Jump to content

klaussackspawner doesn't consider eyeturret (with patch)


chaosmonkey
  • Pending

The eyeturret is effectively a defensive structure and should be considered when spawning a klaus sack. The included patch addresses both the location selection and removal of "too close" structures.

diff --git a/scripts/components/klaussackspawner.lua b/scripts/components/klaussackspawner.lua
index 050673f..01a2fd3 100644
--- a/scripts/components/klaussackspawner.lua
+++ b/scripts/components/klaussackspawner.lua
@@ -37,7 +37,7 @@ local function IsValidSpawner(x, y, z)
     return true
 end

-local STRUCTURES_TAGS = { "structure" }
+local STRUCTURES_TAGS = { "structure", "eyeturret" }
 local function SpawnKlausSack()
     local numstructsatspawn = {}

@@ -47,7 +47,7 @@ local function SpawnKlausSack()
     for i, v in ipairs(_spawners) do
         x, y, z = v.Transform:GetWorldPosition()
         if IsValidSpawner(x, y, z) and not IsAnyPlayerInRange(x, y, z, 35) then
-            local structs = TheSim:FindEntities(x, y, z, 5, STRUCTURES_TAGS)
+            local structs = TheSim:FindEntities(x, y, z, 5, nil, nil, STRUCTURES_TAGS)
             if #structs == 0 then
                 break
             end
@@ -74,7 +74,7 @@ local function SpawnKlausSack()
     if x ~= nil then
         x, y, z = TheWorld.Map:GetTileCenterPoint(x, y, z)
         local sack = SpawnPrefab("klaus_sack")
-        local structs = TheSim:FindEntities(x, y, z, 2, STRUCTURES_TAGS)
+        local structs = TheSim:FindEntities(x, y, z, 2, nil, nil, STRUCTURES_TAGS)
         for i, v in ipairs(structs) do
             if v.components.workable ~= nil then
                 v.components.workable:Destroy(sack)

 


Steps to Reproduce

Spawn an eyeturret at every deerspawningground except 1. Fast forward to winter and observe that the klaus sack can spawn on top of the eyeturret.

After applying the above patch, klaus sack spawner works as expected with eye turrets.

  • Sad Dupe 1



User Feedback


There are no comments to display.



Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
  • Create New...