mirror of
https://github.com/CHOMPStation2/CHOMPStation2.git
synced 2025-12-10 10:12:45 +00:00
Co-authored-by: Heroman3003 <31296024+Heroman3003@users.noreply.github.com> Co-authored-by: Kashargul <144968721+Kashargul@users.noreply.github.com>
234 lines
7.9 KiB
Plaintext
234 lines
7.9 KiB
Plaintext
/datum/nifsoft/medichines_org
|
|
name = "Medichines"
|
|
desc = "An internal swarm of nanites to make sure you stay in good shape and to promote healing, or to preserve you if you are critically injured."
|
|
list_pos = NIF_ORGANIC_HEAL
|
|
cost = 1250
|
|
p_drain = 0.05
|
|
a_drain = 0.1 //This is messed with manually below.
|
|
wear = 2
|
|
activates = FALSE //It is automatic in emergencies, not manually controllable.
|
|
tick_flags = NIF_ALWAYSTICK
|
|
applies_to = NIF_ORGANIC
|
|
var/mode = 0
|
|
health_flags = (NIF_H_ORGREPAIR)
|
|
|
|
//These self-activate on their own, these aren't user-settable to on/off.
|
|
/datum/nifsoft/medichines_org/activate()
|
|
if((. = ..()))
|
|
mode = 1
|
|
|
|
/datum/nifsoft/medichines_org/deactivate(var/force = FALSE)
|
|
if((. = ..()))
|
|
a_drain = initial(a_drain)
|
|
mode = initial(mode)
|
|
if(nif.human) // What if we deactivate because human is gone?
|
|
nif.human.Stasis(0)
|
|
|
|
/datum/nifsoft/medichines_org/life()
|
|
if((. = ..()))
|
|
var/mob/living/carbon/human/H = nif.human
|
|
var/HP_percent = H.health/H.getMaxHealth()
|
|
|
|
//Mode changing state machine
|
|
if(HP_percent >= 0.9)
|
|
if(mode)
|
|
nif.notify("User Status: NORMAL. Medichines deactivating.")
|
|
H << 'sound/voice/nifmed_normal.ogg' //CHOMP Add
|
|
deactivate()
|
|
return TRUE
|
|
else if(!mode && HP_percent < 0.8)
|
|
nif.notify("User Status: INJURED. Commencing medichine routines.",TRUE)
|
|
H << 'sound/voice/nifmed_injured.ogg' //CHOMP Add
|
|
activate()
|
|
else if(mode == 1 && HP_percent < 0.2)
|
|
nif.notify("User Status: DANGER. Seek medical attention!",TRUE)
|
|
H << 'sound/voice/nifmed_danger.ogg' //CHOMP Add
|
|
mode = 2
|
|
else if(mode == 2 && HP_percent < -0.4)
|
|
nif.notify("User Status: CRITICAL. Notifying medical, and starting emergency stasis!",TRUE)
|
|
H << 'sound/voice/nifmed_critical.ogg' //CHOMP Add
|
|
mode = 3
|
|
if(!isbelly(H.loc)) //Not notified in case of vore, for gameplay purposes.
|
|
var/turf/T = get_turf(H)
|
|
var/obj/item/radio/headset/a = new /obj/item/radio/headset/heads/captain(null)
|
|
a.autosay("[H.real_name] has been put in emergency stasis, located at ([T.x],[T.y],[T.z])!", "[H.real_name]'s NIF", "Medical")
|
|
qdel(a)
|
|
|
|
//Handle the actions in each mode
|
|
|
|
//Injured but not critical
|
|
if(mode)
|
|
H.adjustToxLoss(-0.1 * mode)
|
|
H.adjustBruteLoss(-0.1 * mode)
|
|
H.adjustFireLoss(-0.1 * mode)
|
|
|
|
if(mode >= 2)
|
|
nif.use_charge(a_drain) //A second drain if we're in level 2+
|
|
|
|
//Patient critical - emergency stasis
|
|
if(mode >= 3)
|
|
if(HP_percent <= 0)
|
|
H.Stasis(3)
|
|
if(HP_percent > 0.2)
|
|
H.Stasis(0)
|
|
nif.notify("Ending emergency stasis.",TRUE)
|
|
mode = 2
|
|
|
|
return TRUE
|
|
|
|
/datum/nifsoft/medichines_syn
|
|
name = "Medichines"
|
|
desc = "A swarm of mechanical repair nanites, able to repair relatively minor damage to synthetic bodies. Large repairs must still be performed manually."
|
|
list_pos = NIF_SYNTH_HEAL
|
|
cost = 1250
|
|
p_drain = 0.05
|
|
a_drain = 0.00 //This is manually drained below.
|
|
wear = 2
|
|
activates = FALSE //It is automatic in emergencies, not manually controllable.
|
|
tick_flags = NIF_ALWAYSTICK
|
|
applies_to = NIF_SYNTHETIC
|
|
var/mode = 0
|
|
health_flags = (NIF_H_SYNTHREPAIR)
|
|
|
|
|
|
//These self-activate on their own, these aren't user-settable to on/off.
|
|
/datum/nifsoft/medichines_syn/activate()
|
|
if((. = ..()))
|
|
mode = 1
|
|
|
|
/datum/nifsoft/medichines_syn/deactivate(var/force = FALSE)
|
|
if((. = ..()))
|
|
mode = 0
|
|
|
|
/datum/nifsoft/medichines_syn/life()
|
|
if((. = ..()))
|
|
//We're good!
|
|
var/mob/living/carbon/human/S = nif.human
|
|
var/HP_percent = S.health/S.getMaxHealth()
|
|
if(!nif.human.bad_external_organs.len)
|
|
if(mode || active)
|
|
nif.notify("User Status: NORMAL. Medichines deactivating.")
|
|
//Needs fixing W << 'sound/voice/nifmedsynth_normal.ogg' //CHOMP Add
|
|
deactivate()
|
|
return TRUE
|
|
|
|
if(!mode && !active)
|
|
nif.notify("User Status: DAMAGED. Medichines performing minor repairs.",TRUE)
|
|
//Needs fixing W << 'sound/voice/nifmedsynth_injured.ogg' //CHOMP Add
|
|
activate()
|
|
|
|
for(var/obj/item/organ/external/EO as anything in nif.human.bad_external_organs)
|
|
for(var/datum/wound/W as anything in EO.wounds)
|
|
if(W.damage <= 30) // Chomp Edit // The current limb break threshold.
|
|
W.heal_damage(0.1)
|
|
EO.update_damages()
|
|
if(EO.update_icon())
|
|
nif.human.UpdateDamageIcon(1)
|
|
nif.use_charge(0.1)
|
|
return TRUE //Return entirely, we only heal one at a time.
|
|
else if(mode == 1)
|
|
mode = 2
|
|
nif.notify("Medichines unable to repair all damage. Perform manual repairs.",TRUE)
|
|
// Chomp Edit Start //
|
|
else if(mode == 2 && HP_percent < -0.4)
|
|
nif.notify("User Status: CRITICAL. Notifying medical!",TRUE)
|
|
S << 'sound/voice/nifmed_critical.ogg' //CHOMP Add
|
|
mode = 0
|
|
if(!isbelly(S.loc)) //Not notified in case of vore, for gameplay purposes.
|
|
var/turf/T = get_turf(S)
|
|
var/obj/item/radio/headset/a = new /obj/item/radio/headset/heads/captain(null)
|
|
a.autosay("[S.real_name] is in critical condition, located at ([T.x],[T.y],[T.z])!", "[S.real_name]'s NIF", "Medical")
|
|
qdel(a)
|
|
// Chomp Edit End //
|
|
|
|
/* //Chomp Comment out, using our solution instead of their backport and edit of our solution.
|
|
if(mode == 2 && HP_percent < -0.4) //lets inform someone who might be able to help us that we got toasted and roasted
|
|
nif.notify("User Status: CRITICAL. Notifying medical!",TRUE)
|
|
mode = 3 //this does nothing except stop it from repeating over and over and over and over and over and over and over
|
|
if(!isbelly(S.loc)) //Not notified in case of vore, for gameplay purposes.
|
|
var/turf/T = get_turf(S)
|
|
var/obj/item/radio/headset/a = new /obj/item/radio/headset/heads/captain(null)
|
|
a.autosay("[S.real_name] is in a critical condition, located at ([T.x],[T.y],[T.z])!", "[S.real_name]'s NIF", "Medical")
|
|
qdel(a)
|
|
*/ //Chomp comment out END
|
|
|
|
return TRUE
|
|
|
|
/datum/nifsoft/spare_breath
|
|
name = "Respirocytes"
|
|
desc = "Nanites simulating red blood cells will filter and recycle oxygen for a short time, preventing suffocation in hostile environments. NOTE: Only capable of supplying OXYGEN."
|
|
list_pos = NIF_SPAREBREATH
|
|
cost = 325
|
|
p_drain = 0.05
|
|
a_drain = 0.1
|
|
wear = 2
|
|
tick_flags = NIF_ALWAYSTICK
|
|
applies_to = NIF_ORGANIC
|
|
var/filled = 100 //Tracks the internal tank 'refilling', which still uses power
|
|
health_flags = (NIF_H_SPAREBREATH)
|
|
|
|
/datum/nifsoft/spare_breath/activate()
|
|
if(!(filled > 50))
|
|
nif.notify("Respirocytes not saturated!",TRUE)
|
|
return FALSE
|
|
if((. = ..()))
|
|
nif.notify("Now taking air from reserves.")
|
|
|
|
/datum/nifsoft/spare_breath/deactivate(var/force = FALSE)
|
|
if((. = ..()))
|
|
nif.notify("Now taking air from environment and refilling reserves.")
|
|
|
|
/datum/nifsoft/spare_breath/life()
|
|
if((. = ..()))
|
|
if(active) //Supplying air, not recharging it
|
|
switch(filled) //Text warnings
|
|
if(75)
|
|
nif.notify("Respirocytes at 75% saturation.",TRUE)
|
|
if(50)
|
|
nif.notify("Respirocytes at 50% saturation!",TRUE)
|
|
if(25)
|
|
nif.notify("Respirocytes at 25% saturation, seek a habitable environment!",TRUE)
|
|
if(5)
|
|
nif.notify("Respirocytes at 5% saturation! Failure imminent!",TRUE)
|
|
|
|
if(filled == 0) //Ran out
|
|
deactivate()
|
|
else //Drain a little
|
|
filled--
|
|
|
|
else //Recharging air, not supplying it
|
|
if(filled == 100)
|
|
return TRUE
|
|
else if(nif.use_charge(0.1) && ++filled == 100)
|
|
nif.notify("Respirocytes now fully saturated.")
|
|
|
|
/datum/nifsoft/spare_breath/proc/resp_breath()
|
|
if(!active) return null
|
|
var/datum/gas_mixture/breath = new(BREATH_VOLUME)
|
|
breath.adjust_gas(GAS_O2, BREATH_MOLES)
|
|
breath.temperature = T20C
|
|
return breath
|
|
|
|
/datum/nifsoft/mindbackup
|
|
name = "Mind Backup"
|
|
desc = "Backup your mind on the go. Stores a one-time sync of your current mindstate upon activation."
|
|
list_pos = NIF_BACKUP
|
|
cost = 125
|
|
|
|
/datum/nifsoft/mindbackup/activate()
|
|
if((. = ..()))
|
|
var/mob/living/carbon/human/H = nif.human
|
|
SStranscore.m_backup(H.mind,H.nif,one_time = TRUE)
|
|
persist_nif_data(H)
|
|
nif.notify("Mind backed up!")
|
|
nif.use_charge(0.1)
|
|
deactivate()
|
|
return TRUE
|
|
|
|
/datum/nifsoft/mindbackup/deactivate(var/force = FALSE)
|
|
if((. = ..()))
|
|
return TRUE
|
|
|
|
/datum/nifsoft/mindbackup/stat_text()
|
|
return "Store Backup"
|