Remove useless ABMs
This commit is contained in:
parent
65e8629b16
commit
f673ee9d94
@ -12,6 +12,17 @@ minetest.register_node(":streets:emergencyphone",{
|
||||
clicker:set_hp(6)
|
||||
minetest.log("action",clicker:get_player_name() .. " healed by emergency phone at pos " .. minetest.pos_to_string(pos) .. "")
|
||||
end
|
||||
end,
|
||||
after_place_node = function(pos, placer, itemstack, pointed_thing)
|
||||
local node = minetest.get_node(pos)
|
||||
local node_above = minetest.get_node({x=pos.x,y=pos.y+1,z=pos.z})
|
||||
if node_above.name == "air" then
|
||||
node.name = "infrastructure:emergency_phone_bottom"
|
||||
minetest.set_node(pos, node)
|
||||
pos.y = pos.y+1
|
||||
end
|
||||
node.name = "infrastructure:emergency_phone_top"
|
||||
minetest.set_node(pos, node)
|
||||
end
|
||||
})
|
||||
minetest.register_alias("streets:emergency_phone","streets:emergencyphone")
|
||||
@ -22,4 +33,4 @@ minetest.register_craft({
|
||||
{"wool:orange","default:apple","wool:orange"},
|
||||
{"default:steel_ingot","default:diamondblock","default:steel_ingot"}
|
||||
}
|
||||
})
|
||||
})
|
||||
|
@ -85,23 +85,6 @@
|
||||
})
|
||||
|
||||
minetest.register_alias("infrastructure:emergency_phone", "infrastructure:emergency_phone_top")
|
||||
|
||||
minetest.register_abm({
|
||||
nodenames = {"streets:emergencyphone"},
|
||||
interval = 1,
|
||||
chance = 1,
|
||||
action = function(pos, node)
|
||||
local node = minetest.get_node(pos)
|
||||
local node_above = minetest.get_node({x=pos.x,y=pos.y+1,z=pos.z})
|
||||
if node_above.name == "air" then
|
||||
node.name = "infrastructure:emergency_phone_bottom"
|
||||
minetest.set_node(pos, node)
|
||||
pos.y = pos.y+1
|
||||
end
|
||||
node.name = "infrastructure:emergency_phone_top"
|
||||
minetest.set_node(pos, node)
|
||||
end,
|
||||
})
|
||||
else
|
||||
print("Infrastructure mod: -!- Emergency-Phone is disabled!")
|
||||
end
|
||||
|
@ -1,7 +1,6 @@
|
||||
--[[
|
||||
StreetsMod: inDev Trafficlights
|
||||
]]
|
||||
dofile(streets.modpath .. "/../trafficlight/old2new.lua")
|
||||
|
||||
streets.tlBox = {
|
||||
{-0.1875,-0.5,0.5,0.1875,0.5,0.75}, --Box
|
||||
|
@ -1,58 +0,0 @@
|
||||
--[[
|
||||
StreetsMod: Convert old trafficlights
|
||||
]]
|
||||
minetest.register_node(":streets:trafficlight_bottom", {
|
||||
diggable = false,
|
||||
pointable = false,
|
||||
drawtype = "airlike",
|
||||
description = "I'm an old node, please drop me",
|
||||
groups = {not_in_creative_inventory = 1}
|
||||
})
|
||||
minetest.register_abm({
|
||||
nodenames = {"streets:trafficlight_bottom"},
|
||||
interval = 1,
|
||||
chance = 1,
|
||||
action = function(pos, node)
|
||||
minetest.log("action", "Converting trafficlight at position " .. minetest.pos_to_string(pos))
|
||||
-- Replace controller with distributor
|
||||
pos.y = pos.y - 2
|
||||
minetest.set_node(pos, {name = "streets:digiline_distributor"})
|
||||
-- Change bottom pole
|
||||
pos.y = pos.y + 2
|
||||
minetest.set_node(pos, {name = "streets:bigpole", param2 = 2})
|
||||
-- Change middle pole
|
||||
pos.y = pos.y + 1
|
||||
minetest.set_node(pos, {name = "streets:bigpole", param2 = 2})
|
||||
-- Change the top
|
||||
pos.y = pos.y + 1
|
||||
local fd = minetest.get_node(pos).param2
|
||||
local ch = minetest.get_meta(pos):get_string("channel")
|
||||
minetest.set_node(pos, {name = "streets:bigpole", param2 = 2})
|
||||
-- Place new top
|
||||
if fd == 1 then
|
||||
minetest.set_node({x = pos.x - 1, y = pos.y, z = pos.z}, {name = "streets:trafficlight_top_warn", param2 = fd})
|
||||
local meta = minetest.get_meta({x = pos.x - 1, y = pos.y, z = pos.z})
|
||||
meta:set_string("channel", ch)
|
||||
meta:set_string("state", "warn")
|
||||
meta:set_string("formspec", "field[channel;Channel;${channel}]")
|
||||
elseif fd == 2 then
|
||||
minetest.set_node({x = pos.x, y = pos.y, z = pos.z + 1}, {name = "streets:trafficlight_top_warn", param2 = fd})
|
||||
local meta = minetest.get_meta({x = pos.x, y = pos.y, z = pos.z + 1})
|
||||
meta:set_string("channel", ch)
|
||||
meta:set_string("state", "warn")
|
||||
meta:set_string("formspec", "field[channel;Channel;${channel}]")
|
||||
elseif fd == 3 then
|
||||
minetest.set_node({x = pos.x + 1, y = pos.y, z = pos.z}, {name = "streets:trafficlight_top_warn", param2 = fd})
|
||||
local meta = minetest.get_meta({x = pos.x + 1, y = pos.y, z = pos.z})
|
||||
meta:set_string("channel", ch)
|
||||
meta:set_string("state", "warn")
|
||||
meta:set_string("formspec", "field[channel;Channel;${channel}]")
|
||||
elseif fd == 0 then
|
||||
minetest.set_node({x = pos.x, y = pos.y, z = pos.z - 1}, {name = "streets:trafficlight_top_warn", param2 = fd})
|
||||
local meta = minetest.get_meta({x = pos.x, y = pos.y, z = pos.z - 1})
|
||||
meta:set_string("channel", ch)
|
||||
meta:set_string("state", "warn")
|
||||
meta:set_string("formspec", "field[channel;Channel;${channel}]")
|
||||
end
|
||||
end
|
||||
})
|
Loading…
x
Reference in New Issue
Block a user