Skip to content

Commit

Permalink
Change Fire Protection Function (#100)
Browse files Browse the repository at this point in the history
* Tweak Fire Protect

This change tweaks the fire protection function so that it no longer needs to override nodes and hence rely on additional dependencies like ethereal mod.

* Remove ethereal and fire dependencies

Remove fire and ethereal dependencies as they are no longer needed since fire protection doesn't override items inside those mods.

* Re-add Torch Damage

This re-adds torch damage of 1 per second if fire protection is enabled.

* Remove nether dependency

Nether dependency isn't required as well.
  • Loading branch information
tenplus1 authored Feb 5, 2023
1 parent 72970b3 commit dc7fbce
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 18 deletions.
24 changes: 7 additions & 17 deletions 3d_armor/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -477,22 +477,14 @@ minetest.register_globalstep(function(dtime)
end
end)

-- Fire Protection, added by TenPlus1.
if armor.config.fire_protect == true then
-- override any hot nodes that do not already deal damage
for _, row in pairs(armor.fire_nodes) do
if minetest.registered_nodes[row[1]] then
local damage = minetest.registered_nodes[row[1]].damage_per_second
if not damage or damage == 0 then
minetest.override_item(row[1], {damage_per_second = row[3]})
end
end
end
else
print ("[3d_armor] Fire Nodes disabled")
end

if armor.config.fire_protect == true then
-- make torches hurt
minetest.override_item("default:torch", {damage_per_second = 1})
minetest.override_item("default:torch_wall", {damage_per_second = 1})
minetest.override_item("default:torch_ceiling", {damage_per_second = 1})

-- check player damage for any hot nodes we may be protected against
minetest.register_on_player_hpchange(function(player, hp_change, reason)

if reason.type == "node_damage" and reason.node then
Expand All @@ -501,9 +493,7 @@ if armor.config.fire_protect == true then
local name = player:get_player_name()
for _,igniter in pairs(armor.fire_nodes) do
if reason.node == igniter[1] then
if armor.def[name].fire < igniter[2] then
armor:punch(player, "fire")
else
if armor.def[name].fire >= igniter[2] then
hp_change = 0
end
end
Expand Down
2 changes: 1 addition & 1 deletion 3d_armor/mod.conf
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name = 3d_armor
depends = default, player_api
optional_depends = player_monoids, armor_monoid, pova, fire, ethereal, moreores, nether
optional_depends = player_monoids, armor_monoid, pova, moreores
description = Adds craftable armor that is visible to other players.

0 comments on commit dc7fbce

Please sign in to comment.