2005-11-26 00:32:56 +01:00
|
|
|
-- implements gates and travel between them
|
|
|
|
-- used in HSE and Eressea
|
|
|
|
|
2005-01-08 00:48:11 +01:00
|
|
|
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
|
2007-06-13 14:38:15 +02:00
|
|
|
for key, u in pairs(units) do
|
2005-01-08 00:48:11 +01:00
|
|
|
u.region = b.region
|
|
|
|
u.building = b
|
2005-01-03 22:28:57 +01:00
|
|
|
end
|
2005-01-08 00:48:11 +01:00
|
|
|
end
|
|
|
|
|
|
|
|
function gate_units(b, maxsize)
|
|
|
|
local size = maxsize
|
|
|
|
local units = {}
|
|
|
|
local u
|
|
|
|
|
|
|
|
for u in b.units do
|
2007-06-13 14:38:15 +02:00
|
|
|
if u.number<=size and u.weight<=u.capacity then
|
2005-01-13 13:42:36 +01:00
|
|
|
units[u] = u
|
|
|
|
size = size - u.number
|
2005-01-08 00:48:11 +01:00
|
|
|
end
|
2005-01-03 22:28:57 +01:00
|
|
|
end
|
2005-01-08 00:48:11 +01:00
|
|
|
return units
|
2005-01-03 22:28:57 +01:00
|
|
|
end
|