Converts ForceEvent.js to typescript and overhauls the UI to be good (#71750)

## About The Pull Request


![image](https://user-images.githubusercontent.com/40974010/205735472-e6ea0f7e-ffcc-4339-b2c6-7cc43c65c575.png)

## Why It's Good For The Game

The old UI annoyed me enough to improve it

## Changelog
🆑
refactor: Refactored and overhauled the ForceEvent UI
/🆑
This commit is contained in:
tralezab
2022-12-09 13:34:47 -08:00
committed by GitHub
parent 17b38919dc
commit 8ac384f35b
4 changed files with 256 additions and 124 deletions
+35 -8
View File
@@ -29,19 +29,46 @@
return GLOB.fun_state
/datum/force_event/ui_static_data(mob/user)
var/static/list/category_to_icons
if(!category_to_icons)
category_to_icons = list(
EVENT_CATEGORY_AI = "robot",
EVENT_CATEGORY_ANOMALIES = "cloud-bolt",
EVENT_CATEGORY_BUREAUCRATIC = "print",
EVENT_CATEGORY_ENGINEERING = "wrench",
EVENT_CATEGORY_ENTITIES = "ghost",
EVENT_CATEGORY_FRIENDLY = "face-smile",
EVENT_CATEGORY_HEALTH = "brain",
EVENT_CATEGORY_HOLIDAY = "calendar",
EVENT_CATEGORY_INVASION = "user-group",
EVENT_CATEGORY_JANITORIAL = "bath",
EVENT_CATEGORY_SPACE = "meteor",
EVENT_CATEGORY_WIZARD = "hat-wizard",
)
var/list/data = list()
data["categories"] = list()
for(var/datum/round_event_control/event_control in SSevents.control)
if(!data["categories"][event_control.category])
data["categories"][event_control.category] = list(
var/list/categories_seen = list()
var/list/categories = list()
var/list/events = list()
for(var/datum/round_event_control/event_control as anything in SSevents.control)
//add category
if(!categories_seen[event_control.category])
categories_seen[event_control.category] = TRUE
UNTYPED_LIST_ADD(categories, list(
"name" = event_control.category,
"events" = list()
)
data["categories"][event_control.category]["events"] += list(list(
"icon" = category_to_icons[event_control.category],
))
//add event, with one value matching up the category
UNTYPED_LIST_ADD(events, list(
"name" = event_control.name,
"description" = event_control.description,
"type" = event_control.type
"type" = event_control.type,
"category" = event_control.category,
))
data["categories"] = categories
data["events"] = events
return data
/datum/force_event/ui_act(action, list/params, datum/tgui/ui, datum/ui_state/state)