diff options
| author | Warmist | 2012-04-04 02:06:35 +0300 |
|---|---|---|
| committer | Warmist | 2012-04-04 02:06:35 +0300 |
| commit | 179c6e4025c019f15ac59ff7c84922a0a57a0a1c (patch) | |
| tree | 4d52febc68eec4e699efd02fba1da84d2aee47eb /plugins/Dfusion | |
| parent | 6a6ca516c37243081f107518b167424e79a75bcc (diff) | |
| download | dfhack-179c6e4025c019f15ac59ff7c84922a0a57a0a1c.tar.gz dfhack-179c6e4025c019f15ac59ff7c84922a0a57a0a1c.tar.bz2 dfhack-179c6e4025c019f15ac59ff7c84922a0a57a0a1c.tar.xz | |
Revived adv_tools, with new reincarnate command.
Diffstat (limited to 'plugins/Dfusion')
| -rw-r--r-- | plugins/Dfusion/luafiles/adv_tools/init.lua | 58 | ||||
| -rw-r--r-- | plugins/Dfusion/luafiles/adv_tools/plugin.lua | 3 | ||||
| -rw-r--r-- | plugins/Dfusion/luafiles/init.lua | 3 | ||||
| -rw-r--r-- | plugins/Dfusion/luafiles/tools/init.lua | 2 |
4 files changed, 62 insertions, 4 deletions
diff --git a/plugins/Dfusion/luafiles/adv_tools/init.lua b/plugins/Dfusion/luafiles/adv_tools/init.lua index 4550f837..ae0947ed 100644 --- a/plugins/Dfusion/luafiles/adv_tools/init.lua +++ b/plugins/Dfusion/luafiles/adv_tools/init.lua @@ -1,6 +1,60 @@ -adv_tools=adv_tools or {} -adv_tools.menu=adv_tools.menu or MakeMenu() +adv_tools= {} +adv_tools.menu=MakeMenu() --TODO make every tool generic (work for both modes) +function adv_tools.reincarnate(swap_soul) --only for adventurer i guess, TODO soul swap... + if swap_soul==nil then + swap_soul=true + end + local adv=df.global.world.units.other[0][0] + if adv.flags1.dead==false then + error("You are not dead (yet)!") + end + local hist_fig=getNemesis(adv).figure + if hist_fig==nil then + error("No historical figure for adventurer...") + end + local events=df.global.world.history.events + local trg_hist_fig + for i=#events-1,0,-1 do + if df.history_event_hist_figure_diedst:is_instance(events[i]) then + --print("is instance:"..i) + if events[i].hfid==hist_fig.id then + --print("Is same id:"..i) + trg_hist_fig=events[i].slayer + break + end + end + end + if trg_hist_fig ==nil then + error("Slayer not found") + end + local trg_unit + for k,v in pairs(df.global.world.history.figures) do --maybe getting it by [] would be enought? + if v.id==trg_hist_fig then + trg_unit=v.unit_id + break + end + end + if trg_unit==nil then + error("Unit id not found!") + end + local trg_unit_final + for k,v in pairs(df.global.world.units.all) do + if v.id==trg_unit then + trg_unit_final=v + break + end + end + tools.change_adv(trg_unit_final) + if swap_souls then --actually add a soul... + t_soul=adv.status.cur_soul + adv.status.cur_soul=df.NULL + adv.status.souls:resize(0) + trg_unit_final.status.cur_soul=t_soul + trg_unit_final.status.souls:insert(#trg_unit_final.status.souls,t_soul) + end +end +adv_tools.menu:add("Reincarnate",adv_tools.reincarnate) function adv_tools.ressurect() v2=engine.peek(vector:getval(indx),ptr_Creature.hurt1) diff --git a/plugins/Dfusion/luafiles/adv_tools/plugin.lua b/plugins/Dfusion/luafiles/adv_tools/plugin.lua index e69de29b..cdd81e06 100644 --- a/plugins/Dfusion/luafiles/adv_tools/plugin.lua +++ b/plugins/Dfusion/luafiles/adv_tools/plugin.lua @@ -0,0 +1,3 @@ +if not(FILE) then + adv_tools.menu:display() +end
\ No newline at end of file diff --git a/plugins/Dfusion/luafiles/init.lua b/plugins/Dfusion/luafiles/init.lua index 57014e51..358f93d0 100644 --- a/plugins/Dfusion/luafiles/init.lua +++ b/plugins/Dfusion/luafiles/init.lua @@ -73,7 +73,7 @@ table.insert(plugins,{"friendship","Multi race fort enabler"}) table.insert(plugins,{"offsets","Find all offsets"}) table.insert(plugins,{"friendship_civ","Multi civ fort enabler"}) -table.insert(plugins,{"adv_tools","some tools for (mainly) advneturer hacking"}) + table.insert(plugins,{"triggers","a function calling plug (discontinued...)"}) table.insert(plugins,{"migrants","multi race imigrations"}) @@ -81,6 +81,7 @@ table.insert(plugins,{"migrants","multi race imigrations"}) --table.insert(plugins,{"onfunction","run lua on some df function"}) --table.insert(plugins,{"editor","edit internals of df",EditDF}) table.insert(plugins,{"saves","run current worlds's init.lua",RunSaved}) +table.insert(plugins,{"adv_tools","some tools for (mainly) advneturer hacking"}) loadall(plugins) dofile_silent("dfusion/initcustom.lua") diff --git a/plugins/Dfusion/luafiles/tools/init.lua b/plugins/Dfusion/luafiles/tools/init.lua index adc376e5..27624e0a 100644 --- a/plugins/Dfusion/luafiles/tools/init.lua +++ b/plugins/Dfusion/luafiles/tools/init.lua @@ -134,7 +134,7 @@ function tools.change_adv(unit,nemesis) other_nem.flags[1]=true end if nem then - nem.flags[1]=true + nem.flags[0]=true nem.flags[2]=true df.global.ui_advmode.player_id=nem.id else |
