export dig_now_tile over Lua

develop
myk002 2021-06-27 19:31:05 -07:00
parent fc19fb6785
commit 93d67dd51e
No known key found for this signature in database
GPG Key ID: 8A39CA0FA0C16E78
2 changed files with 24 additions and 13 deletions

@ -842,13 +842,33 @@ DFhackCExport command_result plugin_shutdown(color_ostream &) {
return CR_OK;
}
// External API
// Lua API
// runs dig-now for the specified tile. default options apply.
bool dig_now_tile (color_ostream& out, const DFCoord& pos)
// runs dig-now for the specified tile coordinate. default options apply.
static int dig_now_tile(lua_State *L)
{
DFCoord pos;
if (lua_gettop(L) <= 1)
Lua::CheckDFAssign(L, &pos, 1);
else
pos = DFCoord(luaL_checkint(L, 1), luaL_checkint(L, 2),
luaL_checkint(L, 3));
color_ostream *out = Lua::GetOutput(L);
if (!out)
out = &Core::getInstance().getConsole();
return 1;
dig_now_options options;
options.start = pos;
options.end = pos;
return dig_now_impl(out, options);
lua_pushboolean(L, dig_now_impl(*out, options));
return 1;
}
DFHACK_PLUGIN_LUA_COMMANDS {
DFHACK_LUA_COMMAND(dig_now_tile),
DFHACK_LUA_END
};

@ -1,9 +0,0 @@
#pragma once
#include "ColorText.h"
#include "modules/Maps.h"
/**
* Runs dig-now for the specified tile. Default options apply.
*/
bool dig_now_tile(DFHack::color_ostream &out, const DFHack::DFCoord &pos);