[Assets] Properly assign asset id
This commit is contained in:
parent
62b843f9f6
commit
3b21f8f345
1 changed files with 2 additions and 2 deletions
|
@ -10,7 +10,7 @@ export default function patchAssets() {
|
||||||
try {
|
try {
|
||||||
after("registerAsset", assetsModule, (args: Asset[], id: number) => {
|
after("registerAsset", assetsModule, (args: Asset[], id: number) => {
|
||||||
const asset = args[0];
|
const asset = args[0];
|
||||||
all[asset.name] = { ...asset, id };
|
all[asset.name] = { ...asset, id: id };
|
||||||
});
|
});
|
||||||
|
|
||||||
for (let id = 1; ; 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 find = (filter: (a: any) => void): Asset | null | undefined => Object.values(all).find(filter);
|
||||||
export const getAssetByName = (name: string): Asset => all[name];
|
export const getAssetByName = (name: string): Asset => all[name];
|
||||||
export const getAssetByID = (name: string): Asset => assetsModule.getAssetByID(name);
|
export const getAssetByID = (name: string): Asset => assetsModule.getAssetByID(name);
|
||||||
export const getAssetIDByName = (name: string) => all[name].id;
|
export const getAssetIDByName = (name: string) => all[name]?.id;
|
Loading…
Reference in a new issue