mirror of
https://github.com/FlightControl-Master/MOOSE.git
synced 2025-10-29 16:58:06 +00:00
Merge remote-tracking branch 'refs/remotes/origin/master' into FlightControl
# Conflicts: # Moose Mission Setup/Moose Mission Update/l10n/DEFAULT/Moose.lua # Moose Mission Setup/Moose.lua # Moose Test Missions/SPA - Spawning/SPA-010 - Spawn Demo/SPA-010 - Spawn Demo.miz # Moose Test Missions/SPA - Spawning/SPA-011 - Ground Ops - Simple Spawning/SPA-011 - Ground Ops - Simple Spawning.miz # Moose Test Missions/SPA - Spawning/SPA-012 - Ground Ops - Multiple Spawns/SPA-012 - Ground Ops - Multiple Spawns.miz # Moose Test Missions/SPA - Spawning/SPA-013 - Ground Ops - Scheduled Spawns/SPA-013 - Ground Ops - Scheduled Spawns.miz # Moose Test Missions/SPA - Spawning/SPA-014 - Ground Ops - Scheduled Spawns Limited/SPA-014 - Ground Ops - Scheduled Spawns Limited.miz # Moose Test Missions/SPA - Spawning/SPA-015 - Ground Ops - Randomize Route/SPA-015 - Ground Ops - Randomize Route.miz # Moose Test Missions/SPA - Spawning/SPA-016 - Ground Ops - Randomize Zones/SPA-016 - Ground Ops - Randomize Zones.miz # Moose Test Missions/SPA - Spawning/SPA-017 - Ground Ops - Set AI inactive while spawning/SPA-017 - Ground Ops - Set AI inactive while spawning.miz # Moose Test Missions/SPA - Spawning/SPA-018 - Ground Ops - Randomize Templates/SPA-018 - Ground Ops - Randomize Templates.miz # Moose Test Missions/SPA - Spawning/SPA-100 - CleanUp Inactive Units/SPA-100 - CleanUp Inactive Units.miz # Moose Test Missions/SPA - Spawning/SPA-110 - Limit Spawning/SPA-110 - Limit Spawning.miz # Moose Test Missions/SPA - Spawning/SPA-121 - Air Ops - Scheduled Spawns with Repeat on Landing with Limit/SPA-121 - Air Ops - Scheduled Spawns with Repeat on Landing with Limit.miz # Moose Test Missions/SPA - Spawning/SPA-130 - Uncontrolled Spawning/SPA-130 - Uncontrolled Spawning.miz # Moose Test Missions/SPA - Spawning/SPA-200 - Randomize Unit Types/SPA-200 - Randomize Unit Types.miz # Moose Test Missions/SPA - Spawning/SPA-220 - Randomize Zones/SPA-220 - Randomize Zones.miz # Moose Test Missions/SPA - Spawning/SPA-310 - Spawn at Static position/SPA-310 - Spawn at Static position.miz # Moose Test Missions/SPA - Spawning/SPA-320 - Spawn at Unit position/SPA-320 - Spawn at Unit position.miz # Moose Test Missions/SPA - Spawning/SPA-330 - Spawn at Vec2 position/SPA-330 - Spawn at Vec2 position.miz # Moose Test Missions/SPA - Spawning/SPA-340 - Spawn at Vec3 position/SPA-340 - Spawn at Vec3 position.miz # Moose Test Missions/ZON - Zones/ZON-100 - Normal Zone/ZON-100 - Normal Zone.miz # docs/Documentation/Zone.html
This commit is contained in:
@@ -455,8 +455,7 @@ function GROUP:IsCompletelyInZone( Zone )
|
||||
|
||||
for UnitID, UnitData in pairs( self:GetUnits() ) do
|
||||
local Unit = UnitData -- Wrapper.Unit#UNIT
|
||||
-- TODO: Rename IsPointVec3InZone to IsVec3InZone
|
||||
if Zone:IsPointVec3InZone( Unit:GetVec3() ) then
|
||||
if Zone:IsVec3InZone( Unit:GetVec3() ) then
|
||||
else
|
||||
return false
|
||||
end
|
||||
@@ -474,7 +473,7 @@ function GROUP:IsPartlyInZone( Zone )
|
||||
|
||||
for UnitID, UnitData in pairs( self:GetUnits() ) do
|
||||
local Unit = UnitData -- Wrapper.Unit#UNIT
|
||||
if Zone:IsPointVec3InZone( Unit:GetVec3() ) then
|
||||
if Zone:IsVec3InZone( Unit:GetVec3() ) then
|
||||
return true
|
||||
end
|
||||
end
|
||||
@@ -491,7 +490,7 @@ function GROUP:IsNotInZone( Zone )
|
||||
|
||||
for UnitID, UnitData in pairs( self:GetUnits() ) do
|
||||
local Unit = UnitData -- Wrapper.Unit#UNIT
|
||||
if Zone:IsPointVec3InZone( Unit:GetVec3() ) then
|
||||
if Zone:IsVec3InZone( Unit:GetVec3() ) then
|
||||
return false
|
||||
end
|
||||
end
|
||||
|
||||
@@ -217,10 +217,7 @@ function IDENTIFIABLE:GetCallsign()
|
||||
end
|
||||
|
||||
|
||||
function IDENTIFIABLE:GetThreatLevel()
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
return 0, "Scenery"
|
||||
end
|
||||
|
||||
39
Moose Development/Moose/Wrapper/Scenery.lua
Normal file
39
Moose Development/Moose/Wrapper/Scenery.lua
Normal file
@@ -0,0 +1,39 @@
|
||||
--- This module contains the SCENERY class.
|
||||
--
|
||||
-- 1) @{Scenery#SCENERY} class, extends @{Positionable#POSITIONABLE}
|
||||
-- ===============================================================
|
||||
-- Scenery objects are defined on the map.
|
||||
-- The @{Scenery#SCENERY} class is a wrapper class to handle the DCS Scenery objects:
|
||||
--
|
||||
-- * Wraps the DCS Scenery objects.
|
||||
-- * Support all DCS Scenery APIs.
|
||||
-- * Enhance with Scenery specific APIs not in the DCS API set.
|
||||
--
|
||||
-- @module Scenery
|
||||
-- @author FlightControl
|
||||
|
||||
|
||||
|
||||
--- The SCENERY class
|
||||
-- @type SCENERY
|
||||
-- @extends Wrapper.Positionable#POSITIONABLE
|
||||
SCENERY = {
|
||||
ClassName = "SCENERY",
|
||||
}
|
||||
|
||||
|
||||
function SCENERY:Register( SceneryName, SceneryObject )
|
||||
local self = BASE:Inherit( self, POSITIONABLE:New( SceneryName ) )
|
||||
self.SceneryName = SceneryName
|
||||
self.SceneryObject = SceneryObject
|
||||
return self
|
||||
end
|
||||
|
||||
function SCENERY:GetDCSObject()
|
||||
return self.SceneryObject
|
||||
end
|
||||
|
||||
function SCENERY:GetThreatLevel()
|
||||
|
||||
return 0, "Scenery"
|
||||
end
|
||||
@@ -79,3 +79,8 @@ function STATIC:GetDCSObject()
|
||||
|
||||
return nil
|
||||
end
|
||||
|
||||
function STATIC:GetThreatLevel()
|
||||
|
||||
return 1, "Static"
|
||||
end
|
||||
@@ -536,45 +536,129 @@ end
|
||||
-- * Threat level 8: Unit is a Short Range SAM, radar guided.
|
||||
-- * Threat level 9: Unit is a Medium Range SAM, radar guided.
|
||||
-- * Threat level 10: Unit is a Long Range SAM, radar guided.
|
||||
-- @param #UNIT self
|
||||
function UNIT:GetThreatLevel()
|
||||
|
||||
local Attributes = self:GetDesc().attributes
|
||||
self:E( Attributes )
|
||||
|
||||
local ThreatLevel = 0
|
||||
local ThreatText = ""
|
||||
|
||||
if self:IsGround() then
|
||||
|
||||
local ThreatLevels = {
|
||||
"Unarmed",
|
||||
"Infantry",
|
||||
"Old Tanks & APCs",
|
||||
"Tanks & IFVs without ATGM",
|
||||
"Tanks & IFV with ATGM",
|
||||
"Modern Tanks",
|
||||
"AAA",
|
||||
"IR Guided SAMs",
|
||||
"SR SAMs",
|
||||
"MR SAMs",
|
||||
"LR SAMs"
|
||||
}
|
||||
self:E( "Ground" )
|
||||
|
||||
self:T2( Attributes )
|
||||
local ThreatLevels = {
|
||||
"Unarmed",
|
||||
"Infantry",
|
||||
"Old Tanks & APCs",
|
||||
"Tanks & IFVs without ATGM",
|
||||
"Tanks & IFV with ATGM",
|
||||
"Modern Tanks",
|
||||
"AAA",
|
||||
"IR Guided SAMs",
|
||||
"SR SAMs",
|
||||
"MR SAMs",
|
||||
"LR SAMs"
|
||||
}
|
||||
|
||||
|
||||
if Attributes["LR SAM"] then ThreatLevel = 10
|
||||
elseif Attributes["MR SAM"] then ThreatLevel = 9
|
||||
elseif Attributes["SR SAM"] and
|
||||
not Attributes["IR Guided SAM"] then ThreatLevel = 8
|
||||
elseif ( Attributes["SR SAM"] or Attributes["MANPADS"] ) and
|
||||
Attributes["IR Guided SAM"] then ThreatLevel = 7
|
||||
elseif Attributes["AAA"] then ThreatLevel = 6
|
||||
elseif Attributes["Modern Tanks"] then ThreatLevel = 5
|
||||
elseif ( Attributes["Tanks"] or Attributes["IFV"] ) and
|
||||
Attributes["ATGM"] then ThreatLevel = 4
|
||||
elseif ( Attributes["Tanks"] or Attributes["IFV"] ) and
|
||||
not Attributes["ATGM"] then ThreatLevel = 3
|
||||
elseif Attributes["Old Tanks"] or Attributes["APC"] or Attributes["Artillery"] then ThreatLevel = 2
|
||||
elseif Attributes["Infantry"] then ThreatLevel = 1
|
||||
end
|
||||
|
||||
ThreatText = ThreatLevels[ThreatLevel+1]
|
||||
end
|
||||
|
||||
if Attributes["LR SAM"] then ThreatLevel = 10
|
||||
elseif Attributes["MR SAM"] then ThreatLevel = 9
|
||||
elseif Attributes["SR SAM"] and
|
||||
not Attributes["IR Guided SAM"] then ThreatLevel = 8
|
||||
elseif ( Attributes["SR SAM"] or Attributes["MANPADS"] ) and
|
||||
Attributes["IR Guided SAM"] then ThreatLevel = 7
|
||||
elseif Attributes["AAA"] then ThreatLevel = 6
|
||||
elseif Attributes["Modern Tanks"] then ThreatLevel = 5
|
||||
elseif ( Attributes["Tanks"] or Attributes["IFV"] ) and
|
||||
Attributes["ATGM"] then ThreatLevel = 4
|
||||
elseif ( Attributes["Tanks"] or Attributes["IFV"] ) and
|
||||
not Attributes["ATGM"] then ThreatLevel = 3
|
||||
elseif Attributes["Old Tanks"] or Attributes["APC"] then ThreatLevel = 2
|
||||
elseif Attributes["Infantry"] then ThreatLevel = 1
|
||||
if self:IsAir() then
|
||||
|
||||
self:E( "Air" )
|
||||
|
||||
local ThreatLevels = {
|
||||
"Unarmed",
|
||||
"Tanker",
|
||||
"AWACS",
|
||||
"Transport Helicpter",
|
||||
"UAV",
|
||||
"Bomber",
|
||||
"Strategic Bomber",
|
||||
"Attack Helicopter",
|
||||
"Interceptor",
|
||||
"Multirole Fighter",
|
||||
"Fighter"
|
||||
}
|
||||
|
||||
|
||||
if Attributes["Fighters"] then ThreatLevel = 10
|
||||
elseif Attributes["Multirole fighters"] then ThreatLevel = 9
|
||||
elseif Attributes["Battleplanes"] then ThreatLevel = 8
|
||||
elseif Attributes["Attack helicopters"] then ThreatLevel = 7
|
||||
elseif Attributes["Strategic bombers"] then ThreatLevel = 6
|
||||
elseif Attributes["Bombers"] then ThreatLevel = 5
|
||||
elseif Attributes["UAVs"] then ThreatLevel = 4
|
||||
elseif Attributes["Transport helicopters"] then ThreatLevel = 3
|
||||
elseif Attributes["AWACS"] then ThreatLevel = 2
|
||||
elseif Attributes["Tankers"] then ThreatLevel = 1
|
||||
end
|
||||
|
||||
ThreatText = ThreatLevels[ThreatLevel+1]
|
||||
end
|
||||
|
||||
if self:IsShip() then
|
||||
|
||||
self:E( "Ship" )
|
||||
|
||||
--["Aircraft Carriers"] = {"Heavy armed ships",},
|
||||
--["Cruisers"] = {"Heavy armed ships",},
|
||||
--["Destroyers"] = {"Heavy armed ships",},
|
||||
--["Frigates"] = {"Heavy armed ships",},
|
||||
--["Corvettes"] = {"Heavy armed ships",},
|
||||
--["Heavy armed ships"] = {"Armed ships", "Armed Air Defence", "HeavyArmoredUnits",},
|
||||
--["Light armed ships"] = {"Armed ships","NonArmoredUnits"},
|
||||
--["Armed ships"] = {"Ships"},
|
||||
--["Unarmed ships"] = {"Ships","HeavyArmoredUnits",},
|
||||
|
||||
local ThreatLevels = {
|
||||
"Unarmed ship",
|
||||
"Light armed ships",
|
||||
"Corvettes",
|
||||
"",
|
||||
"Frigates",
|
||||
"",
|
||||
"Cruiser",
|
||||
"",
|
||||
"Destroyer",
|
||||
"",
|
||||
"Aircraft Carrier"
|
||||
}
|
||||
|
||||
|
||||
if Attributes["Aircraft Carriers"] then ThreatLevel = 10
|
||||
elseif Attributes["Destroyers"] then ThreatLevel = 8
|
||||
elseif Attributes["Cruisers"] then ThreatLevel = 6
|
||||
elseif Attributes["Frigates"] then ThreatLevel = 4
|
||||
elseif Attributes["Corvettes"] then ThreatLevel = 2
|
||||
elseif Attributes["Light armed ships"] then ThreatLevel = 1
|
||||
end
|
||||
|
||||
ThreatText = ThreatLevels[ThreatLevel+1]
|
||||
end
|
||||
|
||||
self:T2( ThreatLevel )
|
||||
return ThreatLevel, ThreatLevels[ThreatLevel+1]
|
||||
return ThreatLevel, ThreatText
|
||||
|
||||
end
|
||||
|
||||
@@ -589,7 +673,7 @@ function UNIT:IsInZone( Zone )
|
||||
self:F2( { self.UnitName, Zone } )
|
||||
|
||||
if self:IsAlive() then
|
||||
local IsInZone = Zone:IsPointVec3InZone( self:GetVec3() )
|
||||
local IsInZone = Zone:IsVec3InZone( self:GetVec3() )
|
||||
|
||||
self:T( { IsInZone } )
|
||||
return IsInZone
|
||||
@@ -606,7 +690,7 @@ function UNIT:IsNotInZone( Zone )
|
||||
self:F2( { self.UnitName, Zone } )
|
||||
|
||||
if self:IsAlive() then
|
||||
local IsInZone = not Zone:IsPointVec3InZone( self:GetVec3() )
|
||||
local IsInZone = not Zone:IsVec3InZone( self:GetVec3() )
|
||||
|
||||
self:T( { IsInZone } )
|
||||
return IsInZone
|
||||
|
||||
Reference in New Issue
Block a user