mirror of
https://github.com/CHOMPStation2/CHOMPStation2.git
synced 2026-08-24 05:38:15 +01:00
[MIRROR] EMP & Wires refactor (#12658)
Co-authored-by: Guti <32563288+TheCaramelion@users.noreply.github.com> Co-authored-by: Cameron Lennox <killer65311@gmail.com>
This commit is contained in:
co-authored by
Guti
Cameron Lennox
parent
494fc9bea9
commit
b116cc450d
@@ -83,22 +83,22 @@
|
||||
|
||||
|
||||
/obj/machinery/power/am_control_unit/emp_act(severity, recursive)
|
||||
. = ..()
|
||||
if (. & EMP_PROTECT_SELF)
|
||||
return
|
||||
switch(severity)
|
||||
if(1)
|
||||
if(EMP_HEAVY)
|
||||
if(active) toggle_power()
|
||||
stability -= rand(15,30)
|
||||
if(2)
|
||||
if(EMP_MEDIUM)
|
||||
if(active) toggle_power()
|
||||
stability -= rand(10,20)
|
||||
if(3)
|
||||
if(EMP_LIGHT)
|
||||
if(active) toggle_power()
|
||||
stability -= rand(8,15)
|
||||
if(4)
|
||||
if(EMP_HARMLESS)
|
||||
if(active) toggle_power()
|
||||
stability -= rand(5,10)
|
||||
..()
|
||||
return FALSE
|
||||
|
||||
|
||||
/obj/machinery/power/am_control_unit/ex_act(severity)
|
||||
switch(severity)
|
||||
|
||||
@@ -89,7 +89,7 @@
|
||||
|
||||
|
||||
/obj/machinery/am_shielding/emp_act(severity, recursive)//Immune due to not really much in the way of electronics.
|
||||
return FALSE
|
||||
return
|
||||
|
||||
|
||||
/obj/machinery/am_shielding/ex_act(severity)
|
||||
|
||||
@@ -137,7 +137,6 @@ GLOBAL_LIST_EMPTY(apcs)
|
||||
var/has_electronics = APC_HAS_ELECTRONICS_NONE // 0 - none, 1 - plugged in, 2 - secured by screwdriver
|
||||
var/beenhit = 0 // used for counting how many times it has been hit, used for Aliens at the moment
|
||||
var/longtermpower = 10
|
||||
var/datum/wires/apc/wires = null
|
||||
var/emergency_lights = FALSE
|
||||
var/update_state = -1
|
||||
var/update_overlay = -1
|
||||
@@ -187,7 +186,7 @@ GLOBAL_LIST_EMPTY(apcs)
|
||||
|
||||
/obj/machinery/power/apc/Initialize(mapload, ndir, building)
|
||||
. = ..()
|
||||
wires = new(src)
|
||||
set_wires(new /datum/wires/apc(src))
|
||||
GLOB.apcs += src
|
||||
|
||||
// offset 24 pixels in direction of dir
|
||||
@@ -1189,6 +1188,9 @@ GLOBAL_LIST_EMPTY(apcs)
|
||||
|
||||
// damage and destruction acts
|
||||
/obj/machinery/power/apc/emp_act(severity, recursive)
|
||||
. = ..()
|
||||
if (. & EMP_PROTECT_SELF)
|
||||
return
|
||||
// Fail for 8-12 minutes (divided by severity)
|
||||
// Division by 2 is required, because machinery ticks are every two seconds. Without it we would fail for 16-24 minutes.
|
||||
|
||||
@@ -1204,7 +1206,6 @@ GLOBAL_LIST_EMPTY(apcs)
|
||||
severity = severity+1
|
||||
|
||||
update_icon()
|
||||
..(severity, recursive)
|
||||
|
||||
/obj/machinery/power/apc/ex_act(severity)
|
||||
|
||||
|
||||
@@ -14,8 +14,6 @@
|
||||
throw_speed = 3
|
||||
throw_range = 5
|
||||
w_class = ITEMSIZE_NORMAL
|
||||
/// Are we EMP immune?
|
||||
var/emp_proof = FALSE
|
||||
var/static/cell_uid = 1 // Unique ID of this power cell. Used to reduce bunch of uglier code in nanoUI.
|
||||
var/c_uid
|
||||
var/charge = 1000 // maximum charge on spawn
|
||||
@@ -234,7 +232,8 @@
|
||||
rigged = 1 //broken batterys are dangerous
|
||||
|
||||
/obj/item/cell/emp_act(severity, recursive)
|
||||
if(emp_proof)
|
||||
. = ..()
|
||||
if (. & EMP_PROTECT_SELF)
|
||||
return
|
||||
//remove this once emp changes on dev are merged in
|
||||
if(isrobot(loc))
|
||||
@@ -246,7 +245,6 @@
|
||||
charge = 0
|
||||
|
||||
update_icon()
|
||||
..()
|
||||
|
||||
/obj/item/cell/ex_act(severity)
|
||||
|
||||
|
||||
@@ -61,7 +61,10 @@
|
||||
desc = "A small power cell designed to power handheld devices. Shielded from EMPs."
|
||||
icon_state = "s_st"
|
||||
matter = list(MAT_STEEL = 400, MAT_GLASS = 60)
|
||||
emp_proof = TRUE
|
||||
|
||||
/obj/item/cell/device/empproof/Initialize(mapload)
|
||||
AddElement(/datum/element/empprotection, EMP_PROTECT_SELF)
|
||||
return ..()
|
||||
|
||||
/obj/item/cell/device/empproof/empty
|
||||
charge = 0
|
||||
@@ -90,7 +93,10 @@
|
||||
desc = "A small power cell designed to power handheld weaponry. Shielded from EMPs."
|
||||
icon_state = "s_hi"
|
||||
matter = list(MAT_STEEL = 400, MAT_GLASS = 60)
|
||||
emp_proof = TRUE
|
||||
|
||||
/obj/item/cell/device/weapon/empproof/Initialize(mapload)
|
||||
AddElement(/datum/element/empprotection, EMP_PROTECT_SELF)
|
||||
return ..()
|
||||
|
||||
/obj/item/cell/device/weapon/empproof/empty
|
||||
charge = 0
|
||||
|
||||
@@ -151,7 +151,10 @@
|
||||
maxcharge = 30000 //determines how badly mobs get shocked
|
||||
matter = list(MAT_STEEL = 700, MAT_GLASS = 80)
|
||||
robot_durability = 200
|
||||
emp_proof = TRUE
|
||||
|
||||
/obj/item/cell/infinite/Initialize(mapload)
|
||||
AddElement(/datum/element/empprotection, EMP_PROTECT_SELF)
|
||||
return ..()
|
||||
|
||||
/obj/item/cell/infinite/check_charge()
|
||||
return 1
|
||||
|
||||
@@ -8,7 +8,6 @@
|
||||
anchored = TRUE
|
||||
var/power_failing = FALSE // Turns to TRUE when the grid check event is fired by the Game Master, or perhaps a cheeky antag.
|
||||
// Wire stuff below.
|
||||
var/datum/wires/grid_checker/wires
|
||||
var/wire_locked_out = FALSE
|
||||
var/wire_allow_manual_1 = FALSE
|
||||
var/wire_allow_manual_2 = FALSE
|
||||
@@ -19,7 +18,7 @@
|
||||
. = ..()
|
||||
connect_to_network()
|
||||
update_icon()
|
||||
wires = new(src)
|
||||
set_wires(new /datum/wires/grid_checker(src))
|
||||
default_apply_parts()
|
||||
|
||||
/obj/machinery/power/grid_checker/Destroy()
|
||||
|
||||
@@ -159,5 +159,5 @@
|
||||
|
||||
/obj/machinery/power/port_gen/pacman2/emag_act(var/remaining_uses, var/mob/user)
|
||||
emagged = 1
|
||||
emp_act(1)
|
||||
emp_act(EMP_HEAVY)
|
||||
return 1
|
||||
|
||||
@@ -72,18 +72,21 @@
|
||||
. += span_notice("The generator is off.")
|
||||
|
||||
/obj/machinery/power/port_gen/emp_act(severity, recursive)
|
||||
. = ..()
|
||||
if (. & EMP_PROTECT_SELF)
|
||||
return
|
||||
var/duration = 6000 //ten minutes
|
||||
switch(severity)
|
||||
if(1)
|
||||
if(EMP_HEAVY)
|
||||
stat &= BROKEN
|
||||
if(prob(75)) explode()
|
||||
if(2)
|
||||
if(EMP_MEDIUM)
|
||||
if(prob(50)) stat &= BROKEN
|
||||
if(prob(10)) explode()
|
||||
if(3)
|
||||
if(EMP_LIGHT)
|
||||
if(prob(25)) stat &= BROKEN
|
||||
duration = 300
|
||||
if(4)
|
||||
if(EMP_HARMLESS)
|
||||
if(prob(10)) stat &= BROKEN
|
||||
duration = 300
|
||||
|
||||
|
||||
@@ -459,9 +459,6 @@
|
||||
power_gen = cool_rotations
|
||||
runner.nutrition -= nutrition_drain
|
||||
|
||||
/obj/machinery/power/rtg/reg/emp_act(severity, recursive)
|
||||
return
|
||||
|
||||
/obj/item/circuitboard/machine/reg_d
|
||||
name = T_BOARD("D-Type-REG")
|
||||
build_path = /obj/machinery/power/rtg/reg
|
||||
|
||||
@@ -82,10 +82,6 @@
|
||||
to_chat(user, span_warning("\The [src] needs to be firmly secured to the floor first."))
|
||||
return 1
|
||||
|
||||
|
||||
/obj/machinery/power/emitter/emp_act(severity, recursive)
|
||||
return TRUE
|
||||
|
||||
/obj/machinery/power/emitter/process()
|
||||
if(stat & (BROKEN))
|
||||
return
|
||||
|
||||
@@ -169,10 +169,6 @@
|
||||
..()
|
||||
return
|
||||
|
||||
|
||||
/obj/machinery/field_generator/emp_act(severity, recursive)
|
||||
return FALSE
|
||||
|
||||
/obj/machinery/field_generator/bullet_act(var/obj/item/projectile/Proj)
|
||||
if(istype(Proj, /obj/item/projectile/beam))
|
||||
power += Proj.damage * EMITTER_DAMAGE_POWER_TRANSFER
|
||||
|
||||
@@ -19,11 +19,10 @@
|
||||
var/list/obj/structure/particle_accelerator/connected_parts
|
||||
var/assembled = 0
|
||||
var/parts = null
|
||||
var/datum/wires/particle_acc/control_box/wires = null
|
||||
|
||||
/obj/machinery/particle_accelerator/control_box/Initialize(mapload)
|
||||
. = ..()
|
||||
wires = new(src)
|
||||
set_wires(new /datum/wires/particle_acc/control_box(src))
|
||||
connected_parts = list()
|
||||
update_active_power_usage(initial(active_power_usage) * (strength + 1))
|
||||
|
||||
|
||||
@@ -542,6 +542,9 @@ GLOBAL_LIST_EMPTY(smeses)
|
||||
qdel(src) // Either way we want to ensure the SMES is deleted.
|
||||
|
||||
/obj/machinery/power/smes/emp_act(severity, recursive)
|
||||
. = ..()
|
||||
if (. & EMP_PROTECT_SELF)
|
||||
return
|
||||
inputting(rand(0,1))
|
||||
outputting(rand(0,1))
|
||||
output_level = rand(0, output_level_max)
|
||||
@@ -550,7 +553,6 @@ GLOBAL_LIST_EMPTY(smeses)
|
||||
if (charge < 0)
|
||||
charge = 0
|
||||
update_icon()
|
||||
..()
|
||||
|
||||
/obj/machinery/power/smes/bullet_act(var/obj/item/projectile/Proj)
|
||||
take_damage(Proj.get_structure_damage())
|
||||
|
||||
@@ -104,7 +104,6 @@
|
||||
var/cur_coils = 1 // Current amount of installed coils
|
||||
var/safeties_enabled = 1 // If 0 modifications can be done without discharging the SMES, at risk of critical failure.
|
||||
var/failing = 0 // If 1 critical failure has occured and SMES explosion is imminent.
|
||||
var/datum/wires/smes/wires
|
||||
var/grounding = 1 // Cut to quickly discharge, at cost of "minor" electrical issues in output powernet.
|
||||
var/RCon = 1 // Cut to disable AI and remote control.
|
||||
var/RCon_tag = "NO_TAG" // RCON tag, change to show it on SMES Remote control console.
|
||||
@@ -153,7 +152,7 @@
|
||||
. = ..()
|
||||
component_parts = list()
|
||||
component_parts += new /obj/item/stack/cable_coil(src,30)
|
||||
wires = new /datum/wires/smes(src)
|
||||
set_wires(new /datum/wires/smes(src))
|
||||
|
||||
// Allows for mapped-in SMESs with larger capacity/IO
|
||||
if(mapload)
|
||||
|
||||
@@ -19,7 +19,6 @@
|
||||
var/input_power_multiplier = 1
|
||||
var/zap_cooldown = 10
|
||||
var/last_zap = 0
|
||||
var/datum/wires/tesla_coil/wires = null
|
||||
var/zap_range = 5
|
||||
var/lossy_transfer = TRUE //If true, we lose power upon shooting the next beam by our power_loss var. Only comes to play if power_loss is > 1
|
||||
|
||||
@@ -50,7 +49,7 @@
|
||||
|
||||
/obj/machinery/power/tesla_coil/Initialize(mapload)
|
||||
. = ..()
|
||||
wires = new(src)
|
||||
set_wires(new /datum/wires/tesla_coil(src))
|
||||
|
||||
/obj/machinery/power/tesla_coil/Initialize(mapload)
|
||||
. = ..()
|
||||
|
||||
@@ -295,7 +295,7 @@
|
||||
if(issilicon(closest_mob))
|
||||
var/mob/living/silicon/S = closest_mob
|
||||
if(stun_mobs)
|
||||
S.emp_act(3 /*EMP_LIGHT*/)
|
||||
S.emp_act(EMP_LIGHT)
|
||||
tesla_zap(closest_mob, 7, power / 1.5, explosive, stun_mobs, current_jumps = current_jumps) // metallic folks bounce it further
|
||||
else
|
||||
tesla_zap(closest_mob, 5, power / 1.5, explosive, stun_mobs, current_jumps = current_jumps)
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
if(prob(85) && explosive)
|
||||
explosion(loc, 0, 2, 4, /*flame_range = 2,*/ adminlog = FALSE/*, smoke = FALSE*/) // VOREStation Edit - No devastation range
|
||||
else if(prob(50))
|
||||
emp_act(2)
|
||||
emp_act(EMP_MEDIUM)
|
||||
else
|
||||
ex_act(2)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user