Skip to content

Commit

Permalink
Removes Memories, returns Notes in their place. (#1101)
Browse files Browse the repository at this point in the history
* removes memories, adds notes

* fixes and tweaks
  • Loading branch information
Kapu1178 authored Oct 28, 2024
1 parent 0c607a1 commit 4afde47
Show file tree
Hide file tree
Showing 39 changed files with 162 additions and 926 deletions.
165 changes: 6 additions & 159 deletions code/__DEFINES/memory_defines.dm
Original file line number Diff line number Diff line change
@@ -1,165 +1,12 @@
///name of the file that has all the memory strings
#define MEMORY_FILE "memories.json"
#define NOTES_CUSTOM "Custom"
#define NOTES_BANK_ACCOUNT "Bank"
#define NOTES_ANTAG "Antag"
#define NOTES_TRAITS "Traits"

///name of the file that has all the saved engravings
#define ENGRAVING_SAVE_FILE "data/engravings/[SSmapping.config.map_name]_engravings.json"
///name of the file that has all the prisoner tattoos
#define PRISONER_TATTOO_SAVE_FILE "data/engravings/prisoner_tattoos.json"
///Current version of the engraving persistence json
#define ENGRAVING_PERSISTENCE_VERSION 0
///Current version of the tattoo persistence json
#define TATTOO_PERSISTENCE_VERSION 0

#define ENGRAVING_PERSISTENCE_VERSION 1
///how many engravings will be loaded max with persistence
#define MIN_PERSISTENT_ENGRAVINGS 15
#define MAX_PERSISTENT_ENGRAVINGS 25

///threshold for the memory being a happy one 8)
#define MEMORY_HAPPY_THRESHOLD 7
///threshold for the memory being a sad one :^(
#define MEMORY_SAD_THRESHOLD 7
///moodlet set if the creature with the memory doesn't use mood (doesn't include mood line)
#define MOODLESS_MEMORY "nope"

///Factor of how beauty is divided to make the engraving art value
#define ENGRAVING_BEAUTY_TO_ART_FACTOR 10
//Factor on how much beauty is removed from before adding the element on old engravings
#define ENGRAVING_PERSISTENCE_BEAUTY_LOSS_FACTOR 5

///How cool a story is!
#define STORY_VALUE_SHIT 0 // poo icon
#define STORY_VALUE_NONE 1 // |: face
#define STORY_VALUE_MEH 2 // bronze star
#define STORY_VALUE_OKAY 3 // silver star
#define STORY_VALUE_AMAZING 4 //gold star
#define STORY_VALUE_LEGENDARY 5 //platinum star

//Flags for memories
///this memory doesn't have a location, emit that
#define MEMORY_FLAG_NOLOCATION (1<<0)
///this memory shouldn't include the station name (example: revolution memory)
#define MEMORY_FLAG_NOSTATIONNAME (1<<1)
///this memory is REALLY shit and should never be saved in persistence, basically apply this to all quirks.
#define MEMORY_FLAG_NOPERSISTENCE (1<<2)
///this memory has already been engraved, and cannot be selected for engraving again.
#define MEMORY_FLAG_ALREADY_USED (1<<3)
///this memory requires the target not to be blind.
#define MEMORY_CHECK_BLINDNESS (1<<4)
///this memory requires the target not to be deaf.
#define MEMORY_CHECK_DEAFNESS (1<<5)
///this memory requires the target not to be both deaf and blind.
#define MEMORY_CHECK_BLIND_AND_DEAF (MEMORY_CHECK_BLINDNESS|MEMORY_CHECK_DEAFNESS)
///this memory can be memorized by unconscious people.
#define MEMORY_SKIP_UNCONSCIOUS (1<<6)

// These defines are for what notable event happened. they correspond to the json lists related to the memory
/// A memory of completing a surgery.
#define MEMORY_SUCCESSFUL_SURGERY "surgery"
/// A memory of priming a bomb
#define MEMORY_BOMB_PRIMED "bomb"
/// A memory of pulling off either a high five or a high ten
#define MEMORY_HIGH_FIVE "highfive"
/// A memory of getting borged
#define MEMORY_BORGED "borged"
/// A memory of dying! includes time of death
#define MEMORY_DEATH "death"
/// A memory of being creampied! Mentions where
#define MEMORY_CREAMPIED "creampied"
/// A memory of being slipped! Mentions on what
#define MEMORY_SLIPPED "slipped"
/// A memory of letting my spaghetti spill, how embarrasing!
#define MEMORY_SPAGHETTI_SPILL "spaghetti_spilled"
/// A memory of getting a kiss blown. Provides the kisser and kissee.
#define MEMORY_KISS "kiss"
/// A memory of a really good meal
#define MEMORY_MEAL "meal"
/// A memory of a really good drink
#define MEMORY_DRINK "drink"
/// A memory of being lit
#define MEMORY_FIRE "fire"
/// A memory of limb loss
#define MEMORY_DISMEMBERED "dismembered"
/// A memory of seeing a pet die
#define MEMORY_PET_DEAD "pet_dead"
/// A memory of leading a winning revolution
#define MEMORY_WON_REVOLUTION "won_revolution"
/// An award ceremony of a medal
#define MEMORY_RECEIVED_MEDAL "received_medal"
/// A megafauna kill!
#define MEMORY_MEGAFAUNA_KILL "megafauna_kill"
/// Being held at gunpoint
#define MEMORY_GUNPOINT "held_at_gunpoint"
/// Exploding into gibs
#define MEMORY_GIBBED "gibbed"
/// Crushed by vending machine
#define MEMORY_VENDING_CRUSHED "vending_crushed"
/// Dusted by SM
#define MEMORY_SUPERMATTER_DUSTED "supermatter_dusted"
/// Nuke ops nuke code memory
#define MEMORY_NUKECODE "nuke_code"
/// A memory of having to play 52 card pickup
#define MEMORY_PLAYING_52_PICKUP "playing_52_pickup"
/// A memory of playing cards with others
#define MEMORY_PLAYING_CARDS "playing_cards"


/**
* These are also memories, but they're examples of what I kinda don't want to be memories. They're stuff that I had to port
* over to this system from the old old and they don't make for good examples
*
* ideally these eventually get moved off this system... though engraving your bank account is so HILARIOUSLY dumb so maybe leave that one
*/
///your memorized bank account
#define MEMORY_ACCOUNT "account"
///your memorized drug
#define MEMORY_QUIRK_DRUG "quirk_drug"
///your allergy
#define MEMORY_ALLERGY "allergy"

//These defines are for what the story is for, they should be defined as what part of the json file they interact with
///wall engraving stories
#define STORY_ENGRAVING "engraving"
///changeling memory reading
#define STORY_CHANGELING_ABSORB "changeling_absorb"
///tattoos
#define STORY_TATTOO "tattoo"

//These defines are story flags for including special bits on the generated story.
///include a date this event happened
#define STORY_FLAG_DATED (1<<0)

///Generic memory info keys. Use these whenever one of these is the case in a story, because we add extra story piece if these exist.
///The location of the memory, add these to have a chance of it being added to the story
#define DETAIL_WHERE "WHERE"
///The main subject of the memory. Should be whoever has the biggest impact on the story. (As it grabs the memory from this person)
#define DETAIL_PROTAGONIST "PROTAGONIST"
///Usually used bespokely by specific memory types and not added generically, but its generaly the object used to cause the memory. E.g. a peel to slip, the food that was eaten.
#define DETAIL_WHAT_BY "WHAT_BY"
///Used whenever a memory has a secondary character. Used bespokely by actions.
#define DETAIL_DEUTERAGONIST "DEUTERAGONIST"
///Automatically obtained details
#define DETAIL_PROTAGONIST_MOOD "VICTIM_MOOD"

//Specific memory info keys. they are used to replace json strings with memory specific data!
#define DETAIL_SURGERY_TYPE "SURGERY_TYPE"
#define DETAIL_TIME_OF_DEATH "TIME_OF_DEATH"
#define DETAIL_ALLERGY_TYPE "ALLERGY_TYPE"
#define DETAIL_FAV_BRAND "FAV_BRAND"
#define DETAIL_HIGHFIVE_TYPE "HIGHFIVE_TYPE"
#define DETAIL_BOMB_TYPE "BOMB_TYPE"
#define DETAIL_ACCOUNT_ID "ACCOUNT_ID"
#define DETAIL_ACCOUNT_PIN "ACCOUNT_PIN"
#define DETAIL_KISSER "KISSER"
#define DETAIL_FOOD "FOOD"
#define DETAIL_DRINK "DRINK"
#define DETAIL_LOST_LIMB "LOST_LIMB"
#define DETAIL_STATION_NAME "STATION_NAME"
#define DETAIL_MEDAL_TYPE "MEDAL_TYPE"
#define DETAIL_MEDAL_REASON "MEDAL_REASON"
#define DETAIL_NUKE_CODE "NUKE_CODE"
// for cardgames
#define DETAIL_PLAYERS "PLAYERS"
#define DETAIL_CARDGAME "CARDGAME"
#define DETAIL_DEALER "DEALER"
#define DETAIL_HELD_CARD_ITEM "HELD_CARD_ITEM" // could either be a singlecard, cardhand, or a deck


99 changes: 0 additions & 99 deletions code/__HELPERS/memory_helpers.dm

This file was deleted.

2 changes: 1 addition & 1 deletion code/_compile_options.dm
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@
/////////////////////// MISC PERFORMANCE

//uncomment this to load centcom and runtime station and thats it.
#define LOWMEMORYMODE
// #define LOWMEMORYMODE

//uncomment to enable the spatial grid debug proc.
// #define SPATIAL_GRID_ZLEVEL_STATS
Expand Down
1 change: 0 additions & 1 deletion code/_globalvars/lists/maintenance_loot.dm
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,6 @@ GLOBAL_LIST_INIT(rarity_loot, list(//rare: really good items
/obj/item/book/granter/crafting_recipe/trash_cannon = 1,
/obj/item/disk/nuclear/fake = 1,
/obj/item/skillchip/brainwashing = 1,
/obj/item/tattoo_kit = 1,
) = 1,

))
Expand Down
2 changes: 1 addition & 1 deletion code/controllers/subsystem/job.dm
Original file line number Diff line number Diff line change
Expand Up @@ -622,7 +622,7 @@ SUBSYSTEM_DEF(job)
var/mob/living/carbon/human/wageslave = equipping
var/datum/bank_account/bank = SSeconomy.bank_accounts_by_id["[wageslave.account_id]"]

wageslave.mind.add_memory(MEMORY_ACCOUNT, list(DETAIL_ACCOUNT_ID = wageslave.account_id, DETAIL_ACCOUNT_PIN = bank.account_pin), story_value = STORY_VALUE_SHIT, memory_flags = MEMORY_FLAG_NOLOCATION)
wageslave.mind.set_note(NOTES_BANK_ACCOUNT, list("Account ID: [wageslave.account_id]<br>Account PIN: [bank.account_pin]"))
to_chat(player_client, span_obviousnotice("Your bank account pin is: <b>[bank.account_pin]</b>"))

setup_alt_job_items(wageslave, job, player_client) //PARIAH EDIT ADDITION
Expand Down
61 changes: 0 additions & 61 deletions code/controllers/subsystem/persistence.dm
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,6 @@ SUBSYSTEM_DEF(persistence)

///instantiated wall engraving components
var/list/wall_engravings = list()
///tattoo stories that we're saving.
var/list/prison_tattoos_to_save = list()
///tattoo stories that have been selected for this round.
var/list/prison_tattoos_to_use = list()
var/list/saved_messages = list()
var/list/saved_modes = list(1,2,3)
var/list/saved_maps = list()
Expand All @@ -25,7 +21,6 @@ SUBSYSTEM_DEF(persistence)
/datum/controller/subsystem/persistence/Initialize()
LoadPoly()
load_wall_engravings()
load_prisoner_tattoos()
LoadTrophies()
LoadRecentMaps()
LoadPhotoPersistence()
Expand All @@ -37,7 +32,6 @@ SUBSYSTEM_DEF(persistence)

/datum/controller/subsystem/persistence/proc/collect_data()
save_wall_engravings()
save_prisoner_tattoos()
CollectTrophies()
CollectMaps()
SavePhotoPersistence() //THIS IS PERSISTENCE, NOT THE LOGGING PORTION.
Expand Down Expand Up @@ -129,61 +123,6 @@ SUBSYSTEM_DEF(persistence)

return json

/datum/controller/subsystem/persistence/proc/load_prisoner_tattoos()
var/json_file = file(PRISONER_TATTOO_SAVE_FILE)
if(!fexists(json_file))
return
var/list/json = json_decode(file2text(json_file))
if(!json)
return

if(json["version"] < TATTOO_PERSISTENCE_VERSION)
update_prisoner_tattoos(json)

var/datum/job/prisoner_datum = SSjob.name_occupations[JOB_PRISONER]
if(!prisoner_datum)
return
var/iterations_allowed = prisoner_datum.spawn_positions

var/list/entries = json["entries"]
if(entries.len)
for(var/index in 1 to iterations_allowed)
prison_tattoos_to_use += list(entries[rand(1, entries.len)])

log_world("Loaded [prison_tattoos_to_use.len] prison tattoos")

/datum/controller/subsystem/persistence/proc/save_prisoner_tattoos()
var/json_file = file(PRISONER_TATTOO_SAVE_FILE)
var/list/saved_data = list()
var/list/entries = list()

if(fexists(json_file))
var/list/old_json = json_decode(file2text(json_file))
if(old_json)
entries += old_json["entries"] //Save the old if its there

entries += prison_tattoos_to_save

saved_data["version"] = ENGRAVING_PERSISTENCE_VERSION
saved_data["entries"] = entries

fdel(json_file)
WRITE_FILE(json_file, json_encode(saved_data))

///This proc can update entries if the format has changed at some point.
/datum/controller/subsystem/persistence/proc/update_prisoner_tattoos(json)

for(var/tattoo_entry in json["entries"])
continue //no versioning yet

//Save it to the file
var/json_file = file(PRISONER_TATTOO_SAVE_FILE)
fdel(json_file)
WRITE_FILE(json_file, json_encode(json))

return json


/datum/controller/subsystem/persistence/proc/LoadTrophies()
if(fexists("data/npc_saves/TrophyItems.sav")) //legacy compatability to convert old format to new
var/savefile/S = new /savefile("data/npc_saves/TrophyItems.sav")
Expand Down
2 changes: 0 additions & 2 deletions code/datums/components/creamed.dm
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@ GLOBAL_LIST_INIT(creamable, typecacheof(list(

SEND_SIGNAL(parent, COMSIG_MOB_CREAMED)

add_memory_in_range(parent, 7, MEMORY_CREAMPIED, list(DETAIL_PROTAGONIST = parent), story_value = STORY_VALUE_OKAY, memory_flags = MEMORY_CHECK_BLINDNESS, protagonist_memory_flags = NONE)

creamface = mutable_appearance('icons/effects/creampie.dmi')

if(ishuman(parent))
Expand Down
Loading

0 comments on commit 4afde47

Please sign in to comment.