0
0
Fork 0

Make players suffocate only in opaque blocks

This commit is contained in:
Wuzzy 2017-03-14 04:33:11 +01:00
parent 36e6c78eeb
commit decb9d6870
1 changed files with 3 additions and 4 deletions

View File

@ -91,16 +91,15 @@ minetest.register_globalstep(function(dtime)
-- TODO: Resolve conflict -- TODO: Resolve conflict
player:set_physics_override(def.speed, def.jump, def.gravity) player:set_physics_override(def.speed, def.jump, def.gravity)
-- Is player suffocating inside node? (Only for solid full cube type nodes without damage -- Is player suffocating inside node? (Only for solid full opaque cube type nodes
-- and without group disable_suffocation=1.) -- without group disable_suffocation=1)
local ndef = minetest.registered_nodes[playerplus[name].nod_head] local ndef = minetest.registered_nodes[playerplus[name].nod_head]
if (ndef.walkable == nil or ndef.walkable == true) if (ndef.walkable == nil or ndef.walkable == true)
and (ndef.drowning == nil or ndef.drowning == 0)
and (ndef.damage_per_second == nil or ndef.damage_per_second <= 0)
and (ndef.collision_box == nil or ndef.collision_box.type == "regular") and (ndef.collision_box == nil or ndef.collision_box.type == "regular")
and (ndef.node_box == nil or ndef.node_box.type == "regular") and (ndef.node_box == nil or ndef.node_box.type == "regular")
and (ndef.groups.disable_suffocation ~= 1) and (ndef.groups.disable_suffocation ~= 1)
and (ndef.groups.opaque == 1)
-- Check privilege, too -- Check privilege, too
and (not minetest.check_player_privs(name, {noclip = true})) then and (not minetest.check_player_privs(name, {noclip = true})) then
if player:get_hp() > 0 then if player:get_hp() > 0 then