mirror of
https://github.com/minetest/minetest.git
synced 2024-11-23 08:03:45 +01:00
Add disable_jump check for the player's feet
This commit is contained in:
parent
65a6a316d0
commit
34862a6442
@ -1666,6 +1666,7 @@ to games.
|
|||||||
* `2`: the node always gets the digging time 0.5 seconds (rail, sign)
|
* `2`: the node always gets the digging time 0.5 seconds (rail, sign)
|
||||||
* `3`: the node always gets the digging time 0 seconds (torch)
|
* `3`: the node always gets the digging time 0 seconds (torch)
|
||||||
* `disable_jump`: Player (and possibly other things) cannot jump from node
|
* `disable_jump`: Player (and possibly other things) cannot jump from node
|
||||||
|
or if their feet are in the node. Note: not supported for `new_move = false`
|
||||||
* `fall_damage_add_percent`: damage speed = `speed * (1 + value/100)`
|
* `fall_damage_add_percent`: damage speed = `speed * (1 + value/100)`
|
||||||
* `falling_node`: if there is no walkable block under the node it will fall
|
* `falling_node`: if there is no walkable block under the node it will fall
|
||||||
* `float`: the node will not fall through liquids
|
* `float`: the node will not fall through liquids
|
||||||
|
@ -56,11 +56,18 @@ minetest.register_node("testnodes:attached_wallmounted", {
|
|||||||
minetest.register_node("testnodes:nojump", {
|
minetest.register_node("testnodes:nojump", {
|
||||||
description = S("Non-jumping Node"),
|
description = S("Non-jumping Node"),
|
||||||
groups = {disable_jump=1, dig_immediate=3},
|
groups = {disable_jump=1, dig_immediate=3},
|
||||||
|
|
||||||
|
|
||||||
tiles = {"testnodes_nojump_top.png", "testnodes_nojump_side.png"},
|
tiles = {"testnodes_nojump_top.png", "testnodes_nojump_side.png"},
|
||||||
})
|
})
|
||||||
|
|
||||||
|
-- Jump disabled plant
|
||||||
|
minetest.register_node("testnodes:nojump_walkable", {
|
||||||
|
description = S("Non-jumping Plant Node"),
|
||||||
|
drawtype = "plantlike",
|
||||||
|
groups = {disable_jump=1, dig_immediate=3},
|
||||||
|
walkable = false,
|
||||||
|
tiles = {"testnodes_nojump_top.png"},
|
||||||
|
})
|
||||||
|
|
||||||
-- Climbable up and down with jump and sneak keys
|
-- Climbable up and down with jump and sneak keys
|
||||||
minetest.register_node("testnodes:climbable", {
|
minetest.register_node("testnodes:climbable", {
|
||||||
description = S("Climbable Node"),
|
description = S("Climbable Node"),
|
||||||
|
@ -436,9 +436,11 @@ void LocalPlayer::move(f32 dtime, Environment *env, f32 pos_max_d,
|
|||||||
Check properties of the node on which the player is standing
|
Check properties of the node on which the player is standing
|
||||||
*/
|
*/
|
||||||
const ContentFeatures &f = nodemgr->get(map->getNode(m_standing_node));
|
const ContentFeatures &f = nodemgr->get(map->getNode(m_standing_node));
|
||||||
|
const ContentFeatures &f1 = nodemgr->get(map->getNode(m_standing_node + v3s16(0, 1, 0)));
|
||||||
|
|
||||||
// Determine if jumping is possible
|
// Determine if jumping is possible
|
||||||
m_disable_jump = itemgroup_get(f.groups, "disable_jump");
|
m_disable_jump = itemgroup_get(f.groups, "disable_jump") ||
|
||||||
|
itemgroup_get(f1.groups, "disable_jump");
|
||||||
m_can_jump = ((touching_ground && !is_climbing) || sneak_can_jump) && !m_disable_jump;
|
m_can_jump = ((touching_ground && !is_climbing) || sneak_can_jump) && !m_disable_jump;
|
||||||
|
|
||||||
// Jump key pressed while jumping off from a bouncy block
|
// Jump key pressed while jumping off from a bouncy block
|
||||||
|
Loading…
Reference in New Issue
Block a user