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
32 lines
990 B
Plaintext
32 lines
990 B
Plaintext
// If a mob has this component, every life tick it will gain nutrition if it's standing in light up to nutrition_max.
|
|
// Extremely good tutorial component if you need an example with no special bells and whistles, and no "gotcha" behaviors.
|
|
/datum/component/photosynth
|
|
var/nutrition_max = 1000
|
|
|
|
/datum/component/photosynth/Initialize()
|
|
if(!isliving(parent))
|
|
return COMPONENT_INCOMPATIBLE
|
|
|
|
/datum/component/photosynth/RegisterWithParent()
|
|
RegisterSignal(parent, COMSIG_LIVING_LIFE, PROC_REF(process_component))
|
|
|
|
/datum/component/photosynth/UnregisterFromParent()
|
|
UnregisterSignal(parent, list(COMSIG_LIVING_LIFE))
|
|
|
|
/datum/component/photosynth/proc/process_component()
|
|
var/mob/living/owner = parent
|
|
if(QDELETED(parent))
|
|
return
|
|
if(owner.stat == DEAD)
|
|
return
|
|
if(owner.is_incorporeal())
|
|
return
|
|
if(owner.inStasisNow())
|
|
return
|
|
if(!isturf(owner.loc))
|
|
return
|
|
if(owner.nutrition >= nutrition_max)
|
|
return
|
|
var/turf/T = owner.loc
|
|
owner.adjust_nutrition(T.get_lumcount() / 10)
|