Files
sampleproj/Assets/lua/door.lua
Jan Racek 1fdb223f5d lul
2026-03-29 09:34:46 +02:00

39 lines
1.1 KiB
Lua

-- ============================================================================
-- door.lua - Interactable door that plays an open cutscene
-- ============================================================================
-- Tests: onInteract, Cutscene.Play with onComplete, Entity.Find,
-- Entity.SetActive, Controls, Audio
local isOpen = false
function onCreate(self)
isOpen = false
Debug.Log("Door created")
end
function onInteract(self)
if isOpen then
setStatus("Door is already open")
return
end
if Cutscene.IsPlaying() then return end
isOpen = true
Audio.Play("door_open", 100, 64)
Controls.SetEnabled(false)
setStatus("Opening door...")
Cutscene.Play("door_open", {
onComplete = function()
Controls.SetEnabled(true)
setStatus("Door opened! Path is clear.")
-- Disable the door blocker object
local blocker = Entity.Find("DoorBlocker")
if blocker then
Entity.SetActive(blocker, false)
end
end
})
end