forked from StrafesNET/strafe-project
physics: set style on reset and spawn
This commit is contained in:
parent
e794b2649c
commit
78c53ae429
@ -1811,14 +1811,18 @@ fn atomic_input_instruction(state:&mut PhysicsState,data:&PhysicsData,ins:TimedI
|
||||
},
|
||||
Instruction::Mode(ModeInstruction::Restart(mode_id))=>{
|
||||
//teleport to mode start zone
|
||||
let mut spawn_point=vec3::ZERO;
|
||||
let mode=data.modes.get_mode(mode_id);
|
||||
let spawn_point=mode.and_then(|mode|
|
||||
if let Some(mode)=mode{
|
||||
// set style
|
||||
state.style=mode.get_style().clone();
|
||||
//TODO: spawn at the bottom of the start zone plus the hitbox size
|
||||
//TODO: set camera andles to face the same way as the start zone
|
||||
data.models.get_model_transform(mode.get_start().into()).map(|transform|
|
||||
transform.vertex.translation
|
||||
)
|
||||
).unwrap_or(vec3::ZERO);
|
||||
//TODO: set camera angles to face the same way as the start zone
|
||||
if let Some(transform)=data.models.get_model_transform(mode.get_start()){
|
||||
// NOTE: this value may be 0,0,0 on source maps
|
||||
spawn_point=transform.vertex.translation;
|
||||
}
|
||||
}
|
||||
set_position(spawn_point,&mut state.move_state,&mut state.body,&mut state.touching,&mut state.run,&mut state.mode_state,mode,&data.models,&data.hitbox_mesh,&data.bvh,&state.style,&state.camera,&state.input_state,state.time);
|
||||
set_velocity(&mut state.body,&state.touching,&data.models,&data.hitbox_mesh,vec3::ZERO);
|
||||
state.set_move_state(data,MoveState::Air);
|
||||
@ -1828,6 +1832,9 @@ fn atomic_input_instruction(state:&mut PhysicsState,data:&PhysicsData,ins:TimedI
|
||||
Instruction::Mode(ModeInstruction::Spawn(mode_id,stage_id))=>{
|
||||
//spawn at a particular stage
|
||||
if let Some(mode)=data.modes.get_mode(mode_id){
|
||||
// set style
|
||||
state.style=mode.get_style().clone();
|
||||
// teleport to stage in mode
|
||||
if let Some(stage)=mode.get_stage(stage_id){
|
||||
let _=teleport_to_spawn(
|
||||
stage.spawn(),
|
||||
|
Loading…
x
Reference in New Issue
Block a user