mirror of
https://github.com/VOREStation/VOREStation.git
synced 2026-05-19 05:09:49 +01:00
c07054d463
* Upport these * wtf * Update negative.dm * Hard feet into a neutral * revert * type-o * Makes toxin_gut a trait. Better as a trait than a var. * Fix these Was free trait otherwise * Update negative.dm * Fixes these as well * Update low_sugar.dm * Update vorestation.dme * Converts these to components Still needs optimization. * Makes absorbent a component * Implements deep sleeper * Update living_movement.dm * Update living_movement.dm * Update negative.dm * why not * Adjust these * Update positive.dm * Update positive.dm * Eh, let's lower this some. * Add singulo mtabolism * these too * Make this use bloodloss_rate * Update negative.dm * grapples you * Update mob_grab.dm * my brain hurts reading this please leave more comments * Slippery * enable * Remove waterbreather from breathless Unneeded * Update negative.dm * Update low_sugar.dm * Update snacks.dm
58 lines
2.0 KiB
Plaintext
58 lines
2.0 KiB
Plaintext
/datum/component/burninlight
|
|
// This is a merge of the old shadow species light burning life code, and Zaddat's handle_environment_special() proc.
|
|
// It handles both cases, but shadows behave more like Zaddat do now. By default this code follows Zaddat damage with no healing.
|
|
var/threshold = 0.2 // percent from 0 to 1
|
|
// Damage or healing per life tick
|
|
var/damage_rate = 1.25
|
|
var/heal_rate = 0
|
|
|
|
/datum/component/burninlight/shadow
|
|
threshold = 0.15
|
|
damage_rate = 1
|
|
heal_rate = 1
|
|
|
|
/datum/component/burninlight/Initialize()
|
|
if(!isliving(parent))
|
|
return COMPONENT_INCOMPATIBLE
|
|
|
|
/datum/component/burninlight/RegisterWithParent()
|
|
RegisterSignal(parent, COMSIG_LIVING_LIFE, PROC_REF(process_component))
|
|
|
|
/datum/component/burninlight/UnregisterFromParent()
|
|
UnregisterSignal(parent, list(COMSIG_LIVING_LIFE))
|
|
|
|
/datum/component/burninlight/proc/process_component()
|
|
if(QDELETED(parent))
|
|
return
|
|
var/mob/living/owner = parent
|
|
if(owner.stat == DEAD)
|
|
return
|
|
if(owner.is_incorporeal())
|
|
return
|
|
if(!isturf(owner.loc))
|
|
return
|
|
if(owner.inStasisNow())
|
|
return
|
|
|
|
var/light_amount = 0 //how much light there is in the place, affects damage
|
|
if(isturf(owner.loc)) //else, there's considered to be no light
|
|
var/turf/T = owner.loc
|
|
light_amount = T.get_lumcount(0,1)
|
|
|
|
// Apply damage if beyond the minimum light threshold, actually makes zaddat SLIGHTLY more forgiving!
|
|
if(light_amount > 0 && light_amount > threshold) // Checks light_amount, as threshold of 0 can pass 0s to the damage procs otherwise.
|
|
if(damage_rate > 0)
|
|
if(ishuman(owner))
|
|
var/mob/living/carbon/human/H = owner
|
|
var/damageable = H.get_damageable_organs()
|
|
var/covered = H.get_coverage()
|
|
for(var/K in damageable)
|
|
if(!(K in covered))
|
|
H.apply_damage(light_amount * damage_rate, BURN, K, 0)
|
|
else
|
|
owner.take_overall_damage(light_amount * damage_rate,light_amount * damage_rate)
|
|
|
|
// heal in the dark, if possible
|
|
else if(heal_rate > 0)
|
|
owner.heal_overall_damage(heal_rate,heal_rate)
|