script-side controls work

This commit is contained in:
austin 2025-05-16 11:19:53 -04:00
parent 39717cdfb2
commit 62ede14baa
4 changed files with 80 additions and 0 deletions

View File

@ -0,0 +1,42 @@
/**
* Overall state of the player's controls
*/
export interface PlayerControlState {
/**
* State of the room tool
*/
roomTool: RoomToolState,
}
/**
* State for the room tool
*/
export interface RoomToolState {
/**
* The currently selected functionality of the room tool
*/
currentState: number,
}
/**
* Overall state for the client player
*/
export interface ClientPlayer {
/**
* State of controls for the player
*/
controlState: PlayerControlState,
}
/**
* Actual player control state
*/
export const defaultPlayerState: ClientPlayer = {
controlState: {
roomTool: {
currentState: 0
}
}
}

View File

@ -0,0 +1,30 @@
/**
* Overall state of the player's controls
*/
interface PlayerControlState {
/**
* State of the room tool
*/
roomTool: RoomToolState,
}
/**
* State for the room tool
*/
interface RoomToolState {
/**
* The currently selected functionality of the room tool
*/
currentState: number,
}
/**
* Actual player control state
*/
export let playerControlState: PlayerControlState = {
roomTool: {
currentState: 0
}
}

View File

@ -5,6 +5,7 @@ import { SceneLoader } from '/Scripts/engine/scene/scene-loader'
import { Engine } from '/Scripts/types/engine'
import { clientHooks } from '/Scripts/client/clienthooks'
import { ChunkGeneratorManager } from '/Scripts/server/chunk/chunkgeneratormanager'
import { defaultPlayerState } from '/Scripts/client/player/player'
/**
* The core engine values
@ -15,6 +16,7 @@ export const engine: Engine = {
hookManager: new HookManager(),
sceneLoader: new SceneLoader(),
chunkGeneratorManager: new ChunkGeneratorManager(),
playerState: defaultPlayerState,
}
/**

View File

@ -1,3 +1,4 @@
import { ClientPlayer } from "/Scripts/client/player/player";
import { HookManager } from "/Scripts/engine/hooks/hook-manager";
import { SceneLoader } from "/Scripts/engine/scene/scene-loader";
import { ChunkGeneratorManager } from "/Scripts/server/chunk/chunkgeneratormanager";
@ -35,5 +36,10 @@ export interface Engine {
*/
readonly chunkGeneratorManager: ChunkGeneratorManager,
/**
* State of the client player
*/
playerState: ClientPlayer,
}