server/scripts/eressea/embassy.lua

47 lines
1.3 KiB
Lua
Raw Permalink Normal View History

-- Muschelplateau
if not config.embassy or config.embassy==0 then return nil end
2017-01-22 11:38:01 +01:00
local embassy = {}
local home = nil
-- global exports (use item)
function use_seashell(u, amount)
-- Muschelplateau...
local visit = u.faction:get_key('mupL')
if visit and u.region~= home then
local turns = get_turn() - visit
local msg = message.create('msg_event')
msg:set_string("string", u.name .. "(" .. itoa36(u.id) .. ") erzählt den Bewohnern von " .. u.region.name .. " von Muschelplateau, das die Partei " .. u.faction.name .. " vor " .. turns .. " Wochen besucht hat." )
msg:send_region(u.region)
return 0
end
return -4
end
function embassy.init()
home = get_region(165,30)
if home==nil then
eressea.log.error("cannot find embassy region 'Muschelplateau'")
end
2010-08-08 09:40:42 +02:00
end
function embassy.update()
-- Muschelplateau
if home==nil then
return
end
2019-04-28 18:30:54 +02:00
eressea.log.info("updating embassies in " .. tostring(home))
2010-08-08 09:40:42 +02:00
local u
for u in home.units do
2019-04-28 18:30:54 +02:00
if not u.faction:get_key('mupL') then
if u.faction:add_item('seashell', 1) > 0 then
eressea.log.info("new seashell for " .. tostring(u.faction))
u.faction:set_key('mupL', get_turn())
end
2010-08-08 09:40:42 +02:00
end
end
end
return embassy