Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds a verb to see medals you've given out #5870

Merged
merged 4 commits into from
Mar 3, 2024
Merged
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 26 additions & 1 deletion code/game/verbs/records.dm
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,7 @@

GLOBAL_DATUM_INIT(medals_view_tgui, /datum/medals_view_tgui, new)


/datum/medals_view_tgui/tgui_interact(mob/user, datum/tgui/ui)
ui = SStgui.try_update_ui(user, src, ui)
if(!ui)
Expand All @@ -194,7 +195,7 @@
. = ..()
.["medals"] = list()

for(var/datum/view_record/medal_view/medal as anything in DB_VIEW(/datum/view_record/medal_view, DB_COMP("player_id", DB_EQUALS, user.client.player_data.id)))
for(var/datum/view_record/medal_view/medal as anything in get_medals())
var/xeno_medal = FALSE
if(medal.medal_type in GLOB.xeno_medals)
xeno_medal = TRUE
Expand All @@ -212,6 +213,10 @@

.["medals"] += list(current_medal)

/datum/medals_view_tgui/proc/get_medals()
return DB_VIEW(/datum/view_record/medal_view, DB_COMP("player_id", DB_EQUALS, user.client.player_data.id))

Check failure on line 217 in code/game/verbs/records.dm

View workflow job for this annotation

GitHub Actions / Run Linters

undefined var: "user"

Check warning on line 217 in code/game/verbs/records.dm

View workflow job for this annotation

GitHub Actions / Run Linters

field access requires static type: "client"

Check warning on line 217 in code/game/verbs/records.dm

View workflow job for this annotation

GitHub Actions / Run Linters

field access requires static type: "player_data"

Check warning on line 217 in code/game/verbs/records.dm

View workflow job for this annotation

GitHub Actions / Run Linters

field access requires static type: "id"


/datum/medals_view_tgui/ui_state(mob/user)
return GLOB.always_state

Expand All @@ -225,3 +230,23 @@
set category = "OOC.Records"

GLOB.medals_view_tgui.tgui_interact(mob)

GLOBAL_DATUM_INIT(medals_view_given_tgui, /datum/medals_view_tgui/given_medals, new)


/datum/medals_view_tgui/given_medals/get_medals()
return DB_VIEW(/datum/view_record/medal_view, DB_COMP("giver_player_id", DB_EQUALS, user.client.player_data.id))

Check failure on line 238 in code/game/verbs/records.dm

View workflow job for this annotation

GitHub Actions / Run Linters

undefined var: "user"

Check warning on line 238 in code/game/verbs/records.dm

View workflow job for this annotation

GitHub Actions / Run Linters

field access requires static type: "client"

Check warning on line 238 in code/game/verbs/records.dm

View workflow job for this annotation

GitHub Actions / Run Linters

field access requires static type: "player_data"

Check warning on line 238 in code/game/verbs/records.dm

View workflow job for this annotation

GitHub Actions / Run Linters

field access requires static type: "id"


/datum/medals_view_tgui/given_medals/tgui_interact(mob/user, datum/tgui/ui)
ui = SStgui.try_update_ui(user, src, ui)
if(!ui)
ui = new(user, src, "MedalsViewer", "[user.ckey]'s Given Medals")
ui.open()


/client/verb/view_given_medals()
set name = "View Medals Given to Others"
set category = "OOC.Records"

GLOB.medals_view_given_tgui.tgui_interact(mob)
Loading