Combat & Interaction System
Relevant source files
The following files were used as context for generating this wiki page:
The Combat & Interaction System manages logical actor behaviors, weapon mechanics, and entity interactions. It processes state transitions for combat, including attacks, defenses, and movement logic derived from original game data files like COMBAT.INI and ITEM.INI.
The system facilitates complex actor life cycles by coordinating script execution with physics-based movement and collision detection. It ensures that actors respond to player inputs or AI decisions while maintaining deterministic simulation rules.
Sources: crates/cyrus-game/src/script/registry.rs:1-80, crates/cyrus-assets/src/script/combat.rs
Combat Data Structures
Combat behaviors are defined by Attack and Defense structures prepared from COMBAT.INI. An Attack consists of multiple Motion segments, which can be linked to form authored combos.
Attack and Motion
A Motion defines the specific parameters of a single combat move, including its range, timing, and collision properties.
The system identifies four primary attack types: Melee, Missile, Combo, and Stab.
Sources: crates/cyrus-assets/src/script/combat.rs:5-52, crates/cyrus-assets/src/script/combat.rs:95-115
Defense Mechanics
Defenses are organized as a numbered prefix table. The system scans the table until it encounters a record with a zero maximum range.
Sources: crates/cyrus-assets/src/script/combat.rs:188-216
Actor Control State
Each logical actor maintains an ActorControlState that tracks lifecycle selectors, motion classification, and combat status.
| Field | Description |
|---|---|
death_selector | Lifecycle selector (e.g., 6 for combat entry, 8 for dead). |
living_state | Current motion or weapon state. |
sliding_state | Tracks whether the actor is currently sliding. |
weapon_drawn | Boolean indicating if the actor's weapon is equipped. |
combat | Optional CombatControlState containing tactical data. |
Sources: crates/cyrus-game/src/script/registry.rs:200-265
Weapon Geometry
Weapon models are defined by their hand and hilt model stems. The system interprets the ROB Y-extent as signed map units to determine weapon length before Q8 conversion.
Interaction Logic
The system handles interactions through script hooks and native function calls. Key interaction types include:
Player Activation
The system samples player controller inputs to determine if an interaction is valid. Activation requires checking the player's current condition (e.g., whether they are on a rope or in water).
Sources: crates/cyrus-game/src/script/registry.rs:1145-1160
Inventory and Items
AddItem and RemoveItem functions operate on the session inventory. The system validates prerequisites and drop/add dependencies for every item.
| Feature | Description |
|---|---|
| Prerequisites | List of items required to use or own an item. |
| Item Scripts | Script instances triggered upon item usage. |
| HUD Artwork | PNG frames and atlases for inventory display. |
Sources: crates/cyrus-assets/src/hud_export.rs:180-230, crates/cyrus-game/src/script/registry.rs:1360-1375
Combat Message Flow
Actors communicate during combat using addressed messages. These messages are sent using the receiver's authored class.
Conclusion
The Combat & Interaction System provides a robust framework for managing actor lifecycles and tactical engagements. By deriving logic directly from original game data and maintaining a separated logical state, it ensures faithful reproduction of game behaviors within the modern Rust environment.