This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--show a list of 'spells' | |
local dlg=require("gui.dialogs") | |
function doNothing() | |
print("Doing nothing real good") | |
end | |
function greetAndStuff() | |
dlg.showMessage("Greetings", "Season's greatings and lols") | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--set target unit as king/queen | |
local unit=dfhack.gui.getSelectedUnit() | |
if not unit then qerror("No unit selected") end | |
local newfig=dfhack.units.getNemesis(unit).figure | |
local my_entity=df.historical_entity.find(df.global.ui.civ_id) | |
local monarch_id | |
for k,v in pairs(my_entity.positions.own) do | |
if v.code=="MONARCH" then | |
monarch_id=v.id | |
break |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--add races to the arena spawn list | |
local arena_spawn=df.global.world.arena_spawn | |
arena_spawn.race:resize(0) | |
arena_spawn.caste:resize(0) | |
for num,race in pairs(df.global.world.raws.creatures.all) do | |
for caste_id,caste in pairs(race.caste) do | |
arena_spawn.race:insert("#",num) | |
arena_spawn.caste:insert("#",caste_id) | |
end | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--teleport in travel map | |
local utils=require("utils") | |
if df.global.ui_advmode.travel_not_moved then | |
qerror("please leave current site") | |
end | |
print("Current location:",pos2xy(df.global.world.world_data.travel[0].pos)) | |
print("Teleport to:") | |
local tx=utils.prompt_input("x:",utils.check_number,"q") | |
local ty=utils.prompt_input("y:",utils.check_number,"q") | |
if tx and ty then |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
local events_by_type={} | |
for k,v in pairs(df.global.world.units.active) do | |
if dfhack.units.isCitizen(v) then | |
local mytypes={} | |
for idx,event in pairs(v.status.recent_events) do | |
local t=event.type | |
if mytypes[t]==nil then | |
if events_by_type[t] then | |
events_by_type[t]=events_by_type[t]+1 | |
else |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
local eventful=require("plugins.eventful") | |
function add_site(size,civ,site_type,name) | |
local x=(df.global.world.map.region_x+1)%16; | |
local y=(df.global.world.map.region_y+1)%16; | |
local minx,miny,maxx,maxy | |
if(x<size) then | |
minx=0 | |
maxx=2*size | |
elseif(x+size>16) then | |
maxx=16 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- adv mode waypoint system. | |
local args={...} | |
function printHelp() | |
print("An adventure mode travel map teleporation system.") | |
print(" -s <name> - save current position as <name> waypoint") | |
print(" -g <name> - goto waypoint <name>") | |
print(" -dg <name> - goto waypoint <name>") | |
print(" -d <name> - delete waypoint") | |
print(" -l (or no arguments) - list waypoint names") | |
listWaypoints() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
local race=465 | |
local modifiers={} | |
local modifiers_idx={} | |
local caste=df.creature_raw.find(race).caste[1] | |
local bp=caste.bp_appearance | |
local unit=dfhack.gui.getSelectedUnit() | |
for k,v in pairs(bp.modifiers) do | |
if v.noun=='hair' then | |
print(k,df.appearance_modifier_type[v.type]) | |
modifiers_idx[k]=true |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--traveling mk2 | |
--if map is loaded then | |
local dialog = require("gui.dialogs") | |
function showWaypointDialog(onSelect,onCancel) | |
local choices={} | |
local wps=dfhack.persistent.get_all('!WP!/',true) | |
if wps~=nil then | |
for k,v in ipairs(wps) do | |
table.insert(choices,{text=string.sub(v.key,6),x=v.ints[1],y=v.ints[2]}) | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- allows to do jobs in adv. mode. | |
--[==[ | |
version: 0.002 | |
changelog: | |
*0.002 | |
- kind-of fixed the item problem... now they get teleported (if teleport_items=true which should be default for adventurer) | |
- gather plants still not working... Other jobs seem to work. | |
- added new-and-improved waiting. Interestingly it could be improved to be interuptable. | |
--]==] |