add sim.reloadSave, tpt.selectedreplace

This commit is contained in:
jacob1 2014-03-13 14:44:28 -04:00
parent c6d6011337
commit 258aaedb0a
5 changed files with 14 additions and 3 deletions

View File

@ -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);

View File

@ -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");

View File

@ -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);

View File

@ -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)

View File

@ -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);