mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2025-12-10 17:52:36 +00:00
[MIRROR] Separates COMSIG_LIVING_ADJUST_DAMAGE into 6 different signals [MDB IGNORE] (#24179)
* Separates COMSIG_LIVING_ADJUST_DAMAGE into 6 different signals (#78814) ## About The Pull Request As potato requested after the merge of #78744 these should have separate concerns even if they are very similar. In addition I improved how mob chains react to glide size changes, and swapped PAIs to using these signals instead of an override of `onBruteLoss` just because I can. I tested it but the unit tests will catch me if i did it wrong ## Changelog 🆑 fix: Flesh Worms will move smoothly more consistently. /🆑 * Separates COMSIG_LIVING_ADJUST_DAMAGE into 6 different signals --------- Co-authored-by: Jacquerel <hnevard@gmail.com>
This commit is contained in:
@@ -55,9 +55,34 @@
|
|||||||
///from base of element/bane/activate(): (item/weapon, mob/user)
|
///from base of element/bane/activate(): (item/weapon, mob/user)
|
||||||
#define COMSIG_OBJECT_ON_BANING "obj_on_baning"
|
#define COMSIG_OBJECT_ON_BANING "obj_on_baning"
|
||||||
|
|
||||||
///from base of mob/living/on_damage_adjustment
|
// adjust_x_loss messages sent from /mob/living/proc/adjust[x]Loss
|
||||||
#define COMSIG_LIVING_ADJUST_DAMAGE "living_adjust_damage"
|
/// Returned from all the following messages if you actually aren't going to apply any change
|
||||||
#define COMPONENT_IGNORE_CHANGE (1<<0)
|
#define COMPONENT_IGNORE_CHANGE (1<<0)
|
||||||
|
// Each of these messages sends the damagetype even though it is inferred by the signal so you can pass all of them to the same proc if required
|
||||||
|
/// Send when bruteloss is modified (type, amount, forced)
|
||||||
|
#define COMSIG_LIVING_ADJUST_BRUTE_DAMAGE "living_adjust_brute_damage"
|
||||||
|
/// Send when fireloss is modified (type, amount, forced)
|
||||||
|
#define COMSIG_LIVING_ADJUST_BURN_DAMAGE "living_adjust_burn_damage"
|
||||||
|
/// Send when oxyloss is modified (type, amount, forced)
|
||||||
|
#define COMSIG_LIVING_ADJUST_OXY_DAMAGE "living_adjust_oxy_damage"
|
||||||
|
/// Send when toxloss is modified (type, amount, forced)
|
||||||
|
#define COMSIG_LIVING_ADJUST_TOX_DAMAGE "living_adjust_tox_damage"
|
||||||
|
/// Send when cloneloss is modified (type, amount, forced)
|
||||||
|
#define COMSIG_LIVING_ADJUST_CLONE_DAMAGE "living_adjust_clone_damage"
|
||||||
|
/// Send when staminaloss is modified (type, amount, forced)
|
||||||
|
#define COMSIG_LIVING_ADJUST_STAMINA_DAMAGE "living_adjust_stamina_damage"
|
||||||
|
|
||||||
|
/// List of signals sent when you receive any damage except stamina
|
||||||
|
#define COMSIG_LIVING_ADJUST_STANDARD_DAMAGE_TYPES list(\
|
||||||
|
COMSIG_LIVING_ADJUST_BRUTE_DAMAGE,\
|
||||||
|
COMSIG_LIVING_ADJUST_BURN_DAMAGE,\
|
||||||
|
COMSIG_LIVING_ADJUST_CLONE_DAMAGE,\
|
||||||
|
COMSIG_LIVING_ADJUST_OXY_DAMAGE,\
|
||||||
|
COMSIG_LIVING_ADJUST_TOX_DAMAGE,\
|
||||||
|
)
|
||||||
|
/// List of signals sent when you receive any kind of damage at all
|
||||||
|
#define COMSIG_LIVING_ADJUST_ALL_DAMAGE_TYPES (COMSIG_LIVING_ADJUST_STANDARD_DAMAGE_TYPES + COMSIG_LIVING_ADJUST_STAMINA_DAMAGE)
|
||||||
|
|
||||||
|
|
||||||
/// from base of mob/living/updatehealth()
|
/// from base of mob/living/updatehealth()
|
||||||
#define COMSIG_LIVING_HEALTH_UPDATE "living_health_update"
|
#define COMSIG_LIVING_HEALTH_UPDATE "living_health_update"
|
||||||
|
|||||||
@@ -25,6 +25,8 @@
|
|||||||
if (!isnull(front))
|
if (!isnull(front))
|
||||||
SEND_SIGNAL(front, COMSIG_MOB_GAINED_CHAIN_TAIL, parent)
|
SEND_SIGNAL(front, COMSIG_MOB_GAINED_CHAIN_TAIL, parent)
|
||||||
parent.AddComponent(/datum/component/leash, owner = front, distance = 1) // Handles catching up gracefully
|
parent.AddComponent(/datum/component/leash, owner = front, distance = 1) // Handles catching up gracefully
|
||||||
|
var/mob/living/living_parent = parent
|
||||||
|
living_parent.set_glide_size(front.glide_size)
|
||||||
|
|
||||||
/datum/component/mob_chain/Destroy(force, silent)
|
/datum/component/mob_chain/Destroy(force, silent)
|
||||||
if (!isnull(front))
|
if (!isnull(front))
|
||||||
@@ -42,11 +44,13 @@
|
|||||||
RegisterSignal(parent, COMSIG_MOVABLE_MOVED, PROC_REF(on_moved))
|
RegisterSignal(parent, COMSIG_MOVABLE_MOVED, PROC_REF(on_moved))
|
||||||
RegisterSignal(parent, COMSIG_ATOM_CAN_BE_PULLED, PROC_REF(on_pulled))
|
RegisterSignal(parent, COMSIG_ATOM_CAN_BE_PULLED, PROC_REF(on_pulled))
|
||||||
RegisterSignals(parent, list(COMSIG_LIVING_UNARMED_ATTACK, COMSIG_HUMAN_EARLY_UNARMED_ATTACK, COMSIG_MOB_ATTACK_RANGED), PROC_REF(on_attack))
|
RegisterSignals(parent, list(COMSIG_LIVING_UNARMED_ATTACK, COMSIG_HUMAN_EARLY_UNARMED_ATTACK, COMSIG_MOB_ATTACK_RANGED), PROC_REF(on_attack))
|
||||||
|
RegisterSignal(parent, COMSIG_MOVABLE_UPDATE_GLIDE_SIZE, PROC_REF(on_glide_size_changed))
|
||||||
if (vary_icon_state)
|
if (vary_icon_state)
|
||||||
RegisterSignal(parent, COMSIG_ATOM_UPDATE_ICON_STATE, PROC_REF(on_update_icon_state))
|
RegisterSignal(parent, COMSIG_ATOM_UPDATE_ICON_STATE, PROC_REF(on_update_icon_state))
|
||||||
update_mob_appearance()
|
update_mob_appearance()
|
||||||
if (pass_damage_back)
|
if (pass_damage_back)
|
||||||
RegisterSignal(parent, COMSIG_LIVING_ADJUST_DAMAGE, PROC_REF(on_adjust_damage))
|
RegisterSignals(parent, COMSIG_LIVING_ADJUST_STANDARD_DAMAGE_TYPES, PROC_REF(on_adjust_damage))
|
||||||
|
RegisterSignal(parent, COMSIG_LIVING_ADJUST_STAMINA_DAMAGE, PROC_REF(on_adjust_stamina))
|
||||||
RegisterSignal(parent, COMSIG_CARBON_LIMB_DAMAGED, PROC_REF(on_limb_damage))
|
RegisterSignal(parent, COMSIG_CARBON_LIMB_DAMAGED, PROC_REF(on_limb_damage))
|
||||||
|
|
||||||
var/datum/action/cooldown/worm_contract/shrink = new(parent)
|
var/datum/action/cooldown/worm_contract/shrink = new(parent)
|
||||||
@@ -58,14 +62,20 @@
|
|||||||
COMSIG_ATOM_UPDATE_ICON_STATE,
|
COMSIG_ATOM_UPDATE_ICON_STATE,
|
||||||
COMSIG_CARBON_LIMB_DAMAGED,
|
COMSIG_CARBON_LIMB_DAMAGED,
|
||||||
COMSIG_HUMAN_EARLY_UNARMED_ATTACK,
|
COMSIG_HUMAN_EARLY_UNARMED_ATTACK,
|
||||||
COMSIG_LIVING_ADJUST_DAMAGE,
|
COMSIG_LIVING_ADJUST_BRUTE_DAMAGE,
|
||||||
|
COMSIG_LIVING_ADJUST_BURN_DAMAGE,
|
||||||
|
COMSIG_LIVING_ADJUST_CLONE_DAMAGE,
|
||||||
COMSIG_LIVING_DEATH,
|
COMSIG_LIVING_DEATH,
|
||||||
|
COMSIG_LIVING_ADJUST_OXY_DAMAGE,
|
||||||
|
COMSIG_LIVING_ADJUST_STAMINA_DAMAGE,
|
||||||
|
COMSIG_LIVING_ADJUST_TOX_DAMAGE,
|
||||||
COMSIG_LIVING_UNARMED_ATTACK,
|
COMSIG_LIVING_UNARMED_ATTACK,
|
||||||
COMSIG_MOB_ATTACK_RANGED,
|
COMSIG_MOB_ATTACK_RANGED,
|
||||||
COMSIG_MOB_CHAIN_CONTRACT,
|
COMSIG_MOB_CHAIN_CONTRACT,
|
||||||
COMSIG_MOB_GAINED_CHAIN_TAIL,
|
COMSIG_MOB_GAINED_CHAIN_TAIL,
|
||||||
COMSIG_MOB_LOST_CHAIN_TAIL,
|
COMSIG_MOB_LOST_CHAIN_TAIL,
|
||||||
COMSIG_MOVABLE_MOVED,
|
COMSIG_MOVABLE_MOVED,
|
||||||
|
COMSIG_MOVABLE_UPDATE_GLIDE_SIZE,
|
||||||
COMSIG_QDELETING,
|
COMSIG_QDELETING,
|
||||||
))
|
))
|
||||||
qdel(parent.GetComponent(/datum/component/leash))
|
qdel(parent.GetComponent(/datum/component/leash))
|
||||||
@@ -153,14 +163,23 @@
|
|||||||
return
|
return
|
||||||
INVOKE_ASYNC(back, TYPE_PROC_REF(/mob, ClickOn), target)
|
INVOKE_ASYNC(back, TYPE_PROC_REF(/mob, ClickOn), target)
|
||||||
|
|
||||||
|
/// Maintain glide size backwards
|
||||||
|
/datum/component/mob_chain/proc/on_glide_size_changed(mob/living/our_mob, new_size)
|
||||||
|
SIGNAL_HANDLER
|
||||||
|
back?.set_glide_size(new_size)
|
||||||
|
|
||||||
|
/// On gain or lose stamina, adjust our tail too
|
||||||
|
/datum/component/mob_chain/proc/on_adjust_stamina(mob/living/our_mob, type, amount, forced)
|
||||||
|
SIGNAL_HANDLER
|
||||||
|
if (forced)
|
||||||
|
return
|
||||||
|
back?.adjustStaminaLoss(amount, forced = forced)
|
||||||
|
|
||||||
/// On damage or heal, affect our furthest segment
|
/// On damage or heal, affect our furthest segment
|
||||||
/datum/component/mob_chain/proc/on_adjust_damage(mob/living/our_mob, type, amount, forced)
|
/datum/component/mob_chain/proc/on_adjust_damage(mob/living/our_mob, type, amount, forced)
|
||||||
SIGNAL_HANDLER
|
SIGNAL_HANDLER
|
||||||
if (isnull(back) || forced)
|
if (isnull(back) || forced)
|
||||||
return
|
return
|
||||||
if (type == STAMINA)
|
|
||||||
back.adjustStaminaLoss(amount, forced = forced)
|
|
||||||
return // Pass stamina changes all the way along so we maintain consistent speed
|
|
||||||
switch (type)
|
switch (type)
|
||||||
if(BRUTE)
|
if(BRUTE)
|
||||||
back.adjustBruteLoss(amount, forced = forced)
|
back.adjustBruteLoss(amount, forced = forced)
|
||||||
|
|||||||
@@ -18,9 +18,7 @@
|
|||||||
return . - bruteloss
|
return . - bruteloss
|
||||||
|
|
||||||
/mob/living/basic/adjustBruteLoss(amount, updating_health = TRUE, forced = FALSE, required_bodytype)
|
/mob/living/basic/adjustBruteLoss(amount, updating_health = TRUE, forced = FALSE, required_bodytype)
|
||||||
if(!forced && (status_flags & GODMODE))
|
if(!can_adjust_brute_loss(amount, forced, required_bodytype))
|
||||||
return 0
|
|
||||||
if(on_damage_adjustment(BRUTE, amount, forced) & COMPONENT_IGNORE_CHANGE)
|
|
||||||
return 0
|
return 0
|
||||||
if(forced)
|
if(forced)
|
||||||
. = adjust_health(amount * CONFIG_GET(number/damage_multiplier), updating_health, forced)
|
. = adjust_health(amount * CONFIG_GET(number/damage_multiplier), updating_health, forced)
|
||||||
@@ -28,9 +26,7 @@
|
|||||||
. = adjust_health(amount * damage_coeff[BRUTE] * CONFIG_GET(number/damage_multiplier), updating_health, forced)
|
. = adjust_health(amount * damage_coeff[BRUTE] * CONFIG_GET(number/damage_multiplier), updating_health, forced)
|
||||||
|
|
||||||
/mob/living/basic/adjustFireLoss(amount, updating_health = TRUE, forced = FALSE, required_bodytype)
|
/mob/living/basic/adjustFireLoss(amount, updating_health = TRUE, forced = FALSE, required_bodytype)
|
||||||
if(!forced && (status_flags & GODMODE))
|
if(!can_adjust_fire_loss(amount, forced, required_bodytype))
|
||||||
return 0
|
|
||||||
if(on_damage_adjustment(BURN, amount, forced) & COMPONENT_IGNORE_CHANGE)
|
|
||||||
return 0
|
return 0
|
||||||
if(forced)
|
if(forced)
|
||||||
. = adjust_health(amount * CONFIG_GET(number/damage_multiplier), updating_health, forced)
|
. = adjust_health(amount * CONFIG_GET(number/damage_multiplier), updating_health, forced)
|
||||||
@@ -38,9 +34,7 @@
|
|||||||
. = adjust_health(amount * damage_coeff[BURN] * CONFIG_GET(number/damage_multiplier), updating_health, forced)
|
. = adjust_health(amount * damage_coeff[BURN] * CONFIG_GET(number/damage_multiplier), updating_health, forced)
|
||||||
|
|
||||||
/mob/living/basic/adjustOxyLoss(amount, updating_health = TRUE, forced = FALSE, required_biotype, required_respiration_type)
|
/mob/living/basic/adjustOxyLoss(amount, updating_health = TRUE, forced = FALSE, required_biotype, required_respiration_type)
|
||||||
if(!forced && (status_flags & GODMODE))
|
if(!can_adjust_oxy_loss(amount, forced, required_biotype, required_respiration_type))
|
||||||
return 0
|
|
||||||
if(on_damage_adjustment(OXY, amount, forced) & COMPONENT_IGNORE_CHANGE)
|
|
||||||
return 0
|
return 0
|
||||||
if(forced)
|
if(forced)
|
||||||
. = adjust_health(amount * CONFIG_GET(number/damage_multiplier), updating_health, forced)
|
. = adjust_health(amount * CONFIG_GET(number/damage_multiplier), updating_health, forced)
|
||||||
@@ -48,9 +42,7 @@
|
|||||||
. = adjust_health(amount * damage_coeff[OXY] * CONFIG_GET(number/damage_multiplier), updating_health, forced)
|
. = adjust_health(amount * damage_coeff[OXY] * CONFIG_GET(number/damage_multiplier), updating_health, forced)
|
||||||
|
|
||||||
/mob/living/basic/adjustToxLoss(amount, updating_health = TRUE, forced = FALSE, required_biotype)
|
/mob/living/basic/adjustToxLoss(amount, updating_health = TRUE, forced = FALSE, required_biotype)
|
||||||
if(!forced && (status_flags & GODMODE))
|
if(!can_adjust_tox_loss(amount, forced, required_biotype))
|
||||||
return 0
|
|
||||||
if(on_damage_adjustment(TOX, amount, forced) & COMPONENT_IGNORE_CHANGE)
|
|
||||||
return 0
|
return 0
|
||||||
if(forced)
|
if(forced)
|
||||||
. = adjust_health(amount * CONFIG_GET(number/damage_multiplier), updating_health, forced)
|
. = adjust_health(amount * CONFIG_GET(number/damage_multiplier), updating_health, forced)
|
||||||
@@ -58,7 +50,7 @@
|
|||||||
. = adjust_health(amount * damage_coeff[TOX] * CONFIG_GET(number/damage_multiplier), updating_health, forced)
|
. = adjust_health(amount * damage_coeff[TOX] * CONFIG_GET(number/damage_multiplier), updating_health, forced)
|
||||||
|
|
||||||
/mob/living/basic/adjustCloneLoss(amount, updating_health = TRUE, forced = FALSE, required_biotype)
|
/mob/living/basic/adjustCloneLoss(amount, updating_health = TRUE, forced = FALSE, required_biotype)
|
||||||
if(on_damage_adjustment(CLONE, amount, forced) & COMPONENT_IGNORE_CHANGE)
|
if(!can_adjust_clone_loss(amount, forced, required_biotype))
|
||||||
return 0
|
return 0
|
||||||
if(forced)
|
if(forced)
|
||||||
. = adjust_health(amount * CONFIG_GET(number/damage_multiplier), updating_health, forced)
|
. = adjust_health(amount * CONFIG_GET(number/damage_multiplier), updating_health, forced)
|
||||||
@@ -66,7 +58,7 @@
|
|||||||
. = adjust_health(amount * damage_coeff[CLONE] * CONFIG_GET(number/damage_multiplier), updating_health, forced)
|
. = adjust_health(amount * damage_coeff[CLONE] * CONFIG_GET(number/damage_multiplier), updating_health, forced)
|
||||||
|
|
||||||
/mob/living/basic/adjustStaminaLoss(amount, updating_stamina = TRUE, forced = FALSE, required_biotype)
|
/mob/living/basic/adjustStaminaLoss(amount, updating_stamina = TRUE, forced = FALSE, required_biotype)
|
||||||
if(on_damage_adjustment(STAMINA, amount, forced) & COMPONENT_IGNORE_CHANGE)
|
if(!can_adjust_stamina_loss(amount, forced, required_biotype))
|
||||||
return 0
|
return 0
|
||||||
. = staminaloss
|
. = staminaloss
|
||||||
if(forced)
|
if(forced)
|
||||||
|
|||||||
@@ -56,9 +56,7 @@
|
|||||||
return amount
|
return amount
|
||||||
|
|
||||||
/mob/living/carbon/adjustBruteLoss(amount, updating_health = TRUE, forced = FALSE, required_bodytype)
|
/mob/living/carbon/adjustBruteLoss(amount, updating_health = TRUE, forced = FALSE, required_bodytype)
|
||||||
if(!forced && (status_flags & GODMODE))
|
if(!can_adjust_brute_loss(amount, forced, required_bodytype))
|
||||||
return 0
|
|
||||||
if(on_damage_adjustment(BRUTE, amount, forced) & COMPONENT_IGNORE_CHANGE)
|
|
||||||
return 0
|
return 0
|
||||||
if(amount > 0)
|
if(amount > 0)
|
||||||
. = take_overall_damage(brute = amount, updating_health = updating_health, forced = forced, required_bodytype = required_bodytype)
|
. = take_overall_damage(brute = amount, updating_health = updating_health, forced = forced, required_bodytype = required_bodytype)
|
||||||
@@ -75,9 +73,7 @@
|
|||||||
return adjustBruteLoss(diff, updating_health, forced, required_bodytype)
|
return adjustBruteLoss(diff, updating_health, forced, required_bodytype)
|
||||||
|
|
||||||
/mob/living/carbon/adjustFireLoss(amount, updating_health = TRUE, forced = FALSE, required_bodytype)
|
/mob/living/carbon/adjustFireLoss(amount, updating_health = TRUE, forced = FALSE, required_bodytype)
|
||||||
if(!forced && (status_flags & GODMODE))
|
if(!can_adjust_fire_loss(amount, forced, required_bodytype))
|
||||||
return 0
|
|
||||||
if(on_damage_adjustment(BURN, amount, forced) & COMPONENT_IGNORE_CHANGE)
|
|
||||||
return 0
|
return 0
|
||||||
if(amount > 0)
|
if(amount > 0)
|
||||||
. = take_overall_damage(burn = amount, updating_health = updating_health, forced = forced, required_bodytype = required_bodytype)
|
. = take_overall_damage(burn = amount, updating_health = updating_health, forced = forced, required_bodytype = required_bodytype)
|
||||||
@@ -94,11 +90,7 @@
|
|||||||
return adjustFireLoss(diff, updating_health, forced, required_bodytype)
|
return adjustFireLoss(diff, updating_health, forced, required_bodytype)
|
||||||
|
|
||||||
/mob/living/carbon/adjustToxLoss(amount, updating_health = TRUE, forced = FALSE, required_biotype = ALL)
|
/mob/living/carbon/adjustToxLoss(amount, updating_health = TRUE, forced = FALSE, required_biotype = ALL)
|
||||||
if(!forced && (status_flags & GODMODE))
|
if(!can_adjust_tox_loss(amount, forced, required_biotype))
|
||||||
return 0
|
|
||||||
if(!forced && !(mob_biotypes & required_biotype))
|
|
||||||
return 0
|
|
||||||
if(on_damage_adjustment(TOX, amount, forced) & COMPONENT_IGNORE_CHANGE)
|
|
||||||
return 0
|
return 0
|
||||||
if(!forced && HAS_TRAIT(src, TRAIT_TOXINLOVER)) //damage becomes healing and healing becomes damage
|
if(!forced && HAS_TRAIT(src, TRAIT_TOXINLOVER)) //damage becomes healing and healing becomes damage
|
||||||
amount = -amount
|
amount = -amount
|
||||||
|
|||||||
@@ -159,23 +159,24 @@
|
|||||||
|
|
||||||
return TRUE
|
return TRUE
|
||||||
|
|
||||||
/// Should be called by any adjustXLoss proc to send signalling information, returns a bit flag which may indicate that we don't want to make any adjustment
|
|
||||||
/mob/living/proc/on_damage_adjustment(damage_type, amount, forced)
|
|
||||||
return SEND_SIGNAL(src, COMSIG_LIVING_ADJUST_DAMAGE, damage_type, amount, forced)
|
|
||||||
|
|
||||||
/mob/living/proc/getBruteLoss()
|
/mob/living/proc/getBruteLoss()
|
||||||
return bruteloss
|
return bruteloss
|
||||||
|
|
||||||
/mob/living/proc/adjustBruteLoss(amount, updating_health = TRUE, forced = FALSE, required_bodytype = ALL)
|
/mob/living/proc/can_adjust_brute_loss(amount, forced, required_bodytype)
|
||||||
if(!forced && (status_flags & GODMODE))
|
if(!forced && (status_flags & GODMODE))
|
||||||
return 0
|
return FALSE
|
||||||
if(on_damage_adjustment(BRUTE, amount, forced) & COMPONENT_IGNORE_CHANGE)
|
if(SEND_SIGNAL(src, COMSIG_LIVING_ADJUST_BRUTE_DAMAGE, BRUTE, amount, forced) & COMPONENT_IGNORE_CHANGE)
|
||||||
|
return FALSE
|
||||||
|
return TRUE
|
||||||
|
|
||||||
|
/mob/living/proc/adjustBruteLoss(amount, updating_health = TRUE, forced = FALSE, required_bodytype = ALL)
|
||||||
|
if (!can_adjust_brute_loss(amount, forced, required_bodytype))
|
||||||
return 0
|
return 0
|
||||||
. = bruteloss
|
. = bruteloss
|
||||||
bruteloss = clamp((bruteloss + (amount * CONFIG_GET(number/damage_multiplier))), 0, maxHealth * 2)
|
bruteloss = clamp((bruteloss + (amount * CONFIG_GET(number/damage_multiplier))), 0, maxHealth * 2)
|
||||||
. -= bruteloss
|
. -= bruteloss
|
||||||
if(!.) // no change, no need to update
|
if(!.) // no change, no need to update
|
||||||
return FALSE
|
return 0
|
||||||
if(updating_health)
|
if(updating_health)
|
||||||
updatehealth()
|
updatehealth()
|
||||||
|
|
||||||
@@ -195,19 +196,24 @@
|
|||||||
/mob/living/proc/getOxyLoss()
|
/mob/living/proc/getOxyLoss()
|
||||||
return oxyloss
|
return oxyloss
|
||||||
|
|
||||||
/mob/living/proc/adjustOxyLoss(amount, updating_health = TRUE, forced = FALSE, required_biotype = ALL, required_respiration_type = ALL)
|
/mob/living/proc/can_adjust_oxy_loss(amount, forced, required_biotype, required_respiration_type)
|
||||||
if(!forced)
|
if(!forced)
|
||||||
if(status_flags & GODMODE)
|
if(status_flags & GODMODE)
|
||||||
return 0
|
return FALSE
|
||||||
|
if (required_respiration_type)
|
||||||
|
var/obj/item/organ/internal/lungs/affected_lungs = get_organ_slot(ORGAN_SLOT_LUNGS)
|
||||||
|
if(isnull(affected_lungs))
|
||||||
|
if(!(mob_respiration_type & required_respiration_type)) // if the mob has no lungs, use mob_respiration_type
|
||||||
|
return FALSE
|
||||||
|
else
|
||||||
|
if(!(affected_lungs.respiration_type & required_respiration_type)) // otherwise use the lungs' respiration_type
|
||||||
|
return FALSE
|
||||||
|
if(SEND_SIGNAL(src, COMSIG_LIVING_ADJUST_OXY_DAMAGE, OXY, amount, forced) & COMPONENT_IGNORE_CHANGE)
|
||||||
|
return FALSE
|
||||||
|
return TRUE
|
||||||
|
|
||||||
var/obj/item/organ/internal/lungs/affected_lungs = get_organ_slot(ORGAN_SLOT_LUNGS)
|
/mob/living/proc/adjustOxyLoss(amount, updating_health = TRUE, forced = FALSE, required_biotype = ALL, required_respiration_type = ALL)
|
||||||
if(isnull(affected_lungs))
|
if(!can_adjust_oxy_loss(amount, forced, required_biotype, required_respiration_type))
|
||||||
if(!(mob_respiration_type & required_respiration_type)) // if the mob has no lungs, use mob_respiration_type
|
|
||||||
return 0
|
|
||||||
else
|
|
||||||
if(!(affected_lungs.respiration_type & required_respiration_type)) // otherwise use the lungs' respiration_type
|
|
||||||
return 0
|
|
||||||
if(on_damage_adjustment(OXY, amount, forced) & COMPONENT_IGNORE_CHANGE)
|
|
||||||
return 0
|
return 0
|
||||||
. = oxyloss
|
. = oxyloss
|
||||||
oxyloss = clamp((oxyloss + (amount * CONFIG_GET(number/damage_multiplier))), 0, maxHealth * 2)
|
oxyloss = clamp((oxyloss + (amount * CONFIG_GET(number/damage_multiplier))), 0, maxHealth * 2)
|
||||||
@@ -240,13 +246,16 @@
|
|||||||
/mob/living/proc/getToxLoss()
|
/mob/living/proc/getToxLoss()
|
||||||
return toxloss
|
return toxloss
|
||||||
|
|
||||||
|
/mob/living/proc/can_adjust_tox_loss(amount, forced, required_biotype)
|
||||||
|
if(!forced && ((status_flags & GODMODE) || !(mob_biotypes & required_biotype)))
|
||||||
|
return FALSE
|
||||||
|
if(SEND_SIGNAL(src, COMSIG_LIVING_ADJUST_TOX_DAMAGE, TOX, amount, forced) & COMPONENT_IGNORE_CHANGE)
|
||||||
|
return FALSE
|
||||||
|
return TRUE
|
||||||
|
|
||||||
/mob/living/proc/adjustToxLoss(amount, updating_health = TRUE, forced = FALSE, required_biotype = ALL)
|
/mob/living/proc/adjustToxLoss(amount, updating_health = TRUE, forced = FALSE, required_biotype = ALL)
|
||||||
if(!forced && (status_flags & GODMODE))
|
if(!can_adjust_tox_loss(amount, forced, required_biotype))
|
||||||
return FALSE
|
|
||||||
if(on_damage_adjustment(TOX, amount, forced) & COMPONENT_IGNORE_CHANGE)
|
|
||||||
return 0
|
return 0
|
||||||
if(!forced && !(mob_biotypes & required_biotype))
|
|
||||||
return FALSE
|
|
||||||
. = toxloss
|
. = toxloss
|
||||||
toxloss = clamp((toxloss + (amount * CONFIG_GET(number/damage_multiplier))), 0, maxHealth * 2)
|
toxloss = clamp((toxloss + (amount * CONFIG_GET(number/damage_multiplier))), 0, maxHealth * 2)
|
||||||
. -= toxloss
|
. -= toxloss
|
||||||
@@ -271,10 +280,15 @@
|
|||||||
/mob/living/proc/getFireLoss()
|
/mob/living/proc/getFireLoss()
|
||||||
return fireloss
|
return fireloss
|
||||||
|
|
||||||
/mob/living/proc/adjustFireLoss(amount, updating_health = TRUE, forced = FALSE, required_bodytype = ALL)
|
/mob/living/proc/can_adjust_fire_loss(amount, forced, required_bodytype)
|
||||||
if(!forced && (status_flags & GODMODE))
|
if(!forced && (status_flags & GODMODE))
|
||||||
return 0
|
return FALSE
|
||||||
if(on_damage_adjustment(BURN, amount, forced) & COMPONENT_IGNORE_CHANGE)
|
if(SEND_SIGNAL(src, COMSIG_LIVING_ADJUST_BURN_DAMAGE, BURN, amount, forced) & COMPONENT_IGNORE_CHANGE)
|
||||||
|
return FALSE
|
||||||
|
return TRUE
|
||||||
|
|
||||||
|
/mob/living/proc/adjustFireLoss(amount, updating_health = TRUE, forced = FALSE, required_bodytype = ALL)
|
||||||
|
if(!can_adjust_fire_loss(amount, forced, required_bodytype))
|
||||||
return 0
|
return 0
|
||||||
. = fireloss
|
. = fireloss
|
||||||
fireloss = clamp((fireloss + (amount * CONFIG_GET(number/damage_multiplier))), 0, maxHealth * 2)
|
fireloss = clamp((fireloss + (amount * CONFIG_GET(number/damage_multiplier))), 0, maxHealth * 2)
|
||||||
@@ -298,10 +312,15 @@
|
|||||||
/mob/living/proc/getCloneLoss()
|
/mob/living/proc/getCloneLoss()
|
||||||
return cloneloss
|
return cloneloss
|
||||||
|
|
||||||
/mob/living/proc/adjustCloneLoss(amount, updating_health = TRUE, forced = FALSE, required_biotype = ALL)
|
/mob/living/proc/can_adjust_clone_loss(amount, forced, required_biotype)
|
||||||
if(!forced && (!(mob_biotypes & required_biotype) || status_flags & GODMODE || HAS_TRAIT(src, TRAIT_NOCLONELOSS)))
|
if(!forced && (!(mob_biotypes & required_biotype) || status_flags & GODMODE || HAS_TRAIT(src, TRAIT_NOCLONELOSS)))
|
||||||
return 0
|
return FALSE
|
||||||
if(on_damage_adjustment(CLONE, amount, forced) & COMPONENT_IGNORE_CHANGE)
|
if(SEND_SIGNAL(src, COMSIG_LIVING_ADJUST_CLONE_DAMAGE, CLONE, amount, forced) & COMPONENT_IGNORE_CHANGE)
|
||||||
|
return FALSE
|
||||||
|
return TRUE
|
||||||
|
|
||||||
|
/mob/living/proc/adjustCloneLoss(amount, updating_health = TRUE, forced = FALSE, required_biotype = ALL)
|
||||||
|
if(!can_adjust_clone_loss(amount, forced, required_biotype))
|
||||||
return 0
|
return 0
|
||||||
. = cloneloss
|
. = cloneloss
|
||||||
cloneloss = clamp((cloneloss + (amount * CONFIG_GET(number/damage_multiplier))), 0, maxHealth * 2)
|
cloneloss = clamp((cloneloss + (amount * CONFIG_GET(number/damage_multiplier))), 0, maxHealth * 2)
|
||||||
@@ -336,10 +355,15 @@
|
|||||||
/mob/living/proc/getStaminaLoss()
|
/mob/living/proc/getStaminaLoss()
|
||||||
return staminaloss
|
return staminaloss
|
||||||
|
|
||||||
|
/mob/living/proc/can_adjust_stamina_loss(amount, forced, required_biotype)
|
||||||
|
if(!forced && (!(mob_biotypes & required_biotype) || status_flags & GODMODE))
|
||||||
|
return FALSE
|
||||||
|
if(SEND_SIGNAL(src, COMSIG_LIVING_ADJUST_STAMINA_DAMAGE, STAMINA, amount, forced) & COMPONENT_IGNORE_CHANGE)
|
||||||
|
return FALSE
|
||||||
|
return TRUE
|
||||||
|
|
||||||
/mob/living/proc/adjustStaminaLoss(amount, updating_stamina = TRUE, forced = FALSE, required_biotype = ALL)
|
/mob/living/proc/adjustStaminaLoss(amount, updating_stamina = TRUE, forced = FALSE, required_biotype = ALL)
|
||||||
if(!forced && ((status_flags & GODMODE) || required_biotype && !(mob_biotypes & required_biotype)))
|
if(!can_adjust_stamina_loss(amount, forced, required_biotype))
|
||||||
return 0
|
|
||||||
if(on_damage_adjustment(STAMINA, amount, forced) & COMPONENT_IGNORE_CHANGE)
|
|
||||||
return 0
|
return 0
|
||||||
. = staminaloss
|
. = staminaloss
|
||||||
staminaloss = clamp((staminaloss + (amount * CONFIG_GET(number/damage_multiplier))), 0, max_stamina)
|
staminaloss = clamp((staminaloss + (amount * CONFIG_GET(number/damage_multiplier))), 0, max_stamina)
|
||||||
|
|||||||
@@ -19,7 +19,7 @@
|
|||||||
toggle_ai(AI_ON)
|
toggle_ai(AI_ON)
|
||||||
|
|
||||||
/mob/living/simple_animal/adjustBruteLoss(amount, updating_health = TRUE, forced = FALSE, required_bodytype)
|
/mob/living/simple_animal/adjustBruteLoss(amount, updating_health = TRUE, forced = FALSE, required_bodytype)
|
||||||
if(on_damage_adjustment(BRUTE, amount, forced) & COMPONENT_IGNORE_CHANGE)
|
if(!can_adjust_brute_loss(amount, forced, required_bodytype))
|
||||||
return 0
|
return 0
|
||||||
if(forced)
|
if(forced)
|
||||||
. = adjustHealth(amount * CONFIG_GET(number/damage_multiplier), updating_health, forced)
|
. = adjustHealth(amount * CONFIG_GET(number/damage_multiplier), updating_health, forced)
|
||||||
@@ -27,7 +27,7 @@
|
|||||||
. = adjustHealth(amount * damage_coeff[BRUTE] * CONFIG_GET(number/damage_multiplier), updating_health, forced)
|
. = adjustHealth(amount * damage_coeff[BRUTE] * CONFIG_GET(number/damage_multiplier), updating_health, forced)
|
||||||
|
|
||||||
/mob/living/simple_animal/adjustFireLoss(amount, updating_health = TRUE, forced = FALSE, required_bodytype)
|
/mob/living/simple_animal/adjustFireLoss(amount, updating_health = TRUE, forced = FALSE, required_bodytype)
|
||||||
if(on_damage_adjustment(BURN, amount, forced) & COMPONENT_IGNORE_CHANGE)
|
if(!can_adjust_fire_loss(amount, forced, required_bodytype))
|
||||||
return 0
|
return 0
|
||||||
if(forced)
|
if(forced)
|
||||||
. = adjustHealth(amount * CONFIG_GET(number/damage_multiplier), updating_health, forced)
|
. = adjustHealth(amount * CONFIG_GET(number/damage_multiplier), updating_health, forced)
|
||||||
@@ -35,7 +35,7 @@
|
|||||||
. = adjustHealth(amount * damage_coeff[BURN] * CONFIG_GET(number/damage_multiplier), updating_health, forced)
|
. = adjustHealth(amount * damage_coeff[BURN] * CONFIG_GET(number/damage_multiplier), updating_health, forced)
|
||||||
|
|
||||||
/mob/living/simple_animal/adjustOxyLoss(amount, updating_health = TRUE, forced = FALSE, required_biotype, required_respiration_type)
|
/mob/living/simple_animal/adjustOxyLoss(amount, updating_health = TRUE, forced = FALSE, required_biotype, required_respiration_type)
|
||||||
if(on_damage_adjustment(OXY, amount, forced) & COMPONENT_IGNORE_CHANGE)
|
if(!can_adjust_oxy_loss(amount, forced, required_biotype, required_respiration_type))
|
||||||
return 0
|
return 0
|
||||||
if(forced)
|
if(forced)
|
||||||
. = adjustHealth(amount * CONFIG_GET(number/damage_multiplier), updating_health, forced)
|
. = adjustHealth(amount * CONFIG_GET(number/damage_multiplier), updating_health, forced)
|
||||||
@@ -43,7 +43,7 @@
|
|||||||
. = adjustHealth(amount * damage_coeff[OXY] * CONFIG_GET(number/damage_multiplier), updating_health, forced)
|
. = adjustHealth(amount * damage_coeff[OXY] * CONFIG_GET(number/damage_multiplier), updating_health, forced)
|
||||||
|
|
||||||
/mob/living/simple_animal/adjustToxLoss(amount, updating_health = TRUE, forced = FALSE, required_biotype)
|
/mob/living/simple_animal/adjustToxLoss(amount, updating_health = TRUE, forced = FALSE, required_biotype)
|
||||||
if(on_damage_adjustment(TOX, amount, forced) & COMPONENT_IGNORE_CHANGE)
|
if(!can_adjust_tox_loss(amount, forced, required_biotype))
|
||||||
return 0
|
return 0
|
||||||
if(forced)
|
if(forced)
|
||||||
. = adjustHealth(amount * CONFIG_GET(number/damage_multiplier), updating_health, forced)
|
. = adjustHealth(amount * CONFIG_GET(number/damage_multiplier), updating_health, forced)
|
||||||
@@ -51,7 +51,7 @@
|
|||||||
. = adjustHealth(amount * damage_coeff[TOX] * CONFIG_GET(number/damage_multiplier), updating_health, forced)
|
. = adjustHealth(amount * damage_coeff[TOX] * CONFIG_GET(number/damage_multiplier), updating_health, forced)
|
||||||
|
|
||||||
/mob/living/simple_animal/adjustCloneLoss(amount, updating_health = TRUE, forced = FALSE, required_biotype)
|
/mob/living/simple_animal/adjustCloneLoss(amount, updating_health = TRUE, forced = FALSE, required_biotype)
|
||||||
if(on_damage_adjustment(CLONE, amount, forced) & COMPONENT_IGNORE_CHANGE)
|
if(!can_adjust_clone_loss(amount, forced, required_biotype))
|
||||||
return 0
|
return 0
|
||||||
if(forced)
|
if(forced)
|
||||||
. = adjustHealth(amount * CONFIG_GET(number/damage_multiplier), updating_health, forced)
|
. = adjustHealth(amount * CONFIG_GET(number/damage_multiplier), updating_health, forced)
|
||||||
@@ -59,7 +59,7 @@
|
|||||||
. = adjustHealth(amount * damage_coeff[CLONE] * CONFIG_GET(number/damage_multiplier), updating_health, forced)
|
. = adjustHealth(amount * damage_coeff[CLONE] * CONFIG_GET(number/damage_multiplier), updating_health, forced)
|
||||||
|
|
||||||
/mob/living/simple_animal/adjustStaminaLoss(amount, updating_stamina = TRUE, forced = FALSE, required_biotype)
|
/mob/living/simple_animal/adjustStaminaLoss(amount, updating_stamina = TRUE, forced = FALSE, required_biotype)
|
||||||
if(on_damage_adjustment(STAMINA, amount, forced) & COMPONENT_IGNORE_CHANGE)
|
if(!can_adjust_stamina_loss(amount, forced, required_biotype))
|
||||||
return 0
|
return 0
|
||||||
if(forced)
|
if(forced)
|
||||||
staminaloss = max(0, min(max_staminaloss, staminaloss + amount))
|
staminaloss = max(0, min(max_staminaloss, staminaloss + amount))
|
||||||
|
|||||||
@@ -65,7 +65,7 @@
|
|||||||
/mob/living/silicon/pai/ignite_mob(silent)
|
/mob/living/silicon/pai/ignite_mob(silent)
|
||||||
return FALSE
|
return FALSE
|
||||||
|
|
||||||
/mob/living/silicon/pai/proc/take_holo_damage(type, amount)
|
/mob/living/silicon/pai/proc/take_holo_damage(amount)
|
||||||
holochassis_health = clamp((holochassis_health - amount), -50, HOLOCHASSIS_MAX_HEALTH)
|
holochassis_health = clamp((holochassis_health - amount), -50, HOLOCHASSIS_MAX_HEALTH)
|
||||||
if(holochassis_health < 0)
|
if(holochassis_health < 0)
|
||||||
fold_in(force = TRUE)
|
fold_in(force = TRUE)
|
||||||
@@ -73,23 +73,17 @@
|
|||||||
to_chat(src, span_userdanger("The impact degrades your holochassis!"))
|
to_chat(src, span_userdanger("The impact degrades your holochassis!"))
|
||||||
return amount
|
return amount
|
||||||
|
|
||||||
/mob/living/silicon/pai/adjustBruteLoss(amount, updating_health = TRUE, forced = FALSE, required_bodytype)
|
/// Called when we take burn or brute damage, pass it to the shell instead
|
||||||
if(on_damage_adjustment(BRUTE, amount, forced) & COMPONENT_IGNORE_CHANGE)
|
/mob/living/silicon/pai/proc/on_shell_damaged(datum/hurt, type, amount, forced)
|
||||||
return 0
|
SIGNAL_HANDLER
|
||||||
return take_holo_damage(amount)
|
take_holo_damage(amount)
|
||||||
|
return COMPONENT_IGNORE_CHANGE
|
||||||
|
|
||||||
/mob/living/silicon/pai/adjustFireLoss(amount, updating_health = TRUE, forced = FALSE, required_bodytype)
|
/// Called when we take stamina damage, pass it to the shell instead
|
||||||
if(on_damage_adjustment(BURN, amount, forced) & COMPONENT_IGNORE_CHANGE)
|
/mob/living/silicon/pai/proc/on_shell_weakened(datum/hurt, type, amount, forced)
|
||||||
return 0
|
SIGNAL_HANDLER
|
||||||
return take_holo_damage(amount)
|
take_holo_damage(amount * ((forced) ? 1 : 0.25))
|
||||||
|
return COMPONENT_IGNORE_CHANGE
|
||||||
/mob/living/silicon/pai/adjustStaminaLoss(amount, updating_stamina, forced = FALSE, required_biotype)
|
|
||||||
if(on_damage_adjustment(STAMINA, amount, forced) & COMPONENT_IGNORE_CHANGE)
|
|
||||||
return 0
|
|
||||||
if(forced)
|
|
||||||
take_holo_damage(amount)
|
|
||||||
else
|
|
||||||
take_holo_damage(amount * 0.25)
|
|
||||||
|
|
||||||
/mob/living/silicon/pai/getBruteLoss()
|
/mob/living/silicon/pai/getBruteLoss()
|
||||||
return HOLOCHASSIS_MAX_HEALTH - holochassis_health
|
return HOLOCHASSIS_MAX_HEALTH - holochassis_health
|
||||||
|
|||||||
@@ -227,6 +227,8 @@
|
|||||||
update_appearance(UPDATE_DESC)
|
update_appearance(UPDATE_DESC)
|
||||||
|
|
||||||
RegisterSignal(src, COMSIG_LIVING_CULT_SACRIFICED, PROC_REF(on_cult_sacrificed))
|
RegisterSignal(src, COMSIG_LIVING_CULT_SACRIFICED, PROC_REF(on_cult_sacrificed))
|
||||||
|
RegisterSignals(src, list(COMSIG_LIVING_ADJUST_BRUTE_DAMAGE, COMSIG_LIVING_ADJUST_BURN_DAMAGE), PROC_REF(on_shell_damaged))
|
||||||
|
RegisterSignal(src, COMSIG_LIVING_ADJUST_STAMINA_DAMAGE, PROC_REF(on_shell_weakened))
|
||||||
|
|
||||||
/mob/living/silicon/pai/make_laws()
|
/mob/living/silicon/pai/make_laws()
|
||||||
laws = new /datum/ai_laws/pai()
|
laws = new /datum/ai_laws/pai()
|
||||||
|
|||||||
Reference in New Issue
Block a user