@@ -2261,19 +2261,24 @@ declare global {
22612261 error ?: ( error : any ) => void ;
22622262 }
22632263 namespace Schema {
2264- type ObjectSchema < T extends object > = T & {
2264+ interface ColyseusMethods {
2265+ $callbacks : Record < string , any > ;
2266+ $changes : any ;
2267+ toJson ( ) : any ;
2268+ }
2269+ type ObjectSchema < T extends object > = T & ColyseusMethods & {
22652270 listen < K extends keyof T > (
22662271 key : K ,
22672272 callback : ( value : T [ K ] , lastValue : T [ K ] ) => void ,
22682273 immediate ?: boolean ,
22692274 ) : ( ) => void ;
22702275 onChange ( callback : ( ) => void ) : ( ) => void ;
22712276 } ;
2272- interface CollectionSchema < T , K > {
2277+ type CollectionSchema < T , K > = ColyseusMethods & {
22732278 onAdd ( callback : ( value : T , index : K ) => void , immediate ?: boolean ) : ( ) => void ;
22742279 onRemove ( callback : ( value : T , index : K ) => void ) : ( ) => void ;
22752280 onChange ( callback : ( item : T , index : K ) => void ) : ( ) => void ;
2276- }
2281+ } ;
22772282 type MapSchema < T > =
22782283 & {
22792284 [ key : string ] : T ;
@@ -2299,6 +2304,7 @@ declare global {
22992304 interface HealthState {
23002305 classImmunityActive : boolean ;
23012306 fragility : number ;
2307+ health : number ;
23022308 lives : number ;
23032309 maxHealth : number ;
23042310 maxShield : number ;
@@ -2316,11 +2322,16 @@ declare global {
23162322 waitingEndTime : number ;
23172323 waitingStartTime : number ;
23182324 }
2325+ interface SlotState {
2326+ amount : number ;
2327+ }
23192328 interface InventoryState {
23202329 activeInteractiveSlot : number ;
23212330 infiniteAmmo : boolean ;
2322- interactiveSlots : MapSchema < InteractiveSlotState > ;
2331+ interactiveSlots : MapSchema < ObjectSchema < InteractiveSlotState > > ;
23232332 interactiveSlotsOrder : ArraySchema < number > ;
2333+ maxSlots : number ;
2334+ slots : MapSchema < ObjectSchema < SlotState > > ;
23242335 }
23252336 interface PermissionsState {
23262337 adding : boolean ;
@@ -2386,8 +2397,8 @@ declare global {
23862397 url : string ;
23872398 }
23882399 interface CallToActionState {
2389- categories : ArraySchema < ActionCategoryState > ;
2390- items : ArraySchema < ActionItemState > ;
2400+ categories : ArraySchema < ObjectSchema < ActionCategoryState > > ;
2401+ items : ArraySchema < ObjectSchema < ActionItemState > > ;
23912402 }
23922403 interface GameSessionState {
23932404 callToAction : ObjectSchema < CallToActionState > ;
@@ -2437,15 +2448,16 @@ declare global {
24372448 score : number ;
24382449 }
24392450 interface GimkitState {
2440- characters : MapSchema < CharacterState > ;
2441- customAssets : MapSchema < CustomAssetState > ;
2451+ characters : MapSchema < ObjectSchema < CharacterState > > ;
2452+ customAssets : MapSchema < ObjectSchema < CustomAssetState > > ;
24422453 hooks : ObjectSchema < HooksState > ;
24432454 mapSettings : string ;
24442455 matchmaker : ObjectSchema < MatchmakerState > ;
24452456 session : ObjectSchema < SessionState > ;
2446- teams : ArraySchema < TeamState > ;
2457+ teams : ArraySchema < ObjectSchema < TeamState > > ;
24472458 world : ObjectSchema < WorldState > ;
24482459 }
2460+ type GimkitSchema = ObjectSchema < GimkitState > ;
24492461 }
24502462 class BaseNetApi extends EventEmitter2 {
24512463 constructor ( ) ;
@@ -2456,7 +2468,7 @@ declare global {
24562468 /** The room that the client is connected to, or null if there is no connection */
24572469 get room ( ) : any ;
24582470 /** Gimkit's internal Colyseus state */
2459- get state ( ) : Schema . GimkitState ;
2471+ get state ( ) : Schema . GimkitSchema ;
24602472 /** Whether the user is the one hosting the current game */
24612473 get isHost ( ) : boolean ;
24622474 /** Sends a message to the server on a specific channel */
0 commit comments