mirror of
https://github.com/CHOMPStation2/CHOMPStation2.git
synced 2025-12-13 19:52:40 +00:00
[MIRROR] Light-Based Damage Component For Zaddat and Shadows (#10908)
Co-authored-by: Will <7099514+Willburd@users.noreply.github.com> Co-authored-by: Cameron Lennox <killer65311@gmail.com> Co-authored-by: Kashargul <144968721+Kashargul@users.noreply.github.com>
This commit is contained in:
committed by
GitHub
parent
0eb688c308
commit
c0112761bd
56
code/datums/components/traits/burninlight.dm
Normal file
56
code/datums/components/traits/burninlight.dm
Normal file
@@ -0,0 +1,56 @@
|
|||||||
|
/datum/component/burninlight
|
||||||
|
var/mob/living/owner
|
||||||
|
// 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
|
||||||
|
owner = parent
|
||||||
|
RegisterSignal(owner, COMSIG_LIVING_LIFE, PROC_REF(process_component))
|
||||||
|
|
||||||
|
/datum/component/burninlight/proc/process_component()
|
||||||
|
if(QDELETED(parent))
|
||||||
|
return
|
||||||
|
if(owner.stat == DEAD)
|
||||||
|
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, 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)
|
||||||
|
|
||||||
|
/datum/component/burninlight/Destroy(force = FALSE)
|
||||||
|
UnregisterSignal(owner, COMSIG_LIVING_LIFE)
|
||||||
|
owner = null
|
||||||
|
. = ..()
|
||||||
@@ -24,6 +24,8 @@
|
|||||||
return
|
return
|
||||||
if(owner.stat == DEAD)
|
if(owner.stat == DEAD)
|
||||||
return
|
return
|
||||||
|
if(owner.inStasisNow())
|
||||||
|
return
|
||||||
var/turf/T = get_turf(owner.loc)
|
var/turf/T = get_turf(owner.loc)
|
||||||
if(!isturf(T))
|
if(!isturf(T))
|
||||||
return
|
return
|
||||||
|
|||||||
@@ -22,6 +22,8 @@
|
|||||||
return
|
return
|
||||||
if(owner.stat == DEAD)
|
if(owner.stat == DEAD)
|
||||||
return
|
return
|
||||||
|
if(owner.inStasisNow())
|
||||||
|
return
|
||||||
if(owner.nutrition <= 0 && grow_mode == GROWMODE_SHRINK && owner.size_multiplier > RESIZE_TINY)
|
if(owner.nutrition <= 0 && grow_mode == GROWMODE_SHRINK && owner.size_multiplier > RESIZE_TINY)
|
||||||
owner.nutrition = 0.1
|
owner.nutrition = 0.1
|
||||||
if(owner.nutrition <= 0)
|
if(owner.nutrition <= 0)
|
||||||
|
|||||||
@@ -15,6 +15,8 @@
|
|||||||
return
|
return
|
||||||
if(owner.stat == DEAD)
|
if(owner.stat == DEAD)
|
||||||
return
|
return
|
||||||
|
if(owner.inStasisNow())
|
||||||
|
return
|
||||||
if(!isturf(owner.loc))
|
if(!isturf(owner.loc))
|
||||||
return
|
return
|
||||||
if(owner.nutrition >= nutrition_max)
|
if(owner.nutrition >= nutrition_max)
|
||||||
|
|||||||
@@ -257,8 +257,11 @@
|
|||||||
|
|
||||||
return in_stasis
|
return in_stasis
|
||||||
|
|
||||||
//This determines if, RIGHT NOW, the life() tick is being skipped due to stasis
|
/// This determines if, RIGHT NOW, the life() tick is being skipped due to stasis
|
||||||
/mob/living/carbon/human/proc/inStasisNow()
|
/mob/proc/inStasisNow() // For components to be more easily compatible with both simple and human mobs, only humans can stasis.
|
||||||
|
return FALSE
|
||||||
|
|
||||||
|
/mob/living/carbon/human/inStasisNow()
|
||||||
var/stasisValue = getStasis()
|
var/stasisValue = getStasis()
|
||||||
if(stasisValue && (life_tick % stasisValue))
|
if(stasisValue && (life_tick % stasisValue))
|
||||||
return 1
|
return 1
|
||||||
|
|||||||
@@ -1168,15 +1168,6 @@
|
|||||||
if(status_flags & GODMODE)
|
if(status_flags & GODMODE)
|
||||||
return 0 //godmode
|
return 0 //godmode
|
||||||
|
|
||||||
if(species.light_dam)
|
|
||||||
var/light_amount = 0
|
|
||||||
if(isturf(loc))
|
|
||||||
var/turf/T = loc
|
|
||||||
light_amount = T.get_lumcount() * 10
|
|
||||||
if(light_amount > species.light_dam) //if there's enough light, start dying
|
|
||||||
take_overall_damage(1,1)
|
|
||||||
else //heal in the dark
|
|
||||||
heal_overall_damage(1,1)
|
|
||||||
// nutrition decrease
|
// nutrition decrease
|
||||||
if(noisy == TRUE && nutrition < 250 && prob(10))
|
if(noisy == TRUE && nutrition < 250 && prob(10))
|
||||||
var/sound/growlsound = sound(get_sfx("hunger_sounds"))
|
var/sound/growlsound = sound(get_sfx("hunger_sounds"))
|
||||||
|
|||||||
@@ -7,7 +7,6 @@
|
|||||||
|
|
||||||
language = "Sol Common" //todo?
|
language = "Sol Common" //todo?
|
||||||
unarmed_types = list(/datum/unarmed_attack/claws/strong, /datum/unarmed_attack/bite/sharp)
|
unarmed_types = list(/datum/unarmed_attack/claws/strong, /datum/unarmed_attack/bite/sharp)
|
||||||
light_dam = 2
|
|
||||||
darksight = 8
|
darksight = 8
|
||||||
has_organ = list()
|
has_organ = list()
|
||||||
siemens_coefficient = 0
|
siemens_coefficient = 0
|
||||||
@@ -31,6 +30,8 @@
|
|||||||
|
|
||||||
assisted_langs = list()
|
assisted_langs = list()
|
||||||
|
|
||||||
|
species_component = /datum/component/burninlight/shadow // Until a parent component like xenochimera have is needed, only handles burning in light.
|
||||||
|
|
||||||
/datum/species/shadow/handle_death(var/mob/living/carbon/human/H)
|
/datum/species/shadow/handle_death(var/mob/living/carbon/human/H)
|
||||||
spawn(1)
|
spawn(1)
|
||||||
new /obj/effect/decal/cleanable/ash(H.loc)
|
new /obj/effect/decal/cleanable/ash(H.loc)
|
||||||
|
|||||||
@@ -201,7 +201,6 @@
|
|||||||
var/warning_low_pressure = WARNING_LOW_PRESSURE // Low pressure warning.
|
var/warning_low_pressure = WARNING_LOW_PRESSURE // Low pressure warning.
|
||||||
var/hazard_low_pressure = HAZARD_LOW_PRESSURE // Dangerously low pressure.
|
var/hazard_low_pressure = HAZARD_LOW_PRESSURE // Dangerously low pressure.
|
||||||
var/safe_pressure = ONE_ATMOSPHERE
|
var/safe_pressure = ONE_ATMOSPHERE
|
||||||
var/light_dam // If set, mob will be damaged in light over this value and heal in light below its negative.
|
|
||||||
var/minimum_breath_pressure = 16 // Minimum required pressure for breath, in kPa
|
var/minimum_breath_pressure = 16 // Minimum required pressure for breath, in kPa
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -490,6 +490,8 @@
|
|||||||
|
|
||||||
reagent_tag = IS_ZADDAT
|
reagent_tag = IS_ZADDAT
|
||||||
|
|
||||||
|
species_component = /datum/component/burninlight // Until a parent component like xenochimera have is needed, only handles burning in light.
|
||||||
|
|
||||||
heat_discomfort_strings = list(
|
heat_discomfort_strings = list(
|
||||||
"Your joints itch.",
|
"Your joints itch.",
|
||||||
"You feel uncomfortably warm.",
|
"You feel uncomfortably warm.",
|
||||||
@@ -532,24 +534,6 @@
|
|||||||
H.equip_to_slot_or_del(new /obj/item/clothing/mask/gas/zaddat/(H), slot_wear_mask) // mask has to come first or Shroud helmet will get in the way
|
H.equip_to_slot_or_del(new /obj/item/clothing/mask/gas/zaddat/(H), slot_wear_mask) // mask has to come first or Shroud helmet will get in the way
|
||||||
H.equip_to_slot_or_del(new /obj/item/clothing/suit/space/void/zaddat/(H), slot_wear_suit)
|
H.equip_to_slot_or_del(new /obj/item/clothing/suit/space/void/zaddat/(H), slot_wear_suit)
|
||||||
|
|
||||||
/datum/species/zaddat/handle_environment_special(var/mob/living/carbon/human/H)
|
|
||||||
|
|
||||||
if(H.inStasisNow())
|
|
||||||
return
|
|
||||||
|
|
||||||
var/damageable = H.get_damageable_organs()
|
|
||||||
var/covered = H.get_coverage()
|
|
||||||
|
|
||||||
var/light_amount = 0 //how much light there is in the place, affects damage
|
|
||||||
if(isturf(H.loc)) //else, there's considered to be no light
|
|
||||||
var/turf/T = H.loc
|
|
||||||
light_amount = T.get_lumcount() * 5
|
|
||||||
|
|
||||||
|
|
||||||
for(var/K in damageable)
|
|
||||||
if(!(K in covered))
|
|
||||||
H.apply_damage(light_amount/4, BURN, K, 0, 0)
|
|
||||||
|
|
||||||
/datum/species/diona
|
/datum/species/diona
|
||||||
|
|
||||||
name = SPECIES_DIONA
|
name = SPECIES_DIONA
|
||||||
|
|||||||
@@ -762,6 +762,14 @@
|
|||||||
category = 0
|
category = 0
|
||||||
custom_only = FALSE
|
custom_only = FALSE
|
||||||
|
|
||||||
|
/datum/trait/negative/photodegeneration
|
||||||
|
name = "Photodegeneration"
|
||||||
|
desc = "Without the protection of darkness or a suit your body quickly begins to break down when exposed to light."
|
||||||
|
cost = -4
|
||||||
|
is_genetrait = TRUE // There is no upside, a neat landmine for genetics
|
||||||
|
hidden = TRUE //Disabled on Virgo
|
||||||
|
can_take = ORGANICS
|
||||||
|
added_component_path = /datum/component/burninlight // Literally just Zaddat, but you don't start with any suit. Good luck.
|
||||||
|
|
||||||
// Addictions
|
// Addictions
|
||||||
/datum/trait/neutral/addiction_alcohol
|
/datum/trait/neutral/addiction_alcohol
|
||||||
|
|||||||
@@ -548,6 +548,7 @@
|
|||||||
#include "code\datums\components\disabilities\nervousness.dm"
|
#include "code\datums\components\disabilities\nervousness.dm"
|
||||||
#include "code\datums\components\disabilities\rotting.dm"
|
#include "code\datums\components\disabilities\rotting.dm"
|
||||||
#include "code\datums\components\disabilities\tourettes.dm"
|
#include "code\datums\components\disabilities\tourettes.dm"
|
||||||
|
#include "code\datums\components\traits\burninlight.dm"
|
||||||
#include "code\datums\components\species\shadekin.dm"
|
#include "code\datums\components\species\shadekin.dm"
|
||||||
#include "code\datums\components\species\xenochimera.dm"
|
#include "code\datums\components\species\xenochimera.dm"
|
||||||
#include "code\datums\components\traits\drippy.dm"
|
#include "code\datums\components\traits\drippy.dm"
|
||||||
|
|||||||
Reference in New Issue
Block a user