Created
November 12, 2012 21:17
-
-
Save warmist/4061959 to your computer and use it in GitHub Desktop.
Syndrome stuff
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 d = require('gui.dialogs') | |
function assignSyndrome(target,syn_id) | |
if target==nil then | |
qerror("Not a valid target") | |
end | |
local ns=df.unit_syndrome:new() | |
local trg_syn=df.syndrome.find(syn_id) | |
ns.type=trg_syn.id | |
--ns.year= | |
--ns.year_time= | |
ns.ticks=1 | |
ns.unk1=1 | |
for k,v in ipairs(trg_syn.ce) do | |
local sympt=df.unit_syndrome.T_symptoms:new() | |
sympt.ticks=1 | |
sympt.flags=2 | |
ns.symptoms:insert("#",sympt) | |
end | |
target.syndromes.active:insert("#",ns) | |
end | |
function InjectSyndrome() | |
local syns=df.global.world.raws.syndromes.all | |
local tbl={} | |
local tunit=dfhack.gui.getSelectedUnit() | |
for k,v in ipairs(syns) do | |
local name=v.syn_name | |
if name=="" then name="?" end | |
table.insert(tbl,{name,nil,v.id}) | |
end | |
local f=function(name,C) | |
assignSyndrome(tunit,C[3]) | |
end | |
d.showListPrompt("Syndrome Selection","Choose syndrome:",COLOR_WHITE,tbl,f) | |
end | |
InjectSyndrome() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment