mirror of
https://github.com/yogstation13/Yogstation.git
synced 2025-02-26 09:04:50 +00:00
[READY]pathfinding circuitry upgrade (#36398)
* all in one * fixfixfix * uhhhh * demuxdemuxdemuxdemux * wire eriw * icon noci * tihsxifixshit * rewopower * fixif * screeneercs * returnruter
This commit is contained in:
committed by
yogstation13-bot
parent
341843ddc8
commit
c575ebbe7a
@@ -2,39 +2,47 @@ SUBSYSTEM_DEF(pathfinder)
|
||||
name = "pathfinder"
|
||||
init_order = INIT_ORDER_PATH
|
||||
flags = SS_NO_FIRE
|
||||
var/lcount = 10
|
||||
var/run
|
||||
var/free
|
||||
var/list/flow
|
||||
var/datum/flowcache/mobs
|
||||
var/datum/flowcache/circuits
|
||||
var/static/space_type_cache
|
||||
|
||||
/datum/controller/subsystem/pathfinder/Initialize()
|
||||
space_type_cache = typecacheof(/turf/open/space)
|
||||
run = 0
|
||||
free = 1
|
||||
flow = new()
|
||||
flow.len=lcount
|
||||
|
||||
mobs = new(10)
|
||||
circuits = new(3)
|
||||
return ..()
|
||||
|
||||
/datum/controller/subsystem/pathfinder/proc/getfree(atom/M)
|
||||
/datum/flowcache
|
||||
var/lcount
|
||||
var/run
|
||||
var/free
|
||||
var/list/flow
|
||||
|
||||
/datum/flowcache/New(var/n)
|
||||
.=..()
|
||||
lcount = n
|
||||
run = 0
|
||||
free = 1
|
||||
flow = new/list(lcount)
|
||||
|
||||
/datum/flowcache/proc/getfree(atom/M)
|
||||
if(run < lcount)
|
||||
run += 1
|
||||
while(flow[free])
|
||||
CHECK_TICK
|
||||
free = (free % lcount) + 1
|
||||
var/t = addtimer(CALLBACK(SSpathfinder, /datum/controller/subsystem/pathfinder.proc/toolong, free), 150, TIMER_STOPPABLE)
|
||||
var/t = addtimer(CALLBACK(src, /datum/flowcache.proc/toolong, free), 150, TIMER_STOPPABLE)
|
||||
flow[free] = t
|
||||
flow[t] = M
|
||||
return free
|
||||
else
|
||||
return 0
|
||||
|
||||
/datum/controller/subsystem/pathfinder/proc/toolong(l)
|
||||
/datum/flowcache/proc/toolong(l)
|
||||
log_game("Pathfinder route took longer than 150 ticks, src bot [flow[flow[l]]]")
|
||||
found(l)
|
||||
|
||||
/datum/controller/subsystem/pathfinder/proc/found(l)
|
||||
/datum/flowcache/proc/found(l)
|
||||
deltimer(flow[l])
|
||||
flow[l] = null
|
||||
run -= 1
|
||||
|
||||
@@ -15,7 +15,7 @@ PROCESSING_SUBSYSTEM_DEF(circuit)
|
||||
var/cost_multiplier = MINERAL_MATERIAL_AMOUNT / 10 // Each circuit cost unit is 200cm3
|
||||
|
||||
/datum/controller/subsystem/processing/circuit/Initialize(start_timeofday)
|
||||
SScircuit.cipherkey = random_string(2000+rand(0,10), GLOB.alphabet)
|
||||
SScircuit.cipherkey = uppertext(random_string(2000+rand(0,10), GLOB.alphabet))
|
||||
circuits_init()
|
||||
return ..()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user