Improve setup experience and inventory items
This commit is contained in:
parent
fd8693671d
commit
3d078bb99a
@ -1,19 +1,32 @@
|
||||
celevator.callbutton = {}
|
||||
|
||||
local function makebuttontex(dir,upon,downon)
|
||||
local function makebuttontex(dir,upon,downon,inventory)
|
||||
local tex = "[combine:64x64:0,0=celevator_cabinet_sides.png:32,0=celevator_cabinet_sides.png:0,32=celevator_cabinet_sides.png:32,32=celevator_cabinet_sides.png:22,24=celevator_callbutton_panel.png"
|
||||
if inventory then tex = "[combine:32x32:5,0=celevator_callbutton_panel.png" end
|
||||
if dir == "up" then
|
||||
tex = tex..":24,35=celevator_callbutton_up.png"
|
||||
if inventory then
|
||||
tex = tex..":7,11=celevator_callbutton_up.png"
|
||||
else
|
||||
tex = tex..":24,35=celevator_callbutton_up.png"
|
||||
end
|
||||
if upon then
|
||||
tex = tex..":33,36=celevator_callbutton_light.png"
|
||||
end
|
||||
elseif dir == "down" then
|
||||
tex = tex..":24,35=celevator_callbutton_down.png"
|
||||
if inventory then
|
||||
tex = tex..":7,11=celevator_callbutton_down.png"
|
||||
else
|
||||
tex = tex..":24,35=celevator_callbutton_down.png"
|
||||
end
|
||||
if downon then
|
||||
tex = tex..":33,36=celevator_callbutton_light.png"
|
||||
end
|
||||
elseif dir == "both" then
|
||||
tex = tex..":24,28=celevator_callbutton_up.png:24,43=celevator_callbutton_down.png"
|
||||
if inventory then
|
||||
tex = tex..":7,4=celevator_callbutton_up.png:7,19=celevator_callbutton_down.png"
|
||||
else
|
||||
tex = tex..":24,28=celevator_callbutton_up.png:24,43=celevator_callbutton_down.png"
|
||||
end
|
||||
if upon then
|
||||
tex = tex..":33,29=celevator_callbutton_light.png"
|
||||
end
|
||||
@ -105,7 +118,7 @@ for _,state in ipairs(validstates) do
|
||||
if state[2] then nname = nname.."_upon" end
|
||||
if state[3] then nname = nname.."_downon" end
|
||||
local idle = not (state[2] or state[3])
|
||||
local description = string.format("%s Call Button%s",state[4],(idle and "" or " (on state, you hacker you!)"))
|
||||
local description = string.format("Elevator %s Call Button%s%s",state[4],(state[1] == "both" and "s" or ""),(idle and "" or " (on state, you hacker you!)"))
|
||||
minetest.register_node(nname,{
|
||||
description = description,
|
||||
groups = {
|
||||
@ -117,6 +130,7 @@ for _,state in ipairs(validstates) do
|
||||
_celevator_callbutton_up_lit = (state[2] and 1 or 0),
|
||||
_celevator_callbutton_down_lit = (state[3] and 1 or 0),
|
||||
},
|
||||
inventory_image = makebuttontex(state[1],state[2],state[3],true),
|
||||
drop = dropname,
|
||||
tiles = {
|
||||
boringside,
|
||||
|
110
car.lua
110
car.lua
@ -408,7 +408,7 @@ local pieces = {
|
||||
|
||||
for _,def in ipairs(pieces) do
|
||||
def.groups = {
|
||||
dig_immediate = 2,
|
||||
not_in_creative_inventory = 1,
|
||||
_celevator_car = 1,
|
||||
}
|
||||
local xp = tonumber(string.sub(def._position,1,1))
|
||||
@ -435,8 +435,9 @@ for _,def in ipairs(pieces) do
|
||||
def.paramtype = "light"
|
||||
def.paramtype2 = "4dir"
|
||||
def.drawtype = "nodebox"
|
||||
def.description = "Car "..def._position
|
||||
def.description = "Car "..def._position.." (you hacker you!)"
|
||||
def.light_source = 9
|
||||
def.drop = ""
|
||||
def.on_receive_fields = function(pos,_,fields,player)
|
||||
local meta = minetest.get_meta(pos)
|
||||
local carid = meta:get_int("carid")
|
||||
@ -471,6 +472,22 @@ for _,def in ipairs(pieces) do
|
||||
def.on_construct = function(pos)
|
||||
minetest.get_meta(pos):set_string("doorstate","closed")
|
||||
end
|
||||
def.on_punch = function(pos,_,player)
|
||||
if player.is_fake_player then return end
|
||||
local name = player:get_player_name()
|
||||
local sneak = player:get_player_control().sneak
|
||||
if not sneak then return end
|
||||
if minetest.is_protected(pos,name) and not minetest.check_player_privs(name,{protection_bypass=true}) then
|
||||
minetest.record_protection_violation(pos,name)
|
||||
return
|
||||
end
|
||||
local hash = minetest.hash_node_position(pos)
|
||||
local fs = "formspec_version[7]size[6,4]"
|
||||
fs = fs.."label[0.5,1;Really remove this car?]"
|
||||
fs = fs.."button_exit[0.5,2;2,1;yes;Yes]"
|
||||
fs = fs.."button_exit[3,2;2,1;no;No]"
|
||||
minetest.show_formspec(name,string.format("celevator:remove_car_%d",hash),fs)
|
||||
end
|
||||
end
|
||||
minetest.register_node("celevator:car_"..def._position,def)
|
||||
end
|
||||
@ -577,3 +594,92 @@ minetest.register_abm({
|
||||
chance = 1,
|
||||
action = updatecartopbox,
|
||||
})
|
||||
|
||||
minetest.register_node("celevator:car",{
|
||||
description = "Elevator Car",
|
||||
paramtype2 = "4dir",
|
||||
buildable_to = true,
|
||||
inventory_image = "celevator_car_inventory.png",
|
||||
wield_image = "celevator_car_wield.png",
|
||||
wield_scale = vector.new(1,1,10),
|
||||
tiles = {"celevator_transparent.png"},
|
||||
after_place_node = function(pos,player)
|
||||
if not player:is_player() then
|
||||
minetest.remove_node(pos)
|
||||
return true
|
||||
end
|
||||
local name = player:get_player_name()
|
||||
local newnode = minetest.get_node(pos)
|
||||
local facedir = minetest.dir_to_yaw(minetest.fourdir_to_dir(newnode.param2))
|
||||
for x=0,1,1 do
|
||||
for y=0,2,1 do
|
||||
for z=0,2,1 do
|
||||
local offsetdesc = string.format("%dm to the right, %dm up, and %dm back",x,y,z)
|
||||
local placeoffset = vector.new(x,y,z)
|
||||
local placepos = vector.add(pos,vector.rotate_around_axis(placeoffset,vector.new(0,1,0),facedir))
|
||||
local replaces = minetest.get_node(placepos).name
|
||||
if not (minetest.registered_nodes[replaces] and minetest.registered_nodes[replaces].buildable_to) then
|
||||
minetest.chat_send_player(name,string.format("Can't place car here - position %s is blocked!",offsetdesc))
|
||||
minetest.remove_node(pos)
|
||||
return true
|
||||
end
|
||||
if minetest.is_protected(placepos,name) and not minetest.check_player_privs(name,{protection_bypass=true}) then
|
||||
minetest.chat_send_player(name,string.format("Can't place car here - position %s is protected!",offsetdesc))
|
||||
minetest.record_protection_violation(placepos,name)
|
||||
minetest.remove_node(pos)
|
||||
return true
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
for x=0,1,1 do
|
||||
for y=0,2,1 do
|
||||
for z=0,2,1 do
|
||||
local piecename = string.format("celevator:car_%d%d%d",x,y,z)
|
||||
local placeoffset = vector.new(x,y,z)
|
||||
local placepos = vector.add(pos,vector.rotate_around_axis(placeoffset,vector.new(0,1,0),facedir))
|
||||
minetest.set_node(placepos,{name=piecename,param2=newnode.param2})
|
||||
end
|
||||
end
|
||||
end
|
||||
end,
|
||||
})
|
||||
|
||||
minetest.register_on_player_receive_fields(function(_,formname,fields)
|
||||
if string.sub(formname,1,21) ~= "celevator:remove_car_" then return false end
|
||||
if not fields.yes then return true end
|
||||
local hash = tonumber(string.sub(formname,22,-1))
|
||||
if not hash then return true end
|
||||
local rootpos = minetest.get_position_from_hash(hash)
|
||||
local rootdir = minetest.dir_to_yaw(minetest.fourdir_to_dir(minetest.get_node(rootpos).param2))
|
||||
local toberemoved = {
|
||||
["celevator:car_top_box"] = true,
|
||||
["celevator:incar_pi_entity"] = true,
|
||||
["celevator:car_door"] = true,
|
||||
}
|
||||
for x=0,1,1 do
|
||||
for y=0,2,1 do
|
||||
for z=0,2,1 do
|
||||
local piecename = string.format("celevator:car_%d%d%d",x,y,z)
|
||||
local pieceoffset = vector.new(x,y,z)
|
||||
local piecepos = vector.add(rootpos,vector.rotate_around_axis(pieceoffset,vector.new(0,1,0),rootdir))
|
||||
if minetest.get_node(piecepos).name == piecename then
|
||||
minetest.remove_node(piecepos)
|
||||
local erefs = minetest.get_objects_inside_radius(piecepos,0.5)
|
||||
for _,ref in pairs(erefs) do
|
||||
if toberemoved[ref:get_luaentity().name] then
|
||||
ref:remove()
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
local cartopboxpos = vector.add(rootpos,vector.rotate_around_axis(vector.new(0,3,1),vector.new(0,1,0),rootdir))
|
||||
local erefs = minetest.get_objects_inside_radius(cartopboxpos,0.5)
|
||||
for _,ref in pairs(erefs) do
|
||||
if toberemoved[ref:get_luaentity().name] then
|
||||
ref:remove()
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
@ -117,7 +117,7 @@ local function controllerleds(pos,running)
|
||||
end
|
||||
|
||||
minetest.register_node("celevator:controller",{
|
||||
description = "Controller",
|
||||
description = "Elevator Controller",
|
||||
groups = {
|
||||
cracky = 1,
|
||||
},
|
||||
|
112
doors.lua
112
doors.lua
@ -3,7 +3,7 @@ celevator.doors = {}
|
||||
celevator.doors.erefs = {}
|
||||
|
||||
minetest.register_node("celevator:hwdoor_fast_glass_bottom",{
|
||||
description = "Glass Hoistway Door (fast, bottom)",
|
||||
description = "Glass Hoistway Door (fast, bottom - you hacker you!)",
|
||||
tiles = {
|
||||
"celevator_transparent.png",
|
||||
"celevator_door_glass_edge.png",
|
||||
@ -13,9 +13,11 @@ minetest.register_node("celevator:hwdoor_fast_glass_bottom",{
|
||||
"celevator_door_glass_topbottom.png^[transformFY",
|
||||
},
|
||||
groups = {
|
||||
dig_immediate = 2,
|
||||
not_in_creative_inventory = 1,
|
||||
_celevator_hwdoor_root = 1,
|
||||
oddly_breakable_by_hand = 2,
|
||||
},
|
||||
drop = "celevator:hwdoor_glass",
|
||||
paramtype = "light",
|
||||
paramtype2 = "4dir",
|
||||
drawtype = "nodebox",
|
||||
@ -26,10 +28,30 @@ minetest.register_node("celevator:hwdoor_fast_glass_bottom",{
|
||||
{-0.5,-0.5,0.4,0.5,0.5,0.5},
|
||||
},
|
||||
},
|
||||
after_dig_node = function(pos,node)
|
||||
local facedir = minetest.dir_to_yaw(minetest.fourdir_to_dir(node.param2))
|
||||
local xnames = {
|
||||
[0] = "fast",
|
||||
[1] = "slow",
|
||||
}
|
||||
local ynames = {
|
||||
[0] = "bottom",
|
||||
[1] = "middle",
|
||||
[2] = "top",
|
||||
}
|
||||
for x=0,1,1 do
|
||||
for y=0,2,1 do
|
||||
local piecename = string.format("celevator:hwdoor_%s_glass_%s",xnames[x],ynames[y])
|
||||
local pieceoffset = vector.new(x,y,0)
|
||||
local piecepos = vector.add(pos,vector.rotate_around_axis(pieceoffset,vector.new(0,1,0),facedir))
|
||||
if minetest.get_node(piecepos).name == piecename then minetest.remove_node(piecepos) end
|
||||
end
|
||||
end
|
||||
end,
|
||||
})
|
||||
|
||||
minetest.register_node("celevator:hwdoor_fast_glass_middle",{
|
||||
description = "Glass Hoistway Door (fast, middle)",
|
||||
description = "Glass Hoistway Door (fast, middle - you hacker you!)",
|
||||
tiles = {
|
||||
"celevator_transparent.png",
|
||||
"celevator_transparent.png",
|
||||
@ -39,8 +61,9 @@ minetest.register_node("celevator:hwdoor_fast_glass_middle",{
|
||||
"celevator_door_glass_middle.png",
|
||||
},
|
||||
groups = {
|
||||
dig_immediate = 2,
|
||||
not_in_creative_inventory = 1,
|
||||
},
|
||||
drop = "",
|
||||
paramtype = "light",
|
||||
paramtype2 = "4dir",
|
||||
drawtype = "nodebox",
|
||||
@ -54,7 +77,7 @@ minetest.register_node("celevator:hwdoor_fast_glass_middle",{
|
||||
})
|
||||
|
||||
minetest.register_node("celevator:hwdoor_fast_glass_top",{
|
||||
description = "Glass Hoistway Door (fast, top)",
|
||||
description = "Glass Hoistway Door (fast, top - you hacker you!)",
|
||||
tiles = {
|
||||
"celevator_door_glass_edge.png",
|
||||
"celevator_transparent.png",
|
||||
@ -64,8 +87,9 @@ minetest.register_node("celevator:hwdoor_fast_glass_top",{
|
||||
"celevator_door_glass_topbottom.png",
|
||||
},
|
||||
groups = {
|
||||
dig_immediate = 2,
|
||||
not_in_creative_inventory = 1,
|
||||
},
|
||||
drop = "",
|
||||
paramtype = "light",
|
||||
paramtype2 = "4dir",
|
||||
drawtype = "nodebox",
|
||||
@ -79,7 +103,7 @@ minetest.register_node("celevator:hwdoor_fast_glass_top",{
|
||||
})
|
||||
|
||||
minetest.register_node("celevator:hwdoor_slow_glass_bottom",{
|
||||
description = "Glass Hoistway Door (slow, bottom)",
|
||||
description = "Glass Hoistway Door (slow, bottom - you hacker you!)",
|
||||
tiles = {
|
||||
"celevator_transparent.png",
|
||||
"celevator_door_glass_edge.png",
|
||||
@ -89,8 +113,9 @@ minetest.register_node("celevator:hwdoor_slow_glass_bottom",{
|
||||
"celevator_door_glass_topbottom.png^[transformFY",
|
||||
},
|
||||
groups = {
|
||||
dig_immediate = 2,
|
||||
not_in_creative_inventory = 1,
|
||||
},
|
||||
drop = "",
|
||||
paramtype = "light",
|
||||
paramtype2 = "4dir",
|
||||
drawtype = "nodebox",
|
||||
@ -104,7 +129,7 @@ minetest.register_node("celevator:hwdoor_slow_glass_bottom",{
|
||||
})
|
||||
|
||||
minetest.register_node("celevator:hwdoor_slow_glass_middle",{
|
||||
description = "Glass Hoistway Door (slow, middle)",
|
||||
description = "Glass Hoistway Door (slow, middle - you hacker you!)",
|
||||
tiles = {
|
||||
"celevator_transparent.png",
|
||||
"celevator_transparent.png",
|
||||
@ -114,8 +139,9 @@ minetest.register_node("celevator:hwdoor_slow_glass_middle",{
|
||||
"celevator_door_glass_middle.png",
|
||||
},
|
||||
groups = {
|
||||
dig_immediate = 2,
|
||||
not_in_creative_inventory = 1,
|
||||
},
|
||||
drop = "",
|
||||
paramtype = "light",
|
||||
paramtype2 = "4dir",
|
||||
drawtype = "nodebox",
|
||||
@ -129,7 +155,7 @@ minetest.register_node("celevator:hwdoor_slow_glass_middle",{
|
||||
})
|
||||
|
||||
minetest.register_node("celevator:hwdoor_slow_glass_top",{
|
||||
description = "Glass Hoistway Door (slow, top)",
|
||||
description = "Glass Hoistway Door (slow, top - you hacker you!)",
|
||||
tiles = {
|
||||
"celevator_door_glass_edge.png",
|
||||
"celevator_transparent.png",
|
||||
@ -139,8 +165,9 @@ minetest.register_node("celevator:hwdoor_slow_glass_top",{
|
||||
"celevator_door_glass_topbottom.png",
|
||||
},
|
||||
groups = {
|
||||
dig_immediate = 2,
|
||||
not_in_creative_inventory = 1,
|
||||
},
|
||||
drop = "",
|
||||
paramtype = "light",
|
||||
paramtype2 = "4dir",
|
||||
drawtype = "nodebox",
|
||||
@ -154,10 +181,14 @@ minetest.register_node("celevator:hwdoor_slow_glass_top",{
|
||||
})
|
||||
|
||||
minetest.register_node("celevator:hwdoor_placeholder",{
|
||||
description = "Hoistway Door Open-State Placeholder",
|
||||
description = "Hoistway Door Open-State Placeholder (you hacker you!)",
|
||||
groups = {
|
||||
not_in_creative_inventory = 1,
|
||||
},
|
||||
tiles = {
|
||||
"celevator_transparent.png",
|
||||
},
|
||||
drop = "",
|
||||
paramtype = "light",
|
||||
paramtype2 = "4dir",
|
||||
drawtype = "airlike",
|
||||
@ -538,3 +569,58 @@ minetest.register_abm({
|
||||
celevator.doors.spawncardoors(pos,fdir)
|
||||
end,
|
||||
})
|
||||
|
||||
minetest.register_node("celevator:hwdoor_glass",{
|
||||
description = "Glass Elevator Hoistway Door",
|
||||
paramtype2 = "4dir",
|
||||
buildable_to = true,
|
||||
inventory_image = "celevator_door_glass_inventory.png",
|
||||
wield_image = "celevator_door_glass_inventory.png",
|
||||
wield_scale = vector.new(1,3,1),
|
||||
tiles = {"celevator_transparent.png"},
|
||||
after_place_node = function(pos,player)
|
||||
if not player:is_player() then
|
||||
minetest.remove_node(pos)
|
||||
return true
|
||||
end
|
||||
local name = player:get_player_name()
|
||||
local newnode = minetest.get_node(pos)
|
||||
local facedir = minetest.dir_to_yaw(minetest.fourdir_to_dir(newnode.param2))
|
||||
local xnames = {
|
||||
[0] = "fast",
|
||||
[1] = "slow",
|
||||
}
|
||||
local ynames = {
|
||||
[0] = "bottom",
|
||||
[1] = "middle",
|
||||
[2] = "top",
|
||||
}
|
||||
for x=0,1,1 do
|
||||
for y=0,2,1 do
|
||||
local offsetdesc = string.format("%dm to the right and %dm up",x,y)
|
||||
local placeoffset = vector.new(x,y,0)
|
||||
local placepos = vector.add(pos,vector.rotate_around_axis(placeoffset,vector.new(0,1,0),facedir))
|
||||
local replaces = minetest.get_node(placepos).name
|
||||
if not (minetest.registered_nodes[replaces] and minetest.registered_nodes[replaces].buildable_to) then
|
||||
minetest.chat_send_player(name,string.format("Can't place car here - position %s is blocked!",offsetdesc))
|
||||
minetest.remove_node(pos)
|
||||
return true
|
||||
end
|
||||
if minetest.is_protected(placepos,name) and not minetest.check_player_privs(name,{protection_bypass=true}) then
|
||||
minetest.chat_send_player(name,string.format("Can't place car here - position %s is protected!",offsetdesc))
|
||||
minetest.record_protection_violation(placepos,name)
|
||||
minetest.remove_node(pos)
|
||||
return true
|
||||
end
|
||||
end
|
||||
end
|
||||
for x=0,1,1 do
|
||||
for y=0,2,1 do
|
||||
local piecename = string.format("celevator:hwdoor_%s_glass_%s",xnames[x],ynames[y])
|
||||
local placeoffset = vector.new(x,y,0)
|
||||
local placepos = vector.add(pos,vector.rotate_around_axis(placeoffset,vector.new(0,1,0),facedir))
|
||||
minetest.set_node(placepos,{name=piecename,param2=newnode.param2})
|
||||
end
|
||||
end
|
||||
end,
|
||||
})
|
||||
|
@ -137,7 +137,7 @@ local function decelsound(pos)
|
||||
end
|
||||
|
||||
minetest.register_node("celevator:drive",{
|
||||
description = celevator.drives.entity.name,
|
||||
description = "Elevator "..celevator.drives.entity.name,
|
||||
groups = {
|
||||
cracky = 1,
|
||||
_celevator_drive = 1,
|
||||
@ -673,7 +673,7 @@ local function updatecarpos(pos)
|
||||
end
|
||||
|
||||
minetest.register_node("celevator:machine",{
|
||||
description = "Hoist Machine",
|
||||
description = "Elevator Hoist Machine",
|
||||
groups = {
|
||||
dig_immediate = 2,
|
||||
_celevator_machine = 1,
|
||||
@ -688,6 +688,9 @@ minetest.register_node("celevator:machine",{
|
||||
"celevator_machine_front.png",
|
||||
"celevator_machine_front.png",
|
||||
},
|
||||
inventory_image = "celevator_machine_inventory.png",
|
||||
wield_image = "celevator_machine_inventory.png",
|
||||
wield_scale = vector.new(1,1,3),
|
||||
drawtype = "nodebox",
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
@ -705,10 +708,68 @@ minetest.register_node("celevator:machine",{
|
||||
{-0.5,-0.25,-0.05,-0.35,-0.15,0.05} -- Shaft from motor
|
||||
},
|
||||
},
|
||||
after_place_node = function(pos)
|
||||
updatecarpos(pos)
|
||||
selection_box = {
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
{-1.5,-0.5,-0.5,0.5,0.5,0.5},
|
||||
{-0.5,-0.5,-0.8,0.5,0.5,-0.5},
|
||||
},
|
||||
},
|
||||
after_place_node = function(pos,player)
|
||||
if not player:is_player() then
|
||||
minetest.remove_node(pos)
|
||||
return true
|
||||
end
|
||||
local newnode = minetest.get_node(pos)
|
||||
local facedir = minetest.dir_to_yaw(minetest.fourdir_to_dir(newnode.param2))
|
||||
local motorpos = vector.add(pos,vector.rotate_around_axis(vector.new(-1,0,0),vector.new(0,1,0),facedir))
|
||||
local motorreplaces = minetest.get_node(motorpos).name
|
||||
local sheavepos = vector.add(pos,vector.rotate_around_axis(vector.new(0,0,-1),vector.new(0,1,0),facedir))
|
||||
local sheavereplaces = minetest.get_node(sheavepos).name
|
||||
local name = player:get_player_name()
|
||||
if not (minetest.registered_nodes[motorreplaces] and minetest.registered_nodes[motorreplaces].buildable_to) then
|
||||
minetest.chat_send_player(name,"Can't place machine here - no room for the motor (to the left)!")
|
||||
minetest.remove_node(pos)
|
||||
return true
|
||||
end
|
||||
if minetest.is_protected(motorpos,name) and not minetest.check_player_privs(name,{protection_bypass=true}) then
|
||||
minetest.chat_send_player(name,"Can't place machine here - space for the motor (to the left) is protected!")
|
||||
minetest.record_protection_violation(motorpos,name)
|
||||
minetest.remove_node(pos)
|
||||
return true
|
||||
end
|
||||
if not (minetest.registered_nodes[sheavereplaces] and minetest.registered_nodes[sheavereplaces].buildable_to) then
|
||||
minetest.chat_send_player(name,"Can't place machine here - no room for the sheave (in front)!")
|
||||
minetest.remove_node(pos)
|
||||
return true
|
||||
end
|
||||
if minetest.is_protected(sheavepos,name) and not minetest.check_player_privs(name,{protection_bypass=true}) then
|
||||
minetest.chat_send_player(name,"Can't place machine here - space for the sheave (in front) is protected!")
|
||||
minetest.record_protection_violation(sheavepos,name)
|
||||
minetest.remove_node(pos)
|
||||
return true
|
||||
end
|
||||
local meta = minetest.get_meta(pos)
|
||||
meta:set_string("formspec","formspec_version[7]size[8,5]field[0.5,0.5;7,1;carid;Car ID;]button[3,3.5;2,1;save;Save]")
|
||||
minetest.set_node(motorpos,{name="celevator:motor",param2=newnode.param2})
|
||||
minetest.set_node(sheavepos,{name="celevator:sheave",param2=newnode.param2})
|
||||
end,
|
||||
after_dig_node = function(pos,node)
|
||||
local facedir = minetest.dir_to_yaw(minetest.fourdir_to_dir(node.param2))
|
||||
local motorpos = vector.add(pos,vector.rotate_around_axis(vector.new(-1,0,0),vector.new(0,1,0),facedir))
|
||||
if minetest.get_node(motorpos).name == "celevator:motor" then
|
||||
minetest.remove_node(motorpos)
|
||||
end
|
||||
local sheavepos = vector.add(pos,vector.rotate_around_axis(vector.new(0,0,-1),vector.new(0,1,0),facedir))
|
||||
if minetest.get_node(sheavepos).name == "celevator:sheave" then
|
||||
minetest.remove_node(sheavepos)
|
||||
end
|
||||
local erefs = minetest.get_objects_inside_radius(sheavepos,0.5)
|
||||
for _,ref in pairs(erefs) do
|
||||
if ref:get_luaentity().name == "celevator:sheave_moving" then
|
||||
ref:remove()
|
||||
end
|
||||
end
|
||||
end,
|
||||
on_punch = function(pos)
|
||||
local meta = minetest.get_meta(pos)
|
||||
@ -726,15 +787,17 @@ minetest.register_node("celevator:machine",{
|
||||
local meta = minetest.get_meta(pos)
|
||||
meta:set_int("carid",carid)
|
||||
meta:set_string("formspec","")
|
||||
updatecarpos(pos)
|
||||
end
|
||||
end,
|
||||
})
|
||||
|
||||
minetest.register_node("celevator:motor",{
|
||||
description = "Hoist Motor",
|
||||
description = "Hoist Motor (you hacker you!)",
|
||||
groups = {
|
||||
dig_immediate = 2,
|
||||
not_in_creative_inventory = 1,
|
||||
},
|
||||
drop = "",
|
||||
paramtype = "light",
|
||||
paramtype2 = "4dir",
|
||||
tiles = {
|
||||
@ -757,13 +820,18 @@ minetest.register_node("celevator:motor",{
|
||||
{-0.4,0.1,-0.2,0,0.3,0.2}, -- Junction box
|
||||
},
|
||||
},
|
||||
selection_box = {
|
||||
type = "fixed",
|
||||
fixed = {},
|
||||
},
|
||||
})
|
||||
|
||||
minetest.register_node("celevator:sheave",{
|
||||
description = "Sheave",
|
||||
description = "Sheave (you hacker you!)",
|
||||
groups = {
|
||||
dig_immediate = 2,
|
||||
not_in_creative_inventory = 1,
|
||||
},
|
||||
drop = "",
|
||||
paramtype = "light",
|
||||
paramtype2 = "4dir",
|
||||
tiles = {
|
||||
@ -785,13 +853,18 @@ minetest.register_node("celevator:sheave",{
|
||||
{-0.2,-0.3,0.2,0.2,-0.2,0.5},
|
||||
},
|
||||
},
|
||||
selection_box = {
|
||||
type = "fixed",
|
||||
fixed = {},
|
||||
},
|
||||
})
|
||||
|
||||
minetest.register_node("celevator:sheave_centered",{
|
||||
description = "Centered Sheave",
|
||||
description = "Centered Sheave (you hacker you!)",
|
||||
groups = {
|
||||
dig_immediate = 2,
|
||||
not_in_creative_inventory = 1,
|
||||
},
|
||||
drop = "",
|
||||
paramtype = "light",
|
||||
paramtype2 = "4dir",
|
||||
tiles = {
|
||||
@ -813,6 +886,10 @@ minetest.register_node("celevator:sheave_centered",{
|
||||
{-0.2,-0.4,0.2,0.2,-0.3,0.5},
|
||||
},
|
||||
},
|
||||
selection_box = {
|
||||
type = "fixed",
|
||||
fixed = {},
|
||||
},
|
||||
})
|
||||
|
||||
minetest.register_entity("celevator:sheave_moving",{
|
||||
@ -821,6 +898,7 @@ minetest.register_entity("celevator:sheave_moving",{
|
||||
visual_size = vector.new(0.667,0.667,0.667),
|
||||
wield_item = "celevator:sheave_centered",
|
||||
static_save = false,
|
||||
pointable = false,
|
||||
},
|
||||
})
|
||||
|
||||
|
@ -55,6 +55,7 @@ minetest.register_node("celevator:drive_null",{
|
||||
description = celevator.drives.null.name,
|
||||
groups = {
|
||||
cracky = 1,
|
||||
not_in_creative_inventory = 1,
|
||||
},
|
||||
tiles = {
|
||||
"celevator_cabinet_sides.png",
|
||||
|
@ -98,12 +98,13 @@ local switchstates = {"off","on","reset"}
|
||||
|
||||
for _,switchpos in ipairs(switchstates) do
|
||||
minetest.register_node("celevator:fs1switch_"..switchpos,{
|
||||
description = "Fire Service Phase 1 Keyswitch"..(switchpos == "off" and "" or string.format(" (%s state - you hacker you!)",switchpos)),
|
||||
description = "Elevator Fire Service Phase 1 Keyswitch"..(switchpos == "off" and "" or string.format(" (%s state - you hacker you!)",switchpos)),
|
||||
groups = {
|
||||
dig_immediate = 2,
|
||||
not_in_creative_inventory = (switchpos == "off" and 0 or 1),
|
||||
_celevator_fs1switch = 1,
|
||||
},
|
||||
inventory_image = "celevator_fs1switch_off.png",
|
||||
drop = "celevator:fs1switch_off",
|
||||
tiles = {
|
||||
"celevator_cabinet_sides.png",
|
||||
@ -140,7 +141,7 @@ for _,switchpos in ipairs(switchstates) do
|
||||
on_destruct = unpair,
|
||||
})
|
||||
minetest.register_node("celevator:fs1switch_"..switchpos.."_lit",{
|
||||
description = "Fire Service Phase 1 Keyswitch"..string.format(" (%s state, lit - you hacker you!)",switchpos),
|
||||
description = "Elevator Fire Service Phase 1 Keyswitch"..string.format(" (%s state, lit - you hacker you!)",switchpos),
|
||||
groups = {
|
||||
dig_immediate = 2,
|
||||
not_in_creative_inventory = 1,
|
||||
|
@ -135,7 +135,7 @@ function celevator.pi.setarrow(pos,which,active)
|
||||
end
|
||||
|
||||
minetest.register_node("celevator:pi",{
|
||||
description = "Position Indicator",
|
||||
description = "Elevator Position Indicator",
|
||||
groups = {
|
||||
dig_immediate = 2,
|
||||
_celevator_pi = 1,
|
||||
@ -148,6 +148,7 @@ minetest.register_node("celevator:pi",{
|
||||
boringside,
|
||||
displaytex,
|
||||
},
|
||||
inventory_image = "[combine:32x32:0,5=celevator_pi_background.png",
|
||||
paramtype = "light",
|
||||
paramtype2 = "facedir",
|
||||
drawtype = "nodebox",
|
||||
@ -305,7 +306,7 @@ for _,state in ipairs(validstates) do
|
||||
if state[2] then nname = nname.."_upon" end
|
||||
if state[3] then nname = nname.."_downon" end
|
||||
local idle = not (state[2] or state[3])
|
||||
local description = string.format("%s Position Indicator/Lantern Combo%s",state[4],(idle and "" or " (on state, you hacker you!)"))
|
||||
local description = string.format("Elevator %s Position Indicator/Lantern Combo%s",state[4],(idle and "" or " (on state, you hacker you!)"))
|
||||
minetest.register_node(nname,{
|
||||
description = description,
|
||||
groups = {
|
||||
@ -327,6 +328,7 @@ for _,state in ipairs(validstates) do
|
||||
boringside,
|
||||
makepilanterntex(state[1],state[2],state[3])
|
||||
},
|
||||
inventory_image = string.format("[combine:42x42:5,0=celevator_pi_lantern_background_%s.png",(state[1] == "both" and "updown" or state[1])),
|
||||
paramtype = "light",
|
||||
paramtype2 = "facedir",
|
||||
drawtype = "nodebox",
|
||||
@ -385,9 +387,10 @@ for _,state in ipairs(validstates) do
|
||||
if state[2] then nname = nname.."_upon" end
|
||||
if state[3] then nname = nname.."_downon" end
|
||||
idle = not (state[2] or state[3])
|
||||
description = string.format("%s Lantern%s",state[4],(idle and "" or " (on state, you hacker you!)"))
|
||||
description = string.format("Elevator %s Lantern%s",state[4],(idle and "" or " (on state, you hacker you!)"))
|
||||
minetest.register_node(nname,{
|
||||
description = description,
|
||||
inventory_image = string.format("[combine:32x32:0,5=celevator_lantern_background_%s.png",(state[1] == "both" and "updown" or state[1])),
|
||||
groups = {
|
||||
dig_immediate = 2,
|
||||
not_in_creative_inventory = (idle and 0 or 1),
|
||||
|
BIN
textures/celevator_car_inventory.png
Normal file
BIN
textures/celevator_car_inventory.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 4.9 KiB |
BIN
textures/celevator_car_wield.png
Normal file
BIN
textures/celevator_car_wield.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 4.8 KiB |
BIN
textures/celevator_door_glass_inventory.png
Normal file
BIN
textures/celevator_door_glass_inventory.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 573 B |
BIN
textures/celevator_machine_inventory.png
Normal file
BIN
textures/celevator_machine_inventory.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.2 KiB |
Loading…
x
Reference in New Issue
Block a user