Permalink
Browse files

Fix sound error spam

Add box unitpic
Update luamex
  • Loading branch information...
1 parent be2ba1f commit 6b8cfcca82569a5121a179c02a909b8b4d33da34 @ForbodingAngel ForbodingAngel committed Feb 17, 2017
@@ -18,8 +18,6 @@ function gadget:GetInfo()
}
end
-if Spring.GetModOptions().luamex ~= "enabled" then return false end
-
include("LuaRules/Configs/customcmds.h.lua")
--------------------------------------------------------------------------------
@@ -61,6 +59,7 @@ local metalSpots = {}
local metalSpotsByPos = {}
local MEX_DISTANCE = 500
+local communism = true -- pass a modoption here or whatever
--------------------------------------------------------------------------------
-- Command Handling
@@ -167,12 +166,15 @@ function gadget:UnitCreated(unitID, unitDefID, unitTeam)
end
else
income = GG.IntegrateMetal(x, z)
+ spotByID[unitID] = true
end
if income then
income = income * mexDefID[unitDefID]
Spring.SetUnitRulesParam(unitID, "mexIncome", income, inlosTrueTable)
- Spring.SetUnitResourcing(unitID, "cmm", income)
+ if not communism then
+ Spring.SetUnitResourcing(unitID, "cmm", income)
+ end
end
end
end
@@ -200,3 +202,23 @@ function gadget:UnitDestroyed(unitID, unitDefID, unitTeam)
spotByID[unitID] = nil
end
end
+
+if communism then function gadget:GameFrame (n)
+ if n % 30 ~= 0 then return end
+
+ local allyteamIncomes = {}
+ for unitID in pairs (spotByID) do
+ if Spring.GetUnitIsActive (unitID) then
+ local allyteamID = select (6, Spring.GetTeamInfo (Spring.GetUnitTeam (unitID)))
+ allyteamIncomes[allyteamID] = (allyteamIncomes[allyteamID] or 0) + Spring.GetUnitRulesParam (unitID, "mexIncome")
+ end
+ end
+
+ for allyTeamID, income in pairs (allyteamIncomes) do
+ -- fixme: handle comshare
+ local teams = Spring.GetTeamList (allyTeamID)
+ for i = 1, #teams do
+ Spring.AddTeamResource (teams[i], "m", income / #teams)
+ end
+ end
+end end
@@ -14,8 +14,6 @@ function gadget:GetInfo()
}
end
-if Spring.GetModOptions().luamex ~= "enabled" then return false end
-
------------------------------------------------------------
-- Config
------------------------------------------------------------
@@ -198,15 +196,15 @@ end
------------------------------------------------------------
-- Mex finding
------------------------------------------------------------
-local function SanitiseSpots(spots)
+local function SanitiseSpots(spots, metalValueOverride)
local i = 1
while i <= #spots do
local spot = spots[i]
if spot and spot.x and spot.z then
local metal
metal, spot.x, spot.z = IntegrateMetal(spot.x, spot.z)
spot.y = spGetGroundHeight(spot.x, spot.z)
- spot.metal = metalValueOverride or spot.metal or (metal > 0 and metal) or DEFAULT_MEX_INCOME
+ spot.metal = spot.metal or metalValueOverride or (metal > 0 and metal) or DEFAULT_MEX_INCOME
i = i + 1
else
spot[i] = spot[#spots]
@@ -242,15 +240,15 @@ function GetSpots()
if gameConfig then
Spring.Log(gadget:GetInfo().name, LOG.INFO, "Loading gameside mex config")
if gameConfig.spots then
- spots = SanitiseSpots(gameConfig.spots)
+ spots = SanitiseSpots(gameConfig.spots, gameConfig.metalValueOverride)
return spots, false
end
end
if mapConfig then
Spring.Log(gadget:GetInfo().name, LOG.INFO, "Loading mapside mex config")
loadConfig = true
- spots = SanitiseSpots(mapConfig.spots)
+ spots = SanitiseSpots(mapConfig.spots, mapConfig.metalValueOverride)
return spots, false
end
@@ -78,8 +78,8 @@ local unitDef = {
buildoptions = {
"eairengineer",
"escout", --new
- "egunship2", --new
"efighter", --new
+ "egunship2", --new
"ebomber", --new
"etransport", --new
@@ -78,8 +78,8 @@ local unitDef = {
buildoptions = {
"eairengineer_t2",
"escout_t2", --new
- "egunship2_t2", --new
"efighter_t2", --new
+ "egunship2_t2", --new
"ebomber_t2", --new
"etransport_t2", --new
Binary file not shown.
View
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 6b8cfcc

Please sign in to comment.