EMP resistance items (#4995)

Adds cyborg heavy surge prevention module as an upgrade by robotics. It is expensive to make, requires a bit high tech, and can protect cyborg for 1-3 EMP pulses which is purely random when module is installed.

Adds IPC surge prevention module via antag uplink. The module comes in the form of modified red nanopaste that only interacts with IPCs. Like cyborg module it gives EMP protection for 1-3 pulses which is purely random by nanopaste. Can be used only once per paste. Cost for it is 14 telecrystals(idk if need to bump it higher, idea is that you can't buy two of them as traitor).

adds sprite for new nanopaste with surge module.

Cleans up some code in files I worked on.

Fixes bug where destroyed cyborg components would vanish. Fixes #5000
This commit is contained in:
Mykhailo Bykhovtsev
2018-08-04 21:14:32 +03:00
committed by Erki
parent 4065e29e86
commit dd4efb5a27
13 changed files with 178 additions and 13 deletions
@@ -12,7 +12,7 @@
/obj/item/borg/upgrade/proc/action(var/mob/living/silicon/robot/R)
if(R.stat == DEAD)
usr << "<span class='warning'>The [src] will not function on a deceased robot.</span>"
to_chat(usr, "<span class='warning'>The [src] will not function on a deceased robot.</span>")
return 1
return 0
@@ -65,7 +65,7 @@
if(..()) return 0
if(R.intenselight)
usr << "This cyborg's light was already upgraded"
to_chat(usr, "<span class='notice'>This cyborg's light was already upgraded </span>")
return 0
else
R.intenselight = 1
@@ -81,7 +81,7 @@
/obj/item/borg/upgrade/restart/action(var/mob/living/silicon/robot/R)
if(R.health < 0)
usr << "You have to repair the robot before using this module!"
to_chat(usr, "<span class='warning'>You have to repair the robot before using this module!</span>")
return 0
if(!R.key)
@@ -123,8 +123,8 @@
if(..()) return 0
if(!R.module || !(src.type in R.module.supported_upgrades))
R << "Upgrade mounting error! No suitable hardpoint detected!"
usr << "There's no mounting point for the module!"
to_chat(R, "<span class='notice'>Upgrade mounting error! No suitable hardpoint detected!</span>")
to_chat(usr, "<span class='warning'> There's no mounting point for the module!</span>")
return 0
var/obj/item/weapon/gun/energy/taser/mounted/cyborg/T = locate() in R.module
@@ -133,12 +133,12 @@
if(!T)
T = locate() in R.module.modules
if(!T)
usr << "This robot has had its taser removed!"
to_chat(usr, "This robot has had its taser removed!")
return 0
if(T.recharge_time <= 2)
R << "Maximum cooling achieved for this hardpoint!"
usr << "There's no room for another cooling unit!"
to_chat(R, "<span class='notice'>Maximum cooling achieved for this hardpoint!</span>")
to_chat(usr, "<span class='warning'>There's no room for another cooling unit!</span>")
return 0
else
@@ -58,3 +58,74 @@
return
else
user << "<span class='notice'>Nothing to fix in here.</span>"
/obj/item/stack/nanopaste/surge
name = "modified nanopaste"
singular_name = "nanite swarm"
desc = "A tube of paste containing swarms of repair nanites. This one appears to contain different nanites."
icon = 'icons/obj/nanopaste.dmi'
icon_state = "tube-surge"
origin_tech = list(TECH_MATERIAL = 4, TECH_ENGINEERING = 4, TECH_MAGNET = 5, TECH_POWER = 5, TECH_COMBAT = 3, TECH_ILLEGAL = 4)
amount = 20
var/used = FALSE
construction_cost = null
/obj/item/stack/nanopaste/surge/attack(mob/living/carbon/human/M as mob, mob/user as mob, var/target_zone)
if (!istype(M) || !istype(user))
return 0
if(used)
to_chat(user, "<span class='warning'>[src] has depleted it's nanites.</span>")
return 0
if (isipc(M))
var/obj/item/organ/surge/s = M.internal_organs_by_name["surge"]
if(isnull(s))
user.visible_message(
"<span class='notice'>[user] is trying to apply [src] to [(M == user) ? ("itself") : (M)]!</span>",
"<span class='notice'>You start applying [src] to [(M == user) ? ("yourself") : (M)]!</span>"
)
if (!do_mob(user, M, 2))
return 0
s = new /obj/item/organ/surge()
M.internal_organs += s
M.internal_organs_by_name["surge"] = s
user.visible_message(
"<span class='notice'>[user] applies some nanite paste to [(M == user) ? ("itself") : (M)]!</span>",
"<span class='notice'>You apply [src] to [(M == user) ? ("youself") : (M)].</span>"
)
to_chat(M, "<span class='notice'>You can feel nanites inside you creating something new. An internal OS voice states \"Warning: surge prevention module has been installed, it has [s.surge_left] preventions left!\"</span>")
amount = 0
used = TRUE
return 1
else
if(!s.surge_left)
user.visible_message(
"<span class='notice'>[user] is trying to apply [src] to [(M == user) ? ("itself") : (M)]!</span>",
"<span class='notice'>You start applying [src] to [(M == user) ? ("yourself") : (M)]!</span>"
)
if (!do_mob(user, M, 2))
return 0
s.surge_left = rand(1, 3)
s.broken = 0
s.icon_state = "surge_ipc"
user.visible_message(
"<span class='notice'>[user] applies some nanite paste to [(M == user) ? ("itself") : (M)]!</span>",
"<span class='notice'>You apply [src] to [(M == user) ? ("yourself") : (M)].</span>"
)
to_chat(M, "<span class='notice'>You can feel nanites inside you regenerating your surge prevention module. An internal OS voice states \"Warning: surge prevention module repaired, it has [s.surge_left] preventions left!\"</span>")
amount = 0
used = TRUE
return 1
to_chat(user, "<span class='warning'>[(M == user) ? ("You already have") : ("[M] already has")] fully functional surge prevention module installed.</span>")
return 0
else
to_chat(user, "<span class='warning'>[src]'s nanites refuse to work on [(M == user) ? ("you") : (M)].</span>")
return 0