aboutsummaryrefslogtreecommitdiff
path: root/crates/fparkan-runtime/src/player_status.rs
diff options
context:
space:
mode:
authorValentin Popov <valentin@popov.link>2026-11-14 20:50:17 +0300
committerValentin Popov <valentin@popov.link>2026-11-14 20:50:17 +0300
commita124d9021e14c4e2b68b72aa70dc1508abe7c2c8 (patch)
tree635a4be0e9b59235492b3eccad3b227395242eb1 /crates/fparkan-runtime/src/player_status.rs
parent1218625643bb22e00c1e2e85458c0098ac4ed6f1 (diff)
downloadfparkan-a124d9021e14c4e2b68b72aa70dc1508abe7c2c8.tar.xz
fparkan-a124d9021e14c4e2b68b72aa70dc1508abe7c2c8.zip
fix(production): let separate factories build concurrently
Reserve each slot at order time and advance one order per live factory. Hostile completion no longer changes the player's status. A stock Two Fortresses regression starts the player's factory during an enemy job and observes completions from both.
Diffstat (limited to 'crates/fparkan-runtime/src/player_status.rs')
-rw-r--r--crates/fparkan-runtime/src/player_status.rs10
1 files changed, 10 insertions, 0 deletions
diff --git a/crates/fparkan-runtime/src/player_status.rs b/crates/fparkan-runtime/src/player_status.rs
index 637f5254..882ccf33 100644
--- a/crates/fparkan-runtime/src/player_status.rs
+++ b/crates/fparkan-runtime/src/player_status.rs
@@ -1,6 +1,16 @@
use crate::{Engine, MissionControlNodeProviderTableStatus};
use fparkan_world::{handle_by_original_id, identity_metadata, ObjectHandle};
+/// Reports whether this clan is controlled by the player.
+#[must_use]
+pub fn is_player_clan(engine: &Engine, clan: u16) -> bool {
+ engine
+ .loaded
+ .as_ref()
+ .and_then(|mission| mission.mission.clans.get(usize::from(clan)))
+ .is_some_and(|clan| clan.mode == 1)
+}
+
/// Current values for the player's controlled unit and clan.
#[derive(Clone, Copy, Debug, PartialEq)]
pub struct PlayerStatus {