Skip to content

Commit

Permalink
neaten up asset handling
Browse files Browse the repository at this point in the history
  • Loading branch information
harryob committed Dec 12, 2024
1 parent a739778 commit 7b3493f
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 23 deletions.
2 changes: 1 addition & 1 deletion code/modules/asset_cache/assets/lobby.dm
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
return

asset = fcopy_rsc(asset) //dedupe
var/asset_name = sanitize_filename("[icon].png")
var/asset_name = "lobby_art.png"

SSassets.transport.register_asset(asset_name, asset)
assets[asset_name] = asset
Expand Down
15 changes: 2 additions & 13 deletions code/modules/mob/new_player/login.dm
Original file line number Diff line number Diff line change
Expand Up @@ -51,19 +51,6 @@
/mob/new_player/ui_state(mob/user)
return GLOB.always_state

/mob/new_player/ui_static_data(mob/user)
. = ..()

.["icon"] = get_asset_datum(/datum/asset/simple/icon_states/lobby).get_url_mappings()["uscm.png"]
.["sound"] = get_asset_datum(/datum/asset/simple/lobby_sound).get_url_mappings()["load"]

.["lobby_icon"] = ""
.["lobby_author"] = ""
if(SSlobby_art.selected_file_name)
var/icons = get_asset_datum(/datum/asset/simple/lobby_art).get_url_mappings()
.["lobby_icon"] = icons[icons[1]]
.["lobby_author"] = SSlobby_art.author

/mob/new_player/ui_data(mob/user)
. = ..()

Expand All @@ -84,6 +71,8 @@
.["predator_enabled"] = SSticker.mode?.flags_round_type & MODE_PREDATOR && SSticker.mode.check_predator_late_join(src, FALSE)
.["fax_responder_enabled"] = SSticker.mode?.check_fax_responder_late_join(src, FALSE)

.["lobby_author"] = SSlobby_art.author

/mob/new_player/ui_assets(mob/user)
. = ..()

Expand Down
14 changes: 5 additions & 9 deletions tgui/packages/tgui/interfaces/LobbyMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import {
useState,
} from 'react';

import { resolveAsset } from '../assets';
import { useBackend } from '../backend';
import {
Box,
Expand All @@ -21,13 +22,8 @@ import { BoxProps } from '../components/Box';
import { Window } from '../layouts';

type LobbyData = {
icon: string;
lobby_icon: string;
lobby_author: string;

sound: string;
sound_interact: string[];

character_name: string;
display_number: string;

Expand All @@ -50,7 +46,7 @@ const LobbyContext = createContext({ animationsDisable: false });
export const LobbyMenu = () => {
const { act, data } = useBackend<LobbyData>();

const { lobby_icon, lobby_author, sound } = data;
const { lobby_author } = data;

const onLoadPlayer = useRef<HTMLAudioElement>(null);

Expand All @@ -77,7 +73,7 @@ export const LobbyMenu = () => {

return (
<Window theme="crtgreen" fitted scrollbars={false}>
<audio src={sound} ref={onLoadPlayer} />
<audio src={resolveAsset('load')} ref={onLoadPlayer} />
<Window.Content
className={`LobbyScreen ${filterDisabled ? '' : 'filterEnabled'} ${disableAnimations}`}
style={{
Expand All @@ -104,7 +100,7 @@ export const LobbyMenu = () => {
height="100%"
width="100%"
style={{
backgroundImage: `url(${lobby_icon})`,
backgroundImage: `url(${resolveAsset('lobby_art.png')})`,
}}
className="bgLoad bgBackground"
/>
Expand Down Expand Up @@ -166,7 +162,7 @@ const LobbyButtons = (props: { readonly setModal: (_) => void }) => {
<Box height="68px">
<Box
style={{
backgroundImage: `url("${data.icon}")`,
backgroundImage: `url("${resolveAsset('uscm.png')}")`,
}}
width="67px"
className="loadEffect"
Expand Down

0 comments on commit 7b3493f

Please sign in to comment.