Skip to content

Commit

Permalink
Add "Fix air" proc (#8498)
Browse files Browse the repository at this point in the history
* Add 'Fix air' proc

* Update code/ZAS/Turf.dm
  • Loading branch information
SirRichardFrancis authored Jul 5, 2024
1 parent 1680a33 commit 0b99cfc
Show file tree
Hide file tree
Showing 4 changed files with 59 additions and 1 deletion.
24 changes: 24 additions & 0 deletions code/ZAS/Turf.dm
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,30 @@
air.copy_from(zone.air)
air.group_multiplier = 1

/turf/proc/reset_air()
QDEL_NULL(fire)
var/list/initial_gas = new

var/initial_oxygen = initial(oxygen)
if(initial_oxygen)
initial_gas["oxygen"] = initial_oxygen

var/initial_carbon_dioxide = initial(carbon_dioxide)
if(initial_carbon_dioxide )
initial_gas["carbon_dioxide"] = initial_carbon_dioxide

var/initial_nitrogen = initial(nitrogen)
if(initial_nitrogen)
initial_gas["nitrogen"] = initial_nitrogen

var/initial_plasma = initial(plasma)
if(initial_plasma )
initial_gas["plasma"] = initial_plasma

air.gas = initial_gas
air.temperature = initial(temperature)
air.update_values()


// LINDA proc placeholder, used for compatibility with some tgstation code
/turf/proc/GetAtmosAdjacentTurfs(alldir = FALSE)
Expand Down
2 changes: 1 addition & 1 deletion code/controllers/subsystems/air.dm
Original file line number Diff line number Diff line change
Expand Up @@ -375,7 +375,7 @@ SUBSYSTEM_DEF(air)

var/direct = !(block & ZONE_BLOCKED)

if(!istype(B, /turf/space))
if(!istype(B, /turf/space) && B.is_simulated && A.is_simulated)
if(min(A.zone.contents.len, B.zone.contents.len) < ZONE_MIN_SIZE || (direct && (equivalent_pressure(A.zone, B.zone) || times_fired == 0)))
merge(A.zone, B.zone)
return
Expand Down
1 change: 1 addition & 0 deletions code/game/objects/items/weapons/grenades/grenade.dm
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@
var/turf/T = get_turf(src)
if(T)
T.hotspot_expose(700,125)
if(user && user.hud_used)
user.hud_used.updatePlaneMasters(user)


Expand Down
33 changes: 33 additions & 0 deletions code/modules/admin/admin_verbs.dm
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,7 @@ GLOBAL_LIST_INIT(admin_verbs_admin, list(
/client/proc/unban_panel,
/client/proc/game_panel,
/client/proc/secrets,
/client/proc/fix_air,
/client/proc/colorooc,
/client/proc/stealth,
/client/proc/togglebuildmodeself,
Expand Down Expand Up @@ -355,6 +356,38 @@ GLOBAL_LIST_INIT(admin_verbs_admin, list(
if (holder)
holder.Secrets()

/client/proc/fix_air()
set name = "Fix air (lags)"
set category = "Admin"
ASSERT(holder)

// Strip zone of all the air it got from turfs,
// reset air in each individual tile, zone itself,
// and put now updated air back into the zone's air

// Iterating through 'world' is bad, but zones are slow to update and their
// 'contents' list often does not contain some tiles that must get a reset too
for(var/turf/turf in world)
if(turf.zone)
turf.zone.remove(turf) // Handles visual updates and a part of fire removal
if(turf.air)
turf.reset_air()

for(var/zone/zone in SSair.zones)
// Often zone's air ends up with more gas than was put in,
// probably due to rounding errors or bad volume/temperature math
// If left alone, extra gas will leak to the individual turfs
// Sometimes that gas is plasma, and/or there is a lot of it
qdel(zone.air)
zone.air = new

for(var/turf/turf in zone.contents)
if(turf.air)
zone.add(turf)

log_and_message_admins("[src] fixed the air.")


//allows us to set a custom colour for everythign we say in ooc
/client/proc/colorooc()
set category = "Fun"
Expand Down

0 comments on commit 0b99cfc

Please sign in to comment.