#PSEUDOATC

* Fix for debug messages
This commit is contained in:
Applevangelist 2023-01-10 07:49:02 +01:00
commit a7bad8e9f4

View File

@ -100,7 +100,7 @@ PSEUDOATC.id="PseudoATC | "
--- PSEUDOATC version. --- PSEUDOATC version.
-- @field #number version -- @field #number version
PSEUDOATC.version="0.9.3" PSEUDOATC.version="0.9.4"
----------------------------------------------------------------------------------------------------------------------------------------- -----------------------------------------------------------------------------------------------------------------------------------------
@ -450,14 +450,18 @@ function PSEUDOATC:PlayerLanded(unit, place)
local group=unit:GetGroup() local group=unit:GetGroup()
local GID=group:GetID() local GID=group:GetID()
local UID=unit:GetDCSObject():getID() local UID=unit:GetDCSObject():getID()
local PlayerName=self.group[GID].player[UID].playername --local PlayerName=self.group[GID].player[UID].playername
local UnitName=self.group[GID].player[UID].unitname --local UnitName=self.group[GID].player[UID].unitname
local GroupName=self.group[GID].player[UID].groupname --local GroupName=self.group[GID].player[UID].groupname
local PlayerName = unit:GetPlayerName() or "Ghost"
-- Debug message. local UnitName = unit:GetName() or "Ghostplane"
local text=string.format("Player %s in unit %s of group %s (id=%d) landed at %s.", PlayerName, UnitName, GroupName, GID, place) local GroupName = group:GetName() or "Ghostgroup"
self:T(PSEUDOATC.id..text) if self.Debug then
MESSAGE:New(text, 30):ToAllIf(self.Debug) -- Debug message.
local text=string.format("Player %s in unit %s of group %s landed at %s.", PlayerName, UnitName, GroupName, place)
self:T(PSEUDOATC.id..text)
MESSAGE:New(text, 30):ToAllIf(self.Debug)
end
-- Stop altitude reporting timer if its activated. -- Stop altitude reporting timer if its activated.
self:AltitudeTimerStop(GID,UID) self:AltitudeTimerStop(GID,UID)
@ -479,24 +483,28 @@ function PSEUDOATC:PlayerTakeOff(unit, place)
-- Gather some information. -- Gather some information.
local group=unit:GetGroup() local group=unit:GetGroup()
local GID=group:GetID() --local GID=group:GetID()
local UID=unit:GetDCSObject():getID() --local UID=unit:GetDCSObject():getID()
local PlayerName=self.group[GID].player[UID].playername --local PlayerName=self.group[GID].player[UID].playername
local CallSign=self.group[GID].player[UID].callsign --local CallSign=self.group[GID].player[UID].callsign
local UnitName=self.group[GID].player[UID].unitname --local UnitName=self.group[GID].player[UID].unitname
local GroupName=self.group[GID].player[UID].groupname --local GroupName=self.group[GID].player[UID].groupname
local PlayerName = unit:GetPlayerName() or "Ghost"
-- Debug message. local UnitName = unit:GetName() or "Ghostplane"
local text=string.format("Player %s in unit %s of group %s (id=%d) took off at %s.", PlayerName, UnitName, GroupName, GID, place) local GroupName = group:GetName() or "Ghostgroup"
self:T(PSEUDOATC.id..text) local CallSign = unit:GetCallsign() or "Ghost11"
MESSAGE:New(text, 30):ToAllIf(self.Debug) if self.Debug then
-- Debug message.
local text=string.format("Player %s in unit %s of group %s took off at %s.", PlayerName, UnitName, GroupName, place)
self:T(PSEUDOATC.id..text)
MESSAGE:New(text, 30):ToAllIf(self.Debug)
end
-- Bye-Bye message. -- Bye-Bye message.
if place and self.chatty then if place and self.chatty then
local text=string.format("%s, %s, you are airborne. Have a safe trip!", place, CallSign) local text=string.format("%s, %s, you are airborne. Have a safe trip!", place, CallSign)
if self.reportplayername then if self.reportplayername then
text=string.format("%s, %s, you are airborne. Have a safe trip!", place, PlayerName) text=string.format("%s, %s, you are airborne. Have a safe trip!", place, PlayerName)
end end
MESSAGE:New(text, self.mdur):ToGroup(group) MESSAGE:New(text, self.mdur):ToGroup(group)
end end
@ -870,8 +878,8 @@ function PSEUDOATC:ReportHeight(GID, UID, dt, _clear)
-- Message text. -- Message text.
local _text=string.format("%s, your altitude is %s AGL.", callsign, Hs) local _text=string.format("%s, your altitude is %s AGL.", callsign, Hs)
if self.reportplayername then if self.reportplayername then
_text=string.format("%s, your altitude is %s AGL.", PlayerName, Hs) _text=string.format("%s, your altitude is %s AGL.", PlayerName, Hs)
end end
-- Append flight level. -- Append flight level.
if _clear==false then if _clear==false then
_text=_text..string.format(" FL%03d.", position.y/30.48) _text=_text..string.format(" FL%03d.", position.y/30.48)