X-Git-Url: https://git.lizzy.rs/?a=blobdiff_plain;f=init.lua;fp=init.lua;h=ccbf9bd2d87b30936b258189ffa7a9c2041ae1c9;hb=9d0a43b740deabb71d9d77a037bd1160b16028c0;hp=5eb9208e6289c38ff6b940cf30a6d9e533ace876;hpb=c51608c77087d415e0202fd05b37fb09b2db1d34;p=attacking_nodes.git diff --git a/init.lua b/init.lua index 5eb9208..ccbf9bd 100644 --- a/init.lua +++ b/init.lua @@ -8,11 +8,12 @@ function attacknode:update_node() self.description = def and minetest.strip_colors(def.description or ""):split("\n")[1] or self.node.name self.hp_max = math.floor((def and def._mcl_hardness or 1) * 15) self.object:set_hp(self.hp_max) - self.object:set_properties{nametag = self.description} + self.object:set_properties{nametag = self.description, hp_max = self.hp_max} end function attacknode:set_node(node, meta) fnode.set_node(self, node, meta) + self:update_node() end @@ -21,12 +22,13 @@ function attacknode:on_activate(staticdata) self.object:set_armor_groups({fleshy = 100}) self.object:set_acceleration({x = 0, y = 0, z = 0}) + self:update_node() end function attacknode:on_step(dtime) self.health = self.object:get_hp() - mcl_bossbars.update_boss(self, self.description, "yellow") + mcl_bossbars.update_boss(self.object, self.description, "yellow") local pos = self.object:get_pos() if not self.attack_timer then