mirror of
https://github.com/FlightControl-Master/MOOSE.git
synced 2025-08-15 10:47:21 +00:00
Progress
This commit is contained in:
parent
b84d08f052
commit
632ce65bf5
@ -167,7 +167,7 @@ function MESSAGE:ToClient( Client, Settings )
|
|||||||
if self.MessageType then
|
if self.MessageType then
|
||||||
local Settings = Settings or ( Client and _DATABASE:GetPlayerSettings( Client:GetPlayerName() ) ) or _SETTINGS -- Core.Settings#SETTINGS
|
local Settings = Settings or ( Client and _DATABASE:GetPlayerSettings( Client:GetPlayerName() ) ) or _SETTINGS -- Core.Settings#SETTINGS
|
||||||
self.MessageDuration = Settings:GetMessageTime( self.MessageType )
|
self.MessageDuration = Settings:GetMessageTime( self.MessageType )
|
||||||
self.MessageCategory = self.MessageType .. ": "
|
self.MessageCategory = "" -- self.MessageType .. ": "
|
||||||
end
|
end
|
||||||
|
|
||||||
if self.MessageDuration ~= 0 then
|
if self.MessageDuration ~= 0 then
|
||||||
@ -192,7 +192,7 @@ function MESSAGE:ToGroup( Group, Settings )
|
|||||||
if self.MessageType then
|
if self.MessageType then
|
||||||
local Settings = Settings or ( Group and _DATABASE:GetPlayerSettings( Group:GetPlayerName() ) ) or _SETTINGS -- Core.Settings#SETTINGS
|
local Settings = Settings or ( Group and _DATABASE:GetPlayerSettings( Group:GetPlayerName() ) ) or _SETTINGS -- Core.Settings#SETTINGS
|
||||||
self.MessageDuration = Settings:GetMessageTime( self.MessageType )
|
self.MessageDuration = Settings:GetMessageTime( self.MessageType )
|
||||||
self.MessageCategory = self.MessageType .. ": "
|
self.MessageCategory = "" -- self.MessageType .. ": "
|
||||||
end
|
end
|
||||||
|
|
||||||
if self.MessageDuration ~= 0 then
|
if self.MessageDuration ~= 0 then
|
||||||
@ -259,7 +259,7 @@ function MESSAGE:ToCoalition( CoalitionSide, Settings )
|
|||||||
if self.MessageType then
|
if self.MessageType then
|
||||||
local Settings = Settings or _SETTINGS -- Core.Settings#SETTINGS
|
local Settings = Settings or _SETTINGS -- Core.Settings#SETTINGS
|
||||||
self.MessageDuration = Settings:GetMessageTime( self.MessageType )
|
self.MessageDuration = Settings:GetMessageTime( self.MessageType )
|
||||||
self.MessageCategory = self.MessageType .. ": "
|
self.MessageCategory = "" -- self.MessageType .. ": "
|
||||||
end
|
end
|
||||||
|
|
||||||
if CoalitionSide then
|
if CoalitionSide then
|
||||||
@ -303,7 +303,7 @@ function MESSAGE:ToAll()
|
|||||||
if self.MessageType then
|
if self.MessageType then
|
||||||
local Settings = Settings or _SETTINGS -- Core.Settings#SETTINGS
|
local Settings = Settings or _SETTINGS -- Core.Settings#SETTINGS
|
||||||
self.MessageDuration = Settings:GetMessageTime( self.MessageType )
|
self.MessageDuration = Settings:GetMessageTime( self.MessageType )
|
||||||
self.MessageCategory = self.MessageType .. ": "
|
self.MessageCategory = "" -- self.MessageType .. ": "
|
||||||
end
|
end
|
||||||
|
|
||||||
if self.MessageDuration ~= 0 then
|
if self.MessageDuration ~= 0 then
|
||||||
|
|||||||
@ -50,6 +50,8 @@
|
|||||||
-- ## Each zone has a name:
|
-- ## Each zone has a name:
|
||||||
--
|
--
|
||||||
-- * @{#ZONE_BASE.GetName}(): Returns the name of the zone.
|
-- * @{#ZONE_BASE.GetName}(): Returns the name of the zone.
|
||||||
|
-- * @{#ZONE_BASE.SetName}(): Sets the name of the zone.
|
||||||
|
--
|
||||||
--
|
--
|
||||||
-- ## Each zone implements two polymorphic functions defined in @{Zone#ZONE_BASE}:
|
-- ## Each zone implements two polymorphic functions defined in @{Zone#ZONE_BASE}:
|
||||||
--
|
--
|
||||||
@ -121,6 +123,17 @@ function ZONE_BASE:GetName()
|
|||||||
return self.ZoneName
|
return self.ZoneName
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
--- Sets the name of the zone.
|
||||||
|
-- @param #ZONE_BASE self
|
||||||
|
-- @param #string ZoneName The name of the zone.
|
||||||
|
-- @return #ZONE_BASE
|
||||||
|
function ZONE_BASE:SetName( ZoneName )
|
||||||
|
self:F2()
|
||||||
|
|
||||||
|
self.ZoneName = ZoneName
|
||||||
|
end
|
||||||
|
|
||||||
--- Returns if a Vec2 is within the zone.
|
--- Returns if a Vec2 is within the zone.
|
||||||
-- @param #ZONE_BASE self
|
-- @param #ZONE_BASE self
|
||||||
-- @param Dcs.DCSTypes#Vec2 Vec2 The Vec2 to test.
|
-- @param Dcs.DCSTypes#Vec2 Vec2 The Vec2 to test.
|
||||||
@ -651,6 +664,15 @@ function ZONE_RADIUS:IsNoneInZoneOfCoalition( Coalition )
|
|||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
--- Is None in Zone?
|
||||||
|
-- @param #ZONE_RADIUS self
|
||||||
|
-- @return #boolean
|
||||||
|
function ZONE_RADIUS:IsNoneInZone()
|
||||||
|
|
||||||
|
return self:CountCoalitions() == 0
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
--- Get the Zone Coalitions.
|
--- Get the Zone Coalitions.
|
||||||
-- Returns nil if there are none ot two coalitions in the zone!
|
-- Returns nil if there are none ot two coalitions in the zone!
|
||||||
-- @param #ZONE_RADIUS self
|
-- @param #ZONE_RADIUS self
|
||||||
|
|||||||
@ -10,7 +10,7 @@
|
|||||||
-- @module Protect
|
-- @module Protect
|
||||||
|
|
||||||
--- @type PROTECT.__ Methods which are not intended for mission designers, but which are used interally by the moose designer :-)
|
--- @type PROTECT.__ Methods which are not intended for mission designers, but which are used interally by the moose designer :-)
|
||||||
-- @extends Core.Base#BASE
|
-- @extends Core.Fsm#FSM
|
||||||
|
|
||||||
--- @type PROTECT
|
--- @type PROTECT
|
||||||
-- @extends #PROTECT.__
|
-- @extends #PROTECT.__
|
||||||
@ -35,7 +35,7 @@ function PROTECT:New( ProtectZone, Coalition )
|
|||||||
|
|
||||||
local self = BASE:Inherit( self, FSM:New() ) -- #PROTECT
|
local self = BASE:Inherit( self, FSM:New() ) -- #PROTECT
|
||||||
|
|
||||||
self.ProtectZone = ProtectZone
|
self.ProtectZone = ProtectZone -- Core.Zone#ZONE
|
||||||
self.ProtectUnitSet = SET_UNIT:New()
|
self.ProtectUnitSet = SET_UNIT:New()
|
||||||
self.ProtectStaticSet = SET_STATIC:New()
|
self.ProtectStaticSet = SET_STATIC:New()
|
||||||
self.CaptureUnitSet = SET_UNIT:New()
|
self.CaptureUnitSet = SET_UNIT:New()
|
||||||
@ -44,22 +44,43 @@ function PROTECT:New( ProtectZone, Coalition )
|
|||||||
|
|
||||||
self:AddTransition( { "-", "Protected", "Captured" }, "Protected", "Protected" )
|
self:AddTransition( { "-", "Protected", "Captured" }, "Protected", "Protected" )
|
||||||
|
|
||||||
self:AddTransition( { "Protected", "Attacked" }, "Destroyed", "Destroyed" )
|
self:AddTransition( { "Protected", "Attacked", "Empty" }, "Empty", "Empty" )
|
||||||
|
|
||||||
self:AddTransition( { "Protected", "Destroyed" }, "Attacked", "Attacked" )
|
self:AddTransition( { "Protected", "Empty", "Attacked" }, "Attacked", "Attacked" )
|
||||||
|
|
||||||
self:AddTransition( { "Protected", "Attacked", "Destroyed" }, "Captured", "Captured" )
|
self:AddTransition( { "Protected", "Attacked", "Empty" }, "Captured", "Captured" )
|
||||||
|
|
||||||
self:ScheduleRepeat( 60, 60, 0, nil, self.Status, self )
|
self:ScheduleRepeat( 15, 15, 0.1, nil, self.StatusCoalition, self )
|
||||||
|
|
||||||
|
self:ScheduleRepeat( 15, 15, 0.1, nil, self.StatusZone, self )
|
||||||
|
|
||||||
|
self:ScheduleRepeat( 5, 300, 0, nil, self.StatusSmoke, self )
|
||||||
|
|
||||||
self:SetCoalition( Coalition )
|
self:SetCoalition( Coalition )
|
||||||
|
|
||||||
self:__Protected( 5 )
|
self.SmokeTime = nil
|
||||||
|
|
||||||
return self
|
return self
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
--- Get the ProtectZone
|
||||||
|
-- @param #PROTECT self
|
||||||
|
-- @return Core.Zone#ZONE_BASE
|
||||||
|
function PROTECT:GetProtectZone()
|
||||||
|
return self.ProtectZone
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
--- Get the name of the ProtectZone
|
||||||
|
-- @param #PROTECT self
|
||||||
|
-- @return #string
|
||||||
|
function PROTECT:GetProtectZoneName()
|
||||||
|
return self.ProtectZone:GetName()
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
--- Set the owning coalition of the zone.
|
--- Set the owning coalition of the zone.
|
||||||
-- @param #PROTECT self
|
-- @param #PROTECT self
|
||||||
-- @param DCSCoalition.DCSCoalition#coalition Coalition
|
-- @param DCSCoalition.DCSCoalition#coalition Coalition
|
||||||
@ -121,9 +142,9 @@ end
|
|||||||
|
|
||||||
function PROTECT:IsProtected()
|
function PROTECT:IsProtected()
|
||||||
|
|
||||||
local IsAllCoalition = self.ProtectZone:IsAllInZoneOfCoalition( self.Coalition )
|
local IsProtected = self.ProtectZone:IsAllInZoneOfCoalition( self.Coalition )
|
||||||
self:E( { IsAllCoalition = IsAllCoalition } )
|
self:E( { IsProtected = IsProtected } )
|
||||||
return IsAllCoalition
|
return IsProtected
|
||||||
end
|
end
|
||||||
|
|
||||||
function PROTECT:IsCaptured()
|
function PROTECT:IsCaptured()
|
||||||
@ -136,12 +157,18 @@ end
|
|||||||
|
|
||||||
function PROTECT:IsAttacked()
|
function PROTECT:IsAttacked()
|
||||||
|
|
||||||
local IsSomeCoalition = self.ProtectZone:IsSomeInZoneOfCoalition( self.Coalition )
|
local IsAttacked = self.ProtectZone:IsSomeInZoneOfCoalition( self.Coalition )
|
||||||
self:E( { IsSomeCoalition = IsSomeCoalition } )
|
self:E( { IsAttacked = IsAttacked } )
|
||||||
return IsSomeCoalition
|
return IsAttacked
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
function PROTECT:IsEmpty()
|
||||||
|
|
||||||
|
local IsEmpty = self.ProtectZone:IsNoneInZone()
|
||||||
|
self:E( { IsEmpty = IsEmpty } )
|
||||||
|
return IsEmpty
|
||||||
|
end
|
||||||
|
|
||||||
--- Check if the units are still alive.
|
--- Check if the units are still alive.
|
||||||
-- @param #PROTECT self
|
-- @param #PROTECT self
|
||||||
@ -204,10 +231,32 @@ end
|
|||||||
-- @param #PROTECT self
|
-- @param #PROTECT self
|
||||||
-- @param #SMOKECOLOR.Color SmokeColor
|
-- @param #SMOKECOLOR.Color SmokeColor
|
||||||
function PROTECT:Smoke( SmokeColor )
|
function PROTECT:Smoke( SmokeColor )
|
||||||
self.ProtectZone:GetCoordinate():Smoke( SmokeColor )
|
|
||||||
|
local CurrentTime = timer.getTime()
|
||||||
|
self.SmokeColor = SmokeColor
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
--- Flare.
|
||||||
|
-- @param #PROTECT self
|
||||||
|
-- @param #SMOKECOLOR.Color FlareColor
|
||||||
|
function PROTECT:Flare( FlareColor )
|
||||||
|
self.ProtectZone:FlareZone( FlareColor, math.random( 1, 360 ) )
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
--- Bound.
|
||||||
|
-- @param #PROTECT self
|
||||||
|
function PROTECT:onafterProtected()
|
||||||
|
|
||||||
|
|
||||||
|
if self.Coalition == coalition.side.BLUE then
|
||||||
|
self.ProtectZone:BoundZone( 12, country.id.USA )
|
||||||
|
else
|
||||||
|
self.ProtectZone:BoundZone( 12, country.id.RUSSIA )
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
function PROTECT:onenterCaptured()
|
function PROTECT:onenterCaptured()
|
||||||
|
|
||||||
local NewCoalition = self.ProtectZone:GetCoalition()
|
local NewCoalition = self.ProtectZone:GetCoalition()
|
||||||
@ -215,23 +264,54 @@ function PROTECT:onenterCaptured()
|
|||||||
self:SetCoalition( NewCoalition )
|
self:SetCoalition( NewCoalition )
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Check status ProtectZone.
|
--- Check status Coalition ownership.
|
||||||
-- @param #PROTECT self
|
-- @param #PROTECT self
|
||||||
function PROTECT:Status()
|
function PROTECT:StatusCoalition()
|
||||||
|
|
||||||
|
self:E( { State = self:GetState() } )
|
||||||
|
|
||||||
self.ProtectZone:Scan()
|
self.ProtectZone:Scan()
|
||||||
|
|
||||||
if self:IsProtected() then
|
if self:IsProtected() then
|
||||||
self:Protected()
|
self:Protected()
|
||||||
else
|
|
||||||
if self:IsAttacked() then
|
|
||||||
self:Attacked()
|
|
||||||
else
|
else
|
||||||
if self:IsCaptured() then
|
if self:IsCaptured() then
|
||||||
self:Captured()
|
self:Captured()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
--- Check status Zone.
|
||||||
|
-- @param #PROTECT self
|
||||||
|
function PROTECT:StatusZone()
|
||||||
|
|
||||||
|
self:E( { State = self:GetState() } )
|
||||||
|
|
||||||
|
self.ProtectZone:Scan()
|
||||||
|
|
||||||
|
if self:IsAttacked() then
|
||||||
|
self:Attacked()
|
||||||
|
else
|
||||||
|
if self:IsEmpty() then
|
||||||
|
self:Empty()
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
--- Check status Smoke.
|
||||||
|
-- @param #PROTECT self
|
||||||
|
function PROTECT:StatusSmoke()
|
||||||
|
|
||||||
|
local CurrentTime = timer.getTime()
|
||||||
|
|
||||||
|
if self.SmokeTime == nil or self.SmokeTime + 300 <= CurrentTime then
|
||||||
|
if self.SmokeColor then
|
||||||
|
self.ProtectZone:GetCoordinate():Smoke( self.SmokeColor )
|
||||||
|
self.SmokeColor = nil
|
||||||
|
self.SmokeTime = CurrentTime
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -415,9 +415,9 @@ function POSITIONABLE:GetMessageText( Message, Name ) --R2.1 added
|
|||||||
|
|
||||||
local DCSObject = self:GetDCSObject()
|
local DCSObject = self:GetDCSObject()
|
||||||
if DCSObject then
|
if DCSObject then
|
||||||
Name = Name and ( " (" .. Name .. ")" ) or ""
|
Name = Name and ( " => " .. Name ) or ""
|
||||||
local Callsign = string.format( "[%s]", self:GetCallsign() ~= "" and self:GetCallsign() or self:GetName() )
|
local Callsign = string.format( "%s", self:GetCallsign() ~= "" and self:GetCallsign() or self:GetName() )
|
||||||
local MessageText = Callsign .. Name .. ": " .. Message
|
local MessageText = string.format("[%s%s]: %s", Callsign, Name, Message )
|
||||||
return MessageText
|
return MessageText
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user