summaryrefslogtreecommitdiffstats
path: root/src/Entities
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/Entities/ExpOrb.cpp16
-rw-r--r--src/Entities/Player.cpp9
-rw-r--r--src/Entities/TNTEntity.h8
3 files changed, 23 insertions, 10 deletions
diff --git a/src/Entities/ExpOrb.cpp b/src/Entities/ExpOrb.cpp
index 1e5ee00ce..248fb7278 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));
- if (a_ClosestPlayer)
+ cPlayer * a_ClosestPlayer(m_World->FindClosestPlayer(Vector3f(GetPosition()), 5));
+ if (a_ClosestPlayer != NULL)
{
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)
{
+ 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.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
diff --git a/src/Entities/Player.cpp b/src/Entities/Player.cpp
index 7a5ff5696..85833f31d 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();
@@ -1410,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;
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