diff options
| -rw-r--r-- | controllerfw.lua | 20 | ||||
| -rw-r--r-- | dispatcherfw.lua | 23 | 
2 files changed, 41 insertions, 2 deletions
| diff --git a/controllerfw.lua b/controllerfw.lua index 2b29db2..1850a1e 100644 --- a/controllerfw.lua +++ b/controllerfw.lua @@ -235,6 +235,24 @@ if mem.params and not mem.params.secoverrideusers then mem.params.secoverrideuse  if mem.params and mem.params.swingcallwhennotswing == nil then mem.params.swingcallwhennotswing = true end  if not mem.editinguser then mem.editinguser = 1 end +if mem.params and #mem.params.floornames < 2 then +	mem.params.floornames = {"1","2","3"} +	mem.params.floorheights = {5,5,5} +	mem.carstate = "bfdemand" +	if mem.doorstate == "closed" then +		drivecmd({ +			command = "setmaxvel", +			maxvel = mem.params.contractspeed, +		}) +		drivecmd({command = "resetpos"}) +		interrupt(0.1,"checkdrive") +		mem.carmotion = true +		juststarted = true +	else +		close() +	end +end +  if event.type == "program" then  	mem.carstate = "uninit"  	mem.editingfloor = 1 @@ -344,7 +362,7 @@ elseif event.type == "ui" then  		elseif event.fields.add then  			table.insert(mem.params.floorheights,5)  			table.insert(mem.params.floornames,tostring(#mem.params.floornames+1)) -		elseif event.fields.remove then +		elseif event.fields.remove and #mem.params.floornames > 2 then  			table.remove(mem.params.floorheights,mem.editingfloor)  			table.remove(mem.params.floornames,mem.editingfloor)  			mem.editingfloor = math.max(1,mem.editingfloor-1) diff --git a/dispatcherfw.lua b/dispatcherfw.lua index 25ad4f8..9b0a23b 100644 --- a/dispatcherfw.lua +++ b/dispatcherfw.lua @@ -300,6 +300,27 @@ local function fs(element)  	mem.formspec = mem.formspec..element  end +if mem.params and #mem.params.floornames < 2 then +	mem.params.floorheights = {5,5,5} +	mem.params.floornames = {"1","2","3"} +	for _,carid in ipairs(mem.params.carids) do +		local floornames = {} +		local floorheights = {} +		for i=1,#mem.params.floornames,1 do +			if mem.params.floorsserved[carid][i] then +				table.insert(floornames,mem.params.floornames[i]) +				table.insert(floorheights,mem.params.floorheights[i]) +			elseif #floornames > 0 then +				floorheights[#floorheights] = floorheights[#floorheights]+mem.params.floorheights[i] +			end +		end +		send(carid,"newfloortable",{ +			floornames = floornames, +			floorheights = floorheights, +		}) +	end +end +  if event.type == "program" then  	mem.carstatus = {}  	mem.screenstate = "oobe_welcome" @@ -367,7 +388,7 @@ elseif event.type == "ui" then  		elseif event.fields.add then  			table.insert(mem.params.floorheights,5)  			table.insert(mem.params.floornames,tostring(#mem.params.floornames+1)) -		elseif event.fields.remove then +		elseif event.fields.remove and #mem.params.floornames > 2 then  			table.remove(mem.params.floorheights,mem.editingfloor)  			table.remove(mem.params.floornames,mem.editingfloor)  			mem.editingfloor = math.max(1,mem.editingfloor-1) | 
