Some code style changes for climb_factor stuff
This commit is contained in:
parent
e3aa419695
commit
31adcec585
@ -9842,13 +9842,6 @@ Used by `core.register_node`.
|
||||
|
||||
climbable = false, -- If true, can be climbed on like a ladder
|
||||
|
||||
move_resistance = 0,
|
||||
-- Slows down movement of players through this node (max. 7).
|
||||
-- If this is nil, it will be equal to liquid_viscosity.
|
||||
-- Note: If liquid movement physics apply to the node
|
||||
-- (see `liquid_move_physics`), the movement speed will also be
|
||||
-- affected by the `movement_liquid_*` settings.
|
||||
|
||||
climb_factor = 1.0,
|
||||
-- The speed at which a climbable node can be climbed up and down
|
||||
-- is multiplied by this number. Must not be negative. No effect if
|
||||
@ -9856,6 +9849,13 @@ Used by `core.register_node`.
|
||||
-- Note: The base climbing speed is controlled by the setting
|
||||
-- `movement_speed_climb` multiplied by the physics override `speed_climb`.
|
||||
|
||||
move_resistance = 0,
|
||||
-- Slows down movement of players through this node (max. 7).
|
||||
-- If this is nil, it will be equal to liquid_viscosity.
|
||||
-- Note: If liquid movement physics apply to the node
|
||||
-- (see `liquid_move_physics`), the movement speed will also be
|
||||
-- affected by the `movement_liquid_*` settings.
|
||||
|
||||
buildable_to = false, -- If true, placed nodes can replace this node
|
||||
|
||||
floodable = false,
|
||||
|
@ -316,15 +316,12 @@ void LocalPlayer::move(f32 dtime, Environment *env,
|
||||
if (!(is_valid_position && is_valid_position2)) {
|
||||
is_climbing = false;
|
||||
} else {
|
||||
bool climbable_upper = nodemgr->get(node.getContent()).climbable;
|
||||
bool climbable_lower = nodemgr->get(node2.getContent()).climbable;
|
||||
is_climbing = (climbable_upper || climbable_lower) && !free_move;
|
||||
const ContentFeatures &cf_upper = nodemgr->get(node.getContent());
|
||||
const ContentFeatures &cf_lower = nodemgr->get(node2.getContent());
|
||||
is_climbing = (cf_upper.climbable || cf_lower.climbable) && !free_move;
|
||||
if (is_climbing) {
|
||||
if (climbable_lower) {
|
||||
node_climb_factor = nodemgr->get(node2.getContent()).climb_factor;
|
||||
} else {
|
||||
node_climb_factor = nodemgr->get(node.getContent()).climb_factor;
|
||||
}
|
||||
node_climb_factor = cf_lower.climbable
|
||||
? cf_lower.climb_factor : cf_upper.climb_factor;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -371,6 +371,7 @@ void ContentFeatures::reset()
|
||||
pointable = PointabilityType::POINTABLE;
|
||||
diggable = true;
|
||||
climbable = false;
|
||||
climb_factor = 1.0f;
|
||||
buildable_to = false;
|
||||
floodable = false;
|
||||
rightclickable = true;
|
||||
@ -406,7 +407,6 @@ void ContentFeatures::reset()
|
||||
move_resistance = 0;
|
||||
liquid_move_physics = false;
|
||||
post_effect_color_shaded = false;
|
||||
climb_factor = 1.0f;
|
||||
}
|
||||
|
||||
void ContentFeatures::setAlphaFromLegacy(u8 legacy_alpha)
|
||||
@ -670,7 +670,7 @@ void ContentFeatures::deSerialize(std::istream &is, u16 protocol_version)
|
||||
if (is.eof())
|
||||
throw SerializationError("");
|
||||
climb_factor = ftmp;
|
||||
} catch(SerializationError &e) {};
|
||||
} catch (SerializationError &e) {};
|
||||
}
|
||||
|
||||
#if CHECK_CLIENT_BUILD()
|
||||
|
@ -812,6 +812,8 @@ void read_content_features(lua_State *L, ContentFeatures &f, int index)
|
||||
getboolfield(L, index, "diggable", f.diggable);
|
||||
// Player can climb these
|
||||
getboolfield(L, index, "climbable", f.climbable);
|
||||
// Multiplies climb speed on climbable node
|
||||
getfloatfield(L, index, "climb_factor", f.climb_factor);
|
||||
// Player can build on these
|
||||
getboolfield(L, index, "buildable_to", f.buildable_to);
|
||||
// Liquids flow into and replace node
|
||||
@ -951,8 +953,6 @@ void read_content_features(lua_State *L, ContentFeatures &f, int index)
|
||||
errorstream << "Field \"liquid_move_physics\": Invalid type!" << std::endl;
|
||||
}
|
||||
lua_pop(L, 1);
|
||||
|
||||
getfloatfield(L, index, "climb_factor", f.climb_factor);
|
||||
}
|
||||
|
||||
void push_content_features(lua_State *L, const ContentFeatures &c)
|
||||
|
Loading…
Reference in New Issue
Block a user