Move the "boom barrier" to animated textures and make the last gate light stay on solid
This commit is contained in:
parent
4a3a3f40be
commit
08a391e4cc
@ -25,8 +25,10 @@
|
||||
if dir == "x+" then
|
||||
for i = 1, 10 do
|
||||
pos.x = pos.x + 1
|
||||
if (string.match(minetest.env:get_node(pos).name, "infrastructure:boom_barrier_arm_h_bright")
|
||||
or string.match(minetest.env:get_node(pos).name, "infrastructure:boom_barrier_arm_h_dark")) == nil then
|
||||
if (string.match(minetest.env:get_node(pos).name, "infrastructure:boom_barrier_arm_h_lightfirst")
|
||||
or string.match(minetest.env:get_node(pos).name, "infrastructure:boom_barrier_arm_h_end")
|
||||
or string.match(minetest.env:get_node(pos).name, "infrastructure:boom_barrier_arm_h_darkfirst")) == nil then
|
||||
pos.x = pos.x - 1
|
||||
break
|
||||
end
|
||||
minetest.env:remove_node(pos)
|
||||
@ -36,8 +38,9 @@
|
||||
elseif dir == "x-" then
|
||||
for i = 1, 10 do
|
||||
pos.x = pos.x - 1
|
||||
if (string.match(minetest.env:get_node(pos).name, "infrastructure:boom_barrier_arm_h_bright")
|
||||
or string.match(minetest.env:get_node(pos).name, "infrastructure:boom_barrier_arm_h_dark")) == nil then
|
||||
if (string.match(minetest.env:get_node(pos).name, "infrastructure:boom_barrier_arm_h_lightfirst")
|
||||
or string.match(minetest.env:get_node(pos).name, "infrastructure:boom_barrier_arm_h_end")
|
||||
or string.match(minetest.env:get_node(pos).name, "infrastructure:boom_barrier_arm_h_darkfirst")) == nil then
|
||||
break
|
||||
end
|
||||
minetest.env:remove_node(pos)
|
||||
@ -47,8 +50,9 @@
|
||||
elseif dir == "z+" then
|
||||
for i = 1, 10 do
|
||||
pos.z = pos.z + 1
|
||||
if (string.match(minetest.env:get_node(pos).name, "infrastructure:boom_barrier_arm_h_bright")
|
||||
or string.match(minetest.env:get_node(pos).name, "infrastructure:boom_barrier_arm_h_dark")) == nil then
|
||||
if (string.match(minetest.env:get_node(pos).name, "infrastructure:boom_barrier_arm_h_lightfirst")
|
||||
or string.match(minetest.env:get_node(pos).name, "infrastructure:boom_barrier_arm_h_end")
|
||||
or string.match(minetest.env:get_node(pos).name, "infrastructure:boom_barrier_arm_h_darkfirst")) == nil then
|
||||
break
|
||||
end
|
||||
minetest.env:remove_node(pos)
|
||||
@ -58,8 +62,9 @@
|
||||
elseif dir == "z-" then
|
||||
for i = 1, 10 do
|
||||
pos.z = pos.z - 1
|
||||
if (string.match(minetest.env:get_node(pos).name, "infrastructure:boom_barrier_arm_h_bright")
|
||||
or string.match(minetest.env:get_node(pos).name, "infrastructure:boom_barrier_arm_h_dark")) == nil then
|
||||
if (string.match(minetest.env:get_node(pos).name, "infrastructure:boom_barrier_arm_h_lightfirst")
|
||||
or string.match(minetest.env:get_node(pos).name, "infrastructure:boom_barrier_arm_h_end")
|
||||
or string.match(minetest.env:get_node(pos).name, "infrastructure:boom_barrier_arm_h_darkfirst")) == nil then
|
||||
break
|
||||
end
|
||||
minetest.env:remove_node(pos)
|
||||
@ -78,9 +83,12 @@
|
||||
end
|
||||
minetest.env:remove_node(pos)
|
||||
if i % 2 == 1 then
|
||||
node.name = "infrastructure:boom_barrier_arm_h_bright"
|
||||
node.name = "infrastructure:boom_barrier_arm_h_lightfirst"
|
||||
else
|
||||
node.name = "infrastructure:boom_barrier_arm_h_dark"
|
||||
node.name = "infrastructure:boom_barrier_arm_h_darkfirst"
|
||||
end
|
||||
if minetest.get_node({x=pos.x,y=pos.y+1,z=pos.z}).name ~= "infrastructure:boom_barrier_arm_v" then
|
||||
node.name = "infrastructure:boom_barrier_arm_h_end"
|
||||
end
|
||||
minetest.env:add_node({x=pos.x+i, y=pos.y-i, z=pos.z}, node)
|
||||
end
|
||||
@ -92,9 +100,12 @@
|
||||
end
|
||||
minetest.env:remove_node(pos)
|
||||
if i % 2 == 1 then
|
||||
node.name = "infrastructure:boom_barrier_arm_h_bright"
|
||||
node.name = "infrastructure:boom_barrier_arm_h_lightfirst"
|
||||
else
|
||||
node.name = "infrastructure:boom_barrier_arm_h_dark"
|
||||
node.name = "infrastructure:boom_barrier_arm_h_darkfirst"
|
||||
end
|
||||
if minetest.get_node({x=pos.x,y=pos.y+1,z=pos.z}).name ~= "infrastructure:boom_barrier_arm_v" then
|
||||
node.name = "infrastructure:boom_barrier_arm_h_end"
|
||||
end
|
||||
minetest.env:add_node({x=pos.x-i, y=pos.y-i, z=pos.z}, node)
|
||||
end
|
||||
@ -106,9 +117,12 @@
|
||||
end
|
||||
minetest.env:remove_node(pos)
|
||||
if i % 2 == 1 then
|
||||
node.name = "infrastructure:boom_barrier_arm_h_bright"
|
||||
node.name = "infrastructure:boom_barrier_arm_h_lightfirst"
|
||||
else
|
||||
node.name = "infrastructure:boom_barrier_arm_h_dark"
|
||||
node.name = "infrastructure:boom_barrier_arm_h_darkfirst"
|
||||
end
|
||||
if minetest.get_node({x=pos.x,y=pos.y+1,z=pos.z}).name ~= "infrastructure:boom_barrier_arm_v" then
|
||||
node.name = "infrastructure:boom_barrier_arm_h_end"
|
||||
end
|
||||
minetest.env:add_node({x=pos.x, y=pos.y-i, z=pos.z+i}, node)
|
||||
end
|
||||
@ -120,9 +134,12 @@
|
||||
end
|
||||
minetest.env:remove_node(pos)
|
||||
if i % 2 == 1 then
|
||||
node.name = "infrastructure:boom_barrier_arm_h_bright"
|
||||
node.name = "infrastructure:boom_barrier_arm_h_lightfirst"
|
||||
else
|
||||
node.name = "infrastructure:boom_barrier_arm_h_dark"
|
||||
node.name = "infrastructure:boom_barrier_arm_h_darkfirst"
|
||||
end
|
||||
if minetest.get_node({x=pos.x,y=pos.y+1,z=pos.z}).name ~= "infrastructure:boom_barrier_arm_v" then
|
||||
node.name = "infrastructure:boom_barrier_arm_h_end"
|
||||
end
|
||||
minetest.env:add_node({x=pos.x, y=pos.y-i, z=pos.z-i}, node)
|
||||
end
|
||||
@ -130,20 +147,6 @@
|
||||
end
|
||||
end
|
||||
|
||||
minetest.register_abm( {
|
||||
nodenames = {"infrastructure:boom_barrier_arm_h_bright", "infrastructure:boom_barrier_arm_h_dark"},
|
||||
interval = 1,
|
||||
chance = 1,
|
||||
action = function(pos, node)
|
||||
local node = minetest.env:get_node(pos)
|
||||
if node.name == "infrastructure:boom_barrier_arm_h_bright" then
|
||||
minetest.swap_node(pos, {name = "infrastructure:boom_barrier_arm_h_dark", param2 = node.param2})
|
||||
elseif node.name == "infrastructure:boom_barrier_arm_h_dark" then
|
||||
minetest.swap_node(pos, {name = "infrastructure:boom_barrier_arm_h_bright", param2 = node.param2})
|
||||
end
|
||||
end
|
||||
})
|
||||
|
||||
minetest.register_node("infrastructure:boom_barrier_top_h", {
|
||||
description = "Boom barrier mechanism",
|
||||
tiles = {
|
||||
@ -369,13 +372,13 @@
|
||||
},
|
||||
})
|
||||
|
||||
minetest.register_node("infrastructure:boom_barrier_arm_h_bright", {
|
||||
minetest.register_node("infrastructure:boom_barrier_arm_h_lightfirst", {
|
||||
description = "Boom barrier arm",
|
||||
tiles = {
|
||||
"infrastructure_boom_barrier_arm_h_top.png",
|
||||
"infrastructure_boom_barrier_arm_h_bottom_front_back.png",
|
||||
"infrastructure_boom_barrier_arm_h_left_right_bright.png",
|
||||
"infrastructure_boom_barrier_arm_h_left_right_bright.png",
|
||||
{name="infrastructure_boom_barrier_arm_h_anim_lightfirst.png",animation={type="vertical_frames", aspect_w=64, aspect_h=64, length=1.5}},
|
||||
{name="infrastructure_boom_barrier_arm_h_anim_lightfirst.png",animation={type="vertical_frames", aspect_w=64, aspect_h=64, length=1.5}},
|
||||
"infrastructure_boom_barrier_arm_h_bottom_front_back.png",
|
||||
"infrastructure_boom_barrier_arm_h_bottom_front_back.png"
|
||||
},
|
||||
@ -402,12 +405,12 @@
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_node("infrastructure:boom_barrier_arm_h_dark", {
|
||||
minetest.register_node("infrastructure:boom_barrier_arm_h_darkfirst", {
|
||||
tiles = {
|
||||
"infrastructure_boom_barrier_arm_h_top.png",
|
||||
"infrastructure_boom_barrier_arm_h_bottom_front_back.png",
|
||||
"infrastructure_boom_barrier_arm_h_left_right_dark.png",
|
||||
"infrastructure_boom_barrier_arm_h_left_right_dark.png",
|
||||
{name="infrastructure_boom_barrier_arm_h_anim_darkfirst.png",animation={type="vertical_frames", aspect_w=64, aspect_h=64, length=1.5}},
|
||||
{name="infrastructure_boom_barrier_arm_h_anim_darkfirst.png",animation={type="vertical_frames", aspect_w=64, aspect_h=64, length=1.5}},
|
||||
"infrastructure_boom_barrier_arm_h_bottom_front_back.png",
|
||||
"infrastructure_boom_barrier_arm_h_bottom_front_back.png"
|
||||
},
|
||||
@ -415,7 +418,7 @@
|
||||
paramtype = "light",
|
||||
paramtype2 = "facedir",
|
||||
groups = {cracky = 1},
|
||||
drop = "infrastructure:boom_barrier_arm_h_bright",
|
||||
drop = "infrastructure:boom_barrier_arm_h_lightfirst",
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
@ -434,6 +437,41 @@
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_node("infrastructure:boom_barrier_arm_h_end", {
|
||||
tiles = {
|
||||
"infrastructure_boom_barrier_arm_h_top.png",
|
||||
"infrastructure_boom_barrier_arm_h_bottom_front_back.png",
|
||||
"infrastructure_boom_barrier_arm_h_left_right_bright.png",
|
||||
"infrastructure_boom_barrier_arm_h_left_right_bright.png",
|
||||
"infrastructure_boom_barrier_arm_h_bottom_front_back.png",
|
||||
"infrastructure_boom_barrier_arm_h_bottom_front_back.png"
|
||||
},
|
||||
drawtype = "nodebox",
|
||||
paramtype = "light",
|
||||
paramtype2 = "facedir",
|
||||
groups = {cracky = 1},
|
||||
drop = "infrastructure:boom_barrier_arm_h_lightfirst",
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
{-1/8, -1/2, -1/2, 1/8, -7/16, 1/2},
|
||||
{-1/8, -5/16, -1/2, 1/8, -1/4, 1/2},
|
||||
{-1/8, -1/2, -1/2, -1/16, -1/4, 1/2},
|
||||
{1/16, -1/2, -1/2, 1/8, -1/4, 1/2},
|
||||
{0, -1/4, -1/8, 0, 0, 1/8}
|
||||
}
|
||||
},
|
||||
selection_box = {
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
{-1/8, -1/2, -1/2, 1/8, -1/4, 1/2}
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_alias("infrastructure:boom_barrier_arm_h_dark","infrastructure:boom_barrier_arm_h_darkfirst")
|
||||
minetest.register_alias("infrastructure:boom_barrier_arm_h_bright","infrastructure:boom_barrier_arm_h_lightfirst")
|
||||
|
||||
minetest.register_node("infrastructure:boom_barrier_arm_v", {
|
||||
tiles = {
|
||||
"infrastructure_boom_barrier_arm_h_bottom_front_back.png",
|
||||
@ -447,7 +485,7 @@
|
||||
paramtype = "light",
|
||||
paramtype2 = "facedir",
|
||||
groups = {cracky = 1},
|
||||
drop = "infrastructure:boom_barrier_arm_h_bright",
|
||||
drop = "infrastructure:boom_barrier_arm_h_lightfirst",
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
@ -467,4 +505,4 @@
|
||||
})
|
||||
|
||||
minetest.register_alias("infrastructure:boom_barrier_mechanism", "infrastructure:boom_barrier_top_h")
|
||||
minetest.register_alias("infrastructure:boom_barrier_arm", "infrastructure:boom_barrier_arm_h_bright")
|
||||
minetest.register_alias("infrastructure:boom_barrier_arm", "infrastructure:boom_barrier_arm_h_lightfirst")
|
||||
|
Binary file not shown.
After Width: | Height: | Size: 762 B |
Binary file not shown.
After Width: | Height: | Size: 811 B |
Binary file not shown.
Before Width: | Height: | Size: 481 B |
Loading…
x
Reference in New Issue
Block a user