summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--README54
-rw-r--r--controller.lua6
-rw-r--r--crafts.lua3
-rw-r--r--dispatcher.lua6
-rw-r--r--docs/README2
-rw-r--r--docs/celevator_controller_manual.pdfbin2193128 -> 2192852 bytes
-rw-r--r--doors.lua14
-rw-r--r--drive_entity.lua4
-rw-r--r--drive_null.lua4
-rw-r--r--laptop.lua24
-rw-r--r--screenshot.pngbin0 -> 236634 bytes
-rw-r--r--textures/celevator_door_glass_inventory.pngbin573 -> 244 bytes
12 files changed, 115 insertions, 2 deletions
diff --git a/README b/README
new file mode 100644
index 0000000..a4a8104
--- /dev/null
+++ b/README
@@ -0,0 +1,54 @@
+celevator
+Fully functional realistic elevators for Luanti/Minetest (5.7+)
+===============================================================
+
+Description
+-----------
+
+Adds fully functional, realistic elevators capable of moving players between multiple floors in a building.
+
+Features include:
+
+ 2 to 100 floors with customizable names
+ Travel speed adjustable for each elevator independently, up to 20m/s (more than 7.5m/s not recommended in multiplayer)
+ Can travel through loaded or unloaded mapblocks
+ Full selective-collective operation
+ Group dispatching with up to 16 cars in a group and true ETA dispatching
+ Optional destination-based dispatching
+ Swing car operation
+ Animated doors, hoist machine, and tapehead
+ Controller interface with diagnostic LEDs, display, and GUI configuration
+ Optional car call security settings (require area access to place a car call, or disallow car calls to a specific floor entirely)
+ Functional independent service and fire service phase I and II (approximately following ASME A17.1 codes) modes
+ Car top and machine room inspection operation with adjustable speed
+ Adjustable door dwell and nudging timers
+ mView remote monitoring software (optional, available if "laptop" mod is installed)
+ Mesecons input and output modules (optional, available if "mesecons" mod is installed)
+ Communication with Luacontrollers via digilines input/output modules (optional, available if "digilines" mod is installed)
+
+Documentation
+-------------
+
+Documentation is located in the "docs" subdirectory.
+See "docs/celevator_controller_manual.pdf" for full installation and setup instructions.
+
+Contributing
+------------
+
+If you would like to contribute code, the easiest way is to publish your changes somewhere and request that I pull them.
+I can be reached on Libera.Chat in #luanti as "cheapie", or you can contact me via ContentDB or the Luanti forums (same username).
+If you don't have anywhere to publish your changes, I can also accept patches.
+
+Reporting Issues
+----------------
+
+See the previous "Contributing" section for contact information.
+You are encouraged to report any issues you have to me using any of those contact methods.
+If you just have a question or you're not sure if something is a bug, IRC is probably the easiest method.
+
+License
+-------
+
+This software is offered under The Unlicense.
+See the LICENSE file for the full license text.
+If you do use this code for something I'd love to hear what it is, but you're not required to tell me.
diff --git a/controller.lua b/controller.lua
index 0a43eff..2921f81 100644
--- a/controller.lua
+++ b/controller.lua
@@ -645,7 +645,9 @@ end
function celevator.controller.checkiqueue(dtime)
for hash,iqueue in pairs(celevator.controller.iqueue) do
local pos = minetest.get_position_from_hash(hash)
+ local noneleft = true
for iid,time in pairs(iqueue) do
+ noneleft = false
iqueue[iid] = time-dtime
if iqueue[iid] < 0 then
iqueue[iid] = nil
@@ -655,6 +657,10 @@ function celevator.controller.checkiqueue(dtime)
celevator.controller.run(pos,event)
end
end
+ if noneleft then
+ celevator.controller.iqueue[hash] = nil
+ celevator.storage:set_string("controller_iqueue",minetest.serialize(celevator.controller.iqueue))
+ end
end
end
diff --git a/crafts.lua b/crafts.lua
index f998429..13a8b93 100644
--- a/crafts.lua
+++ b/crafts.lua
@@ -29,6 +29,9 @@ if not xcompat_available then
m.mese = "mesecons_torch:redstoneblock" -- mcla still carries this as an alias
m.pick_steel = "mcl_core:pick_steel"
m.torch = "mcl_torches:torch"
+ else
+ minetest.log("warning","[celevator] Unsupported game and xcompat not found, not registering craft recipes")
+ return
end
if minetest.get_modpath("dye") then
m.dye_black = "dye:black"
diff --git a/dispatcher.lua b/dispatcher.lua
index a8bcf1c..02533ff 100644
--- a/dispatcher.lua
+++ b/dispatcher.lua
@@ -422,7 +422,9 @@ end
function celevator.dispatcher.checkiqueue(dtime)
for hash,iqueue in pairs(celevator.dispatcher.iqueue) do
local pos = minetest.get_position_from_hash(hash)
+ local noneleft = true
for iid,time in pairs(iqueue) do
+ noneleft = false
iqueue[iid] = time-dtime
if iqueue[iid] < 0 then
iqueue[iid] = nil
@@ -432,6 +434,10 @@ function celevator.dispatcher.checkiqueue(dtime)
celevator.dispatcher.run(pos,event)
end
end
+ if noneleft then
+ celevator.dispatcher.iqueue[hash] = nil
+ celevator.storage:set_string("dispatcher_iqueue",minetest.serialize(celevator.dispatcher.iqueue))
+ end
end
end
diff --git a/docs/README b/docs/README
index 4928bef..a53637c 100644
--- a/docs/README
+++ b/docs/README
@@ -1,2 +1,4 @@
Source for celevator_controller_manual.pdf is not included in this repository due to its large size.
If desired, the file can be downloaded from: https://cheapiesystems.com/media/celevator_controller_manual.odt
+
+This isn't the README for the whole project, go up one folder for that.
diff --git a/docs/celevator_controller_manual.pdf b/docs/celevator_controller_manual.pdf
index 2da5ca1..0bca94b 100644
--- a/docs/celevator_controller_manual.pdf
+++ b/docs/celevator_controller_manual.pdf
Binary files differ
diff --git a/doors.lua b/doors.lua
index 8528449..75cbb8b 100644
--- a/doors.lua
+++ b/doors.lua
@@ -2,6 +2,12 @@ celevator.doors = {}
celevator.doors.erefs = {}
+--These get overwritten on globalstep and aren't settings.
+--They're just set to true here so the globalstep functions run at least once,
+--in case a door was moving when the server last shut down.
+celevator.doors.hwdoor_step_enabled = true
+celevator.doors.cardoor_step_enabled = true
+
local function placesill(pos,node)
local erefs = minetest.get_objects_inside_radius(pos,0.5)
for _,ref in pairs(erefs) do
@@ -412,6 +418,7 @@ minetest.register_entity("celevator:hwdoor_moving",{
})
function celevator.doors.hwopen(pos,drivepos)
+ celevator.doors.hwdoor_step_enabled = true
local hwdoors_moving = minetest.deserialize(celevator.storage:get_string("hwdoors_moving")) or {}
local hash = minetest.hash_node_position(pos)
if not hwdoors_moving[hash] then
@@ -475,6 +482,7 @@ function celevator.doors.hwopen(pos,drivepos)
end
function celevator.doors.hwclose(pos,drivepos,nudge)
+ celevator.doors.hwdoor_step_enabled = true
local hwdoors_moving = minetest.deserialize(celevator.storage:get_string("hwdoors_moving")) or {}
local hash = minetest.hash_node_position(pos)
if hwdoors_moving[hash] then
@@ -513,6 +521,7 @@ function celevator.doors.hwclose(pos,drivepos,nudge)
end
function celevator.doors.hwstep(dtime)
+ if not celevator.doors.hwdoor_step_enabled then return end
local hwdoors_moving = minetest.deserialize(celevator.storage:get_string("hwdoors_moving")) or {}
local save = false
for hash,data in pairs(hwdoors_moving) do
@@ -587,11 +596,13 @@ function celevator.doors.hwstep(dtime)
if save then
celevator.storage:set_string("hwdoors_moving",minetest.serialize(hwdoors_moving))
end
+ celevator.doors.hwdoor_step_enabled = save
end
minetest.register_globalstep(celevator.doors.hwstep)
function celevator.doors.carstep(dtime)
+ if not celevator.doors.cardoor_step_enabled then return end
local cardoors_moving = minetest.deserialize(celevator.storage:get_string("cardoors_moving")) or {}
local save = false
for hash,data in pairs(cardoors_moving) do
@@ -663,6 +674,7 @@ function celevator.doors.carstep(dtime)
if save then
celevator.storage:set_string("cardoors_moving",minetest.serialize(cardoors_moving))
end
+ celevator.doors.cardoor_step_enabled = save
end
minetest.register_globalstep(celevator.doors.carstep)
@@ -708,6 +720,7 @@ function celevator.doors.spawncardoors(pos,dir,doortype,replace)
end
function celevator.doors.caropen(pos)
+ celevator.doors.cardoor_step_enabled = true
local cardoors_moving = minetest.deserialize(celevator.storage:get_string("cardoors_moving")) or {}
local hash = minetest.hash_node_position(pos)
local cartimer = minetest.get_node_timer(pos)
@@ -770,6 +783,7 @@ function celevator.doors.caropen(pos)
end
function celevator.doors.carclose(pos,nudge)
+ celevator.doors.cardoor_step_enabled = true
local cardoors_moving = minetest.deserialize(celevator.storage:get_string("cardoors_moving")) or {}
local hash = minetest.hash_node_position(pos)
if cardoors_moving[hash] then
diff --git a/drive_entity.lua b/drive_entity.lua
index 0ddd4c4..532b919 100644
--- a/drive_entity.lua
+++ b/drive_entity.lua
@@ -9,6 +9,7 @@ celevator.drives.entity = {
carsoundstate = {},
entityinfo = {},
sheaverefs = {},
+ step_enabled = true, --Not a setting, is overwritten on globalstep, true here to check for running drives on startup
}
local playerposlimits = {}
@@ -459,6 +460,7 @@ function celevator.drives.entity.entitiestonodes(refs,carid)
end
function celevator.drives.entity.step(dtime)
+ if not celevator.drives.entity.step_enabled then return end
local entitydrives_running = minetest.deserialize(celevator.storage:get_string("entitydrives_running")) or {}
local save = false
for i,hash in ipairs(entitydrives_running) do
@@ -644,6 +646,7 @@ function celevator.drives.entity.step(dtime)
if save then
celevator.storage:set_string("entitydrives_running",minetest.serialize(entitydrives_running))
end
+ celevator.drives.entity.step_enabled = save
end
minetest.register_globalstep(celevator.drives.entity.step)
@@ -704,6 +707,7 @@ function celevator.drives.entity.moveto(pos,target,inspection)
end
end
if not running then
+ celevator.drives.entity.step_enabled = true
table.insert(entitydrives_running,hash)
celevator.storage:set_string("entitydrives_running",minetest.serialize(entitydrives_running))
--Controller needs to see something so it knows the drive is running
diff --git a/drive_null.lua b/drive_null.lua
index 1a22e22..2664d47 100644
--- a/drive_null.lua
+++ b/drive_null.lua
@@ -3,6 +3,7 @@ celevator.drives.null = {
description = "Simulation only, no movement, for testing and demonstration",
nname = "celevator:drive_null",
soundhandles = {},
+ step_enabled = true, --Not a setting, is overwritten on globalstep, true here to check for running drives on startup
}
local function update_ui(pos)
@@ -90,6 +91,7 @@ minetest.register_node("celevator:drive_null",{
})
function celevator.drives.null.step(dtime)
+ if not celevator.drives.null.step_enabled then return end
local nulldrives_running = minetest.deserialize(celevator.storage:get_string("nulldrives_running")) or {}
local save = false
for i,hash in ipairs(nulldrives_running) do
@@ -146,6 +148,7 @@ function celevator.drives.null.step(dtime)
if save then
celevator.storage:set_string("nulldrives_running",minetest.serialize(nulldrives_running))
end
+ celevator.drives.null.step_enabled = save
end
minetest.register_globalstep(celevator.drives.null.step)
@@ -163,6 +166,7 @@ function celevator.drives.null.moveto(pos,target)
end
end
if not running then
+ celevator.drives.null.step_enabled = true
table.insert(nulldrives_running,hash)
celevator.storage:set_string("nulldrives_running",minetest.serialize(nulldrives_running))
end
diff --git a/laptop.lua b/laptop.lua
index a65739c..bbfe0a5 100644
--- a/laptop.lua
+++ b/laptop.lua
@@ -61,6 +61,10 @@ laptop.register_app("celevator",{
fs = fs..mtos.theme:get_label("0.5,1","Could not find a controller or dispatcher with the given ID.")
fs = fs..mtos.theme:get_label("0.5,1.3","Please check the ID number and try again.")
fs = fs..mtos.theme:get_button("0.5,3;2,1","major","ok","OK")
+ elseif ram.screenstate == "protected" then
+ fs = fs..mtos.theme:get_label("0.5,0.5","Error")
+ fs = fs..mtos.theme:get_label("0.5,1","Controller or dispatcher is protected.")
+ fs = fs..mtos.theme:get_button("0.5,3;2,1","major","ok","OK")
elseif ram.screenstate == "dispatcherstatus" then
local connection = mem.connections[mem.selectedconnection]
local pos = connection.pos
@@ -201,6 +205,7 @@ laptop.register_app("celevator",{
indep = "Independent Service",
capture = "Captured",
test = "Test Mode",
+ swing = "Swing Operation",
}
local doorstates = {
open = "Open",
@@ -331,10 +336,16 @@ laptop.register_app("celevator",{
mem.screenpage = 1
if exp.type == "DCL" then mem.selectedconnection = #mem.connections-exp.index+1 end
local connection = mem.connections[mem.selectedconnection]
- if connection.itemtype == "controller" and celevator.controller.iscontroller(connection.pos) then
+ local cpos = connection.pos
+ if minetest.is_protected(cpos,mtos.sysram.current_player) and not minetest.check_player_privs(mtos.sysram.current_player,{protection_bypass=true}) then
+ minetest.record_protection_violation(cpos,mtos.sysram.current_player)
+ ram.screenstate = "protected"
+ return
+ end
+ if connection.itemtype == "controller" and celevator.controller.iscontroller(cpos) then
ram.screenstate = "controllerstatus"
app:get_timer():start(0.2)
- elseif connection.itemtype == "dispatcher" and celevator.dispatcher.isdispatcher(connection.pos) then
+ elseif connection.itemtype == "dispatcher" and celevator.dispatcher.isdispatcher(cpos) then
ram.screenstate = "dispatcherstatus"
app:get_timer():start(0.2)
else
@@ -365,6 +376,11 @@ laptop.register_app("celevator",{
ram.screenstate = "notfound"
return
end
+ if minetest.is_protected(pos,mtos.sysram.current_player) and not minetest.check_player_privs(mtos.sysram.current_player,{protection_bypass=true}) then
+ minetest.record_protection_violation(pos,mtos.sysram.current_player)
+ ram.screenstate = "protected"
+ return
+ end
local connection = {
name = fields.name,
carid = carid,
@@ -381,6 +397,10 @@ laptop.register_app("celevator",{
if fields.ok then
ram.screenstate = "newconnection"
end
+ elseif ram.screenstate == "protected" then
+ if fields.ok then
+ ram.screenstate = #mem.connections > 0 and "connections" or "newconnection"
+ end
elseif ram.screenstate == "dispatcherstatus" then
if fields.disconnect then
ram.screenstate = "connections"
diff --git a/screenshot.png b/screenshot.png
new file mode 100644
index 0000000..907df06
--- /dev/null
+++ b/screenshot.png
Binary files differ
diff --git a/textures/celevator_door_glass_inventory.png b/textures/celevator_door_glass_inventory.png
index 4ebf6f9..2538465 100644
--- a/textures/celevator_door_glass_inventory.png
+++ b/textures/celevator_door_glass_inventory.png
Binary files differ