mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2025-12-31 20:11:56 +00:00
* Refactor /turf/var/intact (#62331) Turfs have a variable, intact, which conflates three meanings: Determining whether there's something that can be pried out, such as directly with a crowbar or indirectly with a tile stack and a crowbar off-hand. Determining whether underfloor pieces are visible. Determining whether underfloor pieces can be interacted with - by players with tools, through interaction with effects like chemical acid, or foam. When plating is hit with a stack of tiles, /turf/open/floor/attackby checks whether the turf is intact, and if so, ends the attack chain regardless of whether or not the attempt to hotswap a turf (with a crowbar) is successful or not. However, turfs which want the underfloor to be visible - such as catwalks and glass - set the intact variable to FALSE, and so can be repeatedly placed over one another, as if they were the first tile to be placed over the plating. This refactors /turf/var/intact into two distinct variables: /turf/var/overfloor_placed, for whether or not there is something over plating. /turf/var/underfloor_visible, for whether or not the various underfloor pieces should be invisible, visible, or both visible and interactable. All references to /turf/var/intact have been replaced with an equivalent overfloor_placed or underfloor_visible reference, depending on which check is appropriate. underfloor_accessibility can take one of UNDERFLOOR_HIDDEN, UNDERFLOOR_VISIBLE, or UNDERFLOOR_INTERACTABLE. This prevents cases such as acid foam or tools phasing through glass floors to affect the underfloor pieces underneath, and covers all kinds of unusual, not-wiring-visiblity usage such as Holodeck completeness, Revenant interaction, or station integrity checking. * Refactor /turf/var/intact * Thank Co-authored-by: esainane <esainane+github@gmail.com> Co-authored-by: Funce <funce.973@gmail.com>
78 lines
1.9 KiB
Plaintext
78 lines
1.9 KiB
Plaintext
/**
|
|
* For counting up how much of the station exists at the start of the shift, and how much is left behind by the end of it.
|
|
*
|
|
* "For God's sake, please be careful with those fuel tanks, you're going to set them off and compromise the station's integrity."
|
|
* "Relax boss, everyone knows this station has no integrity."
|
|
* "Yeah, that's why we all like it so much!"
|
|
* * -Recovered engineering chatter from a destroyed NT station, 2557
|
|
*/
|
|
|
|
/datum/station_state
|
|
var/floor = 0
|
|
var/wall = 0
|
|
var/r_wall = 0
|
|
var/window = 0
|
|
var/door = 0
|
|
var/grille = 0
|
|
var/mach = 0
|
|
|
|
/datum/station_state/proc/count()
|
|
floor = 0
|
|
wall = 0
|
|
r_wall = 0
|
|
window = 0
|
|
door = 0
|
|
grille = 0
|
|
mach = 0
|
|
for(var/Z in SSmapping.levels_by_trait(ZTRAIT_STATION))
|
|
for(var/turf/T in block(locate(1,1,Z), locate(world.maxx,world.maxy,Z)))
|
|
// don't count shuttles since they may have just left
|
|
if(istype(T.loc, /area/shuttle))
|
|
continue
|
|
|
|
if(isfloorturf(T))
|
|
var/turf/open/floor/TF = T
|
|
if(TF.burnt)
|
|
floor += 1
|
|
else
|
|
floor += 2
|
|
|
|
if(iswallturf(T))
|
|
wall += 1
|
|
|
|
if(istype(T, /turf/closed/wall/r_wall))
|
|
var/turf/closed/wall/r_wall/TRW = T
|
|
if(TRW.d_state == INTACT)
|
|
r_wall += 2
|
|
else
|
|
r_wall += 1
|
|
|
|
|
|
for(var/obj/O in T.contents)
|
|
if(istype(O, /obj/structure/window))
|
|
window += 1
|
|
else if(istype(O, /obj/structure/grille))
|
|
var/obj/structure/grille/GR = O
|
|
if(!GR.broken)
|
|
grille += 1
|
|
else if(istype(O, /obj/machinery/door))
|
|
door += 1
|
|
else if(ismachinery(O))
|
|
mach += 1
|
|
CHECK_TICK
|
|
CHECK_TICK
|
|
CHECK_TICK
|
|
|
|
/datum/station_state/proc/score(datum/station_state/result)
|
|
if(!result)
|
|
return 0
|
|
var/output = 0
|
|
output += (result.floor / max(floor,1))
|
|
output += (result.r_wall/ max(r_wall,1))
|
|
output += (result.wall / max(wall,1))
|
|
output += (result.window / max(window,1))
|
|
output += (result.door / max(door,1))
|
|
output += (result.grille / max(grille,1))
|
|
output += (result.mach / max(mach,1))
|
|
return (output/7)
|