mirror of
https://github.com/FlightControl-Master/MOOSE.git
synced 2025-08-15 10:47:21 +00:00
CTLD - No radius check (#1800)
Get rid of radius check in IsUnitInZone()
This commit is contained in:
parent
1172cf0ae7
commit
66f52d41eb
@ -309,7 +309,7 @@ do
|
|||||||
-- @extends Core.Base#BASE
|
-- @extends Core.Base#BASE
|
||||||
|
|
||||||
---
|
---
|
||||||
-- @field CTLD_CARGO
|
-- @field #CTLD_CARGO CTLD_CARGO
|
||||||
CTLD_CARGO = {
|
CTLD_CARGO = {
|
||||||
ClassName = "CTLD_CARGO",
|
ClassName = "CTLD_CARGO",
|
||||||
ID = 0,
|
ID = 0,
|
||||||
@ -1075,7 +1075,7 @@ CTLD.UnitTypes = {
|
|||||||
|
|
||||||
--- CTLD class version.
|
--- CTLD class version.
|
||||||
-- @field #string version
|
-- @field #string version
|
||||||
CTLD.version="1.0.14"
|
CTLD.version="1.0.15"
|
||||||
|
|
||||||
--- Instantiate a new CTLD.
|
--- Instantiate a new CTLD.
|
||||||
-- @param #CTLD self
|
-- @param #CTLD self
|
||||||
@ -3652,9 +3652,10 @@ function CTLD:IsUnitInZone(Unit,Zonetype)
|
|||||||
local zoneret = nil
|
local zoneret = nil
|
||||||
local zonewret = nil
|
local zonewret = nil
|
||||||
local zonenameret = nil
|
local zonenameret = nil
|
||||||
|
local unitcoord = Unit:GetCoordinate()
|
||||||
|
local unitVec2 = unitcoord:GetVec2()
|
||||||
for _,_cargozone in pairs(zonetable) do
|
for _,_cargozone in pairs(zonetable) do
|
||||||
local czone = _cargozone -- #CTLD.CargoZone
|
local czone = _cargozone -- #CTLD.CargoZone
|
||||||
local unitcoord = Unit:GetCoordinate()
|
|
||||||
local zonename = czone.name
|
local zonename = czone.name
|
||||||
local active = czone.active
|
local active = czone.active
|
||||||
local color = czone.color
|
local color = czone.color
|
||||||
@ -3671,17 +3672,17 @@ function CTLD:IsUnitInZone(Unit,Zonetype)
|
|||||||
zone = ZONE:FindByName(zonename)
|
zone = ZONE:FindByName(zonename)
|
||||||
self:T("Checking Zone: "..zonename)
|
self:T("Checking Zone: "..zonename)
|
||||||
zonecoord = zone:GetCoordinate()
|
zonecoord = zone:GetCoordinate()
|
||||||
zoneradius = zone:GetRadius()
|
zoneradius = 1500
|
||||||
zonewidth = zoneradius
|
zonewidth = zoneradius
|
||||||
elseif AIRBASE:FindByName(zonename) then
|
elseif AIRBASE:FindByName(zonename) then
|
||||||
zone = AIRBASE:FindByName(zonename):GetZone()
|
zone = AIRBASE:FindByName(zonename):GetZone()
|
||||||
self:T("Checking Zone: "..zonename)
|
self:T("Checking Zone: "..zonename)
|
||||||
zonecoord = zone:GetCoordinate()
|
zonecoord = zone:GetCoordinate()
|
||||||
zoneradius = zone:GetRadius()
|
zoneradius = 2500
|
||||||
zonewidth = zoneradius
|
zonewidth = zoneradius
|
||||||
end
|
end
|
||||||
local distance = self:_GetDistance(zonecoord,unitcoord)
|
local distance = self:_GetDistance(zonecoord,unitcoord)
|
||||||
if distance <= zoneradius and active then
|
if zone:IsVec2InZone(unitVec2) and active then
|
||||||
outcome = true
|
outcome = true
|
||||||
end
|
end
|
||||||
if maxdist > distance then
|
if maxdist > distance then
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user