import { IActor } from "Z64Lib/API/Common/IActor" ; import { IPuppet } from "@Z64Online/common/puppet/IPuppet" ; import { IZ64Core } from "Z64Lib/API/Common/Z64API" ; export class HorseData { pointer : number ; parent : IPuppet ; puppet ! : IActor ; private readonly copyFields : string [ ] = [ "pos" , "rot" , "anim_id" , "speed" ] ; constructor ( pointer , parent , core ) { this . puppet = core . actorManager . createIActorFromPointer ( pointer ) ; this . pointer = pointer ; this . parent = parent ; } get pos ( ) : Buffer { return this . puppet . position . getRawPos ( ) ; } set pos ( buf ) { this . puppet . rdramWriteBuffer ( 0x24 , buf ) ; } get rot ( ) : Buffer { return this . puppet . rotation . getRawRot ( ) ; } set rot ( buf ) { this . puppet . rdramWriteBuffer ( 0xB4 , buf ) ; } get anim_id ( ) : number { return this . puppet . rdramRead32 ( 0x1a4 ) ; } set anim_id ( id ) { this . puppet . rdramWrite32 ( 0x214 , id ) ; } get speed ( ) : number { return this . puppet . rdramRead32 ( 0x1b8 ) ; } set speed ( s ) { this . puppet . rdramWrite32 ( 0x1a4 , s ) ; } toJSON ( ) { const jsonObj = { } ; for ( let i = 0 ; i < this . copyFields . length ; i ++ ) { jsonObj [ this . copyFields [ i ] ] = ( this as any ) [ this . copyFields [ i ] ] ; } return jsonObj ; } }