Skip to content

Commit

Permalink
initial version
Browse files Browse the repository at this point in the history
  • Loading branch information
jamerlan committed Jan 10, 2015
1 parent 0bf766e commit 14ed28a
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions mute_game_spec.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
function widget:GetInfo()
return {
name = "Mute Game Spec v1",
desc = "Disables sound when you start spectating battle (you can enable with F6)",
author = "[teh]decay aka [teh]undertaker aka [DoR]Saruman",
date = "10 jan 2015",
license = "The BSD License",
layer = 0,
version = 1,
enabled = true -- loaded by default
}
end


-- project page on github: https://github.com/SpringWidgets/mute-game-spec

--Changelog
-- v2


local spGetMyPlayerID = Spring.GetMyPlayerID
local spGetPlayerInfo = Spring.GetPlayerInfo
local spSendCommands = Spring.SendCommands

function widget:Initialize()
local playerID = spGetMyPlayerID()
local _, _, spec, _, _, _, _, _ = spGetPlayerInfo(playerID)

if ( spec == true ) then
spSendCommands("mutesound")
end

widgetHandler:RemoveWidget()
end

0 comments on commit 14ed28a

Please sign in to comment.