mirror of
https://github.com/FlightControl-Master/MOOSE.git
synced 2026-08-18 13:16:03 +00:00
Airboss
Take animation for determining the wire
This commit is contained in:
@@ -228,3 +228,4 @@ MooseCodeWS.code-workspace
|
|||||||
.gitignore
|
.gitignore
|
||||||
.gitignore
|
.gitignore
|
||||||
/.gitignore
|
/.gitignore
|
||||||
|
Moose Development/Moose/.vscode/settings.json
|
||||||
|
|||||||
+9
-3
@@ -1,7 +1,8 @@
|
|||||||
{
|
{
|
||||||
"Lua.workspace.preloadFileSize": 1000,
|
"Lua.workspace.preloadFileSize": 1000,
|
||||||
"Lua.diagnostics.disable": [
|
"Lua.diagnostics.disable": [
|
||||||
"undefined-doc-name"
|
"undefined-doc-name",
|
||||||
|
"need-check-nil"
|
||||||
],
|
],
|
||||||
"Lua.diagnostics.globals": [
|
"Lua.diagnostics.globals": [
|
||||||
"BASE",
|
"BASE",
|
||||||
@@ -9,9 +10,14 @@
|
|||||||
"__Moose",
|
"__Moose",
|
||||||
"trigger",
|
"trigger",
|
||||||
"coord",
|
"coord",
|
||||||
"missionCommands"
|
"missionCommands",
|
||||||
|
"world"
|
||||||
],
|
],
|
||||||
"Lua.completion.displayContext": 5,
|
"Lua.completion.displayContext": 5,
|
||||||
"Lua.runtime.version": "Lua 5.1",
|
"Lua.runtime.version": "Lua 5.1",
|
||||||
"Lua.completion.callSnippet": "Both"
|
"Lua.completion.callSnippet": "Both",
|
||||||
|
"Lua.workspace.library": [
|
||||||
|
"${3rd}/lfs/library"
|
||||||
|
],
|
||||||
|
"Lua.workspace.checkThirdParty": false
|
||||||
}
|
}
|
||||||
@@ -1809,7 +1809,7 @@ AIRBOSS.version = "1.2.1"
|
|||||||
function AIRBOSS:New( carriername, alias )
|
function AIRBOSS:New( carriername, alias )
|
||||||
|
|
||||||
-- Inherit everthing from FSM class.
|
-- Inherit everthing from FSM class.
|
||||||
local self = BASE:Inherit( self, FSM:New() ) -- #AIRBOSS
|
self = BASE:Inherit( self, FSM:New() ) -- #AIRBOSS
|
||||||
|
|
||||||
-- Debug.
|
-- Debug.
|
||||||
self:F2( { carriername = carriername, alias = alias } )
|
self:F2( { carriername = carriername, alias = alias } )
|
||||||
@@ -8222,7 +8222,7 @@ function AIRBOSS:OnEventLand( EventData )
|
|||||||
local dist = coord:Get2DDistance( self:GetCoordinate() )
|
local dist = coord:Get2DDistance( self:GetCoordinate() )
|
||||||
|
|
||||||
-- Get wire
|
-- Get wire
|
||||||
local wire = self:_GetWire( coord, 0 )
|
local wire = self:_GetWirePos( coord, 0 )
|
||||||
|
|
||||||
-- Aircraft type.
|
-- Aircraft type.
|
||||||
local _type = EventData.IniUnit:GetTypeName()
|
local _type = EventData.IniUnit:GetTypeName()
|
||||||
@@ -10058,12 +10058,34 @@ function AIRBOSS:_GetSternCoord()
|
|||||||
return self.sterncoord
|
return self.sterncoord
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--- Get wire from
|
||||||
|
-- @param #AIRBOSS self
|
||||||
|
-- @param Core.Point#COORDINATE Lcoord Landing position.
|
||||||
|
-- @return #number Trapped wire (1-4) or 99 if no wire was trapped.
|
||||||
|
function AIRBOSS:_GetWire()
|
||||||
|
|
||||||
|
local wireArgs={}
|
||||||
|
wireArgs[1]=141
|
||||||
|
wireArgs[2]=142
|
||||||
|
wireArgs[3]=143
|
||||||
|
wireArgs[4]=144
|
||||||
|
|
||||||
|
for wire,drawArg in pairs(wireArgs) do
|
||||||
|
local value=self.carrier:GetDrawArgumentValue(drawArg)
|
||||||
|
if math.abs(value)>0.001 then
|
||||||
|
return wire
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
return 99
|
||||||
|
end
|
||||||
|
|
||||||
--- Get wire from landing position.
|
--- Get wire from landing position.
|
||||||
-- @param #AIRBOSS self
|
-- @param #AIRBOSS self
|
||||||
-- @param Core.Point#COORDINATE Lcoord Landing position.
|
-- @param Core.Point#COORDINATE Lcoord Landing position.
|
||||||
-- @param #number dc Distance correction. Shift the landing coord back if dc>0 and forward if dc<0.
|
-- @param #number dc Distance correction. Shift the landing coord back if dc>0 and forward if dc<0.
|
||||||
-- @return #number Trapped wire (1-4) or 99 if no wire was trapped.
|
-- @return #number Trapped wire (1-4) or 99 if no wire was trapped.
|
||||||
function AIRBOSS:_GetWire( Lcoord, dc )
|
function AIRBOSS:_GetWirePos( Lcoord, dc )
|
||||||
|
|
||||||
-- Final bearing (true).
|
-- Final bearing (true).
|
||||||
local FB = self:GetFinalBearing()
|
local FB = self:GetFinalBearing()
|
||||||
@@ -10181,7 +10203,7 @@ function AIRBOSS:_Trapped( playerData )
|
|||||||
end
|
end
|
||||||
|
|
||||||
-- Get wire.
|
-- Get wire.
|
||||||
local wire = self:_GetWire( coord, dcorr )
|
local wire = self:_GetWirePos( coord, dcorr )
|
||||||
|
|
||||||
-- Debug.
|
-- Debug.
|
||||||
local text = string.format( "Player %s _Trapped: v=%.1f km/h, s-dcorr=%.1f m ==> wire=%d (dcorr=%d)", playerData.name, v, s - dcorr, wire, dcorr )
|
local text = string.format( "Player %s _Trapped: v=%.1f km/h, s-dcorr=%.1f m ==> wire=%d (dcorr=%d)", playerData.name, v, s - dcorr, wire, dcorr )
|
||||||
|
|||||||
@@ -963,6 +963,24 @@ function UNIT:GetDamageRelative()
|
|||||||
return 1
|
return 1
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--- Returns the current value for an animation argument on the external model of the given object.
|
||||||
|
-- Each model animation has an id tied to with different values representing different states of the model.
|
||||||
|
-- Animation arguments can be figured out by opening the respective 3d model in the modelviewer.
|
||||||
|
-- @param #UNIT self
|
||||||
|
-- @param #number AnimationArgument Number corresponding to the animated part of the unit.
|
||||||
|
-- @return #number Value of the animation argument [-1, 1]. If draw argument value is invalid for the unit in question a value of 0 will be returned.
|
||||||
|
function UNIT:GetDrawArgumentValue(AnimationArgument)
|
||||||
|
|
||||||
|
local DCSUnit = self:GetDCSObject()
|
||||||
|
|
||||||
|
if DCSUnit then
|
||||||
|
local value = DCSUnit:getDrawArgumentValue(AnimationArgument or 0)
|
||||||
|
return value
|
||||||
|
end
|
||||||
|
|
||||||
|
return 0
|
||||||
|
end
|
||||||
|
|
||||||
--- Returns the category of the #UNIT from descriptor. Returns one of
|
--- Returns the category of the #UNIT from descriptor. Returns one of
|
||||||
--
|
--
|
||||||
-- * Unit.Category.AIRPLANE
|
-- * Unit.Category.AIRPLANE
|
||||||
|
|||||||
Reference in New Issue
Block a user