summaryrefslogtreecommitdiff
path: root/plugins/Dfusion
diff options
context:
space:
mode:
authorWarmist2012-04-28 22:21:57 +0300
committerWarmist2012-04-28 22:21:57 +0300
commita56f1549a94b89b50605a6236a30124df57a66bf (patch)
tree2bb518dcc8bd18bec8bb7724342b2f11bef32bbf /plugins/Dfusion
parent519ea08e8fa03863186cf75e0674a394d3dd4fc6 (diff)
parent9c94b7c1e748743309dae75ec95e374f26624d5f (diff)
downloaddfhack-a56f1549a94b89b50605a6236a30124df57a66bf.tar.gz
dfhack-a56f1549a94b89b50605a6236a30124df57a66bf.tar.bz2
dfhack-a56f1549a94b89b50605a6236a30124df57a66bf.tar.xz
Merge branch 'master' of https://github.com/angavrilov/dfhack
Diffstat (limited to 'plugins/Dfusion')
-rw-r--r--plugins/Dfusion/dfusion.cpp22
-rw-r--r--plugins/Dfusion/luafiles/adv_tools/init.lua2
-rw-r--r--plugins/Dfusion/luafiles/common.lua4
-rw-r--r--plugins/Dfusion/luafiles/tools/init.lua4
4 files changed, 24 insertions, 8 deletions
diff --git a/plugins/Dfusion/dfusion.cpp b/plugins/Dfusion/dfusion.cpp
index d8710c2d..2b36a974 100644
--- a/plugins/Dfusion/dfusion.cpp
+++ b/plugins/Dfusion/dfusion.cpp
@@ -121,10 +121,26 @@ command_result lua_run_file (color_ostream &out, std::vector <std::string> &para
}
command_result lua_run (color_ostream &out, std::vector <std::string> &parameters)
{
- if (!parameters.empty() && parameters[0] == "--core-context")
+ if (!parameters.empty())
{
- Lua::InterpreterLoop(out, Lua::Core::State, "core lua");
- return CR_OK;
+ if (parameters[0] == "--core-context")
+ {
+ Lua::InterpreterLoop(out, Lua::Core::State, "core lua");
+ return CR_OK;
+ }
+ else if (parameters[0] == "--core-reload")
+ {
+ CoreSuspender suspend;
+
+ for (size_t i = 1; i < parameters.size(); i++)
+ {
+ lua_getglobal(Lua::Core::State, "reload");
+ lua_pushstring(Lua::Core::State, parameters[i].c_str());
+ Lua::SafeCall(out, Lua::Core::State, 1, 0);
+ }
+
+ return CR_OK;
+ }
}
mymutex->lock();
diff --git a/plugins/Dfusion/luafiles/adv_tools/init.lua b/plugins/Dfusion/luafiles/adv_tools/init.lua
index f5fd9a47..5504f32b 100644
--- a/plugins/Dfusion/luafiles/adv_tools/init.lua
+++ b/plugins/Dfusion/luafiles/adv_tools/init.lua
@@ -5,7 +5,7 @@ function adv_tools.reincarnate(swap_soul) --only for adventurer i guess
if swap_soul==nil then
swap_soul=true
end
- local adv=df.global.world.units.other[0][0]
+ local adv=df.global.world.units.active[0]
if adv.flags1.dead==false then
error("You are not dead (yet)!")
end
diff --git a/plugins/Dfusion/luafiles/common.lua b/plugins/Dfusion/luafiles/common.lua
index 347b27c0..bdcda5e8 100644
--- a/plugins/Dfusion/luafiles/common.lua
+++ b/plugins/Dfusion/luafiles/common.lua
@@ -478,8 +478,8 @@ function getSelectedUnit()
return nil
end
local unit_indx=df.global.ui_selected_unit
- if unit_indx<#df.global.world.units.other[0]-1 then
- return df.global.world.units.other[0][unit_indx]
+ if unit_indx<#df.global.world.units.active-1 then
+ return df.global.world.units.active[unit_indx]
else
return nil
end
diff --git a/plugins/Dfusion/luafiles/tools/init.lua b/plugins/Dfusion/luafiles/tools/init.lua
index b01157c8..e3a4607c 100644
--- a/plugins/Dfusion/luafiles/tools/init.lua
+++ b/plugins/Dfusion/luafiles/tools/init.lua
@@ -113,7 +113,7 @@ function tools.change_adv(unit,nemesis)
if unit==nil then
error("Invalid unit!")
end
- local other=df.global.world.units.other[0]
+ local other=df.global.world.units.active
local unit_indx
for k,v in pairs(other) do
if v==unit then
@@ -157,7 +157,7 @@ function tools.MakeFollow(unit,trgunit)
error("Invalid creature")
end
if trgunit==nil then
- trgunit=df.global.world.units.other[0][0]
+ trgunit=df.global.world.units.active[0]
end
unit.relations.group_leader_id=trgunit.id
local u_nem=getNemesis(unit)