script-side controls work
This commit is contained in:
		
							parent
							
								
									39717cdfb2
								
							
						
					
					
						commit
						62ede14baa
					
				
							
								
								
									
										42
									
								
								assets/Scripts/client/player/player.ts
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										42
									
								
								assets/Scripts/client/player/player.ts
									
									
									
									
									
										Normal 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
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
							
								
								
									
										30
									
								
								assets/Scripts/client/player/playercontrols.ts
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										30
									
								
								assets/Scripts/client/player/playercontrols.ts
									
									
									
									
									
										Normal 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
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
@ -5,6 +5,7 @@ import { SceneLoader } from '/Scripts/engine/scene/scene-loader'
 | 
				
			|||||||
import { Engine } from '/Scripts/types/engine'
 | 
					import { Engine } from '/Scripts/types/engine'
 | 
				
			||||||
import { clientHooks } from '/Scripts/client/clienthooks'
 | 
					import { clientHooks } from '/Scripts/client/clienthooks'
 | 
				
			||||||
import { ChunkGeneratorManager } from '/Scripts/server/chunk/chunkgeneratormanager'
 | 
					import { ChunkGeneratorManager } from '/Scripts/server/chunk/chunkgeneratormanager'
 | 
				
			||||||
 | 
					import { defaultPlayerState } from '/Scripts/client/player/player'
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * The core engine values
 | 
					 * The core engine values
 | 
				
			||||||
@ -15,6 +16,7 @@ export const engine: Engine = {
 | 
				
			|||||||
    hookManager: new HookManager(),
 | 
					    hookManager: new HookManager(),
 | 
				
			||||||
    sceneLoader: new SceneLoader(),
 | 
					    sceneLoader: new SceneLoader(),
 | 
				
			||||||
    chunkGeneratorManager: new ChunkGeneratorManager(),
 | 
					    chunkGeneratorManager: new ChunkGeneratorManager(),
 | 
				
			||||||
 | 
					    playerState: defaultPlayerState,
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 | 
				
			|||||||
@ -1,3 +1,4 @@
 | 
				
			|||||||
 | 
					import { ClientPlayer } from "/Scripts/client/player/player";
 | 
				
			||||||
import { HookManager } from "/Scripts/engine/hooks/hook-manager";
 | 
					import { HookManager } from "/Scripts/engine/hooks/hook-manager";
 | 
				
			||||||
import { SceneLoader } from "/Scripts/engine/scene/scene-loader";
 | 
					import { SceneLoader } from "/Scripts/engine/scene/scene-loader";
 | 
				
			||||||
import { ChunkGeneratorManager } from "/Scripts/server/chunk/chunkgeneratormanager";
 | 
					import { ChunkGeneratorManager } from "/Scripts/server/chunk/chunkgeneratormanager";
 | 
				
			||||||
@ -35,5 +36,10 @@ export interface Engine {
 | 
				
			|||||||
     */
 | 
					     */
 | 
				
			||||||
    readonly chunkGeneratorManager: ChunkGeneratorManager,
 | 
					    readonly chunkGeneratorManager: ChunkGeneratorManager,
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * State of the client player
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    playerState: ClientPlayer,
 | 
				
			||||||
 | 
					
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
		Reference in New Issue
	
	Block a user