From 3b21f8f345bf2192654da122c4a09e658559245a Mon Sep 17 00:00:00 2001 From: Beef Date: Sat, 22 Oct 2022 23:43:51 +0100 Subject: [PATCH] [Assets] Properly assign asset id --- src/ui/assets.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/ui/assets.ts b/src/ui/assets.ts index 9b83c32..366cb9d 100644 --- a/src/ui/assets.ts +++ b/src/ui/assets.ts @@ -10,7 +10,7 @@ export default function patchAssets() { try { after("registerAsset", assetsModule, (args: Asset[], id: number) => { const asset = args[0]; - all[asset.name] = { ...asset, id }; + all[asset.name] = { ...asset, id: id }; }); for (let id = 1; ; id++) { @@ -24,4 +24,4 @@ export default function patchAssets() { export const find = (filter: (a: any) => void): Asset | null | undefined => Object.values(all).find(filter); export const getAssetByName = (name: string): Asset => all[name]; export const getAssetByID = (name: string): Asset => assetsModule.getAssetByID(name); -export const getAssetIDByName = (name: string) => all[name].id; \ No newline at end of file +export const getAssetIDByName = (name: string) => all[name]?.id; \ No newline at end of file