mirror of
https://github.com/yogstation13/Yogstation.git
synced 2025-02-26 09:04:50 +00:00
* why no work angy * weird errors shit sucks * fixved it I can spell good * fix? POSSIBLY * nope wasnt this * no more immutable thhanks koffee * ok ok * removes all the pref stuff ""removes"" * remove this idiot * this goes bye bye * these go too genius * bye bye * better night vision * tries to fix camera maybe * ok fuck it we ball we ball * ok lets go back go back go back go back * WORK DAMNIT * ha fuc kyou * this maybe * this doesnt work :( * maybe fix maybe * fucks everything why do i do this * test update test * Revert "tries to fix camera" This reverts commit2d14fbae66. * reverts everything I just did peko pain * bye bitch * oh yeah add this I guess * Fucks up the camera net + chunk why * test maybe revert * Revert "test maybe revert" This reverts commit98c5ef1b93. * Revert "Fucks up the camera net + chunk" This reverts commit0e421ebf5f. * this isnt going well uh oh * Attempts to rework out security camera and probably more * Revert "this isnt going well" This reverts commit1d8ceac867. * Revert "Revert "this isnt going well"" This reverts commite26fb61415. * ok ok * Revert "ok" This reverts commit7e7a7f8372. * Revert "Merge remote-tracking branch 'upstream/master' into NahI'dPortit" This reverts commit01094731c1, reversing changes made toc0cf69ebf1. * this doesn't need to be redefined I guess * no we need this totally * a familiar pain * 515 is L * yeah yeah * ok god fine * bye bye basemap :( doesnt work on runtime station * Fixes AI statis not working god im good * remove this oh god * Revert "Revert "Merge remote-tracking branch 'upstream/master' into NahI'dPortit"" This reverts commitb3fb3ba0db. * proves to god I exist and im pissed * yog exclusive feature (tm) plane master * bring this back from previous push * updates vendor emissives as well as firealarms * Updates barsign and fucks everything up * Fixes barsigns breaks all lights and updates barsigns to be machines and not structures We will address this in a later patch * not sure who changed that oh well * yeah this got moved * this needs updating yeah * turns off the carbon monoxide alarm duh * FIXES IT YES thank you biome * turns this off too yeah * Can't compile yet but ports a ton of shit * L * the game opens ig * extra shit * fixes * signals and smooth queue * look ma im going horribly out of scope * fixes chasms * this fixed nothing * ??? * more barsigns for later * forgive me cowboy. also fuck diagonals * oops we need this apparently * fuck it we ball * Update _lists.dm * Update icon_smoothing.dm * it now works kinda * Update atom_initializing_EXPENSIVE.dm * lighting don't work * we have light * sort turfs better * big fucking reorganize * like everything except templates * boy i sure hope nothing bad happens to these bar templates * we're back * no runtimes baby * no errors * shuttles are almost fixed i think * Revert "shuttles are almost fixed i think" This reverts commit046058827c. * Revert "Merge remote-tracking branch 'upstream/master' into icon_smoothing" This reverts commit863e1b776d, reversing changes made to884623e600. * Revert "no errors" This reverts commit884623e600. * too far back i think * midround smoothing runtimes fixed i think * comment cleanup * should fix the component runtimes * Revert "Revert "Merge remote-tracking branch 'upstream/master' into icon_smoothing"" This reverts commita8ff8d63aa. * NO RUNTIMES AND ICEMETA WORKS LET'S GOOOOOO * please stay fixed icemeta * organizing render dms * woops this too in the reorganizing * cryo fixed * nah, i'd win * parallax isn't my problem * pls don't break icemeta * runtime station gets a cam console * well it compiles * maybe fix the map * woops * man i hate maps * was that it? * PLEASE * missing focus tests * maybe that was it * maybe * let's take the batteries out of the carbon monoxide detector * fuck osha * i hate vending machines * that's not a computer * slot machine fix * PLEASE * that wasn't supposed to be there * fuck it i can't fix everything at once * BLUESPACE LOCKER? * literally why * hhh * does this fix chasms? * that should fix bad index * please? * turf_flags for reservations * haha oops * yolo (kill me) * fix wood walls and other walls * fix stairs * that might have fixed shittles * baseturfs are good now i think * should fix plasma windows * decals fixed * please fix changelog * shuttle lighting still fucky * lighting is stinky slow and doesn't finish updating by the time the server starts guh * lighting seemingly works * slipping works * shuttle sounds, slips, and windoors fixed * why am i here * fuck the changelog * of course someone touched smoothing as i'm almost done * we good? * updating ai_eye and rename * z updates and more ai cam updates * ice fixed * weather and ice fix * clockies can see and other clean up catches * windows fixed * cowbot forgive me i'm trying to update flashlights to tg because there's no light on lower multi-z z's like ice meta bottom floor * movable lighting works on multi-z * gps fix * item stacking from drag works * falsewall fix * job panel fixed * AI HANDLED * woops that comment should be gone * i hate ai i hate ai * brass glass visible again * vents on top of tiles now * sigdrobe sprite back * centcomm portals work * portals and see openspace mapping icons fixed * icemeta my behated * kill * is that it * lighting cutoff is old hat * angery overlay * not super necessary * also extra but whatever * ticker but thicker * job fix i hope * this isn't needed anymore * latejoin fix? * laserpointer, pipecrawl, and some consoles fixed * i hate fixing bugs as they're made * we're not ready for that * redef cleanup * gps arrows, gun flashlights, shuttle console placement, multi-z pulling fixed * goofy ah gun code * this was a good idea and necessary * should fix caltrop component * does this please the linter * linter please accept this async function * THERE * take the batteries out * make it stop * cowbot stopped me from letting ghosts dab * recycler loc fix * fix border firedoors not blocking movement * should fix screen fade out and fade in on round start and end * darker command tile trim and fixed bronze wall sprites * fuck you linter * railings actually stop you from leaving * probably fixes gibtonite overlay when struck * armaments dispenser and clockwork catwalk * turbine fix probably * pointing at inhand items should be fixed * fix overwatch app * should hopefully fix cable rotation on shuttle move * flashlights have better directionality logic * hopefully fixes shuttle atmos on move * grilles fixed * hopefully this fixes shuttle buttons, airolocks, and other machinery not working after moving * ice meta mining area finally not freezing * fix lightbulb icons not updating * lava mask and lighting dots * we actually have this * fuck glowshrooms GC * fix light fixture interactions and icon updates * hopefully catches all the updates * lava lighting good to go * seclite was missing inhands * smoothing in replays * light updates accurate in replays * biome's multi-z requests --------- Co-authored-by: cowbot92 <75333826+cowbot92@users.noreply.github.com> Co-authored-by: Molti <gamingjoelouis@gmail.com> Co-authored-by: Ringalong <53777086+JohnFulpWillard@users.noreply.github.com>
387 lines
12 KiB
Plaintext
387 lines
12 KiB
Plaintext
#define FILE_ANTAG_REP "data/AntagReputation.json"
|
|
#define ROUNDCOUNT_ENGINE_JUST_EXPLODED 0
|
|
|
|
//yogs edit
|
|
#define NEXT_MINETYPE_JUNGLE 0
|
|
#define NEXT_MINETYPE_LAVALAND 1
|
|
#define NEXT_MINETYPE_EITHER 2
|
|
//yogs end
|
|
SUBSYSTEM_DEF(persistence)
|
|
name = "Persistence"
|
|
init_order = INIT_ORDER_PERSISTENCE
|
|
flags = SS_NO_FIRE
|
|
|
|
var/list/obj/structure/chisel_message/chisel_messages = list()
|
|
var/list/saved_messages = list()
|
|
var/list/saved_modes = list(1,2,3)
|
|
var/list/saved_trophies = list()
|
|
var/list/antag_rep = list()
|
|
var/list/antag_rep_change = list()
|
|
var/list/picture_logging_information = list()
|
|
var/list/obj/structure/sign/picture_frame/photo_frames = list()
|
|
var/list/obj/item/storage/photo_album/photo_albums = list()
|
|
var/rounds_since_engine_exploded = 0
|
|
|
|
var/next_minetype //yogs
|
|
|
|
/datum/controller/subsystem/persistence/Initialize()
|
|
LoadPoly()
|
|
LoadChiselMessages()
|
|
LoadTrophies()
|
|
LoadRecentModes()
|
|
LoadPhotoPersistence()
|
|
if(CONFIG_GET(flag/use_antag_rep))
|
|
LoadAntagReputation()
|
|
LoadRandomizedRecipes()
|
|
LoadDelaminationCounter()
|
|
return SS_INIT_SUCCESS
|
|
|
|
/datum/controller/subsystem/persistence/proc/LoadPoly()
|
|
for(var/mob/living/simple_animal/parrot/Poly/P in GLOB.alive_mob_list)
|
|
twitterize(P.speech_buffer, "polytalk")
|
|
break //Who's been duping the bird?!
|
|
|
|
/datum/controller/subsystem/persistence/proc/LoadChiselMessages()
|
|
var/list/saved_messages = list()
|
|
if(fexists("data/npc_saves/ChiselMessages.sav")) //legacy compatability to convert old format to new
|
|
var/savefile/chisel_messages_sav = new /savefile("data/npc_saves/ChiselMessages.sav")
|
|
var/saved_json
|
|
chisel_messages_sav[SSmapping.config.map_name] >> saved_json
|
|
if(!saved_json)
|
|
return
|
|
saved_messages = json_decode(saved_json)
|
|
fdel("data/npc_saves/ChiselMessages.sav")
|
|
else
|
|
var/json_file = file("data/npc_saves/ChiselMessages[SSmapping.config.map_name].json")
|
|
if(!fexists(json_file))
|
|
return
|
|
var/list/json = json_decode(file2text(json_file))
|
|
|
|
if(!json)
|
|
return
|
|
saved_messages = json["data"]
|
|
|
|
for(var/item in saved_messages)
|
|
if(!islist(item))
|
|
continue
|
|
|
|
var/xvar = item["x"]
|
|
var/yvar = item["y"]
|
|
var/zvar = item["z"]
|
|
|
|
if(!xvar || !yvar || !zvar)
|
|
continue
|
|
|
|
var/turf/T = locate(xvar, yvar, zvar)
|
|
if(!isturf(T))
|
|
continue
|
|
|
|
if(locate(/obj/structure/chisel_message) in T)
|
|
continue
|
|
|
|
var/obj/structure/chisel_message/M = new(T)
|
|
|
|
if(!QDELETED(M))
|
|
M.unpack(item)
|
|
|
|
log_world("Loaded [saved_messages.len] engraved messages on map [SSmapping.config.map_name]")
|
|
|
|
/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")
|
|
var/saved_json
|
|
S >> saved_json
|
|
if(!saved_json)
|
|
return
|
|
saved_trophies = json_decode(saved_json)
|
|
fdel("data/npc_saves/TrophyItems.sav")
|
|
else
|
|
var/json_file = file("data/npc_saves/TrophyItems.json")
|
|
if(!fexists(json_file))
|
|
return
|
|
var/list/json = json_decode(file2text(json_file))
|
|
if(!json)
|
|
return
|
|
saved_trophies = json["data"]
|
|
SetUpTrophies(saved_trophies.Copy())
|
|
|
|
/datum/controller/subsystem/persistence/proc/LoadRecentModes()
|
|
var/json_file = file("data/RecentModes.json")
|
|
if(!fexists(json_file))
|
|
return
|
|
var/list/json = json_decode(file2text(json_file))
|
|
if(!json)
|
|
return
|
|
saved_modes = json["data"]
|
|
|
|
/datum/controller/subsystem/persistence/proc/LoadAntagReputation()
|
|
var/json = file2text(FILE_ANTAG_REP)
|
|
if(!json)
|
|
var/json_file = file(FILE_ANTAG_REP)
|
|
if(!fexists(json_file))
|
|
WARNING("Failed to load antag reputation. File likely corrupt.")
|
|
return
|
|
return
|
|
antag_rep = json_decode(json)
|
|
|
|
/datum/controller/subsystem/persistence/proc/SetUpTrophies(list/trophy_items)
|
|
for(var/A in GLOB.trophy_cases)
|
|
var/obj/structure/displaycase/trophy/T = A
|
|
if (T.showpiece)
|
|
continue
|
|
T.added_roundstart = TRUE
|
|
|
|
var/trophy_data = pick_n_take(trophy_items)
|
|
|
|
if(!islist(trophy_data))
|
|
continue
|
|
|
|
var/list/chosen_trophy = trophy_data
|
|
|
|
if(!chosen_trophy || isemptylist(chosen_trophy)) //Malformed
|
|
continue
|
|
|
|
var/path = text2path(chosen_trophy["path"]) //If the item no longer exist, this returns null
|
|
if(!path)
|
|
continue
|
|
|
|
T.showpiece = new /obj/item/showpiece_dummy(T, path)
|
|
T.trophy_message = chosen_trophy["message"]
|
|
T.placer_key = chosen_trophy["placer_key"]
|
|
T.update_appearance(UPDATE_ICON)
|
|
|
|
/datum/controller/subsystem/persistence/proc/CollectData()
|
|
CollectChiselMessages()
|
|
CollectTrophies()
|
|
CollectRoundtype()
|
|
SavePhotoPersistence() //THIS IS PERSISTENCE, NOT THE LOGGING PORTION.
|
|
if(CONFIG_GET(flag/use_antag_rep))
|
|
CollectAntagReputation()
|
|
SaveRandomizedRecipes()
|
|
SaveScars()
|
|
SaveDelaminationCounter()
|
|
|
|
/datum/controller/subsystem/persistence/proc/GetPhotoAlbums()
|
|
var/album_path = file("data/photo_albums.json")
|
|
if(fexists(album_path))
|
|
return json_decode(file2text(album_path))
|
|
|
|
/datum/controller/subsystem/persistence/proc/GetPhotoFrames()
|
|
var/frame_path = file("data/photo_frames.json")
|
|
if(fexists(frame_path))
|
|
return json_decode(file2text(frame_path))
|
|
|
|
/datum/controller/subsystem/persistence/proc/LoadPhotoPersistence()
|
|
var/album_path = file("data/photo_albums.json")
|
|
var/frame_path = file("data/photo_frames.json")
|
|
if(fexists(album_path))
|
|
var/list/json = json_decode(file2text(album_path))
|
|
if(json.len)
|
|
for(var/i in photo_albums)
|
|
var/obj/item/storage/photo_album/A = i
|
|
if(!A.persistence_id)
|
|
continue
|
|
if(json[A.persistence_id])
|
|
A.populate_from_id_list(json[A.persistence_id])
|
|
|
|
if(fexists(frame_path))
|
|
var/list/json = json_decode(file2text(frame_path))
|
|
if(json.len)
|
|
for(var/i in photo_frames)
|
|
var/obj/structure/sign/picture_frame/PF = i
|
|
if(!PF.persistence_id)
|
|
continue
|
|
if(json[PF.persistence_id])
|
|
PF.load_from_id(json[PF.persistence_id])
|
|
|
|
/datum/controller/subsystem/persistence/proc/SavePhotoPersistence()
|
|
var/album_path = file("data/photo_albums.json")
|
|
var/frame_path = file("data/photo_frames.json")
|
|
|
|
var/list/frame_json = list()
|
|
var/list/album_json = list()
|
|
|
|
if(fexists(album_path))
|
|
album_json = json_decode(file2text(album_path))
|
|
fdel(album_path)
|
|
|
|
for(var/i in photo_albums)
|
|
var/obj/item/storage/photo_album/A = i
|
|
if(!istype(A) || !A.persistence_id)
|
|
continue
|
|
var/list/L = A.get_picture_id_list()
|
|
album_json[A.persistence_id] = L
|
|
|
|
album_json = json_encode(album_json)
|
|
|
|
WRITE_FILE(album_path, album_json)
|
|
|
|
if(fexists(frame_path))
|
|
frame_json = json_decode(file2text(frame_path))
|
|
fdel(frame_path)
|
|
|
|
for(var/i in photo_frames)
|
|
var/obj/structure/sign/picture_frame/F = i
|
|
if(!istype(F) || !F.persistence_id)
|
|
continue
|
|
frame_json[F.persistence_id] = F.get_photo_id()
|
|
|
|
frame_json = json_encode(frame_json)
|
|
|
|
WRITE_FILE(frame_path, frame_json)
|
|
|
|
/datum/controller/subsystem/persistence/proc/CollectChiselMessages()
|
|
var/json_file = file("data/npc_saves/ChiselMessages[SSmapping.config.map_name].json")
|
|
|
|
for(var/obj/structure/chisel_message/M in chisel_messages)
|
|
saved_messages += list(M.pack())
|
|
|
|
log_world("Saved [saved_messages.len] engraved messages on map [SSmapping.config.map_name]")
|
|
var/list/file_data = list()
|
|
file_data["data"] = saved_messages
|
|
fdel(json_file)
|
|
WRITE_FILE(json_file, json_encode(file_data))
|
|
|
|
/datum/controller/subsystem/persistence/proc/SaveChiselMessage(obj/structure/chisel_message/M)
|
|
saved_messages += list(M.pack()) // dm eats one list
|
|
|
|
|
|
/datum/controller/subsystem/persistence/proc/CollectTrophies()
|
|
var/json_file = file("data/npc_saves/TrophyItems.json")
|
|
var/list/file_data = list()
|
|
file_data["data"] = remove_duplicate_trophies(saved_trophies)
|
|
fdel(json_file)
|
|
WRITE_FILE(json_file, json_encode(file_data))
|
|
|
|
/datum/controller/subsystem/persistence/proc/remove_duplicate_trophies(list/trophies)
|
|
var/list/ukeys = list()
|
|
. = list()
|
|
for(var/trophy in trophies)
|
|
var/tkey = "[trophy["path"]]-[trophy["message"]]"
|
|
if(ukeys[tkey])
|
|
continue
|
|
else
|
|
. += list(trophy)
|
|
ukeys[tkey] = TRUE
|
|
|
|
/datum/controller/subsystem/persistence/proc/SaveTrophy(obj/structure/displaycase/trophy/T)
|
|
if(!T.added_roundstart && T.showpiece)
|
|
var/list/data = list()
|
|
data["path"] = T.showpiece.type
|
|
data["message"] = T.trophy_message
|
|
data["placer_key"] = T.placer_key
|
|
saved_trophies += list(data)
|
|
|
|
/datum/controller/subsystem/persistence/proc/CollectRoundtype()
|
|
saved_modes[3] = saved_modes[2]
|
|
saved_modes[2] = saved_modes[1]
|
|
saved_modes[1] = SSticker.mode.config_tag
|
|
var/json_file = file("data/RecentModes.json")
|
|
var/list/file_data = list()
|
|
file_data["data"] = saved_modes
|
|
fdel(json_file)
|
|
WRITE_FILE(json_file, json_encode(file_data))
|
|
|
|
/datum/controller/subsystem/persistence/proc/CollectAntagReputation()
|
|
var/ANTAG_REP_MAXIMUM = CONFIG_GET(number/antag_rep_maximum)
|
|
|
|
for(var/p_ckey in antag_rep_change)
|
|
// var/start = antag_rep[p_ckey]
|
|
antag_rep[p_ckey] = max(0, min(antag_rep[p_ckey]+antag_rep_change[p_ckey], ANTAG_REP_MAXIMUM))
|
|
|
|
// WARNING("AR_DEBUG: [p_ckey]: Committed [antag_rep_change[p_ckey]] reputation, going from [start] to [antag_rep[p_ckey]]")
|
|
|
|
antag_rep_change = list()
|
|
|
|
fdel(FILE_ANTAG_REP)
|
|
text2file(json_encode(antag_rep), FILE_ANTAG_REP)
|
|
|
|
|
|
/datum/controller/subsystem/persistence/proc/LoadRandomizedRecipes()
|
|
var/json_file = file("data/RandomizedChemRecipes.json")
|
|
var/json
|
|
if(fexists(json_file))
|
|
json = json_decode(file2text(json_file))
|
|
|
|
for(var/randomized_type in subtypesof(/datum/chemical_reaction/randomized))
|
|
var/datum/chemical_reaction/randomized/R = new randomized_type
|
|
var/loaded = FALSE
|
|
if(R.persistent && json)
|
|
var/list/recipe_data = json[R.id]
|
|
if(recipe_data)
|
|
if(R.LoadOldRecipe(recipe_data) && (daysSince(R.created) <= R.persistence_period))
|
|
loaded = TRUE
|
|
if(!loaded) //We do not have information for whatever reason, just generate new one
|
|
R.GenerateRecipe()
|
|
|
|
if(!R.HasConflicts()) //Might want to try again if conflicts happened in the future.
|
|
add_chemical_reaction(R)
|
|
|
|
/datum/controller/subsystem/persistence/proc/SaveRandomizedRecipes()
|
|
var/json_file = file("data/RandomizedChemRecipes.json")
|
|
var/list/file_data = list()
|
|
|
|
//asert globchems done
|
|
for(var/randomized_type in subtypesof(/datum/chemical_reaction/randomized))
|
|
var/datum/chemical_reaction/randomized/R = randomized_type
|
|
R = get_chemical_reaction(initial(R.id)) //ew, would be nice to add some simple tracking
|
|
if(R && R.persistent && R.id)
|
|
var/recipe_data = list()
|
|
recipe_data["timestamp"] = R.created
|
|
recipe_data["required_reagents"] = R.required_reagents
|
|
recipe_data["required_catalysts"] = R.required_catalysts
|
|
recipe_data["required_temp"] = R.required_temp
|
|
recipe_data["is_cold_recipe"] = R.is_cold_recipe
|
|
recipe_data["results"] = R.results
|
|
recipe_data["required_container"] = "[R.required_container]"
|
|
file_data["[R.id]"] = recipe_data
|
|
|
|
fdel(json_file)
|
|
WRITE_FILE(json_file, json_encode(file_data))
|
|
|
|
/datum/controller/subsystem/persistence/proc/SaveScars()
|
|
for(var/i in GLOB.joined_player_list)
|
|
var/mob/living/carbon/human/ending_human = get_mob_by_ckey(i)
|
|
if(!istype(ending_human) || !ending_human.mind?.original_character_slot_index || !ending_human.client || !ending_human.client.prefs || !ending_human.client.prefs.read_preference(/datum/preference/toggle/persistent_scars))
|
|
continue
|
|
|
|
var/mob/living/carbon/human/original_human = ending_human.mind.original_character.resolve()
|
|
|
|
if(!original_human)
|
|
continue
|
|
|
|
if(original_human.stat == DEAD || !original_human.all_scars || original_human != ending_human)
|
|
original_human.save_persistent_scars(TRUE)
|
|
else
|
|
original_human.save_persistent_scars()
|
|
|
|
|
|
/datum/controller/subsystem/persistence/proc/LoadMinetype()
|
|
var/json_file = file("data/next_minetype.json")
|
|
if(fexists(json_file))
|
|
next_minetype = json_decode(file2text(json_file))
|
|
else
|
|
next_minetype = NEXT_MINETYPE_EITHER
|
|
SaveMinetype()
|
|
|
|
/datum/controller/subsystem/persistence/proc/SaveMinetype(minetype = NEXT_MINETYPE_EITHER)
|
|
var/json_file = file("data/next_minetype.json")
|
|
fdel(json_file)
|
|
WRITE_FILE(json_file, json_encode(minetype))
|
|
|
|
|
|
#define DELAMINATION_COUNT_FILEPATH "data/rounds_since_delamination.txt"
|
|
|
|
/datum/controller/subsystem/persistence/proc/LoadDelaminationCounter()
|
|
if (!fexists(DELAMINATION_COUNT_FILEPATH))
|
|
return
|
|
rounds_since_engine_exploded = text2num(file2text(DELAMINATION_COUNT_FILEPATH))
|
|
for (var/obj/structure/sign/delamination_counter/sign as anything in GLOB.map_delamination_counters)
|
|
sign.update_count(rounds_since_engine_exploded)
|
|
|
|
/datum/controller/subsystem/persistence/proc/SaveDelaminationCounter()
|
|
rustg_file_write("[rounds_since_engine_exploded + 1]", DELAMINATION_COUNT_FILEPATH)
|
|
|
|
#undef DELAMINATION_COUNT_FILEPATH
|
|
|