From 36d1956c12a6609141ae28051220e1f27e1318b1 Mon Sep 17 00:00:00 2001 From: Enno Rehling Date: Sat, 1 Jan 2005 17:50:35 +0000 Subject: [PATCH] =?UTF-8?q?Server=20startet=20eressea.lua,=20nicht=20defau?= =?UTF-8?q?lt.lua=20Das=20crasht=20allerdings=20momentan=20bei=20einem=20G?= =?UTF-8?q?eb=C3=A4ude!?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/scripts/default.lua | 16 ---------------- src/scripts/eressea.lua | 37 ++++++++++++++++++------------------- src/scripts/ponnuki.lua | 10 +++++++++- 3 files changed, 27 insertions(+), 36 deletions(-) diff --git a/src/scripts/default.lua b/src/scripts/default.lua index 94dbe7a56..2f71d017a 100644 --- a/src/scripts/default.lua +++ b/src/scripts/default.lua @@ -18,19 +18,6 @@ function write_emails() end end -function run_scripts() - scripts = { - "xmas2004.lua" - } - for index in scripts do - local script = scriptpath .. "/" .. scripts[index] - print("- loading " .. script) - if pcall(dofile, script)==0 then - print("Could not load " .. script) - end - end -end - function process(orders) file = "" .. get_turn() if read_game(file)~=0 then @@ -49,9 +36,6 @@ function process(orders) read_orders(orders) plan_monsters() - -- load scripts: - run_scripts() - -- process_orders() diff --git a/src/scripts/eressea.lua b/src/scripts/eressea.lua index fb3ddbd85..58b6b2949 100644 --- a/src/scripts/eressea.lua +++ b/src/scripts/eressea.lua @@ -1,3 +1,19 @@ +function run_scripts() + scripts = { + "wedding-jadee.lua", + "eternath.lua", + "ponnuki.lua", + "xmas2004.lua" + } + for index in scripts do + local script = scriptpath .. "/" .. scripts[index] + print("- loading " .. script) + if pcall(dofile, script)==0 then + print("Could not load " .. script) + end + end +end + function write_emails() local locales = { "de", "en" } local files = {} @@ -32,15 +48,10 @@ function process(orders) add_equipment("stone", 30); add_equipment("money", 2000 + get_turn() * 10); - -- initialize other scripts - local magrathea = get_region(-67, -5) - if magrathea~=nil and init_ponnuki~=nil then - init_ponnuki(magrathea) - return - end - -- run the turn: read_orders(orders) + run_scripts() + plan_monsters() process_orders() @@ -61,22 +72,10 @@ end -- main body of script -- -scripts = { - "wedding-jadee.lua", - "eternath.lua", - "ponnuki.lua" -} - -- orderfile: contains the name of the orders. if orderfile==nil then print "you must specify an orderfile" else - for index in scripts do - local script = scriptpath .. scripts[index] - if pcall(dofile, script)==0 then - print("Could not load " .. script) - end - end process(orderfile) end diff --git a/src/scripts/ponnuki.lua b/src/scripts/ponnuki.lua index 5a47e15f2..7b4faa494 100644 --- a/src/scripts/ponnuki.lua +++ b/src/scripts/ponnuki.lua @@ -17,7 +17,7 @@ function ponnuki_brain(u) u:add_order("NACH " .. directions[d]) end -function init_ponnuki(home) +local function init_ponnuki(home) local f = get_faction(0) local u = get_unit(atoi36("ponn")) if u == nil then @@ -32,3 +32,11 @@ function init_ponnuki(home) u:set_brain(ponnuki_brain) end end + +-- initialize other scripts +local magrathea = get_region(-67, -5) +if magrathea~=nil and init_ponnuki~=nil then + init_ponnuki(magrathea) + return +end +