replacing IPC eating with APC siphoning

oracle port
This commit is contained in:
sarcoph
2022-05-14 02:06:56 -08:00
parent f45e803bd0
commit b4163be383
14 changed files with 128 additions and 6 deletions
@@ -13,6 +13,11 @@
/mob/living/carbon/handle_status_effects()
..()
handle_pain()
/mob/living/carbon/has_mouth()
var/obj/item/bodypart/head/head = get_bodypart(BODY_ZONE_HEAD)
if(head && head.mouth)
return TRUE
/mob/living/carbon/proc/handle_pain()
var/pain_amount = 0
@@ -0,0 +1,58 @@
// APC powercord: oracle port
/obj/item/apc_powercord
name = "power cord"
desc = "An internal power cord hooked up to a battery. Useful if you run on electricity. Not so much otherwise."
icon = 'icons/obj/power.dmi'
icon_state = "wire1"
/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/mob/living/carbon/human/H = user
var/obj/item/organ/stomach/cell/battery = H.getorganslot(ORGAN_SLOT_STOMACH)
if(!battery)
to_chat(H, "<span class='warning'>You try to siphon energy from \the [target], but your power cell is gone!</span>")
return
if(istype(H) && H.nutrition >= NUTRITION_LEVEL_ALMOST_FULL)
to_chat(user, "<span class='warning'>You are already fully charged!</span>")
return
if(istype(target, /obj/machinery/power/apc))
var/obj/machinery/power/apc/A = target
if(A.cell && A.cell.charge > A.cell.maxcharge*0.25)
powerdraw_loop(A, H)
return
else
to_chat(user, "<span class='warning'>There is not enough charge to draw from that APC.</span>")
return
/obj/item/apc_powercord/proc/powerdraw_loop(obj/machinery/power/apc/A, mob/living/carbon/human/H)
H.visible_message("<span class='notice'>[H] inserts a power connector into the [A].</span>", "<span class='notice'>You begin to draw power from the [A].</span>")
while(do_after(H, 10, target = A))
if(!istype(A))
return
if(loc != H)
to_chat(H, "<span class='warning'>You must keep your connector out while charging!</span>")
break
if(A.cell.charge == 0)
to_chat(H, "<span class='warning'>The [A] doesn't have enough charge to spare.</span>")
break
A.charging = 1
if(A.cell.charge >= 500)
H.nutrition += 50
A.cell.charge -= 250
to_chat(H, "<span class='notice'>You siphon off some of the stored charge for your own use.</span>")
else
H.nutrition += A.cell.charge/10
A.cell.charge = 0
to_chat(H, "<span class='notice'>You siphon off as much as the [A] can spare.</span>")
break
if(H.nutrition > NUTRITION_LEVEL_WELL_FED)
to_chat(H, "<span class='notice'>You are now fully charged.</span>")
break
H.visible_message("<span class='notice'>[H] unplugs from the [A].</span>", "<span class='notice'>You unplug from the [A].</span>")
@@ -27,3 +27,7 @@ mob/proc/checkloadappearance()
else
to_chat(H, "<span class='boldannounce'>You either took too long or chose not to change. Alrighty. Remember, you have 90 seconds from spawn to get to a mirror and still do it if you wish.</span>")
return
// oracle port
/mob/proc/has_mouth()
return FALSE