mirror of
https://github.com/weyne85/DML.git
synced 2025-10-29 16:57:49 +00:00
Version 1.3.2
Sitting Ducks PlayerScore improvements Colors for Owned Zones
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
cfxPlayerScoreUI = {}
|
||||
cfxPlayerScoreUI.version = "2.0.1"
|
||||
cfxPlayerScoreUI.version = "2.1.0"
|
||||
cfxPlayerScoreUI.verbose = false
|
||||
|
||||
--[[-- VERSION HISTORY
|
||||
@@ -7,11 +7,22 @@ cfxPlayerScoreUI.verbose = false
|
||||
- 1.0.3 - module check
|
||||
- 2.0.0 - removed cfxPlayer dependency, handles own commands
|
||||
- 2.0.1 - late start capability
|
||||
- 2.1.0 - soundfile cleanup
|
||||
- score summary for side
|
||||
- allowAll
|
||||
|
||||
--]]--
|
||||
|
||||
cfxPlayerScoreUI.requiredLibs = {
|
||||
"dcsCommon", -- this is doing score keeping
|
||||
"cfxZones", -- zones for config
|
||||
"cfxPlayerScore",
|
||||
}
|
||||
cfxPlayerScoreUI.soundFile = "Quest Snare 3.wav"
|
||||
cfxPlayerScoreUI.rootCommands = {} -- by unit's GROUP name, for player aircraft
|
||||
cfxPlayerScoreUI.allowAll = true
|
||||
cfxPlayerScoreUI.ranked = true
|
||||
|
||||
-- redirect: avoid the debug environ of missionCommand
|
||||
-- redirect: avoid the debug environ of missionCommands
|
||||
function cfxPlayerScoreUI.redirectCommandX(args)
|
||||
timer.scheduleFunction(cfxPlayerScoreUI.doCommandX, args, timer.getTime() + 0.1)
|
||||
end
|
||||
@@ -22,14 +33,24 @@ function cfxPlayerScoreUI.doCommandX(args)
|
||||
local what = args[3] -- "score" or other commands
|
||||
local theGroup = Group.getByName(groupName)
|
||||
local gid = theGroup:getID()
|
||||
local coa = theGroup:getCoalition()
|
||||
|
||||
if not cfxPlayerScore.scoreTextForPlayerNamed then
|
||||
trigger.action.outText("***pSGUI: CANNOT FIND PlayerScore MODULE", 30)
|
||||
return
|
||||
end
|
||||
local desc = cfxPlayerScore.scoreTextForPlayerNamed(playerName)
|
||||
local desc = ""
|
||||
if what == "score" then
|
||||
desc = cfxPlayerScore.scoreTextForPlayerNamed(playerName)
|
||||
elseif what == "allMySide" then
|
||||
desc = cfxPlayerScore.scoreSummaryForPlayersOfCoalition(coa)
|
||||
elseif what == "all" then
|
||||
desc = "Score Table For All Players:\n" .. cfxPlayerScore.scoreTextForAllPlayers(cfxPlayerScoreUI.ranked)
|
||||
else
|
||||
desc = "PlayerScore UI: unknown command <" .. what .. ">"
|
||||
end
|
||||
trigger.action.outTextForGroup(gid, desc, 30)
|
||||
trigger.action.outSoundForGroup(gid, "Quest Snare 3.wav")
|
||||
trigger.action.outSoundForGroup(gid, cfxPlayerScoreUI.soundFile)
|
||||
end
|
||||
|
||||
--
|
||||
@@ -59,8 +80,18 @@ function cfxPlayerScore.processPlayerUnit(theUnit)
|
||||
-- we need to install a group menu item for scores.
|
||||
-- will persist through death
|
||||
local commandTxt = "Show Score / Kills"
|
||||
local theCommand = missionCommands.addCommandForGroup(gid, commandTxt, nil, cfxPlayerScoreUI.redirectCommandX, {groupName, playerName, "score"} )
|
||||
cfxPlayerScoreUI.rootCommands[groupName] = theCommand
|
||||
local theMenu = missionCommands.addSubMenuForGroup(gid, "Show Score", nil)
|
||||
local theCommand = missionCommands.addCommandForGroup(gid, commandTxt, theMenu, cfxPlayerScoreUI.redirectCommandX, {groupName, playerName, "score"})
|
||||
|
||||
commandTxt = "Show my Side Score / Kills"
|
||||
theCommand = missionCommands.addCommandForGroup(gid, commandTxt, theMenu, cfxPlayerScoreUI.redirectCommandX, {groupName, playerName, "allMySide"})
|
||||
|
||||
if cfxPlayerScoreUI.allowAll then
|
||||
commandTxt = "Show All Player Scores"
|
||||
theCommand = missionCommands.addCommandForGroup(gid, commandTxt, theMenu, cfxPlayerScoreUI.redirectCommandX, {groupName, playerName, "all"})
|
||||
end
|
||||
|
||||
cfxPlayerScoreUI.rootCommands[groupName] = theMenu
|
||||
|
||||
if cfxPlayerScoreUI.verbose then
|
||||
trigger.action.outText("++pSGui: installed player score menu for group <" .. groupName .. ">", 30)
|
||||
@@ -78,6 +109,9 @@ end
|
||||
-- Start
|
||||
--
|
||||
function cfxPlayerScoreUI.start()
|
||||
if not dcsCommon.libCheck("cfx Player Score UI",
|
||||
cfxPlayerScoreUI.requiredLibs)
|
||||
then return false end
|
||||
-- install the event handler for new player planes
|
||||
world.addEventHandler(cfxPlayerScoreUI)
|
||||
-- process all existing players (late start)
|
||||
|
||||
Reference in New Issue
Block a user