From 155a4ed177f983024bda4abf4581a97ff2c45752 Mon Sep 17 00:00:00 2001 From: s Date: Thu, 2 Jan 2020 21:47:36 -0500 Subject: [PATCH 1/3] apc --- code/modules/power/apc.dm | 43 ++++++++++++++++++++++++++++++++++ code/modules/power/lighting.dm | 4 ++-- 2 files changed, 45 insertions(+), 2 deletions(-) diff --git a/code/modules/power/apc.dm b/code/modules/power/apc.dm index 9f31743e15c..85cf05f3d24 100644 --- a/code/modules/power/apc.dm +++ b/code/modules/power/apc.dm @@ -787,6 +787,49 @@ . = ..() if(.) return + + var/mob/living/carbon/human/H = user + if(istype(H)) + var/datum/species/ethereal/eth_species = H.dna?.species + if(istype(eth_species) && H.a_intent == INTENT_HARM) + if(cell.charge <= (cell.maxcharge / 2)) // if charge is under 50% you shouldnt drain it + to_chat(H, "The APC doesn't have much power, you probably shouldn't drain any.") + return + var/obj/item/organ/stomach/ethereal/stomach = H.getorganslot(ORGAN_SLOT_STOMACH) + if(stomach.crystal_charge > 95) + to_chat(H, "Your charge is full!") + return + to_chat(H, "You start channeling some power through the APC into your body.") + if(do_after(user, 75, target = src)) + if(cell.charge <= (cell.maxcharge / 2) || (stomach.crystal_charge > 95)) + return + if(istype(stomach)) + to_chat(H, "You receive some charge from the APC.") + stomach.adjust_charge(10) + cell.charge -= 10 + else + to_chat(H, "You can't receive charge from the APC!") + return + if(istype(eth_species) && H.a_intent == INTENT_GRAB) + if(cell.charge == cell.maxcharge) + to_chat(H, "The APC is full!") + return + var/obj/item/organ/stomach/ethereal/stomach = H.getorganslot(ORGAN_SLOT_STOMACH) + if(stomach.crystal_charge < 10) + to_chat(H, "Your charge is too low!") + return + to_chat(H, "You start channeling power through your body into the APC.") + if(do_after(user, 75, target = src)) + if(cell.charge == cell.maxcharge || (stomach.crystal_charge < 10)) + return + if(istype(stomach)) + to_chat(H, "You transfer some power to the APC.") + stomach.adjust_charge(-10) + cell.charge += 10 + else + to_chat(H, "You can't transfer power to the APC!") + return + if(opened && (!issilicon(user))) if(cell) user.visible_message("[user] removes \the [cell] from [src]!", "You remove \the [cell].") diff --git a/code/modules/power/lighting.dm b/code/modules/power/lighting.dm index 2d587533fd6..f71cd4a935b 100644 --- a/code/modules/power/lighting.dm +++ b/code/modules/power/lighting.dm @@ -293,7 +293,7 @@ if(start_with_cell && !no_emergency) cell = new/obj/item/stock_parts/cell/emergency_light(src) - + return INITIALIZE_HINT_LATELOAD /obj/machinery/light/LateInitialize() @@ -643,7 +643,7 @@ var/obj/item/organ/stomach/ethereal/stomach = H.getorganslot(ORGAN_SLOT_STOMACH) if(istype(stomach)) to_chat(H, "You receive some charge from the [fitting].") - stomach.adjust_charge(5) + stomach.adjust_charge(2) else to_chat(H, "You can't receive charge from the [fitting]!") return From 3fd5c6dbbc3e9293144f34d22b7fa97241a4ff9d Mon Sep 17 00:00:00 2001 From: s Date: Thu, 2 Jan 2020 22:16:20 -0500 Subject: [PATCH 2/3] cell --- code/modules/power/cell.dm | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/code/modules/power/cell.dm b/code/modules/power/cell.dm index 0d5c9c291f0..d482dae7ddb 100644 --- a/code/modules/power/cell.dm +++ b/code/modules/power/cell.dm @@ -148,6 +148,30 @@ if(prob(25)) corrupt() +/obj/item/stock_parts/cell/attack_self(mob/user) + var/mob/living/carbon/human/H = user + if(istype(H)) + var/datum/species/ethereal/eth_species = H.dna?.species + if(istype(eth_species)) + if(charge < 25) + to_chat(H, "The [src] doesn't have enough power!") + return + var/obj/item/organ/stomach/ethereal/stomach = H.getorganslot(ORGAN_SLOT_STOMACH) + if(stomach.crystal_charge > 96) + to_chat(H, "Your charge is full!") + return + to_chat(H, "You clumsily channel power through the [src] and into your body, wasting some in the process.") + if(do_after(user, 5, target = src)) + if((charge < 25) || (stomach.crystal_charge > 96)) + return + if(istype(stomach)) + to_chat(H, "You receive some charge from the [src].") + stomach.adjust_charge(3) + charge -= 100 //you waste way more than you receive, so that ethereals cant just steal one cell and forget about hunger + else + to_chat(H, "You can't receive charge from the [src]!") + return + /obj/item/stock_parts/cell/blob_act(obj/structure/blob/B) ex_act(EXPLODE_DEVASTATE) From 296608f2cc930eb46619b0994e4f6cdf51bf85ed Mon Sep 17 00:00:00 2001 From: s Date: Mon, 13 Jan 2020 17:27:47 -0500 Subject: [PATCH 3/3] better --- code/modules/power/apc.dm | 13 ++++++------- code/modules/power/cell.dm | 40 ++++++++++++++++++-------------------- 2 files changed, 25 insertions(+), 28 deletions(-) diff --git a/code/modules/power/apc.dm b/code/modules/power/apc.dm index 85cf05f3d24..bc0709549e6 100644 --- a/code/modules/power/apc.dm +++ b/code/modules/power/apc.dm @@ -788,20 +788,19 @@ if(.) return - var/mob/living/carbon/human/H = user - if(istype(H)) - var/datum/species/ethereal/eth_species = H.dna?.species - if(istype(eth_species) && H.a_intent == INTENT_HARM) + if(isethereal(user)) + var/mob/living/carbon/human/H = user + if(H.a_intent == INTENT_HARM) if(cell.charge <= (cell.maxcharge / 2)) // if charge is under 50% you shouldnt drain it to_chat(H, "The APC doesn't have much power, you probably shouldn't drain any.") return var/obj/item/organ/stomach/ethereal/stomach = H.getorganslot(ORGAN_SLOT_STOMACH) - if(stomach.crystal_charge > 95) + if(stomach.crystal_charge > 145) to_chat(H, "Your charge is full!") return to_chat(H, "You start channeling some power through the APC into your body.") if(do_after(user, 75, target = src)) - if(cell.charge <= (cell.maxcharge / 2) || (stomach.crystal_charge > 95)) + if(cell.charge <= (cell.maxcharge / 2) || (stomach.crystal_charge > 145)) return if(istype(stomach)) to_chat(H, "You receive some charge from the APC.") @@ -810,7 +809,7 @@ else to_chat(H, "You can't receive charge from the APC!") return - if(istype(eth_species) && H.a_intent == INTENT_GRAB) + if(H.a_intent == INTENT_GRAB) if(cell.charge == cell.maxcharge) to_chat(H, "The APC is full!") return diff --git a/code/modules/power/cell.dm b/code/modules/power/cell.dm index d482dae7ddb..56eaa20d65b 100644 --- a/code/modules/power/cell.dm +++ b/code/modules/power/cell.dm @@ -149,28 +149,26 @@ corrupt() /obj/item/stock_parts/cell/attack_self(mob/user) - var/mob/living/carbon/human/H = user - if(istype(H)) - var/datum/species/ethereal/eth_species = H.dna?.species - if(istype(eth_species)) - if(charge < 25) - to_chat(H, "The [src] doesn't have enough power!") - return - var/obj/item/organ/stomach/ethereal/stomach = H.getorganslot(ORGAN_SLOT_STOMACH) - if(stomach.crystal_charge > 96) - to_chat(H, "Your charge is full!") - return - to_chat(H, "You clumsily channel power through the [src] and into your body, wasting some in the process.") - if(do_after(user, 5, target = src)) - if((charge < 25) || (stomach.crystal_charge > 96)) - return - if(istype(stomach)) - to_chat(H, "You receive some charge from the [src].") - stomach.adjust_charge(3) - charge -= 100 //you waste way more than you receive, so that ethereals cant just steal one cell and forget about hunger - else - to_chat(H, "You can't receive charge from the [src]!") + if(isethereal(user)) + var/mob/living/carbon/human/H = user + if(charge < 100) + to_chat(H, "The [src] doesn't have enough power!") return + var/obj/item/organ/stomach/ethereal/stomach = H.getorganslot(ORGAN_SLOT_STOMACH) + if(stomach.crystal_charge > 146) + to_chat(H, "Your charge is full!") + return + to_chat(H, "You clumsily channel power through the [src] and into your body, wasting some in the process.") + if(do_after(user, 5, target = src)) + if((charge < 100) || (stomach.crystal_charge > 146)) + return + if(istype(stomach)) + to_chat(H, "You receive some charge from the [src].") + stomach.adjust_charge(3) + charge -= 100 //you waste way more than you receive, so that ethereals cant just steal one cell and forget about hunger + else + to_chat(H, "You can't receive charge from the [src]!") + return /obj/item/stock_parts/cell/blob_act(obj/structure/blob/B)