LD = require("design.LevelDesignLibrary")
local freyaAiObject, thisLevel
function OnScriptLoaded(level)
  thisLevel = level
end
function SpawnFreyaWithPosAndDir(level, spawnPosVector, spawnDirVector)
  print("---------------------------------------------------------------------freya spawn logic triggered")
  local existingFreyaObj = LD.FindFreya()
  if existingFreyaObj == nil then
    freyaAiObject = game.AI.Spawn(thisLevel, spawnPosVector, spawnDirVector, "CRT_Freya00", "BRA_SpawnNarrative")
    print("------------------------------------------------------------------freya has been spawned: " .. tostring(freyaAiObject))
    print("------------------------------------------------------------------freya is located at: " .. tostring(freyaAiObject:GetWorldPosition()))
  else
    existingFreyaObj:Warp(spawnPosVector, spawnDirVector)
    print("------------------------------------------------------------------freya already exists: " .. tostring(existingFreyaObj))
    print("------------------------------------------------------------------freya has been warped to: " .. tostring(existingFreyaObj:GetWorldPosition()))
  end
end
