From 0a8cb7f4c0ec8241ef49ff8a551042fa805c857d Mon Sep 17 00:00:00 2001 From: silencer-pl <103842328+silencer-pl@users.noreply.github.com> Date: Mon, 27 May 2024 11:55:48 -0400 Subject: [PATCH] location/date/time display control and saving --- code/_globalvars/global_lists.dm | 5 -- code/_globalvars/misc.dm | 9 +--- code/_globalvars/sectorpatrol.dm | 11 +++++ code/controllers/subsystem/statpanel.dm | 6 +-- code/modules/admin/admin_verbs.dm | 5 +- code/modules/admin/verbs/sectorpatrol.dm | 63 ++++++++++++++++++++++-- colonialmarines.dme | 1 + 7 files changed, 80 insertions(+), 20 deletions(-) create mode 100644 code/_globalvars/sectorpatrol.dm diff --git a/code/_globalvars/global_lists.dm b/code/_globalvars/global_lists.dm index d9ccd61025..a3c383de87 100644 --- a/code/_globalvars/global_lists.dm +++ b/code/_globalvars/global_lists.dm @@ -582,8 +582,3 @@ GLOBAL_PROTECT(topic_tokens) GLOBAL_LIST_EMPTY(topic_commands) GLOBAL_PROTECT(topic_commands) - -// Sector Patrol - Persistancy lists - -GLOBAL_LIST_EMPTY(turfs_saved) -GLOBAL_LIST_EMPTY(objects_saved) diff --git a/code/_globalvars/misc.dm b/code/_globalvars/misc.dm index faab0fc23a..4bee215b9b 100644 --- a/code/_globalvars/misc.dm +++ b/code/_globalvars/misc.dm @@ -87,7 +87,7 @@ GLOBAL_VAR_INIT(perf_flags, NO_FLAGS) GLOBAL_LIST_INIT(bitflags, list((1<<0), (1<<1), (1<<2), (1<<3), (1<<4), (1<<5), (1<<6), (1<<7), (1<<8), (1<<9), (1<<10), (1<<11), (1<<12), (1<<13), (1<<14), (1<<15), (1<<16), (1<<17), (1<<18), (1<<19), (1<<20), (1<<21), (1<<22), (1<<23))) -GLOBAL_VAR_INIT(master_mode, "Distress Signal") +GLOBAL_VAR_INIT(master_mode, "Sector Patrol") GLOBAL_VAR_INIT(timezoneOffset, 0) @@ -135,10 +135,3 @@ GLOBAL_VAR(xeno_queue_candidate_count) GLOBAL_VAR(obfs_x) /// A number between -500 and 500. GLOBAL_VAR(obfs_y) - -//Sector Patrol -//For generating hexlike adress groups - -GLOBAL_LIST_INIT(hex_string, list("0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F")) - -GLOBAL_VAR_INIT(savefile_number, 0) diff --git a/code/_globalvars/sectorpatrol.dm b/code/_globalvars/sectorpatrol.dm new file mode 100644 index 0000000000..80b578efc3 --- /dev/null +++ b/code/_globalvars/sectorpatrol.dm @@ -0,0 +1,11 @@ +GLOBAL_VAR_INIT(savefile_number, 0) //Savefile number reference. Should be set automatically by the persistance system. Tells it which save file is latest while loding/saving + +//Round infopanel readout: + +GLOBAL_VAR_INIT(ingame_location, "UACM Outer Veil Primary Supply Terminal, Neroid Sector") +GLOBAL_VAR_INIT(ingame_date, "Unknown Date/Time") +GLOBAL_VAR_INIT(ingame_time, 0) + +//Persistancy lists +GLOBAL_LIST_EMPTY(turfs_saved) //turfs to be saved/loaded, ordered by xyz coordiates +GLOBAL_LIST_EMPTY(objects_saved) //objects to be saved/loaded, orderd by an index number diff --git a/code/controllers/subsystem/statpanel.dm b/code/controllers/subsystem/statpanel.dm index ea9ba4f17b..0ac1aab9a9 100644 --- a/code/controllers/subsystem/statpanel.dm +++ b/code/controllers/subsystem/statpanel.dm @@ -26,9 +26,9 @@ SUBSYSTEM_DEF(statpanels) num_fires++ global_data = list( "Sector Patrol ALPHA", - "UACM Outer Veil Primary Supply Terminal, Neroid Sector", - "August 24th, 2185", - "Station Time: [time2text(642000 + wtime,"hh:mm",0)]", + "[GLOB.ingame_location]", + "[GLOB.ingame_date]", + "Local Time: [time2text(GLOB.ingame_time + wtime,"hh:mm",0)]", "---------", // "Round Time: [ROUND_TIME]", // "Server Time: [time2text(world.timeofday, "YYYY-MM-DD hh:mm:ss")]", diff --git a/code/modules/admin/admin_verbs.dm b/code/modules/admin/admin_verbs.dm index 4ba70e7cb2..8f2337247b 100644 --- a/code/modules/admin/admin_verbs.dm +++ b/code/modules/admin/admin_verbs.dm @@ -167,7 +167,10 @@ GLOBAL_LIST_INIT(admin_verbs_major_event, list( /client/proc/cmd_start_sequence, /client/proc/cmd_answer_civnet, /client/proc/cmd_save_turfs, - /client/proc/cmd_load_turfs + /client/proc/cmd_load_turfs, + /client/proc/cmd_set_time_date_loc, + /client/proc/cmd_save_general, + /client/proc/cmd_load_general, )) GLOBAL_LIST_INIT(admin_verbs_spawn, list( diff --git a/code/modules/admin/verbs/sectorpatrol.dm b/code/modules/admin/verbs/sectorpatrol.dm index 86f95f0811..5f672a4fcf 100644 --- a/code/modules/admin/verbs/sectorpatrol.dm +++ b/code/modules/admin/verbs/sectorpatrol.dm @@ -77,7 +77,7 @@ /client/proc/cmd_save_turfs() - set name = "Peristancy - Save" + set name = "Peristancy - Save Turfs and Objects" set category = "Admin.SectorPatrol" if (!admin_holder || !(admin_holder.rights & R_MOD)) @@ -87,7 +87,7 @@ to_chat(world, SPAN_BOLDWARNING("Persistancy save initiated. Game may stop responding...")) sleep(5) GLOB.savefile_number += 1 - //Globals + //Savefile number reference var/savefile/G = new("data/persistance/globals.sav") G["current_save"] << GLOB.savefile_number //Turfs @@ -125,10 +125,12 @@ I["customizable_desc_lore"] << obj.customizable_desc_lore I.cd = "/general" I["item_index_max"] << item_index + to_chat(world, SPAN_BOLDWARNING("Object data saved.")) + to_chat(world, SPAN_BOLDWARNING("Persistancy save complete. You may resume playing.")) /client/proc/cmd_load_turfs() - set name = "Peristancy - Load" + set name = "Peristancy - Load Turfs and Objects" set category = "Admin.SectorPatrol" if (!admin_holder || !(admin_holder.rights & R_MOD)) @@ -180,3 +182,58 @@ I["customizable_desc_lore"] << newitem.customizable_desc_lore newitem.update_icon() newitem.update_custom_descriptions() + to_chat(world, SPAN_BOLDWARNING("Object data loaded.")) + to_chat(world, SPAN_BOLDWARNING("Persistancy load complete. You may resume playing.")) + +/client/proc/cmd_set_time_date_loc() + + set name = "Set Statpanel IC information" + set category = "Admin.SectorPatrol" + + if (!admin_holder || !(admin_holder.rights & R_MOD)) + to_chat(src, "Only administrators may use this command.") + return + + var/olddate = GLOB.ingame_date + GLOB.ingame_date = tgui_input_text(usr, message = "Enter Date to display:", title = "Date Entry", default = "[GLOB.ingame_date]", timeout = 0) + if(GLOB.ingame_date == null) GLOB.ingame_date = olddate + + var/oldtime = GLOB.ingame_time + var/newtime_hrs = tgui_input_number(usr, message = "In-game time, HOURS:", title = "Time Entry HOURS", timeout = 0) + var/newtime_min = tgui_input_number(usr, message = "In-game time, MINUTES:", title = "Time Entry MINUTES", timeout = 0) + GLOB.ingame_time = ((newtime_hrs * 36000) + (newtime_min * 600)) - world.time + if(GLOB.ingame_time == null) GLOB.ingame_time = oldtime + + var/oldlocation = GLOB.ingame_location + GLOB.ingame_location = tgui_input_text(usr, message = "Enter Location to display:", title = "Location Entry", default = "[GLOB.ingame_location]", timeout = 0) + if(GLOB.ingame_location == null) GLOB.ingame_location = oldlocation + +/client/proc/cmd_save_general() + + set name = "Peristancy - Save General Status" + set category = "Admin.SectorPatrol" + + if (!admin_holder || !(admin_holder.rights & R_MOD)) + to_chat(src, "Only administrators may use this command.") + return + + var/savefile/G = new("data/persistance/globals.sav") + G["Date"] << GLOB.ingame_date + G["Time"] << GLOB.ingame_time + G["Location"] << GLOB.ingame_location + to_chat(src, SPAN_BOLDWARNING("General data saved.")) + +/client/proc/cmd_load_general() + + set name = "Peristancy - Load General Status" + set category = "Admin.SectorPatrol" + + if (!admin_holder || !(admin_holder.rights & R_MOD)) + to_chat(src, "Only administrators may use this command.") + return + + var/savefile/G = new("data/persistance/globals.sav") + G["Date"] >> GLOB.ingame_date + G["Time"] >> GLOB.ingame_time + G["Location"] >> GLOB.ingame_location + to_chat(src, SPAN_BOLDWARNING("General data loaded.")) diff --git a/colonialmarines.dme b/colonialmarines.dme index 86238b8d45..f363f180ae 100644 --- a/colonialmarines.dme +++ b/colonialmarines.dme @@ -205,6 +205,7 @@ #include "code\_globalvars\global_lists.dm" #include "code\_globalvars\misc.dm" #include "code\_globalvars\regexes.dm" +#include "code\_globalvars\sectorpatrol.dm" #include "code\_globalvars\tgui.dm" #include "code\_globalvars\lists\clans.dm" #include "code\_globalvars\lists\client.dm"