Originally shared on the public FactorioPrints / Factorio School archive (factorioprints.com · factorio.school). Authorship preserved from the public catalog.
Slope Formula-based Speed Limiter
A = Desired Ammo Count
L = Desired Maximum Speed
P = The percentage of A you want to start lowering L at
F = A fixed-point constant. Needed to make sure the slope calculator works
When the current ammo count is above P, the space platform will go as fast as the L constant
When the current ammo count is below P, L starts decreasing based on a slope calculated from A, L, and P.