mirror of
https://github.com/CHOMPStation2/CHOMPStation2.git
synced 2026-08-22 12:47:16 +01:00
Merge remote-tracking branch 'upstream/dev-freeze' into dev
This commit is contained in:
+63
-19
@@ -39,8 +39,6 @@
|
||||
|
||||
/turf/simulated/var/tmp/datum/gas_mixture/air
|
||||
|
||||
/turf/simulated/var/tmp/processing = 1
|
||||
|
||||
/turf/simulated/var/tmp/air_check_directions = 0 //Do not modify this, just add turf to air_master.tiles_to_update
|
||||
|
||||
/turf/simulated/var/tmp/unsim_check_directions = 0 //See above.
|
||||
@@ -61,8 +59,6 @@
|
||||
overlays.Add(slmaster)
|
||||
|
||||
/turf/simulated/New()
|
||||
..()
|
||||
|
||||
if(!blocks_air)
|
||||
air = new
|
||||
|
||||
@@ -84,6 +80,8 @@
|
||||
if(istype(target))
|
||||
air_master.tiles_to_update |= target
|
||||
|
||||
. = ..()
|
||||
|
||||
/turf/simulated/Del()
|
||||
if(active_hotspot)
|
||||
del(active_hotspot)
|
||||
@@ -168,23 +166,73 @@
|
||||
if(src in air_master.turfs_with_connections)
|
||||
air_master.AddConnectionToCheck(air_master.turfs_with_connections[src])
|
||||
|
||||
if(zone && CanPass(null, src, 0, 0))
|
||||
|
||||
if(zone && !air_master.zones_needing_rebuilt.Find(zone))
|
||||
for(var/direction in cardinal)
|
||||
var/turf/T = get_step(src,direction)
|
||||
if(!istype(T))
|
||||
continue
|
||||
|
||||
//I can connect to air or space in this direction
|
||||
if((air_check_directions & direction && !(air_directions_archived & direction)) || \
|
||||
(unsim_check_directions & direction && !(unsim_directions_archived & direction)))
|
||||
ZConnect(src,T)
|
||||
zone.ActivateIfNeeded()
|
||||
if(T.zone) T.zone.ActivateIfNeeded()
|
||||
//I can connect to air in this direction
|
||||
if(air_check_directions & direction || unsim_check_directions & direction)
|
||||
|
||||
//If either block air, we must look to see if the adjacent turfs need rebuilt.
|
||||
if(!CanPass(null, T, 0, 0))
|
||||
|
||||
//Target blocks air
|
||||
if(!T.CanPass(null, T, 0, 0))
|
||||
var/turf/NT = get_step(T, direction)
|
||||
|
||||
//If that turf is in my zone still, rebuild.
|
||||
if(istype(NT,/turf/simulated) && NT in zone.contents)
|
||||
air_master.zones_needing_rebuilt.Add(zone)
|
||||
|
||||
//If that is an unsimulated tile in my zone, see if we need to rebuild or just remove.
|
||||
else if(istype(NT) && NT in zone.unsimulated_tiles)
|
||||
var/consider_rebuild = 0
|
||||
for(var/d in cardinal)
|
||||
var/turf/UT = get_step(NT,d)
|
||||
if(istype(UT, /turf/simulated) && UT.zone == zone && UT.CanPass(null, NT, 0, 0)) //If we find a neighboring tile that is in the same zone, check if we need to rebuild
|
||||
consider_rebuild = 1
|
||||
break
|
||||
if(consider_rebuild)
|
||||
air_master.zones_needing_rebuilt.Add(zone) //Gotta check if we need to rebuild, dammit
|
||||
else
|
||||
zone.RemoveTurf(NT) //Not adjacent to anything, and unsimulated. Goodbye~
|
||||
|
||||
//To make a closed connection through closed door.
|
||||
ZConnect(T, src)
|
||||
|
||||
//If I block air.
|
||||
else if(T.zone && !air_master.zones_needing_rebuilt.Find(T.zone))
|
||||
var/turf/NT = get_step(src, reverse_direction(direction))
|
||||
|
||||
//If I am splitting a zone, rebuild.
|
||||
if(istype(NT,/turf/simulated) && (NT in T.zone.contents || (NT.zone && T in NT.zone.contents)))
|
||||
air_master.zones_needing_rebuilt.Add(T.zone)
|
||||
|
||||
//If NT is unsimulated, parse if I should remove it or rebuild.
|
||||
else if(istype(NT) && NT in T.zone.unsimulated_tiles)
|
||||
var/consider_rebuild = 0
|
||||
for(var/d in cardinal)
|
||||
var/turf/UT = get_step(NT,d)
|
||||
if(istype(UT, /turf/simulated) && UT.zone == T.zone && UT.CanPass(null, NT, 0, 0)) //If we find a neighboring tile that is in the same zone, check if we need to rebuild
|
||||
consider_rebuild = 1
|
||||
break
|
||||
|
||||
//Needs rebuilt.
|
||||
if(consider_rebuild)
|
||||
air_master.zones_needing_rebuilt.Add(T.zone)
|
||||
|
||||
//Not adjacent to anything, and unsimulated. Goodbye~
|
||||
else
|
||||
T.zone.RemoveTurf(NT)
|
||||
|
||||
else
|
||||
//Produce connection through open door.
|
||||
ZConnect(src,T)
|
||||
|
||||
//Something like a wall was built, changing the geometry.
|
||||
else if((!(air_check_directions & direction) && air_directions_archived & direction) || \
|
||||
(!(unsim_check_directions & direction) && unsim_directions_archived & direction))
|
||||
else if(air_directions_archived & direction || unsim_directions_archived & direction)
|
||||
var/turf/NT = get_step(T, direction)
|
||||
|
||||
//If the tile is in our own zone, and we cannot connect to it, better rebuild.
|
||||
@@ -207,16 +255,12 @@
|
||||
//The unsimulated turf is adjacent to another one of our zone's turfs,
|
||||
// better rebuild to be sure we didn't get cut in twain
|
||||
if(consider_rebuild)
|
||||
air_master.zones_needing_rebuilt.Add(zone)
|
||||
air_master.zones_needing_rebuilt.Add(NT.zone)
|
||||
|
||||
//Not adjacent to anything, and unsimulated. Goodbye~
|
||||
else
|
||||
zone.RemoveTurf(NT)
|
||||
|
||||
if(air_check_directions)
|
||||
processing = 1
|
||||
else
|
||||
processing = 0
|
||||
return 1
|
||||
|
||||
/turf/proc/HasDoor(turf/O)
|
||||
|
||||
+36
-20
@@ -50,11 +50,19 @@ var/list/CounterDoorDirections = list(SOUTH,EAST) //Which directions doors turfs
|
||||
air = new
|
||||
air.group_multiplier = contents.len
|
||||
for(var/turf/simulated/T in contents)
|
||||
air.oxygen += T.oxygen / air.group_multiplier
|
||||
air.nitrogen += T.nitrogen / air.group_multiplier
|
||||
air.carbon_dioxide += T.carbon_dioxide / air.group_multiplier
|
||||
air.toxins += T.toxins / air.group_multiplier
|
||||
air.temperature += T.temperature / air.group_multiplier
|
||||
if(!T.air)
|
||||
continue
|
||||
air.oxygen += T.air.oxygen / air.group_multiplier
|
||||
air.nitrogen += T.air.nitrogen / air.group_multiplier
|
||||
air.carbon_dioxide += T.air.carbon_dioxide / air.group_multiplier
|
||||
air.toxins += T.air.toxins / air.group_multiplier
|
||||
air.temperature += T.air.temperature / air.group_multiplier
|
||||
for(var/datum/gas/trace in T.air.trace_gases)
|
||||
var/datum/gas/corresponding_gas = locate(trace.type) in air.trace_gases
|
||||
if(!corresponding_gas)
|
||||
corresponding_gas = new trace.type()
|
||||
air.trace_gases.Add(corresponding_gas)
|
||||
corresponding_gas.moles += trace.moles
|
||||
air.update_values()
|
||||
|
||||
//Add this zone to the global list.
|
||||
@@ -69,40 +77,48 @@ var/list/CounterDoorDirections = list(SOUTH,EAST) //Which directions doors turfs
|
||||
for(var/turf/simulated/T in contents)
|
||||
RemoveTurf(T)
|
||||
air_master.ReconsiderTileZone(T)
|
||||
for(var/zone/Z in connected_zones)
|
||||
if(src in Z.connected_zones)
|
||||
Z.connected_zones.Remove(src)
|
||||
air_master.AddConnectionToCheck(connections)
|
||||
|
||||
if(air_master)
|
||||
air_master.zones.Remove(src)
|
||||
air_master.active_zones.Remove(src)
|
||||
air_master.zones_needing_rebuilt.Remove(src)
|
||||
air_master.AddConnectionToCheck(connections)
|
||||
|
||||
air = null
|
||||
|
||||
. = ..()
|
||||
|
||||
|
||||
//Handles deletion via garbage collection.
|
||||
/zone/proc/SoftDelete()
|
||||
air = null
|
||||
|
||||
if(air_master)
|
||||
air_master.zones.Remove(src)
|
||||
air_master.active_zones.Remove(src)
|
||||
air_master.zones_needing_rebuilt.Remove(src)
|
||||
air = null
|
||||
air_master.AddConnectionToCheck(connections)
|
||||
|
||||
connections = null
|
||||
for(var/connection/C in direct_connections)
|
||||
if(C.A.zone == src)
|
||||
C.A.zone = null
|
||||
if(C.B.zone == src)
|
||||
C.B.zone = null
|
||||
direct_connections = null
|
||||
|
||||
//Ensuring the zone list doesn't get clogged with null values.
|
||||
for(var/turf/simulated/T in contents)
|
||||
RemoveTurf(T)
|
||||
air_master.ReconsiderTileZone(T)
|
||||
|
||||
contents.Cut()
|
||||
|
||||
//Removing zone connections and scheduling connection cleanup
|
||||
for(var/zone/Z in connected_zones)
|
||||
if(src in Z.connected_zones)
|
||||
Z.connected_zones.Remove(src)
|
||||
connected_zones = null
|
||||
Z.connected_zones.Remove(src)
|
||||
Z.closed_connection_zones.Remove(src)
|
||||
|
||||
connected_zones = null
|
||||
closed_connection_zones = null
|
||||
|
||||
air_master.AddConnectionToCheck(connections)
|
||||
connections = null
|
||||
|
||||
return 1
|
||||
|
||||
@@ -715,9 +731,9 @@ zone/proc/Rebuild()
|
||||
current_adjacents = list()
|
||||
|
||||
for(var/direction in cardinal)
|
||||
if( !(current.air_check_directions & direction))
|
||||
continue
|
||||
var/turf/simulated/adjacent = get_step(current, direction)
|
||||
if(!current.ZCanPass(adjacent))
|
||||
continue
|
||||
if(adjacent in turfs)
|
||||
current_adjacents += adjacent
|
||||
adjacent_id = turfs[adjacent]
|
||||
|
||||
Reference in New Issue
Block a user