mirror of
https://github.com/FlightControl-Master/MOOSE.git
synced 2025-10-29 16:58:06 +00:00
#PLAYERRECCE
* Gazelle sight correcions * Added Shack event
This commit is contained in:
parent
e2dce132df
commit
120b77d853
@ -94,7 +94,7 @@ PLAYERRECCE = {
|
|||||||
ClassName = "PLAYERRECCE",
|
ClassName = "PLAYERRECCE",
|
||||||
verbose = true,
|
verbose = true,
|
||||||
lid = nil,
|
lid = nil,
|
||||||
version = "0.0.8",
|
version = "0.0.9",
|
||||||
ViewZone = {},
|
ViewZone = {},
|
||||||
ViewZoneVisual = {},
|
ViewZoneVisual = {},
|
||||||
PlayerSet = nil,
|
PlayerSet = nil,
|
||||||
@ -242,7 +242,7 @@ function PLAYERRECCE:New(Name, Coalition, PlayerSet)
|
|||||||
local starttime = math.random(5,10)
|
local starttime = math.random(5,10)
|
||||||
self:__Status(-starttime)
|
self:__Status(-starttime)
|
||||||
|
|
||||||
self:I(self.lid..self.version.." Started.")
|
self:I(self.lid.." Started.")
|
||||||
|
|
||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
@ -304,10 +304,10 @@ function PLAYERRECCE:_GetClockDirection(unit, target)
|
|||||||
clock = UTILS.Round(clock,0)
|
clock = UTILS.Round(clock,0)
|
||||||
if clock > 12 then clock = clock-12 end
|
if clock > 12 then clock = clock-12 end
|
||||||
end
|
end
|
||||||
if self.debug then
|
--if self.debug then
|
||||||
local text = string.format("Heading = %d, Angle = %d, Hours= %d, Clock = %d",_heading,Angle,hours,clock)
|
--local text = string.format("Heading = %d, Angle = %d, Hours= %d, Clock = %d",_heading,Angle,hours,clock)
|
||||||
self:I(self.lid .. text)
|
--self:I(self.lid .. text)
|
||||||
end
|
--end
|
||||||
return clock
|
return clock
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -390,7 +390,30 @@ function PLAYERRECCE:_GetGazelleVivianneSight(Gazelle)
|
|||||||
local heading = unit:GetHeading()
|
local heading = unit:GetHeading()
|
||||||
local viviheading = (heading+horizontalview)%360
|
local viviheading = (heading+horizontalview)%360
|
||||||
local maxview = self:_GetActualMaxLOSight(unit,viviheading, verticalview,vivioff)
|
local maxview = self:_GetActualMaxLOSight(unit,viviheading, verticalview,vivioff)
|
||||||
return viviheading, verticalview, maxview, not vivioff
|
-- visual skew
|
||||||
|
local factor = 3.15
|
||||||
|
self.GazelleViewFactors = {
|
||||||
|
[1]=1.18,
|
||||||
|
[2]=1.32,
|
||||||
|
[3]=1.46,
|
||||||
|
[4]=1.62,
|
||||||
|
[5]=1.77,
|
||||||
|
[6]=1.85,
|
||||||
|
[7]=2.05,
|
||||||
|
[8]=2.05,
|
||||||
|
[9]=2.3,
|
||||||
|
[10]=2.3,
|
||||||
|
[11]=2.27,
|
||||||
|
[12]=2.27,
|
||||||
|
[13]=2.43,
|
||||||
|
}
|
||||||
|
local lfac = UTILS.Round(maxview,-2)
|
||||||
|
if lfac <= 1300 then
|
||||||
|
factor = self.GazelleViewFactors[lfac/100]
|
||||||
|
maxview = math.ceil((maxview*factor)/100)*100
|
||||||
|
end
|
||||||
|
if maxview > 8000 then maxview = 8000 end
|
||||||
|
return viviheading, verticalview,maxview, not vivioff
|
||||||
end
|
end
|
||||||
return 0,0,0,false
|
return 0,0,0,false
|
||||||
end
|
end
|
||||||
@ -651,6 +674,15 @@ function PLAYERRECCE:_LaseTarget(client,targetset)
|
|||||||
local lasingtime = self.lasingtime or 60
|
local lasingtime = self.lasingtime or 60
|
||||||
local targettype = target:GetTypeName()
|
local targettype = target:GetTypeName()
|
||||||
laser:LaseOn(target,lasercode,lasingtime)
|
laser:LaseOn(target,lasercode,lasingtime)
|
||||||
|
|
||||||
|
local function Shack(dT,client,target,targettype)
|
||||||
|
self:__Shack(-1,client,target,targettype)
|
||||||
|
end
|
||||||
|
|
||||||
|
function laser:OnAfterDestroyed(From,Event,To)
|
||||||
|
Shack(-1,client,target,targettype)
|
||||||
|
end
|
||||||
|
|
||||||
self:__TargetLasing(-1,client,target,lasercode,lasingtime)
|
self:__TargetLasing(-1,client,target,lasercode,lasingtime)
|
||||||
else
|
else
|
||||||
-- still looking at target?
|
-- still looking at target?
|
||||||
@ -659,6 +691,7 @@ function PLAYERRECCE:_LaseTarget(client,targetset)
|
|||||||
-- lost LOS or dead
|
-- lost LOS or dead
|
||||||
--local targettype = oldtarget:GetTypeName()
|
--local targettype = oldtarget:GetTypeName()
|
||||||
laser:LaseOff()
|
laser:LaseOff()
|
||||||
|
self:I(self.lid.."*** Laser off!")
|
||||||
if (not oldtarget:IsAlive()) or (oldtarget:GetLife() < 2) then
|
if (not oldtarget:IsAlive()) or (oldtarget:GetLife() < 2) then
|
||||||
self:__Shack(-1,client,oldtarget)
|
self:__Shack(-1,client,oldtarget)
|
||||||
else
|
else
|
||||||
@ -840,12 +873,13 @@ end
|
|||||||
-- @return #PLAYERRECCE self
|
-- @return #PLAYERRECCE self
|
||||||
function PLAYERRECCE:_UploadTargets(client,group,playername)
|
function PLAYERRECCE:_UploadTargets(client,group,playername)
|
||||||
self:T(self.lid.."_UploadTargets")
|
self:T(self.lid.."_UploadTargets")
|
||||||
local targetset, number = self:_GetTargetSet(client,true)
|
--local targetset, number = self:_GetTargetSet(client,true)
|
||||||
local vtargetset, vnumber = self:_GetTargetSet(client,false)
|
--local vtargetset, vnumber = self:_GetTargetSet(client,false)
|
||||||
local totalset = SET_UNIT:New()
|
local totalset, count = self:_GetKnownTargets(client)
|
||||||
totalset:AddSet(targetset)
|
--local totalset = SET_UNIT:New()
|
||||||
totalset:AddSet(vtargetset)
|
-- totalset:AddSet(targetset)
|
||||||
if totalset:CountAlive() > 0 then
|
--totalset:AddSet(vtargetset)
|
||||||
|
if count > 0 then
|
||||||
self.Controller:AddTarget(totalset)
|
self.Controller:AddTarget(totalset)
|
||||||
self:__TargetReportSent(1,client,playername,totalset)
|
self:__TargetReportSent(1,client,playername,totalset)
|
||||||
end
|
end
|
||||||
@ -1487,8 +1521,9 @@ end
|
|||||||
-- @param #string To
|
-- @param #string To
|
||||||
-- @param Wrapper.Client#CLIENT Client
|
-- @param Wrapper.Client#CLIENT Client
|
||||||
-- @param Wrapper.Unit#UNIT Target
|
-- @param Wrapper.Unit#UNIT Target
|
||||||
|
-- @param #string Targettype
|
||||||
-- @return #PLAYERRECCE self
|
-- @return #PLAYERRECCE self
|
||||||
function PLAYERRECCE:onafterShack(From, Event, To, Client, Target)
|
function PLAYERRECCE:onafterShack(From, Event, To, Client, Target, Targettype)
|
||||||
self:T({From, Event, To})
|
self:T({From, Event, To})
|
||||||
local callsign = Client:GetGroup():GetCustomCallSign(self.ShortCallsign,self.Keepnumber,self.CallsignTranslations)
|
local callsign = Client:GetGroup():GetCustomCallSign(self.ShortCallsign,self.Keepnumber,self.CallsignTranslations)
|
||||||
local Settings = ( Client and _DATABASE:GetPlayerSettings( Client:GetPlayerName() ) ) or _SETTINGS
|
local Settings = ( Client and _DATABASE:GetPlayerSettings( Client:GetPlayerName() ) ) or _SETTINGS
|
||||||
@ -1497,7 +1532,7 @@ function PLAYERRECCE:onafterShack(From, Event, To, Client, Target)
|
|||||||
if self.ReferencePoint then
|
if self.ReferencePoint then
|
||||||
coordtext = coord:ToStringFromRPShort(self.ReferencePoint,self.RPName,Client,Settings)
|
coordtext = coord:ToStringFromRPShort(self.ReferencePoint,self.RPName,Client,Settings)
|
||||||
end
|
end
|
||||||
local targettype = Target:GetTypeName()
|
local targettype = Targettype
|
||||||
if self.AttackSet then
|
if self.AttackSet then
|
||||||
for _,_client in pairs(self.AttackSet.Set) do
|
for _,_client in pairs(self.AttackSet.Set) do
|
||||||
local client = _client --Wrapper.Client#CLIENT
|
local client = _client --Wrapper.Client#CLIENT
|
||||||
@ -1507,16 +1542,16 @@ function PLAYERRECCE:onafterShack(From, Event, To, Client, Target)
|
|||||||
coordtext = coord:ToStringFromRPShort(self.ReferencePoint,self.RPName,client,Settings)
|
coordtext = coord:ToStringFromRPShort(self.ReferencePoint,self.RPName,client,Settings)
|
||||||
end
|
end
|
||||||
local coordtext = coord:ToStringA2G(client,Settings)
|
local coordtext = coord:ToStringA2G(client,Settings)
|
||||||
local text = string.format("All stations, %s lost sight of %s\nat %s!",callsign, targettype, coordtext)
|
local text = string.format("All stations, %s good hit on %s\nat %s!",callsign, targettype, coordtext)
|
||||||
MESSAGE:New(text,15,self.Name or "FACA"):ToClient(client)
|
MESSAGE:New(text,15,self.Name or "FACA"):ToClient(client)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
local text = "Shack!"
|
local text = "Shack!"
|
||||||
local ttstext = "Kaboom!"
|
local ttstext = "Shack!"
|
||||||
if self.UseSRS then
|
if self.UseSRS then
|
||||||
local grp = Client:GetGroup()
|
local grp = Client:GetGroup()
|
||||||
self.SRSQueue:NewTransmission(ttstext,nil,self.SRS,nil,1,{grp},text,10)
|
self.SRSQueue:NewTransmission(ttstext,nil,self.SRS,nil,1)
|
||||||
else
|
else
|
||||||
MESSAGE:New(text,10,self.Name or "FACA"):ToClient(Client)
|
MESSAGE:New(text,10,self.Name or "FACA"):ToClient(Client)
|
||||||
end
|
end
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user