fewer units for new players, two players per region

This commit is contained in:
Enno Rehling 2015-06-26 14:19:36 +02:00
parent 7cf1062650
commit b7b20bdec6
1 changed files with 10 additions and 34 deletions

View File

@ -30,38 +30,8 @@ local function seed(r, email, race, lang)
for it, num in pairs(items) do for it, num in pairs(items) do
u:add_item(it, num) u:add_item(it, num)
end end
u = nil
skills ={
"crossbow",
"bow",
"building",
"trade",
"forestry",
"catapult",
"herbalism",
"training",
"riding",
"armorer",
"shipcraft",
"melee",
"sailing",
"polearm",
"espionage",
"roadwork",
"tactics",
"stealth",
"weaponsmithing",
"cartmaking",
"taxation",
"stamina"
}
unit.create(f, r, 50):set_skill("entertainment", 15)
unit.create(f, r, 5):set_skill("mining", 30) unit.create(f, r, 5):set_skill("mining", 30)
unit.create(f, r, 5):set_skill("quarrying", 30) unit.create(f, r, 5):set_skill("quarrying", 30)
for _, sk in ipairs(skills) do
u = u or unit.create(f, r, 5)
if u:set_skill(sk, 15)>0 then u=nil end
end
return f return f
end end
@ -94,11 +64,16 @@ end
math.randomseed(os.time()) math.randomseed(os.time())
local newbs = {} local newbs = {}
local per_region = 2
local num_seeded = 2
local start = nil
for _, p in ipairs(players) do for _, p in ipairs(players) do
local index = math.random(#sel) if num_seeded == per_region then
local start = nil while not start or start.units() do
while not start or start.units() do local index = math.random(#sel)
start = sel[index] start = sel[index]
end
num_seeded = 0
end end
local dupe = false local dupe = false
for f in factions() do for f in factions() do
@ -109,6 +84,7 @@ for _, p in ipairs(players) do
end end
end end
if not dupe then if not dupe then
num_seeded = num_seeded + 1
f = seed(start, p.email, p.race or "human", p.lang or "de") f = seed(start, p.email, p.race or "human", p.lang or "de")
print("new faction ".. tostring(f) .. " starts in ".. tostring(start)) print("new faction ".. tostring(f) .. " starts in ".. tostring(start))
table.insert(newbs, f) table.insert(newbs, f)