Skip to content
This repository was archived by the owner on May 22, 2025. It is now read-only.

Commit 10609a8

Browse files
committed
aaaaa
1 parent 8f21404 commit 10609a8

File tree

7 files changed

+537
-3
lines changed

7 files changed

+537
-3
lines changed

code/_globalvars/tgui.dm

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
GLOBAL_DATUM(crew_manifest_tgui, /datum/crew_manifest)
2+
GLOBAL_DATUM(changelog_tgui, /datum/changelog)
3+
GLOBAL_DATUM(hotkeys_tgui, /datum/hotkeys_help)

code/datums/changelog.dm

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
/datum/changelog
2+
var/static/list/changelog_items = list()
3+
4+
/datum/changelog/ui_state()
5+
return GLOB.always_state
6+
7+
/datum/changelog/ui_interact(mob/user, datum/tgui/ui)
8+
ui = SStgui.try_update_ui(user, src, ui)
9+
if (!ui)
10+
ui = new(user, src, "Changelog")
11+
ui.open()
12+
13+
/datum/changelog/ui_act(action, list/params, datum/tgui/ui, datum/ui_state/state)
14+
. = ..()
15+
if(.)
16+
return
17+
if(action == "get_month")
18+
var/datum/asset/changelog_item/changelog_item = changelog_items[params["date"]]
19+
if (!changelog_item)
20+
changelog_item = new /datum/asset/changelog_item(params["date"])
21+
changelog_items[params["date"]] = changelog_item
22+
return ui.send_asset(changelog_item)
23+
24+
/datum/changelog/ui_static_data()
25+
var/list/data = list( "dates" = list() )
26+
var/regex/ymlRegex = regex(@"\.yml", "g")
27+
28+
for(var/archive_file in sort_list(flist("html/changelogs/archive/")))
29+
var/archive_date = ymlRegex.Replace(archive_file, "")
30+
data["dates"] = list(archive_date) + data["dates"]
31+
32+
return data

code/modules/asset_cache/asset_list.dm

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -538,4 +538,24 @@ GLOBAL_LIST_EMPTY(asset_datums)
538538
SHOULD_CALL_PARENT(FALSE)
539539
CRASH("generate() not implemented for [type]!")
540540

541+
542+
/datum/asset/changelog_item
543+
_abstract = /datum/asset/changelog_item
544+
var/item_filename
545+
546+
/datum/asset/changelog_item/New(date)
547+
item_filename = SANITIZE_FILENAME("[date].yml")
548+
SSassets.transport.register_asset(item_filename, file("html/changelogs/archive/" + item_filename))
549+
550+
/datum/asset/changelog_item/send(client)
551+
if (!item_filename)
552+
return
553+
. = SSassets.transport.send_assets(client, item_filename)
554+
555+
/datum/asset/changelog_item/get_url_mappings()
556+
if (!item_filename)
557+
return
558+
. = list("[item_filename]" = SSassets.transport.get_asset_url(item_filename))
559+
560+
541561
#undef ASSET_CROSS_ROUND_CACHE_DIRECTORY

interface/interface.dm

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -95,9 +95,10 @@
9595
/client/verb/changelog()
9696
set name = "Changelog"
9797
set category = "OOC"
98-
var/datum/asset/simple/namespaced/changelog = get_asset_datum(/datum/asset/simple/namespaced/changelog)
99-
changelog.send(src)
100-
src << browse(changelog.get_htmlloader("changelog.html"), "window=changes;size=675x650")
98+
if(!GLOB.changelog_tgui)
99+
GLOB.changelog_tgui = new /datum/changelog()
100+
101+
GLOB.changelog_tgui.ui_interact(mob)
101102
if(prefs.lastchangelog != GLOB.changelog_hash)
102103
prefs.lastchangelog = GLOB.changelog_hash
103104
prefs.save_preferences()

0 commit comments

Comments
 (0)