This file contains hidden or 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
<script setup lang="ts"> | |
import { InventoryManager } from './inventoryManager'; | |
import { onMounted, onUnmounted } from 'vue'; | |
import { Container } from 'typedi'; | |
onMounted(() => { | |
const inventoryManager = Container.get(InventoryManager); | |
const container = document.querySelector('.container'); | |
if (!inventoryManager || !container) return; |
This file contains hidden or 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
function requestModel(modelHash, tries = 0) { | |
return new Promise((resolve) => { | |
if (!native.isModelValid(modelHash)) return resolve(false); | |
if (native.hasModelLoaded(modelHash)) return resolve(true); | |
if (tries == 0) native.requestModel(modelHash); | |
if (tries == 40) return resolve(false); | |
setTimeout(() => { | |
if (!native.hasModelLoaded(modelHash)) { | |
return resolve(requestModel(modelHash, ++tries)); |