mirror of
https://bitbucket.org/kingarthursteam/cannons.git
synced 2025-04-02 01:22:28 +02:00
fix converting old nodes
This commit is contained in:
34
convert.lua
34
convert.lua
@ -34,8 +34,8 @@ minetest.register_abm({
|
|||||||
node.name = "cannons:bronze_cannon"
|
node.name = "cannons:bronze_cannon"
|
||||||
elseif node.name == "cannons:cannon_mithril" then
|
elseif node.name == "cannons:cannon_mithril" then
|
||||||
node.name = "cannons:cannon_mithril"
|
node.name = "cannons:cannon_mithril"
|
||||||
--else if node.name == "cannons:bronze_canon" then
|
--else if node.name == "cannons:placeholder" then
|
||||||
-- node.name = "cannons:wood_stand_with_bronze_cannon"
|
-- node.name = "cannons:wood_stand_with_placeholder_cannon"
|
||||||
else --dont know what else can happen, but "Der Teufel ist ein Eichhörnchen"
|
else --dont know what else can happen, but "Der Teufel ist ein Eichhörnchen"
|
||||||
node.name = "air"
|
node.name = "air"
|
||||||
end
|
end
|
||||||
@ -43,8 +43,28 @@ minetest.register_abm({
|
|||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
|
--abm to convert single cannonstands
|
||||||
--abm to clean single cannonstands
|
minetest.register_abm({
|
||||||
--minetest.register_alias("name", "convert_to")
|
nodenames = {"cannons:stand","cannons:stand_wood"},
|
||||||
minetest.register_alias("cannons:stand", "default:cobble")
|
interval = 1.0,
|
||||||
minetest.register_alias("cannons:stand_wood", "default:wood")
|
chance = 1,
|
||||||
|
action = function(pos, node, active_object_count, active_object_count_wider)
|
||||||
|
local above_pos = {x= pos.x,y= pos.y+1,z=pos.z}
|
||||||
|
local above = minetest.get_node(above_pos)
|
||||||
|
--if above the stand a cannon...
|
||||||
|
if above.name == "cannons:cannon" or above.name == "cannons:bronze_canon" or above.name == "cannons:mithril_cannon" then
|
||||||
|
--do nothing, let the first abm do all
|
||||||
|
elseif above.name == "air" then
|
||||||
|
minetest.set_node(above_pos, {name = "cannons:wood_stand"})
|
||||||
|
else
|
||||||
|
--replace single stands with a full block, and place the stand above it
|
||||||
|
if node.name == "cannons:stand" then
|
||||||
|
minetest.set_node(pos, {name = "default:cobble"})--replace stand with cobblestone
|
||||||
|
|
||||||
|
else
|
||||||
|
minetest.set_node(pos, {name = "default:wood"})--replace stand with cobblestone
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
Reference in New Issue
Block a user