summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorcheapie <cheapiephp@gmail.com>2026-07-28 05:25:40 -0500
committercheapie <cheapiephp@gmail.com>2026-07-28 05:25:40 -0500
commitf255c26924a0ef915ba53c15295c1e9de278b283 (patch)
treeef747ecbd0e3e20d3ae19c5b8e115a83506bf568
parent924fbc78f755bcd2917334bd28519bb614babac0 (diff)
downloadcelevator-f255c26924a0ef915ba53c15295c1e9de278b283.tar
celevator-f255c26924a0ef915ba53c15295c1e9de278b283.tar.gz
celevator-f255c26924a0ef915ba53c15295c1e9de278b283.tar.bz2
celevator-f255c26924a0ef915ba53c15295c1e9de278b283.tar.xz
celevator-f255c26924a0ef915ba53c15295c1e9de278b283.zip
Improve input validation
-rw-r--r--controllerfw.lua6
-rw-r--r--dispatcherfw.lua2
-rw-r--r--drive_entity.lua3
3 files changed, 6 insertions, 5 deletions
diff --git a/controllerfw.lua b/controllerfw.lua
index 129fa71..fe23066 100644
--- a/controllerfw.lua
+++ b/controllerfw.lua
@@ -397,7 +397,7 @@ elseif event.type == "ui" then
if event.fields.back or event.fields.save then
mem.screenstate = (mem.screenstate == "oobe_floortable_edit" and "oobe_floortable" or "floortable")
local height = tonumber(event.fields.height)
- if height then
+ if height and height < (tonumber(core.settings:get("celevator.max_height")) or 100) then
height = math.floor(height+0.5)
mem.params.floorheights[mem.editingfloor] = math.max(1,height)
end
@@ -481,10 +481,10 @@ elseif event.type == "ui" then
end
end
end
- if event.fields.scrollup then
+ if event.fields.scrollup and (mem.screenpage-1)*10+1 < #mem.params.floornames then
mem.screenpage = mem.screenpage + 1
mem.scrollfollowscar = false
- elseif event.fields.scrolldown then
+ elseif event.fields.scrolldown and mem.screenpage > 1 then
mem.screenpage = mem.screenpage - 1
mem.scrollfollowscar = false
elseif event.fields.scrollfollowscar then
diff --git a/dispatcherfw.lua b/dispatcherfw.lua
index 250a4d1..7793091 100644
--- a/dispatcherfw.lua
+++ b/dispatcherfw.lua
@@ -420,7 +420,7 @@ elseif event.type == "ui" then
if event.fields.back or event.fields.save then
mem.screenstate = (mem.screenstate == "oobe_floortable_edit" and "oobe_floortable" or "floortable")
local height = tonumber(event.fields.height)
- if height then
+ if height and height < (tonumber(core.settings:get("celevator.max_height")) or 100) then
height = math.floor(height+0.5)
mem.params.floorheights[mem.editingfloor] = math.max(1,height)
end
diff --git a/drive_entity.lua b/drive_entity.lua
index 10ce0e2..71cba85 100644
--- a/drive_entity.lua
+++ b/drive_entity.lua
@@ -721,7 +721,7 @@ function celevator.drives.entity.moveto(pos,target,inspection)
meta:set_string("fault","badorigin")
return
end
- if target < 0 or origin.y + target > (carinfo.machinepos.y-3) then
+ if target < 0 or origin.y + target > (carinfo.machinepos.y-3) or target ~= target then
meta:set_string("fault","outofbounds")
return
end
@@ -790,6 +790,7 @@ end
function celevator.drives.entity.setmaxvel(pos,maxvel)
+ if maxvel ~= maxvel then return end
local meta = celevator.get_meta(pos)
meta:set_string("maxvel",tostring(maxvel))
end