mirror of
https://github.com/CHOMPStation2/CHOMPStation2.git
synced 2025-12-11 10:43:20 +00:00
Implementing RoundIDs (#7740)
This commit is contained in:
@@ -289,13 +289,31 @@ CREATE TABLE IF NOT EXISTS `vr_player_hours` (
|
||||
|
||||
-- Data exporting was unselected.
|
||||
|
||||
-- CHOMPedit Start - Mentors Database Table
|
||||
-- CHOMPedit Start
|
||||
CREATE TABLE IF NOT EXISTS `erro_mentor` (
|
||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`ckey` varchar(32) NOT NULL,
|
||||
`mentor` int(16) NOT NULL DEFAULT 0,
|
||||
PRIMARY KEY (`id`) USING BTREE
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=35 DEFAULT CHARSET=latin1 ROW_FORMAT=COMPACT;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `round` (
|
||||
`id` INT(11) NOT NULL AUTO_INCREMENT,
|
||||
`initialize_datetime` DATETIME NOT NULL,
|
||||
`start_datetime` DATETIME NULL,
|
||||
`shutdown_datetime` DATETIME NULL,
|
||||
`end_datetime` DATETIME NULL,
|
||||
`server_ip` INT(10) UNSIGNED NOT NULL,
|
||||
`server_port` SMALLINT(5) UNSIGNED NOT NULL,
|
||||
`commit_hash` CHAR(40) NULL,
|
||||
`game_mode` VARCHAR(32) NULL,
|
||||
`game_mode_result` VARCHAR(64) NULL,
|
||||
`end_state` VARCHAR(64) NULL,
|
||||
`shuttle_name` VARCHAR(64) NULL,
|
||||
`map_name` VARCHAR(32) NULL,
|
||||
`station_name` VARCHAR(80) NULL,
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
|
||||
-- CHOMPedit End
|
||||
|
||||
/*!40101 SET SQL_MODE=IFNULL(@OLD_SQL_MODE, '') */;
|
||||
|
||||
2
code/_global_vars/logging_ch.dm
Normal file
2
code/_global_vars/logging_ch.dm
Normal file
@@ -0,0 +1,2 @@
|
||||
GLOBAL_VAR(round_id)
|
||||
GLOBAL_PROTECT(round_id)
|
||||
@@ -1165,6 +1165,8 @@ var/list/gamemode_cache = list()
|
||||
return runnable_modes
|
||||
|
||||
/datum/configuration/proc/post_load()
|
||||
SSdbcore.InitializeRound() // CHOMPEdit
|
||||
|
||||
//apply a default value to config.python_path, if needed
|
||||
if (!config.python_path)
|
||||
if(world.system_type == UNIX)
|
||||
|
||||
@@ -95,11 +95,12 @@ SUBSYSTEM_DEF(dbcore)
|
||||
else
|
||||
log_debug("Database is not enabled in configuration.")
|
||||
|
||||
/*/datum/controller/subsystem/dbcore/proc/SetRoundID()
|
||||
/datum/controller/subsystem/dbcore/proc/InitializeRound()
|
||||
if(!Connect())
|
||||
return
|
||||
var/DBQuery/query_round_initialize = SSdbcore.NewQuery(
|
||||
"INSERT INTO [format_table_name("round")] (initialize_datetime, server_ip, server_port) VALUES (Now(), INET_ATON(:internet_address), :port)",
|
||||
//"INSERT INTO [format_table_name("round")] (initialize_datetime, server_ip, server_port) VALUES (Now(), INET_ATON(:internet_address), :port)",
|
||||
"INSERT INTO round (initialize_datetime, server_ip, server_port) VALUES (Now(), INET_ATON(:internet_address), :port)",
|
||||
list("internet_address" = world.internet_address || "0", "port" = "[world.port]")
|
||||
)
|
||||
query_round_initialize.Execute(async = FALSE)
|
||||
@@ -110,7 +111,8 @@ SUBSYSTEM_DEF(dbcore)
|
||||
if(!Connect())
|
||||
return
|
||||
var/DBQuery/query_round_start = SSdbcore.NewQuery(
|
||||
"UPDATE [format_table_name("round")] SET start_datetime = Now() WHERE id = :round_id",
|
||||
//"UPDATE [format_table_name("round")] SET start_datetime = Now() WHERE id = :round_id",
|
||||
"UPDATE round SET start_datetime = Now() WHERE id = :round_id",
|
||||
list("round_id" = GLOB.round_id)
|
||||
)
|
||||
query_round_start.Execute()
|
||||
@@ -120,11 +122,13 @@ SUBSYSTEM_DEF(dbcore)
|
||||
if(!Connect())
|
||||
return
|
||||
var/DBQuery/query_round_end = SSdbcore.NewQuery(
|
||||
"UPDATE [format_table_name("round")] SET end_datetime = Now(), game_mode_result = :game_mode_result, station_name = :station_name WHERE id = :round_id",
|
||||
list("game_mode_result" = SSticker.mode_result, "station_name" = station_name(), "round_id" = GLOB.round_id)
|
||||
//"UPDATE [format_table_name("round")] SET end_datetime = Now(), game_mode_result = :game_mode_result, station_name = :station_name WHERE id = :round_id",
|
||||
"UPDATE round SET end_datetime = Now(), game_mode_result = :game_mode_result, station_name = :station_name WHERE id = :round_id",
|
||||
//list("game_mode_result" = SSticker.mode_result, "station_name" = station_name(), "round_id" = GLOB.round_id)
|
||||
list("game_mode_result" = "extended", "station_name" = station_name(), "round_id" = GLOB.round_id) // FIXME: temporary solution as we only use extended so far
|
||||
)
|
||||
query_round_end.Execute()
|
||||
qdel(query_round_end)*/
|
||||
qdel(query_round_end)
|
||||
|
||||
/datum/controller/subsystem/dbcore/proc/Disconnect()
|
||||
failed_connections = 0
|
||||
|
||||
@@ -540,6 +540,8 @@ var/global/datum/controller/subsystem/ticker/ticker
|
||||
for(var/i in total_antagonists)
|
||||
log_game("[i]s[total_antagonists[i]].")
|
||||
|
||||
SSdbcore.SetRoundEnd() // CHOMPEdit
|
||||
|
||||
return 1
|
||||
|
||||
/datum/controller/subsystem/ticker/stat_entry()
|
||||
|
||||
@@ -218,6 +218,7 @@ var/global/list/additional_antag_types = list()
|
||||
emergency_shuttle.auto_recall = 1
|
||||
|
||||
feedback_set_details("round_start","[time2text(world.realtime)]")
|
||||
INVOKE_ASYNC(SSdbcore, TYPE_PROC_REF(/datum/controller/subsystem/dbcore,SetRoundStart)) // CHOMPEdit
|
||||
if(ticker && ticker.mode)
|
||||
feedback_set_details("game_mode","[ticker.mode]")
|
||||
feedback_set_details("server_ip","[world.internet_address]:[world.port]")
|
||||
|
||||
@@ -79,6 +79,10 @@
|
||||
"address" = client.address,
|
||||
"computer_id" = client.computer_id,
|
||||
),
|
||||
// CHOMPEdit - "server" section
|
||||
"server" = list(
|
||||
"round_id" = GLOB.round_id,
|
||||
),
|
||||
"window" = list(
|
||||
"fancy" = FALSE,
|
||||
"locked" = FALSE,
|
||||
|
||||
@@ -126,6 +126,7 @@
|
||||
#include "code\__defines\dcs\signals_ch.dm"
|
||||
#include "code\_global_vars\_regexes.dm"
|
||||
#include "code\_global_vars\bitfields.dm"
|
||||
#include "code\_global_vars\logging_ch.dm"
|
||||
#include "code\_global_vars\misc.dm"
|
||||
#include "code\_global_vars\mobs.dm"
|
||||
#include "code\_global_vars\sensitive.dm"
|
||||
|
||||
Reference in New Issue
Block a user