mirror of
https://github.com/FlightControl-Master/MOOSE.git
synced 2025-08-15 10:47:21 +00:00
Progress, a lot is working already.
This commit is contained in:
@@ -182,6 +182,20 @@ function MESSAGE:ToCoalition( CoalitionSide )
|
||||
return self
|
||||
end
|
||||
|
||||
--- Sends a MESSAGE to a Coalition if the given Condition is true.
|
||||
-- @param #MESSAGE self
|
||||
-- @param CoalitionSide needs to be filled out by the defined structure of the standard scripting engine @{coalition.side}.
|
||||
-- @return #MESSAGE
|
||||
function MESSAGE:ToCoalitionIf( CoalitionSide, Condition )
|
||||
self:F( CoalitionSide )
|
||||
|
||||
if CoalitionSide then
|
||||
self:ToCoalition( CoalitionSide )
|
||||
end
|
||||
|
||||
return self
|
||||
end
|
||||
|
||||
--- Sends a MESSAGE to all players.
|
||||
-- @param #MESSAGE self
|
||||
-- @return #MESSAGE
|
||||
@@ -194,10 +208,24 @@ end
|
||||
-- MessageAll = MESSAGE:New( "To all Players: BLUE has won! Each player of BLUE wins 50 points!", "End of Mission", 25, "Win" )
|
||||
-- MessageAll:ToAll()
|
||||
function MESSAGE:ToAll()
|
||||
self:F()
|
||||
self:F()
|
||||
|
||||
self:ToCoalition( coalition.side.RED )
|
||||
self:ToCoalition( coalition.side.BLUE )
|
||||
self:ToCoalition( coalition.side.RED )
|
||||
self:ToCoalition( coalition.side.BLUE )
|
||||
|
||||
return self
|
||||
end
|
||||
|
||||
|
||||
--- Sends a MESSAGE to all players if the given Condition is true.
|
||||
-- @param #MESSAGE self
|
||||
-- @return #MESSAGE
|
||||
function MESSAGE:ToAllIf( Condition )
|
||||
|
||||
if Condition then
|
||||
self:ToCoalition( coalition.side.RED )
|
||||
self:ToCoalition( coalition.side.BLUE )
|
||||
end
|
||||
|
||||
return self
|
||||
end
|
||||
|
||||
@@ -35,8 +35,8 @@
|
||||
--
|
||||
-- ## 1.2) Each zone implements two polymorphic functions defined in @{Zone#ZONE_BASE}:
|
||||
--
|
||||
-- * @{#ZONE_BASE.IsPointVec2InZone}(): Returns if a @{Point#POINT_VEC2} is within the zone.
|
||||
-- * @{#ZONE_BASE.IsPointVec3InZone}(): Returns if a @{Point#POINT_VEC3} is within the zone.
|
||||
-- * @{#ZONE_BASE.IsVec2InZone}(): Returns if a Vec2 is within the zone.
|
||||
-- * @{#ZONE_BASE.IsVec3InZone}(): Returns if a Vec3 is within the zone.
|
||||
--
|
||||
-- ## 1.3) A zone has a probability factor that can be set to randomize a selection between zones:
|
||||
--
|
||||
@@ -145,21 +145,28 @@
|
||||
--
|
||||
-- Hereby the change log:
|
||||
--
|
||||
-- 2017-02-18: ZONE_POLYGON_BASE:**GetRandomPointVec2()** added.
|
||||
-- 2017-02-28: ZONE\_BASE:**IsVec2InZone()** replaces ZONE\_BASE:_IsPointVec2InZone()_.
|
||||
-- 2017-02-28: ZONE\_BASE:**IsVec3InZone()** replaces ZONE\_BASE:_IsPointVec3InZone()_.
|
||||
-- 2017-02-28: ZONE\_RADIUS:**IsVec2InZone()** replaces ZONE\_RADIUS:_IsPointVec2InZone()_.
|
||||
-- 2017-02-28: ZONE\_RADIUS:**IsVec3InZone()** replaces ZONE\_RADIUS:_IsPointVec3InZone()_.
|
||||
-- 2017-02-28: ZONE\_POLYGON:**IsVec2InZone()** replaces ZONE\_POLYGON:_IsPointVec2InZone()_.
|
||||
-- 2017-02-28: ZONE\_POLYGON:**IsVec3InZone()** replaces ZONE\_POLYGON:_IsPointVec3InZone()_.
|
||||
--
|
||||
-- 2017-02-18: ZONE_POLYGON_BASE:**GetRandomPointVec3()** added.
|
||||
-- 2017-02-18: ZONE\_POLYGON_BASE:**GetRandomPointVec2()** added.
|
||||
--
|
||||
-- 2017-02-18: ZONE_RADIUS:**GetRandomPointVec3( inner, outer )** added.
|
||||
-- 2017-02-18: ZONE\_POLYGON_BASE:**GetRandomPointVec3()** added.
|
||||
--
|
||||
-- 2017-02-18: ZONE_RADIUS:**GetRandomPointVec2( inner, outer )** added.
|
||||
-- 2017-02-18: ZONE\_RADIUS:**GetRandomPointVec3( inner, outer )** added.
|
||||
--
|
||||
-- 2016-08-15: ZONE_BASE:**GetName()** added.
|
||||
-- 2017-02-18: ZONE\_RADIUS:**GetRandomPointVec2( inner, outer )** added.
|
||||
--
|
||||
-- 2016-08-15: ZONE_BASE:**SetZoneProbability( ZoneProbability )** added.
|
||||
-- 2016-08-15: ZONE\_BASE:**GetName()** added.
|
||||
--
|
||||
-- 2016-08-15: ZONE_BASE:**GetZoneProbability()** added.
|
||||
-- 2016-08-15: ZONE\_BASE:**SetZoneProbability( ZoneProbability )** added.
|
||||
--
|
||||
-- 2016-08-15: ZONE_BASE:**GetZoneMaybe()** added.
|
||||
-- 2016-08-15: ZONE\_BASE:**GetZoneProbability()** added.
|
||||
--
|
||||
-- 2016-08-15: ZONE\_BASE:**GetZoneMaybe()** added.
|
||||
--
|
||||
-- ===
|
||||
--
|
||||
@@ -212,7 +219,7 @@ end
|
||||
-- @param #ZONE_BASE self
|
||||
-- @param Dcs.DCSTypes#Vec2 Vec2 The location to test.
|
||||
-- @return #boolean true if the location is within the zone.
|
||||
function ZONE_BASE:IsPointVec2InZone( Vec2 )
|
||||
function ZONE_BASE:IsVec2InZone( Vec2 )
|
||||
self:F2( Vec2 )
|
||||
|
||||
return false
|
||||
@@ -222,10 +229,10 @@ end
|
||||
-- @param #ZONE_BASE self
|
||||
-- @param Dcs.DCSTypes#Vec3 Vec3 The point to test.
|
||||
-- @return #boolean true if the point is within the zone.
|
||||
function ZONE_BASE:IsPointVec3InZone( Vec3 )
|
||||
function ZONE_BASE:IsVec3InZone( Vec3 )
|
||||
self:F2( Vec3 )
|
||||
|
||||
local InZone = self:IsPointVec2InZone( { x = Vec3.x, y = Vec3.z } )
|
||||
local InZone = self:IsVec2InZone( { x = Vec3.x, y = Vec3.z } )
|
||||
|
||||
return InZone
|
||||
end
|
||||
@@ -455,7 +462,7 @@ end
|
||||
-- @param #ZONE_RADIUS self
|
||||
-- @param Dcs.DCSTypes#Vec2 Vec2 The location to test.
|
||||
-- @return #boolean true if the location is within the zone.
|
||||
function ZONE_RADIUS:IsPointVec2InZone( Vec2 )
|
||||
function ZONE_RADIUS:IsVec2InZone( Vec2 )
|
||||
self:F2( Vec2 )
|
||||
|
||||
local ZoneVec2 = self:GetVec2()
|
||||
@@ -473,10 +480,10 @@ end
|
||||
-- @param #ZONE_RADIUS self
|
||||
-- @param Dcs.DCSTypes#Vec3 Vec3 The point to test.
|
||||
-- @return #boolean true if the point is within the zone.
|
||||
function ZONE_RADIUS:IsPointVec3InZone( Vec3 )
|
||||
function ZONE_RADIUS:IsVec3InZone( Vec3 )
|
||||
self:F2( Vec3 )
|
||||
|
||||
local InZone = self:IsPointVec2InZone( { x = Vec3.x, y = Vec3.z } )
|
||||
local InZone = self:IsVec2InZone( { x = Vec3.x, y = Vec3.z } )
|
||||
|
||||
return InZone
|
||||
end
|
||||
@@ -795,7 +802,7 @@ end
|
||||
-- @param #ZONE_POLYGON_BASE self
|
||||
-- @param Dcs.DCSTypes#Vec2 Vec2 The location to test.
|
||||
-- @return #boolean true if the location is within the zone.
|
||||
function ZONE_POLYGON_BASE:IsPointVec2InZone( Vec2 )
|
||||
function ZONE_POLYGON_BASE:IsVec2InZone( Vec2 )
|
||||
self:F2( Vec2 )
|
||||
|
||||
local Next
|
||||
@@ -837,7 +844,7 @@ function ZONE_POLYGON_BASE:GetRandomVec2()
|
||||
while Vec2Found == false do
|
||||
Vec2 = { x = math.random( BS.x1, BS.x2 ), y = math.random( BS.y1, BS.y2 ) }
|
||||
self:T2( Vec2 )
|
||||
if self:IsPointVec2InZone( Vec2 ) then
|
||||
if self:IsVec2InZone( Vec2 ) then
|
||||
Vec2Found = true
|
||||
end
|
||||
end
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -27,6 +27,7 @@ Include.File( "Wrapper/Unit" )
|
||||
Include.File( "Wrapper/Client" )
|
||||
Include.File( "Wrapper/Static" )
|
||||
Include.File( "Wrapper/Airbase" )
|
||||
Include.File( "Wrapper/Scenery" )
|
||||
|
||||
--- Functional Classes
|
||||
Include.File( "Functional/Scoring" )
|
||||
|
||||
@@ -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
|
||||
@@ -673,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
|
||||
@@ -690,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