Skip to content

Commit

Permalink
reworks game preferences (characters v2 staging) (#6310)
Browse files Browse the repository at this point in the history
Co-authored-by: silicons <[email protected]>
Co-authored-by: LordME <[email protected]>
  • Loading branch information
3 people committed Apr 8, 2024
1 parent 9f1b911 commit 39bc14b
Show file tree
Hide file tree
Showing 427 changed files with 3,981 additions and 2,842 deletions.
22 changes: 20 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,32 @@ On **May 9, 2022** we have changed the way to compile the codebase.

[Guides for Contributors](.github/CONTRIBUTING.md)

[CitadelRP HACKMD account](https://hackmd.io/@CitadelStation13RP)
[CitadelRP HackMD - Design Documents & Planning](https://hackmd.io/@CitadelStation13RP)

## SQL Setup

The SQL backend for the library and stats tracking requires a MySQL server.
The SQL backend for the library and stats tracking requires a MariaDB server.
Your server details go in /config/legacy/dbconfig.txt, and the SQL schema is in /SQL/tgstation_schema.sql.
More detailed setup instructions arecoming soon, for now ask in our Discord.

todo: update this section

## Static Files

The following folders are considered 'static folders' and should be added to TGS4's static files:

These are also the folders you are likely going to encounter while managing the server.

- /config: server configuration
- /legacy: legacy configuration data go in here
- /data: server persistent data
- /logs: logs are dumped in here
- /players: player data, like saves and characters get dumped in here

You only need to make the top level folders (e.g. config, data) static folders in TGS4.

Subfolders are automatically included.

## LICENSE

The code for Citadel-Station-13-RP is licensed under the [GNU AGPL v3](http://www.gnu.org/licenses/agpl-3.0.html).
Expand Down
22 changes: 21 additions & 1 deletion SQL/database_schema.sql
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ CREATE TABLE IF NOT EXISTS `%_PREFIX_%photographs` (
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

-- players --
-- Players --

-- Player lookup table --
-- Used to look up player ID from ckey, as well as --
Expand All @@ -153,6 +153,7 @@ CREATE TABLE IF NOT EXISTS `%_PREFIX_%player` (
`flags` int(24) NOT NULL DEFAULT 0,
`firstseen` datetime NOT NULL DEFAULT Now(),
`lastseen` datetime NOT NULL,
`misc` MEDIUMTEXT NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

Expand Down Expand Up @@ -194,6 +195,25 @@ END
$$
DELIMITER ;


-- Preferences --

-- Stores game preferences --
CREATE TABLE IF NOT EXISTS `%_PREFIX_%game_preferences` (
`player` INT(11) NOT NULL,
`entries` MEDIUMTEXT NOT NULL,
`misc` MEDIUMTEXT NOT NULL,
`keybinds` MEDIUMTEXT NOT NULL,
`toggles` MEDIUMTEXT NOT NULL,
`modified` DATETIME NOT NULL,
`version` INT(11) NOT NULL,
PRIMARY KEY (`player`),
CONSTRAINT `linked_player` FOREIGN KEY (`player`)
REFERENCES `%_PREFIX_%player` (`id`)
ON DELETE CASCADE
ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

-- Security - Ipintel --

-- Ipintel Cache Table --
Expand Down
22 changes: 21 additions & 1 deletion SQL/database_schema_prefixed.sql
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ CREATE TABLE IF NOT EXISTS `rp_photographs` (
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

-- players --
-- Players --

-- Player lookup table --
-- Used to look up player ID from ckey, as well as --
Expand All @@ -153,6 +153,7 @@ CREATE TABLE IF NOT EXISTS `rp_player` (
`flags` int(24) NOT NULL DEFAULT 0,
`firstseen` datetime NOT NULL DEFAULT Now(),
`lastseen` datetime NOT NULL,
`misc` MEDIUMTEXT NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

Expand Down Expand Up @@ -194,6 +195,25 @@ END
$$
DELIMITER ;


-- Preferences --

-- Stores game preferences --
CREATE TABLE IF NOT EXISTS `rp_game_preferences` (
`player` INT(11) NOT NULL,
`entries` MEDIUMTEXT NOT NULL,
`misc` MEDIUMTEXT NOT NULL,
`keybinds` MEDIUMTEXT NOT NULL,
`toggles` MEDIUMTEXT NOT NULL,
`modified` DATETIME NOT NULL,
`version` INT(11) NOT NULL,
PRIMARY KEY (`player`),
CONSTRAINT `linked_player` FOREIGN KEY (`player`)
REFERENCES `rp_player` (`id`)
ON DELETE CASCADE
ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

-- Security - Ipintel --

-- Ipintel Cache Table --
Expand Down
21 changes: 13 additions & 8 deletions citadel.dme
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,6 @@
#include "code\__DEFINES\shuttle.dm"
#include "code\__DEFINES\shuttles.dm"
#include "code\__DEFINES\singletons.dm"
#include "code\__DEFINES\skin.dm"
#include "code\__DEFINES\sonar.dm"
#include "code\__DEFINES\space.dm"
#include "code\__DEFINES\spaceman_dmm.dm"
Expand Down Expand Up @@ -131,6 +130,7 @@
#include "code\__DEFINES\atmospherics\machinery\scrubber.dm"
#include "code\__DEFINES\atmospherics\machinery\vent.dm"
#include "code\__DEFINES\cargo\supply.dm"
#include "code\__DEFINES\client\game_preferences.dm"
#include "code\__DEFINES\client\player_flags.dm"
#include "code\__DEFINES\client\playtime.dm"
#include "code\__DEFINES\color\color.dm"
Expand Down Expand Up @@ -200,6 +200,8 @@
#include "code\__DEFINES\fishing\aquarium.dm"
#include "code\__DEFINES\fishing\fish.dm"
#include "code\__DEFINES\fishing\fishing.dm"
#include "code\__DEFINES\interface\skin.dm"
#include "code\__DEFINES\interface\verbs.dm"
#include "code\__DEFINES\inventory\accessories.dm"
#include "code\__DEFINES\inventory\bodytypes.dm"
#include "code\__DEFINES\inventory\carry_weight.dm"
Expand Down Expand Up @@ -532,6 +534,7 @@
#include "code\controllers\subsystem\planets.dm"
#include "code\controllers\subsystem\plants.dm"
#include "code\controllers\subsystem\playtime.dm"
#include "code\controllers\subsystem\preferences.dm"
#include "code\controllers\subsystem\radiation.dm"
#include "code\controllers\subsystem\repository.dm"
#include "code\controllers\subsystem\research.dm"
Expand Down Expand Up @@ -2399,15 +2402,21 @@
#include "code\modules\client\wrappers.dm"
#include "code\modules\client\data\client_data.dm"
#include "code\modules\client\data\player_data.dm"
#include "code\modules\client\game_preferences\game_preference_entry.dm"
#include "code\modules\client\game_preferences\game_preference_middleware.dm"
#include "code\modules\client\game_preferences\game_preference_toggle.dm"
#include "code\modules\client\game_preferences\game_preferences.dm"
#include "code\modules\client\game_preferences\entries\game.dm"
#include "code\modules\client\game_preferences\entries\graphics.dm"
#include "code\modules\client\game_preferences\middleware\keybindings.dm"
#include "code\modules\client\game_preferences\middleware\toggles.dm"
#include "code\modules\client\onboarding\_onboarding.dm"
#include "code\modules\client\onboarding\age_verification.dm"
#include "code\modules\client\onboarding\panic_bunker.dm"
#include "code\modules\client\onboarding\security_checks.dm"
#include "code\modules\client\verbs\minimap.dm"
#include "code\modules\client\verbs\ooc.dm"
#include "code\modules\client\verbs\panic_bunker_player.dm"
#include "code\modules\client\verbs\ping.dm"
#include "code\modules\client\verbs\preferences.dm"
#include "code\modules\client\verbs\system.dm"
#include "code\modules\client\verbs\view.dm"
#include "code\modules\clothing\chameleon.dm"
#include "code\modules\clothing\clothing.dm"
Expand Down Expand Up @@ -4231,16 +4240,12 @@
#include "code\modules\preferences\preference_setup\general\04_equipment.dm"
#include "code\modules\preferences\preference_setup\general\05_background.dm"
#include "code\modules\preferences\preference_setup\general\06_flavor.dm"
#include "code\modules\preferences\preference_setup\global\01_ui.dm"
#include "code\modules\preferences\preference_setup\global\02_settings.dm"
#include "code\modules\preferences\preference_setup\global\03_pai.dm"
#include "code\modules\preferences\preference_setup\global\04_ooc.dm"
#include "code\modules\preferences\preference_setup\global\05_media.dm"
#include "code\modules\preferences\preference_setup\global\language_prefix.dm"
#include "code\modules\preferences\preference_setup\global\setting_datums.dm"
#include "code\modules\preferences\preference_setup\helpers\language_pick.dm"
#include "code\modules\preferences\preference_setup\helpers\species_pick.dm"
#include "code\modules\preferences\preference_setup\keybindings\keybindings.dm"
#include "code\modules\preferences\preference_setup\loadout\loadout.dm"
#include "code\modules\preferences\preference_setup\occupation\occupation.dm"
#include "code\modules\preferences\preference_setup\vore\01_ears.dm"
Expand Down
32 changes: 32 additions & 0 deletions code/__DEFINES/client/game_preferences.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
//* This file is explicitly licensed under the MIT license. *//
//* Copyright (c) 2023 Citadel Station developers. *//

//* Versioning *//

// Migration Directives:
// * prefer append-update instead of change-remove.
// append-update means write new, changed data instead of overwrite old data
// this means that reverting a testmerge doesn't cause problems.

// todo: how to do migration in a downstream-friendly way? current
// would require downstreams to manually edit code.
// this is bad!

// current version; bump to trigger migrations
#define GAME_PREFERENCES_VERSION_CURRENT 1
// prefs start at this version when legacy
#define GAME_PREFERENCES_VERSION_LEGACY 1
// at or below this, we throw out all data
#define GAME_PREFERENCES_VERSION_DROP 0

//* Misc Keys *//

/// boolean value for if we're in hotkeys mode
#define GAME_PREFERENCE_MISC_KEY_HOTKEY_MODE "hotkey-mode"

//* Category Names

// these are the same due to low entry count

#define GAME_PREFERENCE_CATEGORY_GAME "Game"
#define GAME_PREFERENCE_CATEGORY_GRAPHICS "Game"
1 change: 1 addition & 0 deletions code/__DEFINES/controllers/_subsystems.dm
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ DEFINE_BITFIELD(runlevels, list(
#define INIT_ORDER_EARLY_INIT 185
#define INIT_ORDER_REPOSITORY 180
#define INIT_ORDER_STATPANELS 170
#define INIT_ORDER_PREFERENCES 165
#define INIT_ORDER_INPUT 160
#define INIT_ORDER_JOBS 150
#define INIT_ORDER_CHARACTERS 140
Expand Down
7 changes: 7 additions & 0 deletions code/__DEFINES/skin.dm → code/__DEFINES/interface/skin.dm
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
//* This file is explicitly licensed under the MIT license. *//
//* Copyright (c) 2023 Citadel Station developers. *//

//? WINCLONE IDs; NO SKIN CONTROL MAY HAVE THESE IDs, OR WINCLONE WILL NOT CREATE "NAKED" CONTROLS OF THIS TYPE!
#define SKIN_ID_ABSTRACT_MENU "menu"
#define SKIN_ID_ABSTRACT_WINDOW "window"
Expand All @@ -17,6 +20,10 @@
/// main window split
#define SKIN_SPLITTER_ID_MAIN "mainwindow.split"

//* Chat System
#define SKIN_OUTPUT_ID_LEGACY_CHAT "output"
#define SKIN_BROWSER_ID_CHAT "outputbrowser"

//* Cutscene System
#define SKIN_BROWSER_ID_CUTSCENE "cutscenebrowser"

Expand Down
9 changes: 9 additions & 0 deletions code/__DEFINES/interface/verbs.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
//* This file is explicitly licensed under the MIT license. *//
//* Copyright (c) 2023 Citadel Station developers. *//

#define VERB_CATEGORY_IC "IC"
#define VERB_CATEGORY_OOC "OOC"
#define VERB_CATEGORY_OBJECT "Object"
#define VERB_CATEGORY_SYSTEM "System"

// todo: admin verb categories too
14 changes: 7 additions & 7 deletions code/__HELPERS/_logging.dm
Original file line number Diff line number Diff line change
Expand Up @@ -421,13 +421,13 @@ GLOBAL_LIST_INIT(testing_global_profiler, list("_PROFILE_NAME" = "Global"))
if (config_legacy.log_debug)
WRITE_LOG(GLOB.world_runtime_log, "DEBUG: [text]")

for(var/client/C in GLOB.admins)
if(C.is_preference_enabled(/datum/client_preference/debug/show_debug_logs))
to_chat(C,
type = MESSAGE_TYPE_DEBUG,
html = "DEBUG: [text]",
confidential = TRUE,
)
// for(var/client/C in GLOB.admins)
// if(C.get_preference_toggle(/datum/client_preference/debug/show_debug_logs))
// to_chat(C,
// type = MESSAGE_TYPE_DEBUG,
// html = "DEBUG: [text]",
// confidential = TRUE,
// )

/proc/log_ghostsay(text, mob/speaker)
if (config_legacy.log_say)
Expand Down
6 changes: 3 additions & 3 deletions code/__HELPERS/game.dm
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@
var/turf/ear = get_turf(M)
if(ear)
// Ghostship is magic: Ghosts can hear radio chatter from anywhere
if(speaker_coverage[ear] || (istype(M, /mob/observer/dead) && M.is_preference_enabled(/datum/client_preference/ghost_radio)))
if(speaker_coverage[ear] || (istype(M, /mob/observer/dead) && M.get_preference_toggle(/datum/game_preference_toggle/observer/ghost_radio)))
. |= M // Since we're already looping through mobs, why bother using |= ? This only slows things down.
return .

Expand Down Expand Up @@ -308,11 +308,11 @@
switch(type)
// Audio messages use ghost_ears.
if(1)
if(M.is_preference_enabled(/datum/client_preference/ghost_ears))
if(M.get_preference_toggle(/datum/game_preference_toggle/observer/ghost_ears))
mobs |= M
// Visual messages use ghost_sight.
if(2)
if(M.is_preference_enabled(/datum/client_preference/ghost_sight))
if(M.get_preference_toggle(/datum/game_preference_toggle/observer/ghost_sight))
mobs |= M

// For objects below the top level who still want to hear.
Expand Down
37 changes: 1 addition & 36 deletions code/__HELPERS/text.dm
Original file line number Diff line number Diff line change
Expand Up @@ -320,41 +320,6 @@
/proc/capitalize(t as text)
return uppertext(copytext_char(t, 1, 2)) + copytext_char(t, 2)

/**
* Syntax is "stringtoreplace"="stringtoreplacewith".
*/
/proc/autocorrect(input as text)
return input = replace_characters(input, list(
" i " = " I ",
"i'm" = "I'm",
"s's" = "s'",
"isnt" = "isn't",
"dont" = "don't",
"shouldnt" = "shouldn't",
" ive " = " I've ",
"whove" = "who've",
"whod" = "who’d",
"whats " = "what’s ",
"whatd" = "what’d",
"thats" = "that’s",
"thatll" = "that’ll",
"thatd" = "that’d",
" nows " = " now’s ",
"isnt" = "isn’t",
" arent " = " aren’t ",
"wasnt" = "wasn’t",
"werent" = "weren’t",
"havent" = "haven’t",
"hasnt" = "hasn’t",
"hadnt" = "hadn’t",
"doesnt" = "doesn’t",
"didnt" = "didn’t",
"couldnt" = "couldn’t",
"wouldnt" = "wouldn’t",
"mustnt" = "mustn’t",
"shouldnt" = "shouldn’t",
))

/**
* This proc strips html properly, remove < > and all text between
* for complete text sanitizing should be used sanitize()
Expand Down Expand Up @@ -460,7 +425,7 @@
GLOBAL_VAR_INIT(text_tag_icons, new /icon('./icons/chattags.dmi'))

/proc/create_text_tag(tagname, tagdesc = tagname, client/C)
if(!(C && C.is_preference_enabled(/datum/client_preference/chat_tags)))
if(!(C && C.get_preference_toggle(/datum/game_preference_toggle/chat/legacy_chat_tags)))
return tagdesc
return icon2html(GLOB.text_tag_icons, C, tagname)

Expand Down
2 changes: 1 addition & 1 deletion code/__HELPERS/unsorted.dm
Original file line number Diff line number Diff line change
Expand Up @@ -430,7 +430,7 @@
var/list/creatures = list()
var/list/namecounts = list()
for(var/mob/M in mobs)
if(isobserver(M) && ghostfollow && M.client?.holder && M.client.holder.fakekey && M.is_preference_enabled(/datum/client_preference/holder/stealth_ghost_mode))
if(isobserver(M) && ghostfollow && M.client?.holder && M.client.holder.fakekey && M.get_preference_toggle(/datum/game_preference_toggle/admin/stealth_hides_ghost))
continue
var/name = M.name
if (name in names)
Expand Down
Loading

0 comments on commit 39bc14b

Please sign in to comment.