fix house entering
Some checks failed
Rust / rustfmt (push) Successful in 25s
Rust / clippy (push) Failing after 1m26s
Rust / build (push) Successful in 3m0s

This commit is contained in:
luckyturtledev 2024-07-07 14:38:34 +02:00
parent 33b301a410
commit 9bfa6e2669

View file

@ -146,9 +146,22 @@ fn update_move_player(state: &mut State, ctx: &mut EngineContext<'_>) {
y: requested_pos_diff.y as _ y: requested_pos_diff.y as _
}; };
state.ghost.overworld_pos_last_update = now; state.ghost.overworld_pos_last_update = now;
}
pub fn update(state: &mut State, ctx: &mut EngineContext<'_>) {
let mut camera = main_camera_mut();
camera.center = state.ghost.overworld_pos;
camera.zoom = 30.0;
// move player
update_move_player(state, ctx);
//move into house if player stepp at door //move into house if player stepp at door
{ {
let tile_pos = IVec2 {
x: state.ghost.overworld_pos.x.round() as _,
y: state.ghost.overworld_pos.y.round() as _
};
let current_tile = state.overworld.get_or_generate_tile(tile_pos); let current_tile = state.overworld.get_or_generate_tile(tile_pos);
if current_tile.can_enter_house() { if current_tile.can_enter_house() {
info!("enter house at {tile_pos}"); info!("enter house at {tile_pos}");
@ -156,15 +169,6 @@ fn update_move_player(state: &mut State, ctx: &mut EngineContext<'_>) {
state.house_mut(ctx); // gen new house state.house_mut(ctx); // gen new house
} }
} }
}
pub fn update(state: &mut State, ctx: &mut EngineContext<'_>) {
let mut camera = main_camera_mut();
camera.center = Vec2::ZERO;
camera.zoom = 30.0;
// move player
update_move_player(state, ctx);
// generate more chunks if needed // generate more chunks if needed
{ {