From 2d650450df4296500fcb28d14d708af9ad9cbd3d Mon Sep 17 00:00:00 2001
From: Jordie <4343468+Jordie0608@users.noreply.github.com>
Date: Fri, 1 Jun 2018 20:27:04 +1000
Subject: [PATCH 1/2] Fix First Death not being remembered if DB is not in use
---
code/controllers/subsystem/blackbox.dm | 15 +++++++++++++--
1 file changed, 13 insertions(+), 2 deletions(-)
diff --git a/code/controllers/subsystem/blackbox.dm b/code/controllers/subsystem/blackbox.dm
index 351852e00a..5016121615 100644
--- a/code/controllers/subsystem/blackbox.dm
+++ b/code/controllers/subsystem/blackbox.dm
@@ -257,10 +257,18 @@ Versioning
/datum/controller/subsystem/blackbox/proc/ReportDeath(mob/living/L)
if(sealed)
return
- if(!SSdbcore.Connect())
- return
if(!L || !L.key || !L.mind)
return
+ if(!L.suiciding && !first_death.len)
+ first_death["name"] = "[(L.real_name == L.name) ? L.real_name : "[L.real_name] as [L.name]"]"
+ first_death["role"] = null
+ if(L.mind.assigned_role)
+ first_death["role"] = L.mind.assigned_role
+ first_death["area"] = "[AREACOORD(L)]"
+ first_death["damage"] = "[L.getBruteLoss()]/[L.getFireLoss()]/[L.getToxLoss()]/[L.getOxyLoss()]/[L.getCloneLoss()]"
+ first_death["last_words"] = L.last_words
+ if(!SSdbcore.Connect())
+ return
var/area/placeofdeath = get_area(L)
var/sqlname = sanitizeSQL(L.real_name)
var/sqlkey = sanitizeSQL(L.ckey)
@@ -282,6 +290,7 @@ Versioning
var/last_words = sanitizeSQL(L.last_words)
var/suicide = sanitizeSQL(L.suiciding)
var/map = sanitizeSQL(SSmapping.config.map_name)
+<<<<<<< HEAD
if(!L.suiciding && !first_death.len)
first_death["name"] = "[(L.real_name == L.name) ? L.real_name : "[L.real_name] as [L.name]"]"
first_death["role"] = null
@@ -290,5 +299,7 @@ Versioning
first_death["area"] = "[get_area_name(L, TRUE)] [COORD(L)]"
first_death["damage"] = "[sqlbrute]/[sqlfire]/[sqltox]/[sqloxy]/[sqlclone]"
first_death["last_words"] = L.last_words
+=======
+>>>>>>> cabf726... Merge pull request #38186 from AutomaticFrenzy/patch/first-death-no-db
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, suicide) 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()
From 4c876d96121a4e2af1067f60439bedcc1d9dd51f Mon Sep 17 00:00:00 2001
From: LetterJay
Date: Sat, 2 Jun 2018 07:27:13 -0500
Subject: [PATCH 2/2] Update blackbox.dm
---
code/controllers/subsystem/blackbox.dm | 11 -----------
1 file changed, 11 deletions(-)
diff --git a/code/controllers/subsystem/blackbox.dm b/code/controllers/subsystem/blackbox.dm
index 5016121615..ad95606bf4 100644
--- a/code/controllers/subsystem/blackbox.dm
+++ b/code/controllers/subsystem/blackbox.dm
@@ -290,16 +290,5 @@ Versioning
var/last_words = sanitizeSQL(L.last_words)
var/suicide = sanitizeSQL(L.suiciding)
var/map = sanitizeSQL(SSmapping.config.map_name)
-<<<<<<< HEAD
- if(!L.suiciding && !first_death.len)
- first_death["name"] = "[(L.real_name == L.name) ? L.real_name : "[L.real_name] as [L.name]"]"
- first_death["role"] = null
- if(L.mind.assigned_role)
- first_death["role"] = L.mind.assigned_role
- first_death["area"] = "[get_area_name(L, TRUE)] [COORD(L)]"
- first_death["damage"] = "[sqlbrute]/[sqlfire]/[sqltox]/[sqloxy]/[sqlclone]"
- first_death["last_words"] = L.last_words
-=======
->>>>>>> cabf726... Merge pull request #38186 from AutomaticFrenzy/patch/first-death-no-db
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, suicide) 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()