aboutsummaryrefslogtreecommitdiff
path: root/crates
diff options
context:
space:
mode:
Diffstat (limited to 'crates')
-rw-r--r--crates/fparkan-runtime/src/satellite_contacts.rs43
1 files changed, 38 insertions, 5 deletions
diff --git a/crates/fparkan-runtime/src/satellite_contacts.rs b/crates/fparkan-runtime/src/satellite_contacts.rs
index f3867ac8..2229f9ed 100644
--- a/crates/fparkan-runtime/src/satellite_contacts.rs
+++ b/crates/fparkan-runtime/src/satellite_contacts.rs
@@ -130,7 +130,14 @@ fn owned_contacts<'a, T>(
let handle = handle_by_original_id(&engine.world, draft.original_id?)?;
let clan = identity_metadata(&engine.world, handle).ok()?.owner_id?;
registration_sequence(&engine.world, handle).ok()??;
- if Some(clan) != owner {
+ // Both native contact renderers reject Control's 0xfffe sentinel
+ // even while the object is still registered as a ruin.
+ if Some(clan) != owner
+ || mission
+ .control_device_tables
+ .iter()
+ .any(|table| table.handle == handle && table.node_provider_depletion_marked)
+ {
return None;
}
let pose = transform_state(&engine.world, handle).ok()?;
@@ -311,14 +318,19 @@ mod tests {
#[test]
#[ignore = "requires licensed corpus"]
- fn captured_factory_appears_at_its_existing_position() {
+ fn captured_factory_mark_disappears_at_control_depletion() {
use super::{landscape_extent, owned_buildings, BuildingContact};
use crate::{
- create, load_gameplay_mission, starting_cockpit, EngineServices, MissionMode,
- MissionRequest, MissionStartupInput,
+ apply_loaded_mission_control_node_delta, create, load_gameplay_mission,
+ loaded_mission_control_device_tables, starting_cockpit, EngineServices,
+ MissionControlNodeProviderTableStatus, MissionMode, MissionRequest,
+ MissionStartupInput,
};
use fparkan_vfs::DirectoryVfs;
- use fparkan_world::{handle_by_original_id, identity_metadata, set_owner, transform_state};
+ use fparkan_world::{
+ handle_by_original_id, identity_metadata, registration_sequence, set_owner,
+ transform_state,
+ };
use std::sync::Arc;
let root = std::env::var_os("FPARKAN_CORPUS_PART1_ROOT").expect("licensed corpus");
@@ -364,5 +376,26 @@ mod tests {
assert!(owner.is_some());
set_owner(&mut engine.world, handle, owner).unwrap();
assert!(owned_buildings(&engine, cockpit, extent).any(|contact| contact == marker));
+
+ let table = loaded_mission_control_device_tables(&engine)
+ .unwrap()
+ .iter()
+ .find(|table| table.handle == handle)
+ .unwrap();
+ let MissionControlNodeProviderTableStatus::Available(rows) = &table.node_provider_status
+ else {
+ panic!("factory provider");
+ };
+ let root_amount = f32::from_bits(rows[0].current_amount_bits);
+ assert!(root_amount > 0.0);
+ let publication =
+ apply_loaded_mission_control_node_delta(&mut engine, handle, 0, -root_amount)
+ .unwrap()
+ .unwrap();
+ assert_eq!(publication.type1_value_bits, 0);
+ assert!(registration_sequence(&engine.world, handle)
+ .unwrap()
+ .is_some());
+ assert!(!owned_buildings(&engine, cockpit, extent).any(|contact| contact == marker));
}
}