prefabs/walrus_camp.lua
197198199200201202203
local function SpawnHuntingParty(inst, target, houndsonly)
trace("SpawnHuntingParty", inst, target, houndsonly)
local leader = GetMember(inst, "walrus")
if not houndsonly and not leader and CanSpawn(inst, "walrus") then
leader = SpawnMember(inst, "walrus")
197198199200201202
local function SpawnHuntingParty(inst, target, houndsonly)
trace("SpawnHuntingParty", inst, target, houndsonly)
local leader = GetMember(inst, "walrus")
if not houndsonly and not leader and CanSpawn(inst, "walrus") then
leader = SpawnMember(inst, "walrus")
221222223224225226227
trace("hound", i)
local hound = existing_hounds[i]
if not hound then
trace("spawn new hound")
hound = SpawnMember(inst, "icehound")
hound.Transform:SetPosition(GetSpawnPoint(inst))
220221222223224225226
trace("hound", i)
local hound = existing_hounds[i]
if not hound and CanSpawn(inst, "icehound") then
trace("spawn new hound")
hound = SpawnMember(inst, "icehound")
hound.Transform:SetPosition(GetSpawnPoint(inst))
232233234235236237238
trace("use old hound")
end
if companion then
if not hound.components.follower then
hound:AddComponent("follower")
end
231232233234235236237
trace("use old hound")
end
if companion and hound then
if not hound.components.follower then
hound:AddComponent("follower")
end
262263264265266267268
-- assign value to forward declared local above
OnMemberNewTarget = function (inst, member, data)
trace("OnMemberNewTarget", inst, member, data)
if member:IsNear(inst, AGGRO_SPAWN_PARTY_RADIUS) then
CheckSpawnHuntingParty(inst, data.target, false)
end
261262263264265266
-- assign value to forward declared local above
OnMemberNewTarget = function (inst, member, data)
trace("OnMemberNewTarget", inst, member, data)
if member:IsNear(inst, AGGRO_SPAWN_PARTY_RADIUS) then
CheckSpawnHuntingParty(inst, data.target, false)
end