aboutsummaryrefslogtreecommitdiff
path: root/crates/fparkan-runtime/src/boarding.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/fparkan-runtime/src/boarding.rs')
-rw-r--r--crates/fparkan-runtime/src/boarding.rs21
1 files changed, 16 insertions, 5 deletions
diff --git a/crates/fparkan-runtime/src/boarding.rs b/crates/fparkan-runtime/src/boarding.rs
index 95acc7e0..bbcc4615 100644
--- a/crates/fparkan-runtime/src/boarding.rs
+++ b/crates/fparkan-runtime/src/boarding.rs
@@ -11,6 +11,7 @@ use fparkan_world::{
};
pub(super) const WARBOT_CLASS: u32 = 0x0100_8000;
+pub mod bunker;
mod remote_control;
pub use remote_control::{
can_control_warbot_remotely, control_warbot_remotely, remote_automatic_weapons,
@@ -38,6 +39,7 @@ pub(super) struct Boarding {
pub(super) cockpit: StartingCockpit,
pub(super) hero: StartingCockpit,
pub(super) remote: Option<RemoteWarbotControl>,
+ pub(super) turret: Option<crate::TurretAim>,
pub(super) can_fly: bool,
pub(super) ground: Option<crate::ground_support::GroundSupport>,
pub(super) on_building_floor: bool,
@@ -46,7 +48,7 @@ pub(super) struct Boarding {
impl Boarding {
pub(super) fn controls_chassis(self) -> bool {
- self.remote != Some(RemoteWarbotControl::Autopilot)
+ self.turret.is_none() && self.remote != Some(RemoteWarbotControl::Autopilot)
}
pub(super) fn controls_weapons(self) -> bool {
@@ -183,24 +185,27 @@ pub fn board_friendly_warbot(
..hero_pose
},
)?;
- start_warbot_control(engine, hero, cockpit, None);
+ start_player_control(engine, hero, cockpit, None, None);
Ok(Some(cockpit))
}
-fn start_warbot_control(
+fn start_player_control(
engine: &mut Engine,
hero: StartingCockpit,
cockpit: StartingCockpit,
remote: Option<RemoteWarbotControl>,
+ turret: Option<crate::TurretAim>,
) {
- let can_fly = crate::player_motion::warbot_can_fly(engine, cockpit.object_index);
+ let can_fly =
+ turret.is_none() && crate::player_motion::warbot_can_fly(engine, cockpit.object_index);
if let Some(mission) = &mut engine.loaded {
mission.boarding = Some(Boarding {
cockpit,
hero,
remote,
+ turret,
can_fly,
- ground: (!can_fly)
+ ground: (turret.is_none() && !can_fly)
.then(|| {
crate::ground_support::GroundSupport::prepare(
&mission.mission_assets,
@@ -314,6 +319,7 @@ pub fn disembark_warbot(engine: &mut Engine) -> Result<Option<StartingCockpit>,
cockpit: vehicle,
hero,
remote,
+ turret,
can_fly,
on_building_floor,
..
@@ -370,6 +376,11 @@ pub fn disembark_warbot(engine: &mut Engine) -> Result<Option<StartingCockpit>,
mission.boarding = None;
mission.player_pitch_bits = 0;
mission.hero_walk_velocity = [0.0; 2];
+ if turret.is_some() {
+ if let Some(vfs) = &engine.services.vfs {
+ mission.hero_look = crate::hero_look::HeroLook::load(vfs.as_ref());
+ }
+ }
mission.hero_look.reset();
Ok(Some(hero))
}