1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-01-01 03:21:41 +00:00

Merge branch 'load_esm4' into 'master'

Activation handler for ESM4 Door

See merge request OpenMW/openmw!2915
This commit is contained in:
psi29a 2023-04-20 15:38:49 +00:00
commit 55a162e3dd

View File

@ -1,9 +1,27 @@
local async = require('openmw.async')
local types = require('openmw.types')
local world = require('openmw.world')
local EnableObject = async:registerTimerCallback('EnableObject', function(obj) obj.enabled = true end)
local function ESM4DoorActivation(door, actor)
-- TODO: Implement lockpicking minigame
-- TODO: Play door opening animation and sound
local Door4 = types.ESM4Door
if Door4.isTeleport(door) then
actor:teleport(Door4.destCell(door), Door4.destPosition(door), Door4.destRotation(door))
else
door.enabled = false
async:newSimulationTimer(5, EnableObject, door)
end
return false -- disable activation handling in C++ mwmechanics code
end
local handlersPerObject = {}
local handlersPerType = {}
handlersPerType[types.ESM4Door] = { ESM4DoorActivation }
local function onActivate(obj, actor)
local handlers = handlersPerObject[obj.id]
if handlers then