- motd will not be logged to chat log

- mission data will be added to json
This commit is contained in:
Szymon Porwolik
2019-02-24 00:15:08 +01:00
parent 5d415812fa
commit 3512f7f5cf

View File

@@ -16,9 +16,10 @@
-- ########### END OF SETTINGS ########### -- ########### END OF SETTINGS ###########
-- Variable init -- Variable init
Perun.Version = "v0.3.0" Perun.Version = "v0.3.1"
Perun.StatusData = {} Perun.StatusData = {}
Perun.SlotsData = {} Perun.SlotsData = {}
Perun.MissionData = {}
Perun.VersionData = {} Perun.VersionData = {}
Perun.lastSent =0 Perun.lastSent =0
Perun.JsonLocation = lfs.writedir() .. Perun.JsonLocation Perun.JsonLocation = lfs.writedir() .. Perun.JsonLocation
@@ -40,6 +41,7 @@
TempData["1"]=Perun.VersionData TempData["1"]=Perun.VersionData
TempData["2"]=Perun.StatusData TempData["2"]=Perun.StatusData
TempData["3"]=Perun.SlotsData TempData["3"]=Perun.SlotsData
TempData["4"]=Perun.MissionData
io.open(Perun.JsonLocation,"w"):close() io.open(Perun.JsonLocation,"w"):close()
perun_export = io.open(Perun.JsonLocation, "w") perun_export = io.open(Perun.JsonLocation, "w")
@@ -97,10 +99,10 @@
Perun.Send(2,Perun.StatusData) Perun.Send(2,Perun.StatusData)
end end
Perun.UpdateMission = function() Perun.UpdateSlots = function()
-- Main function for mission information updates -- Main function for slot
-- Update Mission data -- Update slots data
Perun.SlotsData['coalitions']=DCS.getAvailableCoalitions() Perun.SlotsData['coalitions']=DCS.getAvailableCoalitions()
Perun.SlotsData['slots']={} Perun.SlotsData['slots']={}
@@ -111,6 +113,16 @@
Perun.Send(3,Perun.SlotsData) Perun.Send(3,Perun.SlotsData)
end end
Perun.UpdateMission = function()
-- Main function for mission information updates
-- Update Mission data
Perun.MissionData=DCS.getCurrentMission()
-- Send
-- Perun.Send(4,Perun.MissionData)
end
Perun.LogChat = function(playerID,msg,all) Perun.LogChat = function(playerID,msg,all)
-- Log chat messages -- Log chat messages
@@ -139,16 +151,17 @@
if _now > Perun.lastSent + Perun.Refresh then if _now > Perun.lastSent + Perun.Refresh then
Perun.lastSent = _now Perun.lastSent = _now
Perun.UpdateMission() Perun.UpdateSlots()
Perun.UpdateStatus() Perun.UpdateStatus()
Perun.UpdateVersion() Perun.UpdateVersion()
Perun.UpdateMission()
Perun.UpdateJson() Perun.UpdateJson()
end end
end end
Perun.onMissionLoadEnd = function() Perun.onMissionLoadEnd = function()
Perun.UpdateMission() Perun.UpdateSlots()
Perun.UpdateJson() Perun.UpdateJson()
end end
@@ -158,7 +171,10 @@
end end
Perun.onPlayerTrySendChat = function (playerID, msg, all) Perun.onPlayerTrySendChat = function (playerID, msg, all)
Perun.LogChat(playerID,msg,all) if msg~=Perun.MOTD_L1 and msg~=Perun.MOTD_L2 then
Perun.LogChat(playerID,msg,all)
end
return msg return msg
end end