Skip to content

Commit

Permalink
Merge pull request #352 from ciribob/beta
Browse files Browse the repository at this point in the history
Release 1.6.4.0
  • Loading branch information
ciribob authored Oct 12, 2019
2 parents 985dcc3 + 85fe251 commit b715077
Show file tree
Hide file tree
Showing 8 changed files with 182 additions and 21 deletions.
4 changes: 2 additions & 2 deletions DCS-SR-Client/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -52,5 +52,5 @@
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]

[assembly: AssemblyVersion("1.6.3.0")]
[assembly: AssemblyFileVersion("1.6.3.0")]
[assembly: AssemblyVersion("1.6.4.0")]
[assembly: AssemblyFileVersion("1.6.4.0")]
2 changes: 1 addition & 1 deletion DCS-SR-Common/Network/UpdaterChecker.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public class UpdaterChecker

public static readonly string MINIMUM_PROTOCOL_VERSION = "1.6.0.0";

public static readonly string VERSION = "1.6.3.0";
public static readonly string VERSION = "1.6.4.0";

private static readonly Logger _logger = LogManager.GetCurrentClassLogger();

Expand Down
4 changes: 2 additions & 2 deletions DCS-SimpleRadio Server/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -52,5 +52,5 @@
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]

[assembly: AssemblyVersion("1.6.3.0")]
[assembly: AssemblyFileVersion("1.6.3.0")]
[assembly: AssemblyVersion("1.6.4.0")]
[assembly: AssemblyFileVersion("1.6.4.0")]
4 changes: 2 additions & 2 deletions Installer/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -52,5 +52,5 @@
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]

[assembly: AssemblyVersion("1.6.3.0")]
[assembly: AssemblyFileVersion("1.6.3.0")]
[assembly: AssemblyVersion("1.6.4.0")]
[assembly: AssemblyFileVersion("1.6.4.0")]
161 changes: 157 additions & 4 deletions Scripts/DCS-SRS-AutoConnectGameGUI.lua
Original file line number Diff line number Diff line change
@@ -1,15 +1,38 @@
-- Version 1.6.3.0
-- ONLY COPY THIS FILE IS YOU ARE GOING TO HOST A SERVER!
-- Version 1.6.4.0
-- ONLY COPY THIS WHOLE FILE IS YOU ARE GOING TO HOST A SERVER!
-- The file must be in Saved Games\DCS\Scripts\Hooks or Saved Games\DCS.openalpha\Scripts\Hooks
-- Make sure you enter the correct address into SERVER_SRS_HOST below.
-- You can add an optional Port. e.g. "127.0.0.1:5002"
-- You can also enable SRS Chat commands to list frequencies and a message to all
-- non SRS connected users to encourage them to connect

-- User options --
local SRSAuto = {}
SRSAuto.SERVER_SRS_HOST = "127.0.0.1"
SRSAuto.SERVER_SRS_HOST = "127.0.0.1:5002"
SRSAuto.SERVER_SEND_AUTO_CONNECT = true -- set to false to disable auto connect or just remove this file

---- SRS CHAT COMMANDS ----
SRSAuto.CHAT_COMMANDS_ENABLED = false -- if true type -freq, -freqs or -frequencies in ALL chat in multilayer to see the frequencies

SRSAuto.SRS_FREQUENCIES = {
["red"]= "ATC = 124, GCI = 126, Helicopters = 30FM", -- edit this to the red frequency list
["blue"]= "ATC = 251, GCI = 264, Helicopters = 30FM", -- edit this to the blue frequency list
["neutral"]= "" -- edit this to the spectator frequency list
}


---- SRS NUDGE MESSAGE ----
SRSAuto.SRS_NUDGE_ENABLED = false -- set to true to enable the message below
SRSAuto.SRS_NUDGE_TIME = 600 -- SECONDS between messages to non connected SRS users
SRSAuto.SRS_MESSAGE_TIME = 30 -- SECONDS to show the message for
SRSAuto.SRS_NUDGE_PATH = "C:\\Program Files\\DCS-SimpleRadio-Standalone\\clients-list.json" -- path to SERVER JSON EXPORT - enable Auto Export List on the server
--- EDIT the message below to change what is said to users - DONT USE QUOTES - either single or double due to the injection into SRS it'll fail
--- Newlines must be escaped like so: \\\n with 3 backslashes
SRSAuto.SRS_NUDGE_MESSAGE = "****** DCS IS BETTER WITH COMMS - USE SRS ******\\\n\\\nMake sure to install DCS SimpleRadio Standalone - SRS - free and easy to install. \\\n\\\nSRS gives you VOIP Comms with other players through your aircrafts own radios. This will help you to be more effective, find enemies and wingmen, or call in support \\\n\\\n Google: DCS SimpleRadio Standalone \\\n\\\nGood comms and teamwork will help YOU and your team win! "


-- DO NOT EDIT BELOW HERE --

SRSAuto.unicast = true

-- Utils --
Expand All @@ -20,6 +43,9 @@ SRSAuto.MESSAGE_PREFIX = "SRS Running @ " -- DO NOT MODIFY!!!
package.path = package.path..";.\\LuaSocket\\?.lua;"
package.cpath = package.cpath..";.\\LuaSocket\\?.dll;"

local JSON = loadfile("Scripts\\JSON.lua")()
SRSAuto.JSON = JSON

local socket = require("socket")

SRSAuto.UDPSendSocket = socket.udp()
Expand Down Expand Up @@ -56,5 +82,132 @@ SRSAuto.onPlayerChangeSlot = function(id)
end
end

SRSAuto.trimStr = function(_str)
return string.format("%s", _str:match("^%s*(.-)%s*$"))
end

SRSAuto.onChatMessage = function(message, playerID)
local _msg = string.lower(SRSAuto.trimStr(message))

if _msg == "-freq" or _msg == "-frequencies" or _msg == "-freqs" then

local _player = net.get_player_info(playerID)

local _freq = ""

if _player.coa == 0 then
_freq = SRSAuto.SRS_FREQUENCIES.neutral
elseif _player.coa == 1 then
_freq = SRSAuto.SRS_FREQUENCIES.red
else
_freq = SRSAuto.SRS_FREQUENCIES.blue
end

local _chatMessage = string.format("*** SRS: %s ***",_freq)
net.send_chat_to(_chatMessage, _player.id)
return
end
end

local _lastSent = 0

SRSAuto.onSimulationFrame = function()

if SRSAuto.SRS_NUDGE_ENABLED then

if not DCS.isServer() then
return
end

local _now = os.time()

-- send every 5 seconds
if _now > _lastSent + SRSAuto.SRS_NUDGE_TIME then
_lastSent = _now

SRSAuto.srsNudge()
end
end
end

SRSAuto.readFile = function (path)
local file = io.open(path, "rb") -- r read mode and b binary mode
if not file then return nil end
local content = file:read "*a" -- *a or *all reads the whole file
file:close()
return content
end

SRSAuto.srsNudge = function()

SRSAuto.log("SRS NUDGE Running")

local _status, _result = pcall(function()

local _playerByName = {}
for _,v in pairs(net.get_player_list()) do

local _player = net.get_player_info(v)
if _player.id ~= 1 then
--filter server owner / user
if _player.side ~= 0 then

_playerByName[_player.name] = _player
--SRSAuto.log("SRS NUDGE - Added ".._player.name)

end
end
end
local fileContent = SRSAuto.readFile(SRSAuto.SRS_NUDGE_PATH);

local srs = {}
srs = SRSAuto.JSON:decode(fileContent)

if srs then
-- loop through SRS and remove players
for _,_srsPlayer in pairs(srs) do
_playerByName[_srsPlayer.Name] = nil
--SRSAuto.log("SRS NUDGE - Removed ".._srsPlayer.Name)
end

-- loop through remaining and nudge
for _name,_player in pairs(_playerByName) do

local _group = DCS.getUnitProperty(_player.slot, DCS.UNIT_GROUP_MISSION_ID)

if _group then

SRSAuto.log("SRS NUDGE - Messaging ".._player.name)
SRSAuto.sendMessage(SRSAuto.SRS_NUDGE_MESSAGE,SRSAuto.SRS_MESSAGE_TIME,_group)

end
end
end
end)

if not _status then
SRSAuto.log('ERROR: ' .. _result)
end



end

SRSAuto.sendMessage = function(msg, showTime, gid)
if gid then
local str = "trigger.action.outTextForGroup(" .. gid .. ",'" .. msg .. "'," .. showTime .. ",true); return true;"
local _status, _error = net.dostring_in('server', str)
if not _status and _error then
SRSAuto.log("Error! " .. _error)
end
else
local str = "trigger.action.outText('" .. msg .. "'," .. showTime .. ",true); return true;"
local _status, _error = net.dostring_in('server', str)
if not _status and _error then
SRSAuto.log("Error! " .. _error)
end
end
end

DCS.setUserCallbacks(SRSAuto)
net.log("Loaded - DCS-SRS-AutoConnect1.6.3.0")
net.log("Loaded - DCS-SRS-AutoConnect1.6.4.0")
4 changes: 2 additions & 2 deletions Scripts/DCS-SRS-OverlayGameGUI.lua
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
-- Version 1.6.3.0
-- Version 1.6.4.0
-- Make sure you COPY this file to the same location as the Export.lua as well!
-- Otherwise the Overlay will not work

Expand Down Expand Up @@ -479,4 +479,4 @@ end

DCS.setUserCallbacks(srsOverlay)

net.log("Loaded - DCS-SRS Overlay GameGUI - Ciribob - 1.6.3.0 ")
net.log("Loaded - DCS-SRS Overlay GameGUI - Ciribob - 1.6.4.0 ")
4 changes: 2 additions & 2 deletions Scripts/DCS-SRSGameGUI.lua
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
-- Version 1.6.3.0
-- Version 1.6.4.0
-- Make sure you COPY this file to the same location as the Export.lua as well!
-- Otherwise the Radio Might not work

Expand Down Expand Up @@ -127,4 +127,4 @@ end

DCS.setUserCallbacks(SRS)

net.log("Loaded - DCS-SRS GameGUI - Ciribob -1.6.3.0")
net.log("Loaded - DCS-SRS GameGUI - Ciribob -1.6.4.0")
20 changes: 14 additions & 6 deletions Scripts/DCS-SimpleRadioStandalone.lua
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
-- Version 1.6.3.0
-- Version 1.6.4.0
-- Special thanks to Cap. Zeen, Tarres and Splash for all the help
-- with getting the radio information :)
-- Add (without the --) To the END OF your Export.lua to enable Simple Radio Standalone :
Expand Down Expand Up @@ -1301,6 +1301,14 @@ function SR.exportRadioF16C(_data)
end
end

local _cipherOnly = SR.round(SR.getButtonPosition(443),1) < -0.5 --If HOT MIC CIPHER Switch, HOT MIC / OFF / CIPHER set to CIPHER, allow only cipher
if _cipherOnly and _data.radios[3].enc ~=true then
_data.radios[3].freq = 0
end
if _cipherOnly and _data.radios[2].enc ~=true then
_data.radios[2].freq = 0
end

_data.control = 0; -- SRS Hotas Controls

return _data
Expand Down Expand Up @@ -1746,7 +1754,7 @@ function SR.exportRadioC101EB(_data)
local _selector = SR.getSelectorPosition(232, 0.25)

if _selector ~= 0 then
_data.radios[2].freq = SR.getRadioFrequency(10)
_data.radios[2].freq = SR.getRadioFrequency(11)
else
_data.radios[2].freq = 1
end
Expand All @@ -1760,7 +1768,7 @@ function SR.exportRadioC101EB(_data)
_data.radios[3].modulation = 0
_data.radios[3].volume = SR.getRadioVolume(0, 412, { 0.0, 1.0 }, false)

_data.radios[3].freq = SR.getRadioFrequency(9)
_data.radios[3].freq = SR.getRadioFrequency(10)

local _selector = SR.getSelectorPosition(404, 0.5)

Expand Down Expand Up @@ -1789,7 +1797,7 @@ function SR.exportRadioC101CC(_data)
_data.radios[1].volume = SR.getRadioVolume(0, 403, { 0.0, 1.0 }, false)

_data.radios[2].name = "V/TVU-740"
_data.radios[2].freq = SR.getRadioFrequency(10)
_data.radios[2].freq = SR.getRadioFrequency(11)
_data.radios[2].modulation = 0
_data.radios[2].volume = 1.0--SR.getRadioVolume(0, 234,{0.0,1.0},false)
_data.radios[2].volMode = 1
Expand Down Expand Up @@ -1817,7 +1825,7 @@ function SR.exportRadioC101CC(_data)
--local _vhfPower = SR.getSelectorPosition(413,1.0)
--
--if _vhfPower == 1 then
_data.radios[3].freq = SR.getRadioFrequency(9)
_data.radios[3].freq = SR.getRadioFrequency(10)
--else
-- _data.radios[3].freq = 1
--end
Expand Down Expand Up @@ -2213,4 +2221,4 @@ function SR.nearlyEqual(a, b, diff)
return math.abs(a - b) < diff
end

SR.log("Loaded SimpleRadio Standalone Export version:1.6.3.0")
SR.log("Loaded SimpleRadio Standalone Export version:1.6.4.0")

0 comments on commit b715077

Please sign in to comment.