Registry Mirror
搜索
Skip to content
You signed in with another tab or window.
Reload
to refresh your session.
You signed out in another tab or window.
Reload
to refresh your session.
You switched accounts on another tab or window.
Reload
to refresh your session.
Dismiss alert
{{ message }}
Files
Expand file tree
master
Breadcrumbs
scripts
/
force.lua
Copy path
Blame
More file actions
Blame
More file actions
Latest commit
History
History
History
44 lines (36 loc) · 1.03 KB
master
Breadcrumbs
scripts
/
force.lua
Copy path
Top
File metadata and controls
Code
Blame
44 lines (36 loc) · 1.03 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
-- Forces an event (wrapper for modtools/force)
--[====[
force
=====
A simpler wrapper around the `modtools/force` script.
Usage:
- ``force event_type``
- ``force event_type civ_id`` - civ ID required for ``Diplomat`` and ``Caravan``
events
See `modtools/force` for a complete list of event types.
]====]
local utils = require 'utils'
local args = {...}
if #args < 1 then qerror('missing event type') end
if args[1]:find('help') then
return print(dfhack.script_help())
end
local eventType = nil
for _, type in ipairs(df.timed_event_type) do
if type:lower() == args[1]:lower() then
eventType = type
end
end
if not eventType then
qerror('unknown event type: ' .. args[1])
end
local newArgs = {'-eventType', eventType}
if eventType == 'Caravan' or eventType == 'Diplomat' then
if not args[2] then
qerror('event type ' .. eventType .. ' requires civ ID')
else
table.insert(newArgs, '-civ')
table.insert(newArgs, args[2])
end
end
dfhack.run_script('modtools/force', table.unpack(newArgs))
You can’t perform that action at this time.