Files
Bubberstation/code/datums/status_effects/food_effects.dm
T
MrMelbertandGitHub 11843651f5 Allows status effects with alerts to display their duration (on the alert), adds it to a select handful (#83211)
## About The Pull Request

Plainly: Expands the status effect API so their alerts can showcase
duration remaining.


https://github.com/tgstation/tgstation/assets/51863163/02eaad84-ebb7-4af9-9895-977c6e71acc4

## Why It's Good For The Game

I figure there are some status effects out there which really want the
player to know how long the duration is.

And right now, for 95% of them, you have to code dive to find out. This
is rather punishing for players who... don't code dive.

At the same time, there are effects which *do* tell you how long they
last, which leaves it up to the player to intuit when it'll run out.
This can get a bit silly during lag, and again, punishes new players.

That's not to say I think every status effect should report how much
duration is left: **For very common effects, like sleeping, it should be
left up to the player to guess.** Otherwise we lose a lot of paranoia
and feeling of helplessness. (Also keep in mind this only applies to
status effects with alerts associated.)

Hence why I only added it, largely, to the more "gamified" buffs and
debuffs - Things from (generally) one or two sources and with a static
duration, (or things which already informed the player how long they
last).

Notable ones include Fleshmend, Convulsing (from emag defib), Regen
core.

## Changelog

🆑 Melbert
qol: Some alerts, such as Fleshmend's, show their remaining duration on
their icon.
/🆑
2024-05-14 08:36:23 +02:00

41 lines
1.3 KiB
Plaintext

/// Buffs given by eating hand-crafted food. The duration scales with consumable reagents purity.
/datum/status_effect/food
id = "food_buff"
duration = 5 MINUTES // Same as food mood buffs
status_type = STATUS_EFFECT_REPLACE // Only one food buff allowed
alert_type = /atom/movable/screen/alert/status_effect/food
show_duration = TRUE
/// Buff power
var/strength
/datum/status_effect/food/on_creation(mob/living/new_owner, timeout_mod = 1, strength = 1)
src.strength = strength
//Generate alert when not specified
if(isnum(timeout_mod))
duration *= timeout_mod
. = ..()
if(istype(linked_alert, /atom/movable/screen/alert/status_effect/food))
linked_alert.icon_state = "[linked_alert.base_icon_state]_[strength]"
/atom/movable/screen/alert/status_effect/food
name = "Hand-crafted meal"
desc = "Eating it made me feel better."
icon_state = "food_buff_1"
base_icon_state = "food_buff"
/// Makes you gain a trait
/datum/status_effect/food/trait
var/trait = TRAIT_DUMB // You need to override this
/datum/status_effect/food/trait/on_apply()
ADD_TRAIT(owner, trait, type)
return ..()
/datum/status_effect/food/trait/be_replaced()
REMOVE_TRAIT(owner, trait, type)
return ..()
/datum/status_effect/food/trait/on_remove()
REMOVE_TRAIT(owner, trait, type)
return ..()