mirror of
https://github.com/The-Powder-Toy/The-Powder-Toy.git
synced 2025-08-06 16:36:32 +02:00
initialize GoL variables, add sim.gspeed function
This commit is contained in:
@@ -742,6 +742,7 @@ void LuaScriptInterface::initSimulationAPI()
|
|||||||
{"neighbours", simulation_neighbours},
|
{"neighbours", simulation_neighbours},
|
||||||
{"neighbors", simulation_neighbours},
|
{"neighbors", simulation_neighbours},
|
||||||
{"framerender", simulation_framerender},
|
{"framerender", simulation_framerender},
|
||||||
|
{"gspeed", simulation_gspeed},
|
||||||
{NULL, NULL}
|
{NULL, NULL}
|
||||||
};
|
};
|
||||||
luaL_register(l, "simulation", simulationAPIMethods);
|
luaL_register(l, "simulation", simulationAPIMethods);
|
||||||
@@ -1981,6 +1982,20 @@ int LuaScriptInterface::simulation_framerender(lua_State * l)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int LuaScriptInterface::simulation_gspeed(lua_State * l)
|
||||||
|
{
|
||||||
|
if (lua_gettop(l) == 0)
|
||||||
|
{
|
||||||
|
lua_pushinteger(l, luacon_sim->GSPEED);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
int gspeed = luaL_checkinteger(l, 1);
|
||||||
|
if (gspeed < 1)
|
||||||
|
return luaL_error(l, "GSPEED must be at least 1");
|
||||||
|
luacon_sim->GSPEED = gspeed;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
//// Begin Renderer API
|
//// Begin Renderer API
|
||||||
|
|
||||||
void LuaScriptInterface::initRendererAPI()
|
void LuaScriptInterface::initRendererAPI()
|
||||||
|
@@ -106,6 +106,7 @@ class LuaScriptInterface: public CommandInterface
|
|||||||
static int simulation_photons(lua_State * l);
|
static int simulation_photons(lua_State * l);
|
||||||
static int simulation_neighbours(lua_State * l);
|
static int simulation_neighbours(lua_State * l);
|
||||||
static int simulation_framerender(lua_State * l);
|
static int simulation_framerender(lua_State * l);
|
||||||
|
static int simulation_gspeed(lua_State * l);
|
||||||
|
|
||||||
//Renderer
|
//Renderer
|
||||||
void initRendererAPI();
|
void initRendererAPI();
|
||||||
|
@@ -5050,6 +5050,8 @@ Simulation::Simulation():
|
|||||||
emp_decor(0),
|
emp_decor(0),
|
||||||
lightningRecreate(0),
|
lightningRecreate(0),
|
||||||
gravWallChanged(false),
|
gravWallChanged(false),
|
||||||
|
CGOL(0),
|
||||||
|
GSPEED(1),
|
||||||
edgeMode(0),
|
edgeMode(0),
|
||||||
gravityMode(0),
|
gravityMode(0),
|
||||||
legacy_enable(0),
|
legacy_enable(0),
|
||||||
|
Reference in New Issue
Block a user