From 3e7bce8f2f0122ee074a01df49574837469b4340 Mon Sep 17 00:00:00 2001 From: expwnent Date: Tue, 11 Jun 2013 02:30:52 -0400 Subject: [PATCH] diggingInvaders: tweak invasion-now to be more useful. --- scripts/devel/invasion-now.lua | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/scripts/devel/invasion-now.lua b/scripts/devel/invasion-now.lua index a2b29231f..6328120a9 100644 --- a/scripts/devel/invasion-now.lua +++ b/scripts/devel/invasion-now.lua @@ -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