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
2 changes: 1 addition & 1 deletion common/springOverrides.lua
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ if Spring.GetModOptions then

-- Returns a copy of the modOptions table. Slower, but allows iterating over
-- the returned table using pairs/ipairs.
Spring.GetModOptionsCopy = function()
GetModOptionsCopy = function()
return table.copy(modOptions)
end
end
Expand Down
7 changes: 3 additions & 4 deletions gamedata/alldefs_post.lua
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ function UnitDef_Post(name, uDef)

-- Cache holiday checks for performance
if not holidays then
holidays = Spring.Utilities.Gametype.GetCurrentHolidays()
holidays = Utilities.Gametype.GetCurrentHolidays()
isAprilFools = holidays["aprilfools"]
isHalloween = holidays["halloween"]
isXmas = holidays["xmas"]
Expand Down Expand Up @@ -1690,7 +1690,7 @@ function WeaponDef_Post(name, wDef)
modOptions = Spring.GetModOptions()
end
if isXmas == nil then
isXmas = Spring.Utilities.Gametype.GetCurrentHolidays()["xmas"]
isXmas = Utilities.Gametype.GetCurrentHolidays()["xmas"]
end

local customparams = wDef.customparams
Expand Down Expand Up @@ -2013,8 +2013,7 @@ function WeaponDef_Post(name, wDef)
end

-- process effects
function ExplosionDef_Post(name, eDef)
end
function ExplosionDef_Post(name, eDef) end

--------------------------
-- MODOPTIONS
Expand Down
4 changes: 2 additions & 2 deletions gamedata/unitdefs.lua
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@ end
local luaFiles = VFS.DirList("units/", "*.lua", nil, true)

local legionEnabled = Spring.GetModOptions().experimentallegionfaction
local scavengersEnabled = Spring.Utilities.Gametype.IsScavengers()
local raptorsEnabled = Spring.Utilities.Gametype.IsRaptors()
local scavengersEnabled = Utilities.Gametype.IsScavengers()
local raptorsEnabled = Utilities.Gametype.IsRaptors()

if Spring.GetModOptions().ruins == "enabled" then
legionEnabled = true
Expand Down
6 changes: 3 additions & 3 deletions gamedata/unitdefs_post.lua
Original file line number Diff line number Diff line change
Expand Up @@ -212,8 +212,8 @@ end

local function preProcessTweakOptions()
local modOptions = {}
if Spring.GetModOptionsCopy then
modOptions = Spring.GetModOptionsCopy()
if GetModOptionsCopy then
modOptions = GetModOptionsCopy()
end

--------------------------------------------------------------------------------
Expand Down Expand Up @@ -266,7 +266,7 @@ local function preProcessTweakOptions()
Spring.Echo("Error parsing and decoding tweakdef", name, modOptions[name], "Error :" .. postsFuncStr)
end
else
local success, tweakunits = pcall(Spring.Utilities.CustomKeyToUsefulTable, modOptions[name])
local success, tweakunits = pcall(Utilities.CustomKeyToUsefulTable, modOptions[name])
if success then
if type(tweakunits) == "table" then
Spring.Echo("Loading " .. name .. " modoption")
Expand Down
8 changes: 4 additions & 4 deletions init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -45,14 +45,14 @@ local commonFunctions = {

if commonFunctions.spring[environment] then
local springFunctions = VFS.Include("common/springFunctions.lua")
Spring.Utilities = Spring.Utilities or springFunctions.Utilities
Spring.Debug = Spring.Debug or springFunctions.Debug
Utilities = Utilities or springFunctions.Utilities
Debug = Debug or springFunctions.Debug
VFS.Include("common/platformFunctions.lua")
VFS.Include("common/constants.lua")
end

if commonFunctions.i18n[environment] then
Spring.I18N = Spring.I18N or VFS.Include("modules/i18n/i18n.lua")
I18N = I18N or VFS.Include("modules/i18n/i18n.lua")
end

if commonFunctions.cmd[environment] then
Expand All @@ -61,7 +61,7 @@ if commonFunctions.cmd[environment] then
end

if commonFunctions.map[environment] then
Spring.Lava = VFS.Include("modules/lava.lua")
Lava = VFS.Include("modules/lava.lua")
end

if commonFunctions.graphics[environment] then
Expand Down
6 changes: 3 additions & 3 deletions luaintro/Addons/main.lua
Original file line number Diff line number Diff line change
Expand Up @@ -173,11 +173,11 @@ local tipKeys = {
local randomTip = ""
if showTips then
local index = math.random(#tipKeys)
randomTip = Spring.I18N("tips.loadscreen." .. tipKeys[index])
randomTip = I18N("tips.loadscreen." .. tipKeys[index])
end

if showDonationTip then
randomTip = Spring.I18N("tips.loadscreen.donations")
randomTip = I18N("tips.loadscreen.donations")
end

-- for guishader
Expand Down Expand Up @@ -710,7 +710,7 @@ function addon.DrawLoadScreen()
gl.Translate(vsx / 2, (usingIntelPotato and 0.938 or 0.988) * vsy, 0)
font2:SetTextColor(0.8, 0.8, 0.8, 1)
font2:SetOutlineColor(0, 0, 0, 0.8)
font2:Print(Spring.I18N("ui.loadScreen.lowRamWarning", { textColor = "\255\200\200\200", warnColor = "\255\255\255\255" }), 0, 0, height * 0.66, "oac")
font2:Print(I18N("ui.loadScreen.lowRamWarning", { textColor = "\255\200\200\200", warnColor = "\255\255\255\255" }), 0, 0, height * 0.66, "oac")
gl.PopMatrix()
end
end
Expand Down
22 changes: 11 additions & 11 deletions luaintro/Addons/music.lua
Original file line number Diff line number Diff line change
Expand Up @@ -42,52 +42,52 @@ function addon.Initialize()
-- Events ----------------------------------------------------------------------------------------------------------------------

-- Raptors
if Spring.Utilities.Gametype.IsRaptors() then
if Utilities.Gametype.IsRaptors() then
table.append(musicPlaylistEvent, VFS.DirList(musicDirOriginal .. "/events/raptors/loading", allowedExtensions))
elseif Spring.GetConfigInt("UseSoundtrackRaptors", 0) == 1 then
table.append(musicPlaylist, VFS.DirList(musicDirOriginal .. "/events/raptors/loading", allowedExtensions))
end

-- Scavengers
if Spring.Utilities.Gametype.IsScavengers() then
if Utilities.Gametype.IsScavengers() then
table.append(musicPlaylistEvent, VFS.DirList(musicDirOriginal .. "/events/scavengers/loading", allowedExtensions))
elseif Spring.GetConfigInt("UseSoundtrackScavengers", 0) == 1 then
table.append(musicPlaylist, VFS.DirList(musicDirOriginal .. "/events/scavengers/loading", allowedExtensions))
end

-- April Fools
---- Day 1 - 100% chance
if Spring.GetConfigInt("UseSoundtrackAprilFools", 1) == 1 and Spring.Utilities.Gametype.GetCurrentHolidays()["aprilfools_specialDay"] then
if Spring.GetConfigInt("UseSoundtrackAprilFools", 1) == 1 and Utilities.Gametype.GetCurrentHolidays()["aprilfools_specialDay"] then
table.append(musicPlaylistEvent, VFS.DirList(musicDirOriginal .. "/events/aprilfools/loading", allowedExtensions))
---- Day 2-7 - 50% chance
elseif Spring.GetConfigInt("UseSoundtrackAprilFools", 1) == 1 and Spring.Utilities.Gametype.GetCurrentHolidays()["aprilfools"] and math.random() <= 0.5 then
elseif Spring.GetConfigInt("UseSoundtrackAprilFools", 1) == 1 and Utilities.Gametype.GetCurrentHolidays()["aprilfools"] and math.random() <= 0.5 then
table.append(musicPlaylistEvent, VFS.DirList(musicDirOriginal .. "/events/aprilfools/loading", allowedExtensions))
---- Post Event - Add to regular playlist
elseif Spring.GetConfigInt("UseSoundtrackAprilFoolsPostEvent", 0) == 1 and not Spring.Utilities.Gametype.GetCurrentHolidays()["aprilfools"] then
elseif Spring.GetConfigInt("UseSoundtrackAprilFoolsPostEvent", 0) == 1 and not Utilities.Gametype.GetCurrentHolidays()["aprilfools"] then
table.append(musicPlaylist, VFS.DirList(musicDirOriginal .. "/events/aprilfools/loading", allowedExtensions))
end

-- Halloween
---- Halloween Day - 100% chance
if Spring.GetConfigInt("UseSoundtrackHalloween", 1) == 1 and Spring.Utilities.Gametype.GetCurrentHolidays()["halloween_specialDay"] then
if Spring.GetConfigInt("UseSoundtrackHalloween", 1) == 1 and Utilities.Gametype.GetCurrentHolidays()["halloween_specialDay"] then
table.append(musicPlaylistEvent, VFS.DirList(musicDirOriginal .. "/events/halloween/loading", allowedExtensions))
---- 2 Weeks Before Halloween - 50% chance
elseif Spring.GetConfigInt("UseSoundtrackHalloween", 1) == 1 and Spring.Utilities.Gametype.GetCurrentHolidays()["halloween"] and math.random() <= 0.5 then
elseif Spring.GetConfigInt("UseSoundtrackHalloween", 1) == 1 and Utilities.Gametype.GetCurrentHolidays()["halloween"] and math.random() <= 0.5 then
table.append(musicPlaylistEvent, VFS.DirList(musicDirOriginal .. "/events/halloween/loading", allowedExtensions))
---- Post Event - Add to regular playlist
elseif Spring.GetConfigInt("UseSoundtrackHalloweenPostEvent", 0) == 1 and not Spring.Utilities.Gametype.GetCurrentHolidays()["halloween_specialDay"] then
elseif Spring.GetConfigInt("UseSoundtrackHalloweenPostEvent", 0) == 1 and not Utilities.Gametype.GetCurrentHolidays()["halloween_specialDay"] then
table.append(musicPlaylist, VFS.DirList(musicDirOriginal .. "/events/halloween/loading", allowedExtensions))
end

-- Xmas
---- Christmas Days - 100% chance
if Spring.GetConfigInt("UseSoundtrackXmas", 1) == 1 and Spring.Utilities.Gametype.GetCurrentHolidays()["xmas_specialDay"] then
if Spring.GetConfigInt("UseSoundtrackXmas", 1) == 1 and Utilities.Gametype.GetCurrentHolidays()["xmas_specialDay"] then
table.append(musicPlaylistEvent, VFS.DirList(musicDirOriginal .. "/events/xmas/loading", allowedExtensions))
---- The Rest of the event - 50% chance
elseif Spring.GetConfigInt("UseSoundtrackXmas", 1) == 1 and Spring.Utilities.Gametype.GetCurrentHolidays()["xmas"] and math.random() <= 0.5 then
elseif Spring.GetConfigInt("UseSoundtrackXmas", 1) == 1 and Utilities.Gametype.GetCurrentHolidays()["xmas"] and math.random() <= 0.5 then
table.append(musicPlaylistEvent, VFS.DirList(musicDirOriginal .. "/events/xmas/loading", allowedExtensions))
---- Post Event - Add to regular playlist
elseif Spring.GetConfigInt("UseSoundtrackXmasPostEvent", 0) == 1 and not Spring.Utilities.Gametype.GetCurrentHolidays()["xmas"] then
elseif Spring.GetConfigInt("UseSoundtrackXmasPostEvent", 0) == 1 and not Utilities.Gametype.GetCurrentHolidays()["xmas"] then
table.append(musicPlaylist, VFS.DirList(musicDirOriginal .. "/events/xmas/loading", allowedExtensions))
end

Expand Down
2 changes: 1 addition & 1 deletion luarules/Utilities/damgam_lib/position_checks.lua
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ local mapSizeZ = Game.mapSizeZ
local landLevel
local seaLevel

local scavengerAllyTeamID = Spring.Utilities.GetScavAllyTeamID()
local scavengerAllyTeamID = Utilities.GetScavAllyTeamID()

-- Team Startboxes
local AllyTeamStartboxes = {}
Expand Down
2 changes: 1 addition & 1 deletion luarules/gadgets/ai_ruin_blueprint_tester.lua
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

local cmdname = "ruinblueprinttest"
local blueprintspath = "luarules/gadgets/ruins/Blueprints/BYAR/Blueprints/"
local enabled = Spring.Utilities.IsDevMode() -- only enable in test environment
local enabled = Utilities.IsDevMode() -- only enable in test environment
local queue = {}
local mapsizeX = Game.mapSizeX
local blueprintpositions = {}
Expand Down
2 changes: 1 addition & 1 deletion luarules/gadgets/ai_ruins.lua
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

if not (Spring.GetModOptions().ruins == "enabled" or (Spring.GetModOptions().ruins == "scav_only" and Spring.Utilities.Gametype.IsScavengers())) then
if not (Spring.GetModOptions().ruins == "enabled" or (Spring.GetModOptions().ruins == "scav_only" and Utilities.Gametype.IsScavengers())) then
return
end

Expand Down
4 changes: 2 additions & 2 deletions luarules/gadgets/api_build_blocking.lua
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ if gadgetHandler:IsSyncedCode() then
local teamsList = Spring.GetTeamList()

local ignoredTeams = {}
local scavTeamID, raptorTeamID = Spring.Utilities.GetScavTeamID(), Spring.Utilities.GetRaptorTeamID()
local scavTeamID, raptorTeamID = Utilities.GetScavTeamID(), Utilities.GetRaptorTeamID()
if scavTeamID then
ignoredTeams[scavTeamID] = true
end
Expand Down Expand Up @@ -76,7 +76,7 @@ if gadgetHandler:IsSyncedCode() then
if Spring.IsCheatingEnabled() then
return true
else
local accountID = Spring.Utilities.GetAccountID(playerID)
local accountID = Utilities.GetAccountID(playerID)
if _G.permissions.cmd[accountID] and not _G.isSinglePlayer then
return true
end
Expand Down
2 changes: 1 addition & 1 deletion luarules/gadgets/api_damage_stats.lua
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ local gameType
function gadget:Initialize()
local tList = Spring.GetTeamList()

if Spring.Utilities.Gametype.IsFFA() then
if Utilities.Gametype.IsFFA() then
gameType = "free for all"
return
end
Expand Down
8 changes: 4 additions & 4 deletions luarules/gadgets/api_permissions.lua
Original file line number Diff line number Diff line change
Expand Up @@ -22,19 +22,19 @@ local trustedNames = powerusers.trustedNames
powerusers.trustedNames = nil
if trustedNames then
for _, playerID in ipairs(Spring.GetPlayerList()) do
local accountID = Spring.Utilities.GetAccountID(playerID)
local accountID = Utilities.GetAccountID(playerID)
if not powerusers[accountID] and trustedNames[Spring.GetPlayerInfo(playerID)] then
powerusers[accountID] = trustedNames[Spring.GetPlayerInfo(playerID)]
end
end
end

local numPlayers = Spring.Utilities.GetPlayerCount()
local numPlayers = Utilities.GetPlayerCount()

-- give permissions when in singleplayer
if numPlayers <= 1 then
for _, playerID in ipairs(Spring.GetPlayerList()) do
local accountID = Spring.Utilities.GetAccountID(playerID)
local accountID = Utilities.GetAccountID(playerID)
local _, _, spec = Spring.GetPlayerInfo(playerID)

-- dont give permissions to the spectators when there is a player is playing
Expand Down Expand Up @@ -70,7 +70,7 @@ local function ResolveTrustedName(playerID)
if not name or not trustedNames[name] then
return false
end
local accountID = Spring.Utilities.GetAccountID(playerID)
local accountID = Utilities.GetAccountID(playerID)
if accountID == -1 then
return false
end -- still unavailable
Expand Down
2 changes: 1 addition & 1 deletion luarules/gadgets/cmd_dev_helpers.lua
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ function isAuthorized(playerID, subPermission)
return true
end
local playername = Spring.GetPlayerInfo(playerID)
local accountID = Spring.Utilities.GetAccountID(playerID)
local accountID = Utilities.GetAccountID(playerID)
local hasPermission = false
-- check catch-all devhelpers permission
if (_G and _G.permissions.devhelpers and _G.permissions.devhelpers[accountID]) or (SYNCED and SYNCED.permissions.devhelpers and SYNCED.permissions.devhelpers[accountID]) then
Expand Down
4 changes: 2 additions & 2 deletions luarules/gadgets/cmd_get_player_data.lua
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ local screenshotWidthHq = 900

--------------------------------------------------------------------------------

local isSingleplayer = Spring.Utilities.Gametype.IsSinglePlayer()
local isSingleplayer = Utilities.Gametype.IsSinglePlayer()

if gadgetHandler:IsSyncedCode() then

Expand Down Expand Up @@ -75,7 +75,7 @@ else

local myPlayerID = Spring.GetMyPlayerID()
local myPlayerName = Spring.GetPlayerInfo(myPlayerID)
local accountID = Spring.Utilities.GetAccountID(myPlayerID)
local accountID = Utilities.GetAccountID(myPlayerID)
local authorized = SYNCED.permissions.playerdata[accountID]

function gadget:Initialize()
Expand Down
4 changes: 2 additions & 2 deletions luarules/gadgets/cmd_give.lua
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ if gadgetHandler:IsSyncedCode() then
end

local playername, _, spec = Spring.GetPlayerInfo(playerID)
local accountID = Spring.Utilities.GetAccountID(playerID)
local accountID = Utilities.GetAccountID(playerID)
local authorized = false
if _G.permissions.give[accountID] then
authorized = true
Expand All @@ -120,7 +120,7 @@ if gadgetHandler:IsSyncedCode() then
else -- UNSYNCED

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

local function RequestGive(cmd, line, words, playerID)
Expand Down
2 changes: 1 addition & 1 deletion luarules/gadgets/cmd_idle_players.lua
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

if Spring.Utilities.Gametype.IsSinglePlayer() then
if Utilities.Gametype.IsSinglePlayer() then
return
end

Expand Down
2 changes: 1 addition & 1 deletion luarules/gadgets/cmd_limiter.lua
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ local historyFrames = 180
local maxCommands = 600
local startWarningOffences = 3
local maxOffences = 6
local isSingleplayer = Spring.Utilities.Gametype.IsSinglePlayer()
local isSingleplayer = Utilities.Gametype.IsSinglePlayer()
local mathFloor = math.floor
local mathMax = math.max

Expand Down
2 changes: 1 addition & 1 deletion luarules/gadgets/cmd_paused_is_paused.lua
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
if Spring.GetModOptions().allowpausegameplay or Spring.Utilities.Gametype.IsSinglePlayer() then
if Spring.GetModOptions().allowpausegameplay or Utilities.Gametype.IsSinglePlayer() then
return
end

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 @@ -42,7 +42,7 @@ if gadgetHandler:IsSyncedCode() then
return
end
local playername, _, spec = Spring.GetPlayerInfo(playerID)
local accountID = Spring.Utilities.GetAccountID(playerID)
local accountID = Utilities.GetAccountID(playerID)
local authorized = false
if _G.permissions.cmd[accountID] then
authorized = true
Expand All @@ -65,7 +65,7 @@ if gadgetHandler:IsSyncedCode() then
else -- UNSYNCED

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

local function execCmd(_, playername, cmd)
Expand Down
4 changes: 2 additions & 2 deletions luarules/gadgets/cmd_undo.lua
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ if gadgetHandler:IsSyncedCode() then
function gadget:RecvLuaMsg(msg, playerID)
if msg:sub(1, 2) == "un" and msg:sub(3, 4) == validation then

local accountID = Spring.Utilities.GetAccountID(playerID)
local accountID = Utilities.GetAccountID(playerID)
local authorized = false
if _G.permissions.undo[accountID] then
authorized = true
Expand All @@ -190,7 +190,7 @@ if gadgetHandler:IsSyncedCode() then

local function notify(message)
for _, playerID in pairs(Spring.GetPlayerList()) do
local accountID = Spring.Utilities.GetAccountID(playerID)
local accountID = Utilities.GetAccountID(playerID)
if _G.permissions.undo[accountID] then
Spring.SendMessageToPlayer(playerID, message)
end
Expand Down
2 changes: 1 addition & 1 deletion luarules/gadgets/dbg_synced_proxy.lua
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ if not gadgetHandler:IsSyncedCode() then
return
end

if not Spring.Utilities.IsDevMode() or not Spring.Utilities.Gametype.IsSinglePlayer() then
if not Utilities.IsDevMode() or not Utilities.Gametype.IsSinglePlayer() then
Spring.SetGameRulesParam("isSyncedProxyEnabled", false)
return
end
Expand Down
2 changes: 1 addition & 1 deletion luarules/gadgets/dbg_test_env_helper.lua
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ end

local ENABLED_RULES_PARAM = "isTestEnvironmentHelperEnabled"

if not Spring.Utilities.IsDevMode() or not Spring.Utilities.Gametype.IsSinglePlayer() then
if not Utilities.IsDevMode() or not Utilities.Gametype.IsSinglePlayer() then
return
end

Expand Down
2 changes: 1 addition & 1 deletion luarules/gadgets/dbg_unitposition_logger.lua
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ if not gadgetHandler:IsSyncedCode() then
local math_ceil = math.ceil

local myPlayerID = Spring.GetMyPlayerID()
local isSinglePlayer = Spring.Utilities.Gametype.IsSinglePlayer()
local isSinglePlayer = Utilities.Gametype.IsSinglePlayer()

local logRate = minLogRate
local lastLogFrame = 30 - minLogRate
Expand Down
Loading
Loading