Skip to content

Commit

Permalink
replace magic numbers related to emp and explosion severity with defi…
Browse files Browse the repository at this point in the history
…nes (ParadiseSS13#26495)

replace even more magic emp and ex numbers
  • Loading branch information
Kenionatus authored Aug 18, 2024
1 parent 1b5af3a commit 777910d
Show file tree
Hide file tree
Showing 37 changed files with 50 additions and 52 deletions.
2 changes: 1 addition & 1 deletion code/datums/beam.dm
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@

/obj/effect/ebeam/deadly/Crossed(atom/A, oldloc)
..()
A.ex_act(1)
A.ex_act(EXPLODE_DEVASTATE)

/obj/effect/ebeam/vetus/Destroy()
for(var/mob/living/M in get_turf(src))
Expand Down
2 changes: 1 addition & 1 deletion code/game/gamemodes/cult/blood_magic.dm
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@
return
owner.visible_message("<span class='warning'>[owner]'s body flashes a bright blue!</span>", \
"<span class='cultitalic'>You speak the cursed words, channeling an electromagnetic pulse from your body.</span>")
owner.emp_act(2)
owner.emp_act(EMP_LIGHT)
INVOKE_ASYNC(GLOBAL_PROC, GLOBAL_PROC_REF(empulse), owner, 2, 5, TRUE, "cult")
owner.whisper(invocation)
charges--
Expand Down
2 changes: 1 addition & 1 deletion code/game/gamemodes/miniantags/abduction/abduction_gear.dm
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ CONTENTS:
if(isradio(I))
var/obj/item/radio/R = I
R.listening = FALSE // Prevents the radio from buzzing due to the EMP, preserving possible stealthiness.
R.emp_act(1)
R.emp_act(EMP_HEAVY)

/obj/item/gun/energy/alien
name = "alien pistol"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@
to_chat(spawner, "<span class='danger'>Success! Your trap on [src] caught [user]!</span>")
stored_obj.forceMove(get_turf(loc))
playsound(get_turf(src),'sound/effects/explosion2.ogg', 200, 1)
user.ex_act(2)
user.ex_act(EXPLODE_HEAVY)
user.Stun(3 SECONDS)//A bomb went off in your hands. Actually lets people follow up with it if they bait someone, right now it is unreliable.
qdel(src)

Expand Down
2 changes: 1 addition & 1 deletion code/game/gamemodes/miniantags/guardian/types/protector.dm
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
var/list/connected_shields = list()

/mob/living/simple_animal/hostile/guardian/protector/ex_act(severity)
if(severity == 1)
if(severity == EXPLODE_DEVASTATE)
adjustBruteLoss(200) //if in protector mode, will do 20 damage and not actually necessarily kill the summoner
else
..()
Expand Down
6 changes: 3 additions & 3 deletions code/game/gamemodes/miniantags/revenant/revenant_abilities.dm
Original file line number Diff line number Diff line change
Expand Up @@ -441,7 +441,7 @@
to_chat(src, "<span class='warning'>You feel [pick("your sense of direction flicker out", "a stabbing pain in your head", "your mind fill with static")].</span>")
new /obj/effect/temp_visual/revenant(loc)
if(cause_emp)
emp_act(1)
emp_act(EMP_HEAVY)

/mob/living/simple_animal/bot/rev_malfunction(cause_emp = TRUE)
if(!emagged)
Expand All @@ -456,7 +456,7 @@
new /obj/effect/temp_visual/revenant(loc)
emag_act(usr)
else if(cause_emp)
emp_act(1)
emp_act(EMP_HEAVY)

/obj/machinery/clonepod/rev_malfunction(cause_emp = TRUE)
..(cause_emp = FALSE)
Expand All @@ -472,7 +472,7 @@
new /obj/effect/temp_visual/revenant(loc)
spark_system.start()
if(cause_emp)
emp_act(1)
emp_act(EMP_HEAVY)

/turf/defile()
if(flags & BLESSED_TILE)
Expand Down
2 changes: 1 addition & 1 deletion code/game/machinery/computer/HolodeckControl.dm
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@
for(var/turf/T in linkedholodeck)
if(prob(30))
do_sparks(2, 1, T)
T.ex_act(3)
T.ex_act(EXPLODE_LIGHT)
T.hotspot_expose(1000,500,1)

/obj/machinery/computer/HolodeckControl/proc/loadProgram(area/A)
Expand Down
4 changes: 2 additions & 2 deletions code/game/machinery/computer/arcade.dm
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,9 @@
return
var/num_of_prizes = 0
switch(severity)
if(1)
if(EMP_HEAVY)
num_of_prizes = rand(1,4)
if(2)
if(EMP_LIGHT)
num_of_prizes = rand(0,2)
for(var/i = num_of_prizes; i > 0; i--)
prizevend()
Expand Down
4 changes: 2 additions & 2 deletions code/game/machinery/computer/computer.dm
Original file line number Diff line number Diff line change
Expand Up @@ -116,10 +116,10 @@
/obj/machinery/computer/emp_act(severity)
..()
switch(severity)
if(1)
if(EMP_HEAVY)
if(prob(50))
obj_break(ENERGY)
if(2)
if(EMP_LIGHT)
if(prob(10))
obj_break(ENERGY)

Expand Down
2 changes: 1 addition & 1 deletion code/game/machinery/deployable.dm
Original file line number Diff line number Diff line change
Expand Up @@ -397,7 +397,7 @@
qdel(src)

/obj/structure/dropwall_generator/ex_act(severity)
if(protected && severity > 1) //We would throw the explosion at the shield, but it is already getting hit
if(protected && severity > EXPLODE_DEVASTATE) //We would throw the explosion at the shield, but it is already getting hit
return
qdel(src)

Expand Down
2 changes: 1 addition & 1 deletion code/game/machinery/doors/poddoor.dm
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@

//"BLAST" doors are obviously stronger than regular doors when it comes to BLASTS.
/obj/machinery/door/poddoor/ex_act(severity)
if(severity == 3)
if(severity == EXPLODE_LIGHT)
return
..()

Expand Down
2 changes: 1 addition & 1 deletion code/game/mecha/mecha.dm
Original file line number Diff line number Diff line change
Expand Up @@ -409,7 +409,7 @@
breakthrough = TRUE

else if(istype(obstacle, /obj/structure/reagent_dispensers/fueltank))
obstacle.ex_act(1)
obstacle.ex_act(EXPLODE_DEVASTATE)

else if(isliving(obstacle))
var/mob/living/L = obstacle
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@
mergeable_decal = FALSE

/obj/effect/decal/cleanable/shreds/ex_act(severity, target)
if(severity == 1) //so shreds created during an explosion aren't deleted by the explosion.
if(severity == EXPLODE_DEVASTATE) //so shreds created during an explosion aren't deleted by the explosion.
qdel(src)

/obj/effect/decal/cleanable/shreds/Initialize(mapload)
Expand Down
2 changes: 1 addition & 1 deletion code/game/objects/effects/snowcloud.dm
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@
qdel(src)

/obj/effect/snow/ex_act(severity)
if(severity == 3 && prob(50))
if(severity == EXPLODE_LIGHT && prob(50))
return
qdel(src)

Expand Down
8 changes: 4 additions & 4 deletions code/game/objects/empulse.dm
Original file line number Diff line number Diff line change
Expand Up @@ -37,16 +37,16 @@
var/will_affect = FALSE

if(distance < heavy_range)
will_affect = T.emp_act(1)
will_affect = T.emp_act(EMP_HEAVY)

else if(distance == heavy_range)
if(prob(50))
will_affect = T.emp_act(1)
will_affect = T.emp_act(EMP_HEAVY)
else
will_affect = T.emp_act(2)
will_affect = T.emp_act(EMP_LIGHT)

else if(distance <= light_range)
will_affect = T.emp_act(2)
will_affect = T.emp_act(EMP_LIGHT)

if(will_affect)
if(cause == "cult")
Expand Down
4 changes: 2 additions & 2 deletions code/game/objects/explosion.dm
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@
if(breach)
T.ex_act(dist)
else
T.ex_act(3)
T.ex_act(EXPLODE_LIGHT)

CHECK_TICK

Expand All @@ -219,7 +219,7 @@

/proc/secondaryexplosion(turf/epicenter, range)
for(var/turf/tile in spiral_range_turfs(range, epicenter))
tile.ex_act(2)
tile.ex_act(EXPLODE_HEAVY)

/client/proc/check_bomb_impacts()
set name = "Check Bomb Impact"
Expand Down
2 changes: 1 addition & 1 deletion code/game/objects/items/devices/flashlight.dm
Original file line number Diff line number Diff line change
Expand Up @@ -393,7 +393,7 @@
var/mob/M = A
add_attack_logs(user, M, "Hit with EMP-light")
to_chat(user, "[src] now has [emp_cur_charges] charge\s.")
A.emp_act(1)
A.emp_act(EMP_HEAVY)
else
to_chat(user, "<span class='warning'>\The [src] needs time to recharge!</span>")
return
Expand Down
2 changes: 1 addition & 1 deletion code/game/objects/items/devices/laserpointer.dm
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@
else if(istype(target, /obj/machinery/camera))
var/obj/machinery/camera/C = target
if(prob(effectchance * diode.rating))
C.emp_act(1)
C.emp_act(EMP_HEAVY)
outmsg = "<span class='notice'>You hit the lens of [C] with [src], temporarily disabling the camera!</span>"

log_admin("[key_name(user)] EMPd a camera with a laser pointer")
Expand Down
4 changes: 2 additions & 2 deletions code/game/objects/items/weapons/twohanded.dm
Original file line number Diff line number Diff line change
Expand Up @@ -722,12 +722,12 @@
if(HAS_TRAIT(src, TRAIT_WIELDED))
if(iswallturf(A))
var/turf/simulated/wall/Z = A
Z.ex_act(2)
Z.ex_act(EXPLODE_HEAVY)
charged = 3
playsound(user, 'sound/weapons/marauder.ogg', 50, 1)
else if(isstructure(A) || ismecha(A))
var/obj/Z = A
Z.ex_act(2)
Z.ex_act(EXPLODE_HEAVY)
charged = 3
playsound(user, 'sound/weapons/marauder.ogg', 50, 1)

Expand Down
2 changes: 1 addition & 1 deletion code/game/objects/items/weapons/weaponry.dm
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@
var/atom/throw_target = get_edge_target_turf(target, user.dir)
user.visible_message("<span class='userdanger'>It's a home run!</span>")
target.throw_at(throw_target, rand(8,10), 14, user)
target.ex_act(2)
target.ex_act(EXPLODE_HEAVY)
playsound(get_turf(src), 'sound/weapons/homerun.ogg', 100, 1)
homerun_ready = 0
return
Expand Down
2 changes: 1 addition & 1 deletion code/game/objects/structures/depot_structures.dm
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
return ..()

/obj/structure/fusionreactor/ex_act(severity)
if(severity < 3)
if(severity < EXPLODE_LIGHT)
obj_integrity = 0
healthcheck()

Expand Down
2 changes: 1 addition & 1 deletion code/game/turfs/simulated/floor.dm
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ GLOBAL_LIST_INIT(icons_to_ignore_at_floor_init, list("damaged1","damaged2","dama
return

/turf/simulated/floor/burn_down()
ex_act(2)
ex_act(EXPLODE_HEAVY)

/turf/simulated/floor/is_shielded()
for(var/obj/structure/A in contents)
Expand Down
2 changes: 1 addition & 1 deletion code/modules/clothing/spacesuits/hardsuit.dm
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@

/obj/item/clothing/head/helmet/space/hardsuit/emp_act(severity)
..()
display_visor_message("[severity > 1 ? "Light" : "Strong"] electromagnetic pulse detected!")
display_visor_message("[severity > EMP_HEAVY ? "Light" : "Strong"] electromagnetic pulse detected!")

/obj/item/clothing/suit/space/hardsuit
name = "hardsuit"
Expand Down
4 changes: 2 additions & 2 deletions code/modules/events/spacevine.dm
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@
return

/turf/simulated/floor/vines/ex_act(severity)
if(severity < 3)
if(severity < EXPLODE_LIGHT)
ChangeTurf(baseturf)

/turf/simulated/floor/vines/narsie_act()
Expand Down Expand Up @@ -209,7 +209,7 @@
nofun = TRUE

/datum/spacevine_mutation/explosive/on_explosion(explosion_severity, obj/structure/spacevine/holder)
if(explosion_severity < 3)
if(explosion_severity < EXPLODE_LIGHT)
qdel(holder)
else
addtimer(CALLBACK(holder, TYPE_PROC_REF(/obj/structure/spacevine, wither)), 5)
Expand Down
2 changes: 1 addition & 1 deletion code/modules/mining/equipment/mining_charges.dm
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@
location = get_atom_on_turf(src)
if(location)
explosion(location, boom_sizes[1], boom_sizes[2], boom_sizes[3], cause = src)
location.ex_act(2, target)
location.ex_act(EXPLODE_HEAVY, target)
qdel(src)

/obj/item/grenade/plastic/miningcharge/proc/override_safety()
Expand Down
2 changes: 1 addition & 1 deletion code/modules/mining/machine_vending.dm
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,7 @@

/obj/machinery/mineral/equipment_vendor/ex_act(severity, target)
do_sparks(5, TRUE, src)
if(prob(50 / severity) && severity < 3)
if(prob(50 / severity) && severity < EXPLODE_LIGHT)
qdel(src)

/obj/machinery/mineral/equipment_vendor/Destroy()
Expand Down
2 changes: 1 addition & 1 deletion code/modules/mining/ores_coins.dm
Original file line number Diff line number Diff line change
Expand Up @@ -353,7 +353,7 @@ GLOBAL_LIST_INIT(sand_recipes, list(\


/obj/item/stack/ore/ex_act(severity)
if(!severity || severity >= 2)
if(!severity || severity >= EXPLODE_HEAVY)
return
qdel(src)

Expand Down
6 changes: 2 additions & 4 deletions code/modules/mob/living/brain/robotic_brain.dm
Original file line number Diff line number Diff line change
Expand Up @@ -160,12 +160,10 @@
if(!brainmob)
return
switch(severity)
if(1)
if(EMP_HEAVY)
brainmob.emp_damage += rand(20, 30)
if(2)
if(EMP_LIGHT)
brainmob.emp_damage += rand(10, 20)
if(3)
brainmob.emp_damage += rand(0, 10)
..()

/obj/item/mmi/robotic_brain/New()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -600,8 +600,8 @@ Difficulty: Hard
if(mode == VORTEX)
var/turf/T = get_turf(src)
for(var/atom/A in T)
A.ex_act(3) //Body is immune to explosions of this strength.
T.ex_act(3)
A.ex_act(EXPLODE_LIGHT) //Body is immune to explosions of this strength.
T.ex_act(EXPLODE_LIGHT)
if(mode == CRYO)
var/turf/simulated/S = get_turf(src)
S.MakeSlippery(TURF_WET_ICE, enraged ? rand(25, 35 SECONDS) : rand(10, 20 SECONDS))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -356,7 +356,7 @@ Difficulty: Very Hard
/obj/item/projectile/colossus/on_hit(atom/target, blocked = 0)
. = ..()
if(isturf(target) || isobj(target))
target.ex_act(2)
target.ex_act(EXPLODE_HEAVY)
for(var/obj/machinery/light/L in range(2, src))
L.break_light_tube(0, 1) //No leaving lights floating their as colossus breaks the station
if(isliving(target))
Expand Down
2 changes: 1 addition & 1 deletion code/modules/mod/mod_control.dm
Original file line number Diff line number Diff line change
Expand Up @@ -455,7 +455,7 @@
. = ..()
if(!active || !wearer)
return
to_chat(wearer, "<span class='warning'>[severity > 1 ? "Light" : "Strong"] electromagnetic pulse detected!")
to_chat(wearer, "<span class='warning'>[severity > EMP_HEAVY ? "Light" : "Strong"] electromagnetic pulse detected!")
if(emp_proof)
return
selected_module?.on_deactivation(display_message = TRUE)
Expand Down
2 changes: 1 addition & 1 deletion code/modules/power/engines/singularity/narsie.dm
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@
/obj/singularity/narsie/proc/godsmack(atom/A)
if(isobj(A))
var/obj/O = A
O.ex_act(1)
O.ex_act(EXPLODE_DEVASTATE)
if(O) qdel(O)

else if(isturf(A))
Expand Down
2 changes: 1 addition & 1 deletion code/modules/power/gravitygenerator.dm
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ GLOBAL_LIST_EMPTY(gravity_generators)
flags_2 = NO_MALF_EFFECT_2

/obj/machinery/gravity_generator/ex_act(severity)
if(severity == 1) // Very sturdy.
if(severity == EXPLODE_DEVASTATE) // Very sturdy.
set_broken()

/obj/machinery/gravity_generator/blob_act(obj/structure/blob/B)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@
icon_state = "[initial(icon_state)][beaker ? "_working" : ""]"

/obj/machinery/chem_dispenser/ex_act(severity)
if(severity < 3)
if(severity < EXPLODE_LIGHT)
if(beaker)
beaker.ex_act(severity)
..()
Expand Down
2 changes: 1 addition & 1 deletion code/modules/reagents/chemistry/machinery/chem_master.dm
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@
reagents.maximum_volume += B.reagents.maximum_volume

/obj/machinery/chem_master/ex_act(severity)
if(severity < 3)
if(severity < EXPLODE_LIGHT)
if(beaker)
beaker.ex_act(severity)
if(loaded_pill_bottle)
Expand Down
2 changes: 1 addition & 1 deletion code/modules/shuttle/shuttle.dm
Original file line number Diff line number Diff line change
Expand Up @@ -688,7 +688,7 @@
SEND_SOUND(M, loud_crash_sound)
for(var/turf/T in L2)
for(var/atom/movable/A in T.contents)
A.ex_act(1)
A.ex_act(EXPLODE_DEVASTATE)
if(istype(A, /obj/machinery/atmospherics/supermatter_crystal))
var/obj/machinery/atmospherics/supermatter_crystal/bakoom = A
addtimer(CALLBACK(bakoom, TYPE_PROC_REF(/obj/machinery/atmospherics/supermatter_crystal, explode), bakoom.combined_gas, bakoom.power, bakoom.gasmix_power_ratio), 1 SECONDS)
Expand Down
Loading

0 comments on commit 777910d

Please sign in to comment.