syscorruption framework
Adds a framework for systems corruption instead of toxins damage for use in synthetic species. No ways to deal / heal it yet, nor effects, or actual uses. Soon.
This commit is contained in:
@@ -11,6 +11,12 @@
|
||||
#define STAMINA "stamina"
|
||||
#define BRAIN "brain"
|
||||
|
||||
//Toxins damage 'typeflag' - is this normal toxins damage or does it have to do with systems corruption (ROBOTIC_ORGANISM species trait)
|
||||
|
||||
#define TOX_DEFAULT 1 //For normal toxins damage / healing (toxins, etc), adjustToxLoss() defaults to this
|
||||
#define TOX_SYSCORRUPT 2 //For toxins damage causing adverse effects to robotic organisms, up to and including fatal corruption, or healing that damage
|
||||
#define TOX_OMNI 3 //For tox damage / healing that affects both organics and robotic organisms. Used by very few things, e.g. aheals / by default setToxLoss()
|
||||
|
||||
//bitflag damage defines used for suicide_act
|
||||
#define BRUTELOSS (1<<0)
|
||||
#define FIRELOSS (1<<1)
|
||||
|
||||
@@ -118,6 +118,7 @@
|
||||
#define TRAIT_NOLIMBDISABLE "no_limb_disable"
|
||||
#define TRAIT_EASYLIMBDISABLE "easy_limb_disable"
|
||||
#define TRAIT_TOXINLOVER "toxinlover"
|
||||
#define TRAIT_ROBOTICORGANISM "robotic_organism"
|
||||
#define TRAIT_NOBREATH "no_breath"
|
||||
#define TRAIT_ANTIMAGIC "anti_magic"
|
||||
#define TRAIT_HOLY "holy"
|
||||
|
||||
@@ -51,6 +51,7 @@ GLOBAL_LIST_INIT(traits_by_type, list(
|
||||
"TRAIT_NOLIMBDISABLE" = TRAIT_NOLIMBDISABLE,
|
||||
"TRAIT_EASYLIMBDISABLE" = TRAIT_EASYLIMBDISABLE,
|
||||
"TRAIT_TOXINLOVER" = TRAIT_TOXINLOVER,
|
||||
"TRAIT_ROBOTICORGANISM" = TRAIT_ROBOTICORGANISM,
|
||||
"TRAIT_NOBREATH" = TRAIT_NOBREATH,
|
||||
"TRAIT_ANTIMAGIC" = TRAIT_ANTIMAGIC,
|
||||
"TRAIT_HOLY" = TRAIT_HOLY,
|
||||
|
||||
@@ -85,8 +85,10 @@
|
||||
heal_overall_damage(0, abs(amount), 0, FALSE, TRUE, updating_health)
|
||||
return amount
|
||||
|
||||
/mob/living/carbon/adjustToxLoss(amount, updating_health = TRUE, forced = FALSE)
|
||||
if(!forced && HAS_TRAIT(src, TRAIT_TOXINLOVER)) //damage becomes healing and healing becomes damage
|
||||
|
||||
//God save me from spaghettifying this - Syscorrupt damage is not affected by toxlovers.
|
||||
/mob/living/carbon/adjustToxLoss(amount, updating_health = TRUE, forced = FALSE, toxins_type = TOX_DEFAULT)
|
||||
if(!forced && HAS_TRAIT(src, TRAIT_TOXINLOVER) && toxins_type != TOX_SYSCORRUPT) //damage becomes healing and healing becomes damage
|
||||
amount = -amount
|
||||
if(amount > 0)
|
||||
blood_volume -= 3 * amount //5x was too much, this is punishing enough.
|
||||
|
||||
@@ -168,20 +168,45 @@
|
||||
updatehealth()
|
||||
return amount
|
||||
|
||||
/mob/living/proc/getToxLoss()
|
||||
return toxloss
|
||||
//By default, returns toxins damage no matter what kind of tox damage the target is using.
|
||||
/mob/living/proc/getToxLoss(toxins_type = TOX_OMNI)
|
||||
if(toxins_type == TOX_OMNI)
|
||||
return toxloss
|
||||
|
||||
/mob/living/proc/adjustToxLoss(amount, updating_health = TRUE, forced = FALSE)
|
||||
var/affected_by = TOX_DEFAULT
|
||||
if(HAS_TRAIT(src, TRAIT_ROBOTICORGANISM))
|
||||
affected_by = TOX_SYSCORRUPT
|
||||
|
||||
if(toxins_type != affected_by)
|
||||
return 0
|
||||
else
|
||||
return toxloss
|
||||
|
||||
/mob/living/proc/adjustToxLoss(amount, updating_health = TRUE, forced = FALSE, toxins_type = TOX_DEFAULT)
|
||||
if(!forced && (status_flags & GODMODE))
|
||||
return FALSE
|
||||
var/affected_by = TOX_DEFAULT
|
||||
if(HAS_TRAIT(src, TRAIT_ROBOTICORGANISM))
|
||||
affected_by = TOX_SYSCORRUPT
|
||||
if(toxins_type != TOX_OMNI && toxins_type != affected_by)
|
||||
return FALSE
|
||||
|
||||
toxloss = clamp((toxloss + (amount * CONFIG_GET(number/damage_multiplier))), 0, maxHealth * 2)
|
||||
if(updating_health)
|
||||
updatehealth()
|
||||
return amount
|
||||
|
||||
/mob/living/proc/setToxLoss(amount, updating_health = TRUE, forced = FALSE)
|
||||
//Defaults to omni here because setToxLoss is used by very few things that usually want to set all types
|
||||
/mob/living/proc/setToxLoss(amount, updating_health = TRUE, forced = FALSE, toxins_type = TOX_OMNI)
|
||||
if(!forced && (status_flags & GODMODE))
|
||||
return FALSE
|
||||
|
||||
var/affected_by = TOX_DEFAULT
|
||||
if(HAS_TRAIT(src, TRAIT_ROBOTICORGANISM))
|
||||
affected_by = TOX_SYSCORRUPT
|
||||
if(toxins_type != TOX_OMNI && toxins_type != affected_by)
|
||||
return FALSE
|
||||
|
||||
toxloss = amount
|
||||
if(updating_health)
|
||||
updatehealth()
|
||||
|
||||
Reference in New Issue
Block a user