From 59806425940c82a31826fda83fe00a704387a754 Mon Sep 17 00:00:00 2001 From: Manuel Martin Date: Wed, 18 Oct 2023 00:17:46 +0200 Subject: [PATCH] Networked behavior variables type handling --- src/inflators/networked-behavior.ts | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/src/inflators/networked-behavior.ts b/src/inflators/networked-behavior.ts index d07fe4d84c..7c5964cfc6 100644 --- a/src/inflators/networked-behavior.ts +++ b/src/inflators/networked-behavior.ts @@ -3,7 +3,10 @@ import { Networked, NetworkedBehavior, NetworkedBehaviorData } from "../bit-comp import { HubsWorld } from "../app"; type NetworkedBehaviorType = { - [key: string]: any; + [key: string]: { + type: string; + value: any; + }; }; export function inflateNetworkedBehavior(world: HubsWorld, eid: number, params: NetworkedBehaviorType): number { @@ -12,9 +15,15 @@ export function inflateNetworkedBehavior(world: HubsWorld, eid: number, params: if (params) { const data = NetworkedBehaviorData.get(eid) || new Map(); for (let key in params) { - data.set(key, params[key]); - NetworkedBehaviorData.set(eid, data); + const type = params[key].type; + const value = params[key].value; + if (type === "integer") { + data.set(key, BigInt(value)); + } else { + data.set(key, value); + } } + NetworkedBehaviorData.set(eid, data); } return eid; }