mirror of
https://github.com/CHOMPStation2/CHOMPStation2.git
synced 2025-12-10 10:12:45 +00:00
add sleeping for ZAS connection edges
Edges will sleep and fully balance if compare() passes. also some small small xgm tweaks. Signed-off-by: Mloc-Argent <colmohici@gmail.com>
This commit is contained in:
@@ -75,6 +75,7 @@ Class Procs:
|
||||
/datum/controller/air_system/var/list/zones_to_update = list()
|
||||
/datum/controller/air_system/var/list/active_fire_zones = list()
|
||||
/datum/controller/air_system/var/list/active_hotspots = list()
|
||||
/datum/controller/air_system/var/list/active_edges = list()
|
||||
|
||||
/datum/controller/air_system/var/active_zones = 0
|
||||
|
||||
@@ -97,7 +98,7 @@ Class Procs:
|
||||
set background = 1
|
||||
#endif
|
||||
|
||||
world << "\red \b Processing Geometry..."
|
||||
world << "<span class='danger'>Processing Geometry...</span>"
|
||||
sleep(-1)
|
||||
|
||||
var/start_time = world.timeofday
|
||||
@@ -108,10 +109,15 @@ Class Procs:
|
||||
simulated_turf_count++
|
||||
S.update_air_properties()
|
||||
|
||||
world << {"<font color='red'><b>Geometry initialized in [round(0.1*(world.timeofday-start_time),0.1)] seconds.</b>
|
||||
world << {"<span class='danger'>Geometry initialized in [round(0.1*(world.timeofday-start_time),0.1)] seconds.</b></span>
|
||||
<span class='info'>
|
||||
Total Simulated Turfs: [simulated_turf_count]
|
||||
Total Zones: [zones.len]
|
||||
Total Unsimulated Turfs: [world.maxx*world.maxy*world.maxz - simulated_turf_count]</font>"}
|
||||
Total Edges: [edges.len]
|
||||
Total Active Edges: [active_edges.len ? "<span class='danger'>[active_edges.len]</span>" : "None"]
|
||||
Total Unsimulated Turfs: [world.maxx*world.maxy*world.maxz - simulated_turf_count]</font>
|
||||
</span>"}
|
||||
|
||||
|
||||
// spawn Start()
|
||||
|
||||
@@ -169,7 +175,7 @@ Total Unsimulated Turfs: [world.maxx*world.maxy*world.maxz - simulated_turf_coun
|
||||
if(.)
|
||||
tick_progress = "processing edges"
|
||||
|
||||
for(var/connection_edge/edge in edges)
|
||||
for(var/connection_edge/edge in active_edges)
|
||||
edge.tick()
|
||||
|
||||
//Process fire zones.
|
||||
@@ -299,6 +305,22 @@ Total Unsimulated Turfs: [world.maxx*world.maxy*world.maxz - simulated_turf_coun
|
||||
zones_to_update.Add(Z)
|
||||
Z.needs_update = 1
|
||||
|
||||
/datum/controller/air_system/proc/mark_edge_sleeping(connection_edge/E)
|
||||
#ifdef ZASDBG
|
||||
ASSERT(istype(E)
|
||||
#endif
|
||||
if(E.sleeping) return
|
||||
active_edges.Remove(E)
|
||||
E.sleeping = 1
|
||||
|
||||
/datum/controller/air_system/proc/mark_edge_active(connection_edge/E)
|
||||
#ifdef ZASDBG
|
||||
ASSERT(istype(E)
|
||||
#endif
|
||||
if(!E.sleeping) return
|
||||
active_edges.Add(E)
|
||||
E.sleeping = 0
|
||||
|
||||
/datum/controller/air_system/proc/equivalent_pressure(zone/A, zone/B)
|
||||
return A.air.compare(B.air)
|
||||
|
||||
@@ -309,12 +331,14 @@ Total Unsimulated Turfs: [world.maxx*world.maxy*world.maxz - simulated_turf_coun
|
||||
if(edge.contains_zone(B)) return edge
|
||||
var/connection_edge/edge = new/connection_edge/zone(A,B)
|
||||
edges.Add(edge)
|
||||
edge.recheck()
|
||||
return edge
|
||||
else
|
||||
for(var/connection_edge/unsimulated/edge in A.edges)
|
||||
if(has_same_air(edge.B,B)) return edge
|
||||
var/connection_edge/edge = new/connection_edge/unsimulated(A,B)
|
||||
edges.Add(edge)
|
||||
edge.recheck()
|
||||
return edge
|
||||
|
||||
/datum/controller/air_system/proc/has_same_air(turf/A, turf/B)
|
||||
@@ -325,5 +349,6 @@ Total Unsimulated Turfs: [world.maxx*world.maxy*world.maxz - simulated_turf_coun
|
||||
if(A.temperature != B.temperature) return 0
|
||||
return 1
|
||||
|
||||
/datum/controller/air_system/proc/remove_edge(connection/c)
|
||||
edges.Remove(c)
|
||||
/datum/controller/air_system/proc/remove_edge(connection_edge/E)
|
||||
edges.Remove(E)
|
||||
if(!E.sleeping) active_edges.Remove(E)
|
||||
Reference in New Issue
Block a user