Skip to content

Commit 5317e71

Browse files
committed
clean up force and modtools/force
and prevent crashy FeatureAttack events
1 parent 46a38cb commit 5317e71

3 files changed

Lines changed: 5 additions & 47 deletions

File tree

docs/force.rst

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ The recognized event types are:
3737
- ``Caravan``
3838
- ``Migrants``
3939
- ``Diplomat``
40-
- ``FeatureAttack`` (Underworld incursion)
4140
- ``Megabeast``
4241
- ``WildlifeCurious``
4342
- ``WildlifeMischievous``

force.lua

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,11 @@
11
-- Forces an event (wrapper for modtools/force)
2-
--[====[
3-
4-
force
5-
=====
6-
A simpler wrapper around the `modtools/force` script.
7-
8-
Usage:
9-
10-
- ``force event_type``
11-
- ``force event_type civ_id`` - civ ID required for ``Diplomat`` and ``Caravan``
12-
events
13-
14-
See `modtools/force` for a complete list of event types.
15-
16-
]====]
172

183
local utils = require 'utils'
194
local args = {...}
205
if #args < 1 then qerror('missing event type') end
216
if args[1]:find('help') then
22-
return print(dfhack.script_help())
7+
print(dfhack.script_help())
8+
return
239
end
2410
local eventType = nil
2511
for _, type in ipairs(df.timed_event_type) do

modtools/force.lua

Lines changed: 3 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,6 @@
11
-- Forces an event (caravan, migrants, etc)
22
-- author Putnam
33
-- edited by expwnent
4-
local help = [====[
5-
6-
modtools/force
7-
==============
8-
This tool triggers events like megabeasts, caravans, and migrants.
9-
10-
Usage::
11-
12-
-eventType event
13-
specify the type of the event to trigger
14-
examples:
15-
Megabeast
16-
Migrants
17-
Caravan
18-
Diplomat
19-
WildlifeCurious
20-
WildlifeMischievous
21-
WildlifeFlier
22-
NightCreature
23-
-civ entity
24-
specify the civ of the event, if applicable
25-
examples:
26-
player
27-
MOUNTAIN
28-
EVIL
29-
28
30-
31-
]====]
324
local utils = require 'utils'
335

346
local function findCiv(arg)
@@ -50,15 +22,16 @@ local validArgs = utils.invert({
5022

5123
local args = utils.processArgs({...}, validArgs)
5224
if args.help then
53-
print(help)
54-
print('force: -eventType [Megabeast, Migrants, Caravan, Diplomat, WildlifeCurious, WildlifeMischievous, WildlifeFlier, NightCreature] -civ [player,ENTITY_ID]')
25+
print(dfhack.script_help())
5526
return
5627
end
5728

5829
if not args.eventType then
5930
error 'Specify an eventType.'
6031
elseif not df.timed_event_type[args.eventType] then
6132
error('Invalid eventType: ' .. args.eventType)
33+
elseif args.eventType == 'FeatureAttack' then
34+
qerror('Event type: FeatureAttack is not currently supported')
6235
end
6336

6437
local civ = nil --as:df.historical_entity

0 commit comments

Comments
 (0)