diff --git a/SQL/paradise_schema.sql b/SQL/paradise_schema.sql
index 750e15488b5..badefaf8999 100644
--- a/SQL/paradise_schema.sql
+++ b/SQL/paradise_schema.sql
@@ -248,6 +248,7 @@ CREATE TABLE `player` (
`volume` smallint(4) DEFAULT '100',
`nanoui_fancy` smallint(4) DEFAULT '1',
`show_ghostitem_attack` smallint(4) DEFAULT '1',
+ `lastchangelog` varchar(32) NOT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `ckey` (`ckey`)
) ENGINE=InnoDB AUTO_INCREMENT=32446 DEFAULT CHARSET=latin1;
diff --git a/SQL/paradise_schema_prefixed.sql b/SQL/paradise_schema_prefixed.sql
index 8af09a45737..4f184355e5e 100644
--- a/SQL/paradise_schema_prefixed.sql
+++ b/SQL/paradise_schema_prefixed.sql
@@ -248,6 +248,7 @@ CREATE TABLE `SS13_player` (
`volume` smallint(4) DEFAULT '100',
`nanoui_fancy` smallint(4) DEFAULT '1',
`show_ghostitem_attack` smallint(4) DEFAULT '1',
+ `lastchangelog` varchar(32) NOT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `ckey` (`ckey`)
) ENGINE=InnoDB AUTO_INCREMENT=32446 DEFAULT CHARSET=latin1;
diff --git a/code/_globalvars/configuration.dm b/code/_globalvars/configuration.dm
index 4cfa038cd1e..5b41171d557 100644
--- a/code/_globalvars/configuration.dm
+++ b/code/_globalvars/configuration.dm
@@ -4,7 +4,7 @@ var/host = null
var/join_motd = null
var/station_name = "NSS Cyberiad"
var/game_version = "Custom ParaCode"
-var/changelog_hash = ""
+var/changelog_hash = md5('html/changelog.html') //used to check if the CL changed
var/game_year = (text2num(time2text(world.realtime, "YYYY")) + 544)
var/aliens_allowed = 1
@@ -35,4 +35,4 @@ var/MAX_EX_FLAME_RANGE = 14
var/eventchance = 10 //% per 5 mins
var/event = 0
var/hadevent = 0
-var/blobevent = 0
\ No newline at end of file
+var/blobevent = 0
diff --git a/code/modules/client/client procs.dm b/code/modules/client/client procs.dm
index 57b7487cbe5..54ec74baf63 100644
--- a/code/modules/client/client procs.dm
+++ b/code/modules/client/client procs.dm
@@ -308,6 +308,11 @@
send_resources()
+ if(prefs.lastchangelog != changelog_hash) //bolds the changelog button on the interface so we know there are updates. -CP
+ winset(src, "rpane.changelog", "background-color=#f4aa94;font-style=bold")
+ prefs.SetChangelog(src,changelog_hash)
+ src << "Changelog has changed since your last visit."
+
if(!void)
void = new()
diff --git a/code/modules/client/preferences.dm b/code/modules/client/preferences.dm
index 3ece1b8f059..159963767d3 100644
--- a/code/modules/client/preferences.dm
+++ b/code/modules/client/preferences.dm
@@ -77,7 +77,7 @@ var/global/list/special_role_times = list( //minimum age (in days) for accounts
var/last_id
//game-preferences
-// var/lastchangelog = "" //Saved changlog filesize to detect if there was a change
+ var/lastchangelog = "" //Saved changelog filesize to detect if there was a change
var/ooccolor = "#b82e00"
var/be_special = list() //Special role selection
var/UI_style = "Midnight"
diff --git a/code/modules/client/preferences_mysql.dm b/code/modules/client/preferences_mysql.dm
index cb2e3116526..2638fc60992 100644
--- a/code/modules/client/preferences_mysql.dm
+++ b/code/modules/client/preferences_mysql.dm
@@ -12,7 +12,8 @@
randomslot,
volume,
nanoui_fancy,
- show_ghostitem_attack
+ show_ghostitem_attack,
+ lastchangelog
FROM [format_table_name("player")]
WHERE ckey='[C.ckey]'"}
)
@@ -38,10 +39,10 @@
volume = text2num(query.item[10])
nanoui_fancy = text2num(query.item[11])
show_ghostitem_attack = text2num(query.item[12])
+ lastchangelog = query.item[13]
//Sanitize
ooccolor = sanitize_hexcolor(ooccolor, initial(ooccolor))
-// lastchangelog = sanitize_text(lastchangelog, initial(lastchangelog))
UI_style = sanitize_inlist(UI_style, list("White", "Midnight"), initial(UI_style))
default_slot = sanitize_integer(default_slot, 1, max_save_slots, initial(default_slot))
toggles = sanitize_integer(toggles, 0, 65535, initial(toggles))
@@ -52,6 +53,7 @@
volume = sanitize_integer(volume, 0, 100, initial(volume))
nanoui_fancy = sanitize_integer(nanoui_fancy, 0, 1, initial(nanoui_fancy))
show_ghostitem_attack = sanitize_integer(show_ghostitem_attack, 0, 1, initial(show_ghostitem_attack))
+ lastchangelog = sanitize_text(lastchangelog, initial(lastchangelog))
return 1
/datum/preferences/proc/save_preferences(client/C)
@@ -75,7 +77,8 @@
randomslot='[randomslot]',
volume='[volume]',
nanoui_fancy='[nanoui_fancy]',
- show_ghostitem_attack='[show_ghostitem_attack]'
+ show_ghostitem_attack='[show_ghostitem_attack]',
+ lastchangelog='[lastchangelog]',
WHERE ckey='[C.ckey]'"}
)
@@ -449,4 +452,14 @@
load_character(C)
return 0
load_character(C,pick(saves))
- return 1*/
\ No newline at end of file
+ return 1*/
+
+/datum/preferences/proc/SetChangelog(client/C,hash)
+ lastchangelog=hash
+ var/DBQuery/query = dbcon.NewQuery("UPDATE client SET lastchangelog='[lastchangelog]' WHERE ckey='[C.ckey]'")
+ if(!query.Execute())
+ var/err = query.ErrorMsg()
+ log_game("SQL ERROR during lastchangelog updating. Error : \[[err]\]\n")
+ message_admins("SQL ERROR during lastchangelog updating. Error : \[[err]\]\n")
+ return
+ return 1
diff --git a/code/modules/mob/new_player/login.dm b/code/modules/mob/new_player/login.dm
index f6e2441e876..bbb0211ce67 100644
--- a/code/modules/mob/new_player/login.dm
+++ b/code/modules/mob/new_player/login.dm
@@ -34,6 +34,10 @@
verbs += /client/proc/readmin
spawn(40)
if(client)
+ if(client.prefs.lastchangelog != changelog_hash) //bolds the changelog button on the interface so we know there are updates. -CP
+ winset(client, "rpane.changelog", "background-color=#f4aa94;font-style=bold")
+ client.prefs.SetChangelog(client,changelog_hash)
+ to_chat(src, "Changelog has changed since your last visit.")
client.playtitlemusic()
if(config.player_overflow_cap && config.overflow_server_url) //Overflow rerouting, if set, forces players to be moved to a different server once a player cap is reached. Less rough than a pure kick.
@@ -44,4 +48,3 @@
tally++
if(tally > config.player_overflow_cap)
src << link(config.overflow_server_url)
-
diff --git a/interface/interface.dm b/interface/interface.dm
index 44f74a20e59..b6a531bad2f 100644
--- a/interface/interface.dm
+++ b/interface/interface.dm
@@ -39,6 +39,11 @@
)
src << browse('html/changelog.html', "window=changes;size=675x650")
+ if(prefs.lastchangelog != changelog_hash) //if it's already opened, no need to tell them they have unread changes
+ prefs.lastchangelog = changelog_hash
+ prefs.save_preferences()
+ winset(src, "rpane.changelog", "background-color=none;font-style=")
+
/client/verb/forum()
set name = "forum"
set desc = "Visit the forum."