Files
S.P.L.U.R.T-Station-13/code/modules/mob/living/stamina_buffer.dm
b7a1e1e0b2 Upstream merge (#169)
* changes

* changes

* changes

* changes

* changes

* changes

* removes combat mode effects

* changes

* changes

* changes

* changes

* changes

* changes

* changes

* less awful

* baton change

* whew

* okay

* math fix

* framework

* Oh Boy

* fixes

* conflict gone

* whew

* yell wip

* ripping off my own code

* fixes

* almost compiling

* e

* auto

* hacky

* local testing time

* modifications

* sigh

* Yelling works

* attempt examinate

* fix

* yelling

* ok

* it works

* it works.

* woo

* let's make this work

* Update PubbyStation.dmm

* Incinerator mapping tweak

* qm can announce to station

* blue airlocks (maybe will remove that)

* changes to HoP access

he couldn't access cargo already, now it's just polished so they don't have weird cargo access that they can't use

* changes Box HoP console to request only (like in the other maps)

* wtf why is this here

* and WHY is this here too???

* Revert "and WHY is this here too???"

This reverts commit 424a53773296eaf261c97992c618c580449f6031.

* Revert "wtf why is this here"

This reverts commit 59fdca38b55ce97ab5bdf28cbea7fb3b9915474e.

* Automatic changelog compile [ci skip]

* Automatic changelog compile [ci skip]

* Automatic changelog compile [ci skip]

* Automatic changelog compile [ci skip]

* Automatic changelog compile [ci skip]

* Automatic changelog compile [ci skip]

* Update PubbyStation.dmm

* Adds plushies from various sources/custom made.

A patch you didn't know you needed.

* More code. Shouldn't break anything.

We'll see if it does.

* Adds a rolled up newspaper sprite

* Adds a child item to the telebaton

identical stats for the future but different looks.

* And a recipe.

You attach a newspaper to a telebaton with tape.

* all the stuff to add pod to code

* The actual map

* Automatic changelog compile [ci skip]

* A

* Automatic changelog generation for PR #14822 [ci skip]

* Automatic changelog generation for PR #14895 [ci skip]

* Automatic changelog generation for PR #14861 [ci skip]

* Automatic changelog generation for PR #14893 [ci skip]

* Automatic changelog generation for PR #14899 [ci skip]

* Automatic changelog generation for PR #14883 [ci skip]

* Okay, let's try this again.

I don't like you, you don't like me,
can we please just get along?

* e

* Automatic changelog generation for PR #14904 [ci skip]

* Automatic changelog compile [ci skip]

Co-authored-by: silicons <2003111+silicons@users.noreply.github.com>
Co-authored-by: bunny232 <bunnyracer23@yahoo.com>
Co-authored-by: qweq12yt <45515587+qweq12yt@users.noreply.github.com>
Co-authored-by: Changelogs <action@github.com>
Co-authored-by: WanderingFox95 <75953558+WanderingFox95@users.noreply.github.com>
Co-authored-by: shellspeed1 <46614774+shellspeed1@users.noreply.github.com>
Co-authored-by: Lin <linzolle@gmail.com>
Co-authored-by: CitadelStationBot <citadelstationcommunity@gmail.com>
2021-06-30 12:12:52 -03:00

56 lines
2.5 KiB
Plaintext

/**
* Attempts to use an amount of stamina from our stamina buffer.
* Does not use anything if we don't have enough.
*
* Returns TRUE or FALSE based on if we have it.
*/
/mob/living/proc/UseStaminaBuffer(amount, warn = FALSE, considered_action = TRUE)
if(!(combat_flags & COMBAT_FLAG_STAMINA_BUFFER))
return TRUE
if(stamina_buffer < amount)
var/stamina_health = getStaminaLoss()
if(stamina_health > STAMINA_NO_OVERDRAW_THRESHOLD)
if(warn)
to_chat(src, "<span class='warning'>You do not have enough action stamina to do that!</span>")
return FALSE
adjustStaminaLoss(amount * CONFIG_GET(number/stamina_combat/overdraw_penalty_factor))
else
stamina_buffer -= amount
if(considered_action)
stamina_buffer_last_use = world.time
UpdateStaminaBuffer()
return TRUE
/**
* Updates our stamina buffer amount.
*/
/mob/living/proc/UpdateStaminaBuffer(updating_hud = TRUE)
var/time = world.time - stamina_buffer_regen_last
CONFIG_CACHE_ENTRY_AND_FETCH_VALUE(number/stamina_combat/buffer_max, buffer_max)
stamina_buffer_regen_last = world.time
if((stamina_buffer >= buffer_max) || !(combat_flags & COMBAT_FLAG_STAMINA_BUFFER))
stamina_buffer = buffer_max
return
else if(!time || HAS_TRAIT(src, TRAIT_NO_STAMINA_BUFFER_REGENERATION))
return
CONFIG_CACHE_ENTRY_AND_FETCH_VALUE(number/stamina_combat/out_of_combat_timer, out_of_combat_timer)
CONFIG_CACHE_ENTRY_AND_FETCH_VALUE(number/stamina_combat/base_regeneration, base_regeneration)
CONFIG_CACHE_ENTRY_AND_FETCH_VALUE(number/stamina_combat/percent_regeneration_out_of_combat, percent_regeneration_out_of_combat)
CONFIG_CACHE_ENTRY_AND_FETCH_VALUE(number/stamina_combat/post_action_penalty_delay, post_action_penalty_delay)
CONFIG_CACHE_ENTRY_AND_FETCH_VALUE(number/stamina_combat/post_action_penalty_factor, post_action_penalty_factor)
var/base_regen = base_regeneration
var/time_since_last_action = world.time - stamina_buffer_last_use
var/action_penalty = ((time_since_last_action) < (post_action_penalty_delay * 10))? post_action_penalty_factor : 1
var/out_of_combat_bonus = (time_since_last_action < (out_of_combat_timer * 10))? 0 : ((buffer_max * percent_regeneration_out_of_combat * 0.01))
var/regen = ((base_regen * action_penalty) + out_of_combat_bonus) * time * 0.1 * stamina_buffer_regen_mod
stamina_buffer += min((buffer_max - stamina_buffer), regen)
if(updating_hud)
hud_used?.staminabuffer?.mark_dirty()
/**
* Boosts our stamina buffer by this much.
*/
/mob/living/proc/RechargeStaminaBuffer(amount)
stamina_buffer += abs(amount)
UpdateStaminaBuffer()