Activation handler for ESM4 Door

fix-glsl-editorconfig
Petr Mikheev 1 year ago
parent 2a6e301925
commit 480951207c

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