mirror of
https://github.com/ParadiseSS13/Paradise.git
synced 2026-07-17 18:13:34 +01:00
24845b238a
* Initial commit - FLOCKMIND - Probably has like a billion things to fix * Do after conversions * Config * Moved the files, icon fixes * Tick everything, language work, event, spawn landmark, role prefs, beginning mob port * Spans and some other fixes. Also the tickening * More tickening * More fixes. Lots of fixes. * More Fixes * A whole lot more. Also flock TGUI. * Fixes fixes fixes fixes fixes * FIXES * More fixes - PR ready, still needs a fuckton of testing * Fixes * fix incomplete upstream merge * fix FlockPanel + sort button name * TGUI review * Fixes tealprint list * Fixes * More fixes * Incapacitator Fix * Filenames * Linters * Interceptor range buff * Reagent counts * Linters * Fabricator vendor fix * Keybinds and HUD - Flockdrones, Fixes Vendor Conversion, Cube Materials * Reworks reagent, adds flock grilles, fixes compute node overlays * Intent-based flockdrone parts * Intent based drone parts * Radial control panel for controlling drones manually, phasing through windows/grilles * Movement fixes * Radio talk power, stare fix * Flock health HUD * Fixes flock lights, linters * Unit tests * Adds countdown to relay * Relay improvements * Small fix * Logic Schmogic * Relay overlay and looping sound effect * Ignore air when converting turfs * Cage fixes and improvements * Improved flock bolt * Turret conversions * Flock bolts taze simple or basic mobs * Sentience type * Fixe * Linter * tgui review stage 2 * Concentrated Repair Burst * Improves radio detection * Removes extra space * Adds healing visual effect * Cube tech levels * Ghooost * Excess * Flock doors, chairs, lattices. Centralizes conversion code. Crafting with Gnesis * Update code/modules/antagonists/flockmind/ai_behaviors/flock_wander.dm Co-authored-by: Kapu1178 <75460809+Kapu1178@users.noreply.github.com> Signed-off-by: PollardTheDragon <144391971+PollardTheDragon@users.noreply.github.com> * Fixes the fix * Astar movement detection * Fix, extraneous code, language stuff * Language fixes and wander fix * Fixes * Another fix * Lints * Another linter * Language improvement * More language improvements * Time requirement and appearing in orbit menu as an antag * Cube glow * TGUI * Minicache * Linters * Grammar * Material ID fix * Lid fix * Reagent turf reaction * Reagent fix * Butcher results * Conversion rates * Flock stare fix * Fixes stare behavior * Staring * Flock mob blood * Flock mobs gibs and blood. Also some runtime fixes * Flock mobs now resist out of grabs, buckles, lockers, and more * Fixes flock orbit, fixes a runtime I think, * Target mechs, damage mechs, other bug fixes * Cage fix * Cage resist change * Some mind changes, gatecrash buff * Drones now shoot mechs, stare improvement * Cut down on spam a little * Nest fix * No more resist spam * Fixed drone death control * Resist statement * Makes the relay alarm scarier * Fixes dead flock camera mobs having no ghost sprite, something with ghosting * Enhanced flockphasing * Improved flockmob pathing * Added required turf restriction to relay * Increased needed bandwidth for relay construction * Nerfed drone substrate rate * Added new status tab items for relay progress * Another relay cost adjustment * Improves drone AI responsiveness * Computer frames now become flock computers * Improves target finding for conversion, building, and replicating * Reduced flock event pop requirements * Adjusts flock protection on structures. Adjusts overlays. * Relay unlock tweak * Fixwes flock being able to gib mech'd AIs with one button * Map conflict * Flock can no longer be outed by merely existing * Fied bug causing drones to shoot themselves * Prevents mobs from attacking while in a cage * Converter tool can now open closets and crates. * Adds descriptions to flockdrone tools. * More informatic blurbs * Adds xenobiology organs * Organ lint * TGUI merge * bundle and mm --------- Signed-off-by: PollardTheDragon <144391971+PollardTheDragon@users.noreply.github.com> Co-authored-by: Toastical <20125180+Toastical@users.noreply.github.com> Co-authored-by: Kapu1178 <75460809+Kapu1178@users.noreply.github.com> Co-authored-by: Burzah <116982774+Burzah@users.noreply.github.com>
366 lines
9.9 KiB
Plaintext
366 lines
9.9 KiB
Plaintext
|
|
/*
|
|
apply_damage(a,b,c)
|
|
args
|
|
a:damage - How much damage to take
|
|
b:damage_type - What type of damage to take, brute, burn
|
|
c:def_zone - Where to take the damage if its brute or burn
|
|
Returns
|
|
standard 0 if fail
|
|
*/
|
|
/mob/living/proc/apply_damage(damage = 0, damagetype = BRUTE, def_zone, blocked = 0, sharp = FALSE, used_weapon, spread_damage = FALSE)
|
|
SEND_SIGNAL(src, COMSIG_MOB_APPLY_DAMAGE, damage, damagetype, def_zone)
|
|
var/hit_percent = (100 - blocked) / 100
|
|
if(!damage || (hit_percent <= 0))
|
|
return FALSE
|
|
var/damage_amount = damage * hit_percent
|
|
switch(damagetype)
|
|
if(BRUTE)
|
|
adjustBruteLoss(damage_amount)
|
|
if(BURN)
|
|
adjustFireLoss(damage_amount)
|
|
if(TOX)
|
|
adjustToxLoss(damage_amount)
|
|
if(OXY)
|
|
adjustOxyLoss(damage_amount)
|
|
if(CLONE)
|
|
adjustCloneLoss(damage_amount)
|
|
if(STAMINA)
|
|
adjustStaminaLoss(damage_amount)
|
|
updatehealth("apply damage")
|
|
return TRUE
|
|
|
|
/mob/living/proc/apply_damage_type(damage = 0, damagetype = BRUTE) //like apply damage except it always uses the damage procs
|
|
switch(damagetype)
|
|
if(BRUTE)
|
|
return adjustBruteLoss(damage)
|
|
if(BURN)
|
|
return adjustFireLoss(damage)
|
|
if(TOX)
|
|
return adjustToxLoss(damage)
|
|
if(OXY)
|
|
return adjustOxyLoss(damage)
|
|
if(CLONE)
|
|
return adjustCloneLoss(damage)
|
|
if(STAMINA)
|
|
return adjustStaminaLoss(damage)
|
|
if(BRAIN)
|
|
return adjustBrainLoss(damage)
|
|
|
|
/mob/living/proc/get_damage_amount(damagetype = BRUTE)
|
|
switch(damagetype)
|
|
if(BRUTE)
|
|
return getBruteLoss()
|
|
if(BURN)
|
|
return getFireLoss()
|
|
if(TOX)
|
|
return getToxLoss()
|
|
if(OXY)
|
|
return getOxyLoss()
|
|
if(CLONE)
|
|
return getCloneLoss()
|
|
if(STAMINA)
|
|
return getStaminaLoss()
|
|
|
|
/mob/living/proc/get_damage_percent()
|
|
var/max = getMaxHealth()
|
|
var/loss = getBruteLoss() + getFireLoss() + getToxLoss() + getCloneLoss() + getOxyLoss()
|
|
return ceil((max - loss) / max * 100)
|
|
|
|
/mob/living/proc/apply_damages(brute = 0, burn = 0, tox = 0, oxy = 0, clone = 0, def_zone = null, blocked = 0, stamina = 0)
|
|
if(blocked >= 100) return 0
|
|
if(brute) apply_damage(brute, BRUTE, def_zone, blocked)
|
|
if(burn) apply_damage(burn, BURN, def_zone, blocked)
|
|
if(tox) apply_damage(tox, TOX, def_zone, blocked)
|
|
if(oxy) apply_damage(oxy, OXY, def_zone, blocked)
|
|
if(clone) apply_damage(clone, CLONE, def_zone, blocked)
|
|
if(stamina) apply_damage(stamina, STAMINA, def_zone, blocked)
|
|
return 1
|
|
|
|
|
|
|
|
/mob/living/proc/apply_effect(effect = 0, effecttype = STUN, blocked = 0)
|
|
blocked = (100 - blocked) / 100
|
|
if(!effect || (blocked <= 0))
|
|
return FALSE
|
|
switch(effecttype)
|
|
if(STUN)
|
|
Stun(effect * blocked)
|
|
if(WEAKEN)
|
|
Weaken(effect * blocked)
|
|
if(KNOCKDOWN)
|
|
KnockDown(effect * blocked)
|
|
if(PARALYZE)
|
|
Paralyse(effect * blocked)
|
|
if(IRRADIATE)
|
|
if(!HAS_TRAIT(src, TRAIT_RADIMMUNE))
|
|
radiation += max(effect * blocked, 0)
|
|
if(SLUR)
|
|
Slur(effect * blocked)
|
|
if(STUTTER)
|
|
Stuttering(effect * blocked)
|
|
if(EYE_BLUR)
|
|
EyeBlurry(effect * blocked)
|
|
if(DROWSY)
|
|
Drowsy(effect * blocked)
|
|
if(JITTER)
|
|
Jitter(effect * blocked)
|
|
updatehealth("apply effect")
|
|
return TRUE
|
|
|
|
/mob/living/proc/apply_effects(stun = 0, weaken = 0, knockdown = 0, paralyze = 0, irradiate = 0, slur = 0, stutter = 0, eyeblur = 0, drowsy = 0, blocked = 0, stamina = 0, jitter = 0)
|
|
if(blocked >= 100)
|
|
return FALSE
|
|
if(stun)
|
|
apply_effect(stun, STUN, blocked)
|
|
if(weaken)
|
|
apply_effect(weaken, WEAKEN, blocked)
|
|
if(knockdown)
|
|
apply_effect(knockdown, KNOCKDOWN, blocked)
|
|
if(paralyze)
|
|
apply_effect(paralyze, PARALYZE, blocked)
|
|
if(irradiate)
|
|
apply_effect(irradiate, IRRADIATE, blocked)
|
|
if(slur)
|
|
apply_effect(slur, SLUR, blocked)
|
|
if(stutter)
|
|
apply_effect(stutter, STUTTER, blocked)
|
|
if(eyeblur)
|
|
apply_effect(eyeblur, EYE_BLUR, blocked)
|
|
if(drowsy)
|
|
apply_effect(drowsy, DROWSY, blocked)
|
|
if(stamina)
|
|
apply_damage(stamina, STAMINA, null, blocked)
|
|
if(jitter)
|
|
apply_effect(jitter, JITTER, blocked)
|
|
return TRUE
|
|
|
|
|
|
/mob/living/proc/getBruteLoss()
|
|
return bruteloss
|
|
|
|
/mob/living/proc/adjustBruteLoss(amount, updating_health = TRUE)
|
|
if(status_flags & GODMODE)
|
|
return FALSE //godmode
|
|
var/old_bruteloss = bruteloss
|
|
bruteloss = max(bruteloss + amount, 0)
|
|
if(old_bruteloss == bruteloss)
|
|
updating_health = FALSE
|
|
. = STATUS_UPDATE_NONE
|
|
else
|
|
. = STATUS_UPDATE_HEALTH
|
|
if(updating_health)
|
|
updatehealth("adjustBruteLoss")
|
|
|
|
/mob/living/proc/getOxyLoss()
|
|
return oxyloss
|
|
|
|
/mob/living/proc/adjustOxyLoss(amount, updating_health = TRUE)
|
|
if(status_flags & GODMODE)
|
|
oxyloss = 0
|
|
return FALSE //godmode
|
|
if(HAS_TRAIT(src, TRAIT_NOBREATH))
|
|
oxyloss = 0
|
|
return FALSE
|
|
if(amount < 0 && has_status_effect(STATUS_EFFECT_NO_OXY_HEAL))
|
|
return FALSE
|
|
var/old_oxyloss = oxyloss
|
|
oxyloss = max(oxyloss + amount, 0)
|
|
if(old_oxyloss == oxyloss)
|
|
updating_health = FALSE
|
|
. = STATUS_UPDATE_NONE
|
|
else
|
|
. = STATUS_UPDATE_HEALTH
|
|
if(updating_health)
|
|
updatehealth("adjustOxyLoss")
|
|
|
|
/mob/living/proc/setOxyLoss(amount, updating_health = TRUE)
|
|
if(status_flags & GODMODE)
|
|
oxyloss = 0
|
|
return FALSE //godmode
|
|
if(HAS_TRAIT(src, TRAIT_NOBREATH))
|
|
oxyloss = 0
|
|
return FALSE
|
|
var/old_oxyloss = oxyloss
|
|
oxyloss = amount
|
|
if(old_oxyloss == oxyloss)
|
|
updating_health = FALSE
|
|
. = STATUS_UPDATE_NONE
|
|
else
|
|
. = STATUS_UPDATE_HEALTH
|
|
if(updating_health)
|
|
updatehealth("setOxyLoss")
|
|
|
|
/mob/living/proc/getToxLoss()
|
|
return toxloss
|
|
|
|
/mob/living/proc/adjustToxLoss(amount, updating_health = TRUE)
|
|
if(status_flags & GODMODE)
|
|
return FALSE //godmode
|
|
var/old_toxloss = toxloss
|
|
toxloss = max(toxloss + amount, 0)
|
|
if(old_toxloss == toxloss)
|
|
updating_health = FALSE
|
|
. = STATUS_UPDATE_NONE
|
|
else
|
|
. = STATUS_UPDATE_HEALTH
|
|
if(updating_health)
|
|
updatehealth("adjustToxLoss")
|
|
|
|
/mob/living/proc/setToxLoss(amount, updating_health = TRUE)
|
|
if(status_flags & GODMODE)
|
|
return FALSE //godmode
|
|
var/old_toxloss = toxloss
|
|
toxloss = amount
|
|
if(old_toxloss == toxloss)
|
|
updating_health = FALSE
|
|
. = STATUS_UPDATE_NONE
|
|
else
|
|
. = STATUS_UPDATE_HEALTH
|
|
if(updating_health)
|
|
updatehealth("setToxLoss")
|
|
|
|
/mob/living/proc/getFireLoss()
|
|
return fireloss
|
|
|
|
/mob/living/proc/adjustFireLoss(amount, updating_health = TRUE)
|
|
if(status_flags & GODMODE)
|
|
return FALSE //godmode
|
|
var/old_fireloss = fireloss
|
|
fireloss = max(fireloss + amount, 0)
|
|
if(old_fireloss == fireloss)
|
|
updating_health = FALSE
|
|
. = STATUS_UPDATE_NONE
|
|
else
|
|
. = STATUS_UPDATE_HEALTH
|
|
if(updating_health)
|
|
updatehealth("adjustFireLoss")
|
|
|
|
/mob/living/proc/getCloneLoss()
|
|
return cloneloss
|
|
|
|
/mob/living/proc/adjustCloneLoss(amount, updating_health = TRUE)
|
|
if(status_flags & GODMODE)
|
|
return FALSE //godmode
|
|
var/old_cloneloss = cloneloss
|
|
cloneloss = max(cloneloss + amount, 0)
|
|
if(old_cloneloss == cloneloss)
|
|
updating_health = FALSE
|
|
. = STATUS_UPDATE_NONE
|
|
else
|
|
. = STATUS_UPDATE_HEALTH
|
|
if(updating_health)
|
|
updatehealth("adjustCloneLoss")
|
|
|
|
/mob/living/proc/setCloneLoss(amount, updating_health = TRUE)
|
|
if(status_flags & GODMODE)
|
|
return FALSE //godmode
|
|
var/old_cloneloss = cloneloss
|
|
cloneloss = amount
|
|
if(old_cloneloss == cloneloss)
|
|
updating_health = FALSE
|
|
. = STATUS_UPDATE_NONE
|
|
else
|
|
. = STATUS_UPDATE_HEALTH
|
|
if(updating_health)
|
|
updatehealth("setCloneLoss")
|
|
|
|
/mob/living/proc/getBrainLoss()
|
|
return 0
|
|
|
|
/mob/living/proc/adjustBrainLoss(amount, updating = TRUE)
|
|
return STATUS_UPDATE_NONE
|
|
|
|
/mob/living/proc/setBrainLoss(amount, updating = TRUE)
|
|
return STATUS_UPDATE_NONE
|
|
|
|
/mob/living/proc/getStaminaLoss()
|
|
return staminaloss
|
|
|
|
/mob/living/proc/adjustStaminaLoss(amount, updating = TRUE)
|
|
if(status_flags & GODMODE)
|
|
return FALSE
|
|
var/old_stamloss = staminaloss
|
|
staminaloss = min(max(staminaloss + amount, 0), 120)
|
|
if(old_stamloss == staminaloss)
|
|
updating = FALSE
|
|
. = STATUS_UPDATE_NONE
|
|
else
|
|
. = STATUS_UPDATE_STAMINA
|
|
if(amount > 0)
|
|
stam_regen_start_time = world.time + (STAMINA_REGEN_BLOCK_TIME * stamina_regen_block_modifier)
|
|
if(updating)
|
|
update_stamina_hud()
|
|
update_stamina()
|
|
|
|
/mob/living/proc/setStaminaLoss(amount, updating = TRUE)
|
|
if(status_flags & GODMODE)
|
|
return FALSE
|
|
var/old_stamloss = staminaloss
|
|
staminaloss = min(max(amount, 0), 120)
|
|
if(old_stamloss == staminaloss)
|
|
updating = FALSE
|
|
. = STATUS_UPDATE_NONE
|
|
else
|
|
. = STATUS_UPDATE_STAMINA
|
|
if(amount > 0)
|
|
stam_regen_start_time = world.time + (STAMINA_REGEN_BLOCK_TIME * stamina_regen_block_modifier)
|
|
if(updating)
|
|
update_stamina_hud()
|
|
update_stamina()
|
|
|
|
/mob/living/proc/getMaxHealth()
|
|
return maxHealth
|
|
|
|
/mob/living/proc/setMaxHealth(newMaxHealth)
|
|
maxHealth = newMaxHealth
|
|
|
|
|
|
|
|
// heal ONE external organ, organ gets randomly selected from damaged ones.
|
|
/mob/living/proc/heal_organ_damage(brute, burn, updating_health = TRUE)
|
|
adjustBruteLoss(-brute, FALSE)
|
|
adjustFireLoss(-burn, FALSE)
|
|
if(updating_health)
|
|
updatehealth("heal organ damage")
|
|
|
|
// damage ONE external organ, organ gets randomly selected from damaged ones.
|
|
/mob/living/proc/take_organ_damage(brute, burn, updating_health = TRUE)
|
|
if(status_flags & GODMODE)
|
|
return FALSE //godmode
|
|
adjustBruteLoss(brute, FALSE)
|
|
adjustFireLoss(burn, FALSE)
|
|
if(updating_health)
|
|
updatehealth("take organ damage")
|
|
|
|
// heal MANY external organs, in random order
|
|
/mob/living/proc/heal_overall_damage(brute, burn, updating_health = TRUE)
|
|
adjustBruteLoss(-brute, FALSE)
|
|
adjustFireLoss(-burn, FALSE)
|
|
if(updating_health)
|
|
updatehealth("heal overall damage")
|
|
|
|
// damage MANY external organs, in random order
|
|
/mob/living/proc/take_overall_damage(brute, burn, updating_health = TRUE, used_weapon = null)
|
|
if(status_flags & GODMODE)
|
|
return FALSE //godmode
|
|
adjustBruteLoss(brute, FALSE)
|
|
adjustFireLoss(burn, FALSE)
|
|
if(updating_health)
|
|
updatehealth("take overall damage")
|
|
|
|
/mob/living/proc/has_organic_damage()
|
|
return (maxHealth - health)
|
|
|
|
//heal up to amount damage, in a given order
|
|
/mob/living/proc/heal_ordered_damage(amount, list/damage_types)
|
|
. = amount //we'll return the amount of damage healed
|
|
for(var/i in damage_types)
|
|
var/amount_to_heal = min(amount, get_damage_amount(i)) //heal only up to the amount of damage we have
|
|
if(amount_to_heal)
|
|
apply_damage_type(-amount_to_heal, i)
|
|
amount -= amount_to_heal //remove what we healed from our current amount
|
|
if(!amount)
|
|
break
|
|
. -= amount //if there's leftover healing, remove it from what we return
|