Vision occluder remover
This mutator removes all vision occluders (usually trees) on the map, and replace capturepoints to resupply zones.
Use this if there are too many trees dropping the framerate, or the map is suffering serious lack of resupply crates.
behaviour("mapremover")
function mapremover:Awake()
local goArray = GameObject.FindObjectsOfType(GameObject);
for i=1,#goArray do
if self.script.mutator.GetConfigurationBool("point") and goArray.GetComponent(ResupplyCrate)~=nil then
self.gameObject.Destroy(goArray)
end
if self.script.mutator.GetConfigurationBool("vision") and goArray.layer==23 then
local dt=goArray
if goArray.transform.parent~=nil then
dt=goArray.transform.parent.gameObject
end
self.gameObject.Destroy(dt)
end
end
if self.script.mutator.GetConfigurationBool("point") then
for i=1,#ActorManager.capturePoints do
local laserHit = Physics.Raycast(Ray(ActorManager.capturePoints.transform.position+Vector3(0,30,0), Vector3(0,-1,0)), 100, RaycastTarget.Opaque)
if laserHit ~= nil then
self.gameObject.Instantiate(self.targets.resupplyzone, ActorManager.capturePoints.transform.position+Vector3(0,30-1*laserHit.distance, 0), Quaternion.Euler(-90,ActorManager.capturePoints.transform.eulerAngles.y,0))
end
for c=1,ActorManager.capturePoints.transform.childCount do
ActorManager.capturePoints.transform.GetChild(c-1).gameObject.SetActive(false)
end
end
end
self.gameObject.Destroy(self.gameObject)
end