2004-07-10 18:37:02 +02:00
|
|
|
-- this script contains the action functions for the two portals
|
|
|
|
-- used on the jadee/wildente wedding island. the two _action functions
|
|
|
|
-- are used as age() functions for a building_action with b:addaction("name")
|
|
|
|
|
2005-01-08 00:48:11 +01:00
|
|
|
if gate_travel==nil then
|
2005-03-23 19:55:47 +01:00
|
|
|
loadscript("gates.lua")
|
2005-01-03 22:28:57 +01:00
|
|
|
end
|
|
|
|
|
2004-07-10 18:37:02 +02:00
|
|
|
hellgate = nil
|
|
|
|
peacegate = nil
|
|
|
|
|
2005-01-03 22:28:57 +01:00
|
|
|
local function wedding_travellers(b)
|
2004-07-13 13:48:16 +02:00
|
|
|
local units = {}
|
|
|
|
|
|
|
|
for u in b.units do
|
2004-07-10 19:16:15 +02:00
|
|
|
if u:get_flag("wdgt") then
|
2004-07-13 13:48:16 +02:00
|
|
|
units[u] = u
|
2004-07-10 19:16:15 +02:00
|
|
|
end
|
2004-07-10 18:37:02 +02:00
|
|
|
end
|
2004-07-13 13:48:16 +02:00
|
|
|
return units
|
|
|
|
end
|
|
|
|
|
2005-01-03 22:28:57 +01:00
|
|
|
local function wedding_exchange(b1, b2)
|
2004-07-13 13:48:16 +02:00
|
|
|
local units1 = wedding_travellers(b1)
|
|
|
|
local units2 = wedding_travellers(b2)
|
|
|
|
|
2005-01-08 00:48:11 +01:00
|
|
|
gate_travel(b2, units1)
|
|
|
|
gate_travel(b1, units2)
|
2004-07-10 18:37:02 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
function hellgate_action(b)
|
|
|
|
if hellgate == nil then
|
|
|
|
hellgate = b
|
|
|
|
else
|
2004-07-13 13:48:16 +02:00
|
|
|
wedding_exchange(hellgate, b)
|
2004-07-10 18:37:02 +02:00
|
|
|
end
|
|
|
|
return 1
|
|
|
|
end
|
|
|
|
|
|
|
|
function peacegate_action(b)
|
|
|
|
if peacegate == nil then
|
|
|
|
peacegate = b
|
|
|
|
else
|
2005-01-03 22:28:57 +01:00
|
|
|
wedding_exchange(peacegate, b)
|
2004-07-10 18:37:02 +02:00
|
|
|
end
|
|
|
|
return 1
|
|
|
|
end
|