Skip to content

Commit

Permalink
Merge remote-tracking branch 'bar/master' into test_framework_one_file
Browse files Browse the repository at this point in the history
  • Loading branch information
saurtron committed Dec 26, 2024
2 parents 077271c + 590c3c8 commit b4d8f4c
Show file tree
Hide file tree
Showing 56 changed files with 536 additions and 986 deletions.
2 changes: 1 addition & 1 deletion common/platformFunctions.lua
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ local function checkRequires(allRequires)
return false
elseif req == 'shaders' and not hasShaders then
return false
elseif req == 'fbo' and not hasVBO then
elseif req == 'fbo' and not hasFBO then
return false
end
end
Expand Down
78 changes: 40 additions & 38 deletions gamedata/alldefs_post.lua
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,8 @@ function UnitDef_Post(name, uDef)
armamd = true,
armsilo = true,
armscab = true,
armseadragon = true,
cordesolator = true,
corfmd = true,
corsilo = true,
cormabm = true,
Expand Down Expand Up @@ -328,14 +330,14 @@ function UnitDef_Post(name, uDef)
uDef.buildoptions[numBuildoptions + 1] = "comeffigylvl1"
end
end


if modOptions.evocom then

if modOptions.evocom then
if uDef.customparams.evocomlvl or name == "armcom" or name == "corcom" or name == "legcom" then
local comLevel = uDef.customparams.evocomlvl
if modOptions.comrespawn == "all" or modOptions.comrespawn == "evocom" then--add effigy respawning, if enabled
uDef.customparams.respawn_condition = "health"

local numBuildoptions = #uDef.buildoptions
if comLevel == 2 then
uDef.buildoptions[numBuildoptions + 1] = "comeffigylvl1"
Expand All @@ -351,13 +353,13 @@ function UnitDef_Post(name, uDef)
end
uDef.customparams.combatradius = 0
uDef.customparams.evolution_health_transfer = "percentage"

if uDef.power then
uDef.power = uDef.power/modOptions.evocomxpmultiplier
else
uDef.power = ((uDef.metalcost+(uDef.energycost/60))/modOptions.evocomxpmultiplier)
end

if name == "armcom" then
uDef.customparams.evolution_target = "armcomlvl2"
uDef.customparams.inheritxpratemultiplier = 0.5
Expand All @@ -374,7 +376,7 @@ function UnitDef_Post(name, uDef)

if modOptions.evocomlevelupmethod == "dynamic" then
uDef.customparams.evolution_condition = "power"
uDef.customparams.evolution_power_multiplier = 1 -- Scales the power calculated based on your own combined power.
uDef.customparams.evolution_power_multiplier = 1 -- Scales the power calculated based on your own combined power.
local evolutionPowerThreshold = uDef.customparams.evolution_power_threshold or 10000 --sets threshold for level 1 commanders
uDef.customparams.evolution_power_threshold = evolutionPowerThreshold*modOptions.evocomlevelupmultiplier
elseif modOptions.evocomlevelupmethod == "timed" then
Expand Down Expand Up @@ -760,28 +762,28 @@ function UnitDef_Post(name, uDef)
----------------------------------------------------------------------
-- CATEGORY ASSIGNER
----------------------------------------------------------------------

-- uDef.movementclass lists
local hoverList = {
HOVER2 = true,
HOVER3 = true,
HHOVER4 = true,
HOVER5 = true
}

local shipList = {
BOAT3 = true,
BOAT4 = true,
BOAT5 = true,
BOAT8 = true,
EPICSHIP = true
}

local subList = {
UBOAT4 = true,
EPICSUBMARINE = true
}

local amphibList = {
VBOT5 = true,
COMMANDERBOT = true,
Expand All @@ -798,12 +800,12 @@ function UnitDef_Post(name, uDef)
COMMANDERBOT = true,
SCAVCOMMANDERBOT = true
}

local categories = {}

-- Manual categories: OBJECT T4AIR LIGHTAIRSCOUT GROUNDSCOUT RAPTOR
-- Deprecated caregories: BOT TANK PHIB NOTLAND SPACE

categories["ALL"] = function() return true end
categories["MOBILE"] = function(uDef) return uDef.speed and uDef.speed > 0 end
categories["NOTMOBILE"] = function(uDef) return not categories.MOBILE(uDef) end
Expand All @@ -822,7 +824,7 @@ function UnitDef_Post(name, uDef)
categories["MINE"] = function(uDef) return uDef.weapondefs and uDef.weapondefs.minerange end
categories["COMMANDER"] = function(uDef) return commanderList[uDef.movementclass] end
categories["EMPABLE"] = function(uDef) return categories.SURFACE(uDef) and uDef.customparams and uDef.customparams.paralyzemultiplier ~= 0 end

uDef.category = uDef.category or ""
if not string.find(uDef.category, "OBJECT") then -- objects should not be targetable and therefore are not assigned any other category
for categoryName, condition in pairs(categories) do
Expand All @@ -841,7 +843,7 @@ function UnitDef_Post(name, uDef)
uDef.collide = false
end
end

if uDef.metalcost and uDef.health and uDef.canmove == true and uDef.mass == nil then
local healthmass = math.ceil(uDef.health/6)
uDef.mass = math.max(uDef.metalcost, healthmass)
Expand Down Expand Up @@ -885,12 +887,12 @@ function UnitDef_Post(name, uDef)
uDef.weapondefs.stiletto_bomb.burstrate = 0.3333
uDef.weapondefs.stiletto_bomb.edgeeffectiveness = 0.30
uDef.weapondefs.stiletto_bomb.damage.default = 3000
uDef.weapondefs.stiletto_bomb.paralyzetime = 1
uDef.weapondefs.stiletto_bomb.paralyzetime = 1
end

if name == "armspid" then
uDef.weapondefs.spider.paralyzetime = 2
uDef.weapondefs.spider.damage.vtol = 100
uDef.weapondefs.spider.paralyzetime = 2
uDef.weapondefs.spider.damage.vtol = 100
uDef.weapondefs.spider.damage.default = 600
uDef.weapondefs.spider.reloadtime = 1.495
end
Expand Down Expand Up @@ -942,10 +944,10 @@ function UnitDef_Post(name, uDef)
uDef.weapondefs.empmissile.areaofeffect = 250
uDef.weapondefs.empmissile.edgeeffectiveness = -0.50
uDef.weapondefs.empmissile.damage.default = 20000
uDef.weapondefs.empmissile.paralyzetime = 5
uDef.weapondefs.empmissile.paralyzetime = 5
uDef.weapondefs.emp.damage.default = 200
uDef.weapondefs.emp.reloadtime = .5
uDef.weapondefs.emp.paralyzetime = 1
uDef.weapondefs.emp.paralyzetime = 1
end

if name == "corbw" then
Expand All @@ -956,9 +958,9 @@ function UnitDef_Post(name, uDef)
--uDef.weapondefs.bladewing_lyzer.beamdecay = 0.5
--uDef.weapondefs.bladewing_lyzer.beamtime = 0.03
--uDef.weapondefs.bladewing_lyzer.beamttl = 0.4

uDef.weapondefs.bladewing_lyzer.damage.default = 300
uDef.weapondefs.bladewing_lyzer.paralyzetime = 1
uDef.weapondefs.bladewing_lyzer.paralyzetime = 1
end


Expand All @@ -969,15 +971,15 @@ function UnitDef_Post(name, uDef)
if (name == "armvulc" or name == "corbuzz" or name == "legstarfall" or name == "corsilo" or name == "armsilo") then
uDef.customparams.paralyzemultiplier = 2
end

--if name == "corsumo" then
--uDef.customparams.paralyzemultiplier = 0.9
--end

if name == "armmar" then
uDef.customparams.paralyzemultiplier = 0.8
end

if name == "armbanth" then
uDef.customparams.paralyzemultiplier = 1.6
end
Expand All @@ -988,19 +990,19 @@ function UnitDef_Post(name, uDef)
--if name == "armvang" then
--uDef.customparams.paralyzemultiplier = 1.1
--end

--if name == "armlun" then
--uDef.customparams.paralyzemultiplier = 1.05
--end

--if name == "corshiva" then
--uDef.customparams.paralyzemultiplier = 1.1
--end

--if name == "corcat" then
--uDef.customparams.paralyzemultiplier = 1.05
--end

--if name == "corkarg" then
--uDef.customparams.paralyzemultiplier = 1.2
--end
Expand Down Expand Up @@ -1325,14 +1327,14 @@ function UnitDef_Post(name, uDef)
end
uDef.customparams.vertdisp = 1.0 * vertexDisplacement
uDef.customparams.healthlookmod = 0

-- Animation Cleanup
if modOptions.animationcleanup then
if uDef.script then
if modOptions.animationcleanup then
if uDef.script then
local oldscript = uDef.script:lower()
if oldscript:find(".cob", nil, true) and (not oldscript:find("_clean.", nil, true)) then
if oldscript:find(".cob", nil, true) and (not oldscript:find("_clean.", nil, true)) then
local newscript = string.sub(oldscript, 1, -5) .. "_clean.cob"
if VFS.FileExists('scripts/'..newscript) then
if VFS.FileExists('scripts/'..newscript) then
Spring.Echo("Using new script for", name, oldscript, '->', newscript)
uDef.script = newscript
else
Expand All @@ -1341,7 +1343,7 @@ function UnitDef_Post(name, uDef)
end
end
end

end

local function ProcessSoundDefaults(wd)
Expand Down Expand Up @@ -1388,7 +1390,7 @@ function WeaponDef_Post(name, wDef)

if not SaveDefsToCustomParams then
-------------- EXPERIMENTAL MODOPTIONS

-- Standard Gravity
local gravityOverwriteExemptions = { --add the name of the weapons (or just the name of the unit followed by _ ) to this table to exempt from gravity standardization.
'cormship_', 'armmship_'
Expand All @@ -1406,8 +1408,8 @@ function WeaponDef_Post(name, wDef)
wDef.mygravity = 0.1445
end
end
-- Accurate Lasers

-- Accurate Lasers
if modOptions.accuratelasers then
if wDef.weapontype and wDef.weapontype == 'BeamLaser' then
wDef.targetmoveerror = nil
Expand Down Expand Up @@ -1486,7 +1488,7 @@ function WeaponDef_Post(name, wDef)
-- VTOL's may or may not do full damage to shields if not defined in weapondefs
local vtolShieldDamageMultiplier = 0

local shieldCollisionExemptions = { --add the name of the weapons (or just the name of the unit followed by _ ) to this table to exempt from shield collision.
local shieldCollisionExemptions = { --add the name of the weapons (or just the name of the unit followed by _ ) to this table to exempt from shield collision.
'corsilo_', 'armsilo_', 'armthor_empmissile', 'armemp_', 'cortron_', 'corjuno_', 'armjuno_'
}

Expand Down
4 changes: 4 additions & 0 deletions gamedata/modrules.lua
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,10 @@ local modrules = {
healthScale = XPValues.healthScale, -- Controls how gaining experience increases the maxDamage (total hitpoints) of the unit. The formula used is Health multiplier = healthScale * (1 + xp / (xp + 1)).
reloadScale = XPValues.reloadScale, -- Controls how gaining experience decreases the reloadTime of the unit's weapons. The formula used is Rate of fire multiplier = reloadScale * (1 + xp / (xp + 1)).
},

damage = {
debris = 0, -- body parts flying off dead units
},
}

return modrules
2 changes: 1 addition & 1 deletion luarules/gadgets/unit_crashing_aircraft.lua
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ if gadgetHandler:IsSyncedCode() then
end
-- make it crash
crashingCount = crashingCount + 1
crashing[unitID] = Spring.GetGameFrame() + 230
crashing[unitID] = Spring.GetGameFrame() + 450
Spring.SetUnitCOBValue(unitID, COB_CRASHING, 1)
Spring.SetUnitNoSelect(unitID,true)
Spring.SetUnitNoMinimap(unitID,true)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
function gadget:GetInfo()
return {
name = 'Engine Hotfixes for Various Engine Kludges',
desc = '',
name = 'Footprint clearance',
desc = 'Clears ground under newly build units any features that are under its footprint',
author = '',
version = 'v1.0',
version = '',
date = 'April 2011',
license = 'GNU GPL, v2 or later',
layer = 0,
Expand All @@ -15,13 +15,9 @@ if not gadgetHandler:IsSyncedCode() then
return
end

local unitTurnrate = {}
local unitXsize5 = {}
local unitZsize5 = {}
for unitDefID, unitDef in pairs(UnitDefs) do
if unitDef.moveDef and unitDef.moveDef.type ~= nil then
unitTurnrate[unitDefID] = unitDef.turnRate
end
if unitDef.isBuilding or unitDef.isFactory then
unitXsize5[unitDefID] = unitDef.xsize * 5
unitZsize5[unitDefID] = unitDef.zsize * 5
Expand All @@ -36,12 +32,6 @@ end

function gadget:UnitCreated(uID, uDefID, uTeam, bID)

--Fix for bad movement in 102
--https://springrts.com/phpbb/viewtopic.php?f=12&t=34593
--if unitTurnrate[uDefID] then -- all non-flying units
-- Spring.MoveCtrl.SetGroundMoveTypeData(uID, "turnAccel", unitTurnrate[uDefID])
--end

--Instagibb any features that are unlucky enough to be in the build radius of new construction projects
if unitXsize5[uDefID] then -- buildings/factories
local xr, zr
Expand All @@ -51,7 +41,7 @@ function gadget:UnitCreated(uID, uDefID, uTeam, bID)
xr, zr = unitZsize5[uDefID], unitXsize5[uDefID]
end

local ux, uy, uz = Spring.GetUnitPosition(uID)
local ux, _, uz = Spring.GetUnitPosition(uID)
local features = Spring.GetFeaturesInRectangle(ux-xr, uz-zr, ux+xr, uz+zr)
for i = 1, #features do
if gibFeatureDefs[Spring.GetFeatureDefID(features[i])] then
Expand All @@ -63,11 +53,3 @@ function gadget:UnitCreated(uID, uDefID, uTeam, bID)
end
end
end

--Remove damage hardcoded in the engine of gibbed pieces of units (hardcoded to 50 damage in engine)
function gadget:UnitPreDamaged(unitID, unitDefID, unitTeam, damage, paralyzer, weaponDefID, projectileID, attackerID, attackerDefID, attackerTeam)
if weaponDefID == -1 then
return 0, 0
end
return damage, 1
end
Loading

0 comments on commit b4d8f4c

Please sign in to comment.