aboutsummaryrefslogtreecommitdiff
path: root/src/content_sao.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/content_sao.cpp')
-rw-r--r--src/content_sao.cpp36
1 files changed, 16 insertions, 20 deletions
diff --git a/src/content_sao.cpp b/src/content_sao.cpp
index 1edddec7b..d4b3079ec 100644
--- a/src/content_sao.cpp
+++ b/src/content_sao.cpp
@@ -53,7 +53,7 @@ public:
// And never save to disk
bool isStaticAllowed() const
{ return false; }
-
+
static ServerActiveObject* create(ServerEnvironment *env, v3f pos,
const std::string &data)
{
@@ -99,7 +99,7 @@ public:
}
u8 getType() const
{ return ACTIVEOBJECT_TYPE_TEST; }
-
+
static ServerActiveObject* create(ServerEnvironment *env, v3f pos,
const std::string &data)
{
@@ -170,7 +170,7 @@ class ItemSAO : public ServerActiveObject
public:
u8 getType() const
{ return ACTIVEOBJECT_TYPE_ITEM; }
-
+
float getMinimumSavedMovement()
{ return 0.1*BS; }
@@ -212,7 +212,7 @@ public:
if(m_move_interval.step(dtime, interval)==false)
return;
dtime = interval;
-
+
core::aabbox3d<f32> box(-BS/3.,0.0,-BS/3., BS/3.,BS*2./3.,BS/3.);
collisionMoveResult moveresult;
// Apply gravity
@@ -223,13 +223,12 @@ public:
if(m_speed_f.getLength()*dtime > pos_max_d)
m_speed_f *= pos_max_d / (m_speed_f.getLength()*dtime);
v3f pos_f = getBasePosition();
- v3f pos_f_old = pos_f;
v3f accel_f = v3f(0,0,0);
f32 stepheight = 0;
moveresult = collisionMoveSimple(m_env,m_env->getGameDef(),
pos_max_d, box, stepheight, dtime,
pos_f, m_speed_f, accel_f);
-
+
if(send_recommended == false)
return;
@@ -327,7 +326,7 @@ public:
m_itemstring_changed = true;
}
}
-
+
return 0;
}
@@ -392,7 +391,7 @@ LuaEntitySAO::LuaEntitySAO(ServerEnvironment *env, v3f pos,
ServerActiveObject::registerType(getType(), create);
return;
}
-
+
// Initialize something to armor groups
m_armor_groups["fleshy"] = 100;
}
@@ -407,11 +406,11 @@ LuaEntitySAO::~LuaEntitySAO()
void LuaEntitySAO::addedToEnvironment(u32 dtime_s)
{
ServerActiveObject::addedToEnvironment(dtime_s);
-
+
// Create entity from name
m_registered = m_env->getScriptIface()->
luaentity_Add(m_id, m_init_name.c_str());
-
+
if(m_registered){
// Get properties
m_env->getScriptIface()->
@@ -671,10 +670,10 @@ int LuaEntitySAO::punch(v3f dir,
return 0;
}
- // It's best that attachments cannot be punched
+ // It's best that attachments cannot be punched
if(isAttached())
return 0;
-
+
ItemStack *punchitem = NULL;
ItemStack punchitem_static;
if(puncher){
@@ -687,11 +686,11 @@ int LuaEntitySAO::punch(v3f dir,
toolcap,
punchitem,
time_from_last_punch);
-
+
if(result.did_punch)
{
setHP(getHP() - result.damage);
-
+
std::string punchername = "nil";
@@ -701,7 +700,7 @@ int LuaEntitySAO::punch(v3f dir,
actionstream<<getDescription()<<" punched by "
<<punchername<<", damage "<<result.damage
<<" hp, health now "<<getHP()<<" hp"<<std::endl;
-
+
{
std::string str = gob_cmd_punched(result.damage, getHP());
// create message and add to list
@@ -887,7 +886,7 @@ void LuaEntitySAO::sendPosition(bool do_interpolate, bool is_movement_end)
// If the object is attached client-side, don't waste bandwidth sending its position to clients
if(isAttached())
return;
-
+
m_last_sent_move_precision = m_base_position.getDistanceFrom(
m_last_sent_position);
m_last_sent_position_timer = 0;
@@ -1272,7 +1271,7 @@ int PlayerSAO::punch(v3f dir,
ServerActiveObject *puncher,
float time_from_last_punch)
{
- // It's best that attachments cannot be punched
+ // It's best that attachments cannot be punched
if(isAttached())
return 0;
@@ -1488,15 +1487,12 @@ bool PlayerSAO::checkMovementCheat()
*/
float player_max_speed = 0;
- float player_max_speed_up = 0;
if(m_privs.count("fast") != 0){
// Fast speed
player_max_speed = m_player->movement_speed_fast;
- player_max_speed_up = m_player->movement_speed_fast;
} else {
// Normal speed
player_max_speed = m_player->movement_speed_walk;
- player_max_speed_up = m_player->movement_speed_walk;
}
// Tolerance. With the lag pool we shouldn't need it.
//player_max_speed *= 2.5;