mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2025-12-30 19:41:56 +00:00
* Refactors memories to be less painful to add and apply, moves memory detail / text to memory subtypes. Adds some new memories to demonstrate. (#72110) So, a huge issue with memories and - what I personally believe is the reason why not many have been added since their inception is - they're very annoying to add! Normally, adding subtypes of stuff like traumas or hallucinations are as easy as doing just that, adding a subtype. But memories used this factory argument passing method combined with holding all their strings in a JSON file which made it just frustrating to add, debug, or just mess with. It also made it much harder to organize new memories keep it clean for stuff like downstreams. So I refactored it. Memories are now handled on a subtype by subtype basis, instead of all memories being a `/datum/memory`. Any variety of arguments can be passed into memories like addcomponent (KWARGS) so each subtype can have their own `new` parameters. This makes it much much easier to add a new memory. All you need to do is make your subtype and add it somewhere. Don't need to mess with jsons or defines or anything. To demonstrate this, I added a few memories. Some existing memories had their story values tweak to compensate. Makes it way simpler to add new memories. Maybe we'll get some more fun ones now? 🆑 Melbert add: Roundstart captains will now memorize the code to the spare ID safe. add: Traitors will now memorize the location and code to their uplink. add: Heads of staff winning a revolution will now get a memory of their success. add: Heads of staff and head revolutionaries who lose their respective sides of the revolution also get a memory of their failure. add: Completing a ritual of knowledge as a heretic grants you a quality memory. add: Successfully defusing a bomb now grants you a cool memory. Failing it will also grant you a memory, though you will likely not be alive to see it. add: Planting bombs now increase their memory quality depending on how cool the bomb is. refactor: Memories have been refactored to be much easier to add. /🆑 * Modular! Co-authored-by: MrMelbert <51863163+MrMelbert@users.noreply.github.com> Co-authored-by: Funce <funce.973@gmail.com>
93 lines
3.5 KiB
Plaintext
93 lines
3.5 KiB
Plaintext
/**
|
|
* # High Fiver Element
|
|
*
|
|
* Attach to an item to make it offer a "high five" when offered to people
|
|
*/
|
|
/datum/element/high_fiver
|
|
|
|
/datum/element/high_fiver/Attach(datum/target)
|
|
. = ..()
|
|
if(!isitem(target))
|
|
return ELEMENT_INCOMPATIBLE
|
|
|
|
RegisterSignal(target, COMSIG_ITEM_OFFERING, PROC_REF(on_offer))
|
|
RegisterSignal(target, COMSIG_ITEM_OFFER_TAKEN, PROC_REF(on_offer_taken))
|
|
|
|
/datum/element/high_fiver/Detach(datum/source, ...)
|
|
. = ..()
|
|
UnregisterSignal(source, list(COMSIG_ITEM_OFFERING, COMSIG_ITEM_OFFER_TAKEN))
|
|
|
|
/// Signal proc for [COMSIG_ITEM_OFFERING] to set up the high-five on offer
|
|
/datum/element/high_fiver/proc/on_offer(obj/item/source, mob/living/carbon/offerer)
|
|
SIGNAL_HANDLER
|
|
|
|
if(locate(/mob/living/carbon) in orange(1, offerer))
|
|
offerer.visible_message(
|
|
span_notice("[offerer] raises [offerer.p_their()] arm, looking for a high-five!"),
|
|
span_notice("You post up, looking for a high-five!"),
|
|
vision_distance = 2,
|
|
)
|
|
offerer.apply_status_effect(/datum/status_effect/offering, source, /atom/movable/screen/alert/give/highfive)
|
|
|
|
else
|
|
offerer.visible_message(
|
|
span_danger("[offerer] raises [offerer.p_their()] arm, looking around for a high-five, but there's no one around!"),
|
|
span_warning("You post up, looking for a high-five, but find no one to accept it..."),
|
|
vision_distance = 4,
|
|
)
|
|
|
|
return COMPONENT_OFFER_INTERRUPT
|
|
|
|
/// Signal proc for [COMSIG_ITEM_OFFER_TAKEN] to continue through with the high-five on take
|
|
/datum/element/high_fiver/proc/on_offer_taken(obj/item/source, mob/living/carbon/offerer, mob/living/carbon/taker)
|
|
SIGNAL_HANDLER
|
|
|
|
var/open_hands_taker = 0
|
|
var/slappers_giver = 0
|
|
// see how many hands the taker has open for high'ing
|
|
for(var/hand in taker.held_items)
|
|
if(isnull(hand))
|
|
open_hands_taker++
|
|
|
|
// see how many hands the offerer is using for high'ing
|
|
for(var/obj/item/slap_check in offerer.held_items)
|
|
if(slap_check.item_flags & HAND_ITEM)
|
|
slappers_giver++
|
|
|
|
var/high_ten = (slappers_giver >= 2)
|
|
var/descriptor = "high-[high_ten ? "ten" : "five"]"
|
|
|
|
if(open_hands_taker <= 0)
|
|
to_chat(taker, span_warning("You can't [descriptor] [offerer] with no open hands!"))
|
|
taker.add_mood_event(descriptor, /datum/mood_event/high_five_full_hand) // not so successful now!
|
|
return COMPONENT_OFFER_INTERRUPT
|
|
|
|
playsound(offerer, 'sound/weapons/slap.ogg', min(50 * slappers_giver, 300), TRUE, 1)
|
|
offerer.add_mob_memory(/datum/memory/high_five, deuteragonist = taker, high_five_type = descriptor, high_ten = high_ten)
|
|
taker.add_mob_memory(/datum/memory/high_five, deuteragonist = offerer, high_five_type = descriptor, high_ten = high_ten)
|
|
|
|
if(high_ten)
|
|
to_chat(taker, span_nicegreen("You give high-tenning [offerer] your all!"))
|
|
offerer.visible_message(
|
|
span_notice("[taker] enthusiastically high-tens [offerer]!"),
|
|
span_nicegreen("Wow! You're high-tenned [taker]!"),
|
|
span_hear("You hear a sickening sound of flesh hitting flesh!"),
|
|
ignored_mobs = taker,
|
|
)
|
|
|
|
offerer.add_mood_event(descriptor, /datum/mood_event/high_ten)
|
|
taker.add_mood_event(descriptor, /datum/mood_event/high_ten)
|
|
else
|
|
to_chat(taker, span_nicegreen("You high-five [offerer]!"))
|
|
offerer.visible_message(
|
|
span_notice("[taker] high-fives [offerer]!"),
|
|
span_nicegreen("All right! You're high-fived by [taker]!"),
|
|
span_hear("You hear a sickening sound of flesh hitting flesh!"),
|
|
ignored_mobs = taker,
|
|
)
|
|
|
|
offerer.add_mood_event(descriptor, /datum/mood_event/high_five)
|
|
taker.add_mood_event(descriptor, /datum/mood_event/high_five)
|
|
|
|
return COMPONENT_OFFER_INTERRUPT
|