replace magic numbers related to emp and explosion severity with defines (#26495)

replace even more magic emp and ex numbers
This commit is contained in:
Kenionatus
2024-08-18 05:11:22 +02:00
committed by GitHub
parent 1b5af3a748
commit 777910d6d2
37 changed files with 50 additions and 52 deletions
+1 -1
View File
@@ -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))
+1 -1
View File
@@ -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--
@@ -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"
@@ -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)
@@ -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
..()
@@ -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)
@@ -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)
@@ -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)
@@ -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)
+2 -2
View File
@@ -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()
+2 -2
View File
@@ -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)
+1 -1
View File
@@ -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)
+1 -1
View File
@@ -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
..()
+1 -1
View File
@@ -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
@@ -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)
+1 -1
View File
@@ -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)
+4 -4
View File
@@ -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")
+2 -2
View File
@@ -195,7 +195,7 @@
if(breach)
T.ex_act(dist)
else
T.ex_act(3)
T.ex_act(EXPLODE_LIGHT)
CHECK_TICK
@@ -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"
@@ -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
@@ -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")
+2 -2
View File
@@ -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)
+1 -1
View File
@@ -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
@@ -28,7 +28,7 @@
return ..()
/obj/structure/fusionreactor/ex_act(severity)
if(severity < 3)
if(severity < EXPLODE_LIGHT)
obj_integrity = 0
healthcheck()
+1 -1
View File
@@ -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)
+1 -1
View File
@@ -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"
+2 -2
View File
@@ -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()
@@ -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)
@@ -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()
+1 -1
View File
@@ -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()
+1 -1
View File
@@ -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)
@@ -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()
@@ -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))
@@ -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))
+1 -1
View File
@@ -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)
@@ -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))
+1 -1
View File
@@ -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)
@@ -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)
..()
@@ -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)
+1 -1
View File
@@ -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)
+2 -2
View File
@@ -198,9 +198,9 @@
/obj/machinery/bsa/full/proc/fire(mob/user, turf/bullseye, target)
var/turf/point = get_front_turf()
for(var/turf/T in get_line(get_step(point,dir),get_target_turf()))
T.ex_act(1)
T.ex_act(EXPLODE_DEVASTATE)
for(var/atom/A in T)
A.ex_act(1)
A.ex_act(EXPLODE_DEVASTATE)
point.Beam(get_target_turf(), icon_state = "bsa_beam", time = 50, maxdistance = world.maxx, beam_type = /obj/effect/ebeam/deadly) //ZZZAP
playsound(src, 'sound/machines/bsa_fire.ogg', 100, 1)