diggingInvaders: tweak invasion-now to be more useful.

develop
expwnent 2013-06-11 02:30:52 -04:00
parent 0378bbb896
commit 3e7bce8f2f
1 changed files with 15 additions and 4 deletions

@ -1,9 +1,20 @@
-- invasion-now civ_id delay : schedules an invasion in the near future
-- invasion-now civName start end : schedules an invasion in the near future, or several
args = {...}
num = tonumber(args[1])
civName = args[1]
if ( num ~= nil ) then
if ( civName ~= nil ) then
--find the civ with that name
evilEntity = nil;
for _,candidate in ipairs(df.global.world.entities.all) do
if candidate.entity_raw.code == civName then
evilEntity = candidate
break
end
end
if ( evilEntity == nil ) then
do return end
end
time = tonumber(args[2]) or 1
time2 = tonumber(args[3]) or time
for i = time,time2 do
@ -12,7 +23,7 @@ if ( num ~= nil ) then
type = df.timed_event_type.CivAttack,
season = df.global.cur_season,
season_ticks = df.global.cur_season_tick+i,
entity = df.historical_entity.find(num)
entity = evilEntity
})
end
end