Datumizes microbatteries (#26900)

* Datumize microbattery

* comments + feedback when you're revivable

* More comment

* more datumization

* Explaining myself

* Being able to charge while not having a microbattery

* Better comment

Co-authored-by: 1080pCat <96908085+1080pCat@users.noreply.github.com>
Signed-off-by: BiancaWilkson <42818125+BiancaWilkson@users.noreply.github.com>

* Changes proc name to be more accurate

---------

Signed-off-by: BiancaWilkson <42818125+BiancaWilkson@users.noreply.github.com>
Co-authored-by: 1080pCat <96908085+1080pCat@users.noreply.github.com>
This commit is contained in:
BiancaWilkson
2024-10-18 19:30:04 -04:00
committed by GitHub
parent 20dfb3af69
commit 074da2b796
12 changed files with 31 additions and 16 deletions
@@ -6,7 +6,7 @@
death()
create_debug_log("died of damage, trigger reason: [reason]")
return
if(HAS_TRAIT(src, TRAIT_KNOCKEDOUT) || (check_death_method() && getOxyLoss() > 50) || HAS_TRAIT(src, TRAIT_FAKEDEATH) || health < HEALTH_THRESHOLD_KNOCKOUT && check_death_method() || health <= HEALTH_THRESHOLD_DEAD)
if(HAS_TRAIT(src, TRAIT_KNOCKEDOUT) || (check_death_method() && getOxyLoss() > 50) || HAS_TRAIT(src, TRAIT_FAKEDEATH) || health < HEALTH_THRESHOLD_KNOCKOUT && check_death_method() || health <= HEALTH_THRESHOLD_DEAD) // In case anyone is wondering where oldcrit is handled, it's here.
if(stat == CONSCIOUS)
KnockOut()
create_debug_log("fell unconscious, trigger reason: [reason]")
@@ -3,10 +3,14 @@
return
..(reason)
if(stat == DEAD)
if(dna.species && dna.species.can_revive_by_healing)
if(dna.species && dna.species.can_revive_by_healing) // Here's where IPC revival is handled
var/obj/item/organ/internal/brain/B = get_int_organ(/obj/item/organ/internal/brain)
if(B)
if((health >= (HEALTH_THRESHOLD_DEAD + HEALTH_THRESHOLD_CRIT) * 0.5) && check_vital_organs() && !suiciding)
if((health >= (HEALTH_THRESHOLD_DEAD + HEALTH_THRESHOLD_CRIT) * 0.5) && ipc_vital_organ_check() && !suiciding)
var/mob/dead/observer/ghost = get_ghost()
if(ghost)
to_chat(ghost, "<span class='ghostalert'>Your chassis has been repaired and repowered, re-enter if you want to continue playing!</span> (Verbs -> Ghost -> Re-enter corpse)")
SEND_SOUND(ghost, sound('sound/effects/genetics.ogg'))
update_revive()
create_debug_log("revived from healing, trigger reason: [reason]")
+3 -7
View File
@@ -425,12 +425,8 @@
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) || H.get_int_organ(/obj/item/organ/internal/heart))
var/obj/item/organ/internal/heart/robotic = H.get_int_organ(/obj/item/organ/internal/heart)
if(robotic)
if(!(robotic.status & ORGAN_ROBOT) && !H.get_int_organ(/obj/item/organ/internal/heart/demon/pulse))
to_chat(user, "<span class='warning'>You lack a cell in which to store charge!</span>")
return
var/datum/organ/battery/power_source = H.get_int_organ_datum(ORGAN_DATUM_BATTERY)
if(istype(power_source))
if(A.emagged || A.stat & BROKEN)
do_sparks(3, 1, A)
to_chat(H, "<span class='warning'>The APC power currents surge erratically, damaging your chassis!</span>")
@@ -443,7 +439,7 @@
else
to_chat(user, "<span class='warning'>There is no charge to draw from that APC.</span>")
else
to_chat(user, "<span class='warning'>You lack a cell in which to store charge!</span>")
to_chat(user, "<span class='warning'>You lack a power source in which to store charge!</span>")
/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>")
+2
View File
@@ -36,6 +36,7 @@
base_icon_state = "cursedheart"
origin_tech = "biotech=6"
actions_types = list(/datum/action/item_action/organ_action/cursed_heart)
organ_datums = list(/datum/organ/heart, /datum/organ/battery) // This doesn't actually work for IPCs but it also doesn't kill you, and it's funny
var/last_pump = 0
var/pump_delay = 30 //you can pump 1 second early, for lag, but no more (otherwise you could spam heal)
var/blood_loss = 100 //600 blood is human default, so 5 failures (below 122 blood is where humans die because reasons?)
@@ -191,6 +192,7 @@
base_icon_state = "heart-c"
dead_icon = "heart-c-off"
status = ORGAN_ROBOT
organ_datums = list(/datum/organ/heart, /datum/organ/battery)
/obj/item/organ/internal/heart/cybernetic/upgraded
name = "upgraded cybernetic heart"
@@ -0,0 +1,5 @@
/*
For any species that doesn't have a heart datum but does have heart-like organs, so just IPCs right now. Microbatteries currently have no behavior.
*/
/datum/organ/battery
organ_tag = ORGAN_DATUM_BATTERY
+7 -2
View File
@@ -85,8 +85,13 @@
.++
if(affecting.body_part == LEG_LEFT)
.++
///Returns true if all the mob's vital organs are functional, otherwise returns false
/mob/living/carbon/human/proc/check_vital_organs()
/* Returns true if all the mob's vital organs are functional, otherwise returns false.
* This proc is only used for checking if IPCs can revive from death, so calling it on a non IPC will always return false (right now)
*/
/mob/living/carbon/human/proc/ipc_vital_organ_check()
var/has_battery = get_int_organ_datum(ORGAN_DATUM_BATTERY)
if(!has_battery)
return FALSE
for(var/obj/item/organ/internal/organ in internal_organs)
if(organ.vital && (organ.damage >= organ.max_damage))
return FALSE
@@ -112,6 +112,7 @@
vital = TRUE
status = ORGAN_ROBOT
requires_robotic_bodypart = TRUE
organ_datums = list(/datum/organ/battery)
/obj/item/organ/internal/eyes/optical_sensor
name = "optical sensor"