From 03a8c6a89f1a8df73f05bcb4d6dc6c68ac80e35a Mon Sep 17 00:00:00 2001 From: Enno Rehling Date: Sat, 4 Jul 2015 23:42:41 +0200 Subject: [PATCH] avoid monsters: only seed new factions in hexes that have no units nearby. --- scripts/populate.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/populate.lua b/scripts/populate.lua index dfd07b5dd..5df2ad92f 100644 --- a/scripts/populate.lua +++ b/scripts/populate.lua @@ -6,7 +6,7 @@ local function score(r, res) local x, y, rn local peas = r:get_resource(res) for _, rn in pairs(r.adj) do - if rn then + if rn and not rn.units() then peas = peas + rn:get_resource(res) end end @@ -16,7 +16,7 @@ end local function select(regions, limit) local sel = {} 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) if s >= limit then table.insert(sel, r)