From 694944e461e1fdc5d202f16964b52206764655fe Mon Sep 17 00:00:00 2001
From: KalevTait <107985691+KalevTait@users.noreply.github.com>
Date: Sun, 17 Jul 2022 15:36:46 +0100
Subject: [PATCH] Code Readability - Power (#18245)
* power
* dissipate -> do_dissipate
* eye_protection =
* move APC charging #defines out of apc, and reference them in more places
---
code/__DEFINES/machines.dm | 5 +
code/game/objects/items/devices/powersink.dm | 4 +-
.../living/silicon/robot/drone/drone_items.dm | 2 +-
code/modules/power/apc.dm | 159 ++++++++++--------
code/modules/power/cable.dm | 2 +-
code/modules/power/generator.dm | 4 +-
code/modules/power/lighting.dm | 2 +-
code/modules/power/port_gen.dm | 10 +-
.../power/singularity/containment_field.dm | 4 +-
.../power/singularity/field_generator.dm | 14 +-
code/modules/power/singularity/generator.dm | 4 +-
.../particle_accelerator.dm | 14 +-
.../particle_accelerator/particle_control.dm | 20 +--
code/modules/power/singularity/singularity.dm | 12 +-
code/modules/power/solar.dm | 14 +-
code/modules/power/supermatter/supermatter.dm | 2 +-
code/modules/power/tesla/energy_ball.dm | 2 +-
code/modules/power/treadmill.dm | 8 +-
code/modules/power/turbine.dm | 12 +-
code/modules/surgery/organs/augments_arms.dm | 2 +-
20 files changed, 157 insertions(+), 139 deletions(-)
diff --git a/code/__DEFINES/machines.dm b/code/__DEFINES/machines.dm
index 3b6a927c20c..50ceb5ad927 100644
--- a/code/__DEFINES/machines.dm
+++ b/code/__DEFINES/machines.dm
@@ -91,6 +91,11 @@
#define SUPERMATTER_EMERGENCY 5 // Integrity < 50%
#define SUPERMATTER_DELAMINATING 6 // Pretty obvious, Integrity < 25%
+//APC charging
+#define APC_NOT_CHARGING 0
+#define APC_IS_CHARGING 1
+#define APC_FULLY_CHARGED 2
+
// Firelock states
#define FD_OPEN 1
#define FD_CLOSED 2
diff --git a/code/game/objects/items/devices/powersink.dm b/code/game/objects/items/devices/powersink.dm
index 6c6526fe176..7206a4ea24f 100644
--- a/code/game/objects/items/devices/powersink.dm
+++ b/code/game/objects/items/devices/powersink.dm
@@ -132,8 +132,8 @@
if(A.operating && A.cell)
A.cell.charge = max(0, A.cell.charge - 50)
power_drained += 50
- if(A.charging == 2) // If the cell was full
- A.charging = 1 // It's no longer full
+ if(A.charging == APC_FULLY_CHARGED) // If the cell was full
+ A.charging = APC_IS_CHARGING // It's no longer full
if(drained >= drain_rate)
break
diff --git a/code/modules/mob/living/silicon/robot/drone/drone_items.dm b/code/modules/mob/living/silicon/robot/drone/drone_items.dm
index 1a3c6b7b2bb..7e7ab0d177a 100644
--- a/code/modules/mob/living/silicon/robot/drone/drone_items.dm
+++ b/code/modules/mob/living/silicon/robot/drone/drone_items.dm
@@ -134,7 +134,7 @@
A.cell.forceMove(src)
A.cell = null
- A.charging = 0
+ A.charging = APC_NOT_CHARGING
A.update_icon()
user.visible_message("[user] removes the power cell from [A]!", "You remove the power cell.")
diff --git a/code/modules/power/apc.dm b/code/modules/power/apc.dm
index a6bac31bea9..857b5772eb9 100644
--- a/code/modules/power/apc.dm
+++ b/code/modules/power/apc.dm
@@ -8,6 +8,16 @@
#define UPSTATE_WIREEXP 64
#define UPSTATE_ALLGOOD 128
+//opened
+#define APC_CLOSED 0
+#define APC_OPENED 1
+#define APC_COVER_OFF 2
+
+//electronics_state
+#define APC_ELECTRONICS_NONE 0
+#define APC_ELECTRONICS_INSTALLED 1
+#define APC_ELECTRONICS_SECURED 2
+
//update_overlay
#define APC_UPOVERLAY_CHARGEING0 1
#define APC_UPOVERLAY_CHARGEING1 2
@@ -64,18 +74,18 @@
var/obj/item/stock_parts/cell/cell
var/start_charge = 90 // initial cell charge %
var/cell_type = 2500 //Base cell has 2500 capacity. Enter the path of a different cell you want to use. cell determines charge rates, max capacity, ect. These can also be changed with other APC vars, but isn't recommended to minimize the risk of accidental usage of dirty editted APCs
- var/opened = 0 //0=closed, 1=opened, 2=cover removed
- var/shorted = 0
+ var/opened = APC_CLOSED
+ var/shorted = FALSE
var/lighting = 3
var/equipment = 3
var/environ = 3
- var/operating = 1
- var/charging = 0
+ var/operating = TRUE
+ var/charging = APC_NOT_CHARGING
var/chargemode = 1
var/chargecount = 0
- var/locked = 1
- var/coverlocked = 1
- var/aidisabled = 0
+ var/locked = TRUE
+ var/coverlocked = TRUE
+ var/aidisabled = FALSE
var/obj/machinery/power/terminal/terminal = null
var/lastused_light = 0
var/lastused_equip = 0
@@ -83,19 +93,19 @@
var/lastused_total = 0
var/main_status = APC_EXTERNAL_POWER_NOTCONNECTED
powernet = 0 // set so that APCs aren't found as powernet nodes //Hackish, Horrible, was like this before I changed it :(
- var/malfhack = 0 //New var for my changes to AI malf. --NeoFite
+ var/malfhack = FALSE //New var for my changes to AI malf. --NeoFite
var/mob/living/silicon/ai/malfai = null //See above --NeoFite
- var/debug= 0
+ var/debug = FALSE
var/autoflag= 0 // 0 = off, 1= eqp and lights off, 2 = eqp off, 3 = all on.
// luminosity = 1
- var/has_electronics = 0 // 0 - none, 1 - plugged in, 2 - secured by screwdriver
+ var/electronics_state = APC_ELECTRONICS_NONE
var/overload = 1 //used for the Blackout malf module
var/mob/living/silicon/ai/occupier = null
var/longtermpower = 10
var/update_state = -1
var/update_overlay = -1
- var/global/status_overlays = 0
- var/updating_icon = 0
+ var/global/status_overlays = FALSE
+ var/updating_icon = FALSE
var/datum/wires/apc/wires = null
var/global/list/status_overlays_lock
var/global/list/status_overlays_charging
@@ -108,7 +118,7 @@
var/report_power_alarm = TRUE
- var/shock_proof = 0 //if set to 1, this APC will not arc bolts of electricity if it's overloaded.
+ var/shock_proof = FALSE //if set to FALSE, this APC will not arc bolts of electricity if it's overloaded.
// Nightshift
var/nightshift_lights = FALSE
@@ -121,12 +131,12 @@
/obj/machinery/power/apc/worn_out
name = "\improper Worn out APC"
- keep_preset_name = 1
- locked = 0
+ keep_preset_name = TRUE
+ locked = FALSE
environ = 0
equipment = 0
lighting = 0
- operating = 0
+ operating = FALSE
emergency_power = FALSE
/obj/machinery/power/apc/noalarm
@@ -151,6 +161,9 @@
/obj/machinery/power/apc/get_cell()
return cell
+/obj/machinery/power/apc/proc/has_electronics()
+ return electronics_state != APC_ELECTRONICS_NONE
+
/obj/machinery/power/apc/connect_to_network()
//Override because the APC does not directly connect to the network; it goes through a terminal.
//The terminal is what the power computer looks for anyway.
@@ -173,8 +186,8 @@
area = get_area(src)
area.apc |= src
- opened = 1
- operating = 0
+ opened = APC_OPENED
+ operating = FALSE
name = "[area.name] APC"
stat |= MAINT
constructed = TRUE
@@ -208,7 +221,7 @@
. = ..()
if(!mapload)
return
- has_electronics = 2 //installed and secured
+ electronics_state = APC_ELECTRONICS_SECURED
// is starting with a power cell installed, create it and set its charge level
if(cell_type)
cell = new/obj/item/stock_parts/cell/upgraded(src)
@@ -242,13 +255,13 @@
if(stat & BROKEN)
. += "Looks broken."
else if(opened)
- if(has_electronics && terminal)
- . += "The cover is [opened==2?"removed":"open"] and the power cell is [ cell ? "installed" : "missing"]."
- else if(!has_electronics && terminal)
+ if(has_electronics() && terminal)
+ . += "The cover is [opened == APC_OPENED ? "removed" : "open"] and the power cell is [ cell ? "installed" : "missing"]."
+ else if(!has_electronics() && terminal)
. += "There are some wires but no electronics."
- else if(has_electronics && !terminal)
+ else if(has_electronics() && !terminal)
. += "Electronics installed but not wired."
- else /* if(!has_electronics && !terminal) */
+ else /* if(!has_electronics() && !terminal) */
. += "There are no electronics nor connected wires."
else
if(stat & MAINT)
@@ -274,7 +287,7 @@
/obj/machinery/power/apc/update_icon(force_update = FALSE)
if(!status_overlays || force_update)
- status_overlays = 1
+ status_overlays = TRUE
status_overlays_lock = new
status_overlays_charging = new
status_overlays_equipment = new
@@ -373,9 +386,9 @@
if(stat & MAINT)
update_state |= UPSTATE_MAINT
if(opened)
- if(opened==1)
+ if(opened == APC_OPENED)
update_state |= UPSTATE_OPENED1
- if(opened==2)
+ if(opened == APC_COVER_OFF)
update_state |= UPSTATE_OPENED2
else if(emagged || malfai)
update_state |= UPSTATE_BLUESCREEN
@@ -388,11 +401,11 @@
if(locked)
update_overlay |= APC_UPOVERLAY_LOCKED
- if(!charging)
+ if(charging == APC_NOT_CHARGING)
update_overlay |= APC_UPOVERLAY_CHARGEING0
- else if(charging == 1)
+ else if(charging == APC_IS_CHARGING)
update_overlay |= APC_UPOVERLAY_CHARGEING1
- else if(charging == 2)
+ else if(charging == APC_FULLY_CHARGED)
update_overlay |= APC_UPOVERLAY_CHARGEING2
if(!equipment)
@@ -429,11 +442,11 @@
/obj/machinery/power/apc/proc/queue_icon_update()
if(!updating_icon)
- updating_icon = 1
+ updating_icon = TRUE
// Start the update
spawn(APC_UPDATE_ICON_COOLDOWN)
update_icon()
- updating_icon = 0
+ updating_icon = FALSE
/obj/machinery/power/apc/flicker(second_pass = FALSE)
if(opened || panel_open)
@@ -494,7 +507,7 @@
else if(terminal) // it already have terminal
to_chat(user, "This APC is already wired!")
return
- else if(has_electronics == 0)
+ else if(!has_electronics())
to_chat(user, "There is nothing to wire!")
return
@@ -508,7 +521,7 @@
if(do_after(user, 20, target = src))
if(C.get_amount() < 10 || !C)
return
- if(C.get_amount() >= 10 && !terminal && opened && has_electronics > 0)
+ if(C.get_amount() >= 10 && !terminal && opened && has_electronics())
var/turf/T = get_turf(src)
var/obj/structure/cable/N = T.get_cable_node()
if(prob(50) && electrocute_mob(usr, N, N, 1, TRUE))
@@ -520,7 +533,7 @@
terminal.connect_to_network()
else if(istype(W, /obj/item/apc_electronics) && opened)
- if(has_electronics!=0) // there are already electronicks inside
+ if(has_electronics()) // there are already electronicks inside
to_chat(user, "You cannot put the board inside, there already is one!")
return
else if(stat & BROKEN)
@@ -531,26 +544,26 @@
"You start to insert the power control board into the frame...")
playsound(loc, 'sound/items/deconstruct.ogg', 50, TRUE)
if(do_after(user, 10, target = src))
- if(!has_electronics)
- has_electronics = TRUE
+ if(!has_electronics())
+ electronics_state = APC_ELECTRONICS_INSTALLED
locked = FALSE
to_chat(user, "You place the power control board inside the frame.")
qdel(W)
else if(istype(W, /obj/item/mounted/frame/apc_frame) && opened)
- if(!(stat & BROKEN || opened==2 || obj_integrity < max_integrity)) // There is nothing to repair
+ if(!(stat & BROKEN || opened == APC_COVER_OFF || obj_integrity < max_integrity)) // There is nothing to repair
to_chat(user, "You found no reason for repairing this APC")
return
- if(!(stat & BROKEN) && opened==2) // Cover is the only thing broken, we do not need to remove elctronicks to replace cover
+ if(!(stat & BROKEN) && opened == APC_COVER_OFF) // Cover is the only thing broken, we do not need to remove elctronicks to replace cover
user.visible_message("[user.name] replaces missing APC's cover.",\
"You begin to replace APC's cover...")
if(do_after(user, 20, target = src)) // replacing cover is quicker than replacing whole frame
to_chat(user, "You replace missing APC's cover.")
qdel(W)
- opened = 1
+ opened = APC_OPENED
update_icon()
return
- if(has_electronics)
+ if(has_electronics())
to_chat(user, "You cannot repair this APC until you remove the electronics still inside!")
return
user.visible_message("[user.name] replaces the damaged APC frame with a new one.",\
@@ -560,8 +573,8 @@
qdel(W)
stat &= ~BROKEN
obj_integrity = max_integrity
- if(opened==2)
- opened = 1
+ if(opened == APC_COVER_OFF)
+ opened = APC_OPENED
update_icon()
return
else
@@ -573,14 +586,14 @@
if(!I.tool_start_check(src, user, 0))
return
if(opened) // a) on open apc
- if(has_electronics==1)
+ if(electronics_state == APC_ELECTRONICS_INSTALLED)
if(terminal)
to_chat(user, "Disconnect the wires first!")
return
to_chat(user, "You are trying to remove the power control board..." )
if(I.use_tool(src, user, 50, volume = I.tool_volume))
- if(has_electronics)
- has_electronics = FALSE
+ if(has_electronics())
+ electronics_state = APC_ELECTRONICS_NONE
if(stat & BROKEN)
user.visible_message(\
"[user.name] has broken the power control board inside [name]!",
@@ -599,7 +612,7 @@
"[user.name] has discarded strangely the programmed power control board from [name]!",
"You discarded the strangely programmed board.")
malfai = null
- malfhack = 0
+ malfhack = FALSE
return
else
user.visible_message(\
@@ -607,8 +620,8 @@
"You remove the power control board.")
new /obj/item/apc_electronics(loc)
return
- else if(opened!=2) //cover isn't removed
- opened = 0
+ else if(opened != APC_COVER_OFF) //cover isn't removed
+ opened = APC_CLOSED
coverlocked = TRUE //closing cover relocks it
update_icon()
return
@@ -620,7 +633,7 @@
to_chat(user, "Exposed wires prevents you from opening it!")
return
else
- opened = 1
+ opened = APC_OPENED
update_icon()
/obj/machinery/power/apc/screwdriver_act(mob/living/user, obj/item/I)
@@ -632,12 +645,12 @@
to_chat(user, "Close the APC first!") //Less hints more mystery!
return
else
- if(has_electronics==1)
- has_electronics = 2
+ if(electronics_state == APC_ELECTRONICS_INSTALLED)
+ electronics_state = APC_ELECTRONICS_SECURED
stat &= ~MAINT
to_chat(user, "You screw the circuit electronics into place.")
- else if(has_electronics==2)
- has_electronics = 1
+ else if(electronics_state == APC_ELECTRONICS_SECURED)
+ electronics_state = APC_ELECTRONICS_INSTALLED
stat |= MAINT
to_chat(user, "You unfasten the electronics.")
else
@@ -699,20 +712,20 @@
if(!(stat & BROKEN))
set_broken()
if(opened != 2)
- opened = 2
+ opened = APC_COVER_OFF
coverlocked = FALSE
visible_message("The APC cover is knocked down!")
update_icon()
/obj/machinery/power/apc/welder_act(mob/user, obj/item/I)
- if(!opened || has_electronics || terminal)
+ if(!opened || has_electronics() || terminal)
return
. = TRUE
if(!I.tool_use_check(user, 3))
return
WELDER_ATTEMPT_SLICING_MESSAGE
if(I.use_tool(src, user, 50, amount = 3, volume = I.tool_volume))
- if((stat & BROKEN) || opened==2)
+ if((stat & BROKEN) || opened == APC_COVER_OFF)
new /obj/item/stack/sheet/metal(loc)
user.visible_message(\
"[user.name] has cut [src] apart with [I].",\
@@ -734,8 +747,8 @@
to_chat(user, "Nothing happens.")
else
flick("apc-spark", src)
- emagged = 1
- locked = 0
+ emagged = TRUE
+ locked = FALSE
to_chat(user, "You emag the APC interface.")
update_icon()
@@ -752,7 +765,7 @@
cell.add_fingerprint(user)
cell.update_icon()
cell = null
- charging = FALSE
+ charging = APC_NOT_CHARGING
update_icon()
return
if(stat & (BROKEN|MAINT))
@@ -1037,7 +1050,7 @@
occupier.parent = malf.parent
else
occupier.parent = malf
- malf.shunted = 1
+ malf.shunted = TRUE
malf.mind.transfer_to(occupier)
occupier.eyeobj.name = "[occupier.name] (AI Eye)"
if(malf.parent)
@@ -1054,7 +1067,7 @@
return
if(occupier.parent && occupier.parent.stat != DEAD)
occupier.mind.transfer_to(occupier.parent)
- occupier.parent.shunted = 0
+ occupier.parent.shunted = FALSE
occupier.parent.adjustOxyLoss(occupier.getOxyLoss())
occupier.parent.cancel_camera()
qdel(occupier)
@@ -1156,10 +1169,10 @@
if((cell.charge/GLOB.CELLRATE + excess) >= lastused_total) // can we draw enough from cell+grid to cover last usage?
cell.charge = min(cell.maxcharge, cell.charge + GLOB.CELLRATE * excess) //recharge with what we can
add_load(excess) // so draw what we can from the grid
- charging = 0
+ charging = APC_NOT_CHARGING
else // not enough power available to run the last tick!
- charging = 0
+ charging = APC_NOT_CHARGING
chargecount = 0
// This turns everything off in the case that there is still a charge left on the battery, just not enough to run the room.
equipment = autoset(equipment, 0)
@@ -1171,7 +1184,7 @@
// Set channels depending on how much charge we have left
// Allow the APC to operate as normal if the cell can charge
- if(charging && longtermpower < 10)
+ if(charging != APC_NOT_CHARGING && longtermpower < 10)
longtermpower += 1
else if(longtermpower > -10)
longtermpower -= 2
@@ -1210,7 +1223,7 @@
autoflag = 0
// now trickle-charge the cell
- if(chargemode && charging == 1 && operating)
+ if(chargemode && charging == APC_IS_CHARGING && operating)
if(excess > 0) // check to make sure we have enough to charge
// Max charge is capped to % per second constant
var/ch = min(excess*GLOB.CELLRATE, cell.maxcharge*GLOB.CHARGELEVEL)
@@ -1218,16 +1231,16 @@
cell.give(ch) // actually recharge the cell
else
- charging = 0 // stop charging
+ charging = APC_NOT_CHARGING // stop charging
chargecount = 0
// show cell as fully charged if so
if(cell.charge >= cell.maxcharge)
cell.charge = cell.maxcharge
- charging = 2
+ charging = APC_FULLY_CHARGED
if(chargemode)
- if(!charging)
+ if(charging == APC_NOT_CHARGING)
if(excess > cell.maxcharge*GLOB.CHARGELEVEL)
chargecount++
else
@@ -1236,10 +1249,10 @@
if(chargecount == 10)
chargecount = 0
- charging = 1
+ charging = APC_IS_CHARGING
else // chargemode off
- charging = 0
+ charging = APC_NOT_CHARGING
chargecount = 0
if(excess >= 2500000 && !shock_proof)
@@ -1261,7 +1274,7 @@
else // no cell, switch everything off
- charging = 0
+ charging = APC_NOT_CHARGING
chargecount = 0
equipment = autoset(equipment, 0)
lighting = autoset(lighting, 0)
@@ -1341,7 +1354,7 @@
if(malfai && operating)
malfai.malf_picker.processing_time = clamp(malfai.malf_picker.processing_time - 10,0,1000)
stat |= BROKEN
- operating = 0
+ operating = FALSE
if(occupier)
malfvacate(1)
update_icon()
diff --git a/code/modules/power/cable.dm b/code/modules/power/cable.dm
index b35bf7bbba5..06cd681e214 100644
--- a/code/modules/power/cable.dm
+++ b/code/modules/power/cable.dm
@@ -26,7 +26,7 @@ By design, d1 is the smallest direction and d2 is the highest
/obj/structure/cable
level = 1
- anchored = 1
+ anchored = TRUE
on_blueprints = TRUE
var/datum/powernet/powernet
name = "power cable"
diff --git a/code/modules/power/generator.dm b/code/modules/power/generator.dm
index 6b43ffd907d..b0dc421164c 100644
--- a/code/modules/power/generator.dm
+++ b/code/modules/power/generator.dm
@@ -2,8 +2,8 @@
name = "thermoelectric generator"
desc = "It's a high efficiency thermoelectric generator."
icon_state = "teg"
- anchored = 0
- density = 1
+ anchored = FALSE
+ density = TRUE
use_power = NO_POWER_USE
var/obj/machinery/atmospherics/binary/circulator/cold_circ
diff --git a/code/modules/power/lighting.dm b/code/modules/power/lighting.dm
index 5d3465c412e..c7051772dfb 100644
--- a/code/modules/power/lighting.dm
+++ b/code/modules/power/lighting.dm
@@ -168,7 +168,7 @@
var/base_state = "tube" // Base description and icon_state
icon_state = "tube1"
desc = "A lighting fixture."
- anchored = 1
+ anchored = TRUE
layer = 5
max_integrity = 100
use_power = ACTIVE_POWER_USE
diff --git a/code/modules/power/port_gen.dm b/code/modules/power/port_gen.dm
index 7de21559b18..31684a9583a 100644
--- a/code/modules/power/port_gen.dm
+++ b/code/modules/power/port_gen.dm
@@ -6,11 +6,11 @@
desc = "A portable generator for emergency backup power"
icon = 'icons/obj/power.dmi'
icon_state = "portgen0_0"
- density = 1
- anchored = 0
+ density = TRUE
+ anchored = FALSE
use_power = NO_POWER_USE
- var/active = 0
+ var/active = FALSE
var/power_gen = 5000
var/power_output = 1
var/base_icon = "portgen0"
@@ -38,7 +38,7 @@
add_avail(power_gen * power_output)
UseFuel()
else
- active = 0
+ active = FALSE
handleInactive()
update_icon()
@@ -267,7 +267,7 @@
explode() //if they're foolish enough to emag while it's running
if(!emagged)
- emagged = 1
+ emagged = TRUE
return 1
/obj/machinery/power/port_gen/pacman/attackby(obj/item/O as obj, mob/user as mob)
diff --git a/code/modules/power/singularity/containment_field.dm b/code/modules/power/singularity/containment_field.dm
index 9b598a0fd4a..e84f63e206a 100644
--- a/code/modules/power/singularity/containment_field.dm
+++ b/code/modules/power/singularity/containment_field.dm
@@ -3,8 +3,8 @@
desc = "An energy field."
icon = 'icons/obj/singularity.dmi'
icon_state = "Contain_F"
- anchored = 1
- density = 0
+ anchored = TRUE
+ density = FALSE
move_resist = INFINITY
resistance_flags = INDESTRUCTIBLE | LAVA_PROOF | FIRE_PROOF | UNACIDABLE | ACID_PROOF
flags_2 = RAD_NO_CONTAMINATE_2
diff --git a/code/modules/power/singularity/field_generator.dm b/code/modules/power/singularity/field_generator.dm
index 83e509055e0..d4a2464dae1 100644
--- a/code/modules/power/singularity/field_generator.dm
+++ b/code/modules/power/singularity/field_generator.dm
@@ -24,8 +24,8 @@ field_generator power level display
desc = "A large thermal battery that projects a high amount of energy when powered."
icon = 'icons/obj/machines/field_generator.dmi'
icon_state = "Field_Gen"
- anchored = 0
- density = 1
+ anchored = FALSE
+ density = TRUE
use_power = NO_POWER_USE
max_integrity = 500
//100% immune to lasers and energy projectiles since it absorbs their energy.
@@ -38,7 +38,7 @@ field_generator power level display
var/warming_up = 0
var/list/obj/machinery/field/containment/fields
var/list/obj/machinery/field/generator/connected_gens
- var/clean_up = 0
+ var/clean_up = FALSE
/obj/machinery/field/generator/update_icon()
overlays.Cut()
@@ -91,14 +91,14 @@ field_generator power level display
user.visible_message("[user.name] secures [name] to the floor.", \
"You secure the external reinforcing bolts to the floor.", \
"You hear ratchet.")
- anchored = 1
+ anchored = TRUE
if(FG_SECURED)
state = FG_UNSECURED
playsound(loc, W.usesound, 75, 1)
user.visible_message("[user.name] unsecures [name] reinforcing bolts from the floor.", \
"You undo the external reinforcing bolts.", \
"You hear ratchet.")
- anchored = 0
+ anchored = FALSE
if(FG_WELDED)
to_chat(user, "[src] needs to be unwelded from the floor!")
else
@@ -294,7 +294,7 @@ field_generator power level display
/obj/machinery/field/generator/proc/cleanup()
- clean_up = 1
+ clean_up = TRUE
for(var/F in fields)
qdel(F)
@@ -304,7 +304,7 @@ field_generator power level display
if(!FG.clean_up)//Makes the other gens clean up as well
FG.cleanup()
connected_gens -= FG
- clean_up = 0
+ clean_up = FALSE
update_icon()
//This is here to help fight the "hurr durr, release singulo cos nobody will notice before the
diff --git a/code/modules/power/singularity/generator.dm b/code/modules/power/singularity/generator.dm
index 6a6f32a101c..152b5e4f112 100644
--- a/code/modules/power/singularity/generator.dm
+++ b/code/modules/power/singularity/generator.dm
@@ -4,8 +4,8 @@
desc = "An odd device which produces a Gravitational Singularity when set up."
icon = 'icons/obj/singularity.dmi'
icon_state = "TheSingGen"
- anchored = 0
- density = 1
+ anchored = FALSE
+ density = TRUE
use_power = NO_POWER_USE
resistance_flags = FIRE_PROOF
var/energy = 0
diff --git a/code/modules/power/singularity/particle_accelerator/particle_accelerator.dm b/code/modules/power/singularity/particle_accelerator/particle_accelerator.dm
index 80ca9fac23a..5d383f90a09 100644
--- a/code/modules/power/singularity/particle_accelerator/particle_accelerator.dm
+++ b/code/modules/power/singularity/particle_accelerator/particle_accelerator.dm
@@ -64,14 +64,14 @@ So, hopefully this is helpful if any more icons are to be added/changed/wonderin
desc = "Part of a Particle Accelerator."
icon = 'icons/obj/machines/particle_accelerator.dmi'
icon_state = "none"
- anchored = 0
- density = 1
+ anchored = FALSE
+ density = TRUE
max_integrity = 500
armor = list(MELEE = 30, BULLET = 20, LASER = 20, ENERGY = 0, BOMB = 0, BIO = 0, RAD = 0, FIRE = 90, ACID = 80)
var/obj/machinery/particle_accelerator/control_box/master = null
var/construction_state = 0
var/reference = null
- var/powered = 0
+ var/powered = FALSE
var/strength = null
var/desc_holder = null
@@ -253,15 +253,15 @@ So, hopefully this is helpful if any more icons are to be added/changed/wonderin
desc = "Part of a Particle Accelerator."
icon = 'icons/obj/machines/particle_accelerator.dmi'
icon_state = "none"
- anchored = 0
- density = 1
+ anchored = FALSE
+ density = TRUE
use_power = NO_POWER_USE
idle_power_usage = 0
active_power_usage = 0
var/construction_state = 0
- var/active = 0
+ var/active = FALSE
var/reference = null
- var/powered = null
+ var/powered = FALSE
var/strength = 0
var/desc_holder = null
diff --git a/code/modules/power/singularity/particle_accelerator/particle_control.dm b/code/modules/power/singularity/particle_accelerator/particle_control.dm
index 578d87ad633..ebbd0aa34c2 100644
--- a/code/modules/power/singularity/particle_accelerator/particle_control.dm
+++ b/code/modules/power/singularity/particle_accelerator/particle_control.dm
@@ -4,13 +4,13 @@
icon = 'icons/obj/machines/particle_accelerator.dmi'
icon_state = "control_box"
reference = "control_box"
- anchored = 0
- density = 1
+ anchored = FALSE
+ density = TRUE
use_power = NO_POWER_USE
idle_power_usage = 500
active_power_usage = 10000
construction_state = 0
- active = 0
+ active = FALSE
dir = 1
var/strength_upper_limit = 2
var/interface_control = 1
@@ -50,16 +50,16 @@
if(construction_state < 3)
use_power = NO_POWER_USE
assembled = 0
- active = 0
+ active = FALSE
for(var/obj/structure/particle_accelerator/part in connected_parts)
part.strength = null
- part.powered = 0
+ part.powered = FALSE
part.update_icon()
connected_parts = list()
return
if(!part_scan())
use_power = IDLE_POWER_USE
- active = 0
+ active = FALSE
connected_parts = list()
return
@@ -150,7 +150,7 @@
/obj/machinery/particle_accelerator/control_box/power_change()
..()
if(stat & NOPOWER)
- active = 0
+ active = FALSE
use_power = NO_POWER_USE
else if(!stat && construction_state <= 3)
use_power = IDLE_POWER_USE
@@ -159,7 +159,7 @@
if((stat & NOPOWER) || (!stat && construction_state <= 3)) //Only update the part icons if something's changed (i.e. any of the above condition sets are met).
for(var/obj/structure/particle_accelerator/part in connected_parts)
part.strength = null
- part.powered = 0
+ part.powered = FALSE
part.update_icon()
return
@@ -238,13 +238,13 @@
use_power = ACTIVE_POWER_USE
for(var/obj/structure/particle_accelerator/part in connected_parts)
part.strength = strength
- part.powered = 1
+ part.powered = TRUE
part.update_icon()
else
use_power = IDLE_POWER_USE
for(var/obj/structure/particle_accelerator/part in connected_parts)
part.strength = null
- part.powered = 0
+ part.powered = FALSE
part.update_icon()
return 1
diff --git a/code/modules/power/singularity/singularity.dm b/code/modules/power/singularity/singularity.dm
index f59afec9b78..438eb4cf75a 100644
--- a/code/modules/power/singularity/singularity.dm
+++ b/code/modules/power/singularity/singularity.dm
@@ -12,7 +12,7 @@
var/current_size = 1
var/allowed_size = 1
var/energy = 100 //How strong are we?
- var/dissipate = 1 //Do we lose energy over time?
+ var/dissipate = TRUE //Do we lose energy over time?
var/dissipate_delay = 10
var/dissipate_track = 0
var/dissipate_strength = 1 //How much energy do we lose?
@@ -120,7 +120,7 @@
if(prob(event_chance))//Chance for it to run a special event TODO:Come up with one or two more that fit
event()
eat()
- dissipate()
+ do_dissipate()
check_energy()
return
@@ -137,7 +137,7 @@
message_admins("A singularity has been created without containment fields active at [x], [y], [z] (JMP)")
investigate_log("was created. [count?"":"No containment fields were active"]","singulo")
-/obj/singularity/proc/dissipate()
+/obj/singularity/proc/do_dissipate()
if(!dissipate)
return
if(dissipate_track >= dissipate_delay)
@@ -209,7 +209,7 @@
pixel_y = -128
grav_pull = 10
consume_range = 4
- dissipate = 0 //It cant go smaller due to e loss
+ dissipate = FALSE //It cant go smaller due to e loss
if(STAGE_SIX) //This only happens if a stage 5 singulo consumes a supermatter shard.
current_size = STAGE_SIX
icon = 'icons/effects/352x352.dmi'
@@ -218,7 +218,7 @@
pixel_y = -160
grav_pull = 15
consume_range = 5
- dissipate = 0
+ dissipate = FALSE
if(current_size == allowed_size)
investigate_log("grew to size [current_size]","singulo")
return 1
@@ -278,7 +278,7 @@
if(istype(A, /obj/machinery/power/supermatter_crystal) && !consumedSupermatter)
desc = "[initial(desc)] It glows fiercely with inner fire."
name = "supermatter-charged [initial(name)]"
- consumedSupermatter = 1
+ consumedSupermatter = TRUE
set_light(10)
if(istype(A, /obj/singularity/narsie))
if(current_size == STAGE_SIX)
diff --git a/code/modules/power/solar.dm b/code/modules/power/solar.dm
index 14bbca61deb..7da3df614de 100644
--- a/code/modules/power/solar.dm
+++ b/code/modules/power/solar.dm
@@ -11,7 +11,7 @@
active_power_usage = 0
max_integrity = 150
integrity_failure = 50
- var/obscured = 0
+ var/obscured = FALSE
var/sunfrac = 0
var/adir = SOUTH // actual dir
var/ndir = SOUTH // target dir
@@ -45,7 +45,7 @@
if(!S)
S = new /obj/item/solar_assembly(src)
S.glass_type = /obj/item/stack/sheet/glass
- S.anchored = 1
+ S.anchored = TRUE
S.loc = src
if(S.glass_type == /obj/item/stack/sheet/rglass) //if the panel is in reinforced glass
max_integrity *= 2 //this need to be placed here, because panels already on the map don't have an assembly linked to
@@ -167,10 +167,10 @@
break
if(T.density) // if we hit a solid turf, panel is obscured
- obscured = 1
+ obscured = TRUE
return
- obscured = 0 // if hit the edge or stepped 20 times, not obscured
+ obscured = FALSE // if hit the edge or stepped 20 times, not obscured
update_solar_exposure()
@@ -185,7 +185,7 @@
icon_state = "sp_base"
item_state = "electropack"
w_class = WEIGHT_CLASS_BULKY // Pretty big!
- anchored = 0
+ anchored = FALSE
var/tracker = 0
var/glass_type = null
@@ -205,13 +205,13 @@
if(!anchored && isturf(loc))
if(istype(W, /obj/item/wrench))
- anchored = 1
+ anchored = TRUE
user.visible_message("[user] wrenches the solar assembly into place.", "You wrench the solar assembly into place.")
playsound(src.loc, W.usesound, 50, 1)
return 1
else
if(istype(W, /obj/item/wrench))
- anchored = 0
+ anchored = FALSE
user.visible_message("[user] unwrenches the solar assembly from its place.", "You unwrench the solar assembly from its place.")
playsound(src.loc, W.usesound, 50, 1)
return 1
diff --git a/code/modules/power/supermatter/supermatter.dm b/code/modules/power/supermatter/supermatter.dm
index 92c554fadba..45913d69493 100644
--- a/code/modules/power/supermatter/supermatter.dm
+++ b/code/modules/power/supermatter/supermatter.dm
@@ -200,7 +200,7 @@
countdown.start()
GLOB.poi_list |= src
radio = new(src)
- radio.listening = 0
+ radio.listening = FALSE
radio.config(list("Engineering" = 0))
investigate_log("has been created.", "supermatter")
diff --git a/code/modules/power/tesla/energy_ball.dm b/code/modules/power/tesla/energy_ball.dm
index 63b5abffaa2..a2787ad3f3f 100644
--- a/code/modules/power/tesla/energy_ball.dm
+++ b/code/modules/power/tesla/energy_ball.dm
@@ -136,7 +136,7 @@
qdel(Orchiectomy_target)
else if(length(orbiting_balls))
- dissipate() //sing code has a much better system.
+ do_dissipate() //sing code has a much better system.
/obj/singularity/energy_ball/proc/new_mini_ball()
if(!loc)
diff --git a/code/modules/power/treadmill.dm b/code/modules/power/treadmill.dm
index f64e634ef94..70f3ab44c50 100644
--- a/code/modules/power/treadmill.dm
+++ b/code/modules/power/treadmill.dm
@@ -121,20 +121,20 @@
icon = 'icons/obj/status_display.dmi'
icon_state = "frame"
desc = "Monitors treadmill use."
- anchored = 1
- density = 0
+ anchored = TRUE
+ density = FALSE
maptext_height = 26
maptext_width = 32
maptext_y = -1
- var/on = 0 // if we should be metering or not
+ var/on = FALSE // if we should be metering or not
var/id = null // id of treadmill
var/obj/machinery/power/treadmill/treadmill = null
var/total_joules = 0 // total power from prisoner
var/J_per_ticket = 45000 // amt of power charged for a ticket
var/line1 = ""
var/line2 = ""
- var/frame = 0 // on 0, show labels, on 1 show numbers
+ var/frame = FALSE // on 0, show labels, on 1 show numbers
var/redeem_immediately = 0 // redeem immediately for holding cell
/obj/machinery/treadmill_monitor/Initialize(mapload)
diff --git a/code/modules/power/turbine.dm b/code/modules/power/turbine.dm
index 5f5ceee9124..44feffd8d1c 100644
--- a/code/modules/power/turbine.dm
+++ b/code/modules/power/turbine.dm
@@ -27,13 +27,13 @@
desc = "The compressor stage of a gas turbine generator."
icon = 'icons/obj/pipes.dmi'
icon_state = "compressor"
- anchored = 1
- density = 1
+ anchored = TRUE
+ density = TRUE
resistance_flags = FIRE_PROOF
var/obj/machinery/power/turbine/turbine
var/datum/gas_mixture/gas_contained
var/turf/simulated/inturf
- var/starter = 0
+ var/starter = FALSE
var/rpm = 0
var/rpmtarget = 0
var/capacity = 1e6
@@ -46,10 +46,10 @@
desc = "A gas turbine used for backup power generation."
icon = 'icons/obj/pipes.dmi'
icon_state = "turbine"
- anchored = 1
- density = 1
+ anchored = TRUE
+ density = TRUE
resistance_flags = FIRE_PROOF
- var/opened = 0
+ var/opened = FALSE
var/obj/machinery/power/compressor/compressor
var/turf/simulated/outturf
var/lastgen
diff --git a/code/modules/surgery/organs/augments_arms.dm b/code/modules/surgery/organs/augments_arms.dm
index 6e7020d5ea2..ee607defda6 100644
--- a/code/modules/surgery/organs/augments_arms.dm
+++ b/code/modules/surgery/organs/augments_arms.dm
@@ -380,7 +380,7 @@
if(A.cell.charge == 0)
to_chat(H, "\The [A] has no more charge.")
break
- A.charging = 1
+ A.charging = APC_IS_CHARGING
if(A.cell.charge >= 500)
H.adjust_nutrition(50)
A.cell.charge -= 500