import { IModelReference , IModelScript } from "@Z64Online/common/api/Z64API" ; import { IModLoaderAPI } from "modloader64_api/IModLoaderAPI" ; export class ModelReference implements IModelReference { hash : string ; pointer : number = 0 ; isPlayerModel : boolean = true ; isDead : boolean = false ; isLoaded : boolean = false ; script : IModelScript | undefined ; flags : Buffer = Buffer . alloc ( 4 ) ; ModLoader : IModLoaderAPI ; constructor ( hash , ModLoader ) { this . hash = hash ; this . ModLoader = ModLoader ; } loadModel ( ) { this . ModLoader . privateBus . emit ( "LOAD_MODEL" , this ) ; return this . isLoaded ; } unregister ( ) { this . ModLoader . privateBus . emit ( "KILL_MODEL" , this ) ; return this . isDead ; } } export class ModelObject { private _zobj : Buffer ; size : number ; constructor ( zobj ) { this . _zobj = zobj ; this . size = zobj . byteLength ; } set zobj ( buf ) { this . _zobj = buf ; } get zobj ( ) : Buffer { let copy = Buffer . alloc ( this . _zobj . byteLength ) ; this . _zobj . copy ( copy ) ; return copy ; } }