Ashlar checks / tooling (push) Successful in 6s
SCENARIO=combat docker/ashlar-run.sh loads docker/scenarios/combat on top
of the Game Template: our own CC0 Lua content that gives the player a
shield and blade and spawns a hostile duelist with the same kit, cloned
from the template's player record. The player holds Block, then attacks,
and the run prints block counts. The default boot is unchanged.
The engine now logs each successful shield block or parry at verbose
level ("Ashlar block: ..."), so runs can count them.
Documented in docs/ashlar/SCENARIOS.md.
Closes #24
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
59 lines
2.5 KiB
Lua
59 lines
2.5 KiB
Lua
-- Ashlar headless combat scenario (CC0). Gives the player a shield and a blade, spawns a hostile duelist with the
|
|
-- same kit in front of the player, and hands both off to their local scripts. Uses only Game Template meshes.
|
|
local world = require('openmw.world')
|
|
local types = require('openmw.types')
|
|
local util = require('openmw.util')
|
|
|
|
local started = false
|
|
|
|
local function log(...)
|
|
print('ASHLAR_COMBAT', ...)
|
|
end
|
|
|
|
local function makeKit()
|
|
local shieldRec = world.createRecord(types.Armor.createRecordDraft {
|
|
name = 'Test Shield', type = types.Armor.TYPE.Shield, weight = 5, value = 1, health = 5000,
|
|
baseArmor = 5, enchantCapacity = 0, model = 'meshes/marker_error.dae', icon = '' })
|
|
local bladeRec = world.createRecord(types.Weapon.createRecordDraft {
|
|
name = 'Test Blade', type = types.Weapon.TYPE.ShortBladeOneHand, weight = 3, value = 1, health = 5000,
|
|
speed = 1, reach = 1, enchantCapacity = 0, chopMinDamage = 2, chopMaxDamage = 4, slashMinDamage = 2,
|
|
slashMaxDamage = 4, thrustMinDamage = 2, thrustMaxDamage = 4, model = 'meshes/marker_error.dae', icon = '' })
|
|
return world.createObject(shieldRec.id), world.createObject(bladeRec.id)
|
|
end
|
|
|
|
local function start(player)
|
|
local npcRec = world.createRecord(types.NPC.createRecordDraft {
|
|
template = types.NPC.record(player), name = 'Test Duelist', isEssential = false })
|
|
local npc = world.createObject(npcRec.id)
|
|
local yaw = player.rotation:getYaw()
|
|
local forward = util.vector3(math.sin(yaw), math.cos(yaw), 0)
|
|
npc:teleport(player.cell, player.position + forward * 160, util.transform.rotateZ(yaw + math.pi))
|
|
npc:addScript('scripts/ashlarcombat/npc.lua')
|
|
|
|
local pShield, pBlade = makeKit()
|
|
pShield:moveInto(types.Actor.inventory(player))
|
|
pBlade:moveInto(types.Actor.inventory(player))
|
|
local nShield, nBlade = makeKit()
|
|
nShield:moveInto(types.Actor.inventory(npc))
|
|
nBlade:moveInto(types.Actor.inventory(npc))
|
|
|
|
player:sendEvent('AshlarCombatStart', { shield = pShield, blade = pBlade, enemy = npc })
|
|
npc:sendEvent('AshlarCombatStart', { shield = nShield, blade = nBlade, enemy = player })
|
|
log('spawned', npc.recordId)
|
|
end
|
|
|
|
return {
|
|
engineHandlers = {
|
|
onUpdate = function()
|
|
if started then
|
|
return
|
|
end
|
|
local player = world.players[1]
|
|
if player and player.cell then
|
|
started = true
|
|
start(player)
|
|
end
|
|
end,
|
|
},
|
|
}
|