Skip to content

Commit

Permalink
Reworks Interdictor Mob Protection (#14881)
Browse files Browse the repository at this point in the history
Co-authored-by: TobleroneSwordfish <20713227+TobleroneSwordfish@users.noreply.github.com>
  • Loading branch information
Wisemonster and TobleroneSwordfish committed Aug 5, 2023
1 parent 11a5bcd commit 1e592e8
Show file tree
Hide file tree
Showing 6 changed files with 52 additions and 36 deletions.
26 changes: 11 additions & 15 deletions code/mob.dm
Expand Up @@ -585,13 +585,11 @@
tmob_effect.deactivate(10)
tmob_effect.update_charge(-1)
//spatial interdictor: mitigate biomagnetic discharges
//consumes 100 units of charge (50,000 joules) to interdict a repulsion, permitting safe discharge of the fields
for_by_tcl(IX, /obj/machinery/interdictor)
if (IX.expend_interdict(100,src))
src.visible_message("<span class='alert'><B>[src]</B> and <B>[tmob]</B>'s magnetic fields briefly flare, then fade.</span>")
var/atom/source = get_turf(tmob)
playsound(source, 'sound/impact_sounds/Energy_Hit_1.ogg', 30, 1)
return
if (tmob.hasStatus("spatial_protection"))
src.visible_message("<span class='alert'><B>[src]</B> and <B>[tmob]</B>'s magnetic fields briefly flare, then fade.</span>")
var/atom/source = get_turf(tmob)
playsound(source, 'sound/impact_sounds/Energy_Hit_1.ogg', 30, 1)
return
// like repels - bump them away from each other
src.now_pushing = 0
var/atom/source = get_turf(tmob)
Expand Down Expand Up @@ -632,14 +630,12 @@
tmob_effect.deactivate(10)
tmob_effect.update_charge(-tmob_effect.charge)
//spatial interdictor: mitigate biomagnetic discharges
//consumes 150 units of charge (75,000 joules) to interdict an attraction, permitting safe discharge of the fields

for_by_tcl(IX, /obj/machinery/interdictor)
if (IX.expend_interdict(150,src))
src.visible_message("<span class='alert'><B>[src]</B> and <B>[tmob]</B>'s magnetic fields briefly flare, then fade.</span>")
var/atom/source = get_turf(tmob)
playsound(source, 'sound/impact_sounds/Energy_Hit_1.ogg', 30, 1)
return

if (tmob.hasStatus("spatial_protection"))
src.visible_message("<span class='alert'><B>[src]</B> and <B>[tmob]</B>'s magnetic fields briefly flare, then fade.</span>")
var/atom/source = get_turf(tmob)
playsound(source, 'sound/impact_sounds/Energy_Hit_1.ogg', 30, 1)
return
// opposite attracts - fling everything nearby at these dumbasses
src.now_pushing = 1
tmob.now_pushing = 1
Expand Down
13 changes: 10 additions & 3 deletions code/mob/living/life/Life.dm
Expand Up @@ -274,10 +274,17 @@
animate(src, transform = matrix(), time = 1)
last_no_gravity = src.no_gravity

// Zephyr-class interdictor: carbon mobs in range gain a buff to stamina recovery, which can accumulate to linger briefly
if (iscarbon(src))
//Interdictor's protections for mobs
if (isliving(src) && !isintangible(src))
for_by_tcl(IX, /obj/machinery/interdictor)
if (IX.expend_interdict(4,src,TRUE,ITDR_ZEPHYR))
var/area/area = get_area(src)
if (IX.expend_interdict(6,src,TRUE)) //This protects mobs from radstorms/wormholes/magnetic biofields
src.changeStatus("spatial_protection", 3 SECONDS)
if (istype(area) && area.irradiated)
IX.resisted = TRUE
if (!iscarbon(src)) //Prevents non-carbons from getting the Zephyr stam boost, but still protects other mobs
break
if (IX.expend_interdict(4,src,TRUE,ITDR_ZEPHYR)) // Zephyr-class interdictor: carbon mobs in range gain a buff to stamina recovery, which can accumulate to linger briefly
src.changeStatus("zephyr_field", 3 SECONDS * life_mult)
break

Expand Down
7 changes: 1 addition & 6 deletions code/mob/living/life/disability.dm
Expand Up @@ -37,12 +37,7 @@
if (A.irradiated)
//spatial interdictor: mitigate effect of radiation
//power expenditure is managed centrally by the interdictor
var/interdictor_influence = 0
for_by_tcl(IX, /obj/machinery/interdictor)
if (IX.radstorm_interdict(owner))
interdictor_influence = 1
break
if(!interdictor_influence)
if (!owner.hasStatus("spatial_protection"))
owner.take_radiation_dose((rand() * 0.3 SIEVERTS * A.irradiated * mult))

if (owner.bioHolder && ishuman(owner))
Expand Down
16 changes: 16 additions & 0 deletions code/modules/status_system/statusEffects.dm
Expand Up @@ -2424,3 +2424,19 @@
name = "De-revving"
desc = "An implant is attempting to convert you from the revolution! Remove the implant!"
icon_state = "mindhack"

/datum/statusEffect/interdictor //Status effect for letting people know they are protected from some spatial anomalies
id = "spatial_protection"
name = "Spatial Protection"
desc = "You are being protected from wormholes, radiation storms, and magnetic biofields."
icon_state = "blocking" //This gives the general idea that they are being protected, but could use a better icon
maxDuration = 4 SECONDS
effect_quality = STATUS_QUALITY_POSITIVE

onAdd(optional=null)
owner.add_filter("protection", 1, outline_filter(color="#e6ec21"))
..()

onRemove()
owner.remove_filter("protection")
..()
12 changes: 8 additions & 4 deletions code/obj/machinery/interdictor.dm
Expand Up @@ -8,6 +8,7 @@
icon_state = "interdictor"
power_usage = 1250 //drawn while interdiction field is active; charging is a separate usage value that can be concurrent
density = 1
var/resisted = FALSE //Changes if someone is being protected from a radstorm
anchored = UNANCHORED
req_access = list(access_engineering)

Expand Down Expand Up @@ -267,6 +268,9 @@
message_admins("Interdictor at ([log_loc(src)]) is missing a power cell. This is not supposed to happen, yell at kubius")
return
if(anchored)
if (src.resisted)
radstorm_interdict(src)
src.resisted = FALSE
if(intcap.charge < intcap.maxcharge && powered())
var/amount_to_add = min(round(intcap.maxcharge - intcap.charge, 10), src.chargerate)
if(amount_to_add)
Expand Down Expand Up @@ -331,12 +335,12 @@
return 1

///Specialized radiation storm interdiction proc that allows multiple protections under a single unified cost per process.
/obj/machinery/interdictor/proc/radstorm_interdict(var/target = null)
var/use_cost = 400 //how much it costs per machine tick to interdict radstorms, regardless of number of mobs protected
/obj/machinery/interdictor/proc/radstorm_interdict()
var/use_cost = 350 //how much it costs per machine tick to interdict radstorms, regardless of number of mobs protected
if (!src.resisted) //Don't spend power if no one is around to protect
return
if (status & BROKEN || !src.canInterdict)
return 0
if (!target || !IN_RANGE(src,target,src.interdict_range))
return 0
if (!intcap)
src.stop_interdicting()
return 0
Expand Down
14 changes: 6 additions & 8 deletions code/obj/portal.dm
Expand Up @@ -92,14 +92,12 @@

Bumped(mob/M as mob|obj)
//spatial interdictor: when something would enter a wormhole, it doesn't
//consumes 200 units of charge (100,000 joules) per wormhole interdicted
for_by_tcl(IX, /obj/machinery/interdictor)
if (IX.expend_interdict(200,src))
icon = 'icons/effects/effects.dmi'
icon_state = "sparks_attack"
playsound(src.loc, 'sound/impact_sounds/Energy_Hit_1.ogg', 30, 1)
density = 0
return
if (M.hasStatus("spatial_protection"))
icon = 'icons/effects/effects.dmi'
icon_state = "sparks_attack"
playsound(src.loc, 'sound/impact_sounds/Energy_Hit_1.ogg', 30, 1)
density = 0
return
..()

/obj/portal/afterlife
Expand Down

0 comments on commit 1e592e8

Please sign in to comment.