Lua: Add missing light flags, allow creating light record via world.createRecord

This commit is contained in:
Zackhasacat 2024-05-13 14:14:44 +00:00 committed by psi29a
parent f595015ffc
commit c63c1e69cf
7 changed files with 128 additions and 4 deletions

View file

@ -126,7 +126,30 @@ local function testRecordStores()
testRecordStore(types.NPC.races,"races")
testRecordStore(types.Player.birthSigns,"birthSigns")
end
local function testRecordCreation()
local newLight = {
isCarriable = true,
isDynamic = true,
isFire =false,
isFlicker = false,
isFlickerSlow = false,
isNegative = false,
isOffByDefault = false,
isPulse = false,
weight = 1,
value = 10,
duration = 12,
radius = 30,
color = 5,
name = "TestLight",
model = "meshes\\marker_door.dae"
}
local draft = types.Light.createRecordDraft(newLight)
local record = world.createRecord(draft)
for key, value in pairs(newLight) do
testing.expectEqual(record[key],value)
end
end
local function initPlayer()
player:teleport('', util.vector3(4096, 4096, 867.237), util.transform.identity)
coroutine.yield()
@ -165,6 +188,7 @@ tests = {
{'teleport', testTeleport},
{'getGMST', testGetGMST},
{'recordStores', testRecordStores},
{'recordCreation', testRecordCreation},
{'mwscript', testMWScript},
}