FrameworkZ
10.8.3
Provides a framework for Project Zomboid with various systems.
Loading...
Searching...
No Matches
fzta_LockUnlockWindow.lua
Go to the documentation of this file.
1
if
not
isClient
() then return end
2
3
local
ISBaseTimedAction
=
ISBaseTimedAction
4
local
IsoFlagType
=
IsoFlagType
5
6
require "TimedActions/
ISBaseTimedAction
"
7
8
ISLockUnlockWindow
=
ISBaseTimedAction
:derive("
ISLockUnlockWindow
");
9
10
function
ISLockUnlockWindow
:isValid()
11
local keyId =
self
.window:getKeyId()
12
if
self
.character:getInventory():haveThisKeyId(keyId) then return true end
13
return
FrameworkZ
.Utilities:IsTrulyInterior(
self
.character:
getSquare
())
14
end
15
16
function
ISLockUnlockWindow
:update() end
17
18
function
ISLockUnlockWindow
:start()
19
self
.character:faceThisObject(
self
.window)
20
end
21
22
function
ISLockUnlockWindow
:stop()
23
if not
self
:isValid() then
24
self
.character:faceThisObject(
self
.window)
25
self
.character:getEmitter():playSound("DoorIsLocked")
26
end
27
28
ISBaseTimedAction
.stop(
self
)
29
end
30
31
if
isServer
() then
32
function
ISLockUnlockWindow
.LockWindow(
data
, coordinates)
33
local
x
,
y
, z = coordinates.
x
, coordinates.
y
, coordinates.z
34
local window =
getSquare
(
x
,
y
, z) and
getSquare
(
x
,
y
, z).getWindow and
getSquare
(
x
,
y
, z):getWindow() or
nil
35
36
if window then
37
window:setPermaLocked(true)
38
window:setIsLocked(true)
39
end
40
end
41
FrameworkZ
.
Foundation
:Subscribe("
ISLockUnlockWindow
.LockWindow",
ISLockUnlockWindow
.LockWindow)
42
43
function
ISLockUnlockWindow
.UnlockWindow(
data
, coordinates)
44
local
x
,
y
, z = coordinates.
x
, coordinates.
y
, coordinates.z
45
local window =
getSquare
(
x
,
y
, z) and
getSquare
(
x
,
y
, z).getWindow and
getSquare
(
x
,
y
, z):getWindow() or
nil
46
47
if window then
48
window:setPermaLocked(false)
49
window:setIsLocked(false)
50
end
51
end
52
FrameworkZ
.
Foundation
:Subscribe("
ISLockUnlockWindow
.UnlockWindow",
ISLockUnlockWindow
.UnlockWindow)
53
end
54
55
function
ISLockUnlockWindow
:perform()
56
if
self
.shouldLock then
57
FrameworkZ
.
Foundation
:SendFire(
self
.character, "
ISLockUnlockWindow
.LockWindow", function()
58
self
.window:setPermaLocked(true)
59
self
.window:setIsLocked(true)
60
self
.character:getEmitter():playSound("WoodDoorLock")
61
end, {
self
.window:getX(),
self
.window:getY(),
self
.window:getZ()})
62
elseif not
self
.shouldLock then
63
FrameworkZ
.
Foundation
:SendFire(
self
.character,
"ISLockUnlockWindow.LockWindow"
, function()
64
self
.window:setPermaLocked(false)
65
self
.window:setIsLocked(false)
66
self
.character:getEmitter():playSound(
"WoodDoorLock"
)
67
end, {
self
.window:getX(),
self
.window:getY(),
self
.window:getZ()})
68
end
69
70
ISBaseTimedAction
.perform(
self
)
71
end
72
73
function
ISLockUnlockWindow
:
new
(character, window, shouldLock)
74
local o = {}
75
76
setmetatable(o,
self
)
77
self
.__index =
self
78
o.character = character
79
o.window = window
80
o.shouldLock = shouldLock
81
o.stopOnWalk =
true
82
o.stopOnRun =
true
83
o.maxTime = 0
84
85
return
o
86
end
y
void local y()
x
void local x()
nil
void self FrameworkZ UI self nil
Definition
MainMenu.lua:95
self
void self self
Definition
MainMenu.lua:89
getSquare
void local getSquare()
isClient
void local isClient()
isServer
void local isServer()
data
void local data()
Foundation
void FrameworkZ Foundation()
IsoFlagType
void local IsoFlagType()
ISBaseTimedAction
void local ISBaseTimedAction()
UnnamedFunction
void UnnamedFunction()
ISLockUnlockWindow
void ISLockUnlockWindow()
FrameworkZ::Foundation
Foundation for FrameworkZ.
Definition
__Foundation.lua:85
FrameworkZ
Definition
__Boot.lua:2
ISLockUnlockWindow
Definition
fzta_LockUnlockWindow.lua:2
ISLockUnlockWindow::UnlockWindow
void UnlockWindow(data, coordinates)
ISLockUnlockWindow::LockWindow
void LockWindow(data, coordinates)
ISLockUnlockWindow::start
void start()
ISLockUnlockWindow::perform
void perform()
ISLockUnlockWindow::stop
void stop()
ISLockUnlockWindow::isValid
void isValid()
FrameworkZ
Contents
mods
FrameworkZ
media
lua
shared
_FrameworkZ
_TimedActions
fzta_LockUnlockWindow.lua
Generated on Fri Jul 25 2025 08:47:10 for FrameworkZ by
1.10.0