update advtrains_line_automation

This commit is contained in:
Sergei Mozhaisky 2019-12-16 10:24:56 +00:00
parent 248722f401
commit ad4c901937
4 changed files with 21 additions and 16 deletions

View File

@ -0,0 +1,11 @@
minetest.register_craft({
type="shapeless",
output = 'advtrains_line_automation:dtrack_stop_placer',
recipe = {
"advtrains:dtrack_placer",
"technic:control_logic_unit",
"dye:black",
"dye:yellow",
},
})

View File

@ -21,6 +21,10 @@ if minetest.get_modpath("advtrains_interlocking") then
dofile(MP.."/craft/advtrains_interlocking.lua")
end
if minetest.get_modpath("advtrains_line_automation") then
dofile(MP.."/craft/advtrains_line_automation.lua")
end
if minetest.get_modpath("advtrains_luaautomation") then
dofile(MP.."/craft/advtrains_luaautomation.lua")
end
end

View File

@ -22,18 +22,6 @@ dofile(modpath.."railwaytime.lua")
dofile(modpath.."scheduler.lua")
dofile(modpath.."stoprail.lua")
minetest.register_craft({
type="shapeless",
output = 'advtrains_line_automation:dtrack_stop_placer',
recipe = {
"advtrains:dtrack_placer",
"technic:control_logic_unit",
"dye:black",
"dye:yellow",
},
})
function advtrains.lines.load(data)
if data then

View File

@ -90,7 +90,7 @@ function sched.enqueue(rwtime, handler, evtdata, unitid, unitlim)
ucn = (units_cnt[unitid] or 0)
local ulim=(unitlim or UNITS_THRESH)
if ucn >= ulim then
atwarn("[lines][scheduler] discarding enqueue for",handler,"(limit",ulim,") because unit",unitid,"has already",ucn,"schedules enqueued")
atlog("[lines][scheduler] discarding enqueue for",handler,"(limit",ulim,") because unit",unitid,"has already",ucn,"schedules enqueued")
return false
end
@ -118,10 +118,12 @@ end
-- Discards all schedules for unit "unitid" (removes them from the queue)
function sched.discard_all(unitid)
for i=1,#queue do
local i = 1
while i<=#queue do
if queue[i].u == unitid then
table.remove(queue,i)
i=i-1
else
i=i+1
end
end
units_cnt[unitid] = 0