server/src/scripts/gates.lua

28 lines
504 B
Lua
Raw Normal View History

function gate_travel(b, units)
2005-01-03 22:28:57 +01:00
-- we've found which units we want to exchange, now swap them:
local u
for u in units do
u.region = b.region
u.building = b
2005-01-03 22:28:57 +01:00
end
end
function gate_units(b, maxsize)
local size = maxsize
local units = {}
local u
local first = true
for u in b.units do
if first then
first = false
else
if u.number<=size and u.weight<=u.capacity then
units[u] = u
size = size - u.number
end
end
2005-01-03 22:28:57 +01:00
end
return units
2005-01-03 22:28:57 +01:00
end