Skip to content

Commit

Permalink
removed engine hotfixes gadget and divide its functions to a new "foo…
Browse files Browse the repository at this point in the history
…tprint clearance" gadget and the "debris explosions" gadget (#4052)

* removed engine hotfixes gadget and devide its functions to a new footprint clearance gadget and the debris explosions gadget

* revert changes to debris explosion gadget: has already been in: #4053plemented as modrule in
  • Loading branch information
Ruwetuin authored Dec 21, 2024
1 parent 02404a3 commit f596825
Showing 1 changed file with 4 additions and 22 deletions.
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

0 comments on commit f596825

Please sign in to comment.