Files
Bubberstation/code/datums/elements/ignites_matches.dm
MrMelbert 586710e0d4 You can light a match on the heel of your boot (#88690)
## About The Pull Request

- Matches can be ignited with boots.
- Matches have a rare chance of failing to ignite (prompting you to try
again) or an even rarer chance of snapping (wasting it).
- Also makes ignition span use mostly-consistent (using rose span for
the "cooler" ignition effects).

## Why It's Good For The Game

You may be thinking "hey, matches won't light on just friction unless
they're from the 1800s", and you'd be right. But it's a cool movie
trope, which means it should be possible, I don't make the rules.

## Changelog

🆑 Melbert
add: You can light matches on the heel of your boots - Just don't do it
too hard.
/🆑
2025-01-06 03:16:59 +01:00

40 lines
1.5 KiB
Plaintext

/// Ignites matches swiped over it.
/datum/element/ignites_matches
/datum/element/ignites_matches/Attach(datum/target)
. = ..()
RegisterSignal(target, COMSIG_ATOM_ITEM_INTERACTION, PROC_REF(on_interact))
/datum/element/ignites_matches/Detach(datum/source)
UnregisterSignal(source, COMSIG_ATOM_ITEM_INTERACTION)
return ..()
/datum/element/ignites_matches/proc/on_interact(atom/source, mob/living/user, obj/item/match/match, ...)
SIGNAL_HANDLER
if(!istype(match) || match.lit || match.burnt || match.broken)
return NONE
if(SHOULD_SKIP_INTERACTION(source, match, user))
return NONE
var/over_what_tp = source.loc == user ? "[user.p_their()] [source.name]" : source
var/over_what_fp = source.loc == user ? "your [source.name]" : source
if(prob(10))
user.visible_message(
span_warning("[user] swipes [match] over [over_what_tp], but nothing happens."),
span_warning("You swipe [match] over [over_what_fp], but it fails to ignite."),
)
return ITEM_INTERACT_SUCCESS
if(prob((HAS_TRAIT(user, TRAIT_CLUMSY) || HAS_TRAIT(user, TRAIT_HULK)) ? 33 : 2))
user.visible_message(
span_warning("[user] swipes [match] over [over_what_tp], accidentally snapping it."),
span_warning("You swipe [match] over [over_what_fp] too fast, snapping it in half."),
)
match.snap()
return ITEM_INTERACT_SUCCESS
user.visible_message(
span_rose("[user] swipes [match] over [over_what_tp], igniting it."),
span_rose("You swipe [match] over [over_what_fp], igniting it."),
)
match.matchignite()
return ITEM_INTERACT_SUCCESS