Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions luarules/gadgets/api_build_blocking.lua
Original file line number Diff line number Diff line change
Expand Up @@ -349,8 +349,8 @@ if gadgetHandler:IsSyncedCode() then
--------------------------------------------------------------------------------------------------------------------------------------------------
elseif not gadgetHandler:IsSyncedCode() then --elseif for readability

local myPlayerID = Spring.GetMyPlayerID()
local myTeamID = Spring.GetMyTeamID()
local myPlayerID = Spring.GetLocalPlayerID()
local myTeamID = Spring.GetLocalTeamID()

local function HandleBuildBlocked(_, unitDefID, reasonsStr)
if Script.LuaUI.UnitBlocked then
Expand All @@ -365,8 +365,8 @@ elseif not gadgetHandler:IsSyncedCode() then --elseif for readability
local function UpdateSyncActions()
if myTeamID then gadgetHandler:RemoveSyncAction("BuildBlocked_" .. myTeamID) end

myPlayerID = Spring.GetMyPlayerID()
myTeamID = Spring.GetMyTeamID()
myPlayerID = Spring.GetLocalPlayerID()
myTeamID = Spring.GetLocalTeamID()

if myTeamID then
gadgetHandler:AddSyncAction("BuildBlocked_" .. myTeamID, HandleBuildBlocked)
Expand Down
4 changes: 2 additions & 2 deletions luarules/gadgets/api_enemyunitdestroyed.lua
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@ end

if not gadgetHandler:IsSyncedCode() then
local spGetUnitAllyTeam = Spring.GetUnitAllyTeam
local myAllyTeamID = Spring.GetMyAllyTeamID()
local myAllyTeamID = Spring.GetLocalAllyTeamID()
local spec, fullView = Spring.GetSpectatingState()

function gadget:Initialize()
myAllyTeamID = Spring.GetMyAllyTeamID()
myAllyTeamID = Spring.GetLocalAllyTeamID()
spec, fullView = Spring.GetSpectatingState()
end

Expand Down
10 changes: 5 additions & 5 deletions luarules/gadgets/api_widget_events.lua
Original file line number Diff line number Diff line change
Expand Up @@ -15,21 +15,21 @@ function gadget:GetInfo()
end

local spAreTeamsAllied = Spring.AreTeamsAllied
local spGetMyAllyTeamID = Spring.GetMyAllyTeamID
local spGetMyAllyTeamID = Spring.GetLocalAllyTeamID
local spGetSpectatingState = Spring.GetSpectatingState
local spGetUnitLosState = Spring.GetUnitLosState

local myAllyTeamID, myTeamID, spec, specFullView

function gadget:Initialize()
myTeamID = Spring.GetMyTeamID()
myAllyTeamID = Spring.GetMyAllyTeamID()
myTeamID = Spring.GetLocalTeamID()
myAllyTeamID = Spring.GetLocalAllyTeamID()
spec, specFullView = spGetSpectatingState()
end

function gadget:PlayerChanged()
myTeamID = Spring.GetMyTeamID()
myAllyTeamID = Spring.GetMyAllyTeamID()
myTeamID = Spring.GetLocalTeamID()
myAllyTeamID = Spring.GetLocalAllyTeamID()
spec, specFullView = spGetSpectatingState()
end

Expand Down
2 changes: 1 addition & 1 deletion luarules/gadgets/camera_lockcamera.lua
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ else -- UNSYNCED
local GetCameraState = Spring.GetCameraState
local SetCameraState = Spring.SetCameraState
local GetLastUpdateSeconds = Spring.GetLastUpdateSeconds
local GetMyAllyTeamID = Spring.GetMyAllyTeamID
local GetMyAllyTeamID = Spring.GetLocalAllyTeamID
local GetSpectatingState = Spring.GetSpectatingState
local GetPlayerInfo = Spring.GetPlayerInfo
local SendLuaRulesMsg = Spring.SendLuaRulesMsg
Expand Down
34 changes: 17 additions & 17 deletions luarules/gadgets/cmd_dev_helpers.lua
Original file line number Diff line number Diff line change
Expand Up @@ -1019,7 +1019,7 @@ else -- UNSYNCED
end

function removeUnitDef(_, line, words, playerID)
if playerID ~= Spring.GetMyPlayerID() then
if playerID ~= Spring.GetLocalPlayerID() then
return
end
if not isAuthorized(playerID, "units") then
Expand All @@ -1035,7 +1035,7 @@ else -- UNSYNCED
end

function clearWrecks(_, line, words, playerID)
if playerID ~= Spring.GetMyPlayerID() then
if playerID ~= Spring.GetLocalPlayerID() then
return
end
if not isAuthorized(playerID, "terrain") then
Expand All @@ -1045,7 +1045,7 @@ else -- UNSYNCED
end

function reduceWrecks(_, line, words, playerID)
if playerID ~= Spring.GetMyPlayerID() then
if playerID ~= Spring.GetLocalPlayerID() then
return
end
if not isAuthorized(playerID, "terrain") then
Expand All @@ -1055,7 +1055,7 @@ else -- UNSYNCED
end

function processUnits(_, line, words, playerID, action)
if playerID ~= Spring.GetMyPlayerID() then
if playerID ~= Spring.GetLocalPlayerID() then
return
end
if not isAuthorized(playerID, "units") then
Expand Down Expand Up @@ -1091,7 +1091,7 @@ else -- UNSYNCED
end

function dumpFeatures(_, line, words, playerID)
if playerID ~= Spring.GetMyPlayerID() then
if playerID ~= Spring.GetLocalPlayerID() then
return
end
if not isAuthorized(playerID, "units") then
Expand All @@ -1110,7 +1110,7 @@ else -- UNSYNCED
end

function dumpUnits(_, line, words, playerID)
if playerID ~= Spring.GetMyPlayerID() then
if playerID ~= Spring.GetLocalPlayerID() then
return
end
if not isAuthorized(playerID, "units") then
Expand Down Expand Up @@ -1263,7 +1263,7 @@ else -- UNSYNCED
end

function fightertest(_, line, words, playerID, action)
if playerID ~= Spring.GetMyPlayerID() then
if playerID ~= Spring.GetLocalPlayerID() then
return
end
Spring.Echo("Fightertest",line, words, playerID, action)
Expand Down Expand Up @@ -1380,7 +1380,7 @@ else -- UNSYNCED
end

function globallos(_, line, words, playerID, action)
if playerID ~= Spring.GetMyPlayerID() then
if playerID ~= Spring.GetLocalPlayerID() then
return
end
if not isAuthorized(playerID, "terrain") then
Expand All @@ -1395,7 +1395,7 @@ else -- UNSYNCED
end

function playertoteam(_, line, words, playerID, action)
if playerID ~= Spring.GetMyPlayerID() then
if playerID ~= Spring.GetLocalPlayerID() then
return
end
if not isAuthorized(playerID, "teams") then
Expand All @@ -1415,15 +1415,15 @@ else -- UNSYNCED
end
if not words[2] then
words[2] = words[1]
words[1] = Spring.GetMyPlayerID()
words[1] = Spring.GetLocalPlayerID()
end
if tonumber(words[2]) < (#Spring.GetTeamList())-1 then
Spring.SendLuaRulesMsg(PACKET_HEADER .. ':playertoteam:' .. words[1] .. ':' .. words[2])
end
end

function killteam(_, line, words, playerID, action)
if playerID ~= Spring.GetMyPlayerID() then
if playerID ~= Spring.GetLocalPlayerID() then
return
end
if not isAuthorized(playerID, "teams") then
Expand All @@ -1436,7 +1436,7 @@ else -- UNSYNCED
end

function desync(_, line, words, playerID)
if playerID ~= Spring.GetMyPlayerID() then
if playerID ~= Spring.GetLocalPlayerID() then
return
end
if not isAuthorized(playerID, "test") then
Expand All @@ -1450,7 +1450,7 @@ else -- UNSYNCED
--spawnceg usage:
--/luarules spawnceg newnuke --spawns at cursor
--/luarules spawnceg newnuke [int] -- spawns at cursor at height
if playerID ~= Spring.GetMyPlayerID() then
if playerID ~= Spring.GetLocalPlayerID() then
return
end
if not isAuthorized(playerID, "units") then
Expand All @@ -1476,7 +1476,7 @@ else -- UNSYNCED
function spawnunitexplosion(_, line, words, playerID)
--spawnunitexplosion usage:
--/luarules spawnunitexplosion armbull --spawns at cursor
if playerID ~= Spring.GetMyPlayerID() then
if playerID ~= Spring.GetLocalPlayerID() then
return
end
if not isAuthorized(playerID, "units") then
Expand All @@ -1493,7 +1493,7 @@ else -- UNSYNCED
end

function GiveCat(_, line, words, playerID)
if playerID ~= Spring.GetMyPlayerID() then
if playerID ~= Spring.GetLocalPlayerID() then
return
end
if not isAuthorized(playerID, "units") then
Expand Down Expand Up @@ -1523,7 +1523,7 @@ else -- UNSYNCED
collectBuildOptions(rootDef.id, 0)
Spring.Echo("givecat: giving " .. #result .. " unique units from '" .. unitName .. "'")
if #result == 0 then return end
local _, _, _, teamID = Spring.GetPlayerInfo(Spring.GetMyPlayerID(), false)
local _, _, _, teamID = Spring.GetPlayerInfo(Spring.GetLocalPlayerID(), false)
if words[2] and tonumber(words[2]) then
teamID = tonumber(words[2])
end
Expand Down Expand Up @@ -1697,7 +1697,7 @@ else -- UNSYNCED
end

-- team
local _, _, _, teamID = Spring.GetPlayerInfo(Spring.GetMyPlayerID(), false)
local _, _, _, teamID = Spring.GetPlayerInfo(Spring.GetLocalPlayerID(), false)
if string.match(line, ' ([0-9].*)') then
teamID = string.match(line, ' ([0-9].*)')
end
Expand Down
2 changes: 1 addition & 1 deletion luarules/gadgets/cmd_factory_stop_production.lua
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ else
end

function gadget:PlayerChanged()
myTeamID = Spring.GetMyTeamID()
myTeamID = Spring.GetLocalTeamID()
isSpec = Spring.GetSpectatingState()
end

Expand Down
2 changes: 1 addition & 1 deletion luarules/gadgets/cmd_get_player_data.lua
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ else
local fontfileOutlineSize = 9
local fontfileOutlineStrength = 1.7

local myPlayerID = Spring.GetMyPlayerID()
local myPlayerID = Spring.GetLocalPlayerID()
local myPlayerName = Spring.GetPlayerInfo(myPlayerID)
local accountID = Spring.Utilities.GetAccountID(myPlayerID)
local authorized = SYNCED.permissions.playerdata[accountID]
Expand Down
2 changes: 1 addition & 1 deletion luarules/gadgets/cmd_give.lua
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ if gadgetHandler:IsSyncedCode() then

else -- UNSYNCED

local myPlayerID = Spring.GetMyPlayerID()
local myPlayerID = Spring.GetLocalPlayerID()
local accountID = Spring.Utilities.GetAccountID(myPlayerID)
local authorized = SYNCED.permissions.give[accountID]

Expand Down
6 changes: 3 additions & 3 deletions luarules/gadgets/cmd_idle_players.lua
Original file line number Diff line number Diff line change
Expand Up @@ -255,8 +255,8 @@ else -- UNSYNCED
local mx,my = GetMouseState()
local validation = SYNCED.validationIdle
local warningGiven = false
local myTeamID = Spring.GetMyTeamID()
local myAllyTeamID = Spring.GetMyAllyTeamID()
local myTeamID = Spring.GetLocalTeamID()
local myAllyTeamID = Spring.GetLocalAllyTeamID()
local gaiaTeamID = Spring.GetGaiaTeamID()

local isBuilder = {}
Expand Down Expand Up @@ -361,7 +361,7 @@ else -- UNSYNCED
updateTimer = 0

if checkQueueTime and GetGameSeconds() > checkQueueTime then
local teamID = Spring.GetMyTeamID()
local teamID = Spring.GetLocalTeamID()
local myUnits = Spring.GetTeamUnits(teamID)
local queueTime = 0
for i=1, #myUnits do
Expand Down
2 changes: 1 addition & 1 deletion luarules/gadgets/cmd_luaui_reload.lua
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ if (gadgetHandler:IsSyncedCode()) then
end

function LuaUIReload(cmd, line, words, playerID)
if playerID and playerID==Spring.GetMyPlayerID() then
if playerID and playerID==Spring.GetLocalPlayerID() then
Spring.SendCommands("luaui reload")
end
end
Expand Down
2 changes: 1 addition & 1 deletion luarules/gadgets/cmd_mouse_pos_broadcast.lua
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ else
local validation = SYNCED.validationMouse
local msgPrefix = "£" .. validation

local myPlayerID = Spring.GetMyPlayerID()
local myPlayerID = Spring.GetLocalPlayerID()
local spec, _ = GetSpectatingState()
local myAllyTeamID = select(5, GetPlayerInfo(myPlayerID, false))

Expand Down
2 changes: 1 addition & 1 deletion luarules/gadgets/cmd_selected_units.lua
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ else
local PackU16 = VFS.PackU16
local UnpackU16 = VFS.UnpackU16

local myPlayerID = Spring.GetMyPlayerID()
local myPlayerID = Spring.GetLocalPlayerID()

local time = 0
local timeSeconds = 0
Expand Down
4 changes: 2 additions & 2 deletions luarules/gadgets/cmd_sendcommand.lua
Original file line number Diff line number Diff line change
Expand Up @@ -64,12 +64,12 @@ if gadgetHandler:IsSyncedCode() then

else -- UNSYNCED

local myPlayerID = Spring.GetMyPlayerID()
local myPlayerID = Spring.GetLocalPlayerID()
local accountID = Spring.Utilities.GetAccountID(myPlayerID)
local authorized = SYNCED.permissions.cmd[accountID]

local function execCmd(_, playername, cmd)
if playername == select(1, Spring.GetPlayerInfo(Spring.GetMyPlayerID())) or playername == '*' then
if playername == select(1, Spring.GetPlayerInfo(Spring.GetLocalPlayerID())) or playername == '*' then
Spring.SendCommands(cmd)
end
end
Expand Down
14 changes: 7 additions & 7 deletions luarules/gadgets/cus_gl4.lua
Original file line number Diff line number Diff line change
Expand Up @@ -1784,7 +1784,7 @@ end
local function ReloadCUSGL4(optName, line, words, playerID)
if initiated and (not words) then return end
manualReload = true
if playerID ~= Spring.GetMyPlayerID() then
if playerID ~= Spring.GetLocalPlayerID() then
return
end
Spring.Echo("[CustomUnitShadersGL4] Reloading")
Expand All @@ -1794,7 +1794,7 @@ local function ReloadCUSGL4(optName, line, words, playerID)
end

local function DisableCUSGL4(optName, _, _, playerID)
if playerID ~= Spring.GetMyPlayerID() then
if playerID ~= Spring.GetLocalPlayerID() then
return
end
Spring.Echo("[CustomUnitShadersGL4] Disabling")
Expand All @@ -1806,7 +1806,7 @@ function gadget:GameFrame(n)
if not itsXmas and SYNCED.itsXmas then
itsXmas = true
initiated = false
ReloadCUSGL4(nil,nil,nil, Spring.GetMyPlayerID())
ReloadCUSGL4(nil,nil,nil, Spring.GetLocalPlayerID())
end
for unitID, buildProgress in pairs(buildProgresses) do
local health, maxHealth, paralyzeDamage, capture, build = spGetUnitHealth(unitID)
Expand All @@ -1824,7 +1824,7 @@ end

local updaterate = 1
local function CUSGL4updaterate(optName, line, words, playerID)
if playerID ~= Spring.GetMyPlayerID() then
if playerID ~= Spring.GetLocalPlayerID() then
return
end
if updaterate == 1 then
Expand All @@ -1836,15 +1836,15 @@ local function CUSGL4updaterate(optName, line, words, playerID)
end

local function DebugCUSGL4(optName, line, words, playerID)
if playerID ~= Spring.GetMyPlayerID() then
if playerID ~= Spring.GetLocalPlayerID() then
return
end
debugmode = not debugmode
Spring.Echo("[CustomUnitShadersGL4] Debugmode set to", debugmode)
end

local function DumpCUSGL4(optName, line, words, playerID)
if playerID ~= Spring.GetMyPlayerID() then
if playerID ~= Spring.GetLocalPlayerID() then
return
end
Spring.Echo("[CustomUnitShadersGL4] Dumping unit bins:", debugmode)
Expand Down Expand Up @@ -1893,7 +1893,7 @@ end


local function MarkBinCUSGL4(optName, line, words, playerID)
if (playerID ~= Spring.GetMyPlayerID()) then
if (playerID ~= Spring.GetLocalPlayerID()) then
return
end
Spring.Echo("[CustomUnitShadersGL4] Marking Bins", optName, line, words, playerID)
Expand Down
2 changes: 1 addition & 1 deletion luarules/gadgets/dbg_gadget_profiler.lua
Original file line number Diff line number Diff line change
Expand Up @@ -397,7 +397,7 @@ else
local function Start(optName, line, words, pID, _)
if running then
Kill(nil, nil, nil, pID, nil)
elseif pID == Spring.GetMyPlayerID() then
elseif pID == Spring.GetLocalPlayerID() then
running = true

tick = (words and words[1] and tonumber(words[1])) or tick
Expand Down
Loading
Loading