Implement world-scalar packed event conditions

This commit is contained in:
Jan Petykiewicz 2026-04-16 13:48:55 -07:00
commit 3f2632e330
12 changed files with 1541 additions and 8 deletions

View file

@ -0,0 +1,43 @@
{
"format_version": 1,
"fixture_id": "packed-event-world-scalar-condition-parity-save-slice-fixture",
"source": {
"kind": "captured-runtime",
"description": "Fixture pinning one remaining unmapped world-scalar ordinary-condition family after the grounded batch."
},
"state_save_slice_path": "packed-event-world-scalar-condition-parity-save-slice.json",
"commands": [
{
"kind": "service_trigger_kind",
"trigger_kind": 7
}
],
"expected_summary": {
"packed_event_collection_present": true,
"packed_event_record_count": 1,
"packed_event_decoded_record_count": 1,
"packed_event_imported_runtime_record_count": 0,
"packed_event_parity_only_record_count": 1,
"packed_event_blocked_unmapped_world_descriptor_count": 1,
"event_runtime_record_count": 0,
"world_flag_count": 7,
"total_event_record_service_count": 0,
"total_trigger_dispatch_count": 1
},
"expected_state_fragment": {
"packed_event_collection": {
"records": [
{
"import_outcome": "blocked_unmapped_world_descriptor",
"standalone_condition_rows": [
{
"raw_condition_id": 2419,
"metric": "All Factory Production",
"semantic_family": "world_scalar_threshold"
}
]
}
]
}
}
}

View file

@ -0,0 +1,125 @@
{
"format_version": 1,
"save_slice_id": "packed-event-world-scalar-condition-parity-save-slice",
"source": {
"description": "Tracked save-slice document pinning one remaining unmapped world-scalar condition family after the grounded batch.",
"original_save_filename": "captured-world-scalar-condition-parity.gms",
"original_save_sha256": "world-scalar-condition-parity-sample-sha256",
"notes": [
"tracked as JSON save-slice document rather than raw .smp",
"keeps the broader all-factory-production family parity-only until a stronger runtime landing surface is grounded"
]
},
"save_slice": {
"file_extension_hint": "gms",
"container_profile_family": "rt3-classic-save-container-v1",
"mechanism_family": "classic-save-rehydrate-v1",
"mechanism_confidence": "grounded",
"trailer_family": null,
"bridge_family": null,
"profile": null,
"candidate_availability_table": null,
"named_locomotive_availability_table": null,
"special_conditions_table": null,
"event_runtime_collection": {
"source_kind": "packed-event-runtime-collection",
"mechanism_family": "classic-save-rehydrate-v1",
"mechanism_confidence": "grounded",
"container_profile_family": "rt3-classic-save-container-v1",
"metadata_tag_offset": 31232,
"records_tag_offset": 31488,
"close_tag_offset": 31872,
"packed_state_version": 1001,
"packed_state_version_hex": "0x000003e9",
"live_id_bound": 33,
"live_record_count": 1,
"live_entry_ids": [33],
"decoded_record_count": 1,
"imported_runtime_record_count": 0,
"records": [
{
"record_index": 0,
"live_entry_id": 33,
"payload_offset": 31520,
"payload_len": 152,
"decode_status": "parity_only",
"payload_family": "real_packed_v1",
"trigger_kind": 7,
"one_shot": false,
"compact_control": {
"mode_byte_0x7ef": 7,
"primary_selector_0x7f0": 0,
"grouped_mode_0x7f4": 2,
"one_shot_header_0x7f5": 0,
"modifier_flag_0x7f9": 0,
"modifier_flag_0x7fa": 0,
"grouped_target_scope_ordinals_0x7fb": [0, 0, 0, 0],
"grouped_scope_checkboxes_0x7ff": [1, 0, 0, 0],
"summary_toggle_0x800": 1,
"grouped_territory_selectors_0x80f": [-1, -1, -1, -1]
},
"text_bands": [],
"standalone_condition_row_count": 1,
"standalone_condition_rows": [
{
"row_index": 0,
"raw_condition_id": 2419,
"subtype": 4,
"flag_bytes": [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
"candidate_name": null,
"comparator": null,
"metric": "All Factory Production",
"semantic_family": "world_scalar_threshold",
"semantic_preview": null,
"requires_candidate_name_binding": false,
"notes": [
"checked-in RT3.lng label is known, but this world-scalar condition family is not yet lowered"
]
}
],
"negative_sentinel_scope": null,
"grouped_effect_row_counts": [1, 0, 0, 0],
"grouped_effect_rows": [
{
"group_index": 0,
"row_index": 0,
"descriptor_id": 110,
"descriptor_label": "Disable Stock Buying and Selling",
"target_mask_bits": 8,
"parameter_family": "world_flag_toggle",
"opcode": 0,
"raw_scalar_value": 1,
"value_byte_0x09": 0,
"value_dword_0x0d": 0,
"value_byte_0x11": 0,
"value_byte_0x12": 0,
"value_word_0x14": 0,
"value_word_0x16": 0,
"row_shape": "bool_toggle",
"semantic_family": "bool_toggle",
"semantic_preview": "Set Disable Stock Buying and Selling to TRUE",
"recovered_locomotive_id": null,
"locomotive_name": null,
"notes": []
}
],
"decoded_conditions": [],
"decoded_actions": [
{
"kind": "set_world_flag",
"key": "world.disable_stock_buying_and_selling",
"value": true
}
],
"executable_import_ready": false,
"notes": [
"unmapped world-scalar condition parity sample"
]
}
]
},
"notes": [
"world-scalar condition parity sample"
]
}
}

View file

@ -0,0 +1,102 @@
{
"format_version": 1,
"fixture_id": "packed-event-world-scalar-condition-save-slice-fixture",
"source": {
"kind": "captured-runtime",
"description": "Fixture proving grounded world-scalar ordinary conditions gate an imported whole-game effect."
},
"state_save_slice_path": "packed-event-world-scalar-condition-save-slice.json",
"commands": [
{
"kind": "service_trigger_kind",
"trigger_kind": 6
},
{
"kind": "service_trigger_kind",
"trigger_kind": 7
}
],
"expected_summary": {
"packed_event_collection_present": true,
"packed_event_record_count": 2,
"packed_event_decoded_record_count": 2,
"packed_event_imported_runtime_record_count": 2,
"event_runtime_record_count": 2,
"named_locomotive_availability_count": 1,
"zero_named_locomotive_availability_count": 0,
"named_locomotive_cost_count": 1,
"cargo_production_override_count": 1,
"world_restore_limited_track_building_amount": 18,
"world_restore_territory_access_cost": 750000,
"world_flag_count": 8,
"total_event_record_service_count": 2,
"total_trigger_dispatch_count": 2
},
"expected_state_fragment": {
"world_flags": {
"world.disable_stock_buying_and_selling": true
},
"world_restore": {
"limited_track_building_amount": 18,
"territory_access_cost": 750000
},
"named_locomotive_availability": {
"Big Boy": 42
},
"named_locomotive_cost": {
"Locomotive 1": 250000
},
"cargo_production_overrides": {
"1": 125
},
"packed_event_collection": {
"records": [
{
"import_outcome": "imported"
},
{
"import_outcome": "imported",
"decoded_conditions": [
{
"kind": "named_locomotive_availability_threshold",
"name": "Big Boy",
"comparator": "eq",
"value": 42
},
{
"kind": "named_locomotive_cost_threshold",
"name": "Locomotive 1",
"comparator": "eq",
"value": 250000
},
{
"kind": "cargo_production_total_threshold",
"comparator": "eq",
"value": 125
},
{
"kind": "limited_track_building_amount_threshold",
"comparator": "eq",
"value": 18
},
{
"kind": "territory_access_cost_threshold",
"comparator": "eq",
"value": 750000
}
]
}
]
},
"event_runtime_records": [
{
"record_id": 41,
"service_count": 1
},
{
"record_id": 45,
"service_count": 1
}
]
}
}

View file

@ -0,0 +1,386 @@
{
"format_version": 1,
"save_slice_id": "packed-event-world-scalar-condition-save-slice",
"source": {
"description": "Tracked save-slice document proving grounded world-scalar ordinary conditions gate a whole-game effect.",
"original_save_filename": "captured-world-scalar-condition.gms",
"original_save_sha256": "world-scalar-condition-sample-sha256",
"notes": [
"tracked as JSON save-slice document rather than raw .smp",
"uses checked-in RT3.lng condition ids for named locomotive availability, named locomotive cost, aggregate cargo production, limited track building amount, and access rights cost"
]
},
"save_slice": {
"file_extension_hint": "gms",
"container_profile_family": "rt3-classic-save-container-v1",
"mechanism_family": "classic-save-rehydrate-v1",
"mechanism_confidence": "grounded",
"trailer_family": null,
"bridge_family": null,
"profile": null,
"candidate_availability_table": null,
"named_locomotive_availability_table": null,
"special_conditions_table": null,
"event_runtime_collection": {
"source_kind": "packed-event-runtime-collection",
"mechanism_family": "classic-save-rehydrate-v1",
"mechanism_confidence": "grounded",
"container_profile_family": "rt3-classic-save-container-v1",
"metadata_tag_offset": 31488,
"records_tag_offset": 31744,
"close_tag_offset": 32768,
"packed_state_version": 1001,
"packed_state_version_hex": "0x000003e9",
"live_id_bound": 45,
"live_record_count": 2,
"live_entry_ids": [41, 45],
"decoded_record_count": 2,
"imported_runtime_record_count": 2,
"records": [
{
"record_index": 0,
"live_entry_id": 41,
"payload_offset": 31808,
"payload_len": 272,
"decode_status": "parity_only",
"payload_family": "real_packed_v1",
"trigger_kind": 6,
"one_shot": false,
"compact_control": {
"mode_byte_0x7ef": 6,
"primary_selector_0x7f0": 0,
"grouped_mode_0x7f4": 2,
"one_shot_header_0x7f5": 0,
"modifier_flag_0x7f9": 0,
"modifier_flag_0x7fa": 0,
"grouped_target_scope_ordinals_0x7fb": [0, 0, 0, 0],
"grouped_scope_checkboxes_0x7ff": [1, 0, 0, 0],
"summary_toggle_0x800": 1,
"grouped_territory_selectors_0x80f": [-1, -1, -1, -1]
},
"text_bands": [],
"standalone_condition_row_count": 0,
"standalone_condition_rows": [],
"negative_sentinel_scope": null,
"grouped_effect_row_counts": [5, 0, 0, 0],
"grouped_effect_rows": [
{
"group_index": 0,
"row_index": 0,
"descriptor_id": 250,
"descriptor_label": "Unknown Loco Available",
"target_mask_bits": 8,
"parameter_family": "locomotive_availability_scalar",
"opcode": 3,
"raw_scalar_value": 42,
"value_byte_0x09": 0,
"value_dword_0x0d": 0,
"value_byte_0x11": 0,
"value_byte_0x12": 0,
"value_word_0x14": 0,
"value_word_0x16": 0,
"row_shape": "scalar_assignment",
"semantic_family": "scalar_assignment",
"semantic_preview": "Set Unknown Loco Available to 42",
"recovered_locomotive_id": 10,
"locomotive_name": null,
"notes": [
"locomotive availability descriptor maps to live locomotive id 10"
]
},
{
"group_index": 0,
"row_index": 1,
"descriptor_id": 352,
"descriptor_label": "Locomotive 1 Cost",
"target_mask_bits": 8,
"parameter_family": "locomotive_cost_scalar",
"opcode": 3,
"raw_scalar_value": 250000,
"value_byte_0x09": 0,
"value_dword_0x0d": 0,
"value_byte_0x11": 0,
"value_byte_0x12": 0,
"value_word_0x14": 0,
"value_word_0x16": 0,
"row_shape": "scalar_assignment",
"semantic_family": "scalar_assignment",
"semantic_preview": "Set Locomotive 1 Cost to 250000",
"recovered_locomotive_id": 1,
"locomotive_name": null,
"notes": [
"locomotive cost descriptor maps to live locomotive id 1"
]
},
{
"group_index": 0,
"row_index": 2,
"descriptor_id": 230,
"descriptor_label": "Cargo Production Slot 1",
"target_mask_bits": 8,
"parameter_family": "cargo_production_scalar",
"opcode": 3,
"raw_scalar_value": 125,
"value_byte_0x09": 0,
"value_dword_0x0d": 0,
"value_byte_0x11": 0,
"value_byte_0x12": 0,
"value_word_0x14": 0,
"value_word_0x16": 0,
"row_shape": "scalar_assignment",
"semantic_family": "scalar_assignment",
"semantic_preview": "Set Cargo Production Slot 1 to 125",
"recovered_locomotive_id": null,
"locomotive_name": null,
"notes": []
},
{
"group_index": 0,
"row_index": 3,
"descriptor_id": 122,
"descriptor_label": "Limited Track Building Amount",
"target_mask_bits": 8,
"parameter_family": "world_track_build_limit_scalar",
"opcode": 3,
"raw_scalar_value": 18,
"value_byte_0x09": 0,
"value_dword_0x0d": 0,
"value_byte_0x11": 0,
"value_byte_0x12": 0,
"value_word_0x14": 0,
"value_word_0x16": 0,
"row_shape": "scalar_assignment",
"semantic_family": "scalar_assignment",
"semantic_preview": "Set Limited Track Building Amount to 18",
"recovered_locomotive_id": null,
"locomotive_name": null,
"notes": []
},
{
"group_index": 0,
"row_index": 4,
"descriptor_id": 453,
"descriptor_label": "Territory Access Cost",
"target_mask_bits": 8,
"parameter_family": "territory_access_cost_scalar",
"opcode": 3,
"raw_scalar_value": 750000,
"value_byte_0x09": 0,
"value_dword_0x0d": 0,
"value_byte_0x11": 0,
"value_byte_0x12": 0,
"value_word_0x14": 0,
"value_word_0x16": 0,
"row_shape": "scalar_assignment",
"semantic_family": "scalar_assignment",
"semantic_preview": "Set Territory Access Cost to 750000",
"recovered_locomotive_id": null,
"locomotive_name": null,
"notes": []
}
],
"decoded_conditions": [],
"decoded_actions": [
{
"kind": "set_named_locomotive_availability_value",
"name": "Big Boy",
"value": 42
},
{
"kind": "set_named_locomotive_cost",
"name": "Locomotive 1",
"value": 250000
},
{
"kind": "set_cargo_production_slot",
"slot": 1,
"value": 125
},
{
"kind": "set_limited_track_building_amount",
"value": 18
},
{
"kind": "set_territory_access_cost",
"value": 750000
}
],
"executable_import_ready": true,
"notes": [
"world-scalar setup record"
]
},
{
"record_index": 1,
"live_entry_id": 45,
"payload_offset": 32128,
"payload_len": 224,
"decode_status": "parity_only",
"payload_family": "real_packed_v1",
"trigger_kind": 7,
"one_shot": false,
"compact_control": {
"mode_byte_0x7ef": 7,
"primary_selector_0x7f0": 0,
"grouped_mode_0x7f4": 2,
"one_shot_header_0x7f5": 0,
"modifier_flag_0x7f9": 0,
"modifier_flag_0x7fa": 0,
"grouped_target_scope_ordinals_0x7fb": [0, 0, 0, 0],
"grouped_scope_checkboxes_0x7ff": [1, 0, 0, 0],
"summary_toggle_0x800": 1,
"grouped_territory_selectors_0x80f": [-1, -1, -1, -1]
},
"text_bands": [],
"standalone_condition_row_count": 5,
"standalone_condition_rows": [
{
"row_index": 0,
"raw_condition_id": 2422,
"subtype": 4,
"flag_bytes": [42, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
"candidate_name": "Big Boy",
"comparator": "eq",
"metric": "Named Locomotive Availability: Big Boy",
"semantic_family": "world_scalar_threshold",
"semantic_preview": "Test Named Locomotive Availability: Big Boy == 42",
"requires_candidate_name_binding": false,
"notes": [
"checked-in world-scalar condition metadata sample"
]
},
{
"row_index": 1,
"raw_condition_id": 2423,
"subtype": 4,
"flag_bytes": [144, 208, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
"candidate_name": "Locomotive 1",
"comparator": "eq",
"metric": "Named Locomotive Cost: Locomotive 1",
"semantic_family": "world_scalar_threshold",
"semantic_preview": "Test Named Locomotive Cost: Locomotive 1 == 250000",
"requires_candidate_name_binding": false,
"notes": [
"checked-in world-scalar condition metadata sample"
]
},
{
"row_index": 2,
"raw_condition_id": 2418,
"subtype": 4,
"flag_bytes": [125, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
"candidate_name": null,
"comparator": "eq",
"metric": "Cargo Production Total",
"semantic_family": "world_scalar_threshold",
"semantic_preview": "Test Cargo Production Total == 125",
"requires_candidate_name_binding": false,
"notes": [
"checked-in world-scalar condition metadata sample"
]
},
{
"row_index": 3,
"raw_condition_id": 2547,
"subtype": 4,
"flag_bytes": [18, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
"candidate_name": null,
"comparator": "eq",
"metric": "Limited Track Building Amount",
"semantic_family": "world_scalar_threshold",
"semantic_preview": "Test Limited Track Building Amount == 18",
"requires_candidate_name_binding": false,
"notes": [
"checked-in world-scalar condition metadata sample"
]
},
{
"row_index": 4,
"raw_condition_id": 1516,
"subtype": 4,
"flag_bytes": [176, 113, 11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
"candidate_name": null,
"comparator": "eq",
"metric": "Territory Access Cost",
"semantic_family": "world_scalar_threshold",
"semantic_preview": "Test Territory Access Cost == 750000",
"requires_candidate_name_binding": false,
"notes": [
"checked-in world-scalar condition metadata sample"
]
}
],
"negative_sentinel_scope": null,
"grouped_effect_row_counts": [1, 0, 0, 0],
"grouped_effect_rows": [
{
"group_index": 0,
"row_index": 0,
"descriptor_id": 110,
"descriptor_label": "Disable Stock Buying and Selling",
"target_mask_bits": 8,
"parameter_family": "world_flag_toggle",
"opcode": 0,
"raw_scalar_value": 1,
"value_byte_0x09": 0,
"value_dword_0x0d": 0,
"value_byte_0x11": 0,
"value_byte_0x12": 0,
"value_word_0x14": 0,
"value_word_0x16": 0,
"row_shape": "bool_toggle",
"semantic_family": "bool_toggle",
"semantic_preview": "Set Disable Stock Buying and Selling to TRUE",
"recovered_locomotive_id": null,
"locomotive_name": null,
"notes": []
}
],
"decoded_conditions": [
{
"kind": "named_locomotive_availability_threshold",
"name": "Big Boy",
"comparator": "eq",
"value": 42
},
{
"kind": "named_locomotive_cost_threshold",
"name": "Locomotive 1",
"comparator": "eq",
"value": 250000
},
{
"kind": "cargo_production_total_threshold",
"comparator": "eq",
"value": 125
},
{
"kind": "limited_track_building_amount_threshold",
"comparator": "eq",
"value": 18
},
{
"kind": "territory_access_cost_threshold",
"comparator": "eq",
"value": 750000
}
],
"decoded_actions": [
{
"kind": "set_world_flag",
"key": "world.disable_stock_buying_and_selling",
"value": true
}
],
"executable_import_ready": true,
"notes": [
"world-scalar conditions gate a whole-game effect"
]
}
]
},
"notes": [
"world-scalar condition executable sample"
]
}
}