Skip to content

Commit

Permalink
location/date/time display control and saving
Browse files Browse the repository at this point in the history
  • Loading branch information
silencer-pl committed May 27, 2024
1 parent da1d0c2 commit 0a8cb7f
Show file tree
Hide file tree
Showing 7 changed files with 80 additions and 20 deletions.
5 changes: 0 additions & 5 deletions code/_globalvars/global_lists.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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)
9 changes: 1 addition & 8 deletions code/_globalvars/misc.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down Expand Up @@ -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)
11 changes: 11 additions & 0 deletions code/_globalvars/sectorpatrol.dm
Original file line number Diff line number Diff line change
@@ -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
6 changes: 3 additions & 3 deletions code/controllers/subsystem/statpanel.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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")]",
Expand Down
5 changes: 4 additions & 1 deletion code/modules/admin/admin_verbs.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
63 changes: 60 additions & 3 deletions code/modules/admin/verbs/sectorpatrol.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand All @@ -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
Expand Down Expand Up @@ -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))
Expand Down Expand Up @@ -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."))
1 change: 1 addition & 0 deletions colonialmarines.dme
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down

0 comments on commit 0a8cb7f

Please sign in to comment.