Updates rig emp_act

EMPing hardsuits drains a bit of charge. Module damage is dealt to
damaged modules first. Various other adjustments.
This commit is contained in:
mwerezak
2015-02-26 00:41:46 -05:00
parent d06b2a0a12
commit a8c315ad52
5 changed files with 80 additions and 20 deletions
@@ -441,4 +441,32 @@
drain_loc = null
interfaced_with = null
total_power_drained = 0
total_power_drained = 0
/*
//Maybe make this use power when active or something
/obj/item/rig_module/emp_shielding
name = "\improper EMP dissipation module"
desc = "A bewilderingly complex bundle of fiber optics and chips."
toggleable = 1
usable = 0
activate_string = "Enable active EMP shielding"
deactivate_string = "Disable active EMP shielding"
interface_name = "active EMP shielding system"
interface_desc = "A highly experimental system that augments the hardsuit's existing EM shielding."
var/protection_amount = 20
/obj/item/rig_module/emp_shielding/activate()
if(!..())
return
holder.emp_protection += protection_amount
/obj/item/rig_module/emp_shielding/deactivate()
if(!..())
return
holder.emp_protection = max(0,(holder.emp_protection - protection_amount))
*/
+45 -15
View File
@@ -72,6 +72,8 @@
var/vision_restriction
var/offline_vision_restriction = 1 // 0 - none, 1 - welder vision, 2 - blind. Maybe move this to helmets.
var/emp_protection = 0
// Wiring! How exciting.
var/datum/wires/rig/wires
var/datum/effect/effect/system/spark_spread/spark_system
@@ -336,6 +338,7 @@
for(var/obj/item/rig_module/module in installed_modules)
module.deactivate()
offline = 2
malfunction_delay = 0 //ensures that people aren't stuck in their suit if the cell runs out while malfunctioning.
chest.slowdown = offline_slowdown
return
@@ -416,7 +419,7 @@
data["aicontrol"] = control_overridden
data["aioverride"] = ai_override_enabled
data["securitycheck"] = security_check_enabled
data["malf"] = malfunctioning
data["malf"] = malfunction_delay
var/list/module_list = list()
@@ -686,13 +689,20 @@
//Todo
/obj/item/weapon/rig/proc/malfunction()
return 0
/obj/item/weapon/rig/emp_act(severity)
malfunctioning += severity*10
if(malfunction_delay <= 0)
malfunction_delay = 20
take_hit(severity*10,"electrical pulse")
return 0
/obj/item/weapon/rig/emp_act(severity_class)
//set malfunctioning
if(emp_protection < 40)
malfunctioning += 10
if(malfunction_delay <= 0)
malfunction_delay = max(malfunction_delay, round(30/severity_class))
//drain some charge
if(cell) cell.emp_act(severity_class + 15)
//possibly damage some modules
take_hit((100/severity_class), "electrical pulse", 1)
/obj/item/weapon/rig/proc/shock(mob/user)
if (electrocute_mob(user, cell, src))
@@ -705,29 +715,49 @@
if(!installed_modules.len)
return
if(!prob(max(0,(damage-(chest ? chest.breach_threshold : 0)))))
var/chance
if(!is_emp)
chance = 2*max(0, damage - (chest? chest.breach_threshold : 0))
else
//Want this to be roughly independant of the number of modules, that way people designing hardsuits
//don't have to worry (as much) about how adding that extra module will affect emp resiliance.
chance = max(0, damage - emp_protection)*min(installed_modules.len/15, 1)
if(!prob(chance))
return
//deal addition damage to already damaged module first.
//This way the chances of a module being disabled aren't so remote.
var/list/valid_modules = list()
var/list/damaged_modules = list()
for(var/obj/item/rig_module/module in installed_modules)
if(module.damage < 2)
valid_modules |= module
if(module.damage > 0)
damaged_modules |= module
if(!valid_modules.len)
return
var/obj/item/rig_module/dam_module = null
if(damaged_modules.len)
dam_module = pick(damaged_modules)
else if(valid_modules.len)
dam_module = pick(valid_modules)
if(!dam_module) return
var/obj/item/rig_module/dam_module = pick(valid_modules)
dam_module.damage++
if(!source)
source = "hit"
if(wearer)
wearer << "<span class='danger'>The [source] has [dam_module.damage >= 2 ? "destroyed" : "damaged"] your [dam_module.interface_name]!"
if(wearer)
if(dam_module.damage >= 2)
wearer << "<span class='danger'>The [source] has disabled your [dam_module.interface_name]!"
else
wearer << "<span class='warning'>The [source] has damaged your [dam_module.interface_name]!"
dam_module.deactivate()
/obj/item/weapon/rig/proc/malfunction_check(var/mob/living/carbon/human/user)
if(malfunctioning)
if(malfunction_delay)
user << "<span class='danger'>ERROR: Hardware fault. Rebooting interface...</span>"
return 1
return 0
@@ -39,7 +39,9 @@
flags_inv = HIDEJUMPSUIT|HIDETAIL
flags = STOPPRESSUREDAMAGE | THICKMATERIAL | AIRTIGHT
slowdown = 0
breach_threshold = 35
//With 0.05 resiliance, will reach 10 breach damage after 18 laser carbine blasts. Completely immune to smg hits.
breach_threshold = 28
resilience = 0.05
can_breach = 1
sprite_sheets = list("Tajara" = 'icons/mob/species/tajaran/suit.dmi',"Unathi" = 'icons/mob/species/unathi/suit.dmi')
supporting_limbs = list()
@@ -6,6 +6,7 @@
suit_type = "light suit"
allowed = list(/obj/item/weapon/gun,/obj/item/ammo_magazine,/obj/item/ammo_casing,/obj/item/weapon/melee/baton,/obj/item/weapon/handcuffs,/obj/item/weapon/tank,/obj/item/device/suit_cooling_unit,/obj/item/weapon/cell)
armor = list(melee = 50, bullet = 15, laser = 50, energy = 10, bomb = 25, bio = 0, rad = 0)
emp_protection = 10
slowdown = 0
flags = STOPPRESSUREDAMAGE | THICKMATERIAL
offline_slowdown = 0
@@ -54,6 +55,7 @@
desc = "A unique, vaccum-proof suit of nano-enhanced armor designed specifically for Spider Clan assassins."
icon_state = "ninja_rig"
armor = list(melee = 60, bullet = 50, laser = 30,energy = 15, bomb = 30, bio = 30, rad = 30)
emp_protection = 40
slowdown = 0
req_access = list(access_syndicate)
@@ -75,9 +77,6 @@
..()
/obj/item/weapon/rig/light/ninja/malfunction_check()
return 0 //even as strong as ninjas are, they may not be able to afford being blocked from switching modules for 20 seconds
/obj/item/weapon/rig/light/stealth
name = "stealth suit control module"
suit_type = "stealth"
@@ -7,6 +7,7 @@
slowdown = 3
offline_slowdown = 10
offline_vision_restriction = 2
emp_protection = -20
allowed = list(/obj/item/device/flashlight,/obj/item/weapon/tank,/obj/item/device/suit_cooling_unit,/obj/item/weapon/storage/bag/ore,/obj/item/device/t_scanner,/obj/item/weapon/pickaxe, /obj/item/weapon/rcd)