[MIRROR] Fixes ethereals being unable to channel power into APCs, readds some defines (#4034)

* Fixes ethereals being unable to channel power into APCs, readds some defines (#57417)

* Fixes ethereals being unable to channel power into APCs, readds some defines

Co-authored-by: wesoda25 <37246588+wesoda25@users.noreply.github.com>
This commit is contained in:
SkyratBot
2021-03-10 02:31:08 +01:00
committed by GitHub
co-authored by wesoda25
parent a01994376c
commit 29680a2f0b
4 changed files with 36 additions and 35 deletions
+2 -2
View File
@@ -565,12 +565,12 @@ Recharging stations are available in robotics, the dormitory bathrooms, and the
/atom/movable/screen/alert/etherealcharge
name = "Low Blood Charge"
desc = "Your blood's electric charge is running low, find a source of charge for your blood. Use a recharging station found in robotics or the dormitory bathrooms, or eat some Ethereal-friendly food."
desc = "Your charge is running low, find a source of energy! Use a recharging station, eat some Ethereal-friendly food, or syphon some power from lights, a power cell, or an APC (done by right clicking on combat mode)."
icon_state = "etherealcharge"
/atom/movable/screen/alert/ethereal_overcharge
name = "Blood Overcharge"
desc = "Your blood's electric charge is becoming dangerously high, find an outlet for your energy. Use Grab Intent on an APC to channel your energy into it."
desc = "Your charge is running dangerously high, find an outlet for your energy! Right click an APC while not in combat mode."
icon_state = "ethereal_overcharge"
//Need to cover all use cases - emag, illegal upgrade module, malf AI hack, traitor cyborg
+30 -29
View File
@@ -48,7 +48,7 @@
/// The APCs external powernet has enough power to charge the APC.
#define APC_HAS_POWER 2
// Etherials:
// Ethereals:
/// How long it takes an ethereal to drain or charge APCs. Also used as a spam limiter.
#define APC_DRAIN_TIME (7.5 SECONDS)
/// How much power ethereals gain/drain from APCs.
@@ -840,46 +840,47 @@
var/mob/living/carbon/human/H = user
var/datum/species/ethereal/E = H.dna.species
var/charge_limit = ETHEREAL_CHARGE_DANGEROUS - APC_POWER_GAIN
if(H.combat_mode && E.drain_time < world.time)
if(LAZYACCESS(modifiers, RIGHT_CLICK)) //Disarm
if(cell.charge == cell.maxcharge)
to_chat(H, "<span class='warning'>The APC is full!</span>")
var/obj/item/organ/stomach/ethereal/stomach = H.getorganslot(ORGAN_SLOT_STOMACH)
if((E.drain_time < world.time) && LAZYACCESS(modifiers, RIGHT_CLICK) && stomach)
if(H.combat_mode)
if(cell.charge <= (cell.maxcharge / 2)) // ethereals can't drain APCs under half charge, this is so that they are forced to look to alternative power sources if the station is running low
to_chat(H, "<span class='warning'>The APC's syphon safeties prevent you from draining power!</span>")
return
var/obj/item/organ/stomach/ethereal/stomach = H.getorganslot(ORGAN_SLOT_STOMACH)
if(stomach.crystal_charge < 10)
if(stomach.crystal_charge > charge_limit)
to_chat(H, "<span class='warning'>Your charge is full!</span>")
return
E.drain_time = world.time + APC_DRAIN_TIME
to_chat(H, "<span class='notice'>You start channeling some power through the APC into your body.</span>")
if(do_after(user, APC_DRAIN_TIME, target = src))
if(cell.charge <= (cell.maxcharge / 2) || (stomach.crystal_charge > charge_limit))
return
if(istype(stomach))
to_chat(H, "<span class='notice'>You receive some charge from the APC.</span>")
stomach.adjust_charge(APC_POWER_GAIN)
cell.charge -= APC_POWER_GAIN
else
to_chat(H, "<span class='warning'>You can't receive charge from the APC!</span>")
return
else
if(cell.charge >= cell.maxcharge - APC_POWER_GAIN)
to_chat(H, "<span class='warning'>The APC can't receive anymore power!</span>")
return
if(stomach.crystal_charge < APC_POWER_GAIN)
to_chat(H, "<span class='warning'>Your charge is too low!</span>")
return
E.drain_time = world.time + APC_DRAIN_TIME
to_chat(H, "<span class='notice'>You start channeling power through your body into the APC.</span>")
if(do_after(user, APC_DRAIN_TIME, target = src))
if(cell.charge == cell.maxcharge || (stomach.crystal_charge < 10))
if((cell.charge >= (cell.maxcharge - APC_POWER_GAIN)) || (stomach.crystal_charge < APC_POWER_GAIN))
to_chat(H, "<span class='warning'>You can't transfer power to the APC!</span>")
return
if(istype(stomach))
to_chat(H, "<span class='notice'>You transfer some power to the APC.</span>")
stomach.adjust_charge(-10)
cell.charge += 10
stomach.adjust_charge(-APC_POWER_GAIN)
cell.charge += APC_POWER_GAIN
else
to_chat(H, "<span class='warning'>You can't transfer power to the APC!</span>")
return
if(cell.charge <= (cell.maxcharge / 2)) // ethereals can't drain APCs under half charge, this is so that they are forced to look to alternative power sources if the station is running low
to_chat(H, "<span class='warning'>The APC's syphon safeties prevent you from draining power!</span>")
return
var/obj/item/organ/stomach/ethereal/stomach = H.getorganslot(ORGAN_SLOT_STOMACH)
if(stomach.crystal_charge > charge_limit)
to_chat(H, "<span class='warning'>Your charge is full!</span>")
return
E.drain_time = world.time + APC_DRAIN_TIME
to_chat(H, "<span class='notice'>You start channeling some power through the APC into your body.</span>")
if(do_after(user, APC_DRAIN_TIME, target = src))
if(cell.charge <= (cell.maxcharge / 2) || (stomach.crystal_charge > charge_limit))
return
if(istype(stomach))
to_chat(H, "<span class='notice'>You receive some charge from the APC.</span>")
stomach.adjust_charge(APC_POWER_GAIN)
cell.charge -= APC_POWER_GAIN
else
to_chat(H, "<span class='warning'>You can't receive charge from the APC!</span>")
return
if(opened && (!issilicon(user)))
if(cell)
+2 -2
View File
@@ -151,12 +151,12 @@
var/mob/living/carbon/human/H = user
var/datum/species/ethereal/E = H.dna.species
var/charge_limit = ETHEREAL_CHARGE_DANGEROUS - CELL_POWER_GAIN
if(E.drain_time > world.time)
var/obj/item/organ/stomach/ethereal/stomach = H.getorganslot(ORGAN_SLOT_STOMACH)
if((E.drain_time > world.time) || !stomach)
return
if(charge < CELL_POWER_DRAIN)
to_chat(H, "<span class='warning'>[src] doesn't have enough power!</span>")
return
var/obj/item/organ/stomach/ethereal/stomach = H.getorganslot(ORGAN_SLOT_STOMACH)
if(stomach.crystal_charge > charge_limit)
to_chat(H, "<span class='warning'>Your charge is full!</span>")
return
+2 -2
View File
@@ -735,12 +735,12 @@
var/datum/species/ethereal/eth_species = H.dna?.species
if(istype(eth_species))
var/datum/species/ethereal/E = H.dna.species
if(E.drain_time > world.time)
var/obj/item/organ/stomach/ethereal/stomach = H.getorganslot(ORGAN_SLOT_STOMACH)
if((E.drain_time > world.time) || !stomach)
return
to_chat(H, "<span class='notice'>You start channeling some power through the [fitting] into your body.</span>")
E.drain_time = world.time + LIGHT_DRAIN_TIME
if(do_after(user, LIGHT_DRAIN_TIME, target = src))
var/obj/item/organ/stomach/ethereal/stomach = H.getorganslot(ORGAN_SLOT_STOMACH)
if(istype(stomach))
to_chat(H, "<span class='notice'>You receive some charge from the [fitting].</span>")
stomach.adjust_charge(LIGHT_POWER_GAIN)