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
--replaces jobs with selected race workers | |
local trg_race=338 | |
local workers={} | |
local bad_jobs={} | |
for k,v in pairs(df.global.world.units.active) do --find possible workers | |
if v.civ_id==df.global.ui.civ_id and v.race==trg_race and v.job.current_job==nil and not v.flags1.dead then | |
table.insert(workers,v) | |
end | |
end | |
local last_id,jobs=dfhack.job.listNewlyCreated(0) |
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
--create fake identity and apply to yourself | |
local adv=df.global.world.units.active[0] | |
args={...} | |
function printHelp() | |
print("Assume different identity") | |
print("-n <name> - same race/caste different name") | |
print("-h <hist_id> - by historical figure id") | |
print("-r - remove identity") | |
print("-s <id>: select identity from a list") | |
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
unit = dfhack.gui.getSelectedUnit() | |
Physical = {STRENGTH=450, TOUGHNESS=950} | |
P_Attributes = unit.body.physical_attrs | |
M_Attributes = unit.status.current_sould.mental_attrs | |
for attrName, attrValue in pairs(Physical) do | |
P_Attributes[attrName].value = attrValue |
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
unit = dfhack.gui.getSelectedUnit() | |
PlusPlus = {700, 1200, 1400, 1500, 1600, 1800, 2500} | |
Plus = {450, 950, 1150, 1250, 1350, 1550, 2250} | |
Normal = {200, 700, 900, 1000, 1100, 1300, 2000} | |
Minus = {150, 600, 800, 900, 1000, 1100, 1500} | |
Mental_Attribute_Names = { | |
Mental_PlusPlus = {"FOCUS", "SPATIAL_SENSE"}, | |
Mental_Plus = {"ANALYTICAL_ABILITY", "FOCUS", "CREATIVITY", "PATIENCE", "MEMORY"}, |
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
TraitArrayBins = defclass(TraitArrayBins) | |
TraitArrayBins.ATTRS={ | |
name=DEFAULT_NIL, | |
traitMin=0, | |
traitMed=0, | |
traitMax=0, | |
} | |
function TraitArrayBins.init(args) --not sure if needed |
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
myclass=defclass(myclass) | |
myclass.ATTRS={name="default name"} | |
function myclass:init(args) | |
print("--constructing--") | |
printall(args) | |
end | |
function myclass:tostring() | |
return self.name .. (self.id or 0) | |
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
--create unit at pointer or given location. Usage e.g. "spawnunit DWARF 0 Dwarfy" | |
--Made by warmist, but edited by Putnam for the dragon ball mod to be used in reactions | |
--note that it's extensible to any autosyndrome reaction to spawn anything due to this; to use in autosyndrome, you want \COMMAND spawnunit CREATURE caste_number name \LOCATION | |
args={...} | |
function getCaste(race_id,caste_id) | |
local cr=df.creature_raw.find(race_id) | |
return cr.caste[caste_id] |
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
{name="Mount",f=function (unit_list,pos) | |
horse=getCreatureAtPointer() | |
for k,unit_rider 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 | |
horse.general_refs:insert("#",{new=df.general_ref_unit_riderst,unit_id=unit_rider.id}) | |
unit_rider.relations.rider_mount_id=horse.id | |
unit_rider.flags1.rider=true | |
horse.flags1.ridden=true | |
insert_sorted(df.global.world.units.other.ANY_RIDER,unit_rider,"id") |
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 ev=require("plugins.eventful") | |
local freq={[1]=10,[2]=5,[3]=500,[4]=1000,[5]=500,[6]=100,[7]=1,[8]=1000} | |
for k,v in pairs(freq) do | |
ev.enableEvent(k,v) | |
end | |
ev.onBuildingCreatedDestroyed.one=function(id) print("building cr/d:",id) end | |
ev.onConstructionCreatedDestroyed.one=function(id) print("construct cr/d:",id) end | |
ev.onJobInitiated.one=function(job) print("job init:",job) end | |
ev.onJobCompleted.one=function(job) print("job complete :",job) end | |
ev.onUnitDeath.one=function(id) print("death:",id) 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
function loopFix() | |
dofile('hack/scripts/fix/population-cap.lua') | |
dfhack.timeout(3,'months',loopFix) | |
end | |
loopFix() |