diff --git a/src/gui/game/GameController.cpp b/src/gui/game/GameController.cpp index cd8dcc945..8a81bd538 100644 --- a/src/gui/game/GameController.cpp +++ b/src/gui/game/GameController.cpp @@ -149,6 +149,7 @@ GameController::GameController(): ActiveToolChanged(0, gameModel->GetActiveTool(0)); ActiveToolChanged(1, gameModel->GetActiveTool(1)); ActiveToolChanged(2, gameModel->GetActiveTool(2)); + ActiveToolChanged(3, gameModel->GetActiveTool(3)); //sim = new Simulation(); Client::Ref().AddListener(this); diff --git a/src/lua/LegacyLuaAPI.cpp b/src/lua/LegacyLuaAPI.cpp index 4c9649189..8f2ed2e1d 100644 --- a/src/lua/LegacyLuaAPI.cpp +++ b/src/lua/LegacyLuaAPI.cpp @@ -588,12 +588,13 @@ int luacon_mouseevent(int mx, int my, int mb, int event, int mouse_wheel) return mpcontinue; } -int luacon_step(int mx, int my, std::string selectl, std::string selectr, std::string selectalt, int bsx, int bsy) +int luacon_step(int mx, int my, std::string selectl, std::string selectr, std::string selectalt, std::string selectreplace, int bsx, int bsy) { int i, j, callret; lua_State* l=luacon_ci->l; lua_pushinteger(l, bsy); lua_pushinteger(l, bsx); + lua_pushstring(l, selectreplace.c_str()); lua_pushstring(l, selectalt.c_str()); lua_pushstring(l, selectr.c_str()); lua_pushstring(l, selectl.c_str()); @@ -604,6 +605,7 @@ int luacon_step(int mx, int my, std::string selectl, std::string selectr, std::s lua_setfield(l, tptProperties, "selectedl"); lua_setfield(l, tptProperties, "selectedr"); lua_setfield(l, tptProperties, "selecteda"); + lua_setfield(l, tptProperties, "selectedreplace"); lua_setfield(l, tptProperties, "brushx"); lua_setfield(l, tptProperties, "brushy"); lua_pushstring(l, "stepfunctions"); diff --git a/src/lua/LuaScriptHelper.h b/src/lua/LuaScriptHelper.h index 74098e042..6b8280337 100644 --- a/src/lua/LuaScriptHelper.h +++ b/src/lua/LuaScriptHelper.h @@ -21,7 +21,7 @@ extern int tptElements; //Table for TPT element names extern int tptParts, tptPartsMeta, tptElementTransitions, tptPartsCData, tptPartMeta, tptPart, cIndex; void luacon_hook(lua_State *L, lua_Debug *ar); -int luacon_step(int mx, int my, std::string , std::string selectr, std::string selectedalt, int bsx, int bsy); +int luacon_step(int mx, int my, std::string , std::string selectr, std::string selectedalt, std::string selectedreplace, int bsx, int bsy); int luacon_mouseevent(int mx, int my, int mb, int event, int mouse_wheel); int luacon_keyevent(int key, int modifier, int event); int luacon_eval(const char *command); diff --git a/src/lua/LuaScriptInterface.cpp b/src/lua/LuaScriptInterface.cpp index 9d09560c5..455c4427e 100644 --- a/src/lua/LuaScriptInterface.cpp +++ b/src/lua/LuaScriptInterface.cpp @@ -483,6 +483,7 @@ void LuaScriptInterface::initSimulationAPI() {"loadStamp", simulation_loadStamp}, {"deleteStamp", simulation_deleteStamp}, {"loadSave", simulation_loadSave}, + {"reloadSave", simulation_reloadSave}, {"getSaveID", simulation_getSaveID}, {"adjustCoords", simulation_adjustCoords}, {"prettyPowders", simulation_prettyPowders}, @@ -1430,6 +1431,12 @@ int LuaScriptInterface::simulation_loadSave(lua_State * l) return 0; } +int LuaScriptInterface::simulation_reloadSave(lua_State * l) +{ + luacon_controller->ReloadSim(); + return 0; +} + int LuaScriptInterface::simulation_getSaveID(lua_State *l) { SaveInfo *tempSave = luacon_model->GetSave(); @@ -2851,7 +2858,7 @@ void LuaScriptInterface::OnTick() ui::Engine::Ref().LastTick(gettime()); if(luacon_mousedown) luacon_mouseevent(luacon_mousex, luacon_mousey, luacon_mousebutton, LUACON_MPRESS, 0); - luacon_step(luacon_mousex, luacon_mousey, luacon_selectedl, luacon_selectedr, luacon_selectedalt, luacon_brushx, luacon_brushy); + luacon_step(luacon_mousex, luacon_mousey, luacon_selectedl, luacon_selectedr, luacon_selectedalt, luacon_selectedreplace, luacon_brushx, luacon_brushy); } int LuaScriptInterface::Command(std::string command) diff --git a/src/lua/LuaScriptInterface.h b/src/lua/LuaScriptInterface.h index 648d0b5bb..edef9dfe2 100644 --- a/src/lua/LuaScriptInterface.h +++ b/src/lua/LuaScriptInterface.h @@ -88,6 +88,7 @@ class LuaScriptInterface: public CommandInterface static int simulation_loadStamp(lua_State * l); static int simulation_deleteStamp(lua_State * l); static int simulation_loadSave(lua_State * l); + static int simulation_reloadSave(lua_State * l); static int simulation_getSaveID(lua_State * l); static int simulation_adjustCoords(lua_State * l); static int simulation_prettyPowders(lua_State * l);