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 = {}
-- 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