Commit Graph
76 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 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
blagish 5f0c338521 Preventing inititating combat with not actors 2026-09-18 04:20:13 +04:00
LeanandEvil Eye 6a721aebc6 restored the get type method call after accidental deletion 2026-08-21 23:15:29 +02:00
LeanandEvil Eye 4713953628 added an additional check to catch lua none values being returned 2026-08-21 23:15:29 +02:00
LeanandEvil Eye 63ba859f69 Added nil check to iterateAndFilterAiSequence. If the filterPackages wrapper passes a callback that returns nil, no packages will be removed. Adjusted removePackages to return an explicit boolean if argument is nil. All previous functionality was retained. 2026-08-21 23:15:29 +02:00
Dave CorleyandEvil Eye d493603e3e FIX: Big sad C L A N G 2026-08-03 16:51:11 +02:00
Dave CorleyandEvil Eye 31cd519bdf CLEANUP: Use the existing mChanged instead of mNoSave 2026-08-03 16:51:11 +02:00
Dave CorleyandEvil Eye d00d06c4a4 FIX: Only allow writing saveState in global scripts 2026-08-03 16:51:11 +02:00
Dave CorleyandEvil Eye fdc418befb FIX: C L A N G 2026-08-03 16:51:11 +02:00
Dave CorleyandEvil Eye d0fd20ff86 FEAT: Implement DontSaveObject with Lua bindings 2026-08-03 16:51:11 +02:00
Evil EyeandAlexei Kotov 317415ea94 Don't set use to an invalid attack type 2026-03-28 18:00:15 +03:00
Mads Buvik Sandvei e2b4d16325 Handler for animations ending 2026-02-24 21:52:10 +01:00
Evil Eye 998065618f Deduplicate stats cache usage 2026-01-11 13:34:21 +01:00
Evil Eye 1d24ad54d9 Replace actor ids with RefNums in ai packages 2025-12-26 11:07:30 +01:00
elsid a2bc1569e0 Remove unused includes 2025-08-02 12:45:03 +02:00
Mads Buvik Sandveiandpsi29a 978d8668f4 Bring jail time skill changes over to lua 2025-08-02 08:39:13 +00:00
Evil Eye 6f9b813bd1 Mark scripts on newly scripted, active objects as active 2025-07-14 22:39:19 +02:00
Kuyondo 77bd2250b0 isactive return bool now 2025-05-07 11:24:09 +08:00
Evil EyeandPetr Mikheev 68ebefc2dd Fix Lua memory usage 2024-10-15 21:18:13 +00:00
Evil Eye a32e006e1c Remove references to temporaries and this_state in properties 2024-09-06 16:57:36 +02:00
Evil Eye c9783344a0 Wrap all memory allocating Lua functions in protected calls 2024-08-22 22:22:28 +02:00
Sebastian Fieber 234476bdae lua - add isFleeing() to lua AI interface 2024-07-31 20:29:33 +02:00
Max Yari 13918e3b70 AttackType -> ATTACK_TYPE 2024-06-24 01:15:43 +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 7d659ae64c Added lua enum for attacktypes 2024-06-21 23:18:48 +02:00
Hristos N. Triantafillouandpsi29a 63a27bbf99 Expose Wander option values to the Lua API (#7916) 2024-05-03 09:40:30 +00:00
Mads Buvik Sandvei e0e968a082 rebase errors 2024-01-30 21:25:39 +01:00
Mads Buvik Sandvei 9f15f3b431 Add engine handler for skill levelup, to dehardcode the book/trainer case. 2024-01-30 21:25:39 +01:00
Mads Buvik Sandvei 011d9d6493 Dehardcode skill and level progression 2024-01-30 21:25:36 +01:00
Mads Buvik SandveiandZackhasacat a94add741e Lua: Animation bindings 2024-01-26 21:39:33 +00:00
Petr Mikheev 4016e8b383 Lua engine handler onTeleported 2023-07-19 10:42:58 +02:00
elsid f6fce5ee15 Cleanup includes 2023-07-08 11:28:56 +02:00
Petr Mikheev 866f67ed19 Change MWScript Lua bindings (#7142) 2023-06-30 22:26:17 +02:00
Petr Mikheev 3c5a9f55c5 Expose the argument cancelOther of AiSequence::stack to Lua 2023-03-27 02:28:45 +02:00
psi29a 76cba95a44 Merge branch 'lua' into 'master'
LuaManager refactoring

See merge request OpenMW/openmw!2852
2023-03-26 11:12:51 +00:00
Petr Mikheev 8d1e52ed51 Extract engine handlers processing from LuaManager to a new class EngineEvents 2023-03-26 03:38:40 +02:00
elsid 33a59a9342 Use ESM::RefId::toDebugString to convert record to string in Lua 2023-03-25 15:05:55 +01:00
Petr Mikheev 2bfffb3063 Move std::variant<SelfObject*, LObject, GObject> from mwlua/stats.cpp to mwlua/objectvariant.hpp 2023-03-13 23:44:00 +01:00
Petr Mikheev 0b385d5db9 Create MWWorld::SafePtr 2023-03-13 23:44:00 +01:00
florent.teppe 216ca71149 Applied review comments
getEditorName => getNameId
restored cosntructor in CoordinateConverter
2023-01-28 12:14:00 +01:00
florent.teppe 531e55e04c Better handling of the esm3 vs esm4 cell problem
Common attribute are in one structure that has two constructors, one for ESM3 vs ESM4 Cell
Mood part of MWWorld::Cell
2023-01-27 13:39:39 +01:00
florent.teppe 562e129bd0 encapsulations of esm3 cell and esm4 cells. 2023-01-26 22:37:31 +01:00
Petr Mikheev 8c7cad024b Access local mwscript variables in Lua scripts 2023-01-07 22:10:10 +01:00
psi29a d5f5e53714 Merge branch 'playercontrols' into 'master'
Move some of player controls logic from C++ to Lua

See merge request OpenMW/openmw!2541
2022-12-30 16:57:40 +00:00
Petr Mikheev 1869aeae5c Move some of player controls logic from C++ to Lua 2022-12-28 22:04:19 +01:00
Petr Mikheev b8fb013edf Merge MWLua::ObjectRegistry and MWWorld::WorldModel 2022-12-28 12:45:11 +01:00
florent.teppe 1ef1de974d script blacklist => RefId
Applies changes from review

Fixed clang format

Clang format + review.
2022-12-27 19:16:21 +01:00