Use fire-like damage types properly

This commit is contained in:
Elias Fleckenstein 2021-04-14 17:20:51 +02:00
parent e74838136d
commit 875bb3db84
5 changed files with 10 additions and 7 deletions

@ -70,10 +70,13 @@ function mcl_damage.get_mcl_damage_reason(mt_reason)
mcl_reason.type = "player"
end
end
elseif mt_reason.type == "node_damage" then
if minetest.get_item_group(reason.node or "", "fire_damage") > 0 then
elseif mt_reason.type == "node_damage" and mt_reason.node then
if minetest.get_item_group(mt_reason.node, "fire") > 0 then
mcl_reason.type = "in_fire"
end
if minetest.get_item_group(mt_reason.node, "lava") > 0 then
mcl_reason.type = "lava"
end
end
for key, value in pairs(mt_reason) do

@ -106,7 +106,7 @@ function mcl_burning.damage(obj)
end
if do_damage then
mcl_util.deal_damage(obj, 1, {type = "in_fire"})
mcl_util.deal_damage(obj, 1, {type = "on_fire"})
end
end

@ -203,7 +203,7 @@ minetest.register_node("mcl_fire:fire", {
sunlight_propagates = true,
damage_per_second = 1,
_mcl_node_death_message = fire_death_messages,
groups = {fire = 1, dig_immediate = 3, not_in_creative_inventory = 1, dig_by_piston=1, destroys_items=1, set_on_fire=8, fire_damage=1},
groups = {fire = 1, dig_immediate = 3, not_in_creative_inventory = 1, dig_by_piston=1, destroys_items=1, set_on_fire=8},
floodable = true,
on_flood = function(pos, oldnode, newnode)
if get_item_group(newnode.name, "water") ~= 0 then
@ -334,7 +334,7 @@ minetest.register_node("mcl_fire:eternal_fire", {
sunlight_propagates = true,
damage_per_second = 1,
_mcl_node_death_message = fire_death_messages,
groups = {fire = 1, dig_immediate = 3, not_in_creative_inventory = 1, dig_by_piston = 1, destroys_items = 1, set_on_fire=8, fire_damage=1},
groups = {fire = 1, dig_immediate = 3, not_in_creative_inventory = 1, dig_by_piston = 1, destroys_items = 1, set_on_fire=8},
floodable = true,
on_flood = function(pos, oldnode, newnode)
if get_item_group(newnode.name, "water") ~= 0 then

@ -114,7 +114,7 @@ minetest.register_node("mcl_nether:magma", {
if mod_death_messages then
mcl_death_messages.player_damage(player, S("@1 stood too long on a magma block.", player:get_player_name()))
end
player:set_hp(player:get_hp() - 1, { type = "punch", from = "mod" })
mcl_util.deal_damage(player, 1, {type = "hot_floor"})
end
end,
_mcl_blast_resistance = 0.5,

@ -456,7 +456,7 @@ minetest.register_globalstep(function(dtime)
if dist < 1.1 or dist_feet < 1.1 then
if player:get_hp() > 0 then
mcl_death_messages.player_damage(player, S("@1 was prickled to death by a cactus.", name))
player:set_hp(player:get_hp() - 1, { _mcl_type = "cactus" })
mcl_util.deal_damage(player, 1, {type = "cactus"})
end
end
end