This helps improve clarity by preventing confusion between the refNum and the combination of a refNum and an mpNum that is now called the uniqueIndex.
34 lines
1.0 KiB
Lua
34 lines
1.0 KiB
Lua
packetBuilder = {}
|
|
|
|
packetBuilder.AddAIActorToPacket = function(actorUniqueIndex, action, targetPid, targetUniqueIndex,
|
|
posX, posY, posZ, distance, duration, shouldRepeat)
|
|
|
|
local splitIndex = actorUniqueIndex:split("-")
|
|
tes3mp.SetActorRefNum(splitIndex[1])
|
|
tes3mp.SetActorMpNum(splitIndex[2])
|
|
|
|
tes3mp.SetActorAIAction(action)
|
|
|
|
if targetPid ~= nil then
|
|
tes3mp.SetActorAITargetToPlayer(targetPid)
|
|
elseif targetUniqueIndex ~= nil then
|
|
local targetSplitIndex = targetUniqueIndex:split("-")
|
|
|
|
if targetSplitIndex[2] ~= nil then
|
|
tes3mp.SetActorAITargetToObject(targetSplitIndex[1], targetSplitIndex[2])
|
|
end
|
|
elseif posX ~= nil and posY ~= nil and posZ ~= nil then
|
|
tes3mp.SetActorAICoordinates(posX, posY, posZ)
|
|
elseif distance ~= nil then
|
|
tes3mp.SetActorAIDistance(distance)
|
|
elseif duration ~= nil then
|
|
tes3mp.SetActorAIDuration(duration)
|
|
end
|
|
|
|
tes3mp.SetActorAIRepetition(shouldRepeat)
|
|
|
|
tes3mp.AddActor()
|
|
end
|
|
|
|
return packetBuilder
|