This file contains 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 skills to be changed with DFHack. | |
--[[ | |
Args are arranged like this: | |
unitID SKILL level ADD/SUBTRACT/SET | |
SKILL being anything such as DETAILSTONE, level being a number that it will be set to (15 is legendary, 0 is dabbling). | |
Add will add skill levels, subtract will subtract, set will place it at exactly the level you put in. | |
]] |
This file contains 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
do | |
local function thoughtIsNegative(thought) | |
return df.unit_thought_type.attrs[thought.type].value:sub(1,1)=='-' and df.unit_thought_type[thought.type]~='LackChairs' | |
end | |
local function write_gamelog_and_announce(msg,color) | |
dfhack.gui.showAnnouncement(msg,color) | |
local log = io.open('gamelog.txt', 'a') | |
log:write(msg.."\n") | |
log:close() | |
end |
This file contains 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 utils = require('utils') | |
validArgs = utils.invert({ | |
'all', | |
'citizens', | |
'named', | |
'notStraight', | |
'gayOnly', | |
'biOnly', | |
'straightOnly', |
This file contains 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
-- Adds emotions to creatures. | |
local utils=require('utils') | |
local function addEmotionToUnit(emotions,thought,emotion,subthought,severity) | |
if not (type(emotion)=='number') then emotion=df.emotion_type[emotion] end | |
if not (type(thought)=='number') then thought=df.unit_thought_type[thought] end | |
emotions:insert('#',{new=df.unit_personality.T_emotions, | |
type=emotion, | |
unk2=1, |
This file contains 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
-- lets babies be adopted by couples with no infants. | |
local function getSpouseOrLover(unit) | |
local lover_unit=df.unit.find(unit.relations.lover_id) or df.unit.find(unit.relations.spouse_id) | |
if lover_unit then | |
return lover_unit.hist_figure_id | |
else | |
local hist_fig=df.historical_figure.find(unit.hist_figure_id) | |
for k,v in ipairs(hist_fig.histfig_links) do | |
if df.histfig_hf_link_spousest:is_instance(v) or df.histfig_hf_link_loverst:is_instance(v) then |
This file contains 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 utils=require('utils') | |
validArgs = validArgs or utils.invert({ | |
'pets' | |
}) | |
local args = utils.processArgs({...}, validArgs) | |
for k,v in ipairs(df.global.world.buildings.other.COFFIN) do | |
if v.owner_id==-1 then |
This file contains 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 function getRaceName() | |
return df.creature_raw.find(df.global.ui.race_id).name[1] | |
end | |
local function emotionIsNegative(thought) | |
return thought.type~=-1 and df.emotion_type.attrs[thought.type].divider>0 | |
end | |
local function write_gamelog_and_announce(msg,color) | |
dfhack.gui.showAnnouncement(msg,color) | |
dfhack.gui.writeToGamelog(msg) | |
end |
This file contains 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 creatures = assert(io.open(dfhack.getDFPath()..'/generated_creatures.txt', 'w')) | |
local items = assert(io.open(dfhack.getDFPath()..'/generated_items.txt', 'w')) | |
local materials = assert(io.open(dfhack.getDFPath()..'/generated_materials.txt', 'w')) | |
local entities = assert(io.open(dfhack.getDFPath()..'/generated_entities.txt', 'w')) | |
local interactions = assert(io.open(dfhack.getDFPath()..'/generated_interactions.txt', 'w')) |
This file contains 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
function unMount (rider,horse) | |
--for k,horse in pairs(unit_list) do | |
--if unit_rider.pos.x==horse.pos.x and unit_rider.pos.y==horse.pos.y | |
--and unit_rider.pos.z==horse.pos.z then --check if they are on the same tile | |
for i=#horse.general_refs-1,0,-1 do | |
if df.general_ref_unit_riderst:is_instance(horse.general_refs[i]) then horse.general_refs:erase(i) end | |
end | |
rider.relations.rider_mount_id=-1 | |
rider.flags1.rider=false | |
horse.flags1.ridden=false |
This file contains 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
-- Adds extra functionality to projectiles. Use the argument "disable" (minus quotes) to disable. | |
flowtypes = { | |
miasma = 0, | |
mist = 1, | |
mist2 = 2, | |
dust = 3, | |
lavaMist = 4, | |
smoke = 5, | |
dragonFire = 6, |
OlderNewer