From 9295425eaff8bf37e15c563343b804be066602a2 Mon Sep 17 00:00:00 2001 From: Legendaxe <102746941+Legendaxe@users.noreply.github.com> Date: Wed, 6 Dec 2023 16:39:42 +0200 Subject: [PATCH 1/3] added: species whitelist --- SQL/paradise_schema.sql | 1 + SQL/updates220/53.220.5-53.220.6.sql | 4 +++ code/__DEFINES/misc_defines.dm | 2 +- code/game/jobs/whitelist.dm | 15 ++++++++-- config/example/config.toml | 8 ++++- modular_ss220/modular_ss220.dme | 1 + .../species_whitelist/_species_whitelist.dm | 4 +++ .../species_whitelist/_species_whitelist.dme | 4 +++ .../code/species_whitelist_configuration.dm | 14 +++++++++ .../code/species_whitelist_preferences.dm | 30 +++++++++++++++++++ 10 files changed, 79 insertions(+), 4 deletions(-) create mode 100644 SQL/updates220/53.220.5-53.220.6.sql create mode 100644 modular_ss220/species_whitelist/_species_whitelist.dm create mode 100644 modular_ss220/species_whitelist/_species_whitelist.dme create mode 100644 modular_ss220/species_whitelist/code/species_whitelist_configuration.dm create mode 100644 modular_ss220/species_whitelist/code/species_whitelist_preferences.dm diff --git a/SQL/paradise_schema.sql b/SQL/paradise_schema.sql index d00d5e14da36..ff0786f0b30d 100644 --- a/SQL/paradise_schema.sql +++ b/SQL/paradise_schema.sql @@ -297,6 +297,7 @@ CREATE TABLE `player` ( `server_region` VARCHAR(32) NULL DEFAULT NULL COLLATE 'utf8mb4_general_ci', `muted_adminsounds_ckeys` MEDIUMTEXT NULL DEFAULT NULL COLLATE 'utf8mb4_general_ci', `viewrange` VARCHAR(5) NOT NULL DEFAULT '19x15' COLLATE 'utf8mb4_general_ci', + `species_whitelist` LONGTEXT COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '["human"]', PRIMARY KEY (`id`), UNIQUE KEY `ckey` (`ckey`), KEY `lastseen` (`lastseen`), diff --git a/SQL/updates220/53.220.5-53.220.6.sql b/SQL/updates220/53.220.5-53.220.6.sql new file mode 100644 index 000000000000..d39755af7e84 --- /dev/null +++ b/SQL/updates220/53.220.5-53.220.6.sql @@ -0,0 +1,4 @@ +# Updating DB from 53.220.5 to 53.220.6 +# Adds species whitelist ~legendaxe + +ALTER TABLE `player` ADD `species_whitelist` LONGTEXT COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '["human"]'; diff --git a/code/__DEFINES/misc_defines.dm b/code/__DEFINES/misc_defines.dm index 3641f687896e..1247d77e0047 100644 --- a/code/__DEFINES/misc_defines.dm +++ b/code/__DEFINES/misc_defines.dm @@ -375,7 +375,7 @@ #define INVESTIGATE_BOMB "bombs" // The SQL version required by this version of the code -#define SQL_VERSION 532205 // SS220 EDIT +#define SQL_VERSION 532206 // SS220 EDIT // Vending machine stuff #define CAT_NORMAL 1 diff --git a/code/game/jobs/whitelist.dm b/code/game/jobs/whitelist.dm index 23b2d842bc75..45c9d0d556c7 100644 --- a/code/game/jobs/whitelist.dm +++ b/code/game/jobs/whitelist.dm @@ -14,9 +14,20 @@ if(NOT_SELECTABLE in S.species_traits) return FALSE + // SS220 EDIT START + // Yes if admin - if(check_rights(R_ADMIN, FALSE)) - return TRUE + //if(check_rights(R_ADMIN, FALSE)) + // return TRUE + + if(GLOB.configuration.species_whitelist.species_whitelist_enabled) + if(!M.client?.prefs?.species_whitelist) + return FALSE + + if(!(species in M.client.prefs.species_whitelist)) + return FALSE + + // SS220 EDIT END // No if species is blacklisted if(S.blacklisted) diff --git a/config/example/config.toml b/config/example/config.toml index a5e6a38d0039..806902f22aee 100644 --- a/config/example/config.toml +++ b/config/example/config.toml @@ -147,7 +147,7 @@ ipc_screens = [ # Enable/disable the database on a whole sql_enabled = false # SQL version. If this is a mismatch, round start will be delayed -sql_version = 532205 +sql_version = 532206 # SQL server address. Can be an IP or DNS name sql_address = "127.0.0.1" # SQL server port @@ -895,3 +895,9 @@ ffmpeg_cpuaffinity = "" force_discord_verification = false ################################################################ + +[species_whitelist_configuration] + +species_whitelist_enabled = false + +################################################################ diff --git a/modular_ss220/modular_ss220.dme b/modular_ss220/modular_ss220.dme index ef38cf6c50ab..9596927f48f8 100644 --- a/modular_ss220/modular_ss220.dme +++ b/modular_ss220/modular_ss220.dme @@ -75,6 +75,7 @@ #include "mecha_skins/mecha_skins.dme" #include "queue/_queue.dme" #include "phrases/_phrases.dme" +#include "species_whitelist/_species_whitelist.dme" // --- PRIME --- // // #define MODPACK_MAIN_ONLY diff --git a/modular_ss220/species_whitelist/_species_whitelist.dm b/modular_ss220/species_whitelist/_species_whitelist.dm new file mode 100644 index 000000000000..308df37ef295 --- /dev/null +++ b/modular_ss220/species_whitelist/_species_whitelist.dm @@ -0,0 +1,4 @@ +/datum/modpack/discord_link + name = "Вайтлист на расы" + desc = "Добавление вайтлиста на расы" + author = "legendaxe" diff --git a/modular_ss220/species_whitelist/_species_whitelist.dme b/modular_ss220/species_whitelist/_species_whitelist.dme new file mode 100644 index 000000000000..4d322dfee0df --- /dev/null +++ b/modular_ss220/species_whitelist/_species_whitelist.dme @@ -0,0 +1,4 @@ +#include "_species_whitelist.dm" + +#include "code/species_whitelist_configuration.dm" +#include "code/species_whitelist_preferences.dm" diff --git a/modular_ss220/species_whitelist/code/species_whitelist_configuration.dm b/modular_ss220/species_whitelist/code/species_whitelist_configuration.dm new file mode 100644 index 000000000000..50bcfb171b4b --- /dev/null +++ b/modular_ss220/species_whitelist/code/species_whitelist_configuration.dm @@ -0,0 +1,14 @@ +/datum/server_configuration + /// Holder for the gateway configuration datum + var/datum/configuration_section/species_whitelist_configuration/species_whitelist + +/datum/server_configuration/load_all_sections() + . = ..() + species_whitelist = new() + safe_load(species_whitelist, "species_whitelist_configuration") + +/datum/configuration_section/species_whitelist_configuration + var/species_whitelist_enabled = FALSE + +/datum/configuration_section/species_whitelist_configuration/load_data(list/data) + CONFIG_LOAD_BOOL(species_whitelist_enabled, data["species_whitelist_enabled"]) diff --git a/modular_ss220/species_whitelist/code/species_whitelist_preferences.dm b/modular_ss220/species_whitelist/code/species_whitelist_preferences.dm new file mode 100644 index 000000000000..62a7ea75c89e --- /dev/null +++ b/modular_ss220/species_whitelist/code/species_whitelist_preferences.dm @@ -0,0 +1,30 @@ +/datum/preferences + var/species_whitelist + +/datum/preferences/proc/get_species_whitelist() + . = TRUE + + if(species_whitelist) + return + + var/datum/db_query/preferences_query = SSdbcore.NewQuery("SELECT species_whitelist FROM player WHERE ckey=:ckey", list( + "ckey" = parent.ckey + )) + + if(!preferences_query.warn_execute()) + qdel(preferences_query) + return FALSE + + while(preferences_query.NextRow()) + var/species_whitelist_json = preferences_query.item[1] + if(species_whitelist_json) + species_whitelist = json_decode(preferences_query.item[1]) + + qdel(preferences_query) + +/datum/preferences/load_preferences(datum/db_query/query) + . = ..() + if(!.) + return + + return get_species_whitelist() From c168cc5fbeb40d48e5604a4db16c807e3cecc1a2 Mon Sep 17 00:00:00 2001 From: Legendaxe <102746941+Legendaxe@users.noreply.github.com> Date: Wed, 6 Dec 2023 16:52:14 +0200 Subject: [PATCH 2/3] sql fix --- SQL/paradise_schema.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SQL/paradise_schema.sql b/SQL/paradise_schema.sql index ff0786f0b30d..6855c02dabe0 100644 --- a/SQL/paradise_schema.sql +++ b/SQL/paradise_schema.sql @@ -297,7 +297,7 @@ CREATE TABLE `player` ( `server_region` VARCHAR(32) NULL DEFAULT NULL COLLATE 'utf8mb4_general_ci', `muted_adminsounds_ckeys` MEDIUMTEXT NULL DEFAULT NULL COLLATE 'utf8mb4_general_ci', `viewrange` VARCHAR(5) NOT NULL DEFAULT '19x15' COLLATE 'utf8mb4_general_ci', - `species_whitelist` LONGTEXT COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '["human"]', + `species_whitelist` LONGTEXT COLLATE utf8mb4_unicode_ci NOT NULL, PRIMARY KEY (`id`), UNIQUE KEY `ckey` (`ckey`), KEY `lastseen` (`lastseen`), From 8b52293481f53ddcc80bee61a18c689df53ecbd0 Mon Sep 17 00:00:00 2001 From: Legendaxe <102746941+Legendaxe@users.noreply.github.com> Date: Thu, 7 Dec 2023 13:43:19 +0200 Subject: [PATCH 3/3] added: bg3 seeds --- modular_ss220/text_to_speech/code/_defines.dm | 1 + .../text_to_speech/code/seeds/silero.dm | 78 +++++++++++++++++++ 2 files changed, 79 insertions(+) diff --git a/modular_ss220/text_to_speech/code/_defines.dm b/modular_ss220/text_to_speech/code/_defines.dm index 76aa786cfde3..b76348a641ac 100644 --- a/modular_ss220/text_to_speech/code/_defines.dm +++ b/modular_ss220/text_to_speech/code/_defines.dm @@ -34,6 +34,7 @@ #define TTS_CATEGORY_LEFT4DEAD "Left 4 Dead" #define TTS_CATEGORY_SPONGEBOB "SpongeBob" #define TTS_CATEGORY_TINYBUNNY "Tiny Bunny" +#define TTS_CATEGORY_BALDURS_GATE_3 "Baldur's gate 3" #define TTS_GENDER_ANY "Любой" #define TTS_GENDER_MALE "Мужской" diff --git a/modular_ss220/text_to_speech/code/seeds/silero.dm b/modular_ss220/text_to_speech/code/seeds/silero.dm index 538192ccd911..f3d5611a3694 100644 --- a/modular_ss220/text_to_speech/code/seeds/silero.dm +++ b/modular_ss220/text_to_speech/code/seeds/silero.dm @@ -4327,3 +4327,81 @@ category = TTS_CATEGORY_WITCHER gender = TTS_GENDER_MALE required_donator_level = 1 + +/datum/tts_seed/silero/gale + name = "Gale" + value = "en_Gale" + category = TTS_CATEGORY_BALDURS_GATE_3 + gender = TTS_GENDER_MALE + +/datum/tts_seed/silero/jaheira + name = "Jaheira" + value = "en_Jaheira" + category = TTS_CATEGORY_BALDURS_GATE_3 + gender = TTS_GENDER_FEMALE + +/datum/tts_seed/silero/laezel + name = "Laezel" + value = "en_Laezel" + category = TTS_CATEGORY_BALDURS_GATE_3 + gender = TTS_GENDER_FEMALE + +/datum/tts_seed/silero/karlach + name = "Karlach" + value = "en_Karlach" + category = TTS_CATEGORY_BALDURS_GATE_3 + gender = TTS_GENDER_FEMALE + +/datum/tts_seed/silero/shadowheart + name = "Shadowheart" + value = "en_Shadowheart" + category = TTS_CATEGORY_BALDURS_GATE_3 + gender = TTS_GENDER_FEMALE + +/datum/tts_seed/silero/wyll + name = "Wyll" + value = "en_Wyll" + category = TTS_CATEGORY_BALDURS_GATE_3 + gender = TTS_GENDER_MALE + +/datum/tts_seed/silero/minthara + name = "Minthara" + value = "en_Minthara" + category = TTS_CATEGORY_BALDURS_GATE_3 + gender = TTS_GENDER_FEMALE + +/datum/tts_seed/silero/minsc + name = "Minsc" + value = "en_Minsc" + category = TTS_CATEGORY_BALDURS_GATE_3 + gender = TTS_GENDER_MALE + +/datum/tts_seed/silero/astarion + name = "Astarion" + value = "en_Astarion" + category = TTS_CATEGORY_BALDURS_GATE_3 + gender = TTS_GENDER_MALE + +/datum/tts_seed/silero/halsin + name = "Halsin" + value = "en_Halsin" + category = TTS_CATEGORY_BALDURS_GATE_3 + gender = TTS_GENDER_MALE + +/datum/tts_seed/silero/emperor_bg3 + name = "Emperor" + value = "en_Emperor" + category = TTS_CATEGORY_BALDURS_GATE_3 + gender = TTS_GENDER_MALE + +/datum/tts_seed/silero/ketheric + name = "Ketheric" + value = "en_Ketheric" + category = TTS_CATEGORY_BALDURS_GATE_3 + gender = TTS_GENDER_MALE + +/datum/tts_seed/silero/gortash + name = "Gortash" + value = "en_Gortash" + category = TTS_CATEGORY_BALDURS_GATE_3 + gender = TTS_GENDER_MALE