From bba51755d4eae0595e583e2d4e9dfe9093506cff Mon Sep 17 00:00:00 2001 From: STRWarrior Date: Wed, 11 Dec 2013 16:14:08 +0100 Subject: ExpOrbs now move. --- src/Entities/ExpOrb.cpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'src/Entities') diff --git a/src/Entities/ExpOrb.cpp b/src/Entities/ExpOrb.cpp index 1e5ee00ce..83c522a18 100644 --- a/src/Entities/ExpOrb.cpp +++ b/src/Entities/ExpOrb.cpp @@ -40,21 +40,25 @@ void cExpOrb::SpawnOn(cClientHandle & a_Client) void cExpOrb::Tick(float a_Dt, cChunk & a_Chunk) { - cPlayer * a_ClosestPlayer(m_World->FindClosestPlayer(Vector3f(GetPosition()), 4)); + cPlayer * a_ClosestPlayer(m_World->FindClosestPlayer(Vector3f(GetPosition()), 5)); if (a_ClosestPlayer) { Vector3f a_PlayerPos(a_ClosestPlayer->GetPosition()); + a_PlayerPos.y++; Vector3f a_Distance(a_PlayerPos - GetPosition()); - if (a_Distance.Length() < 0.1f) + double Distance(a_Distance.Length()); + if (Distance < 0.1f) { a_ClosestPlayer->DeltaExperience(m_Reward); a_ClosestPlayer->SendExperience(); Destroy(true); } - a_Distance.y = 0; a_Distance.Normalize(); - a_Distance *= 3; + a_Distance *= ((float) (5.5 - Distance)); SetSpeedX( a_Distance.x ); + SetSpeedY( a_Distance.y ); SetSpeedZ( a_Distance.z ); + BroadcastMovementUpdate(); } + HandlePhysics(a_Dt, a_Chunk); } \ No newline at end of file -- cgit v1.2.3 From 39443c63adb600d05dc5ebc961def5b80ccd5ed8 Mon Sep 17 00:00:00 2001 From: STRWarrior Date: Fri, 13 Dec 2013 15:32:25 +0100 Subject: Using "a_ClosestPlayer != NULL" in cExpOrb. --- src/Entities/ExpOrb.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/Entities') diff --git a/src/Entities/ExpOrb.cpp b/src/Entities/ExpOrb.cpp index 83c522a18..27d34f6ed 100644 --- a/src/Entities/ExpOrb.cpp +++ b/src/Entities/ExpOrb.cpp @@ -41,7 +41,7 @@ void cExpOrb::SpawnOn(cClientHandle & a_Client) void cExpOrb::Tick(float a_Dt, cChunk & a_Chunk) { cPlayer * a_ClosestPlayer(m_World->FindClosestPlayer(Vector3f(GetPosition()), 5)); - if (a_ClosestPlayer) + if (a_ClosestPlayer != NULL) { Vector3f a_PlayerPos(a_ClosestPlayer->GetPosition()); a_PlayerPos.y++; -- cgit v1.2.3 From 4e11095441fc98e59611008735949900d72d7465 Mon Sep 17 00:00:00 2001 From: Tiger Wang Date: Sat, 14 Dec 2013 02:02:26 +0000 Subject: Groups.ini and Users.ini are now generated --- src/Entities/Player.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'src/Entities') diff --git a/src/Entities/Player.cpp b/src/Entities/Player.cpp index 7a5ff5696..ff519f890 100644 --- a/src/Entities/Player.cpp +++ b/src/Entities/Player.cpp @@ -1393,7 +1393,12 @@ void cPlayer::LoadPermissionsFromDisk() } else { - LOGWARN("Failed to read the users.ini file. The player will be added only to the Default group."); + LOGWARN("Regenerating users.ini, player %s will be added to the \"Default\" group", m_PlayerName.c_str()); + IniFile.AddHeaderComment(" This is the file in which the group the player belongs to is stored"); + IniFile.AddHeaderComment(" The format is: [PlayerName] | Groups=GroupName"); + + IniFile.SetValue(m_PlayerName, "Groups", "Default"); + IniFile.WriteFile("users.ini"); AddToGroup("Default"); } ResolvePermissions(); -- cgit v1.2.3 From 0aeece7fdaccc8f20e96f9560c4f4c1b5a6bc5cc Mon Sep 17 00:00:00 2001 From: Tiger Wang Date: Sat, 14 Dec 2013 02:40:54 +0000 Subject: Fixes to redstone wire and torches + Wires now power blocks around the block beneath * Torches no longer power off if it is on a linked powered block * Enhanced code, split functions, etc. --- src/Entities/Player.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/Entities') diff --git a/src/Entities/Player.cpp b/src/Entities/Player.cpp index ff519f890..34caa340b 100644 --- a/src/Entities/Player.cpp +++ b/src/Entities/Player.cpp @@ -1415,7 +1415,7 @@ bool cPlayer::LoadFromDisk() LOGINFO("Player %s has permissions:", m_PlayerName.c_str() ); for( PermissionMap::iterator itr = m_ResolvedPermissions.begin(); itr != m_ResolvedPermissions.end(); ++itr ) { - if( itr->second ) LOGINFO("%s", itr->first.c_str() ); + if( itr->second ) LOG(" %s", itr->first.c_str() ); } AString SourceFile; -- cgit v1.2.3 From 4622d4ac09f612614368674b443e4205ede2a416 Mon Sep 17 00:00:00 2001 From: Tiger Wang Date: Sat, 14 Dec 2013 02:54:08 +0000 Subject: Improved player permissions logging --- src/Entities/Player.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/Entities') diff --git a/src/Entities/Player.cpp b/src/Entities/Player.cpp index 34caa340b..85833f31d 100644 --- a/src/Entities/Player.cpp +++ b/src/Entities/Player.cpp @@ -1415,7 +1415,7 @@ bool cPlayer::LoadFromDisk() LOGINFO("Player %s has permissions:", m_PlayerName.c_str() ); for( PermissionMap::iterator itr = m_ResolvedPermissions.begin(); itr != m_ResolvedPermissions.end(); ++itr ) { - if( itr->second ) LOG(" %s", itr->first.c_str() ); + if( itr->second ) LOG(" - %s", itr->first.c_str() ); } AString SourceFile; -- cgit v1.2.3 From 483ef89503605839c05047bebcf3c435262905c9 Mon Sep 17 00:00:00 2001 From: STRWarrior Date: Sat, 14 Dec 2013 12:50:08 +0100 Subject: Fixed not getting XP from mobs. --- src/Entities/ExpOrb.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/Entities') diff --git a/src/Entities/ExpOrb.cpp b/src/Entities/ExpOrb.cpp index 27d34f6ed..248fb7278 100644 --- a/src/Entities/ExpOrb.cpp +++ b/src/Entities/ExpOrb.cpp @@ -49,8 +49,8 @@ void cExpOrb::Tick(float a_Dt, cChunk & a_Chunk) double Distance(a_Distance.Length()); if (Distance < 0.1f) { + LOGD("Player %s picked up an ExpOrb. His reward is %i", a_ClosestPlayer->GetName().c_str(), m_Reward); a_ClosestPlayer->DeltaExperience(m_Reward); - a_ClosestPlayer->SendExperience(); Destroy(true); } a_Distance.Normalize(); -- cgit v1.2.3 From 78aca16d58bcd55abbfc301d0d225532c3a8a899 Mon Sep 17 00:00:00 2001 From: STRWarrior Date: Sat, 14 Dec 2013 16:28:17 +0100 Subject: Exported the cTNTEntity --- src/Entities/TNTEntity.h | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'src/Entities') diff --git a/src/Entities/TNTEntity.h b/src/Entities/TNTEntity.h index eb5040e8a..d1fcae766 100644 --- a/src/Entities/TNTEntity.h +++ b/src/Entities/TNTEntity.h @@ -6,13 +6,14 @@ - +// tolua_begin class cTNTEntity : public cEntity { typedef cEntity super; public: + // tolua_end CLASS_PROTODEF(cTNTEntity); cTNTEntity(double a_X, double a_Y, double a_Z, double a_FuseTimeInSec); @@ -21,11 +22,14 @@ public: // cEntity overrides: virtual void SpawnOn(cClientHandle & a_ClientHandle) override; virtual void Tick(float a_Dt, cChunk & a_Chunk) override; + + double GetCounterTime(void) const { return m_Counter; } // tolua_export + double GetMaxFuseTime(void) const { return m_MaxFuseTime; } // tolua_export protected: double m_Counter; ///< How much time has elapsed since the object was created, in seconds double m_MaxFuseTime; ///< How long the fuse is, in seconds -}; +}; // tolua_export -- cgit v1.2.3