-
Notifications
You must be signed in to change notification settings - Fork 67
/
Copy pathstation_integrity.dm
77 lines (69 loc) · 1.94 KB
/
station_integrity.dm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
/**
* 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)