Adds AI ventcrawling code, does not implement it (#29661)

* bam

* push

* im trolling myself

* code

* ok lets go

* fix

* improvements
This commit is contained in:
Contrabang
2025-07-04 12:05:23 -07:00
committed by GitHub
parent b1908df76b
commit 211633f2b5
16 changed files with 478 additions and 5 deletions
@@ -466,4 +466,7 @@ Pipelines + Other Objects -> Pipe network
if(user)
to_chat(user, "<span class='notice'>You set the target pressure of [src] to maximum.</span>")
/obj/machinery/atmospherics/proc/get_machinery_pipelines()
return list()
#undef VENT_SOUND_DELAY
@@ -131,6 +131,9 @@
else if(A == node2)
return parent2
/obj/machinery/atmospherics/binary/get_machinery_pipelines()
return list(parent1, parent2)
/obj/machinery/atmospherics/binary/is_pipenet_split()
return TRUE
@@ -182,8 +182,11 @@
else if(A == node3)
return parent3
/obj/machinery/atmospherics/trinary/get_machinery_pipelines()
return list(parent1, parent2, parent3)
/obj/machinery/atmospherics/trinary/is_pipenet_split()
return FALSE
return TRUE
/obj/machinery/atmospherics/trinary/replacePipenet(datum/pipeline/Old, datum/pipeline/New)
if(Old == parent1)
@@ -90,6 +90,9 @@
/obj/machinery/atmospherics/unary/returnPipenet()
return parent
/obj/machinery/atmospherics/unary/get_machinery_pipelines()
return parent
/obj/machinery/atmospherics/unary/replacePipenet(datum/pipeline/Old, datum/pipeline/New)
if(Old == parent)
parent = New
@@ -231,3 +231,30 @@
/datum/pipeline/proc/remove_ventcrawler(mob/living/crawler)
UnregisterSignal(crawler, COMSIG_LIVING_EXIT_VENTCRAWL)
crawlers -= crawler
/**
* Gets all pipelines connected to this with valves, including src.
*/
/datum/pipeline/proc/get_connected_pipelines()
. = list()
var/list/possible_expansions = list(src)
while(length(possible_expansions))
var/datum/pipeline/P = popleft(possible_expansions)
if(!P)
break
. |= P
for(var/obj/machinery/atmospherics/V in P.other_atmosmch)
for(var/datum/pipeline/possible in V.get_machinery_pipelines())
if(possible in .)
continue
possible_expansions |= possible
/datum/pipeline/proc/get_ventcrawls(check_welded = TRUE)
. = list()
for(var/datum/pipeline/P in get_connected_pipelines())
for(var/obj/machinery/atmospherics/V in P.other_atmosmch)
if(!is_type_in_list(V, GLOB.ventcrawl_machinery))
continue
if(check_welded && !V.can_crawl_through())
continue
. |= V
@@ -541,8 +541,6 @@ GLOBAL_LIST_INIT(ventcrawl_machinery, list(/obj/machinery/atmospherics/unary/ven
var/ventcrawl_delay = 0 SECONDS
#else
var/ventcrawl_delay = 4.5 SECONDS
if(!client)
return
#endif
if(ismorph(src))
if(!do_after(src, ventcrawl_delay, target = src, hidden = TRUE))