mirror of
https://github.com/FlightControl-Master/MOOSE.git
synced 2025-08-15 10:47:21 +00:00
Compare commits
8 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5260b2b430 | ||
|
|
0213bc7aef | ||
|
|
ca8b0899d0 | ||
|
|
a1f5c0ab9b | ||
|
|
b0e3f82d27 | ||
|
|
327ab4766b | ||
|
|
3aee8a49c1 | ||
|
|
57de0b7351 |
@@ -912,7 +912,7 @@ do -- COORDINATE
|
|||||||
-- The text will reflect the temperature like this:
|
-- The text will reflect the temperature like this:
|
||||||
--
|
--
|
||||||
-- - For Russian and European aircraft using the metric system - Degrees Celcius (°C)
|
-- - For Russian and European aircraft using the metric system - Degrees Celcius (°C)
|
||||||
-- - For American aircraft we link to the imperial system - Degrees Farenheit (°F)
|
-- - For American aircraft we link to the imperial system - Degrees Fahrenheit (°F)
|
||||||
--
|
--
|
||||||
-- A text containing a pressure will look like this:
|
-- A text containing a pressure will look like this:
|
||||||
--
|
--
|
||||||
@@ -932,7 +932,7 @@ do -- COORDINATE
|
|||||||
if Settings:IsMetric() then
|
if Settings:IsMetric() then
|
||||||
return string.format( " %-2.2f °C", DegreesCelcius )
|
return string.format( " %-2.2f °C", DegreesCelcius )
|
||||||
else
|
else
|
||||||
return string.format( " %-2.2f °F", UTILS.CelciusToFarenheit( DegreesCelcius ) )
|
return string.format( " %-2.2f °F", UTILS.CelsiusToFahrenheit( DegreesCelcius ) )
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
return " no temperature"
|
return " no temperature"
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -2755,7 +2755,7 @@ function RANGE:_DisplayRangeWeather( _unitname )
|
|||||||
local tW = string.format( "%.1f m/s", Ws )
|
local tW = string.format( "%.1f m/s", Ws )
|
||||||
local tP = string.format( "%.1f mmHg", P * hPa2mmHg )
|
local tP = string.format( "%.1f mmHg", P * hPa2mmHg )
|
||||||
if settings:IsImperial() then
|
if settings:IsImperial() then
|
||||||
-- tT=string.format("%d°F", UTILS.CelciusToFarenheit(T))
|
-- tT=string.format("%d°F", UTILS.CelsiusToFahrenheit(T))
|
||||||
tW = string.format( "%.1f knots", UTILS.MpsToKnots( Ws ) )
|
tW = string.format( "%.1f knots", UTILS.MpsToKnots( Ws ) )
|
||||||
tP = string.format( "%.2f inHg", P * hPa2inHg )
|
tP = string.format( "%.2f inHg", P * hPa2inHg )
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -255,10 +255,11 @@ CSAR.AircraftType["Mi-24P"] = 8
|
|||||||
CSAR.AircraftType["Mi-24V"] = 8
|
CSAR.AircraftType["Mi-24V"] = 8
|
||||||
CSAR.AircraftType["Bell-47"] = 2
|
CSAR.AircraftType["Bell-47"] = 2
|
||||||
CSAR.AircraftType["UH-60L"] = 10
|
CSAR.AircraftType["UH-60L"] = 10
|
||||||
|
CSAR.AircraftType["AH-64D_BLK_II"] = 2
|
||||||
|
|
||||||
--- CSAR class version.
|
--- CSAR class version.
|
||||||
-- @field #string version
|
-- @field #string version
|
||||||
CSAR.version="1.0.4c"
|
CSAR.version="1.0.4d"
|
||||||
|
|
||||||
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||||
-- ToDo list
|
-- ToDo list
|
||||||
|
|||||||
@@ -1017,6 +1017,7 @@ CTLD.UnitTypes = {
|
|||||||
["Hercules"] = {type="Hercules", crates=true, troops=true, cratelimit = 7, trooplimit = 64, length = 25, cargoweightlimit = 19000}, -- 19t cargo, 64 paratroopers.
|
["Hercules"] = {type="Hercules", crates=true, troops=true, cratelimit = 7, trooplimit = 64, length = 25, cargoweightlimit = 19000}, -- 19t cargo, 64 paratroopers.
|
||||||
--Actually it's longer, but the center coord is off-center of the model.
|
--Actually it's longer, but the center coord is off-center of the model.
|
||||||
["UH-60L"] = {type="UH-60L", crates=true, troops=true, cratelimit = 2, trooplimit = 20, length = 16, cargoweightlimit = 3500}, -- 4t cargo, 20 (unsec) seats
|
["UH-60L"] = {type="UH-60L", crates=true, troops=true, cratelimit = 2, trooplimit = 20, length = 16, cargoweightlimit = 3500}, -- 4t cargo, 20 (unsec) seats
|
||||||
|
["AH-64D_BLK_II"] = {type="AH-64D_BLK_II", crates=false, troops=true, cratelimit = 0, trooplimit = 2, length = 17, cargoweightlimit = 200}, -- 2 ppl **outside** the helo
|
||||||
}
|
}
|
||||||
|
|
||||||
--- CTLD class version.
|
--- CTLD class version.
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -384,61 +384,81 @@ AIRBASE.TheChannel = {
|
|||||||
-- * AIRBASE.Syria.Beirut_Rafic_Hariri
|
-- * AIRBASE.Syria.Beirut_Rafic_Hariri
|
||||||
-- * AIRBASE.Syria.An_Nasiriyah
|
-- * AIRBASE.Syria.An_Nasiriyah
|
||||||
-- * AIRBASE.Syria.Abu_al_Duhur
|
-- * AIRBASE.Syria.Abu_al_Duhur
|
||||||
|
-- * AIRBASE.Syria.At_Tanf
|
||||||
|
-- * AIRBASE.Syria.H3
|
||||||
|
-- * AIRBASE.Syria.H3_Northwest
|
||||||
|
-- * AIRBASE.Syria.H3_Southwest
|
||||||
|
-- * AIRBASE.Syria.Kharab_Ishk
|
||||||
|
-- * AIRBASE.Syria.Raj_al_Issa_East
|
||||||
|
-- * AIRBASE.Syria.Raj_al_Issa_West
|
||||||
|
-- * AIRBASE.Syria.Ruwayshid
|
||||||
|
-- * AIRBASE.Syria.Sanliurfa
|
||||||
|
-- * AIRBASE.Syria.Tal_Siman
|
||||||
--
|
--
|
||||||
-- @field Syria
|
--@field Syria
|
||||||
AIRBASE.Syria = {
|
AIRBASE.Syria={
|
||||||
["Kuweires"] = "Kuweires",
|
["Kuweires"]="Kuweires",
|
||||||
["Marj_Ruhayyil"] = "Marj Ruhayyil",
|
["Marj_Ruhayyil"]="Marj Ruhayyil",
|
||||||
["Kiryat_Shmona"] = "Kiryat Shmona",
|
["Kiryat_Shmona"]="Kiryat Shmona",
|
||||||
["Marj_as_Sultan_North"] = "Marj as Sultan North",
|
["Marj_as_Sultan_North"]="Marj as Sultan North",
|
||||||
["Eyn_Shemer"] = "Eyn Shemer",
|
["Eyn_Shemer"]="Eyn Shemer",
|
||||||
["Incirlik"] = "Incirlik",
|
["Incirlik"]="Incirlik",
|
||||||
["Damascus"] = "Damascus",
|
["Damascus"]="Damascus",
|
||||||
["Bassel_Al_Assad"] = "Bassel Al-Assad",
|
["Bassel_Al_Assad"]="Bassel Al-Assad",
|
||||||
["Rosh_Pina"] = "Rosh Pina",
|
["Rosh_Pina"]="Rosh Pina",
|
||||||
["Aleppo"] = "Aleppo",
|
["Aleppo"]="Aleppo",
|
||||||
["Al_Qusayr"] = "Al Qusayr",
|
["Al_Qusayr"]="Al Qusayr",
|
||||||
["Wujah_Al_Hajar"] = "Wujah Al Hajar",
|
["Wujah_Al_Hajar"]="Wujah Al Hajar",
|
||||||
["Al_Dumayr"] = "Al-Dumayr",
|
["Al_Dumayr"]="Al-Dumayr",
|
||||||
["Gazipasa"] = "Gazipasa",
|
["Gazipasa"]="Gazipasa",
|
||||||
["Ru_Convoy_4"] = "Ru Convoy-4",
|
["Ru_Convoy_4"]="Ru Convoy-4",
|
||||||
["Hatay"] = "Hatay",
|
["Hatay"]="Hatay",
|
||||||
["Nicosia"] = "Nicosia",
|
["Nicosia"]="Nicosia",
|
||||||
["Pinarbashi"] = "Pinarbashi",
|
["Pinarbashi"]="Pinarbashi",
|
||||||
["Paphos"] = "Paphos",
|
["Paphos"]="Paphos",
|
||||||
["Kingsfield"] = "Kingsfield",
|
["Kingsfield"]="Kingsfield",
|
||||||
["Thalah"] = "Tha'lah",
|
["Thalah"]="Tha'lah",
|
||||||
["Haifa"] = "Haifa",
|
["Haifa"]="Haifa",
|
||||||
["Khalkhalah"] = "Khalkhalah",
|
["Khalkhalah"]="Khalkhalah",
|
||||||
["Megiddo"] = "Megiddo",
|
["Megiddo"]="Megiddo",
|
||||||
["Lakatamia"] = "Lakatamia",
|
["Lakatamia"]="Lakatamia",
|
||||||
["Rayak"] = "Rayak",
|
["Rayak"]="Rayak",
|
||||||
["Larnaca"] = "Larnaca",
|
["Larnaca"]="Larnaca",
|
||||||
["Mezzeh"] = "Mezzeh",
|
["Mezzeh"]="Mezzeh",
|
||||||
["Gecitkale"] = "Gecitkale",
|
["Gecitkale"]="Gecitkale",
|
||||||
["Akrotiri"] = "Akrotiri",
|
["Akrotiri"]="Akrotiri",
|
||||||
["Naqoura"] = "Naqoura",
|
["Naqoura"]="Naqoura",
|
||||||
["Gaziantep"] = "Gaziantep",
|
["Gaziantep"]="Gaziantep",
|
||||||
["Sayqal"] = "Sayqal",
|
["Sayqal"]="Sayqal",
|
||||||
["Tiyas"] = "Tiyas",
|
["Tiyas"]="Tiyas",
|
||||||
["Shayrat"] = "Shayrat",
|
["Shayrat"]="Shayrat",
|
||||||
["Taftanaz"] = "Taftanaz",
|
["Taftanaz"]="Taftanaz",
|
||||||
["H4"] = "H4",
|
["H4"]="H4",
|
||||||
["King_Hussein_Air_College"] = "King Hussein Air College",
|
["King_Hussein_Air_College"]="King Hussein Air College",
|
||||||
["Rene_Mouawad"] = "Rene Mouawad",
|
["Rene_Mouawad"]="Rene Mouawad",
|
||||||
["Jirah"] = "Jirah",
|
["Jirah"]="Jirah",
|
||||||
["Ramat_David"] = "Ramat David",
|
["Ramat_David"]="Ramat David",
|
||||||
["Qabr_as_Sitt"] = "Qabr as Sitt",
|
["Qabr_as_Sitt"]="Qabr as Sitt",
|
||||||
["Minakh"] = "Minakh",
|
["Minakh"]="Minakh",
|
||||||
["Adana_Sakirpasa"] = "Adana Sakirpasa",
|
["Adana_Sakirpasa"]="Adana Sakirpasa",
|
||||||
["Palmyra"] = "Palmyra",
|
["Palmyra"]="Palmyra",
|
||||||
["Hama"] = "Hama",
|
["Hama"]="Hama",
|
||||||
["Ercan"] = "Ercan",
|
["Ercan"]="Ercan",
|
||||||
["Marj_as_Sultan_South"] = "Marj as Sultan South",
|
["Marj_as_Sultan_South"]="Marj as Sultan South",
|
||||||
["Tabqa"] = "Tabqa",
|
["Tabqa"]="Tabqa",
|
||||||
["Beirut_Rafic_Hariri"] = "Beirut-Rafic Hariri",
|
["Beirut_Rafic_Hariri"]="Beirut-Rafic Hariri",
|
||||||
["An_Nasiriyah"] = "An Nasiriyah",
|
["An_Nasiriyah"]="An Nasiriyah",
|
||||||
["Abu_al_Duhur"] = "Abu al-Duhur",
|
["Abu_al_Duhur"]="Abu al-Duhur",
|
||||||
|
["At_Tanf"]="At Tanf",
|
||||||
|
["H3"]="H3",
|
||||||
|
["H3_Northwest"]="H3 Northwest",
|
||||||
|
["H3_Southwest"]="H3 Southwest",
|
||||||
|
["Kharab_Ishk"]="Kharab Ishk",
|
||||||
|
["Raj_al_Issa_East"]="Raj al Issa East",
|
||||||
|
["Raj_al_Issa_West"]="Raj al Issa West",
|
||||||
|
["Ruwayshid"]="Ruwayshid",
|
||||||
|
["Sanliurfa"]="Sanliurfa",
|
||||||
|
["Tal_Siman"]="Tal Siman",
|
||||||
}
|
}
|
||||||
|
|
||||||
--- Airbases of the Mariana Islands map:
|
--- Airbases of the Mariana Islands map:
|
||||||
|
|||||||
@@ -3770,3 +3770,44 @@ function POSITIONABLE:IsSubmarine()
|
|||||||
|
|
||||||
return nil
|
return nil
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--- Sets the controlled group to go at 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 the speed on passing waypoints. If not 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 fly at the specified altitude in meters.
|
||||||
|
-- @param #CONTROLLABLE self
|
||||||
|
-- @param #number Altitude Altitude in meters.
|
||||||
|
-- @param #boolean Keep (Optional) When set to true, will maintain the altitude on passing waypoints. If not present or false, the controlled group will return to the altitude as defined by their route.
|
||||||
|
-- @param #string AltType (Optional) Specifies 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
|
||||||
@@ -1,46 +1,52 @@
|
|||||||
--- **Wrapper** -- STATIC wraps the DCS StaticObject class.
|
--- **Wrapper** -- STATIC wraps the DCS StaticObject class.
|
||||||
--
|
--
|
||||||
-- ===
|
-- ===
|
||||||
--
|
--
|
||||||
-- ### Author: **FlightControl**
|
-- ### Author: **FlightControl**
|
||||||
--
|
--
|
||||||
-- ### Contributions: **funkyfranky**
|
-- ### Contributions: **funkyfranky**
|
||||||
--
|
--
|
||||||
-- ===
|
-- ===
|
||||||
--
|
--
|
||||||
-- @module Wrapper.Static
|
-- @module Wrapper.Static
|
||||||
-- @image Wrapper_Static.JPG
|
-- @image Wrapper_Static.JPG
|
||||||
|
|
||||||
|
|
||||||
--- @type STATIC
|
--- @type STATIC
|
||||||
-- @extends Wrapper.Positionable#POSITIONABLE
|
-- @extends Wrapper.Positionable#POSITIONABLE
|
||||||
|
|
||||||
--- Wrapper class to handle Static objects.
|
--- Wrapper class to handle Static objects.
|
||||||
--
|
--
|
||||||
-- Note that Statics are almost the same as Units, but they don't have a controller.
|
-- Note that Statics are almost the same as Units, but they don't have a controller.
|
||||||
-- The @{Wrapper.Static#STATIC} class is a wrapper class to handle the DCS Static objects:
|
-- The @{Wrapper.Static#STATIC} class is a wrapper class to handle the DCS Static objects:
|
||||||
--
|
--
|
||||||
-- * Wraps the DCS Static objects.
|
-- * Wraps the DCS Static objects.
|
||||||
-- * Support all DCS Static APIs.
|
-- * Support all DCS Static APIs.
|
||||||
-- * Enhance with Static specific APIs not in the DCS API set.
|
-- * Enhance with Static specific APIs not in the DCS API set.
|
||||||
--
|
--
|
||||||
-- ## STATIC reference methods
|
-- ## STATIC reference methods
|
||||||
--
|
--
|
||||||
-- For each DCS Static will have a STATIC wrapper object (instance) within the _@{DATABASE} object.
|
-- For each DCS Static will have a STATIC wrapper object (instance) within the _@{DATABASE} object.
|
||||||
-- This is done at the beginning of the mission (when the mission starts).
|
-- This is done at the beginning of the mission (when the mission starts).
|
||||||
--
|
--
|
||||||
-- The STATIC class does not contain a :New() method, rather it provides :Find() methods to retrieve the object reference
|
-- The STATIC class does not contain a :New() method, rather it provides :Find() methods to retrieve the object reference
|
||||||
-- using the Static Name.
|
-- using the Static Name.
|
||||||
--
|
--
|
||||||
-- Another thing to know is that STATIC objects do not "contain" the DCS Static object.
|
-- Another thing to know is that STATIC objects do not "contain" the DCS Static object.
|
||||||
-- The STATIc methods will reference the DCS Static object by name when it is needed during API execution.
|
-- The STATIc methods will reference the DCS Static object by name when it is needed during API execution.
|
||||||
-- If the DCS Static object does not exist or is nil, the STATIC methods will return nil and log an exception in the DCS.log file.
|
-- If the DCS Static object does not exist or is nil, the STATIC methods will return nil and log an exception in the DCS.log file.
|
||||||
--
|
--
|
||||||
-- The STATIc class provides the following functions to retrieve quickly the relevant STATIC instance:
|
-- The STATIc class provides the following functions to retrieve quickly the relevant STATIC instance:
|
||||||
--
|
--
|
||||||
-- * @{#STATIC.FindByName}(): Find a STATIC instance from the _DATABASE object using a DCS Static name.
|
-- * @{#STATIC.FindByName}(): Find a STATIC instance from the _DATABASE object using a DCS Static name.
|
||||||
--
|
--
|
||||||
-- IMPORTANT: ONE SHOULD NEVER SANITIZE these STATIC OBJECT REFERENCES! (make the STATIC object references nil).
|
-- IMPORTANT: ONE SHOULD NEVER SANATIZE these STATIC OBJECT REFERENCES! (make the STATIC object references nil).
|
||||||
--
|
--
|
||||||
-- @field #STATIC
|
-- @field #STATIC
|
||||||
STATIC = { ClassName = "STATIC" }
|
STATIC = {
|
||||||
|
ClassName = "STATIC",
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
--- Register a static object.
|
--- Register a static object.
|
||||||
-- @param #STATIC self
|
-- @param #STATIC self
|
||||||
@@ -52,6 +58,7 @@ function STATIC:Register( StaticName )
|
|||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
--- Finds a STATIC from the _DATABASE using a DCSStatic object.
|
--- Finds a STATIC from the _DATABASE using a DCSStatic object.
|
||||||
-- @param #STATIC self
|
-- @param #STATIC self
|
||||||
-- @param DCS#StaticObject DCSStatic An existing DCS Static object reference.
|
-- @param DCS#StaticObject DCSStatic An existing DCS Static object reference.
|
||||||
@@ -76,13 +83,13 @@ function STATIC:FindByName( StaticName, RaiseError )
|
|||||||
|
|
||||||
-- Set static name.
|
-- Set static name.
|
||||||
self.StaticName = StaticName
|
self.StaticName = StaticName
|
||||||
|
|
||||||
if StaticFound then
|
if StaticFound then
|
||||||
return StaticFound
|
return StaticFound
|
||||||
end
|
end
|
||||||
|
|
||||||
if RaiseError == nil or RaiseError == true then
|
if RaiseError == nil or RaiseError == true then
|
||||||
error( "STATIC not found for: " .. StaticName )
|
error( "STATIC not found for: " .. StaticName )
|
||||||
end
|
end
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
@@ -90,39 +97,38 @@ end
|
|||||||
|
|
||||||
--- Destroys the STATIC.
|
--- Destroys the STATIC.
|
||||||
-- @param #STATIC self
|
-- @param #STATIC self
|
||||||
-- @param #boolean GenerateEvent (Optional) true to generate a crash or dead event, false to not generate any event. `nil` (default) creates a remove event.
|
-- @param #boolean GenerateEvent (Optional) true if you want to generate a crash or dead event for the static.
|
||||||
-- @return #nil The DCS StaticObject is not existing or alive.
|
-- @return #nil The DCS StaticObject is not existing or alive.
|
||||||
--
|
|
||||||
-- @usage
|
-- @usage
|
||||||
-- -- Air static example: destroy the static Helicopter and generate a S_EVENT_CRASH.
|
-- -- Air static example: destroy the static Helicopter and generate a S_EVENT_CRASH.
|
||||||
-- Helicopter = STATIC:FindByName( "Helicopter" )
|
-- Helicopter = STATIC:FindByName( "Helicopter" )
|
||||||
-- Helicopter:Destroy( true )
|
-- Helicopter:Destroy( true )
|
||||||
--
|
--
|
||||||
-- @usage
|
-- @usage
|
||||||
-- -- Ground static example: destroy the static Tank and generate a S_EVENT_DEAD.
|
-- -- Ground static example: destroy the static Tank and generate a S_EVENT_DEAD.
|
||||||
-- Tanks = UNIT:FindByName( "Tank" )
|
-- Tanks = UNIT:FindByName( "Tank" )
|
||||||
-- Tanks:Destroy( true )
|
-- Tanks:Destroy( true )
|
||||||
--
|
--
|
||||||
-- @usage
|
-- @usage
|
||||||
-- -- Ship static example: destroy the Ship silently.
|
-- -- Ship static example: destroy the Ship silently.
|
||||||
-- Ship = STATIC:FindByName( "Ship" )
|
-- Ship = STATIC:FindByName( "Ship" )
|
||||||
-- Ship:Destroy()
|
-- Ship:Destroy()
|
||||||
--
|
--
|
||||||
-- @usage
|
-- @usage
|
||||||
-- -- Destroy without event generation example.
|
-- -- Destroy without event generation example.
|
||||||
-- Ship = STATIC:FindByName( "Boat" )
|
-- Ship = STATIC:FindByName( "Boat" )
|
||||||
-- Ship:Destroy( false ) -- Don't generate any event upon destruction.
|
-- Ship:Destroy( false ) -- Don't generate an event upon destruction.
|
||||||
--
|
--
|
||||||
function STATIC:Destroy( GenerateEvent )
|
function STATIC:Destroy( GenerateEvent )
|
||||||
self:F2( self.ObjectName )
|
self:F2( self.ObjectName )
|
||||||
|
|
||||||
local DCSObject = self:GetDCSObject()
|
local DCSObject = self:GetDCSObject()
|
||||||
|
|
||||||
if DCSObject then
|
if DCSObject then
|
||||||
|
|
||||||
local StaticName = DCSObject:getName()
|
local StaticName = DCSObject:getName()
|
||||||
self:F( { StaticName = StaticName } )
|
self:F( { StaticName = StaticName } )
|
||||||
|
|
||||||
if GenerateEvent and GenerateEvent == true then
|
if GenerateEvent and GenerateEvent == true then
|
||||||
if self:IsAir() then
|
if self:IsAir() then
|
||||||
self:CreateEventCrash( timer.getTime(), DCSObject )
|
self:CreateEventCrash( timer.getTime(), DCSObject )
|
||||||
@@ -134,7 +140,7 @@ function STATIC:Destroy( GenerateEvent )
|
|||||||
else
|
else
|
||||||
self:CreateEventRemoveUnit( timer.getTime(), DCSObject )
|
self:CreateEventRemoveUnit( timer.getTime(), DCSObject )
|
||||||
end
|
end
|
||||||
|
|
||||||
DCSObject:destroy()
|
DCSObject:destroy()
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
@@ -142,16 +148,17 @@ function STATIC:Destroy( GenerateEvent )
|
|||||||
return nil
|
return nil
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
--- Get DCS object of static of static.
|
--- Get DCS object of static of static.
|
||||||
-- @param #STATIC self
|
-- @param #STATIC self
|
||||||
-- @return DCS static object
|
-- @return DCS static object
|
||||||
function STATIC:GetDCSObject()
|
function STATIC:GetDCSObject()
|
||||||
local DCSStatic = StaticObject.getByName( self.StaticName )
|
local DCSStatic = StaticObject.getByName( self.StaticName )
|
||||||
|
|
||||||
if DCSStatic then
|
if DCSStatic then
|
||||||
return DCSStatic
|
return DCSStatic
|
||||||
end
|
end
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -163,7 +170,7 @@ function STATIC:GetUnits()
|
|||||||
local DCSStatic = self:GetDCSObject()
|
local DCSStatic = self:GetDCSObject()
|
||||||
|
|
||||||
local Statics = {}
|
local Statics = {}
|
||||||
|
|
||||||
if DCSStatic then
|
if DCSStatic then
|
||||||
Statics[1] = STATIC:Find( DCSStatic )
|
Statics[1] = STATIC:Find( DCSStatic )
|
||||||
self:T3( Statics )
|
self:T3( Statics )
|
||||||
@@ -173,6 +180,7 @@ function STATIC:GetUnits()
|
|||||||
return nil
|
return nil
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
--- Get threat level of static.
|
--- Get threat level of static.
|
||||||
-- @param #STATIC self
|
-- @param #STATIC self
|
||||||
-- @return #number Threat level 1.
|
-- @return #number Threat level 1.
|
||||||
@@ -186,62 +194,65 @@ end
|
|||||||
-- @param Core.Point#COORDINATE Coordinate The coordinate where to spawn the new Static.
|
-- @param Core.Point#COORDINATE Coordinate The coordinate where to spawn the new Static.
|
||||||
-- @param #number Heading The heading of the static respawn in degrees. Default is 0 deg.
|
-- @param #number Heading The heading of the static respawn in degrees. Default is 0 deg.
|
||||||
-- @param #number Delay Delay in seconds before the static is spawned.
|
-- @param #number Delay Delay in seconds before the static is spawned.
|
||||||
function STATIC:SpawnAt( Coordinate, Heading, Delay )
|
function STATIC:SpawnAt(Coordinate, Heading, Delay)
|
||||||
|
|
||||||
Heading = Heading or 0
|
Heading=Heading or 0
|
||||||
|
|
||||||
if Delay and Delay > 0 then
|
if Delay and Delay>0 then
|
||||||
SCHEDULER:New( nil, self.SpawnAt, { self, Coordinate, Heading }, Delay )
|
SCHEDULER:New(nil, self.SpawnAt, {self, Coordinate, Heading}, Delay)
|
||||||
else
|
else
|
||||||
|
|
||||||
local SpawnStatic = SPAWNSTATIC:NewFromStatic( self.StaticName )
|
local SpawnStatic=SPAWNSTATIC:NewFromStatic(self.StaticName)
|
||||||
|
|
||||||
SpawnStatic:SpawnFromPointVec2( Coordinate, Heading, self.StaticName )
|
SpawnStatic:SpawnFromPointVec2( Coordinate, Heading, self.StaticName )
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
--- Respawn the @{Wrapper.Unit} at the same location with the same properties.
|
--- Respawn the @{Wrapper.Unit} at the same location with the same properties.
|
||||||
-- This is useful to respawn a cargo after it has been destroyed.
|
-- This is useful to respawn a cargo after it has been destroyed.
|
||||||
-- @param #STATIC self
|
-- @param #STATIC self
|
||||||
-- @param DCS#country.id CountryID (Optional) The country ID used for spawning the new static. Default is same as currently.
|
-- @param DCS#country.id CountryID (Optional) The country ID used for spawning the new static. Default is same as currently.
|
||||||
-- @param #number Delay (Optional) Delay in seconds before static is respawned. Default now.
|
-- @param #number Delay (Optional) Delay in seconds before static is respawned. Default now.
|
||||||
function STATIC:ReSpawn( CountryID, Delay )
|
function STATIC:ReSpawn(CountryID, Delay)
|
||||||
|
|
||||||
if Delay and Delay > 0 then
|
if Delay and Delay>0 then
|
||||||
SCHEDULER:New( nil, self.ReSpawn, { self, CountryID }, Delay )
|
SCHEDULER:New(nil, self.ReSpawn, {self, CountryID}, Delay)
|
||||||
else
|
else
|
||||||
|
|
||||||
CountryID = CountryID or self:GetCountry()
|
CountryID=CountryID or self:GetCountry()
|
||||||
|
|
||||||
local SpawnStatic = SPAWNSTATIC:NewFromStatic( self.StaticName, CountryID )
|
|
||||||
|
|
||||||
SpawnStatic:Spawn( nil, self.StaticName )
|
|
||||||
|
|
||||||
|
local SpawnStatic=SPAWNSTATIC:NewFromStatic(self.StaticName, CountryID)
|
||||||
|
|
||||||
|
SpawnStatic:Spawn(nil, self.StaticName)
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
--- Respawn the @{Wrapper.Unit} at a defined Coordinate with an optional heading.
|
--- Respawn the @{Wrapper.Unit} at a defined Coordinate with an optional heading.
|
||||||
-- @param #STATIC self
|
-- @param #STATIC self
|
||||||
-- @param Core.Point#COORDINATE Coordinate The coordinate where to spawn the new Static.
|
-- @param Core.Point#COORDINATE Coordinate The coordinate where to spawn the new Static.
|
||||||
-- @param #number Heading (Optional) The heading of the static respawn in degrees. Default is the current heading.
|
-- @param #number Heading (Optional) The heading of the static respawn in degrees. Default the current heading.
|
||||||
-- @param #number Delay (Optional) Delay in seconds before static is respawned. Default is now.
|
-- @param #number Delay (Optional) Delay in seconds before static is respawned. Default now.
|
||||||
function STATIC:ReSpawnAt( Coordinate, Heading, Delay )
|
function STATIC:ReSpawnAt(Coordinate, Heading, Delay)
|
||||||
|
|
||||||
-- Heading=Heading or 0
|
--Heading=Heading or 0
|
||||||
|
|
||||||
if Delay and Delay > 0 then
|
if Delay and Delay>0 then
|
||||||
SCHEDULER:New( nil, self.ReSpawnAt, { self, Coordinate, Heading }, Delay )
|
SCHEDULER:New(nil, self.ReSpawnAt, {self, Coordinate, Heading}, Delay)
|
||||||
else
|
else
|
||||||
local SpawnStatic = SPAWNSTATIC:NewFromStatic( self.StaticName, self:GetCountry() )
|
|
||||||
|
local SpawnStatic=SPAWNSTATIC:NewFromStatic(self.StaticName, self:GetCountry())
|
||||||
SpawnStatic:SpawnFromCoordinate( Coordinate, Heading, self.StaticName )
|
|
||||||
|
SpawnStatic:SpawnFromCoordinate(Coordinate, Heading, self.StaticName)
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user