Skip to content

Commit

Permalink
Target over-penetration for heavy railguns (#3380)
Browse files Browse the repository at this point in the history
Gadget added that uses a repeatedly spawning projectile to simulate over-penetration of relatively soft targets. Respawned projectiles deal less damage with more gradual loss of impulse. It has some limited customization options for now.

The first unit candidate is the legsrail, which is part of this PR as the unit demo.
  • Loading branch information
efrec authored Nov 21, 2024
1 parent 531e9cd commit 7cc3537
Show file tree
Hide file tree
Showing 8 changed files with 547 additions and 19 deletions.
20 changes: 20 additions & 0 deletions luarules/gadgets/unit_collision_damage_behavior.lua
Original file line number Diff line number Diff line change
Expand Up @@ -253,3 +253,23 @@ function gadget:GameFrame(frame)
end
gameFrame = frame
end

local function setVelocityControl(unitID, enabled)
if enabled == false then
launchedUnits[unitID] = nil
unitInertiaCheckFlags[unitID] = nil
elseif not unitInertiaCheckFlags[unitID] then
unitInertiaCheckFlags[unitID] = {
expirationFrame = gameFrame + velocityWatchFrames,
velocityCap = unitDefData[Spring.GetUnitDefID(unitID)].velocityCap,
}
end
end

function gadget:Initialize()
GG.SetVelocityControl = setVelocityControl
end

function gadget:ShutDown()
GG.SetVelocityControl = nil
end
Loading

0 comments on commit 7cc3537

Please sign in to comment.