server/scripts/e3a/main.lua

65 lines
1.2 KiB
Lua
Raw Normal View History

2010-08-08 09:40:42 +02:00
require "multis"
2010-09-12 04:12:04 +02:00
require "e3a.frost"
2010-08-08 09:40:42 +02:00
function process(orders)
local confirmed_multis = { }
local suspected_multis = { }
if open_game(get_turn())~=0 then
print("could not read game")
return -1
end
init_summary()
-- kill multi-players (external script)
kill_multis(confirmed_multis, false)
mark_multis(suspected_multis, false)
-- run the turn:
if read_orders(orders) ~= 0 then
print("could not read " .. orders)
return -1
end
-- plan_monsters()
local mon = get_faction(666)
if mon ~= nil then
mon.lastturn = get_turn()
end
if nmr_check(config.maxnmrs or 30)~=0 then
return -1
end
process_orders()
if xmas2009~=nil then
xmas2009()
end
-- create new monsters:
spawn_dragons()
spawn_undead()
-- spawn_braineaters(0.25)
-- spawn_ents()
-- post-turn updates:
update_guards()
update_scores()
2010-09-12 04:12:04 +02:00
frost.update()
2010-08-08 09:40:42 +02:00
local localechange = { en = { "L46o" } }
2010-08-08 09:40:42 +02:00
change_locales(localechange)
-- use newfactions file to place out new players
-- autoseed(config.basepath .. "/newfactions", false)
write_files(config.locales)
file = "" .. get_turn() .. ".dat"
2012-06-17 02:54:05 +02:00
if eressea.write_game(file)~=0 then
2010-08-08 09:40:42 +02:00
print("could not write game")
return -1
end
return 0
end