forked from github/server
Merge pull request #150 from badgerman/bug-2077-ents
Bug 2077: ents were created as undead
This commit is contained in:
commit
cbb88d0d11
|
@ -1,7 +1,7 @@
|
||||||
local function create_ents(r, number)
|
local function create_ents(r, number)
|
||||||
local f = get_faction(666)
|
local f = get_faction(666)
|
||||||
if f~=nil and number>0 then
|
if f~=nil and number>0 then
|
||||||
u = unit.create(f, r, number)
|
u = unit.create(f, r, number, "ent")
|
||||||
u.name = "Wütende Ents"
|
u.name = "Wütende Ents"
|
||||||
u:set_skill("perception", 2)
|
u:set_skill("perception", 2)
|
||||||
|
|
||||||
|
@ -13,11 +13,21 @@ local function create_ents(r, number)
|
||||||
return nil
|
return nil
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local function repair_ents(r)
|
||||||
|
for u in r.units do
|
||||||
|
if u.faction.id==666 and u.race == "undead" and u.name == "Wütende Ents" then
|
||||||
|
print("ent repair", u)
|
||||||
|
u.race = "ent"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
local ents = {}
|
local ents = {}
|
||||||
|
|
||||||
function ents.update()
|
function ents.update()
|
||||||
local r
|
local r
|
||||||
for r in regions() do
|
for r in regions() do
|
||||||
|
repair_ents(r)
|
||||||
if r:get_flag(0) then -- RF_CHAOTIC
|
if r:get_flag(0) then -- RF_CHAOTIC
|
||||||
if r.terrain == "plain" and r:get_resource("tree")==0 then
|
if r.terrain == "plain" and r:get_resource("tree")==0 then
|
||||||
if math.random(3)==1 then
|
if math.random(3)==1 then
|
||||||
|
|
Loading…
Reference in New Issue