Templates update

This commit is contained in:
Frank
2021-05-11 00:21:50 +02:00
parent 59e4f48726
commit 7cd29501a9
4 changed files with 358 additions and 88 deletions

View File

@@ -240,7 +240,7 @@ EVENTS = {
Kill = world.event.S_EVENT_KILL or -1,
Score = world.event.S_EVENT_SCORE or -1,
UnitLost = world.event.S_EVENT_UNIT_LOST or -1,
LandingAfterEjection = 31, --world.event.S_EVENT_LANDING_AFTER_EJECTION or -1,
LandingAfterEjection = world.event.S_EVENT_LANDING_AFTER_EJECTION or -1,
-- Added with DCS 2.7.0
ParatrooperLanding = world.event.S_EVENT_PARATROOPER_LENDING or -1,
DiscardChairAfterEjection = world.event.S_EVENT_DISCARD_CHAIR_AFTER_EJECTION or -1,
@@ -524,7 +524,7 @@ local _EVENTMETA = {
Event = "OnEventUnitLost",
Text = "S_EVENT_UNIT_LOST"
},
[world.event.S_EVENT_LANDING_AFTER_EJECTION] = {
[EVENTS.LandingAfterEjection] = {
Order = 1,
Event = "OnEventLandingAfterEjection",
Text = "S_EVENT_LANDING_AFTER_EJECTION"
@@ -592,7 +592,7 @@ end
-- @param Core.Base#BASE EventClass The class object for which events are handled.
-- @return #EVENT.Events
function EVENT:Init( EventID, EventClass )
self:F( { _EVENTMETA[EventID].Text, EventClass } )
self:F3( { _EVENTMETA[EventID].Text, EventClass } )
if not self.Events[EventID] then
-- Create a WEAK table to ensure that the garbage collector is cleaning the event links when the object usage is cleaned.
@@ -1124,34 +1124,33 @@ function EVENT:onEvent( Event )
end
if Event.TgtObjectCategory == Object.Category.STATIC then
BASE:T({StaticTgtEvent = Event.id})
-- get base data
Event.TgtDCSUnit = Event.target
if Event.target:isExist() and Event.id ~= 33 then -- leave out ejected seat object
Event.TgtDCSUnitName = Event.TgtDCSUnit:getName()
Event.TgtDCSUnit = Event.target
if Event.target:isExist() and Event.id ~= 33 then -- leave out ejected seat object
Event.TgtDCSUnitName = Event.TgtDCSUnit:getName()
Event.TgtUnitName = Event.TgtDCSUnitName
Event.TgtUnit = STATIC:FindByName( Event.TgtDCSUnitName, false )
Event.TgtCoalition = Event.TgtDCSUnit:getCoalition()
Event.TgtCategory = Event.TgtDCSUnit:getDesc().category
Event.TgtTypeName = Event.TgtDCSUnit:getTypeName()
else
Event.TgtDCSUnitName = string.format("No target object for Event ID %s", tostring(Event.id))
Event.TgtUnitName = Event.TgtDCSUnitName
Event.TgtUnit = nil
Event.TgtCoalition = 0
Event.TgtCategory = 0
if Event.id == 6 then
Event.TgtTypeName = "Ejected Pilot"
Event.TgtDCSUnitName = string.format("Ejected Pilot ID %s", tostring(Event.IniDCSUnitName))
Event.TgtUnitName = Event.TgtDCSUnitName
elseif Event.id == 33 then
Event.TgtTypeName = "Ejection Seat"
Event.TgtDCSUnitName = string.format("Ejection Seat ID %s", tostring(Event.IniDCSUnitName))
Event.TgtUnitName = Event.TgtDCSUnitName
Event.TgtUnit = STATIC:FindByName( Event.TgtDCSUnitName, false )
Event.TgtCoalition = Event.TgtDCSUnit:getCoalition()
Event.TgtCategory = Event.TgtDCSUnit:getDesc().category
Event.TgtTypeName = Event.TgtDCSUnit:getTypeName()
else
Event.TgtDCSUnitName = string.format("No target object for Event ID %s", tostring(Event.id))
Event.TgtUnitName = Event.TgtDCSUnitName
Event.TgtUnit = nil
Event.TgtCoalition = 0
Event.TgtCategory = 0
if Event.id == 6 then
Event.TgtTypeName = "Ejected Pilot"
Event.TgtDCSUnitName = string.format("Ejected Pilot ID %s", tostring(Event.IniDCSUnitName))
Event.TgtUnitName = Event.TgtDCSUnitName
elseif Event.id == 33 then
Event.TgtTypeName = "Ejection Seat"
Event.TgtDCSUnitName = string.format("Ejection Seat ID %s", tostring(Event.IniDCSUnitName))
Event.TgtUnitName = Event.TgtDCSUnitName
else
Event.TgtTypeName = "Static"
end
end
Event.TgtTypeName = "Static"
end
end
end
if Event.TgtObjectCategory == Object.Category.SCENERY then

View File

@@ -634,9 +634,9 @@ do -- COORDINATE
--- Return a random Coordinate within an Outer Radius and optionally NOT within an Inner Radius of the COORDINATE.
-- @param #COORDINATE self
-- @param DCS#Distance OuterRadius
-- @param DCS#Distance InnerRadius
-- @return #COORDINATE
-- @param DCS#Distance OuterRadius Outer radius in meters.
-- @param DCS#Distance InnerRadius Inner radius in meters.
-- @return #COORDINATE self
function COORDINATE:GetRandomCoordinateInRadius( OuterRadius, InnerRadius )
self:F2( { OuterRadius, InnerRadius } )
@@ -2172,8 +2172,8 @@ do -- COORDINATE
-- @param #table Color RGB color table {r, g, b}, e.g. {1,0,0} for red (default).
-- @param #number Alpha Transparency [0,1]. Default 1.
-- @param #table FillColor RGB color table {r, g, b}, e.g. {1,0,0} for red. Default is same as `Color` value.
-- @param #number FillAlpha Transparency [0,1]. Default 0.15.
-- @param #number FontSize Font size.
-- @param #number FillAlpha Transparency [0,1]. Default 0.3.
-- @param #number FontSize Font size. Default 14.
-- @param #boolean ReadOnly (Optional) Mark is readonly and cannot be removed by users. Default false.
-- @return #number The resulting Mark ID, which is a number. Can be used to remove the object again.
function COORDINATE:TextToAll(Text, Coalition, Color, Alpha, FillColor, FillAlpha, FontSize, ReadOnly)
@@ -2185,8 +2185,8 @@ do -- COORDINATE
Color=Color or {1,0,0}
Color[4]=Alpha or 1.0
FillColor=FillColor or Color
FillColor[4]=FillAlpha or 0.15
FontSize=FontSize or 12
FillColor[4]=FillAlpha or 0.3
FontSize=FontSize or 14
trigger.action.textToAll(Coalition, MarkID, self:GetVec3(), Color, FillColor, FontSize, ReadOnly, Text or "Hello World")
return MarkID
end

View File

@@ -17,6 +17,7 @@
-- * Get zone properties.
-- * Get zone bounding box.
-- * Set/get zone name.
-- * Draw zones (circular and polygon) on the F10 map.
--
--
-- There are essentially two core functions that zones accomodate:
@@ -495,6 +496,10 @@ end
-- * @{#ZONE_RADIUS.GetRandomPointVec2}(): Gets a @{Core.Point#POINT_VEC2} object representing a random 2D point in the zone.
-- * @{#ZONE_RADIUS.GetRandomPointVec3}(): Gets a @{Core.Point#POINT_VEC3} object representing a random 3D point in the zone. Note that the height of the point is at landheight.
--
-- ## Draw zone
--
-- * @{#ZONE_RADIUS.DrawZone}(): Draws the zone on the F10 map.
--
-- @field #ZONE_RADIUS
ZONE_RADIUS = {
ClassName="ZONE_RADIUS",
@@ -1506,6 +1511,11 @@ end
-- * @{#ZONE_POLYGON_BASE.GetRandomVec2}(): Gets a random 2D point in the zone.
-- * @{#ZONE_POLYGON_BASE.GetRandomPointVec2}(): Return a @{Core.Point#POINT_VEC2} object representing a random 2D point within the zone.
-- * @{#ZONE_POLYGON_BASE.GetRandomPointVec3}(): Return a @{Core.Point#POINT_VEC3} object representing a random 3D point at landheight within the zone.
--
-- ## Draw zone
--
-- * @{#ZONE_POLYGON_BASE.DrawZone}(): Draws the zone on the F10 map.
--
--
-- @field #ZONE_POLYGON_BASE
ZONE_POLYGON_BASE = {
@@ -1938,7 +1948,7 @@ end
-- This is especially handy if you want to quickly setup a SET_ZONE...
-- So when you would declare `local SetZone = SET_ZONE:New():FilterPrefixes( "Defense" ):FilterStart()`,
-- then SetZone would contain the ZONE_POLYGON object `DefenseZone` as part of the zone collection,
-- without much scripting overhead!!!
-- without much scripting overhead!
--
-- @field #ZONE_POLYGON
ZONE_POLYGON = {