354 lines
13 KiB
Lua
354 lines
13 KiB
Lua
marsdoors = {}
|
|
|
|
minetest.register_node("marsdoors:door1_closed", {
|
|
description = "Gate (does not support air)",
|
|
drawtype = "mesh",
|
|
mesh = "marsdoors_door1_closed.obj",
|
|
wield_scale = {x=0.5, y=0.5, z=0.5},
|
|
selection_box = {
|
|
type = "fixed",
|
|
fixed = {-2.2, -0.5, -0.5, 3.2, 2.5, 0.5}
|
|
|
|
},
|
|
collision_box = {
|
|
type = "fixed",
|
|
fixed = {{-0.5, -0.5, -0.5, 1.5, 2.5, 0.5},}},
|
|
tiles = {"marsdoors_shieldblock.png","marsdoors_warntape.png","default_obsidian.png","default_obsidian.png","marsdoors_warntape.png","default_obsidian.png"},
|
|
groups = {cracky = 1, level = 2, not_in_creative_inventory=0},
|
|
sounds = default.node_sound_wood_defaults(),
|
|
paramtype = "light",
|
|
paramtype2 = "facedir",
|
|
sunlight_propagates = true,
|
|
is_ground_content = false,
|
|
damage_per_second = 20,
|
|
on_rightclick = function(pos, node, player, itemstack, pointed_thing)
|
|
minetest.swap_node(pos, {name="marsdoors:door1", param2=minetest.get_node(pos).param2})
|
|
minetest.sound_play("marsdoors_door1", {pos=pos, gain = 1, max_hear_distance = 5})
|
|
end,
|
|
})
|
|
|
|
|
|
minetest.register_node("marsdoors:door1", {
|
|
description = "Gate (open)",
|
|
drawtype = "mesh",
|
|
mesh = "marsdoors_door1.obj",
|
|
drop = "marsdoors:door1_closed",
|
|
wield_scale = {x=0.5, y=0.5, z=0.5},
|
|
selection_box = {
|
|
type = "fixed",
|
|
fixed = {-0.5, -0.5, -0.5, 1.5, 2.5, 0.5}
|
|
},
|
|
collision_box = {
|
|
type = "fixed",fixed = {
|
|
{-3.4, -0.5, -0.5, -0.5, 2.5, 0.5},
|
|
{4.4, -0.5, -0.5, 1.5, 2.5, 0.5}}},
|
|
tiles = {"marsdoors_shieldblock.png","marsdoors_warntape.png","default_obsidian.png","default_obsidian.png","marsdoors_warntape.png","default_obsidian.png"},
|
|
groups = {cracky = 1, level = 2, not_in_creative_inventory=1},
|
|
sounds = default.node_sound_wood_defaults(),
|
|
paramtype = "light",
|
|
paramtype2 = "facedir",
|
|
sunlight_propagates = true,
|
|
is_ground_content = false,
|
|
on_rightclick = function(pos, node, player, itemstack, pointed_thing)
|
|
minetest.swap_node(pos, {name="marsdoors:door1_closed", param2=minetest.get_node(pos).param2})
|
|
minetest.sound_play("marsdoors_door1", {pos=pos, gain = 1, max_hear_distance = 5})
|
|
end,
|
|
})
|
|
|
|
|
|
minetest.register_node("marsdoors:trapdoor_1", {
|
|
description = "Trap door",
|
|
drawtype = "nodebox",
|
|
paramtype = "light",
|
|
node_box = {
|
|
type = "fixed",
|
|
fixed = {
|
|
{-0.5, -0.375, -0.5, 0.5, -0.4375, 0.5},
|
|
{-0.5, 0.4375, -0.5, 0.5, 0.375, 0.5},
|
|
}
|
|
},
|
|
tiles = {"marsdoors_shieldblock.png","marsdoors_shieldblock.png","marsdoors_door2.png","marsdoors_warntape.png","marsdoors_door2.png","marsdoors_door2_2.png",},
|
|
groups = {cracky = 1, level = 2, not_in_creative_inventory=0},
|
|
sounds = default.node_sound_stone_defaults(),
|
|
paramtype = "light",
|
|
paramtype2 = "facedir",
|
|
sunlight_propagates = true,
|
|
is_ground_content = false,
|
|
climbable = true,
|
|
on_rightclick = function(pos, node, player, itemstack, pointed_thing)
|
|
minetest.swap_node(pos, {name="marsdoors:trapdoor_2", param2=minetest.get_node(pos).param2})
|
|
minetest.sound_play("marsdoors_door2", {pos=pos, gain = 1, max_hear_distance = 5})
|
|
minetest.after(4, function(pos)
|
|
if minetest.get_node(pos).name=="marsdoors:trapdoor_2" then
|
|
minetest.swap_node(pos, {name="marsdoors:trapdoor_1", param2=minetest.get_node(pos).param2})
|
|
minetest.sound_play("marsdoors_door2", {pos=pos, gain = 1, max_hear_distance = 5})
|
|
end
|
|
end, pos)
|
|
|
|
|
|
end,
|
|
})
|
|
minetest.register_node("marsdoors:trapdoor_2", {
|
|
description = "Trap door (open)",
|
|
drop="marsdoors:trapdoor_1",
|
|
drawtype = "nodebox",
|
|
paramtype = "light",
|
|
node_box = {
|
|
type = "fixed",
|
|
fixed = {
|
|
{0.375, -0.375, -0.5, 1.5, -0.4375, 0.5},
|
|
{0.375, 0.4375, -0.5, 1.5, 0.375, 0.5},
|
|
}
|
|
},
|
|
tiles = {"marsdoors_shieldblock.png","marsdoors_shieldblock.png","marsdoors_door2_open.png","marsdoors_warntape.png","marsdoors_door2_open.png","marsdoors_door2_2_open.png",},
|
|
groups = {cracky = 1, level = 2, not_in_creative_inventory=1},
|
|
sounds = default.node_sound_wood_defaults(),
|
|
paramtype = "light",
|
|
paramtype2 = "facedir",
|
|
sunlight_propagates = true,
|
|
is_ground_content = false,
|
|
climbable = true,
|
|
on_rightclick = function(pos, node, player, itemstack, pointed_thing)
|
|
local p={x=pos.x,y=pos.y+1,z=pos.z}
|
|
minetest.sound_play("marsdoors_door2", {pos=pos, gain = 1, max_hear_distance = 5})
|
|
minetest.swap_node(pos, {name="marsdoors:trapdoor_1", param2=minetest.get_node(pos).param2})
|
|
end,
|
|
})
|
|
|
|
|
|
|
|
|
|
minetest.register_node("marsdoors:door2_1", {
|
|
description = "Door",
|
|
drop="marsdoors:door2_1",
|
|
drawtype = "nodebox",
|
|
paramtype = "light",
|
|
node_box = {
|
|
type = "fixed",
|
|
fixed = {
|
|
{-0.5, -0.5, -0.125, 0.5, 0.5, 0.125},
|
|
}
|
|
},
|
|
tiles = {"marsdoors_warntape.png","marsdoors_warntape.png","marsdoors_door2.png","marsdoors_warntape.png","marsdoors_door2.png","marsdoors_door2_2.png",},
|
|
groups = {cracky = 1, level = 2, not_in_creative_inventory=0},
|
|
sounds = default.node_sound_stone_defaults(),
|
|
paramtype = "light",
|
|
paramtype2 = "facedir",
|
|
sunlight_propagates = true,
|
|
is_ground_content = false,
|
|
after_place_node = function(pos, placer, itemstack, pointed_thing)
|
|
local p={x=pos.x,y=pos.y+1,z=pos.z}
|
|
if minetest.registered_nodes[minetest.get_node(p).name].walkable then
|
|
return false
|
|
else
|
|
minetest.set_node(p, {name = "marsdoors:door2_2",param2=minetest.get_node(pos).param2})
|
|
end
|
|
end,
|
|
on_rightclick = function(pos, node, player, itemstack, pointed_thing)
|
|
local p={x=pos.x,y=pos.y+1,z=pos.z}
|
|
minetest.swap_node(p, {name="marsdoors:door2_open_2", param2=minetest.get_node(pos).param2})
|
|
minetest.swap_node(pos, {name="marsdoors:door2_open_1", param2=minetest.get_node(pos).param2})
|
|
minetest.sound_play("marsdoors_door2", {pos=pos, gain = 1, max_hear_distance = 5})
|
|
minetest.after(2, function(pos,p)
|
|
if minetest.get_node(pos).name=="marsdoors:door2_open_1" then
|
|
minetest.sound_play("marsdoors_door2", {pos=pos, gain = 1, max_hear_distance = 5})
|
|
minetest.swap_node(p, {name="marsdoors:door2_2", param2=minetest.get_node(pos).param2})
|
|
minetest.swap_node(pos, {name="marsdoors:door2_1", param2=minetest.get_node(pos).param2})
|
|
end
|
|
end, pos,p)
|
|
end,
|
|
after_dig_node = function (pos, name, digger)
|
|
marsdoors.replacenode({x=pos.x,y=pos.y+1,z=pos.z})
|
|
end,
|
|
})
|
|
|
|
minetest.register_node("marsdoors:door2_2", {
|
|
description = "Door 2-1",
|
|
drawtype = "nodebox",
|
|
drop="marsdoors:door2_1",
|
|
paramtype = "light",
|
|
node_box = {
|
|
type = "fixed",
|
|
fixed = {
|
|
{-0.5, -0.5, -0.125, 0.5, 0.5, 0.125},
|
|
}
|
|
},
|
|
tiles = {"marsdoors_warntape.png","marsdoors_warntape.png","marsdoors_door2.png","marsdoors_warntape.png","marsdoors_door2.png","marsdoors_door2_2.png",},
|
|
groups = {cracky = 1, level = 2, not_in_creative_inventory=1},
|
|
sounds = default.node_sound_wood_defaults(),
|
|
paramtype = "light",
|
|
paramtype2 = "facedir",
|
|
sunlight_propagates = true,
|
|
is_ground_content = false,
|
|
on_rightclick = function(pos, node, player, itemstack, pointed_thing)
|
|
local p={x=pos.x,y=pos.y-1,z=pos.z}
|
|
minetest.swap_node(p, {name="marsdoors:door2_open_1", param2=minetest.get_node(pos).param2})
|
|
minetest.swap_node(pos, {name="marsdoors:door2_open_2", param2=minetest.get_node(pos).param2})
|
|
minetest.sound_play("marsdoors_door2", {pos=pos, gain = 1, max_hear_distance = 5})
|
|
minetest.after(2, function(pos,p)
|
|
if minetest.get_node(pos).name=="marsdoors:door2_open_2" then
|
|
minetest.sound_play("marsdoors_door2", {pos=pos, gain = 1, max_hear_distance = 5})
|
|
minetest.swap_node(p, {name="marsdoors:door2_1", param2=minetest.get_node(pos).param2})
|
|
minetest.swap_node(pos, {name="marsdoors:door2_2", param2=minetest.get_node(pos).param2})
|
|
end
|
|
end, pos,p)
|
|
end,
|
|
after_dig_node = function (pos, name, digger)
|
|
marsdoors.replacenode({x=pos.x,y=pos.y-1,z=pos.z})
|
|
end,
|
|
})
|
|
|
|
minetest.register_node("marsdoors:door2_open_1", {
|
|
description = "Door (open) 2-o-1",
|
|
drop="marsdoors:door2_1",
|
|
drawtype = "nodebox",
|
|
paramtype = "light",
|
|
node_box = {
|
|
type = "fixed",
|
|
fixed = {
|
|
{0.41, -0.5, -0.124, 1.41, 0.5, 0.125},
|
|
}
|
|
},
|
|
tiles = {"marsdoors_warntape.png","marsdoors_warntape.png","marsdoors_door2_open.png","marsdoors_warntape.png","marsdoors_door2_open.png","marsdoors_door2_2_open.png",},
|
|
groups = {cracky = 1, level = 2, not_in_creative_inventory=1},
|
|
sounds = default.node_sound_wood_defaults(),
|
|
paramtype = "light",
|
|
paramtype2 = "facedir",
|
|
sunlight_propagates = true,
|
|
is_ground_content = false,
|
|
on_rightclick = function(pos, node, player, itemstack, pointed_thing)
|
|
local p={x=pos.x,y=pos.y+1,z=pos.z}
|
|
minetest.sound_play("marsdoors_door2", {pos=pos, gain = 1, max_hear_distance = 5})
|
|
minetest.swap_node(p, {name="marsdoors:door2_2", param2=minetest.get_node(pos).param2})
|
|
minetest.swap_node(pos, {name="marsdoors:door2_1", param2=minetest.get_node(pos).param2})
|
|
end,
|
|
after_dig_node = function (pos, name, digger)
|
|
marsdoors.replacenode({x=pos.x,y=pos.y+1,z=pos.z})
|
|
end,
|
|
})
|
|
|
|
minetest.register_node("marsdoors:door2_open_2", {
|
|
description = "Door (open) 2-o-1",
|
|
drawtype = "nodebox",
|
|
drop="marsdoors:door2_1",
|
|
paramtype = "light",
|
|
node_box = {
|
|
type = "fixed",
|
|
fixed = {
|
|
{0.41, -0.5, -0.124, 1.41, 0.5, 0.125},
|
|
}
|
|
},
|
|
tiles = {"marsdoors_warntape.png","marsdoors_warntape.png","marsdoors_door2_open.png","marsdoors_warntape.png","marsdoors_door2_open.png","marsdoors_door2_2_open.png",},
|
|
groups = {cracky = 1, level = 2, not_in_creative_inventory=1},
|
|
sounds = default.node_sound_wood_defaults(),
|
|
paramtype = "light",
|
|
paramtype2 = "facedir",
|
|
sunlight_propagates = true,
|
|
is_ground_content = false,
|
|
on_rightclick = function(pos, node, player, itemstack, pointed_thing)
|
|
local p={x=pos.x,y=pos.y-1,z=pos.z}
|
|
minetest.sound_play("marsdoors_door2", {pos=pos, gain = 1, max_hear_distance = 5})
|
|
minetest.swap_node(p, {name="marsdoors:door2_1", param2=minetest.get_node(pos).param2})
|
|
minetest.swap_node(pos, {name="marsdoors:door2_2", param2=minetest.get_node(pos).param2})
|
|
end,
|
|
after_dig_node = function (pos, name, digger)
|
|
marsdoors.replacenode({x=pos.x,y=pos.y-1,z=pos.z})
|
|
end,
|
|
})
|
|
|
|
|
|
minetest.register_node("marsdoors:warning", {
|
|
description = "Warning tape block",
|
|
tiles = {"marsdoors_warntape.png"},
|
|
groups = {cracky = 2,},
|
|
sounds = default.node_sound_stone_defaults(),
|
|
})
|
|
|
|
minetest.register_node("marsdoors:shieldblock", {
|
|
description = "Shieldblock",
|
|
tiles = {"marsdoors_shieldblock.png"},
|
|
groups = {cracky = 1},
|
|
sounds = default.node_sound_stone_defaults(),
|
|
})
|
|
|
|
minetest.register_node("marsdoors:steelwallblock", {
|
|
description = "Steel wallblock",
|
|
tiles = {"marsdoors_wall.png"},
|
|
groups = {cracky = 1},
|
|
sounds = default.node_sound_stone_defaults(),
|
|
})
|
|
|
|
minetest.register_node("marsdoors:oxogen", {
|
|
description = "Oxygen block",
|
|
tiles = {"marsdoors_oxogen.png"},
|
|
drawtype="glasslike",
|
|
groups = {crumbly = 2},
|
|
paramtype = "light",
|
|
sunlight_propagates = true,
|
|
alpha = 50,
|
|
sounds = default.node_sound_glass_defaults(),
|
|
})
|
|
|
|
|
|
minetest.register_node("marsdoors:clight", {
|
|
description = "Ceiling light",
|
|
tiles = {"default_cloud.png"},
|
|
drawtype = "nodebox",
|
|
groups = {snappy = 3, not_in_creative_inventory=0},
|
|
sounds = default.node_sound_glass_defaults(),
|
|
is_ground_content = false,
|
|
paramtype = "light",
|
|
paramtype2 = "facedir",
|
|
node_box = {type="fixed",fixed={-0.2,0.4,-0.4,0.2,0.6,0.4}},
|
|
light_source=14,
|
|
})
|
|
|
|
|
|
|
|
minetest.register_node("marsdoors:crystal", {
|
|
description = "Crystal",
|
|
drawtype = "mesh",
|
|
mesh = "marsdoors_crystal.obj",
|
|
visual_scale = 0.16,
|
|
wield_scale = {x=1, y=1, z=1},
|
|
alpha = 20,
|
|
tiles = {
|
|
{
|
|
name = "marsdoors_glitsh.png^[colorize:#cc0000aa",
|
|
animation = {
|
|
type = "vertical_frames",
|
|
aspect_w = 16,
|
|
aspect_h = 16,
|
|
length = 2.0,
|
|
},
|
|
},
|
|
},
|
|
paramtype = "light",
|
|
paramtype2 = "facedir",
|
|
sunlight_propagates = true,
|
|
damage_per_second = 4,
|
|
|
|
is_ground_content = false,
|
|
light_source=4,
|
|
groups = {cracky = 2, level = 2},
|
|
})
|
|
|
|
function marsdoors.replacenode(pos)
|
|
minetest.set_node(pos, {name = "air"})
|
|
end
|
|
|
|
minetest.register_alias("marssurvive:door1_closed", "marsdoors:door1_closed")
|
|
minetest.register_alias("marssurvive:door1", "marsdoors:door1")
|
|
minetest.register_alias("marssurvive:trapdoor_1", "marsdoors:trapdoor_1")
|
|
minetest.register_alias("marssurvive:trapdoor_2", "marsdoors:trapdoor_2")
|
|
minetest.register_alias("marssurvive:door2_1", "marsdoors:door2_1")
|
|
minetest.register_alias("marssurvive:door2_2", "marsdoors:door2_2")
|
|
minetest.register_alias("marssurvive:door2_open_1", "marsdoors:door2_open_1")
|
|
minetest.register_alias("marssurvive:door2_open_2", "marsdoors:door2_open_2")
|
|
minetest.register_alias("marssurvive:warning", "marsdoors:warning")
|
|
minetest.register_alias("marssurvive:shieldblock", "marsdoors:shieldblock")
|
|
minetest.register_alias("marssurvive:steelwallblock", "marsdoors:steelwallblock")
|
|
minetest.register_alias("marssurvive:oxogen", "marsdoors:oxogen")
|
|
minetest.register_alias("marssurvive:clight", "marsdoors:clight")
|
|
minetest.register_alias("marssurvive:crystal", "marsdoors:crystal")
|