mirror of
https://github.com/FlightControl-Master/MOOSE.git
synced 2025-08-15 10:47:21 +00:00
#ZONE_CAPTURE_COALITION - allow zone to be a ZONE_POLYGON
#RANGE Messaging changes in case >1 player per group
This commit is contained in:
@@ -2570,7 +2570,7 @@ function RANGE:_DisplayMyStrafePitResults( _unitName )
|
||||
self:F( _unitName )
|
||||
|
||||
-- Get player unit and name
|
||||
local _unit, _playername = self:_GetPlayerUnitAndName( _unitName )
|
||||
local _unit, _playername, _multiplayer = self:_GetPlayerUnitAndName( _unitName )
|
||||
|
||||
if _unit and _playername then
|
||||
|
||||
@@ -2622,7 +2622,7 @@ function RANGE:_DisplayMyStrafePitResults( _unitName )
|
||||
end
|
||||
|
||||
-- Send message to group.
|
||||
self:_DisplayMessageToGroup( _unit, _message, nil, true, true )
|
||||
self:_DisplayMessageToGroup( _unit, _message, nil, true, true, _multiplayer )
|
||||
end
|
||||
end
|
||||
|
||||
@@ -2633,7 +2633,7 @@ function RANGE:_DisplayStrafePitResults( _unitName )
|
||||
self:F( _unitName )
|
||||
|
||||
-- Get player unit and name.
|
||||
local _unit, _playername = self:_GetPlayerUnitAndName( _unitName )
|
||||
local _unit, _playername, _multiplayer = self:_GetPlayerUnitAndName( _unitName )
|
||||
|
||||
-- Check if we have a unit which is a player.
|
||||
if _unit and _playername then
|
||||
@@ -2680,7 +2680,7 @@ function RANGE:_DisplayStrafePitResults( _unitName )
|
||||
end
|
||||
|
||||
-- Send message.
|
||||
self:_DisplayMessageToGroup( _unit, _message, nil, true, true )
|
||||
self:_DisplayMessageToGroup( _unit, _message, nil, true, true, _multiplayer )
|
||||
end
|
||||
end
|
||||
|
||||
@@ -2691,7 +2691,7 @@ function RANGE:_DisplayMyBombingResults( _unitName )
|
||||
self:F( _unitName )
|
||||
|
||||
-- Get player unit and name.
|
||||
local _unit, _playername = self:_GetPlayerUnitAndName( _unitName )
|
||||
local _unit, _playername, _multiplayer = self:_GetPlayerUnitAndName( _unitName )
|
||||
|
||||
if _unit and _playername then
|
||||
|
||||
@@ -2737,7 +2737,7 @@ function RANGE:_DisplayMyBombingResults( _unitName )
|
||||
end
|
||||
|
||||
-- Send message.
|
||||
self:_DisplayMessageToGroup( _unit, _message, nil, true, true )
|
||||
self:_DisplayMessageToGroup( _unit, _message, nil, true, true, _multiplayer )
|
||||
end
|
||||
end
|
||||
|
||||
@@ -2751,7 +2751,7 @@ function RANGE:_DisplayBombingResults( _unitName )
|
||||
local _playerResults = {}
|
||||
|
||||
-- Get player unit and name.
|
||||
local _unit, _player = self:_GetPlayerUnitAndName( _unitName )
|
||||
local _unit, _player, _multiplayer = self:_GetPlayerUnitAndName( _unitName )
|
||||
|
||||
-- Check if we have a unit with a player.
|
||||
if _unit and _player then
|
||||
@@ -2795,7 +2795,7 @@ function RANGE:_DisplayBombingResults( _unitName )
|
||||
end
|
||||
|
||||
-- Send message.
|
||||
self:_DisplayMessageToGroup( _unit, _message, nil, true, true )
|
||||
self:_DisplayMessageToGroup( _unit, _message, nil, true, true, _multiplayer )
|
||||
end
|
||||
end
|
||||
|
||||
@@ -2806,7 +2806,7 @@ function RANGE:_DisplayRangeInfo( _unitname )
|
||||
self:F( _unitname )
|
||||
|
||||
-- Get player unit and player name.
|
||||
local unit, playername = self:_GetPlayerUnitAndName( _unitname )
|
||||
local unit, playername, _multiplayer = self:_GetPlayerUnitAndName( _unitname )
|
||||
|
||||
-- Check if we have a player.
|
||||
if unit and playername then
|
||||
@@ -2901,7 +2901,7 @@ function RANGE:_DisplayRangeInfo( _unitname )
|
||||
text = text .. textdelay
|
||||
|
||||
-- Send message to player group.
|
||||
self:_DisplayMessageToGroup( unit, text, nil, true, true )
|
||||
self:_DisplayMessageToGroup( unit, text, nil, true, true, _multiplayer )
|
||||
|
||||
-- Debug output.
|
||||
self:T2( self.id .. text )
|
||||
@@ -2916,7 +2916,7 @@ function RANGE:_DisplayBombTargets( _unitname )
|
||||
self:F( _unitname )
|
||||
|
||||
-- Get player unit and player name.
|
||||
local _unit, _playername = self:_GetPlayerUnitAndName( _unitname )
|
||||
local _unit, _playername, _multiplayer = self:_GetPlayerUnitAndName( _unitname )
|
||||
|
||||
-- Check if we have a player.
|
||||
if _unit and _playername then
|
||||
@@ -2948,7 +2948,7 @@ function RANGE:_DisplayBombTargets( _unitname )
|
||||
end
|
||||
end
|
||||
|
||||
self:_DisplayMessageToGroup( _unit, _text, 120, true, true )
|
||||
self:_DisplayMessageToGroup( _unit, _text, 120, true, true, _multiplayer )
|
||||
end
|
||||
end
|
||||
|
||||
@@ -2959,7 +2959,7 @@ function RANGE:_DisplayStrafePits( _unitname )
|
||||
self:F( _unitname )
|
||||
|
||||
-- Get player unit and player name.
|
||||
local _unit, _playername = self:_GetPlayerUnitAndName( _unitname )
|
||||
local _unit, _playername, _multiplayer = self:_GetPlayerUnitAndName( _unitname )
|
||||
|
||||
-- Check if we have a player.
|
||||
if _unit and _playername then
|
||||
@@ -2988,7 +2988,7 @@ function RANGE:_DisplayStrafePits( _unitname )
|
||||
_text = _text .. string.format( "\n- %s: heading %03d°\n%s", _strafepit.name, heading, mycoord )
|
||||
end
|
||||
|
||||
self:_DisplayMessageToGroup( _unit, _text, nil, true, true )
|
||||
self:_DisplayMessageToGroup( _unit, _text, nil, true, true, _multiplayer )
|
||||
end
|
||||
end
|
||||
|
||||
@@ -2999,7 +2999,7 @@ function RANGE:_DisplayRangeWeather( _unitname )
|
||||
self:F( _unitname )
|
||||
|
||||
-- Get player unit and player name.
|
||||
local unit, playername = self:_GetPlayerUnitAndName( _unitname )
|
||||
local unit, playername, _multiplayer = self:_GetPlayerUnitAndName( _unitname )
|
||||
|
||||
-- Check if we have a player.
|
||||
if unit and playername then
|
||||
@@ -3048,7 +3048,7 @@ function RANGE:_DisplayRangeWeather( _unitname )
|
||||
end
|
||||
|
||||
-- Send message to player group.
|
||||
self:_DisplayMessageToGroup( unit, text, nil, true, true )
|
||||
self:_DisplayMessageToGroup( unit, text, nil, true, true, _multiplayer )
|
||||
|
||||
-- Debug output.
|
||||
self:T2( self.id .. text )
|
||||
@@ -3666,7 +3666,8 @@ end
|
||||
-- @param #number _time Duration how long the message is displayed.
|
||||
-- @param #boolean _clear Clear up old messages.
|
||||
-- @param #boolean display If true, display message regardless of player setting "Messages Off".
|
||||
function RANGE:_DisplayMessageToGroup( _unit, _text, _time, _clear, display )
|
||||
-- @param #boolean _togroup If true, display the message to the group in any case
|
||||
function RANGE:_DisplayMessageToGroup( _unit, _text, _time, _clear, display, _togroup )
|
||||
self:F( { unit = _unit, text = _text, time = _time, clear = _clear } )
|
||||
|
||||
-- Defaults
|
||||
@@ -3694,8 +3695,13 @@ function RANGE:_DisplayMessageToGroup( _unit, _text, _time, _clear, display )
|
||||
local playermessage = self.PlayerSettings[playername].messages
|
||||
|
||||
-- Send message to player if messages enabled and not only for the examiner.
|
||||
|
||||
if _gid and (playermessage == true or display) and (not self.examinerexclusive) then
|
||||
local m = MESSAGE:New(_text,_time,nil,_clear):ToUnit(_unit)
|
||||
if _togroup and _grp then
|
||||
local m = MESSAGE:New(_text,_time,nil,_clear):ToGroup(_grp)
|
||||
else
|
||||
local m = MESSAGE:New(_text,_time,nil,_clear):ToUnit(_unit)
|
||||
end
|
||||
end
|
||||
|
||||
-- Send message to examiner.
|
||||
@@ -3715,7 +3721,7 @@ end
|
||||
function RANGE:_SmokeBombImpactOnOff( unitname )
|
||||
self:F( unitname )
|
||||
|
||||
local unit, playername = self:_GetPlayerUnitAndName( unitname )
|
||||
local unit, playername, _multiplayer = self:_GetPlayerUnitAndName( unitname )
|
||||
if unit and playername then
|
||||
local text
|
||||
if self.PlayerSettings[playername].smokebombimpact == true then
|
||||
@@ -3736,7 +3742,7 @@ end
|
||||
function RANGE:_SmokeBombDelayOnOff( unitname )
|
||||
self:F( unitname )
|
||||
|
||||
local unit, playername = self:_GetPlayerUnitAndName( unitname )
|
||||
local unit, playername, _multiplayer = self:_GetPlayerUnitAndName( unitname )
|
||||
if unit and playername then
|
||||
local text
|
||||
if self.PlayerSettings[playername].delaysmoke == true then
|
||||
@@ -3757,7 +3763,7 @@ end
|
||||
function RANGE:_MessagesToPlayerOnOff( unitname )
|
||||
self:F( unitname )
|
||||
|
||||
local unit, playername = self:_GetPlayerUnitAndName( unitname )
|
||||
local unit, playername, _multiplayer = self:_GetPlayerUnitAndName( unitname )
|
||||
if unit and playername then
|
||||
local text
|
||||
if self.PlayerSettings[playername].messages == true then
|
||||
@@ -3778,7 +3784,7 @@ function RANGE:_TargetsheetOnOff( _unitname )
|
||||
self:F2( _unitname )
|
||||
|
||||
-- Get player unit and player name.
|
||||
local unit, playername = self:_GetPlayerUnitAndName( _unitname )
|
||||
local unit, playername, _multiplayer = self:_GetPlayerUnitAndName( _unitname )
|
||||
|
||||
-- Check if we have a player.
|
||||
if unit and playername then
|
||||
@@ -3820,7 +3826,7 @@ end
|
||||
function RANGE:_FlareDirectHitsOnOff( unitname )
|
||||
self:F( unitname )
|
||||
|
||||
local unit, playername = self:_GetPlayerUnitAndName( unitname )
|
||||
local unit, playername, _multiplayer = self:_GetPlayerUnitAndName( unitname )
|
||||
if unit and playername then
|
||||
local text
|
||||
if self.PlayerSettings[playername].flaredirecthits == true then
|
||||
@@ -4039,12 +4045,14 @@ end
|
||||
-- @param #string _unitName Name of the player unit.
|
||||
-- @return Wrapper.Unit#UNIT Unit of player.
|
||||
-- @return #string Name of the player.
|
||||
-- @return nil If player does not exist.
|
||||
-- @return #boolean If true, group has > 1 player in it
|
||||
function RANGE:_GetPlayerUnitAndName( _unitName )
|
||||
self:F2( _unitName )
|
||||
|
||||
if _unitName ~= nil then
|
||||
|
||||
|
||||
local multiplayer = false
|
||||
|
||||
-- Get DCS unit from its name.
|
||||
local DCSunit = Unit.getByName( _unitName )
|
||||
|
||||
@@ -4056,7 +4064,11 @@ function RANGE:_GetPlayerUnitAndName( _unitName )
|
||||
self:T2( { DCSunit = DCSunit, unit = unit, playername = playername } )
|
||||
if DCSunit and unit and playername then
|
||||
self:F2(playername)
|
||||
return unit, playername
|
||||
local grp = unit:GetGroup()
|
||||
if grp and grp:CountAliveUnits() > 1 then
|
||||
multiplayer = true
|
||||
end
|
||||
return unit, playername, multiplayer
|
||||
end
|
||||
|
||||
end
|
||||
@@ -4064,7 +4076,7 @@ function RANGE:_GetPlayerUnitAndName( _unitName )
|
||||
end
|
||||
|
||||
-- Return nil if we could not find a player.
|
||||
return nil, nil
|
||||
return nil, nil, nil
|
||||
end
|
||||
|
||||
--- Returns a string which consists of the player name.
|
||||
|
||||
@@ -363,7 +363,7 @@ do -- ZONE_CAPTURE_COALITION
|
||||
|
||||
--- ZONE_CAPTURE_COALITION Constructor.
|
||||
-- @param #ZONE_CAPTURE_COALITION self
|
||||
-- @param Core.Zone#ZONE Zone A @{Zone} object with the goal to be achieved.
|
||||
-- @param Core.Zone#ZONE Zone A @{Zone} object with the goal to be achieved. Alternatively, can be handed as the name of late activated group describing a @{ZONE_POLYGON} with its waypoints.
|
||||
-- @param DCSCoalition.DCSCoalition#coalition Coalition The initial coalition owning the zone.
|
||||
-- @param #table UnitCategories Table of unit categories. See [DCS Class Unit](https://wiki.hoggitworld.com/view/DCS_Class_Unit). Default {Unit.Category.GROUND_UNIT}.
|
||||
-- @param #table ObjectCategories Table of unit categories. See [DCS Class Object](https://wiki.hoggitworld.com/view/DCS_Class_Object). Default {Object.Category.UNIT, Object.Category.STATIC}, i.e. all UNITS and STATICS.
|
||||
|
||||
@@ -59,10 +59,15 @@ do -- Zone
|
||||
-- @param Core.Zone#ZONE_RADIUS Zone A @{Zone} object with the goal to be achieved.
|
||||
-- @return #ZONE_GOAL
|
||||
function ZONE_GOAL:New( Zone )
|
||||
|
||||
local self = BASE:Inherit( self, ZONE_RADIUS:New( Zone:GetName(), Zone:GetVec2(), Zone:GetRadius() ) ) -- #ZONE_GOAL
|
||||
self:F( { Zone = Zone } )
|
||||
|
||||
|
||||
BASE:I({Zone=Zone})
|
||||
local self = BASE:Inherit( self, BASE:New())
|
||||
if type(Zone) == "string" then
|
||||
self = BASE:Inherit( self, ZONE_POLYGON:NewFromGroupName(Zone) )
|
||||
else
|
||||
self = BASE:Inherit( self, ZONE_RADIUS:New( Zone:GetName(), Zone:GetVec2(), Zone:GetRadius() ) ) -- #ZONE_GOAL
|
||||
self:F( { Zone = Zone } )
|
||||
end
|
||||
-- Goal object.
|
||||
self.Goal = GOAL:New()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user