-
Notifications
You must be signed in to change notification settings - Fork 565
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
![image](https://github.com/cmss13-devs/cmss13/assets/55142896/e2260755-bb89-488d-89c2-78309e78bea8) this'll let you access historical medals and all (if they saved correctly) etc etc :cl: add: added a historical medal viewer /:cl: --------- Co-authored-by: Drathek <[email protected]>
- Loading branch information
Showing
7 changed files
with
135 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
/datum/asset/spritesheet/medal | ||
name = "medal" | ||
|
||
/datum/asset/spritesheet/medal/register() | ||
for(var/obj/item/clothing/accessory/medal/medal as anything in subtypesof(/obj/item/clothing/accessory/medal)) | ||
var/icon/current_icon = icon(initial(medal.icon), initial(medal.icon_state), SOUTH) | ||
var/imgid = replacetext("[initial(medal.name)]", " ", "-") | ||
|
||
Insert(imgid, current_icon) | ||
return ..() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
import { BooleanLike, classes } from 'common/react'; | ||
import { useBackend } from '../backend'; | ||
import { Section } from '../components'; | ||
import { Window } from '../layouts'; | ||
|
||
interface MedalProps { | ||
medals: Medal[]; | ||
} | ||
|
||
interface Medal { | ||
round_id: string; | ||
medal_type?: string; | ||
medal_icon?: string; | ||
xeno_medal?: BooleanLike; | ||
recipient_name?: string; | ||
recipient_role?: string; | ||
giver_name?: string; | ||
citation?: string; | ||
} | ||
|
||
export const MedalsViewer = (props, context) => { | ||
const { data, act } = useBackend<MedalProps>(context); | ||
const { medals } = data; | ||
|
||
return ( | ||
<Window width={700} height={350}> | ||
<Window.Content scrollable className={'MedalsViewer'}> | ||
{medals.map((medal) => { | ||
const medalType = medal.medal_type | ||
? medal.medal_type | ||
: 'Unknown Medal'; | ||
const sectionTitle = `Round ${medal.round_id} - ${medalType}`; | ||
const sectionType = medal.xeno_medal ? 'xeno-medal' : 'human-medal'; | ||
return ( | ||
<Section | ||
key={medal.citation} | ||
title={sectionTitle} | ||
className={sectionType}> | ||
Issued to{' '} | ||
<b> | ||
{medal.recipient_name}{' '} | ||
{!medal.xeno_medal && `(${medal.recipient_role})`} | ||
</b>{' '} | ||
by <b>{medal.giver_name}</b> for: <br /> | ||
{!medal.xeno_medal && ( | ||
<span | ||
className={classes([ | ||
'medal32x32', | ||
medal.medal_icon, | ||
'medal-icon', | ||
])} | ||
/> | ||
)} | ||
{medal.citation} | ||
</Section> | ||
); | ||
})} | ||
</Window.Content> | ||
</Window> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
.MedalsViewer { | ||
.medal-icon { | ||
vertical-align: -50%; | ||
} | ||
|
||
.xeno-medal { | ||
background-color: #52375c; | ||
|
||
.Section__title { | ||
border-bottom: 0.1666666667em solid #6b3f7a; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters