forked from github/server
avoid monsters: only seed new factions in hexes that have no units nearby.
This commit is contained in:
parent
ae8c448698
commit
03a8c6a89f
|
@ -6,7 +6,7 @@ local function score(r, res)
|
||||||
local x, y, rn
|
local x, y, rn
|
||||||
local peas = r:get_resource(res)
|
local peas = r:get_resource(res)
|
||||||
for _, rn in pairs(r.adj) do
|
for _, rn in pairs(r.adj) do
|
||||||
if rn then
|
if rn and not rn.units() then
|
||||||
peas = peas + rn:get_resource(res)
|
peas = peas + rn:get_resource(res)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -16,7 +16,7 @@ end
|
||||||
local function select(regions, limit)
|
local function select(regions, limit)
|
||||||
local sel = {}
|
local sel = {}
|
||||||
for r in regions do
|
for r in regions do
|
||||||
if r.terrain~="ocean" and r.units()==nil then
|
if r.terrain~="ocean" and not r.units() then
|
||||||
s = score(r)
|
s = score(r)
|
||||||
if s >= limit then
|
if s >= limit then
|
||||||
table.insert(sel, r)
|
table.insert(sel, r)
|
||||||
|
|
Loading…
Reference in New Issue