Merge pull request #13375 from timothyteakettle/emp-rework

the emp rework (emp severity reduces as you move from epicentre, severity is 1-100)
This commit is contained in:
silicons
2020-10-01 03:01:18 -07:00
committed by GitHub
95 changed files with 166 additions and 295 deletions
+16 -20
View File
@@ -1,32 +1,28 @@
/proc/empulse(turf/epicenter, heavy_range, light_range, log=0)
/proc/empulse(turf/epicenter, power, log=0)
if(!epicenter)
return
if(!isturf(epicenter))
epicenter = get_turf(epicenter.loc)
if(log)
message_admins("EMP with size ([heavy_range], [light_range]) in area [epicenter.loc.name] ")
log_game("EMP with size ([heavy_range], [light_range]) in area [epicenter.loc.name] ")
var/max_distance = max(round((power/7)^0.7), 1)
if(heavy_range >= 1)
if(log)
message_admins("EMP with power [power], max distance [max_distance] in area [epicenter.loc.name] ")
log_game("EMP with power [power], max distance [max_distance] in area [epicenter.loc.name] ")
if(power > 100)
new /obj/effect/temp_visual/emp/pulse(epicenter)
if(heavy_range > light_range)
light_range = heavy_range
for(var/A in spiral_range(light_range, epicenter))
for(var/A in spiral_range(max_distance, epicenter))
var/atom/T = A
var/distance = get_dist(epicenter, T)
if(distance < 0)
distance = 0
if(distance < heavy_range)
T.emp_act(EMP_HEAVY)
else if(distance == heavy_range)
if(prob(50))
T.emp_act(EMP_HEAVY)
else
T.emp_act(EMP_LIGHT)
else if(distance <= light_range)
T.emp_act(EMP_LIGHT)
var/severity = 100
if(distance != 0) //please dont divide by 0
severity = min(max((max_distance / distance^0.3) * (100/max_distance), 1),100) //if it goes below 1 or above 100 stuff gets bad
T.emp_act(severity)
return 1
/proc/empulse_using_range(turf/epicenter, range, log=0) //make an emp using range instead of power
var/power_from_range = (7*(range^(1/0.7)))
empulse(epicenter, power_from_range, log)
+1 -1
View File
@@ -101,7 +101,7 @@
. = ..()
if(. & EMP_PROTECT_SELF)
return
var/wipe_chance = 60 / severity
var/wipe_chance = severity/1.5
if(prob(wipe_chance))
visible_message("<span class='warning'>[src] fizzles and disappears!</span>")
qdel(src) //rip cash
+1 -1
View File
@@ -140,7 +140,7 @@
/obj/item/defibrillator/emp_act(severity)
. = ..()
if(cell && !(. & EMP_PROTECT_CONTENTS))
deductcharge(1000 / severity)
deductcharge(severity*10)
if (. & EMP_PROTECT_SELF)
return
if(safety)
+1 -1
View File
@@ -1206,7 +1206,7 @@ GLOBAL_LIST_EMPTY(PDAs)
A.emp_act(severity)
if (!(. & EMP_PROTECT_SELF))
emped += 1
spawn(200 * severity)
spawn(2 * severity)
emped -= 1
/proc/get_viewable_pdas()
@@ -225,7 +225,7 @@
if(C && istype(C) && C.bug == src)
if(!same_z_level(C))
return
C.emp_act(EMP_HEAVY)
C.emp_act(80)
C.bug = null
bugged_cameras -= C.c_tag
interact()
@@ -428,7 +428,7 @@
else
A.visible_message("<span class='danger'>[user] blinks \the [src] at \the [A].")
to_chat(user, "\The [src] now has [emp_cur_charges] charge\s.")
A.emp_act(EMP_HEAVY)
A.emp_act(80)
else
to_chat(user, "<span class='warning'>\The [src] needs time to recharge!</span>")
return
@@ -128,7 +128,7 @@
else if(istype(target, /obj/machinery/camera))
var/obj/machinery/camera/C = target
if(prob(effectchance * diode.rating))
C.emp_act(EMP_HEAVY)
C.emp_act(80)
outmsg = "<span class='notice'>You hit the lens of [C] with [src], temporarily disabling the camera!</span>"
log_combat(user, C, "EMPed", src)
else
+1 -1
View File
@@ -261,4 +261,4 @@
if (!(. & EMP_PROTECT_SELF))
turn_off()
if(!iscyborg(loc))
deductcharge(1000 / severity, TRUE, FALSE)
deductcharge(severity*10, TRUE, FALSE)
+1 -1
View File
@@ -351,7 +351,7 @@
/obj/item/book/granter/spell/charge/recoil(mob/user)
..()
to_chat(user,"<span class='warning'>[src] suddenly feels very warm!</span>")
empulse(src, 1, 1)
empulse_using_range(src, 1)
/obj/item/book/granter/spell/summonitem
spell = /obj/effect/proc_holder/spell/targeted/summonitem
@@ -7,5 +7,5 @@
/obj/item/grenade/empgrenade/prime(mob/living/lanced_by)
. = ..()
update_mob()
empulse(src, 4, 10)
empulse_using_range(src, 14)
qdel(src)
@@ -65,7 +65,7 @@
/obj/item/implant/emp/activate()
. = ..()
uses--
empulse(imp_in, 3, 5)
empulse_using_range(imp_in, 7)
if(!uses)
qdel(src)
+1 -1
View File
@@ -232,7 +232,7 @@
if (!(. & EMP_PROTECT_SELF))
switch_status(FALSE)
if(!iscyborg(loc))
deductcharge(1000 / severity, TRUE, FALSE)
deductcharge(severity*10, TRUE, FALSE)
/obj/item/melee/baton/stunsword
name = "stunsword"
-24
View File
@@ -104,9 +104,6 @@
set_sign(new /datum/barsign/hiddensigns/empbarsign)
broken = TRUE
/obj/structure/sign/barsign/emag_act(mob/user)
. = ..()
if(broken || (obj_flags & EMAGGED))
@@ -128,8 +125,6 @@
return
set_sign(picked_name)
//Code below is to define useless variables for datums. It errors without these
@@ -140,95 +135,77 @@
var/desc = "desc"
var/hidden = FALSE
//Anything below this is where all the specific signs are. If people want to add more signs, add them below.
/datum/barsign/maltesefalcon
name = "Maltese Falcon"
icon = "maltesefalcon"
desc = "The Maltese Falcon, Space Bar and Grill."
/datum/barsign/thebark
name = "The Bark"
icon = "thebark"
desc = "Ian's bar of choice."
/datum/barsign/harmbaton
name = "The Harmbaton"
icon = "theharmbaton"
desc = "A great dining experience for both security members and assistants."
/datum/barsign/thesingulo
name = "The Singulo"
icon = "thesingulo"
desc = "Where people go that'd rather not be called by their name."
/datum/barsign/thedrunkcarp
name = "The Drunk Carp"
icon = "thedrunkcarp"
desc = "Don't drink and swim."
/datum/barsign/scotchservinwill
name = "Scotch Servin Willy's"
icon = "scotchservinwill"
desc = "Willy sure moved up in the world from clown to bartender."
/datum/barsign/officerbeersky
name = "Officer Beersky's"
icon = "officerbeersky"
desc = "Man eat a dong, these drinks are great."
/datum/barsign/thecavern
name = "The Cavern"
icon = "thecavern"
desc = "Fine drinks while listening to some fine tunes."
/datum/barsign/theouterspess
name = "The Outer Spess"
icon = "theouterspess"
desc = "This bar isn't actually located in outer space."
/datum/barsign/slipperyshots
name = "Slippery Shots"
icon = "slipperyshots"
desc = "Slippery slope to drunkeness with our shots!"
/datum/barsign/thegreytide
name = "The Grey Tide"
icon = "thegreytide"
desc = "Abandon your toolboxing ways and enjoy a lazy beer!"
/datum/barsign/honkednloaded
name = "Honked 'n' Loaded"
icon = "honkednloaded"
desc = "Honk."
/datum/barsign/thenest
name = "The Nest"
icon = "thenest"
desc = "A good place to retire for a drink after a long night of crime fighting."
/datum/barsign/thecoderbus
name = "The Coderbus"
icon = "thecoderbus"
desc = "A very controversial bar known for its wide variety of constantly-changing drinks."
/datum/barsign/theadminbus
name = "The Adminbus"
icon = "theadminbus"
@@ -313,7 +290,6 @@
hidden = TRUE
//Hidden signs list below this point
/datum/barsign/hiddensigns/empbarsign
name = "Haywire Barsign"
icon = "empbarsign"
@@ -571,10 +571,10 @@
O.emp_act(severity)
if(!secure || broken)
return ..()
if(prob(50 / severity))
if(prob(severity/2))
locked = !locked
update_icon()
if(prob(20 / severity) && !opened)
if(prob(severity/5) && !opened)
if(!locked)
open()
else