mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2025-12-20 22:54:46 +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>
73 lines
1.9 KiB
Plaintext
73 lines
1.9 KiB
Plaintext
GLOBAL_LIST_INIT(creamable, typecacheof(list(
|
|
/mob/living/carbon/human,
|
|
/mob/living/basic/pet/dog/corgi,
|
|
/mob/living/silicon/ai)))
|
|
|
|
/**
|
|
* Creamed component
|
|
*
|
|
* For when you have pie on your face
|
|
*/
|
|
/datum/component/creamed
|
|
dupe_mode = COMPONENT_DUPE_UNIQUE_PASSARGS
|
|
|
|
var/mutable_appearance/creamface
|
|
|
|
/datum/component/creamed/Initialize()
|
|
if(!is_type_in_typecache(parent, GLOB.creamable))
|
|
return COMPONENT_INCOMPATIBLE
|
|
|
|
SEND_SIGNAL(parent, COMSIG_MOB_CREAMED)
|
|
|
|
add_memory_in_range(parent, 7, /datum/memory/witnessed_creampie, protagonist = parent)
|
|
|
|
creamface = mutable_appearance('icons/effects/creampie.dmi')
|
|
|
|
if(ishuman(parent))
|
|
var/mob/living/carbon/human/H = parent
|
|
if(H.dna.species.bodytype & BODYTYPE_SNOUTED)
|
|
creamface.icon_state = "creampie_lizard"
|
|
else if(H.dna.species.bodytype & BODYTYPE_MONKEY)
|
|
creamface.icon_state = "creampie_monkey"
|
|
else
|
|
creamface.icon_state = "creampie_human"
|
|
H.add_mood_event("creampie", /datum/mood_event/creampie)
|
|
else if(iscorgi(parent))
|
|
creamface.icon_state = "creampie_corgi"
|
|
else if(isAI(parent))
|
|
creamface.icon_state = "creampie_ai"
|
|
|
|
var/atom/A = parent
|
|
A.add_overlay(creamface)
|
|
|
|
/datum/component/creamed/Destroy(force, silent)
|
|
var/atom/A = parent
|
|
A.cut_overlay(creamface)
|
|
qdel(creamface)
|
|
if(ishuman(A))
|
|
var/mob/living/carbon/human/human_parent = A
|
|
human_parent.clear_mood_event("creampie")
|
|
return ..()
|
|
|
|
/datum/component/creamed/RegisterWithParent()
|
|
RegisterSignals(parent, list(
|
|
COMSIG_COMPONENT_CLEAN_ACT,
|
|
COMSIG_COMPONENT_CLEAN_FACE_ACT),
|
|
PROC_REF(clean_up)
|
|
)
|
|
|
|
/datum/component/creamed/UnregisterFromParent()
|
|
UnregisterSignal(parent, list(
|
|
COMSIG_COMPONENT_CLEAN_ACT,
|
|
COMSIG_COMPONENT_CLEAN_FACE_ACT))
|
|
|
|
///Callback to remove pieface
|
|
/datum/component/creamed/proc/clean_up(datum/source, clean_types)
|
|
SIGNAL_HANDLER
|
|
|
|
. = NONE
|
|
if(!(clean_types & CLEAN_TYPE_BLOOD))
|
|
return
|
|
qdel(src)
|
|
return COMPONENT_CLEANED
|