slightly relax limits on quality for new player regions

This commit is contained in:
Enno Rehling 2016-05-15 23:44:03 +02:00
parent f2c02232cd
commit eb57473af5
1 changed files with 13 additions and 9 deletions

View File

@ -1,8 +1,8 @@
local autoseed = {} local autoseed = {}
-- minimum required resources in the 7-hex neighborhood: -- minimum required resources in the 7-hex neighborhood:
local peasants = 20000 local peasants = 10000
local trees = 1000 local trees = 800
-- number of starters per region: -- number of starters per region:
local per_region = 2 local per_region = 2
@ -23,8 +23,12 @@ local function select_regions(regions, peasants, trees)
local sel = {} local sel = {}
for r in regions do for r in regions do
if not r.plane and r.terrain~="ocean" and not r.units() then if not r.plane and r.terrain~="ocean" and not r.units() then
if score(r, "peasant") >= peasants and score(r, "tree") >= trees then sp = score(r, "peasant")
table.insert(sel, r) st = score(r, "tree")
if sp >= peasants then
if st >= trees then
table.insert(sel, r)
end
end end
end end
end end
@ -89,9 +93,10 @@ function autoseed.init()
else else
for _, p in ipairs(players) do for _, p in ipairs(players) do
if num_seeded == per_region then if num_seeded == per_region then
while not start or start.units() do local index = rng_int() % #sel
local index = 1 + (rng_int() % #sel) while not start do
start = sel[index] start = sel[index + 1]
index = (index + 1) % #sel
end end
num_seeded = 0 num_seeded = 0
end end
@ -99,10 +104,9 @@ function autoseed.init()
if dupe then if dupe then
eressea.log.warning("seed: duplicate email " .. p.email .. " already used by " .. tostring(dupe)) eressea.log.warning("seed: duplicate email " .. p.email .. " already used by " .. tostring(dupe))
else else
print("new faction ".. p.email .. " starts in ".. tostring(start))
local f = seed(start, p.email, p.race or "human", p.lang or "de") local f = seed(start, p.email, p.race or "human", p.lang or "de")
num_seeded = num_seeded + 1 num_seeded = num_seeded + 1
print("new faction ".. tostring(f) .. " starts in ".. tostring(start))
-- table.insert(newbs, f)
end end
end end
end end