forked from MineClone5/MineClone5
Allow drowning damage when drowning in lava.
This commit is contained in:
parent
e1b428dbd1
commit
5db80b3ec5
|
@ -9,14 +9,6 @@ local is_swift = {}
|
||||||
local is_cat = {}
|
local is_cat = {}
|
||||||
local is_fire_proof = {}
|
local is_fire_proof = {}
|
||||||
|
|
||||||
local is_fire_node = { ["mcl_core:lava_flowing"]=true,
|
|
||||||
["mcl_core:lava_source"]=true,
|
|
||||||
["mcl_fire:eternal_fire"]=true,
|
|
||||||
["mcl_fire:fire"]=true,
|
|
||||||
["mcl_nether:magma"]=true,
|
|
||||||
["mcl_nether:nether_lava_source"]=true,
|
|
||||||
["mcl_nether:nether_lava_flowing"]=true,
|
|
||||||
["mcl_nether:nether_lava_source"]=true}
|
|
||||||
|
|
||||||
minetest.register_globalstep(function(dtime)
|
minetest.register_globalstep(function(dtime)
|
||||||
|
|
||||||
|
@ -259,6 +251,16 @@ minetest.register_globalstep(function(dtime)
|
||||||
|
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
|
||||||
|
local is_fire_node = { ["mcl_core:lava_flowing"]=true,
|
||||||
|
["mcl_core:lava_source"]=true,
|
||||||
|
["mcl_fire:eternal_fire"]=true,
|
||||||
|
["mcl_fire:fire"]=true,
|
||||||
|
["mcl_nether:magma"]=true,
|
||||||
|
["mcl_nether:nether_lava_source"]=true,
|
||||||
|
["mcl_nether:nether_lava_flowing"]=true,
|
||||||
|
["mcl_nether:nether_lava_source"]=true}
|
||||||
|
|
||||||
-- Prevent damage to player with Fire Resistance enabled
|
-- Prevent damage to player with Fire Resistance enabled
|
||||||
minetest.register_on_player_hpchange(function(player, hp_change)
|
minetest.register_on_player_hpchange(function(player, hp_change)
|
||||||
|
|
||||||
|
@ -269,7 +271,7 @@ minetest.register_on_player_hpchange(function(player, hp_change)
|
||||||
local player_info = mcl_playerinfo[player:get_player_name()]
|
local player_info = mcl_playerinfo[player:get_player_name()]
|
||||||
|
|
||||||
if is_fire_node[player_info.node_head] or is_fire_node[player_info.node_feet] or is_fire_node[player_info.node_stand] then
|
if is_fire_node[player_info.node_head] or is_fire_node[player_info.node_feet] or is_fire_node[player_info.node_stand] then
|
||||||
if player:get_breath() == 0 then -- probably drowning
|
if player:get_breath() == 0 and hp_change > -4 then -- probably drowning
|
||||||
return -1
|
return -1
|
||||||
else
|
else
|
||||||
return 0
|
return 0
|
||||||
|
|
Loading…
Reference in New Issue