#CTLD Fix for Beacon Zone disappearing too fast

This commit is contained in:
Applevangelist 2022-12-03 14:37:01 +01:00
parent 37b1e7366c
commit 508e36d327

View File

@ -3522,7 +3522,12 @@ function CTLD:AddCTLDZone(Name, Type, Color, Active, HasBeacon, Shiplength, Ship
ctldzone.name = Name or "NONE" ctldzone.name = Name or "NONE"
ctldzone.type = Type or CTLD.CargoZoneType.MOVE -- #CTLD.CargoZoneType ctldzone.type = Type or CTLD.CargoZoneType.MOVE -- #CTLD.CargoZoneType
ctldzone.hasbeacon = HasBeacon or false ctldzone.hasbeacon = HasBeacon or false
if Type == CTLD.CargoZoneType.BEACON then
self.droppedbeaconref[ctldzone.name] = zone:GetCoordinate()
ctldzone.timestamp = timer.getTime()
end
if HasBeacon then if HasBeacon then
ctldzone.fmbeacon = self:_GetFMBeacon(Name) ctldzone.fmbeacon = self:_GetFMBeacon(Name)
ctldzone.uhfbeacon = self:_GetUHFBeacon(Name) ctldzone.uhfbeacon = self:_GetUHFBeacon(Name)
@ -3611,7 +3616,7 @@ function CTLD:CheckDroppedBeacons()
for _,_beacon in pairs (self.droppedBeacons) do for _,_beacon in pairs (self.droppedBeacons) do
local beacon = _beacon -- #CTLD.CargoZone local beacon = _beacon -- #CTLD.CargoZone
if not beacon.timestamp then beacon.timestamp = timer.getTime() end if not beacon.timestamp then beacon.timestamp = timer.getTime() + timeout end
local T0 = beacon.timestamp local T0 = beacon.timestamp
if timer.getTime() - T0 > timeout then if timer.getTime() - T0 > timeout then
local name = beacon.name local name = beacon.name
@ -3686,15 +3691,19 @@ function CTLD:_AddRadioBeacon(Name, Sound, Mhz, Modulation, IsShip, IsDropped)
if IsDropped and Zone then if IsDropped and Zone then
local ZoneCoord = Zone local ZoneCoord = Zone
local ZoneVec3 = ZoneCoord:GetVec3() local ZoneVec3 = ZoneCoord:GetVec3()
local Frequency = Mhz * 1000000 -- Freq in Hertz local Frequency = string.format("%09d",Mhz * 1000000) -- Freq in Hertz
local Sound = "l10n/DEFAULT/"..Sound local Sound = "l10n/DEFAULT/"..Sound
trigger.action.radioTransmission(Sound, ZoneVec3, Modulation, false, Frequency, 1000) -- Beacon in MP only runs for 30secs straight trigger.action.radioTransmission(Sound, ZoneVec3, Modulation, false, Frequency, 1000) -- Beacon in MP only runs for 30secs straight
--local status = string.format("***** Beacon added Freq %s Mod %s", Mhz, UTILS.GetModulationName(Modulation))
--MESSAGE:New(status,10,"Debug"):ToLogIf(self.debug)
elseif Zone then elseif Zone then
local ZoneCoord = Zone:GetCoordinate(2) local ZoneCoord = Zone:GetCoordinate(2)
local ZoneVec3 = ZoneCoord:GetVec3() local ZoneVec3 = ZoneCoord:GetVec3()
local Frequency = Mhz * 1000000 -- Freq in Hertz local Frequency = string.format("%09d",Mhz * 1000000) -- Freq in Hertz
local Sound = "l10n/DEFAULT/"..Sound local Sound = "l10n/DEFAULT/"..Sound
trigger.action.radioTransmission(Sound, ZoneVec3, Modulation, false, Frequency, 1000) -- Beacon in MP only runs for 30secs straight trigger.action.radioTransmission(Sound, ZoneVec3, Modulation, false, Frequency, 1000) -- Beacon in MP only runs for 30secs straight
--local status = string.format("***** Beacon added Freq %s Mod %s", Mhz, UTILS.GetModulationName(Modulation))
--MESSAGE:New(status,10,"Debug"):ToLogIf(self.debug)
end end
return self return self
end end