Skip to content

Commit

Permalink
Adds a verb to see medals you've given out (#5870)
Browse files Browse the repository at this point in the history
# About the pull request

Someone requested this

# Explain why it's good for the game
# Testing Photographs and Procedure
<details>
<summary>Screenshots & Videos</summary>

Put screenshots and videos here with an empty line between the
screenshots and the `<details>` tags.

</details>


# Changelog
:cl:
add: New View Given Medals button to see what medals you've given to
others
/:cl:
  • Loading branch information
TheGamerdk authored Mar 3, 2024
1 parent 749fd75 commit ac4ccaa
Showing 1 changed file with 26 additions and 1 deletion.
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 @@ GLOBAL_DATUM_INIT(medals_view_tgui, /datum/medals_view_tgui, new)
. = ..()
.["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(user))
var/xeno_medal = FALSE
if(medal.medal_type in GLOB.xeno_medals)
xeno_medal = TRUE
Expand All @@ -212,6 +213,10 @@ GLOBAL_DATUM_INIT(medals_view_tgui, /datum/medals_view_tgui, new)

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

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


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

Expand All @@ -225,3 +230,23 @@ GLOBAL_DATUM_INIT(medals_view_tgui, /datum/medals_view_tgui, new)
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(mob/user)
return DB_VIEW(/datum/view_record/medal_view, DB_COMP("giver_player_id", DB_EQUALS, user.client.player_data.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)

0 comments on commit ac4ccaa

Please sign in to comment.