Part of #5. Replace the passive block dice roll with a held block when [Game] real time combat is on.
Acceptance
A new Block input action, registered in Lua next to the other player controls, bindable on keyboard, mouse and controller. Its default binding must not conflict with existing defaults.
While Block is held with a shield equipped and the weapon drawn, the player enters a block stance. They can't attack, and they move at reduced speed.
A melee hit inside the existing fCombatBlockLeftAngle/fCombatBlockRightAngle arc is always blocked while in the stance. There is no roll. Shield durability and fatigue loss work as they do today, and the Block skill still trains.
Fatigue loss per block scales down with Block skill, so skill keeps mattering.
With the setting off, behavior is unchanged: the classic roll stays.
Unit tests cover the arc check, the stance gate and the fatigue scaling. Settings and Lua docs are updated.
Notes: hook into MWMechanics::blockMeleeAttack and isReadyToBlock. Keep the diff small and rebase-friendly. Feel needs Eric's playtest.
Part of #5. Replace the passive block dice roll with a held block when `[Game] real time combat` is on.
**Acceptance**
- A new `Block` input action, registered in Lua next to the other player controls, bindable on keyboard, mouse and controller. Its default binding must not conflict with existing defaults.
- While Block is held with a shield equipped and the weapon drawn, the player enters a block stance. They can't attack, and they move at reduced speed.
- A melee hit inside the existing `fCombatBlockLeftAngle`/`fCombatBlockRightAngle` arc is always blocked while in the stance. There is no roll. Shield durability and fatigue loss work as they do today, and the Block skill still trains.
- Fatigue loss per block scales down with Block skill, so skill keeps mattering.
- With the setting off, behavior is unchanged: the classic roll stays.
- Unit tests cover the arc check, the stance gate and the fatigue scaling. Settings and Lua docs are updated.
Notes: hook into `MWMechanics::blockMeleeAttack` and `isReadyToBlock`. Keep the diff small and rebase-friendly. Feel needs Eric's playtest.
claude
added this to the 2. Feel milestone 2026-11-12 18:31:35 +00:00
New Block input: engine action 51, Lua input.ACTION.Block, and a Block Lua action registered with the other player controls, plus self.controls.block. It shows in the controls menu for keyboard/mouse and controller. Defaults: middle mouse button and D-pad down. Nothing else uses either, so there's no conflict. #8 (controller support) may want to revisit the pad layout.
With [Game] real time combat on, holding Block with a shield equipped and the weapon drawn puts the player in the block stance. No new attacks start, and movement is scaled by the new [Game] block stance speed setting (default 0.5).
In the stance, any melee hit inside the fCombatBlockLeftAngle/fCombatBlockRightAngle arc is blocked with no roll. Without the stance the player doesn't block. Shield durability, the block sound, fatigue loss and Block skill training are unchanged, except that fatigue loss is multiplied by 1 - 0.5 * clamp(Block, 0, 100) / 100.
With the setting off, the classic roll is untouched. Holding Block with it off does nothing, because the engine gates the stance on the setting, not on Lua.
NPCs and creatures still use the classic roll. That's #20.
The rules are in the new apps/openmw/mwmechanics/activeblock.cpp, with small hooks in blockMeleeAttack, CharacterController (attack start), Npc::getMaxSpeed and the Lua controls.
Docs: settings/game.rst, settings-default.cfg, openmw/input.lua and openmw/self.lua.
Testing
docker/ashlar-build.sh: build OK. components-tests 1636 passed; openmw-tests 564 passed, including 6 new MWMechanicsActiveBlockTest tests for the arc, the stance gate and fatigue scaling.
docker/ashlar-run.sh: the Game Template boots and renders normally with no Lua errors. The saved input_v3.xml has control 51 bound to MIDDLE and pad button 12 (D-pad down).
Not tested: blocking an actual hit end to end. The Game Template has no shield or hostile melee actor, so this needs test content or Eric's hands-on playtest. How it feels (speed penalty, timing) needs Eric's playtest in any case.
Remaining: there's no held-shield pose yet. The stance is invisible until a hit is blocked and the existing shield animation plays. Follow-up: #23.
Done in `9be251af0a`.
**What changed**
- New `Block` input: engine action 51, Lua `input.ACTION.Block`, and a `Block` Lua action registered with the other player controls, plus `self.controls.block`. It shows in the controls menu for keyboard/mouse and controller. Defaults: **middle mouse button** and **D-pad down**. Nothing else uses either, so there's no conflict. #8 (controller support) may want to revisit the pad layout.
- With `[Game] real time combat` on, holding Block with a shield equipped and the weapon drawn puts the player in the block stance. No new attacks start, and movement is scaled by the new `[Game] block stance speed` setting (default 0.5).
- In the stance, any melee hit inside the `fCombatBlockLeftAngle`/`fCombatBlockRightAngle` arc is blocked with no roll. Without the stance the player doesn't block. Shield durability, the block sound, fatigue loss and Block skill training are unchanged, except that fatigue loss is multiplied by `1 - 0.5 * clamp(Block, 0, 100) / 100`.
- With the setting off, the classic roll is untouched. Holding Block with it off does nothing, because the engine gates the stance on the setting, not on Lua.
- NPCs and creatures still use the classic roll. That's #20.
- The rules are in the new `apps/openmw/mwmechanics/activeblock.cpp`, with small hooks in `blockMeleeAttack`, `CharacterController` (attack start), `Npc::getMaxSpeed` and the Lua controls.
- Docs: `settings/game.rst`, `settings-default.cfg`, `openmw/input.lua` and `openmw/self.lua`.
**Testing**
- `docker/ashlar-build.sh`: build OK. components-tests 1636 passed; openmw-tests 564 passed, including 6 new `MWMechanicsActiveBlockTest` tests for the arc, the stance gate and fatigue scaling.
- `docker/ashlar-run.sh`: the Game Template boots and renders normally with no Lua errors. The saved `input_v3.xml` has control 51 bound to MIDDLE and pad button 12 (D-pad down).
- **Not tested:** blocking an actual hit end to end. The Game Template has no shield or hostile melee actor, so this needs test content or Eric's hands-on playtest. How it feels (speed penalty, timing) needs Eric's playtest in any case.
**Remaining:** there's no held-shield pose yet. The stance is invisible until a hit is blocked and the existing shield animation plays. Follow-up: #23.
4dda556716: the built-in controls no longer clear Block when another script overrides combat controls.
78f1f9516d: you can block with a weapon too, as Eric asked. With a drawn melee weapon and no shield, holding Block parries melee hits from the front. [Game] weapon block damage (default 0.5) of the damage gets through, and the weapon takes the rest as wear. It costs fatigue scaled by Block skill and trains Block. A shield still blocks the whole hit. Hand-to-hand, ranged weapons and spells can't block.
The raised-shield pose (#23) is in the same commit.
The first playtest looked like "nothing happens" for two reasons: there was no pose, and Block in Eric's profile had been rebound to the ` key, which left Console unbound. The bindings are restored.
Headless stance test (Game Template plus a generated test shield and blade, RENDERER software): walking speed is 147 not blocking, 74 blocking with a shield, 147 after release, and 74 blocking with only the weapon. Build OK; components-tests 1636 and openmw-tests 566 passed (8 active-block tests).
Changes from Eric's first playtest:
- `4dda556716`: the built-in controls no longer clear Block when another script overrides combat controls.
- `78f1f9516d`: **you can block with a weapon too**, as Eric asked. With a drawn melee weapon and no shield, holding Block parries melee hits from the front. `[Game] weapon block damage` (default 0.5) of the damage gets through, and the weapon takes the rest as wear. It costs fatigue scaled by Block skill and trains Block. A shield still blocks the whole hit. Hand-to-hand, ranged weapons and spells can't block.
- The raised-shield pose (#23) is in the same commit.
The first playtest looked like "nothing happens" for two reasons: there was no pose, and Block in Eric's profile had been rebound to the ` key, which left Console unbound. The bindings are restored.
Headless stance test (Game Template plus a generated test shield and blade, `RENDERER` software): walking speed is 147 not blocking, 74 blocking with a shield, 147 after release, and 74 blocking with only the weapon. Build OK; components-tests 1636 and openmw-tests 566 passed (8 active-block tests).
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Part of #5. Replace the passive block dice roll with a held block when
[Game] real time combatis on.Acceptance
Blockinput action, registered in Lua next to the other player controls, bindable on keyboard, mouse and controller. Its default binding must not conflict with existing defaults.fCombatBlockLeftAngle/fCombatBlockRightAnglearc is always blocked while in the stance. There is no roll. Shield durability and fatigue loss work as they do today, and the Block skill still trains.Notes: hook into
MWMechanics::blockMeleeAttackandisReadyToBlock. Keep the diff small and rebase-friendly. Feel needs Eric's playtest.Done in
9be251af0a.What changed
Blockinput: engine action 51, Luainput.ACTION.Block, and aBlockLua action registered with the other player controls, plusself.controls.block. It shows in the controls menu for keyboard/mouse and controller. Defaults: middle mouse button and D-pad down. Nothing else uses either, so there's no conflict. #8 (controller support) may want to revisit the pad layout.[Game] real time combaton, holding Block with a shield equipped and the weapon drawn puts the player in the block stance. No new attacks start, and movement is scaled by the new[Game] block stance speedsetting (default 0.5).fCombatBlockLeftAngle/fCombatBlockRightAnglearc is blocked with no roll. Without the stance the player doesn't block. Shield durability, the block sound, fatigue loss and Block skill training are unchanged, except that fatigue loss is multiplied by1 - 0.5 * clamp(Block, 0, 100) / 100.apps/openmw/mwmechanics/activeblock.cpp, with small hooks inblockMeleeAttack,CharacterController(attack start),Npc::getMaxSpeedand the Lua controls.settings/game.rst,settings-default.cfg,openmw/input.luaandopenmw/self.lua.Testing
docker/ashlar-build.sh: build OK. components-tests 1636 passed; openmw-tests 564 passed, including 6 newMWMechanicsActiveBlockTesttests for the arc, the stance gate and fatigue scaling.docker/ashlar-run.sh: the Game Template boots and renders normally with no Lua errors. The savedinput_v3.xmlhas control 51 bound to MIDDLE and pad button 12 (D-pad down).Remaining: there's no held-shield pose yet. The stance is invisible until a hit is blocked and the existing shield animation plays. Follow-up: #23.
Changes from Eric's first playtest:
4dda556716: the built-in controls no longer clear Block when another script overrides combat controls.78f1f9516d: you can block with a weapon too, as Eric asked. With a drawn melee weapon and no shield, holding Block parries melee hits from the front.[Game] weapon block damage(default 0.5) of the damage gets through, and the weapon takes the rest as wear. It costs fatigue scaled by Block skill and trains Block. A shield still blocks the whole hit. Hand-to-hand, ranged weapons and spells can't block.The first playtest looked like "nothing happens" for two reasons: there was no pose, and Block in Eric's profile had been rebound to the ` key, which left Console unbound. The bindings are restored.
Headless stance test (Game Template plus a generated test shield and blade,
RENDERERsoftware): walking speed is 147 not blocking, 74 blocking with a shield, 147 after release, and 74 blocking with only the weapon. Build OK; components-tests 1636 and openmw-tests 566 passed (8 active-block tests).