1
0
Fork 0

[mcl_falling_nodes] fix warnings

This commit is contained in:
AFCMS 2021-05-25 00:46:39 +02:00
parent fddaacdeae
commit dd3b5a98ae
6 changed files with 6 additions and 31 deletions

View File

@ -1,7 +1,4 @@
local S = minetest.get_translator("mcl_falling_nodes") local function get_falling_depth(self)
local has_mcl_armor = minetest.get_modpath("mcl_armor")
local get_falling_depth = function(self)
if not self._startpos then if not self._startpos then
-- Fallback -- Fallback
self._startpos = self.object:get_pos() self._startpos = self.object:get_pos()
@ -9,7 +6,7 @@ local get_falling_depth = function(self)
return self._startpos.y - vector.round(self.object:get_pos()).y return self._startpos.y - vector.round(self.object:get_pos()).y
end end
local deal_falling_damage = function(self, dtime) local function deal_falling_damage(self, dtime)
if minetest.get_item_group(self.node.name, "falling_node_damage") == 0 then if minetest.get_item_group(self.node.name, "falling_node_damage") == 0 then
return return
end end
@ -38,7 +35,7 @@ local deal_falling_damage = function(self, dtime)
inv:set_stack("armor", 2, helmet) inv:set_stack("armor", 2, helmet)
end end
end end
local deathmsg, dmg_type local dmg_type
if minetest.get_item_group(self.node.name, "anvil") ~= 0 then if minetest.get_item_group(self.node.name, "anvil") ~= 0 then
dmg_type = "anvil" dmg_type = "anvil"
else else
@ -60,10 +57,8 @@ minetest.register_entity(":__builtin:falling_node", {
collide_with_objects = false, collide_with_objects = false,
collisionbox = {-0.5, -0.5, -0.5, 0.5, 0.5, 0.5}, collisionbox = {-0.5, -0.5, -0.5, 0.5, 0.5, 0.5},
}, },
node = {}, node = {},
meta = {}, meta = {},
set_node = function(self, node, meta) set_node = function(self, node, meta)
local def = minetest.registered_nodes[node.name] local def = minetest.registered_nodes[node.name]
-- Change falling node if definition tells us to -- Change falling node if definition tells us to
@ -90,7 +85,6 @@ minetest.register_entity(":__builtin:falling_node", {
glow = glow, glow = glow,
}) })
end, end,
get_staticdata = function(self) get_staticdata = function(self)
local meta = self.meta local meta = self.meta
-- Workaround: Save inventory seperately from metadata. -- Workaround: Save inventory seperately from metadata.
@ -111,7 +105,6 @@ minetest.register_entity(":__builtin:falling_node", {
} }
return minetest.serialize(ds) return minetest.serialize(ds)
end, end,
on_activate = function(self, staticdata) on_activate = function(self, staticdata)
self.object:set_armor_groups({immortal = 1}) self.object:set_armor_groups({immortal = 1})
@ -134,7 +127,6 @@ minetest.register_entity(":__builtin:falling_node", {
end end
self._startpos = vector.round(self._startpos) self._startpos = vector.round(self._startpos)
end, end,
on_step = function(self, dtime) on_step = function(self, dtime)
-- Set gravity -- Set gravity
local acceleration = self.object:get_acceleration() local acceleration = self.object:get_acceleration()
@ -186,10 +178,9 @@ minetest.register_entity(":__builtin:falling_node", {
return return
end end
local nd = minetest.registered_nodes[n2.name] local nd = minetest.registered_nodes[n2.name]
if n2.name == "mcl_portals:portal_end" then --if n2.name == "mcl_portals:portal_end" then
-- TODO: Teleport falling node. -- TODO: Teleport falling node.
if (nd and nd.buildable_to == true) or minetest.get_item_group(self.node.name, "crush_after_fall") ~= 0 then
elseif (nd and nd.buildable_to == true) or minetest.get_item_group(self.node.name, "crush_after_fall") ~= 0 then
-- Replace destination node if it's buildable to -- Replace destination node if it's buildable to
minetest.remove_node(np) minetest.remove_node(np)
-- Run script hook -- Run script hook
@ -256,7 +247,6 @@ minetest.register_entity(":__builtin:falling_node", {
self.object:set_pos(npos) self.object:set_pos(npos)
end end
end end
deal_falling_damage(self, dtime) deal_falling_damage(self, dtime)
end end
}) })

View File

@ -1,3 +0,0 @@
# textdomain: mcl_falling_nodes
@1 was smashed by a falling anvil.=@1 wurde von einem fallenden Amboss zerschmettert.
@1 was smashed by a falling block.=@1 wurde von einem fallenden Block zerschmettert.

View File

@ -1,3 +0,0 @@
# textdomain: mcl_falling_nodes
@1 was smashed by a falling anvil.=@1 fue aplastado por la caída de un yunque.
@1 was smashed by a falling block.=@1 fue aplastado por la caída de un bloque.

View File

@ -1,3 +0,0 @@
# textdomain: mcl_falling_nodes
@1 was smashed by a falling anvil.=@1 a été écrasé par une enclume qui tombait.
@1 was smashed by a falling block.=@1 a été écrasé par un bloc qui tombait.

View File

@ -1,3 +0,0 @@
# textdomain: mcl_falling_nodes
@1 was smashed by a falling anvil.=@1 придавило падающей наковальней.
@1 was smashed by a falling block.=@1 раздавило падающим блоком.

View File

@ -1,3 +0,0 @@
# textdomain: mcl_falling_nodes
@1 was smashed by a falling anvil.=
@1 was smashed by a falling block.=