@@ -7,7 +7,7 @@ import { RenderPass } from "three/examples/jsm/postprocessing/RenderPass.js";
77import { UnrealBloomPass } from "three/examples/jsm/postprocessing/UnrealBloomPass.js" ;
88import { getRole , isMobile } from "./device" ;
99import { GameServer } from "./game/game-server" ;
10- import { fromVec3 , toVec3 , type PlayerAction , type Vec3 } from "./game/player" ;
10+ import { createAction , fromVec3 , toVec3 , type PlayerAction } from "./game/player-action " ;
1111
1212// Required for Github Pages deployment
1313THREE . DefaultLoadingManager . setURLModifier ( ( url ) => {
@@ -207,7 +207,8 @@ async function init() {
207207 currentTarget = picked . getWorldPosition ( new THREE . Vector3 ( ) ) ;
208208 currentTarget . x += 0.4 ;
209209 currentTarget . y = scar . position . y ;
210- playAction ( { type : 'Move' , targetPosition : toVec3 ( currentTarget ) } ) ;
210+ const move = createAction ( 'move' , { target : toVec3 ( currentTarget ) } )
211+ playAction ( move ) ;
211212 if ( currentPick ) {
212213 // restore material
213214 currentPick . material = currentMaterial ! ;
@@ -311,7 +312,7 @@ async function init() {
311312
312313 function playActionLocal ( action : PlayerAction ) {
313314 switch ( action . type ) {
314- case 'Move ' : currentTarget = mapXZFrom ( fromVec3 ( action . targetPosition ! ) , scar . position ) ;
315+ case 'move ' : currentTarget = mapXZFrom ( fromVec3 ( action . payload . target ) , scar . position ) ;
315316 }
316317 }
317318
0 commit comments