Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function script.Create()
- Spring.Echo ("MAGNET unit " .. unitID .. " was created!")
- StartThread (magnet)
- end
- function magnet ()
- while (true) do
- local x,y,z = Spring.GetUnitPosition (unitID)
- nearunits=Spring.GetUnitsInSphere (x,y,z, 200) or "nothing"
- if (nearunits~="nothing") then
- for _, nearunitid in ipairs (nearunits) do
- if (nearunitid~=unitID) then
- Spring.AddUnitImpulse( nearunitid, 0, 0.5, 0)
- end
- end
- end
- Sleep (100)
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement