building angle fixes

This commit is contained in:
Robin Appelman 2025-06-28 21:13:57 +02:00
commit cf1dcca7fd

View file

@ -495,7 +495,11 @@ impl BuildingState {
let position = building.position();
let ty = BuildingType::from_building(building);
let angle = match building {
Building::Teleporter(teleporter) => teleporter.yaw_to_exit),
Building::Teleporter(teleporter)
if teleporter.is_entrance && teleporter.yaw_to_exit != 0.0 =>
{
teleporter.angle + (180.0 - teleporter.yaw_to_exit)
}
Building::Sentry(sentry) => sentry.angle,
_ => 0.0,
};
@ -590,6 +594,7 @@ fn test_building_packing() {
team: Team::Blue,
level: 3,
ty: BuildingType::Level1Sentry,
build_progress: 23,
};
let bytes = input.pack(&world);
@ -600,6 +605,7 @@ fn test_building_packing() {
assert_eq!(input.ty, unpacked.ty);
assert_eq!(input.team, unpacked.team);
assert_eq!(input.level, unpacked.level);
assert_eq!(input.build_progress, unpacked.build_progress);
assert!(f32::abs(input.position.x - unpacked.position.x) < 0.5);
assert!(f32::abs(input.position.y - unpacked.position.y) < 0.5);