GSServer-CBT/soggy_resources/lua/Actor/ActorData.lua
Akbar Yahya e0d4d8040c melon
2022-11-21 16:30:31 +08:00

68 lines
1.4 KiB
Lua
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

----------------------
-- 这是Lua端ActorData包含了创建和管理Actor所使用的数据的接口
-- @module ActorData
local ActorData = {}
function ActorData:GetByNpcRewindData(data)
local sceneID = data.scene_id
if sceneID == nil then
sceneID = sceneData.DefaultSceneID
end
local roomID = data.room_id or 0
local dummyPoint = sceneData:GetDummyPoint(sceneID, data.pos)
if dummyPoint == nil then
print("Dummy Point " .. data.pos .. " is nil")
return
end
local actorData = {
alias = data.alias,
metaPath = data.script,
configID = data.id,
dataIndex = data.data_index,
bornPos = dummyPoint.pos,
bornEuler = dummyPoint.rot,
isNetwork = true,
isAutoStart = true,
sceneID = sceneID,
roomID = roomID,
noPerform = false,
}
return actorData
end
function ActorData:GetByGadgetRewindData(data)
local sceneID = data.scene_id
if sceneID == nil then
sceneID = sceneData.DefaultSceneID
end
local roomID = data.room_id or 0
local dummyPoint = sceneData:GetDummyPoint(sceneID, data.pos)
if dummyPoint == nil then
print("Dummy Point " .. data.pos .. " is nil")
return
end
local actorData = {
alias = data.alias,
metaPath = data.script,
configID = data.id,
dataIndex = data.data_index,
bornPos = dummyPoint.pos,
bornEuler = dummyPoint.rot,
isNetwork = false,
isAutoStart = false,
sceneID = sceneID,
roomID = roomID,
noPerform = false,
}
return actorData
end
return ActorData