Autochangelogs (#17152)

* Scripts ported

* Converted changelogs

* Fix

* Prettier

* Removes old unneeded save

* Removes very old changelogs
This commit is contained in:
Selis
2025-02-15 17:10:05 -05:00
committed by GitHub
parent f423f81e42
commit f7de6141b5
54 changed files with 678 additions and 11804 deletions
+2
View File
@@ -3,3 +3,5 @@
GLOBAL_REAL(config, /datum/controller/configuration) = new
GLOBAL_DATUM_INIT(revdata, /datum/getrev, new)
GLOBAL_VAR_INIT(changelog_hash, "")
+1
View File
@@ -0,0 +1 @@
GLOBAL_DATUM(changelog_tgui, /datum/changelog)
+32
View File
@@ -0,0 +1,32 @@
/datum/changelog
var/static/list/changelog_items = list()
/datum/changelog/tgui_state()
return GLOB.tgui_always_state
/datum/changelog/tgui_interact(mob/user, datum/tgui/ui)
ui = SStgui.try_update_ui(user, src, ui)
if (!ui)
ui = new(user, src, "Changelog")
ui.open()
/datum/changelog/tgui_act(action, list/params, datum/tgui/ui, datum/tgui_state/state)
. = ..()
if(.)
return
if(action == "get_month")
var/datum/asset/changelog_item/changelog_item = changelog_items[params["date"]]
if (!changelog_item)
changelog_item = new /datum/asset/changelog_item(params["date"])
changelog_items[params["date"]] = changelog_item
return ui.send_asset(changelog_item)
/datum/changelog/tgui_static_data()
var/list/data = list( "dates" = list() )
var/regex/ymlRegex = regex(@"\.yml", "g")
for(var/archive_file in sortList(flist("html/changelogs/archive/")))
var/archive_date = ymlRegex.Replace(archive_file, "")
data["dates"] = list(archive_date) + data["dates"]
return data
+3 -1
View File
@@ -14,7 +14,9 @@
debug_log = start_log("[log_path]-debug.log")
//VOREStation Edit End
changelog_hash = md5('html/changelog.html') //used for telling if the changelog has changed recently
var/latest_changelog = file("[global.config.directory]/../html/changelogs/archive/" + time2text(world.timeofday, "YYYY-MM") + ".yml")
GLOB.changelog_hash = fexists(latest_changelog) ? md5(latest_changelog) : "" //for telling if the changelog has changed recently
to_world_log("Changelog Hash: '[GLOB.changelog_hash]' ([latest_changelog])")
if(byond_version < RECOMMENDED_VERSION)
to_world_log("Your server's byond version does not meet the recommended requirements for this server. Please update BYOND")
-1
View File
@@ -32,7 +32,6 @@ var/href_logfile = null
// var/const/star_name = "Vir"
// var/const/starsys_name = "Vir"
var/const/game_version = "VOREStation"
var/changelog_hash = ""
var/game_year = (text2num(time2text(world.realtime, "YYYY")) + 300) //VOREStation Edit
var/round_progressing = 1
+1 -1
View File
@@ -534,7 +534,7 @@ GLOBAL_LIST_EMPTY(asset_datums)
/datum/asset/changelog_item/New(date)
item_filename = sanitize_filename("[date].yml")
SSassets.transport.register_asset(item_filename, file("html/changelogs_ch/archive/" + item_filename))
SSassets.transport.register_asset(item_filename, file("html/changelogs/archive/" + item_filename))
/datum/asset/changelog_item/send(client)
if (!item_filename)
@@ -10,28 +10,6 @@
"no_image32.png" = 'html/images/no_image32.png',
)
/datum/asset/simple/changelog
assets = list(
"88x31.png" = 'html/88x31.png',
"bug-minus.png" = 'html/bug-minus.png',
"cross-circle.png" = 'html/cross-circle.png',
"hard-hat-exclamation.png" = 'html/hard-hat-exclamation.png',
"image-minus.png" = 'html/image-minus.png',
"image-plus.png" = 'html/image-plus.png',
"map-pencil.png" = 'html/map-pencil.png',
"music-minus.png" = 'html/music-minus.png',
"music-plus.png" = 'html/music-plus.png',
"tick-circle.png" = 'html/tick-circle.png',
"wrench-screwdriver.png" = 'html/wrench-screwdriver.png',
"spell-check.png" = 'html/spell-check.png',
"burn-exclamation.png" = 'html/burn-exclamation.png',
"chevron.png" = 'html/chevron.png',
"chevron-expand.png" = 'html/chevron-expand.png',
"changelog.css" = 'html/changelog.css',
"changelog.js" = 'html/changelog.js',
"changelog.html" = 'html/changelog.html'
)
/datum/asset/simple/arcade
assets = list(
"boss1.gif" = 'icons/UI_Icons/Arcade/boss1.gif',
@@ -0,0 +1,17 @@
/datum/asset/changelog_item
_abstract = /datum/asset/changelog_item
var/item_filename
/datum/asset/changelog_item/New(date)
item_filename = sanitize_filename("[date].yml")
register_asset(item_filename, file("html/changelogs/archive/" + item_filename))
/datum/asset/changelog_item/send(client)
if (!item_filename)
return
. = send_asset(client, item_filename)
/datum/asset/changelog_item/get_url_mappings()
if (!item_filename)
return
. = list("[item_filename]" = get_asset_url(item_filename))
+6
View File
@@ -330,6 +330,12 @@
void = new()
screen += void
if((prefs?.read_preference(/datum/preference/text/lastchangelog) != GLOB.changelog_hash) && isnewplayer(src.mob)) //bolds the changelog button on the interface so we know there are updates.
to_chat(src, span_info("You have unread updates in the changelog."))
winset(src, "rpane.changelog", "background-color=#eaeaea;font-style=bold")
if(CONFIG_GET(flag/aggressive_changelog))
src.changes()
if(CONFIG_GET(flag/paranoia_logging))
var/alert = FALSE //VOREStation Edit start.
if(isnum(player_age) && player_age == 0)
@@ -1,3 +1,5 @@
// Toggles
/// Whether or not to toggle ambient occlusion, the shadows around people
/datum/preference/toggle/ambient_occlusion
category = PREFERENCE_CATEGORY_GAME_PREFERENCES
@@ -93,3 +95,14 @@
savefile_key = "obfuscate_job"
default_value = FALSE
savefile_identifier = PREFERENCE_PLAYER
// Text
/datum/preference/text/lastchangelog
category = PREFERENCE_CATEGORY_GAME_PREFERENCES
savefile_key = "lastchangelog"
savefile_identifier = PREFERENCE_PLAYER
/datum/preference/text/lastchangelog/is_accessible(datum/preferences/preferences)
..()
return FALSE
+7 -1
View File
@@ -483,7 +483,13 @@
/client/verb/changes()
set name = "Changelog"
set category = "OOC.Resources"
src << link("https://wiki.vore-station.net/Changelog")
if(!GLOB.changelog_tgui)
GLOB.changelog_tgui = new /datum/changelog()
GLOB.changelog_tgui.tgui_interact(usr)
if(prefs?.read_preference(/datum/preference/text/lastchangelog) != GLOB.changelog_hash)
prefs.write_preference_by_type(/datum/preference/text/lastchangelog, GLOB.changelog_hash)
/mob/verb/observe()
set name = "Observe"
+4 -4
View File
@@ -106,12 +106,10 @@
else
output += "<p><b><a href='byond://?src=\ref[src];open_station_news=1'>Show [using_map.station_name] News<br>(NEW!)</A></b></p>"
/* //TODO: Actually add the fukin changelog. We need it DESPERATELY but this isn't the PR for it.
if(client.prefs.lastchangelog == changelog_hash)
if(read_preference(/datum/preference/text/lastchangelog) == GLOB.changelog_hash)
output += "<p><a href='byond://?src=\ref[src];open_changelog=1'>Show Changelog</A><br><i>No Changes</i></p>"
else
output += "<p><b><a href='byond://?src=\ref[src];open_changelog=1'>Show Changelog</A><br>(NEW!)</b></p>"
*/
output += "</div>"
@@ -354,7 +352,9 @@
client.feedback_form = new(client)
if(href_list["open_changelog"])
src << link("https://wiki.vore-station.net/Changelog")
write_preference_directly(/datum/preference/text/lastchangelog, GLOB.changelog_hash)
client.changes()
return
/mob/new_player/proc/handle_server_news()
if(!client)