From 875bb3db8419d63fbd7295e8147e4d3588d2909a Mon Sep 17 00:00:00 2001 From: Elias Fleckenstein Date: Wed, 14 Apr 2021 17:20:51 +0200 Subject: [PATCH] Use fire-like damage types properly --- mods/CORE/mcl_damage/init.lua | 7 +++++-- mods/ENTITIES/mcl_burning/api.lua | 2 +- mods/ITEMS/mcl_fire/init.lua | 4 ++-- mods/ITEMS/mcl_nether/init.lua | 2 +- mods/PLAYER/mcl_playerplus/init.lua | 2 +- 5 files changed, 10 insertions(+), 7 deletions(-) diff --git a/mods/CORE/mcl_damage/init.lua b/mods/CORE/mcl_damage/init.lua index bd640be430..927ce6771f 100644 --- a/mods/CORE/mcl_damage/init.lua +++ b/mods/CORE/mcl_damage/init.lua @@ -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 diff --git a/mods/ENTITIES/mcl_burning/api.lua b/mods/ENTITIES/mcl_burning/api.lua index 98f315ef98..4f4452a575 100644 --- a/mods/ENTITIES/mcl_burning/api.lua +++ b/mods/ENTITIES/mcl_burning/api.lua @@ -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 diff --git a/mods/ITEMS/mcl_fire/init.lua b/mods/ITEMS/mcl_fire/init.lua index 96c6195aaa..95d76c45d9 100644 --- a/mods/ITEMS/mcl_fire/init.lua +++ b/mods/ITEMS/mcl_fire/init.lua @@ -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 diff --git a/mods/ITEMS/mcl_nether/init.lua b/mods/ITEMS/mcl_nether/init.lua index 4670547675..b6285ceb49 100644 --- a/mods/ITEMS/mcl_nether/init.lua +++ b/mods/ITEMS/mcl_nether/init.lua @@ -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, diff --git a/mods/PLAYER/mcl_playerplus/init.lua b/mods/PLAYER/mcl_playerplus/init.lua index 2001ddbd29..64dbb1088d 100644 --- a/mods/PLAYER/mcl_playerplus/init.lua +++ b/mods/PLAYER/mcl_playerplus/init.lua @@ -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