From 57cb0c73fcaf08efe520c431b02ec77793416adc Mon Sep 17 00:00:00 2001 From: Enno Rehling Date: Sun, 11 Dec 2005 12:33:57 +0000 Subject: [PATCH] embassies in a separate file --- src/scripts/eressea.lua | 31 +++---------------------------- src/scripts/eressea/embassy.lua | 27 +++++++++++++++++++++++++++ 2 files changed, 30 insertions(+), 28 deletions(-) create mode 100644 src/scripts/eressea/embassy.lua diff --git a/src/scripts/eressea.lua b/src/scripts/eressea.lua index d50ade68c..f50ec86e5 100644 --- a/src/scripts/eressea.lua +++ b/src/scripts/eressea.lua @@ -28,39 +28,14 @@ function run_scripts() "write_emails.lua", "eressea/eternath.lua", "eressea/wedding-jadee.lua", - "eressea/ponnuki.lua" + "eressea/ponnuki.lua", + "eressea/embassy.lua" } for index in scripts do loadscript(scripts[index]) end end -function use_seashell(u, amount) --- Muschelplateau... - local visit = u.faction.objects["muschel"] - if visit~=nil then - local turns = get_turn() - visit - local msg = message("msg_event") - msg:set_string("string", tostring(u) .. " erzählt den Bewohnern von " .. r.name .. " von Muschelplateau, das seine Partei vor " .. turns .. " Wochen besucht hat." ) - msg:send_region(u.region) - end -end - -function update_special() --- Muschelplateau - local r = get_region(165,30) - if r~=nil then - local u - for u in r.units do - if u.faction.objects["muschel"]~=nil then - if (u.faction.add_item("muschel", 1)>0) then - u.faction.objects["seashell"] = get_turn() - end - end - end - end -end - function process(orders) -- initialize starting equipment for new players equipment_setitem("new_faction", "conquesttoken", "1"); @@ -94,7 +69,7 @@ function process(orders) process_orders() -- post-turn updates: - update_special() + update_embassies() update_guards() update_scores() diff --git a/src/scripts/eressea/embassy.lua b/src/scripts/eressea/embassy.lua new file mode 100644 index 000000000..91b8642a5 --- /dev/null +++ b/src/scripts/eressea/embassy.lua @@ -0,0 +1,27 @@ +function use_seashell(u, amount) +-- Muschelplateau... + local visit = u.faction.objects:get("embassy_muschel") + if visit~=nil then + local turns = get_turn() - visit + local msg = message("msg_event") + msg:set_string("string", tostring(u) .. " erzählt den Bewohnern von " .. r.name .. " von Muschelplateau, das seine Partei vor " .. turns .. " Wochen besucht hat." ) + msg:send_region(u.region) + end +end + +function update_embassies() +-- Muschelplateau + local r = get_region(165,30) + if r~=nil then + local u + for u in r.units do + if u.faction.objects:get("embassy_muschel")==nil then + if (u.faction:add_item("seashell", 1)>0) then + print(u.faction) + u.faction.objects:set("embassy_muschel", get_turn()) + end + end + end + end +end +