Merge branch 'load_esm4' into 'master'

Activation handler for ESM4 Door

See merge request OpenMW/openmw!2915
7344-support-launching-the-example-suite
psi29a 2 years ago
commit 55a162e3dd

@ -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

Loading…
Cancel
Save