Implement whole-game packed event conditions

This commit is contained in:
Jan Petykiewicz 2026-04-15 21:41:40 -07:00
commit cc54a00e25
16 changed files with 1184 additions and 42 deletions

View file

@ -0,0 +1,81 @@
{
"format_version": 1,
"fixture_id": "packed-event-world-condition-gated-save-slice-fixture",
"source": {
"kind": "captured-runtime",
"description": "Fixture proving whole-game ordinary conditions gate imported world-state effects."
},
"state_save_slice_path": "packed-event-world-condition-gated-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,
"candidate_availability_count": 2,
"zero_candidate_availability_count": 0,
"special_condition_count": 1,
"enabled_special_condition_count": 1,
"world_restore_economic_status_code": 4,
"total_event_record_service_count": 2,
"total_trigger_dispatch_count": 2
},
"expected_state_fragment": {
"world_restore": {
"economic_status_code": 4
},
"candidate_availability": {
"Mogul": 2,
"Turbo Diesel": 1
},
"packed_event_collection": {
"records": [
{
"import_outcome": "imported"
},
{
"import_outcome": "imported",
"decoded_conditions": [
{
"kind": "special_condition_threshold",
"label": "Use Wartime Cargos",
"comparator": "ge",
"value": 1
},
{
"kind": "candidate_availability_threshold",
"name": "Mogul",
"comparator": "ge",
"value": 2
},
{
"kind": "economic_status_code_threshold",
"comparator": "ge",
"value": 4
}
]
}
]
},
"event_runtime_records": [
{
"record_id": 41,
"service_count": 1
},
{
"record_id": 44,
"service_count": 1
}
]
}
}

View file

@ -0,0 +1,297 @@
{
"format_version": 1,
"save_slice_id": "packed-event-world-condition-gated-save-slice",
"source": {
"description": "Tracked save-slice document with whole-game conditions gating a whole-game effect.",
"original_save_filename": "captured-world-condition-gated.gms",
"original_save_sha256": "world-condition-gated-sample-sha256",
"notes": [
"tracked as JSON save-slice document rather than raw .smp",
"proves whole-game ordinary conditions gate imported runtime effects"
]
},
"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": {
"source_kind": "save-bridge-secondary-block",
"semantic_family": "scenario-named-candidate-availability-table",
"header_offset": 27248,
"entries_offset": 27345,
"entries_end_offset": 27432,
"observed_entry_count": 2,
"zero_availability_count": 1,
"zero_availability_names": [
"Turbo Diesel"
],
"footer_progress_hex_words": [
"0x000032dc",
"0x00003714"
],
"entries": [
{
"index": 0,
"offset": 27345,
"text": "Mogul",
"availability_dword": 2,
"availability_dword_hex": "0x00000002",
"trailer_word": 2,
"trailer_word_hex": "0x00000002"
},
{
"index": 1,
"offset": 27373,
"text": "Turbo Diesel",
"availability_dword": 0,
"availability_dword_hex": "0x00000000",
"trailer_word": 0,
"trailer_word_hex": "0x00000000"
}
]
},
"special_conditions_table": {
"source_kind": "save-fixed-special-conditions-range",
"table_offset": 3428,
"table_len": 144,
"enabled_visible_count": 1,
"enabled_visible_labels": [
"Use Wartime Cargos"
],
"entries": [
{
"slot_index": 0,
"hidden": false,
"label_id": 2874,
"help_id": 2875,
"label": "Use Wartime Cargos",
"value": 1,
"value_hex": "0x00000001"
},
{
"slot_index": 35,
"hidden": true,
"label_id": 3,
"help_id": 3,
"label": "Hidden sentinel",
"value": 1,
"value_hex": "0x00000001"
}
]
},
"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": 30528,
"records_tag_offset": 30784,
"close_tag_offset": 31616,
"packed_state_version": 1001,
"packed_state_version_hex": "0x000003e9",
"live_id_bound": 44,
"live_record_count": 2,
"live_entry_ids": [41, 44],
"decoded_record_count": 2,
"imported_runtime_record_count": 2,
"records": [
{
"record_index": 0,
"live_entry_id": 41,
"payload_offset": 30848,
"payload_len": 96,
"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": [1, 0, 0, 0],
"grouped_effect_rows": [
{
"group_index": 0,
"row_index": 0,
"descriptor_id": 8,
"descriptor_label": "Economic Status",
"target_mask_bits": 8,
"parameter_family": "whole_game_state_enum",
"opcode": 3,
"raw_scalar_value": 4,
"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 Economic Status to 4",
"locomotive_name": null,
"notes": []
}
],
"decoded_conditions": [],
"decoded_actions": [
{
"kind": "set_economic_status_code",
"value": 4
}
],
"executable_import_ready": true,
"notes": [
"world-side setup record"
]
},
{
"record_index": 1,
"live_entry_id": 44,
"payload_offset": 30976,
"payload_len": 184,
"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": 3,
"standalone_condition_rows": [
{
"row_index": 0,
"raw_condition_id": 3901,
"subtype": 0,
"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": "ge",
"metric": "Special Condition: Use Wartime Cargos",
"semantic_family": "world_state_threshold",
"semantic_preview": "Test Use Wartime Cargos >= 1",
"requires_candidate_name_binding": false,
"notes": [
"tracked whole-game condition sample"
]
},
{
"row_index": 1,
"raw_condition_id": 3902,
"subtype": 0,
"flag_bytes": [2, 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": "ge",
"metric": "Candidate Availability: Mogul",
"semantic_family": "world_state_threshold",
"semantic_preview": "Test Mogul >= 2",
"requires_candidate_name_binding": false,
"notes": [
"tracked whole-game condition sample"
]
},
{
"row_index": 2,
"raw_condition_id": 3903,
"subtype": 0,
"flag_bytes": [4, 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": "ge",
"metric": "Economic Status",
"semantic_family": "world_state_threshold",
"semantic_preview": "Test Economic Status >= 4",
"requires_candidate_name_binding": false,
"notes": [
"tracked whole-game condition sample"
]
}
],
"negative_sentinel_scope": null,
"grouped_effect_row_counts": [1, 0, 0, 0],
"grouped_effect_rows": [
{
"group_index": 0,
"row_index": 0,
"descriptor_id": 109,
"descriptor_label": "Turbo Diesel Availability",
"target_mask_bits": 8,
"parameter_family": "candidate_availability_scalar",
"opcode": 3,
"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": "scalar_assignment",
"semantic_family": "scalar_assignment",
"semantic_preview": "Set Turbo Diesel Availability to 1",
"locomotive_name": null,
"notes": [
"tracked whole-game grouped-effect sample"
]
}
],
"decoded_conditions": [
{
"kind": "special_condition_threshold",
"label": "Use Wartime Cargos",
"comparator": "ge",
"value": 1
},
{
"kind": "candidate_availability_threshold",
"name": "Mogul",
"comparator": "ge",
"value": 2
},
{
"kind": "economic_status_code_threshold",
"comparator": "ge",
"value": 4
}
],
"decoded_actions": [
{
"kind": "set_candidate_availability",
"name": "Turbo Diesel",
"value": 1
}
],
"executable_import_ready": true,
"notes": [
"whole-game ordinary conditions gate a whole-game effect"
]
}
]
},
"notes": [
"whole-game condition-gated effect sample"
]
}
}

View file

@ -0,0 +1,36 @@
{
"format_version": 1,
"fixture_id": "packed-event-world-parity-save-slice-fixture",
"source": {
"kind": "captured-runtime",
"description": "Fixture keeping the current whole-game descriptor and condition frontier explicit."
},
"state_save_slice_path": "packed-event-world-parity-save-slice.json",
"commands": [
{
"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": 0,
"event_runtime_record_count": 0,
"packed_event_blocked_unmapped_world_descriptor_count": 1,
"packed_event_blocked_unmapped_world_condition_count": 1
},
"expected_state_fragment": {
"packed_event_collection": {
"records": [
{
"import_outcome": "blocked_unmapped_world_descriptor"
},
{
"import_outcome": "blocked_unmapped_world_condition"
}
]
}
}
}

View file

@ -0,0 +1,153 @@
{
"format_version": 1,
"save_slice_id": "packed-event-world-parity-save-slice",
"source": {
"description": "Tracked save-slice document preserving the current whole-game descriptor and condition frontier.",
"original_save_filename": "captured-world-parity.gms",
"original_save_sha256": "world-parity-sample-sha256",
"notes": [
"tracked as JSON save-slice document rather than raw .smp",
"keeps one unmapped world descriptor and one unmapped world condition explicit"
]
},
"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,
"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": 32000,
"records_tag_offset": 32256,
"close_tag_offset": 33024,
"packed_state_version": 1001,
"packed_state_version_hex": "0x000003e9",
"live_id_bound": 52,
"live_record_count": 2,
"live_entry_ids": [49, 52],
"decoded_record_count": 2,
"imported_runtime_record_count": 0,
"records": [
{
"record_index": 0,
"live_entry_id": 49,
"payload_offset": 32320,
"payload_len": 112,
"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": [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",
"locomotive_name": null,
"notes": [
"recovered whole-game descriptor family without a checked-in executable mapping yet"
]
}
],
"decoded_conditions": [],
"decoded_actions": [],
"executable_import_ready": false,
"notes": [
"world-side descriptor remains parity-only"
]
},
{
"record_index": 1,
"live_entry_id": 52,
"payload_offset": 32464,
"payload_len": 120,
"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": [0, 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": 3904,
"subtype": 0,
"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": "ge",
"metric": "Special Condition: Disable Stock Buying and Selling",
"semantic_family": "world_state_threshold",
"semantic_preview": "Test Disable Stock Buying and Selling >= 1",
"requires_candidate_name_binding": false,
"notes": [
"recovered world-side ordinary condition family without a checked-in executable mapping yet"
]
}
],
"negative_sentinel_scope": null,
"grouped_effect_row_counts": [0, 0, 0, 0],
"grouped_effect_rows": [],
"decoded_conditions": [],
"decoded_actions": [],
"executable_import_ready": false,
"notes": [
"world-side ordinary condition remains parity-only"
]
}
]
},
"notes": [
"whole-game parity frontier sample"
]
}
}

View file

@ -0,0 +1,45 @@
{
"format_version": 1,
"fixture_id": "packed-event-world-special-condition-save-slice-fixture",
"source": {
"kind": "captured-runtime",
"description": "Fixture proving a whole-game special-condition effect imports and executes through the ordinary runtime path."
},
"state_save_slice_path": "packed-event-world-special-condition-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": 1,
"event_runtime_record_count": 1,
"special_condition_count": 1,
"enabled_special_condition_count": 1,
"total_event_record_service_count": 1,
"total_trigger_dispatch_count": 1
},
"expected_state_fragment": {
"special_conditions": {
"Use Wartime Cargos": 1
},
"packed_event_collection": {
"records": [
{
"import_outcome": "imported",
"decoded_actions": [
{
"kind": "set_special_condition",
"label": "Use Wartime Cargos",
"value": 1
}
]
}
]
}
}
}

View file

@ -0,0 +1,109 @@
{
"format_version": 1,
"save_slice_id": "packed-event-world-special-condition-save-slice",
"source": {
"description": "Tracked save-slice document with a whole-game special-condition effect row.",
"original_save_filename": "captured-world-special-condition.gms",
"original_save_sha256": "world-special-condition-sample-sha256",
"notes": [
"tracked as JSON save-slice document rather than raw .smp",
"proves whole-game special-condition effects import through the ordinary runtime path"
]
},
"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,
"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": 30000,
"records_tag_offset": 30256,
"close_tag_offset": 30720,
"packed_state_version": 1001,
"packed_state_version_hex": "0x000003e9",
"live_id_bound": 12,
"live_record_count": 1,
"live_entry_ids": [12],
"decoded_record_count": 1,
"imported_runtime_record_count": 1,
"records": [
{
"record_index": 0,
"live_entry_id": 12,
"payload_offset": 30336,
"payload_len": 112,
"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": 0,
"standalone_condition_rows": [],
"negative_sentinel_scope": null,
"grouped_effect_row_counts": [1, 0, 0, 0],
"grouped_effect_rows": [
{
"group_index": 0,
"row_index": 0,
"descriptor_id": 108,
"descriptor_label": "Use Wartime Cargos",
"target_mask_bits": 8,
"parameter_family": "special_condition_scalar",
"opcode": 3,
"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": "scalar_assignment",
"semantic_family": "scalar_assignment",
"semantic_preview": "Set Use Wartime Cargos to 1",
"locomotive_name": null,
"notes": [
"tracked world-side descriptor sample"
]
}
],
"decoded_conditions": [],
"decoded_actions": [
{
"kind": "set_special_condition",
"label": "Use Wartime Cargos",
"value": 1
}
],
"executable_import_ready": true,
"notes": [
"tracked whole-game grouped-effect import sample"
]
}
]
},
"notes": [
"whole-game special-condition effect sample"
]
}
}