mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-07-13 09:05:11 +01:00
Enhanced delam/tram counter (#75699)
## About The Pull Request Gives a makeover to the delam and tram hit counters and adds some new functionality.    https://github.com/tgstation/tgstation/assets/83487515/871fb0fd-8b92-45c5-877b-c122a034608c - The signs now remember your last 'best' score and show the crew if they're trending in the right or wrong direction since the last incident. - Safety Moth PSA panel. In the future this will dynamically change based on the current events, or function as a status display. - Tram hit counters no longer waste processing every tram hit. Previously each sign independently managed tracking, which meant that deconstructing or constructing a sign would reset it to 0 and it would become out of sync with the other signs. - Can be repaired, EMP'd ## Why It's Good For The Game Provide a little motivation to reach for that high score. The PSA changing to for example, find a locker during a delam event. ## Changelog 🆑 LT3 image: Delam and tram flipsigns have been replaced with information displays fix: Tram hit count is centrally managed instead of independently on each sign, so they won't get out of sync /🆑
This commit is contained in:
@@ -22,6 +22,9 @@ SUBSYSTEM_DEF(persistence)
|
||||
var/list/obj/structure/sign/picture_frame/photo_frames
|
||||
var/list/obj/item/storage/photo_album/photo_albums
|
||||
var/rounds_since_engine_exploded = 0
|
||||
var/delam_highscore = 0
|
||||
var/tram_hits_this_round = 0
|
||||
var/tram_hits_last_round = 0
|
||||
|
||||
/datum/controller/subsystem/persistence/Initialize()
|
||||
load_poly()
|
||||
@@ -33,7 +36,7 @@ SUBSYSTEM_DEF(persistence)
|
||||
load_randomized_recipes()
|
||||
load_custom_outfits()
|
||||
load_delamination_counter()
|
||||
|
||||
load_tram_counter()
|
||||
load_adventures()
|
||||
return SS_INIT_SUCCESS
|
||||
|
||||
@@ -48,6 +51,8 @@ SUBSYSTEM_DEF(persistence)
|
||||
save_scars()
|
||||
save_custom_outfits()
|
||||
save_delamination_counter()
|
||||
if(SStramprocess.can_fire)
|
||||
save_tram_counter()
|
||||
|
||||
///Loads up Poly's speech buffer.
|
||||
/datum/controller/subsystem/persistence/proc/load_poly()
|
||||
@@ -531,19 +536,35 @@ SUBSYSTEM_DEF(persistence)
|
||||
|
||||
WRITE_FILE(file, json_encode(data))
|
||||
|
||||
/// Location where we save the information about how many rounds it has been since the engine blew up
|
||||
/// Location where we save the information about how many rounds it has been since the engine blew up/tram hits
|
||||
#define DELAMINATION_COUNT_FILEPATH "data/rounds_since_delamination.txt"
|
||||
#define DELAMINATION_HIGHSCORE_FILEPATH "data/delamination_highscore.txt"
|
||||
#define TRAM_COUNT_FILEPATH "data/tram_hits_last_round.txt"
|
||||
|
||||
/datum/controller/subsystem/persistence/proc/load_delamination_counter()
|
||||
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)
|
||||
if (fexists(DELAMINATION_HIGHSCORE_FILEPATH))
|
||||
delam_highscore = text2num(file2text(DELAMINATION_HIGHSCORE_FILEPATH))
|
||||
for (var/obj/machinery/incident_display/sign as anything in GLOB.map_delamination_counters)
|
||||
sign.update_delam_count(rounds_since_engine_exploded, delam_highscore)
|
||||
|
||||
/datum/controller/subsystem/persistence/proc/save_delamination_counter()
|
||||
rustg_file_write("[rounds_since_engine_exploded + 1]", DELAMINATION_COUNT_FILEPATH)
|
||||
if((rounds_since_engine_exploded + 1) > delam_highscore)
|
||||
rustg_file_write("[rounds_since_engine_exploded + 1]", DELAMINATION_HIGHSCORE_FILEPATH)
|
||||
|
||||
/datum/controller/subsystem/persistence/proc/load_tram_counter()
|
||||
if(!fexists(TRAM_COUNT_FILEPATH))
|
||||
return
|
||||
tram_hits_last_round = text2num(file2text(TRAM_COUNT_FILEPATH))
|
||||
|
||||
/datum/controller/subsystem/persistence/proc/save_tram_counter()
|
||||
rustg_file_write("[tram_hits_this_round]", TRAM_COUNT_FILEPATH)
|
||||
|
||||
#undef DELAMINATION_COUNT_FILEPATH
|
||||
#undef DELAMINATION_HIGHSCORE_FILEPATH
|
||||
#undef TRAM_COUNT_FILEPATH
|
||||
#undef FILE_RECENT_MAPS
|
||||
#undef KEEP_ROUNDS_MAP
|
||||
|
||||
Reference in New Issue
Block a user