mirror of
https://github.com/Sokomine/cottages.git
synced 2025-07-04 09:00:21 +02:00
handle interation w/ explosions
This commit is contained in:
@ -434,6 +434,10 @@ function anvil.preserve_metadata(pos, oldnode, oldmeta, drops)
|
||||
return drops
|
||||
end
|
||||
|
||||
function anvil.on_destruct(pos)
|
||||
anvil.clear_entity(pos)
|
||||
end
|
||||
|
||||
cottages.api.register_machine("cottages:anvil", {
|
||||
description = S("anvil"),
|
||||
drawtype = "nodebox",
|
||||
@ -468,6 +472,8 @@ cottages.api.register_machine("cottages:anvil", {
|
||||
allow_metadata_inventory_move = anvil.allow_metadata_inventory_move,
|
||||
allow_metadata_inventory_put = anvil.allow_metadata_inventory_put,
|
||||
allow_metadata_inventory_take = anvil.allow_metadata_inventory_take,
|
||||
|
||||
on_destruct = anvil.on_destruct,
|
||||
})
|
||||
|
||||
-- clear hud info
|
||||
|
@ -4,11 +4,15 @@ local deserialize = minetest.deserialize
|
||||
local serialize = minetest.serialize
|
||||
|
||||
minetest.register_entity("cottages:anvil_item", {
|
||||
hp_max = 1,
|
||||
visual = "wielditem",
|
||||
visual_size = {x = .33, y = .33},
|
||||
collisionbox = {0, 0, 0, 0, 0, 0},
|
||||
physical = false,
|
||||
initial_properties = {
|
||||
hp_max = 1,
|
||||
visual = "wielditem",
|
||||
visual_size = {x = .33, y = .33},
|
||||
collisionbox = {0, 0, 0, 0, 0, 0},
|
||||
physical = false,
|
||||
collide_with_objects = false,
|
||||
pointable = false,
|
||||
},
|
||||
|
||||
get_staticdata = function(self)
|
||||
return serialize({self.pos, self.item})
|
||||
@ -34,6 +38,11 @@ minetest.register_entity("cottages:anvil_item", {
|
||||
self.item = item
|
||||
|
||||
obj:set_properties({wield_item = item})
|
||||
obj:set_armor_groups({immortal = 1})
|
||||
end,
|
||||
|
||||
on_blast = function(self, damage)
|
||||
return false, false, {}
|
||||
end,
|
||||
})
|
||||
|
||||
|
Reference in New Issue
Block a user