Skip to content

Commit

Permalink
Preempt some settings related to reclaiming features
Browse files Browse the repository at this point in the history
  • Loading branch information
ForbodingAngel committed Feb 13, 2022
1 parent 05abd6b commit f647df4
Show file tree
Hide file tree
Showing 13 changed files with 37 additions and 27 deletions.
7 changes: 3 additions & 4 deletions Gamedata/alldefs_post.lua
Expand Up @@ -611,10 +611,9 @@ function ModOptions_Post (UnitDefs, WeaponDefs)
if unitDef.workertime and unitDef.workertime >= 8 then
unitDef.workertime = 8
end
-- Set reclaimspeed to be a multiple of workertime. This relies on max defaults set in featuredefs post. Without some mox defaults there, this will be a funny result.
if unitDef.workertime and unitDef.reclaimspeed then
unitDef.reclaimspeed = unitDef.workertime
end
-- Set reclaimspeed to be a multiple of workertime. This relies on max defaults set in featuredefs post. Without some max defaults there, this will be a funny result.
unitDef.reclaimspeed = unitDef.workertime

if canAnyUnitsReclaim == false then
if unitDef.canreclaim == true then
unitDef.canreclaim = false
Expand Down
31 changes: 21 additions & 10 deletions Gamedata/featuredefs_post.lua
Expand Up @@ -19,7 +19,6 @@ local function istable(x) return (type(x) == 'table') end
local function isnumber(x) return (type(x) == 'number') end
local function isstring(x) return (type(x) == 'string') end
local spGetModOptions = Spring.GetModOptions

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

if spGetModOptions then
Expand Down Expand Up @@ -50,19 +49,31 @@ for name, fd in pairs(FeatureDefs) do
end
end

-- Reset maximum feature values
-- Set Reclaimtime that isn't insane. Default engine reclaimtime is (m+e) * 6 which is arbitrary as all hell.
if tonumber(fd["metal"]) == nil or tonumber(fd["metal"]) == 0 then
fd.metal = 100
end
if tonumber(fd["metal"]) > 100 then
fd.metal = 100
fd.metal = 1
end
if tonumber(fd["energy"]) == nil or tonumber(fd["energy"]) == 0 then
fd.energy = 100
end
if tonumber(fd["energy"]) > 500 then
fd.energy = 500
fd.energy = 1
end

local reclaimvalue = (tonumber(fd["metal"]) + tonumber(fd["energy"])) / 4

fd.reclaimtime = reclaimvalue

-- Reset maximum feature values
-- if tonumber(fd["metal"]) == nil or tonumber(fd["metal"]) == 0 then
-- fd.metal = 100
-- end
-- if tonumber(fd["metal"]) > 100 then
-- fd.metal = 100
-- end
-- if tonumber(fd["energy"]) == nil or tonumber(fd["energy"]) == 0 then
-- fd.energy = 100
-- end
-- if tonumber(fd["energy"]) > 1 then
-- fd.energy = 100
-- end
end


Expand Down
2 changes: 1 addition & 1 deletion Gamedata/modrules.lua
Expand Up @@ -37,7 +37,7 @@ local modrules = {
unitMethod = 0, -- defaults to 1

unitEnergyCostFactor = 0, -- defaults to 0
unitEfficiency = 0, -- defaults to 1
unitEfficiency = 1, -- defaults to 1
featureEnergyCostFactor = 0, -- defaults to 0

allowEnemies = false, -- defaults to true
Expand Down
6 changes: 3 additions & 3 deletions LuaRules/Gadgets/game_featureReclaim.lua
Expand Up @@ -6,7 +6,7 @@ function gadget:GetInfo()
date = "December, 2008",
license = "public domain",
layer = 0,
enabled = true -- loaded by default?
enabled = false -- loaded by default?
}
end

Expand All @@ -26,10 +26,10 @@ if gadgetHandler:IsSyncedCode() then
reclaimLeft[featureID] = (reclaimLeft[featureID] or 0.1) + part
if (reclaimLeft[featureID] <= 0) then
Spring.DestroyFeature(featureID)
--Spring.AddTeamResource(builderTeam, "e", 10)
--Spring.AddTeamResource(builderTeam, "e", 1)
local fx, fy, fz = GetFeaturePosition(featureID)
Spring.PlaySoundFile("sounds/miscfx/reclaimed.wav", 0.5, fx, fy, fz)
SpawnCEG("sparklegreenplus10energy", fx, fy, fz)
SpawnCEG("sparklegreen", fx, fy, fz)
end
return false
end
Expand Down
2 changes: 1 addition & 1 deletion Units-Configs-Basedefs/basedefs/zaal/zarm_basedef.lua
Expand Up @@ -18,7 +18,7 @@ unitDef = {
canHover = false,
canMove = false,
canPatrol = false,
canreclaim = false,
canreclaim = true,
canstop = true,
category = "BUILDING",
description = [[Provides Tech/Builds Construction Bugs]],
Expand Down
Expand Up @@ -18,7 +18,7 @@ unitDef = {
canHover = false,
canMove = true,
canPatrol = true,
canreclaim = false,
canreclaim = true,
canstop = true,
category = "LIGHT NOTAIR",
description = [[Construction Bug]],
Expand Down
2 changes: 1 addition & 1 deletion Units-Configs-Basedefs/basedefs/zaal/ztenticle_basedef.lua
Expand Up @@ -18,7 +18,7 @@ unitDef = {
canHover = false,
canMove = false,
canPatrol = false,
canreclaim = false,
canreclaim = true,
canstop = true,
category = "BUILDING",
description = [[Builds Units]],
Expand Down
2 changes: 1 addition & 1 deletion Units/ecommanderbattle.lua
Expand Up @@ -45,7 +45,7 @@ local unitDef = {
canGuard = true,
canMove = true,
canPatrol = true,
canreclaim = false,
canreclaim = true,
canstop = true,
category = "NOTAIR SUPPORT ARMORED",
description = [[Experimental Assault Overseer]],
Expand Down
2 changes: 1 addition & 1 deletion Units/ecommanderbuild.lua
Expand Up @@ -41,7 +41,7 @@ local unitDef = {
canGuard = true,
canMove = true,
canPatrol = true,
canreclaim = false,
canreclaim = true,
canstop = true,
category = "NOTAIR SUPPORT LIGHT",
description = [[Builds Units x8 as fast]],
Expand Down
2 changes: 1 addition & 1 deletion Units/ecommandercloak.lua
Expand Up @@ -41,7 +41,7 @@ local unitDef = {
canGuard = true,
canMove = true,
canPatrol = true,
canreclaim = false,
canreclaim = true,
canstop = true,
category = "NOTAIR SUPPORT LIGHT",
description = [[Provides Massive Cloak Field]],
Expand Down
2 changes: 1 addition & 1 deletion Units/ecommanderfactory.lua
Expand Up @@ -41,7 +41,7 @@ local unitDef = {
canGuard = true,
canMove = true,
canPatrol = true,
canreclaim = false,
canreclaim = true,
canstop = true,
category = "NOTAIR SUPPORT LIGHT",
description = [[Creates buildings and mobile units • Gives ]] ..supplyGiven.. [[ Supply]],
Expand Down
2 changes: 1 addition & 1 deletion Units/ecommandershield.lua
Expand Up @@ -45,7 +45,7 @@ local unitDef = {
canGuard = true,
canMove = true,
canPatrol = true,
canreclaim = false,
canreclaim = true,
canstop = true,
category = "NOTAIR SUPPORT LIGHT",
description = [[Provides large shielding • Self-Heals out of combat 40hp/s when idle]],
Expand Down
2 changes: 1 addition & 1 deletion modinfo.lua
Expand Up @@ -13,7 +13,7 @@ return {
name='Evolution RTS -',
description='EvoRTS',
shortname='EvoRTS',
version='v17.07',
version='dev',
mutator='Official',
game='Evolution RTS',
shortGame='EvoRTS',
Expand Down

0 comments on commit f647df4

Please sign in to comment.