Fixed Offset issue.

This commit is contained in:
FlightControl-User 2018-06-24 08:49:36 +02:00
parent 07aff74126
commit 6b04237a3f

View File

@ -1040,10 +1040,10 @@ ZONE_UNIT = {
-- theta The azimuth of the zone relative to unit
-- relative_to_unit If true, theta is measured clockwise from unit's direction else clockwise from north. If using dx, dy setting this to true makes +x parallel to unit heading.
-- dx, dy OR rho, theta may be used, not both.
-- @return #ZONE_UNIT self
function ZONE_UNIT:New( ZoneName, ZoneUNIT, Radius, Offset)
if Offset then
-- check if the inputs was reasonable, either (dx, dy) or (rho, theta) can be given, else raise an exception.
if (Offset.dx or Offset.dy) and (Offset.rho or Offset.theta) then
error("Cannot use (dx, dy) with (rho, theta)")
@ -1054,6 +1054,7 @@ function ZONE_UNIT:New( ZoneName, ZoneUNIT, Radius, Offset)
self.rho = Offset.rho or 0.0
self.theta = (Offset.theta or 0.0) * math.pi / 180.0
self.relative_to_unit = Offset.relative_to_unit or false
end
local self = BASE:Inherit( self, ZONE_RADIUS:New( ZoneName, ZoneUNIT:GetVec2(), Radius ) )