diff --git a/code/modules/mob/living/carbon/human/species/station.dm b/code/modules/mob/living/carbon/human/species/station.dm
index fcdd8ac40ea..34a9a3e0b4c 100644
--- a/code/modules/mob/living/carbon/human/species/station.dm
+++ b/code/modules/mob/living/carbon/human/species/station.dm
@@ -899,7 +899,8 @@
has_organ = list(
"brain" = /obj/item/organ/internal/brain/mmi_holder/posibrain,
"cell" = /obj/item/organ/internal/cell,
- "optics" = /obj/item/organ/internal/eyes/optical_sensor //Default darksight of 2.
+ "optics" = /obj/item/organ/internal/eyes/optical_sensor, //Default darksight of 2.
+ "charger" = /obj/item/organ/internal/cyberimp/chest/arm_mod/power_cord
)
vision_organ = /obj/item/organ/internal/eyes/optical_sensor
diff --git a/code/modules/power/apc.dm b/code/modules/power/apc.dm
index 56da9cf9b07..0c6965c0e06 100644
--- a/code/modules/power/apc.dm
+++ b/code/modules/power/apc.dm
@@ -640,6 +640,9 @@
(istype(W, /obj/item/device/multitool) || \
istype(W, /obj/item/weapon/wirecutters) || istype(W, /obj/item/device/assembly/signaler)))
return src.attack_hand(user)
+ if(W.flags & NOBLUDGEON)
+ return
+ user.changeNext_move(CLICK_CD_MELEE)
user.do_attack_animation(src)
user.visible_message("The [src.name] has been hit with the [W.name] by [user.name]!", \
"You hit the [src.name] with your [W.name]!", \
@@ -667,36 +670,6 @@
if(!user)
return
src.add_fingerprint(user)
- //Synthetic human mob goes here.
- if(istype(user,/mob/living/carbon/human))
- var/mob/living/carbon/human/H = user
- if(H.get_int_organ(/obj/item/organ/internal/cell) && H.a_intent == I_GRAB)
- if(emagged || stat & BROKEN)
- var/datum/effect/system/spark_spread/s = new /datum/effect/system/spark_spread
- s.set_up(3, 1, src)
- s.start()
- to_chat(H, "The APC power currents surge erratically, damaging your chassis!")
- H.adjustFireLoss(10,0)
- else if(src.cell && src.cell.charge > 0)
- if(H.nutrition < NUTRITION_LEVEL_WELL_FED)
- if(src.cell.charge >= 500)
- H.nutrition += 50
- src.cell.charge -= 500
- else
- H.nutrition += src.cell.charge/10
- src.cell.charge = 0
-
- to_chat(user, "You slot your fingers into the APC interface and siphon off some of the stored charge for your own use.")
- if(src.cell.charge < 0)
- src.cell.charge = 0
- if(H.nutrition > NUTRITION_LEVEL_WELL_FED + 50)
- H.nutrition = NUTRITION_LEVEL_WELL_FED + 50
- src.charging = 1
- else
- to_chat(user, "You are already fully charged.")
- else
- to_chat(user, "There is no charge to draw from that APC.")
- return
if(usr == user && opened && (!issilicon(user)))
if(cell)
diff --git a/code/modules/surgery/organs/augments_internal.dm b/code/modules/surgery/organs/augments_internal.dm
index 153f169efca..ffd0b4f0b1e 100644
--- a/code/modules/surgery/organs/augments_internal.dm
+++ b/code/modules/surgery/organs/augments_internal.dm
@@ -8,17 +8,17 @@
var/implant_overlay
tough = 1 //not easyly broken by combat damage
sterile = 1 //not very germy
+ robotic = 2 // these are cybernetic after all
/obj/item/organ/internal/cyberimp/New(var/mob/M = null)
- if(iscarbon(M))
- src.insert(M)
+ . = ..()
if(implant_overlay)
var/image/overlay = new /image(icon, implant_overlay)
overlay.color = implant_color
overlays |= overlay
- return ..()
-
+/obj/item/organ/internal/cyberimp/emp_act()
+ return // These shouldn't be hurt by EMPs in the standard way
//[[[[BRAIN]]]]
@@ -270,9 +270,15 @@
var/lasthand = null
/obj/item/organ/internal/cyberimp/chest/arm_mod/ui_action_click()
+ toggle_item()
+
+/obj/item/organ/internal/cyberimp/chest/arm_mod/proc/toggle_item()
if(overloaded)//ensure the implant isn't broken
to_chat(owner, "The implant doesn't respond. It seems to be broken...")
return
+ owner.changeNext_move(CLICK_CD_MELEE)
+ if(owner.next_move < world.time)
+ return // No spam
if(out)//check if the owner has the item out already
owner.unEquip(holder, 1)//if he does, take it away. then,
holder.loc = null//stash it in nullspace
@@ -297,6 +303,9 @@
holder.loc = null
out = 0
owner.visible_message("[holder] forcibly retracts into [owner]'s arm.")
+ overload() // Make sure this doesn't happen again
+
+/obj/item/organ/internal/cyberimp/chest/arm_mod/proc/overload()
owner.visible_message("A loud bang comes from [owner]...")
playsound(get_turf(owner), 'sound/effects/bang.ogg', 100, 1)
to_chat(owner, "You feel an explosion erupt inside you as your chest implant breaks. Is it hot in here?")
@@ -312,7 +321,7 @@
limb.droplimb(0, DROPLIMB_EDGE)
owner.say("I HAVE BEEN DISARMED!!!")
owner.adjustFireLoss(25)//severely injure him!
- overloaded = 1//then make sure this can't happen again by breaking the implant.
+ overloaded = TRUE
/obj/item/organ/internal/cyberimp/chest/arm_mod/tase//mounted, self-charging taser!
name = "Arm-cannon taser implant"
@@ -322,6 +331,7 @@
actions_types = list(/datum/action/item_action/organ_action/toggle)
/obj/item/organ/internal/cyberimp/chest/arm_mod/tase/New()//when the implant is created...
+ ..()
holder = new /obj/item/weapon/gun/energy/gun/advtaser/mounted(src)//assign a brand new item to it. (in this case, a gun)
/obj/item/organ/internal/cyberimp/chest/arm_mod/lase//mounted, self-charging laser!
@@ -332,8 +342,88 @@
actions_types = list(/datum/action/item_action/organ_action/toggle)
/obj/item/organ/internal/cyberimp/chest/arm_mod/lase/New()
+ ..()
holder = new /obj/item/weapon/gun/energy/laser/mounted(src)
+// lets make IPCs even *more* vulnerable to EMPs!
+/obj/item/organ/internal/cyberimp/chest/arm_mod/power_cord
+ name = "APC-compatible power adapter implant"
+ desc = "An implant commonly installed inside IPCs in order to allow them to easily collect energy from their environment"
+ origin_tech = "materials=3;biotech=2;powerstorage=3"
+ slot = "shoulders2"
+ actions_types = list(/datum/action/item_action/organ_action/toggle)
+
+
+/obj/item/organ/internal/cyberimp/chest/arm_mod/power_cord/New()
+ ..()
+ holder = new /obj/item/apc_powercord(src)
+
+/obj/item/organ/internal/cyberimp/chest/arm_mod/power_cord/overload()
+ // To allow repair via nanopaste/screwdriver
+ // also so IPCs don't also catch on fire and fall even more apart upon EMP
+ damage = 1
+ overloaded = TRUE
+
+/obj/item/organ/internal/cyberimp/chest/arm_mod/power_cord/surgeryize()
+ if(overloaded && owner)
+ to_chat(owner, "Your [src] feels functional again.")
+ overloaded = FALSE
+
+
+/obj/item/apc_powercord
+ name = "power cable"
+ desc = "Insert into a nearby APC to draw power from it."
+ icon = 'icons/obj/power.dmi'
+ icon_state = "wire1"
+ flags = NODROP | NOBLUDGEON
+
+/obj/item/apc_powercord/afterattack(atom/target, mob/user, proximity_flag, click_parameters)
+ if(!istype(target, /obj/machinery/power/apc) || !ishuman(user) || !proximity_flag)
+ return ..()
+ user.changeNext_move(CLICK_CD_MELEE)
+ var/obj/machinery/power/apc/A = target
+ var/mob/living/carbon/human/H = user
+ if(H.get_int_organ(/obj/item/organ/internal/cell))
+ if(A.emagged || A.stat & BROKEN)
+ var/datum/effect/system/spark_spread/s = new /datum/effect/system/spark_spread
+ s.set_up(3, 1, A)
+ s.start()
+ to_chat(H, "The APC power currents surge erratically, damaging your chassis!")
+ H.adjustFireLoss(10,0)
+ else if(A.cell && A.cell.charge > 0)
+ if(H.nutrition >= NUTRITION_LEVEL_WELL_FED)
+ to_chat(user, "You are already fully charged!")
+ else
+ addtimer(src, "powerdraw_loop", 0, TRUE, A, H)
+ else
+ to_chat(user, "There is no charge to draw from that APC.")
+ else
+ to_chat(user, "You lack a cell in which to store charge!")
+
+/obj/item/apc_powercord/proc/powerdraw_loop(obj/machinery/power/apc/A, mob/living/carbon/human/H)
+ H.visible_message("[H] inserts a power connector into \the [A].", "You begin to draw power from \the [A].")
+ while(do_after(H, 10, target = A))
+ if(loc != H)
+ to_chat(H, "You must keep your connector out while charging!")
+ break
+ if(A.cell.charge == 0)
+ to_chat(H, "\The [A] has no more charge.")
+ break
+ A.charging = 1
+ if(A.cell.charge >= 500)
+ H.nutrition += 50
+ A.cell.charge -= 500
+ to_chat(H, "You siphon off some of the stored charge for your own use.")
+ else
+ H.nutrition += A.cell.charge/10
+ A.cell.charge = 0
+ to_chat(H, "You siphon off the last of \the [A]'s charge.")
+ break
+ if(H.nutrition > NUTRITION_LEVEL_WELL_FED)
+ to_chat(H, "You are now fully charged.")
+ break
+ H.visible_message("[H] unplugs from \the [A].", "You unplug from \the [A].")
+
//BOX O' IMPLANTS
/obj/item/weapon/storage/box/cyber_implants
diff --git a/code/modules/surgery/organs/organ_internal.dm b/code/modules/surgery/organs/organ_internal.dm
index 8de7cccd2d6..0906b3c63c5 100644
--- a/code/modules/surgery/organs/organ_internal.dm
+++ b/code/modules/surgery/organs/organ_internal.dm
@@ -11,9 +11,9 @@
var/non_primary = 0
/obj/item/organ/internal/New(var/mob/living/carbon/holder)
+ ..()
if(istype(holder))
insert(holder)
- ..()
/obj/item/organ/internal/Destroy()
if(owner)
@@ -412,7 +412,8 @@
colourmatrix = null
dark_view = 2
..() //Make sure the organ's got the robotic status indicators before updating the client colour.
- owner.update_client_colour(0) //Since both mechassisted and mechanical eyes give dark_view of 2 and full colour vision atm, just having this here is fine as mechassist() will call it anyway.
+ if(owner)
+ owner.update_client_colour(0) //Since both mechassisted and mechanical eyes give dark_view of 2 and full colour vision atm, just having this here is fine as mechassist() will call it anyway.
/obj/item/organ/internal/mechassist()
..() //Go back, call robotize(), adjust the robotic status indicators and the organ damage parameters.
diff --git a/code/modules/surgery/robotics.dm b/code/modules/surgery/robotics.dm
index d3d5345cb0b..e1dc252412d 100644
--- a/code/modules/surgery/robotics.dm
+++ b/code/modules/surgery/robotics.dm
@@ -398,11 +398,16 @@
return
var/obj/item/organ/external/affected = target.get_organ(target_zone)
+ var/found_damaged_organ = FALSE
for(var/obj/item/organ/internal/I in affected.internal_organs)
- if(I && I.damage > 0)
- if(I.robotic >= 2)
- user.visible_message("[user] starts mending the damage to [target]'s [I.name]'s mechanisms.", \
- "You start mending the damage to [target]'s [I.name]'s mechanisms." )
+ if(I && I.damage > 0 && I.robotic >= 2)
+ user.visible_message("[user] starts mending the damage to [target]'s [I.name]'s mechanisms.", \
+ "You start mending the damage to [target]'s [I.name]'s mechanisms.")
+ found_damaged_organ = TRUE
+
+ if(!found_damaged_organ)
+ to_chat(user, "There are no damaged components in [affected].")
+ return -1
target.custom_pain("The pain in your [affected.name] is living hell!",1)
@@ -425,6 +430,7 @@
user.visible_message(" [user] repairs [target]'s [I.name] with [tool].", \
" You repair [target]'s [I.name] with [tool]." )
I.damage = 0
+ I.surgeryize()
else if(current_type == "insert")
var/obj/item/organ/internal/I = tool