From 4bb1033947056ea75e6a4e1b9f1e2f562d8936a4 Mon Sep 17 00:00:00 2001 From: Enno Rehling Date: Sat, 10 Jul 2004 16:37:02 +0000 Subject: [PATCH] Ein Script, um die Gates aus der Hochzeit zu bedienen. --- src/scripts/eressea.lua | 2 +- src/scripts/wedding-jadee.lua | 41 +++++++++++++++++++++++++++++++++++ 2 files changed, 42 insertions(+), 1 deletion(-) create mode 100644 src/scripts/wedding-jadee.lua diff --git a/src/scripts/eressea.lua b/src/scripts/eressea.lua index 73353403c..02632ff99 100644 --- a/src/scripts/eressea.lua +++ b/src/scripts/eressea.lua @@ -61,7 +61,7 @@ end -- main body of script -- -scripts= { "ponnuki.lua" } +scripts = { "ponnuki.lua", "wedding-jadee.lua" } -- orderfile: contains the name of the orders. if orderfile==nil then diff --git a/src/scripts/wedding-jadee.lua b/src/scripts/wedding-jadee.lua new file mode 100644 index 000000000..e6d92ecb7 --- /dev/null +++ b/src/scripts/wedding-jadee.lua @@ -0,0 +1,41 @@ +-- 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") + +hellgate = nil +peacegate = nil + +function gate_exchange(b1, b2) + local units = {} + local u + for u in b1.units do + units[u.no] = u + end + for u in b2.units do + u.region = b1.region + u.building = b1 + end + for id in units do + u = units[id] + u.region = b2.region + u.building = b2 + end +end + +function hellgate_action(b) + if hellgate == nil then + hellgate = b + else + gate_exchange(hellgate, b) + end + return 1 +end + +function peacegate_action(b) + if peacegate == nil then + peacegate = b + else + gate_exchange(peacegate, b) + end + return 1 +end