From eb57473af5c5ea90d5471bef9fc40fe39c4b1f77 Mon Sep 17 00:00:00 2001 From: Enno Rehling Date: Sun, 15 May 2016 23:44:03 +0200 Subject: [PATCH] slightly relax limits on quality for new player regions --- scripts/eressea/autoseed.lua | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/scripts/eressea/autoseed.lua b/scripts/eressea/autoseed.lua index 5bdbf6c37..e948705c0 100644 --- a/scripts/eressea/autoseed.lua +++ b/scripts/eressea/autoseed.lua @@ -1,8 +1,8 @@ local autoseed = {} -- minimum required resources in the 7-hex neighborhood: -local peasants = 20000 -local trees = 1000 +local peasants = 10000 +local trees = 800 -- number of starters per region: local per_region = 2 @@ -23,8 +23,12 @@ local function select_regions(regions, peasants, trees) local sel = {} for r in regions do if not r.plane and r.terrain~="ocean" and not r.units() then - if score(r, "peasant") >= peasants and score(r, "tree") >= trees then - table.insert(sel, r) + sp = score(r, "peasant") + st = score(r, "tree") + if sp >= peasants then + if st >= trees then + table.insert(sel, r) + end end end end @@ -89,9 +93,10 @@ function autoseed.init() else for _, p in ipairs(players) do if num_seeded == per_region then - while not start or start.units() do - local index = 1 + (rng_int() % #sel) - start = sel[index] + local index = rng_int() % #sel + while not start do + start = sel[index + 1] + index = (index + 1) % #sel end num_seeded = 0 end @@ -99,10 +104,9 @@ function autoseed.init() if dupe then eressea.log.warning("seed: duplicate email " .. p.email .. " already used by " .. tostring(dupe)) else + print("new faction ".. p.email .. " starts in ".. tostring(start)) local f = seed(start, p.email, p.race or "human", p.lang or "de") num_seeded = num_seeded + 1 - print("new faction ".. tostring(f) .. " starts in ".. tostring(start)) - -- table.insert(newbs, f) end end end