Commit Graph
25 Commits
Author SHA1 Message Date
claudeandClaude Opus 5.5 9e28969629 Add ledge mantling
Ashlar checks / tooling (push) Successful in 5s
New [Game] mantling setting, on by default, with mantle max height (1.1
times the actor's height above its feet) and mantle duration (0.4 s).
When the player jumps or falls into a wall while moving towards it
(within 60 degrees), the movement solver casts the player's collision
shape up, across the edge and down. If it finds a surface flat enough to
stand on, above the feet and within reach, with headroom and room on top,
the player moves up, across and onto it along that checked path. Movement
and jump input are ignored meanwhile, and the climb ends any fall without
fall damage. No animation is needed. A script move or teleport, noclip or
paralysis cancels a climb.

Lua: self.controls.mantle (true by default) vetoes climbs while false,
and the actor's scripts get an AshlarMantle event with the ledge height
when one starts. The engine logs "Ashlar mantle:" lines at verbose level.
Player only; with the setting off nothing changes.

The geometry rules (reach, headroom, room on top, slope, too high, too
low) and the climb path are in mwphysics/mantle.cpp, apart from the
physics calls, with unit tests. The new mantle scenario uses a CC0 box
mesh written for it: the player climbs an 80 unit ledge, doesn't climb it
with the Lua veto, and doesn't climb a 240 unit wall.

Closes #28

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-15 15:44:40 -05:00
claudeandClaude Opus 5.5 a691315db7 Add a stamina-driven sprint
Ashlar checks / tooling (push) Successful in 9s
New [Game] sprint setting, on by default, with sprint speed multiplier
(1.4 times run speed), sprint fatigue drain (10 per second on top of
running, halved at Athletics 100) and sprint fatigue threshold (0.1 of
maximum fatigue to start). A sprint ends when fatigue falls below 1% of
maximum; regeneration keeps fatigue just above 0 while running, so
exactly 0 is never reached.

Sprint is engine action 52, Lua input.ACTION.Sprint and the player's
'Sprint' Lua action, with self.controls.sprint. Defaults are Left Alt
and D-pad up, because L3 is already Sneak. Sprinting needs forward
movement within 45 degrees, and isn't possible while sneaking, in the
block stance, swimming, levitating, knocked down or paralyzed. Pressing
Use with a weapon or spell ready ends the sprint until Sprint is
released, so no attack starts while sprinting. A sprint counts as
running for animations, Athletics and the running fatigue cost. AI
doesn't sprint. With the setting off the control does nothing.

The rules are in mwmechanics/sprint.cpp with unit tests. The movement
scenario gains sprint, tiredsprint and sprintuse phases, run in a
circle from the start point so the player stays on land.

Closes #27

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-15 04:12:57 -05:00
claudeandClaude Opus 5.5 4e152c7c4e Add active blocking for NPCs and creatures
With real time combat and the new [Game] 'ai active blocking' setting
(on by default), NPCs and creatures block through the same stance and
arc rules as the player instead of the classic roll.

In combat, an actor with a shield ready and its weapon drawn raises the
stance when an enemy in front of it winds up a melee attack within
reach. Whether it reacts is rolled once per wind-up (10% at 0 Block
skill and agility, up to 90%, scaled by fatigue), and its reaction
delay falls from 0.6 s to 0.15 s with skill. It keeps the block up for
half a second after the wind-up ends so it catches the swing, drops it
after two seconds at most so a held wind-up can't pin it, and starts
no attacks while blocking.

The decision lives in mwmechanics/aiblock.cpp. Combat AI sets a
separate, unsaved CreatureStats flag that is cleared every frame before
AI runs, so a block never outlives the combat package and a Lua block
request is left alone. Actors without a shield never block, and a
creature blocks only if it can carry a shield.

Closes #20

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-13 04:31:38 -05:00
claudeandClaude Opus 5.5 78f1f9516d Let the player block with a weapon, and raise the shield while blocking
Holding Block now works without a shield: with a drawn melee weapon the
player parries melee hits from the front. A parry lets [Game] 'weapon
block damage' (default 0.5) of the damage through, and the weapon takes
the rest as wear. It costs fatigue scaled by Block skill and trains
Block like a shield block. A shield still blocks the whole hit.

While in the stance with a shield, the left arm holds the shield raised
using the shield group's "block start" to "block hit" keys. Animations
without those keys are left alone.

Requested by Eric during a playtest of #19.

Refs #19
Refs #23

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-12 16:28:09 -05:00
claudeandClaude Opus 5.5 9be251af0a Add active blocking for the player
With [Game] 'real time combat' on, the player blocks by holding the new
Block action instead of relying on the classic block roll. Holding Block
with a shield equipped and the weapon drawn raises the block stance: no
new attacks start, movement slows to [Game] 'block stance speed'
(default 0.5), and every melee hit inside the fCombatBlockLeftAngle to
fCombatBlockRightAngle arc is blocked with no roll. Shield durability,
fatigue loss and Block skill training work as before, but the fatigue
cost now falls with Block skill, to half at 100. Without the stance the
player doesn't block. NPCs and creatures keep the classic roll (#20).

Block is engine action 51, exposed to Lua as input.ACTION.Block and as
the player's 'Block' Lua action, with self.controls.block. Defaults are
the middle mouse button and D-pad down, which nothing else uses. With
the setting off, behavior is unchanged.

The pure rules (arc, stance gate, fatigue scaling) live in the new
mwmechanics/activeblock.cpp with unit tests.

Closes #19

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-12 16:01:43 -05:00
Cody Glassman 302d92561d docs - begin restructing docs 2025-06-16 15:36:43 -07:00
Evil Eye e5e21eef20 Fix minor documentation errors 2025-03-20 20:08:31 +01:00
uramer 244c4b4376 Dono't use self as a type name, as it's reserved in Teal 2024-10-20 18:27:28 +02:00
Mads Buvik Sandvei 3df137166c Update self.lua 2024-08-06 20:18:43 +00:00
Max Yari 13918e3b70 AttackType -> ATTACK_TYPE 2024-06-24 01:15:43 +02:00
Max Yari 88e4ec198d Changed value type in the docs 2024-06-22 00:15:19 +02:00
Max Yari b01b76b81e Introduced attacktype enum, fixed lua docs 2024-06-21 23:18:48 +02:00
Max Yari 2ef0568dda Changed lua enum name, tweaked docs 2024-06-21 23:18:48 +02:00
Max Yari 70c822d036 Updated lua docs description 2024-06-21 23:18:48 +02:00
Alexei Kotov 98447a1690 Remove legacy ownership documentation 2024-02-26 12:48:59 +03:00
Petr Mikheev 866f67ed19 Change MWScript Lua bindings (#7142) 2023-06-30 22:26:17 +02:00
ZackhasacatandPetr Mikheev f6fb05d1ca Add functionality for lua to view and modify ownership data for GameObjects 2023-04-25 21:20:43 +00:00
Krzysztof Antoniak ccdd381f96 Minor fixes to Lua documentation 2023-02-28 22:04:53 -08:00
Petr Mikheev 8c7cad024b Access local mwscript variables in Lua scripts 2023-01-07 22:10:10 +01:00
Petr Mikheev 1869aeae5c Move some of player controls logic from C++ to Lua 2022-12-28 22:04:19 +01:00
uramer 4a0b784699 Use reasonable Luadoc comment headers 2022-02-23 22:08:50 +01:00
Petr Mikheev 6c56436809 Control AI packages from Lua 2022-02-06 15:01:51 +01:00
uramerandPetr Mikheev c31dedb89c Implement Yaw, Pitch and Use (attack / cast spell) in Lua self.controls 2022-02-01 18:47:20 +00:00
Petr Mikheev 0f7f5ce140 Remove Lua command "self:setDirectControl" 2021-08-03 14:36:51 +03:00
Petr Mikheev 4eb5841c60 Update OpenMW Lua documentation 2021-07-09 20:48:54 +02:00