Most fleshy mobs are vulnerable to stamina and stuns (#90675)

## About The Pull Request

This PR enables most mobs to take stamina damage, become slowed as a
result of taking stamina damage.
It also gives most mobs CANSTUN which not only allows them to enter
stamcrit from taking stamina damage but also makes them vulnerable to
mechanics like stun batons.

Mobs which already took stamina damage (Spiders and Space Dragons) still
work the same way.
Mechanical or artificial mobs, mining mobs, simple xenomorphs, ghosts,
and most kinds of mob closely associated with antagonists still don't
take stamina damage.

## Why It's Good For The Game

A new player armed with a disabler will probably try and use it on
aggressive animals and be disappointed, but I don't think there is any
_reason_ for them to be disappointed when it's already something they
are doing merely to delay being attacked rather than to kill the target.
It's not intuitive for these mechanics not to function against simple
mobs when they do against humans, _especially_ the kinds of mobs which
look like humans, and there isn't any technical reason why it _couldn't_
work against most mobs which it looks like they should work against.

While this reduces the threat level of some mobs against Security
players I think the greater interaction with the sandbox is beneficial.
I'm hopeful it doesn't have that much effect on many of the most common
places you encounter dangerous mobs like Space Ruins or Gateways as they
are also places where you can't reliably recharge your energy-based
stamina weapons as most that don't require energy do require getting
into melee and endangering yourself.

## Changelog

🆑
balance: Most biological mobs are now slowed by taking stamina damage,
and can be stunned. Mechanical mobs, mining mobs, and several other
special kinds (chiefly those invoked by antagonists) are unaffected. If
this seems to effect any mob it probably shouldn't, please report it as
a bug.
/🆑
This commit is contained in:
Jacquerel
2025-05-10 20:05:53 +01:00
committed by GitHub
parent e706689c15
commit d19b8de989
56 changed files with 162 additions and 34 deletions
+19 -9
View File
@@ -4,17 +4,22 @@
icon = 'icons/mob/simple/animal.dmi'
health = 20
maxHealth = 20
max_stamina = BASIC_MOB_STAMINA_MATCH_HEALTH
gender = PLURAL
living_flags = MOVES_ON_ITS_OWN
status_flags = CANPUSH
status_flags = CANPUSH | CANSTUN
fire_stack_decay_rate = -5 // Reasonably fast as NPCs will not usually actively extinguish themselves
var/basic_mob_flags = NONE
///Defines how fast the basic mob can move. This is not a multiplier
var/speed = 1
///How much stamina the mob recovers per second
var/stamina_recovery = 5
///How much stamina the mob recovers per second, if set to >0 stamina loses its normal function of resetting after a set amount of time
var/stamina_recovery = 0
///How slow will we get when we lose all our stamina?
var/max_stamina_slowdown = 3
///Percentage of max stamina loss we need to lose in order to get stunned
var/stamina_crit_threshold = 100
///how much damage this basic mob does to objects, if any.
var/obj_damage = 0
@@ -42,7 +47,7 @@
var/environment_smash = ENVIRONMENT_SMASH_STRUCTURES
/// 1 for full damage, 0 for none, -1 for 1:1 heal from that source.
var/list/damage_coeff = list(BRUTE = 1, BURN = 1, TOX = 1, STAMINA = 0, OXY = 1)
var/list/damage_coeff = list(BRUTE = 1, BURN = 1, TOX = 1, STAMINA = 1, OXY = 1)
///Verbs used for speaking e.g. "Says" or "Chitters". This can be elementized
var/list/speak_emote = list()
@@ -111,6 +116,8 @@
stack_trace("Basic mob being instantiated in nullspace")
update_basic_mob_varspeed()
apply_target_randomisation()
make_stamina_slowable()
if(speak_emote)
speak_emote = string_list(speak_emote)
@@ -121,7 +128,6 @@
return
apply_atmos_requirements(mapload)
apply_temperature_requirements(mapload)
apply_target_randomisation()
/mob/living/basic/proc/on_ssair_init(datum/source)
SIGNAL_HANDLER
@@ -143,6 +149,14 @@
return
AddElement(/datum/element/body_temp_sensitive, minimum_survivable_temperature, maximum_survivable_temperature, unsuitable_cold_damage, unsuitable_heat_damage, mapload)
/// Ensures that this mob can be slowed from taking stamina damage
/mob/living/basic/proc/make_stamina_slowable()
if (max_stamina == BASIC_MOB_STAMINA_MATCH_HEALTH)
max_stamina = maxHealth
if (damage_coeff[STAMINA] <= 0 || max_stamina <= 0 || max_stamina_slowdown <= 0)
return
AddElement(/datum/element/basic_stamina_slowdown, minium_stamina_threshold = max_stamina / 3, maximum_stamina = max_stamina, maximum_slowdown = max_stamina_slowdown)
/mob/living/basic/proc/apply_target_randomisation()
if (basic_mob_flags & PRECISE_ATTACK_ZONES)
return
@@ -285,10 +299,6 @@
/mob/living/basic/compare_sentience_type(compare_type)
return sentience_type == compare_type
/// Updates movement speed based on stamina loss
/mob/living/basic/update_stamina()
set_varspeed(initial(speed) + (staminaloss * 0.06))
/mob/living/basic/on_fire_stack(seconds_per_tick, datum/status_effect/fire_handler/fire_stacks/fire_handler)
adjust_bodytemperature((maximum_survivable_temperature + (fire_handler.stacks * 12)) * 0.5 * seconds_per_tick)