Skip to content
Draft
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
-------------------------------------------------------------------------------- Unsynced Code --------------------------------------------------------------------------------
--------------------------------------------------------------------------------------------------------------------------------------------------
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 @@ -367,8 +367,8 @@ elseif not gadgetHandler:IsSyncedCode() then --elseif for readability
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 @@ -14,11 +14,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 @@ -17,21 +17,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 @@ -45,7 +45,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
38 changes: 19 additions & 19 deletions luarules/gadgets/cmd_dev_helpers.lua
Original file line number Diff line number Diff line change
Expand Up @@ -843,7 +843,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 @@ -859,7 +859,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 @@ -869,7 +869,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 @@ -879,7 +879,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 @@ -915,7 +915,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 @@ -938,7 +938,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 All @@ -959,7 +959,7 @@ else -- UNSYNCED
--- Dumps all units and features in the loadout.lua format used by UnitLoadout / FeatureLoadout in missions.
--- Usage: /luarules dumploadout
function dumpLoadout(_, 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 @@ -1128,7 +1128,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 @@ -1244,7 +1244,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 @@ -1258,7 +1258,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 @@ -1278,15 +1278,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 @@ -1299,7 +1299,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 @@ -1313,7 +1313,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 @@ -1339,7 +1339,7 @@ else -- UNSYNCED
function modmarker(_, line, words, playerID)
-- /luarules modmarker -- places broadcast marker at cursor with no label
-- /luarules modmarker My text -- places broadcast marker at cursor with label
if playerID ~= Spring.GetMyPlayerID() then
if playerID ~= Spring.GetLocalPlayerID() then
return
end
if not isAuthorized(playerID, "modmarker") then
Expand All @@ -1358,7 +1358,7 @@ else -- UNSYNCED

function spawnunitexplosion(_, line, words, playerID)
--/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 @@ -1375,7 +1375,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 @@ -1407,7 +1407,7 @@ else -- UNSYNCED
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 @@ -1585,7 +1585,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 @@ -133,7 +133,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 @@ -86,7 +86,7 @@ else
local fontfileOutlineSize = 9
local fontfileOutlineStrength = 1.7

local myPlayerID = Spring.GetMyPlayerID()
local myPlayerID = Spring.GetLocalPlayerID()
local myPlayerName = Spring.GetPlayerInfo(myPlayerID)
local function isAuthorized()
local acID = Spring.Utilities.GetAccountID(myPlayerID)
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
return true
end
else -- UNSYNCED
local myPlayerID = Spring.GetMyPlayerID()
local myPlayerID = Spring.GetLocalPlayerID()
local myPlayerName = Spring.GetPlayerInfo(myPlayerID)
local function isAuthorized()
local acID = Spring.Utilities.GetAccountID(myPlayerID)
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 @@ -261,8 +261,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 @@ -367,7 +367,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 @@ -83,7 +83,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 @@ -61,7 +61,7 @@ else
local LuaUICallIn = Script.LuaUI
local LuaUI = Script.LuaUI

local myPlayerID = Spring.GetMyPlayerID()
local myPlayerID = Spring.GetLocalPlayerID()
local myAllyTeamID = select(5, GetPlayerInfo(myPlayerID, false))
local PACK_FFFF = PackU16(0xffff)
local CLEAR_ALL_MSG = PACK_FFFF .. PACK_FFFF
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 @@ -61,7 +61,7 @@ if gadgetHandler:IsSyncedCode() then
return true
end
else -- UNSYNCED
local myPlayerID = Spring.GetMyPlayerID()
local myPlayerID = Spring.GetLocalPlayerID()
local myPlayerName = Spring.GetPlayerInfo(myPlayerID)
local function isAuthorized()
local acID = Spring.Utilities.GetAccountID(myPlayerID)
Expand All @@ -70,7 +70,7 @@ else -- UNSYNCED
end

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 @@ -1889,7 +1889,7 @@ local function ReloadCUSGL4(optName, line, words, playerID)
return
end
manualReload = true
if playerID ~= Spring.GetMyPlayerID() then
if playerID ~= Spring.GetLocalPlayerID() then
return
end
Spring.Echo("[CustomUnitShadersGL4] Reloading")
Expand All @@ -1899,7 +1899,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 @@ -1910,7 +1910,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 @@ -1928,7 +1928,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 @@ -1940,15 +1940,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 @@ -1998,7 +1998,7 @@ local function DumpCUSGL4(optName, line, words, playerID)
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
Loading
Loading