forked from StrafesNET/strafe-client
lol idk #1
@ -249,8 +249,8 @@ impl PhysicsModels{
|
||||
&model.transform
|
||||
)
|
||||
}
|
||||
fn model(&self,model_id:PhysicsModelId)->Option<&PhysicsModel>{
|
||||
self.models.get(&model_id)
|
||||
fn model(&self,model_id:PhysicsModelId)->&PhysicsModel{
|
||||
&self.models[&model_id]
|
||||
}
|
||||
fn attr(&self,model_id:PhysicsModelId)->&PhysicsCollisionAttributes{
|
||||
&self.attributes[&self.models[&model_id].attr_id]
|
||||
@ -1242,7 +1242,7 @@ fn teleport(body:&mut Body,touching:&mut TouchingState,models:&PhysicsModels,sty
|
||||
MoveState::Air
|
||||
}
|
||||
fn teleport_to_spawn(body:&mut Body,touching:&mut TouchingState,style:&StyleModifiers,hitbox_mesh:&HitboxMesh,mode:&gameplay_modes::Mode,models:&PhysicsModels,stage_id:gameplay_modes::StageId)->Option<MoveState>{
|
||||
let model=models.model(mode.get_spawn_model_id(stage_id)?.into()).unwrap();
|
||||
let model=models.model(mode.get_spawn_model_id(stage_id)?.into());
|
||||
let point=model.transform.vertex.transform_point3(Planar64Vec3::Y)+Planar64Vec3::Y*(style.hitbox.halfsize.y()+Planar64::ONE/16);
|
||||
Some(teleport(body,touching,models,style,hitbox_mesh,point))
|
||||
}
|
||||
@ -1298,8 +1298,8 @@ fn run_teleport_behaviour(wormhole:&Option<gameplay_attributes::Wormhole>,models
|
||||
}
|
||||
match wormhole{
|
||||
&Some(gameplay_attributes::Wormhole{destination_model})=>{
|
||||
let origin_model=models.model(convex_mesh_id.model_id).unwrap();
|
||||
let destination_model=models.model(destination_model.into()).unwrap();
|
||||
let origin_model=models.model(convex_mesh_id.model_id);
|
||||
let destination_model=models.model(destination_model.into());
|
||||
//ignore the transform for now
|
||||
Some(teleport(body,touching,models,style,hitbox_mesh,body.position-origin_model.transform.vertex.translation+destination_model.transform.vertex.translation))
|
||||
}
|
||||
@ -1521,9 +1521,9 @@ fn run_teleport_behaviour(wormhole:&Option<gameplay_attributes::Wormhole>,models
|
||||
//it matters which of these runs first, but I have not thought it through yet as it doesn't matter yet
|
||||
state.mode_state.clear();
|
||||
state.mode_state.set_stage_id(gameplay_modes::StageId::FIRST);
|
||||
let spawn_point=data.modes.get_mode(state.mode_state.get_mode_id()).and_then(|mode|
|
||||
let spawn_point=data.modes.get_mode(state.mode_state.get_mode_id()).map(|mode|
|
||||
//TODO: spawn at the bottom of the start zone plus the hitbox size
|
||||
data.models.model(mode.get_start().into()).map(|model|model.transform.vertex.translation)
|
||||
data.models.model(mode.get_start().into()).transform.vertex.translation
|
||||
).unwrap_or(Planar64Vec3::ZERO);
|
||||
set_position(&mut state.body,&mut state.touching,spawn_point);
|
||||
set_velocity(&mut state.body,&state.touching,&data.models,&data.hitbox_mesh,Planar64Vec3::ZERO);
|
||||
|
Loading…
Reference in New Issue
Block a user