mirror of
https://git.minetest.land/VoxeLibre/VoxeLibre.git
synced 2024-11-26 04:21:07 +01:00
Add nether fire nodes to fire resistance
This commit is contained in:
parent
c14b5a974b
commit
0ed66727be
1 changed files with 38 additions and 10 deletions
|
@ -9,11 +9,14 @@ local is_swift = {}
|
||||||
local is_cat = {}
|
local is_cat = {}
|
||||||
local is_fire_proof = {}
|
local is_fire_proof = {}
|
||||||
|
|
||||||
local fire_nodes = {["mcl_core:lava_flowing"]=true,
|
local is_fire_node = { ["mcl_core:lava_flowing"]=true,
|
||||||
["mcl_core:lava_source"]=true,
|
["mcl_core:lava_source"]=true,
|
||||||
["mcl_fire:eternal_fire"]=true,
|
["mcl_fire:eternal_fire"]=true,
|
||||||
["mcl_fire:fire"]=true,
|
["mcl_fire:fire"]=true,
|
||||||
["mcl_nether:magma"]=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)
|
||||||
|
|
||||||
|
@ -264,7 +267,7 @@ minetest.register_on_player_hpchange(function(player, hp_change)
|
||||||
-- it's worth noting that you don't take damage from players in this case...
|
-- it's worth noting that you don't take damage from players in this case...
|
||||||
local player_info = mcl_playerinfo[player:get_player_name()]
|
local player_info = mcl_playerinfo[player:get_player_name()]
|
||||||
|
|
||||||
if fire_nodes[player_info.node_head] or fire_nodes[player_info.node_feet] or fire_nodes[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
|
||||||
return 0
|
return 0
|
||||||
else
|
else
|
||||||
return hp_change
|
return hp_change
|
||||||
|
@ -276,6 +279,22 @@ minetest.register_on_player_hpchange(function(player, hp_change)
|
||||||
|
|
||||||
end, true)
|
end, true)
|
||||||
|
|
||||||
|
|
||||||
|
-- -- If a player is punched and is a weak player, damage by 2 additional hearts
|
||||||
|
-- minetest.register_on_player_hpchange(function(player, hp_change)
|
||||||
|
--
|
||||||
|
-- if is_weak[player] and hp_change < 0 then
|
||||||
|
--
|
||||||
|
-- -- prevent weakness from healing the victim
|
||||||
|
-- return math.min(hp_change - 4, 0)
|
||||||
|
--
|
||||||
|
-- else
|
||||||
|
-- return hp_change
|
||||||
|
-- end
|
||||||
|
--
|
||||||
|
-- end, true)
|
||||||
|
|
||||||
|
|
||||||
function mcl_potions._reset_player_effects(player)
|
function mcl_potions._reset_player_effects(player)
|
||||||
|
|
||||||
player = player or player:get_luaentity()
|
player = player or player:get_luaentity()
|
||||||
|
@ -504,10 +523,19 @@ end
|
||||||
|
|
||||||
|
|
||||||
function mcl_potions.weakness_func(player, factor, duration)
|
function mcl_potions.weakness_func(player, factor, duration)
|
||||||
player:set_attribute("weakness", tostring(factor))
|
|
||||||
minetest.after(duration, function() player:set_attribute("weakness", tostring(0)) end )
|
if not is_weak[player] then
|
||||||
for i=1,math.floor(duration) do
|
|
||||||
minetest.after(i, function() mcl_potions._add_spawner(player, "#6600AA") end)
|
is_weak[player] = {dur = duration, timer = 0, factor = factor}
|
||||||
|
|
||||||
|
else
|
||||||
|
|
||||||
|
local victim = is_weak[player]
|
||||||
|
|
||||||
|
victim.factor = factor
|
||||||
|
victim.dur = math.max(duration, victim.dur - victim.timer)
|
||||||
|
victim.timer = 0
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue