Permalink
Browse files

disabled shieldsphere/jitter on emp, updated/fixes to gadgetprofiler/…

…options/playercolorpalette/playerlist/lockcamera
  • Loading branch information...
Ruwetuin committed Jan 9, 2018
1 parent 468d308 commit efd615db345e0a909a0df669b28c4716f3d0fe86
@@ -216,7 +216,7 @@ else
if (not profile_unsynced) then
UpdateDrawCallin()
UpdateDrawCallin()
--UpdateDrawCallin() -- not sure why they added this line a 2nd time
startTimer = Spring.GetTimer()
StartHook()
profile_unsynced = true
@@ -232,7 +232,7 @@ else
startTimerSYNCED = Spring.GetTimer()
profile_synced = true
UpdateDrawCallin()
UpdateDrawCallin()
--UpdateDrawCallin() -- not sure why they added this line a 2nd time
end
end
local show = true
@@ -241,9 +241,13 @@ else
Start(cmd, msg, words, playerID)
StartSYNCED(cmd, msg, words, playerID)
end
local function Hide(cmd, msg, words, playerID)
show = false
end
local function Show(cmd, msg, words, playerID)
show = true
end
local timers = {}
@@ -275,6 +279,7 @@ else
gadgetHandler.actionHandler.AddChatAction(gadget, 'profile', StartSYNCED,"")
gadgetHandler.actionHandler.AddChatAction(gadget, 'ap', StartBoth,"")
gadgetHandler.actionHandler.AddChatAction(gadget, 'hideprofile', Hide,"")
gadgetHandler.actionHandler.AddChatAction(gadget, 'showprofile', Show,"")
--StartHook()
end
@@ -304,7 +309,7 @@ local function SortFunc(a,b)
--end
end
function gadget:DrawScreen()
function gadget:DrawScreen_()
if not show then return end
if not (next(callinTimes)) then
--Spring.Echo("no callin times in profiler!")
@@ -213,8 +213,8 @@ local myLastCameraState
--------------------------------------------------------------------------------
local playSounds = true
local buttonclick = LUAUI_DIRNAME .. 'Sounds/buildbar_waypoint.wav'
local sliderdrag = LUAUI_DIRNAME .. 'Sounds/buildbar_rem.wav'
local buttonclick = 'LuaUI/Sounds/buildbar_waypoint.wav'
local sliderdrag = 'LuaUI/Sounds/buildbar_rem.wav'
local lastActivity = {}
local lastFpsData = {}
@@ -703,7 +703,7 @@ function SystemEvent(playerID, system)
local lines, length = 0, 0
local function helper(line) lines=lines+1; if string.len(line) then length = string.len(line) end return "" end
helper((system:gsub("(.-)\r?\n", helper)))
if lines <= 7 and length <= 60 then
if lines <= 9 and length <= 64 then
lastSystemData[playerID] = system
end
end
@@ -747,7 +747,7 @@ end]]--
function widget:Initialize()
--widgetHandler:RegisterGlobal('getPlayerScores', RecvPlayerScores)
widgetHandler:RegisterGlobal('CameraBroadcastEvent', CameraBroadcastEvent)
widgetHandler:RegisterGlobal('CameraBroadcastEvent', CameraBroadcastEvent)
widgetHandler:RegisterGlobal('ActivityEvent', ActivityEvent)
widgetHandler:RegisterGlobal('FpsEvent', FpsEvent)
widgetHandler:RegisterGlobal('SystemEvent', SystemEvent)
@@ -797,7 +797,7 @@ function widget:Initialize()
end
WG['advplayerlist_api'].SetLockPlayerID = function(playerID)
if playerID ~= nil then
lockPlayerID = lockPlayerID
lockPlayerID = playerID
else
lockPlayerID = nil
if myLastCameraState ~= nil then
@@ -3501,4 +3501,4 @@ function widget:MapDrawCmd(playerID, cmdType, px, py, pz) -- get the p
--mapDrawNicknameTime[playerID] = osClock
--AddCommandSpotter('map_draw', x, y, z, osClock, false, playerID)
end
end
end
@@ -64,8 +64,8 @@ local volume
function widget:Initialize()
updatePosition()
WG['locakcamerainfo'] = {}
WG['locakcamerainfo'].GetPosition = function()
WG['lockcamerainfo'] = {}
WG['lockcamerainfo'].GetPosition = function()
return {top,left,bottom,right,widgetScale}
end
Spring.SendCommands("fps 0")
@@ -477,7 +477,7 @@ function DrawWindow()
local drawColumnPos = 1
if totalColumns == 0 or maxColumnRows == 0 then
maxColumnRows = math.floor((y-yPosMax+oPadding) / (oHeight+oPadding+oPadding))
totalColumns = 1 + math.floor(#options / maxColumnRows)
totalColumns = math.ceil(#options / maxColumnRows)
end
optionButtons = {}
optionHover = {}
@@ -899,6 +899,14 @@ function applyOptionValue(i, skipRedrawWindow)
if WG['red_buildmenu'] ~= nil then
WG['red_buildmenu'].setConfigUnitBigTooltip(options[i].value)
end
elseif id == 'sameteamcolors' then
if widgetHandler.configData["Player Color Palette"] == nil then
widgetHandler.configData["Player Color Palette"] = {}
end
widgetHandler.configData["Player Color Palette"].useSameTeamColors = options[i].value
if WG['playercolorpalette'] ~= nil then
WG['playercolorpalette'].setSameTeamColors(options[i].value)
end
elseif id == 'bloomhighlights' then
if widgetHandler.configData["Bloom Shader"] == nil then
widgetHandler.configData["Bloom Shader"] = {}
@@ -1732,6 +1740,8 @@ function init()
-- UI
{id="teamcolors", group="ui", widget="Player Color Palette", name="Team colors based on a palette", type="bool", value=GetWidgetToggleValue("Player Color Palette"), description='Replaces lobby team colors for a color palette based one\n\nNOTE: reloads all widgets because these need to update their teamcolors'},
--{id="sameteamcolors", group="ui", name=widgetOptionColor.." same team colors", type="bool", value=(WG['playercolorpalette']~=nil and WG['playercolorpalette'].getSameTeamColors~=nil and WG['playercolorpalette'].getSameTeamColors()), description='Use the same teamcolor for all the players in a team\n\nNOTE: reloads all widgets because these need to update their teamcolors'},
{id="autoquit", group="ui", widget="Autoquit", name="Auto quit", type="bool", value=GetWidgetToggleValue("Autoquit"), description='Automatically quits after the game ends.\n...unless the mouse has been moved within a few seconds.'},
{id="guishader", group="ui", widget="GUI-Shader", name="GUI blur shader", type="bool", value=GetWidgetToggleValue("GUI-Shader"), description='Blurs the world under every user interface element\n\nIntel Graphics have trouble with this'},
@@ -1753,7 +1763,7 @@ function init()
--{id="fancyselunits", group="gfx", widget="Fancy Selected Units", name="Fancy Selected Units", type="bool", value=GetWidgetToggleValue("Fancy Selected Units"), description=''},
--{id="fpstimespeed", group="ui", name="Display FPS, GameTime and Speed", type="bool", value=tonumber(Spring.GetConfigInt("ShowFPS",1) or 1) == 1, description='Located at the top right of the screen\n\nIndividually toggle them with /fps /clock /speed'},
{id="fpstimespeed-widget", group="ui", widget="AdvPlayersList info", name="Time/speed/fps on top of playerlist", type="bool", value=GetWidgetToggleValue("AdvPlayersList info"), description='Shows time, gamespeed and fps on top of the (adv)playerslist'},
{id="fpstimespeed-widget", group="ui", widget="AdvPlayersList info", name="Playerlist time/speed/fps", type="bool", value=GetWidgetToggleValue("AdvPlayersList info"), description='Shows time, gamespeed and fps on top of the (adv)playerslist'},
{id="mascotte", group="ui", widget="AdvPlayersList mascotte", name="Playerlist mascotte", type="bool", value=GetWidgetToggleValue("AdvPlayersList mascotte"), description='Shows a mascotte on top of the (adv)playerslist'},
{id="displaydps", group="ui", widget="Display DPS", name="Display DPS", type="bool", value=GetWidgetToggleValue("Display DPS"), description='Display the \'Damage Per Second\' done where target are hit'},
@@ -1861,6 +1871,9 @@ function init()
options[getOptionByID('buildmenubigtooltip')] = nil
end
if WG['playercolorpalette'] == nil or WG['playercolorpalette'].getSameTeamColors == nil then
options[getOptionByID('sameteamcolors')] = nil
end
if widgetHandler.knownWidgets["Light Effects"] == nil or widgetHandler.knownWidgets["Deferred rendering"] == nil then
options[getOptionByID('lighteffects')] = nil
options[getOptionByID("lighteffects_brightness")] = nil
@@ -1980,7 +1993,7 @@ function widget:Shutdown()
end
if windowList then
glDeleteList(windowList)
end
end
WG['options'] = nil
end
@@ -12,6 +12,7 @@ end
local randomize = false -- randomize player colors
local offsetstartcolor = true -- when false it will always use red as start color, when true it starts with an offset towards center of rgb hue palette more in effect with small playernumbers
local useSameTeamColors = false
local GaiaTeam = Spring.GetGaiaTeamID()
local GaiaTeamColor = {255,0,0 }
@@ -122,21 +123,29 @@ end
local function SetNewTeamColors()
local allyTeamList = Spring.GetAllyTeamList()
local numteams = #Spring.GetTeamList() - 1 -- minus gaia
--local numallyteams = #Spring.GetAllyTeamList() - 1 -- minus gaia
local numallyteams = #Spring.GetAllyTeamList() - 1 -- minus gaia
colorOrder = {}
local i = 0
local r,g,b
for _, allyID in ipairs(allyTeamList) do
if useSameTeamColors then
i = i + 1
end
for _, teamID in ipairs(Spring.GetTeamList(allyID)) do
if teamID == GaiaTeam then
Spring.SetTeamColor(teamID, GaiaTeamColor[1],GaiaTeamColor[2],GaiaTeamColor[3])
else
if randomize then
i = GetShuffledNumber(i, numteams)
if not useSameTeamColors then
if randomize then
i = GetShuffledNumber(i, numteams)
else
i = i + 1
end
r,g,b = GetColor(i, numteams)
else
i = i + 1
r,g,b = GetColor(i, numallyteams)
end
local r,g,b = GetColor(i, numteams, numallyteams)
local _, playerID = Spring.GetTeamInfo(teamID)
local name = playerID and Spring.GetPlayerInfo(playerID) or 'noname'
@@ -171,14 +180,22 @@ function shufflecolors(_,_,params)
end
function widget:Initialize()
WG['playercolorpalette'] = {}
WG['playercolorpalette'].getRandomize = function()
return randomize
end
WG['playercolorpalette'].setRandomize = function(value)
randomize = value
SetNewTeamColors()
end
WG['playercolorpalette'] = {}
WG['playercolorpalette'].getRandomize = function()
return randomize
end
WG['playercolorpalette'].setRandomize = function(value)
randomize = value
SetNewTeamColors()
end
WG['playercolorpalette'].getSameTeamColors = function()
return useSameTeamColors
end
WG['playercolorpalette'].setSameTeamColors = function(value)
useSameTeamColors = value
SetNewTeamColors()
Spring.SendCommands("luarules reloadluaui") -- cause several widgets are still using old colors
end
widgetHandler:AddAction("shufflecolors", shufflecolors, nil, "t")
widgetHandler:AddAction("ordercolors", ordercolors, nil, "t")
@@ -188,17 +205,22 @@ end
function widget:Shutdown()
ResetOldTeamColors()
WG['playercolorpalette'] = nil
end
function widget:GetConfigData(data)
savedTable = {}
savedTable.randomize = randomize
savedTable.useSameTeamColors = useSameTeamColors
return savedTable
end
function widget:SetConfigData(data)
if data.randomize ~= nil then
randomize = data.randomize
end
if data.useSameTeamColors ~= nil then
useSameTeamColors = data.useSameTeamColors
end
end
@@ -8,6 +8,7 @@ ShieldJitter.__index = ShieldJitter
local warpShader
local timerUniform,strengthUniform
local sphereList
local checkStunned = true
-----------------------------------------------------------------------------------------------------------------
-----------------------------------------------------------------------------------------------------------------
@@ -65,6 +66,12 @@ function ShieldJitter:EndDrawDistortion()
end
function ShieldJitter:DrawDistortion()
if checkStunned then
self.stunned = Spring.GetUnitIsStunned(self.unit)
end
if self.stunned then
return
end
local pos = self.pos
local size = self.size
gl.Uniform(strengthUniform, self.strength )
@@ -147,7 +154,15 @@ end
-----------------------------------------------------------------------------------------------------------------
-----------------------------------------------------------------------------------------------------------------
function ShieldJitter:Update()
local time = 0
function ShieldJitter:Update(dt)
time = time + dt
if time > 45 then
checkStunned = true
time = 0
else
checkStunned = false
end
end
-- used if repeatEffect=true;
@@ -7,6 +7,7 @@ ShieldSphereParticle.__index = ShieldSphereParticle
local sphereList
local shieldShader
local checkStunned = true
-----------------------------------------------------------------------------------------------------------------
-----------------------------------------------------------------------------------------------------------------
@@ -70,6 +71,12 @@ function ShieldSphereParticle:EndDraw()
end
function ShieldSphereParticle:Draw()
if checkStunned then
self.stunned = Spring.GetUnitIsStunned(self.unit)
end
if self.stunned then
return
end
local color = self.color1
glMultiTexCoord(1, color[1],color[2],color[3],color[4] or 1)
color = self.color2
@@ -157,7 +164,15 @@ end
-----------------------------------------------------------------------------------------------------------------
-----------------------------------------------------------------------------------------------------------------
local time = 0
function ShieldSphereParticle:Update(n)
time = time + n
if time > 45 then
checkStunned = true
time = 0
else
checkStunned = false
end
if (self.life<1) then
self.life = self.life + n*self.life_incr
self.size = self.size + n*self.sizeGrowth

0 comments on commit efd615d

Please sign in to comment.