1
0
Fork 0

Use fire-like damage types properly

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

View File

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

View File

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

View File

@ -203,7 +203,7 @@ minetest.register_node("mcl_fire:fire", {
sunlight_propagates = true, sunlight_propagates = true,
damage_per_second = 1, damage_per_second = 1,
_mcl_node_death_message = fire_death_messages, _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, floodable = true,
on_flood = function(pos, oldnode, newnode) on_flood = function(pos, oldnode, newnode)
if get_item_group(newnode.name, "water") ~= 0 then if get_item_group(newnode.name, "water") ~= 0 then
@ -334,7 +334,7 @@ minetest.register_node("mcl_fire:eternal_fire", {
sunlight_propagates = true, sunlight_propagates = true,
damage_per_second = 1, damage_per_second = 1,
_mcl_node_death_message = fire_death_messages, _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, floodable = true,
on_flood = function(pos, oldnode, newnode) on_flood = function(pos, oldnode, newnode)
if get_item_group(newnode.name, "water") ~= 0 then if get_item_group(newnode.name, "water") ~= 0 then

View File

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

View File

@ -456,7 +456,7 @@ minetest.register_globalstep(function(dtime)
if dist < 1.1 or dist_feet < 1.1 then if dist < 1.1 or dist_feet < 1.1 then
if player:get_hp() > 0 then if player:get_hp() > 0 then
mcl_death_messages.player_damage(player, S("@1 was prickled to death by a cactus.", name)) 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 end
end end