File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ -- 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+ ]====]
17+
18+ utils = require ' utils'
19+ args = {... }
20+ if # args < 1 then qerror (' missing event type' ) end
21+ eventType = nil
22+ for _ , type in ipairs (df .timed_event_type ) do
23+ if type :lower () == args [1 ]:lower () then
24+ eventType = type
25+ end
26+ end
27+ if not eventType then
28+ qerror (' unknown event type: ' .. args [1 ])
29+ end
30+
31+ newArgs = {' -eventType' , eventType }
32+ if eventType == ' Caravan' or eventType == ' Diplomat' then
33+ if not args [2 ] then
34+ qerror (' event type ' .. eventType .. ' requires civ ID' )
35+ else
36+ table.insert (newArgs , ' -civ' )
37+ table.insert (newArgs , args [2 ])
38+ end
39+ end
40+
41+ dfhack .run_script (' modtools/force' , table.unpack (newArgs ))
You can’t perform that action at this time.
0 commit comments