mirror of
https://github.com/minetest/minetest.git
synced 2024-11-27 10:03:45 +01:00
Cleanup LocalPlayer::applyControl
* Use Environment interface instead of ClientEnvironemnt * Don't create slippery variable and then re-affect it * itemgroup_get return a int, properly test != 0 to be clearer
This commit is contained in:
parent
2ea26e655d
commit
d65d6160d8
@ -444,7 +444,7 @@ void LocalPlayer::move(f32 dtime, Environment *env, f32 pos_max_d)
|
|||||||
move(dtime, env, pos_max_d, NULL);
|
move(dtime, env, pos_max_d, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
void LocalPlayer::applyControl(float dtime, ClientEnvironment *env)
|
void LocalPlayer::applyControl(float dtime, Environment *env)
|
||||||
{
|
{
|
||||||
// Clear stuff
|
// Clear stuff
|
||||||
swimming_vertical = false;
|
swimming_vertical = false;
|
||||||
@ -660,11 +660,10 @@ void LocalPlayer::applyControl(float dtime, ClientEnvironment *env)
|
|||||||
else
|
else
|
||||||
incH = incV = movement_acceleration_default * BS * dtime;
|
incH = incV = movement_acceleration_default * BS * dtime;
|
||||||
|
|
||||||
INodeDefManager *nodemgr = env->getGameDef()->ndef();
|
const INodeDefManager *nodemgr = env->getGameDef()->ndef();
|
||||||
Map *map = &env->getMap();
|
Map *map = &env->getMap();
|
||||||
bool slippery = false;
|
|
||||||
const ContentFeatures &f = nodemgr->get(map->getNodeNoEx(getStandingNodePos()));
|
const ContentFeatures &f = nodemgr->get(map->getNodeNoEx(getStandingNodePos()));
|
||||||
slippery = itemgroup_get(f.groups, "slippery");
|
bool slippery = (itemgroup_get(f.groups, "slippery") != 0);
|
||||||
// Accelerate to target speed with maximum increment
|
// Accelerate to target speed with maximum increment
|
||||||
accelerateHorizontal(speedH * physics_override_speed,
|
accelerateHorizontal(speedH * physics_override_speed,
|
||||||
incH * physics_override_speed, slippery);
|
incH * physics_override_speed, slippery);
|
||||||
|
@ -79,7 +79,7 @@ public:
|
|||||||
void old_move(f32 dtime, Environment *env, f32 pos_max_d,
|
void old_move(f32 dtime, Environment *env, f32 pos_max_d,
|
||||||
std::vector<CollisionInfo> *collision_info);
|
std::vector<CollisionInfo> *collision_info);
|
||||||
|
|
||||||
void applyControl(float dtime, ClientEnvironment *env);
|
void applyControl(float dtime, Environment *env);
|
||||||
|
|
||||||
v3s16 getStandingNodePos();
|
v3s16 getStandingNodePos();
|
||||||
v3s16 getFootstepNodePos();
|
v3s16 getFootstepNodePos();
|
||||||
|
Loading…
Reference in New Issue
Block a user