mirror of
https://github.com/ParadiseSS13/Paradise.git
synced 2026-07-11 07:03:30 +01:00
System configuration
This commit is contained in:
@@ -35,10 +35,3 @@ GLOBAL_VAR_INIT(eventchance, 10) //% per 5 mins
|
||||
GLOBAL_VAR_INIT(event, 0)
|
||||
GLOBAL_VAR_INIT(hadevent, 0)
|
||||
GLOBAL_VAR_INIT(blobevent, 0)
|
||||
|
||||
// These vars are protected because changing them could pose a security risk, though they are fine to be read since they are just system paths
|
||||
GLOBAL_VAR(shutdown_shell_command) // Command to run if shutting down (SHUTDOWN_ON_REBOOT) instead of rebooting
|
||||
GLOBAL_PROTECT(shutdown_shell_command)
|
||||
|
||||
GLOBAL_VAR(python_path) //Path to the python executable. Defaults to "python" on windows and "/usr/bin/env python2" on unix
|
||||
GLOBAL_PROTECT(python_path)
|
||||
|
||||
@@ -24,8 +24,6 @@
|
||||
var/mods_are_mentors = 0
|
||||
var/automute_on = 0 //enables automuting/spam prevention
|
||||
var/round_abandon_penalty_period = 30 MINUTES // Time from round start during which ghosting out is penalized
|
||||
var/medal_hub_address = null
|
||||
var/medal_hub_password = null
|
||||
|
||||
var/reactionary_explosions = 0 //If we use reactionary explosions, explosions that react to walls and doors
|
||||
|
||||
@@ -95,7 +93,6 @@
|
||||
|
||||
var/ghost_interaction = 0
|
||||
|
||||
var/comms_password = ""
|
||||
|
||||
var/default_laws = 0 //Controls what laws the AI spawns with.
|
||||
|
||||
@@ -114,8 +111,6 @@
|
||||
|
||||
var/disable_ooc_emoji = 0 // prevents people from using emoji in OOC
|
||||
|
||||
var/shutdown_on_reboot = 0 // Whether to shut down the world instead of rebooting it
|
||||
|
||||
var/disable_karma = 0 // Disable all karma functions and unlock karma jobs by default
|
||||
|
||||
// Nightshift
|
||||
@@ -299,19 +294,6 @@
|
||||
if("ghost_interaction")
|
||||
config.ghost_interaction = 1
|
||||
|
||||
if("comms_password")
|
||||
config.comms_password = value
|
||||
|
||||
if("python_path")
|
||||
#warn AA clear this up
|
||||
if(value)
|
||||
GLOB.python_path = value
|
||||
else
|
||||
if(world.system_type == UNIX)
|
||||
GLOB.python_path = "/usr/bin/env python2"
|
||||
else //probably windows, if not this should work anyway
|
||||
GLOB.python_path = "pythonw"
|
||||
|
||||
if("allow_drone_spawn")
|
||||
config.allow_drone_spawn = text2num(value)
|
||||
|
||||
@@ -336,22 +318,9 @@
|
||||
if("round_abandon_penalty_period")
|
||||
config.round_abandon_penalty_period = text2num(value) MINUTES
|
||||
|
||||
if("medal_hub_address")
|
||||
config.medal_hub_address = value
|
||||
|
||||
if("medal_hub_password")
|
||||
config.medal_hub_password = value
|
||||
|
||||
if("disable_ooc_emoji")
|
||||
config.disable_ooc_emoji = 1
|
||||
|
||||
if("shutdown_on_reboot")
|
||||
config.shutdown_on_reboot = 1
|
||||
|
||||
if("shutdown_shell_command")
|
||||
#warn AA clear this up
|
||||
GLOB.shutdown_shell_command = value
|
||||
|
||||
if("disable_karma")
|
||||
config.disable_karma = 1
|
||||
|
||||
|
||||
@@ -31,6 +31,8 @@ GLOBAL_DATUM_INIT(configuration, /datum/server_configuration, new())
|
||||
var/datum/configuration_section/overflow_configuration/overflow
|
||||
/// Holder for the ruins configuration datum
|
||||
var/datum/configuration_section/ruin_configuration/ruins
|
||||
/// Holder for the system configuration datum
|
||||
var/datum/configuration_section/system_configuration/system
|
||||
/// Holder for the voting configuration datum
|
||||
var/datum/configuration_section/vote_configuration/vote
|
||||
|
||||
@@ -60,6 +62,7 @@ GLOBAL_DATUM_INIT(configuration, /datum/server_configuration, new())
|
||||
mc = new()
|
||||
overflow = new()
|
||||
ruins = new()
|
||||
system = new()
|
||||
vote = new()
|
||||
|
||||
// Load our stuff up
|
||||
@@ -83,6 +86,7 @@ GLOBAL_DATUM_INIT(configuration, /datum/server_configuration, new())
|
||||
mc.load_data(raw_config_data["mc_configuration"])
|
||||
overflow.load_data(raw_config_data["overflow_configuration"])
|
||||
ruins.load_data(raw_config_data["ruin_configuration"])
|
||||
system.load_data(raw_config_data["system_configuration"])
|
||||
vote.load_data(raw_config_data["voting_configuration"])
|
||||
|
||||
// And report the load
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
/// Config holder for stuff relating to server backend management and secrets
|
||||
/datum/configuration_section/system_configuration
|
||||
// NO EDITS OR READS TO THIS WHAT SOEVER
|
||||
protection_state = PROTECTION_PRIVATE
|
||||
/// Password for authorising world/Topic requests
|
||||
var/topic_key = null
|
||||
/// Medal hub address for lavaland stats
|
||||
var/medal_hub_address = null
|
||||
/// Medal hub password for lavaland stats
|
||||
var/medal_hub_password = null
|
||||
/// Do we want the server to kill on reboot instead of keeping the same DD session
|
||||
var/shutdown_on_reboot = FALSE
|
||||
/// If above is true, you can run a shell command
|
||||
var/shutdown_shell_command = null
|
||||
|
||||
/datum/configuration_section/system_configuration/load_data(list/data)
|
||||
// Use the load wrappers here. That way the default isnt made 'null' if you comment out the config line
|
||||
CONFIG_LOAD_BOOL(shutdown_on_reboot, data["shutdown_on_reboot"])
|
||||
|
||||
CONFIG_LOAD_STR(topic_key, data["communications_password"])
|
||||
CONFIG_LOAD_STR(medal_hub_address, data["medal_hub_address"])
|
||||
CONFIG_LOAD_STR(medal_hub_password, data["medal_hub_password"])
|
||||
CONFIG_LOAD_STR(shutdown_shell_command, data["shutdown_shell_command"])
|
||||
@@ -4,15 +4,15 @@ SUBSYSTEM_DEF(medals)
|
||||
var/hub_enabled = FALSE
|
||||
|
||||
/datum/controller/subsystem/medals/Initialize(timeofday)
|
||||
if(config.medal_hub_address && config.medal_hub_password)
|
||||
if(GLOB.configuration.system.medal_hub_address && GLOB.configuration.system.medal_hub_password)
|
||||
hub_enabled = TRUE
|
||||
..()
|
||||
return ..()
|
||||
|
||||
/datum/controller/subsystem/medals/proc/UnlockMedal(medal, client/player)
|
||||
set waitfor = FALSE
|
||||
if(!medal || !hub_enabled)
|
||||
return
|
||||
if(isnull(world.SetMedal(medal, player, config.medal_hub_address, config.medal_hub_password)))
|
||||
if(isnull(world.SetMedal(medal, player, GLOB.configuration.system.medal_hub_address, GLOB.configuration.system.medal_hub_password)))
|
||||
hub_enabled = FALSE
|
||||
log_game("MEDAL ERROR: Could not contact hub to award medal [medal] to player [player.ckey].")
|
||||
message_admins("Error! Failed to contact hub to award [medal] medal to [player.ckey]!")
|
||||
@@ -35,7 +35,7 @@ SUBSYSTEM_DEF(medals)
|
||||
|
||||
var/newscoreparam = list2params(oldscore)
|
||||
|
||||
if(isnull(world.SetScores(player.ckey, newscoreparam, config.medal_hub_address, config.medal_hub_password)))
|
||||
if(isnull(world.SetScores(player.ckey, newscoreparam, GLOB.configuration.system.medal_hub_address, GLOB.configuration.system.medal_hub_password)))
|
||||
hub_enabled = FALSE
|
||||
log_game("SCORE ERROR: Could not contact hub to set score. Score [score] for player [player.ckey].")
|
||||
message_admins("Error! Failed to contact hub to set [score] score for [player.ckey]!")
|
||||
@@ -44,7 +44,7 @@ SUBSYSTEM_DEF(medals)
|
||||
if(!score || !hub_enabled)
|
||||
return
|
||||
|
||||
var/scoreget = world.GetScores(player.ckey, score, config.medal_hub_address, config.medal_hub_password)
|
||||
var/scoreget = world.GetScores(player.ckey, score, GLOB.configuration.system.medal_hub_address, GLOB.configuration.system.medal_hub_password)
|
||||
if(isnull(scoreget))
|
||||
hub_enabled = FALSE
|
||||
log_game("SCORE ERROR: Could not contact hub to get score. Score [score] for player [player.ckey].")
|
||||
@@ -58,7 +58,7 @@ SUBSYSTEM_DEF(medals)
|
||||
if(!medal || !hub_enabled)
|
||||
return
|
||||
|
||||
if(isnull(world.GetMedal(medal, player, config.medal_hub_address, config.medal_hub_password)))
|
||||
if(isnull(world.GetMedal(medal, player, GLOB.configuration.system.medal_hub_address, GLOB.configuration.system.medal_hub_password)))
|
||||
hub_enabled = FALSE
|
||||
log_game("MEDAL ERROR: Could not contact hub to get medal [medal] for player [player.ckey]")
|
||||
message_admins("Error! Failed to contact hub to get [medal] medal for [player.ckey]!")
|
||||
@@ -68,7 +68,7 @@ SUBSYSTEM_DEF(medals)
|
||||
/datum/controller/subsystem/medals/proc/LockMedal(medal, client/player)
|
||||
if(!player || !medal || !hub_enabled)
|
||||
return
|
||||
var/result = world.ClearMedal(medal, player, config.medal_hub_address, config.medal_hub_password)
|
||||
var/result = world.ClearMedal(medal, player, GLOB.configuration.system.medal_hub_address, GLOB.configuration.system.medal_hub_password)
|
||||
switch(result)
|
||||
if(null)
|
||||
hub_enabled = FALSE
|
||||
@@ -81,6 +81,6 @@ SUBSYSTEM_DEF(medals)
|
||||
|
||||
|
||||
/datum/controller/subsystem/medals/proc/ClearScore(client/player)
|
||||
if(isnull(world.SetScores(player.ckey, "", config.medal_hub_address, config.medal_hub_password)))
|
||||
if(isnull(world.SetScores(player.ckey, "", GLOB.configuration.system.medal_hub_address, GLOB.configuration.system.medal_hub_password)))
|
||||
log_game("MEDAL ERROR: Could not contact hub to clear scores for [player.ckey].")
|
||||
message_admins("Error! Failed to contact hub to clear scores for [player.ckey]!")
|
||||
|
||||
+6
-6
@@ -130,10 +130,10 @@ GLOBAL_LIST_EMPTY(world_topic_handlers)
|
||||
to_chat(world, "<span class='boldannounce'>Rebooting world immediately due to host request</span>")
|
||||
rustg_log_close_all() // Past this point, no logging procs can be used, at risk of data loss.
|
||||
// Now handle a reboot
|
||||
if(config && config.shutdown_on_reboot)
|
||||
if(GLOB?.configuration?.system.shutdown_on_reboot)
|
||||
sleep(0)
|
||||
if(GLOB.shutdown_shell_command)
|
||||
shell(GLOB.shutdown_shell_command)
|
||||
if(GLOB.configuration.system.shutdown_shell_command)
|
||||
shell(GLOB.configuration.system.shutdown_shell_command)
|
||||
del(world)
|
||||
TgsEndProcess() // We want to shutdown on reboot. That means kill our TGS process "gracefully", instead of the watchdog crying
|
||||
return
|
||||
@@ -164,10 +164,10 @@ GLOBAL_LIST_EMPTY(world_topic_handlers)
|
||||
|
||||
// And begin the real shutdown
|
||||
rustg_log_close_all() // Past this point, no logging procs can be used, at risk of data loss.
|
||||
if(config && config.shutdown_on_reboot)
|
||||
if(GLOB?.configuration?.system.shutdown_on_reboot)
|
||||
sleep(0)
|
||||
if(GLOB.shutdown_shell_command)
|
||||
shell(GLOB.shutdown_shell_command)
|
||||
if(GLOB.configuration.system.shutdown_shell_command)
|
||||
shell(GLOB.configuration.system.shutdown_shell_command)
|
||||
rustg_log_close_all() // Past this point, no logging procs can be used, at risk of data loss.
|
||||
del(world)
|
||||
TgsEndProcess() // We want to shutdown on reboot. That means kill our TGS process "gracefully", instead of the watchdog crying
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
*/
|
||||
/datum/world_topic_handler/proc/invoke(list/input)
|
||||
SHOULD_NOT_OVERRIDE(TRUE)
|
||||
var/authorised = (config.comms_password && input["key"] == config.comms_password) // No password means no comms, not any password
|
||||
var/authorised = (GLOB.configuration.system.topic_key && input["key"] == GLOB.configuration.system.topic_key) // No password means no comms, not any password
|
||||
if(requires_commskey && !authorised)
|
||||
// Try keep all returns in JSON unless absolutely necessary (?ping for example)
|
||||
return(json_encode(list("error" = "Invalid Key")))
|
||||
|
||||
@@ -198,6 +198,7 @@
|
||||
#include "code\controllers\configuration\sections\mc_configuration.dm"
|
||||
#include "code\controllers\configuration\sections\overflow_configuration.dm"
|
||||
#include "code\controllers\configuration\sections\ruin_configuration.dm"
|
||||
#include "code\controllers\configuration\sections\system_configuration.dm"
|
||||
#include "code\controllers\configuration\sections\vote_configuration.dm"
|
||||
#include "code\controllers\subsystem\acid.dm"
|
||||
#include "code\controllers\subsystem\afk.dm"
|
||||
|
||||
Reference in New Issue
Block a user