Add logging of deathgasp last words and suicide stats to the death table

This commit is contained in:
CitadelStationBot
2017-08-20 19:41:58 -05:00
parent 2181449c7d
commit 3862fb5d5e
7 changed files with 39 additions and 9 deletions

View File

@@ -1,15 +1,36 @@
diff a/SQL/database_changelog.txt b/SQL/database_changelog.txt (rejected hunks)
@@ -1,10 +1,10 @@
@@ -1,26 +1,20 @@
Any time you make a change to the schema files, remember to increment the database schema version. Generally increment the minor number, major should be reserved for significant changes to the schema. Both values go up to 255.
-The latest database version is 3.1; The query to update the schema revision table is:
+The latest database version is 3.0; The query to update the schema revision table is:
-The latest database version is 3.2; The query to update the schema revision table is:
+The latest database version is 3.1; The query to update the schema revision table is:
-UPDATE `schema_revision` SET major = 3, minor = 1 LIMIT 1;
+INSERT INTO `schema_revision` (`major`, `minor`) VALUES (3, 0);
-INSERT INTO `schema_revision` (`major`, `minor`) VALUES (3, 2);
+INSERT INTO `schema_revision` (`major`, `minor`) VALUES (3, 1);
or
-UPDATE `SS13_schema_revision` SET major = 3, minor = 1 LIMIT 1;
+INSERT INTO `SS13_schema_revision` (`major`, `minor`) VALUES (3, 0);
-INSERT INTO `SS13_schema_revision` (`major`, `minor`) VALUES (3, 2);
+INSERT INTO `SS13_schema_revision` (`major`, `minor`) VALUES (3, 1);
----------------------------------------------------
-18 August 2017, by nfreader, bump to 3.2
+18 August 2017, by Cyberboss and nfreader, bump to 3.1
-Modified table 'death', adding the column 'suicide'.
+Modified table 'death', adding the columns `last_words` and 'suicide'.
-ALTER TABLE `death` ADD COLUMN `suicide` tinyint(0) NOT NULL DEFAULT '0' AFTER `last_words`
-
-----------------------------------------------------
-
-16 August 2017, by Cyberboss, bump to 3.1
-
-Modified table 'death', adding the column 'last_words'.
-
-ALTER TABLE `death` ADD COLUMN `last_words` varchar(255) DEFAULT NULL AFTER `staminaloss`
+ALTER TABLE `death`
+ADD COLUMN `last_words` varchar(255) DEFAULT NULL AFTER `staminaloss`,
+ADD COLUMN `suicide` tinyint(0) NOT NULL DEFAULT '0' AFTER `last_words`;
----------------------------------------------------

View File

@@ -151,6 +151,8 @@ CREATE TABLE `death` (
`toxloss` smallint(5) unsigned NOT NULL,
`cloneloss` smallint(5) unsigned NOT NULL,
`staminaloss` smallint(5) unsigned NOT NULL,
`last_words` varchar(255) DEFAULT NULL,
`suicide` tinyint(1) NOT NULL DEFAULT '0',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;

View File

@@ -148,6 +148,8 @@ CREATE TABLE `SS13_death` (
`toxloss` smallint(5) unsigned NOT NULL,
`cloneloss` smallint(5) unsigned NOT NULL,
`staminaloss` smallint(5) unsigned NOT NULL,
`last_words` varchar(255) DEFAULT NULL,
`suicide` tinyint(1) NOT NULL DEFAULT '0',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;

View File

@@ -72,4 +72,4 @@
//Update this whenever the db schema changes
//make sure you add an update to the schema_version stable in the db changelog
#define DB_MAJOR_VERSION 3
#define DB_MINOR_VERSION 0
#define DB_MINOR_VERSION 1

View File

@@ -198,8 +198,10 @@ SUBSYSTEM_DEF(blackbox)
var/x_coord = sanitizeSQL(L.x)
var/y_coord = sanitizeSQL(L.y)
var/z_coord = sanitizeSQL(L.z)
var/last_words = sanitizeSQL(L.last_words)
var/suicide = sanitizeSQL(L.suiciding)
var/map = sanitizeSQL(SSmapping.config.map_name)
var/datum/DBQuery/query_report_death = SSdbcore.NewQuery("INSERT INTO [format_table_name("death")] (pod, x_coord, y_coord, z_coord, mapname, server_ip, server_port, round_id, tod, job, special, name, byondkey, laname, lakey, bruteloss, fireloss, brainloss, oxyloss, toxloss, cloneloss, staminaloss) VALUES ('[sqlpod]', '[x_coord]', '[y_coord]', '[z_coord]', '[map]', INET_ATON(IF('[world.internet_address]' LIKE '', '0', '[world.internet_address]')), '[world.port]', [GLOB.round_id], '[SQLtime()]', '[sqljob]', '[sqlspecial]', '[sqlname]', '[sqlkey]', '[laname]', '[lakey]', [sqlbrute], [sqlfire], [sqlbrain], [sqloxy], [sqltox], [sqlclone], [sqlstamina])")
var/datum/DBQuery/query_report_death = SSdbcore.NewQuery("INSERT INTO [format_table_name("death")] (pod, x_coord, y_coord, z_coord, mapname, server_ip, server_port, round_id, tod, job, special, name, byondkey, laname, lakey, bruteloss, fireloss, brainloss, oxyloss, toxloss, cloneloss, staminaloss, last_words) VALUES ('[sqlpod]', '[x_coord]', '[y_coord]', '[z_coord]', '[map]', INET_ATON(IF('[world.internet_address]' LIKE '', '0', '[world.internet_address]')), '[world.port]', [GLOB.round_id], '[SQLtime()]', '[sqljob]', '[sqlspecial]', '[sqlname]', '[sqlkey]', '[laname]', '[lakey]', [sqlbrute], [sqlfire], [sqlbrain], [sqloxy], [sqltox], [sqlclone], [sqlstamina], [last_words], [suicide])")
query_report_death.Execute()
/datum/controller/subsystem/blackbox/proc/Seal()

View File

@@ -75,3 +75,5 @@
var/datum/riding/riding_datum
var/datum/language/selected_default_language
var/last_words //used for database logging

View File

@@ -155,6 +155,7 @@ GLOBAL_LIST_INIT(department_radio_keys, list(
var/message_len = length(message)
message = copytext(message, 1, health_diff) + "[message_len > health_diff ? "-.." : "..."]"
message = Ellipsis(message, 10, 1)
last_words = message
message_mode = MODE_WHISPER_CRIT
succumbed = TRUE
else