Code Readability - Power (#18245)

* power

* dissipate -> do_dissipate

* eye_protection =

* move APC charging #defines out of apc, and reference them in more places
This commit is contained in:
KalevTait
2022-07-17 15:36:46 +01:00
committed by GitHub
parent 391a044df1
commit 694944e461
20 changed files with 157 additions and 139 deletions
@@ -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
@@ -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.", \
"<span class='notice'>You secure the external reinforcing bolts to the floor.</span>", \
"<span class='italics'>You hear ratchet.</span>")
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.", \
"<span class='notice'>You undo the external reinforcing bolts.</span>", \
"<span class='italics'>You hear ratchet.</span>")
anchored = 0
anchored = FALSE
if(FG_WELDED)
to_chat(user, "<span class='warning'>[src] needs to be unwelded from the floor!</span>")
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
+2 -2
View File
@@ -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
@@ -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
@@ -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
@@ -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] (<A HREF='?_src_=holder;adminplayerobservecoodjump=1;X=[x];Y=[y];Z=[z]'>JMP</a>)")
investigate_log("was created. [count?"":"<font color='red'>No containment fields were active</font>"]","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("<font color='red'>grew to size [current_size]</font>","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)