mirror of
https://github.com/FlightControl-Master/MOOSE.git
synced 2025-10-29 16:58:06 +00:00
Added CONTROLLABLE SetSpeed() and SetAltitude()
This commit is contained in:
parent
57de0b7351
commit
3aee8a49c1
@ -3770,3 +3770,44 @@ function POSITIONABLE:IsSubmarine()
|
|||||||
|
|
||||||
return nil
|
return nil
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--- Sets the controlled group to go the specified speed in meters per second.
|
||||||
|
-- @param #CONTROLLABLE self
|
||||||
|
-- @param #number Speed Speed in meters per second
|
||||||
|
-- @param #boolean Keep (Optional) When set to true will maintain that speed on passing waypoints. If no present or false the controlled group will return to the speed as defined by their route.
|
||||||
|
-- @return #CONTROLLABLE self
|
||||||
|
function CONTROLLABLE:SetSpeed(Speed, Keep)
|
||||||
|
self:F2( { self.ControllableName } )
|
||||||
|
-- Set default if not specified.
|
||||||
|
local speed = Speed or 5
|
||||||
|
local DCSControllable = self:GetDCSObject()
|
||||||
|
if DCSControllable then
|
||||||
|
local Controller = self:_GetController()
|
||||||
|
if Controller then
|
||||||
|
Controller:setSpeed(speed, Keep)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
return self
|
||||||
|
end
|
||||||
|
|
||||||
|
--- [AIR] Sets the controlled aircraft group to the specified altitude in meters.
|
||||||
|
-- @param #CONTROLLABLE self
|
||||||
|
-- @param #number Altitude Altitude in meters
|
||||||
|
-- @param #boolean Keep (Optional) When set to true will maintain that altitude on passing waypoints. If no present or false the controlled group will return to the altitude as defined by their route.
|
||||||
|
-- @param #string AltType (Optional) Will specify the altitude type used. If nil the altitude type of the current waypoint will be used. Accepted values are "BARO" and "RADIO".
|
||||||
|
-- @return #CONTROLLABLE self
|
||||||
|
function CONTROLLABLE:SetAltitude(Altitude, Keep, AltType)
|
||||||
|
self:F2( { self.ControllableName } )
|
||||||
|
-- Set default if not specified.
|
||||||
|
local altitude = Altitude or 1000
|
||||||
|
local DCSControllable = self:GetDCSObject()
|
||||||
|
if DCSControllable then
|
||||||
|
local Controller = self:_GetController()
|
||||||
|
if Controller then
|
||||||
|
if self:IsAir() then
|
||||||
|
Controller:setAltitude(altitude, Keep, AltType)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
return self
|
||||||
|
end
|
||||||
Loading…
x
Reference in New Issue
Block a user