seperated client and server state, input mapper

This commit is contained in:
Reid 2023-07-20 14:48:17 -07:00
parent 44f63f8deb
commit d5b77a9044
10 changed files with 104 additions and 16 deletions

View file

@ -1,7 +1,7 @@
import { AnyEntity, World } from "@rbxts/matter"
import { waitForEvent } from "ReplicatedStorage/remotes"
import * as Components from "./components"
import { State } from "./state"
import { clientState } from "./state"
type ComponentNames = keyof typeof Components
type ComponentConstructors = (typeof Components)[ComponentNames]
@ -16,13 +16,13 @@ let connection: RBXScriptConnection | undefined
* Starts the replication receiver.
*
* @param world - The world to replicate components in
* @param state - The global state for the ECS
* @param ClientState - The client state for the ECS
*/
export function start(world: World, state: State): void {
export function start(world: World, ClientState: clientState): void {
if (connection) return
function debugPrint(message: string, args: () => (string | number)[]): void {
if (state.debugEnabled) {
if (ClientState.debugEnabled) {
print("ECS Replication>", string.format(message, ...args()))
}
}