mirror of
https://github.com/The-Powder-Toy/The-Powder-Toy.git
synced 2025-01-17 14:28:30 +01:00
Add sim.temperatureScale
This commit is contained in:
parent
55524bc27a
commit
3a7cdeefd9
@ -943,6 +943,7 @@ void LuaScriptInterface::initSimulationAPI()
|
||||
{"removeCustomGol", simulation_removeCustomGol},
|
||||
{"lastUpdatedID", simulation_lastUpdatedID},
|
||||
{"updateUpTo", simulation_updateUpTo},
|
||||
{"temperatureScale", simulation_temperatureScale},
|
||||
{NULL, NULL}
|
||||
};
|
||||
luaL_register(l, "simulation", simulationAPIMethods);
|
||||
@ -2540,6 +2541,21 @@ int LuaScriptInterface::simulation_updateUpTo(lua_State *l)
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int LuaScriptInterface::simulation_temperatureScale(lua_State *l)
|
||||
{
|
||||
if (lua_gettop(l) == 0)
|
||||
{
|
||||
lua_pushinteger(l, luacon_model->GetTemperatureScale());
|
||||
return 1;
|
||||
}
|
||||
int temperatureScale = luaL_checkinteger(l, 1);
|
||||
if (temperatureScale < 0 || temperatureScale > 2)
|
||||
return luaL_error(l, "Invalid temperature scale");
|
||||
luacon_model->SetTemperatureScale(temperatureScale);
|
||||
return 0;
|
||||
}
|
||||
|
||||
//// Begin Renderer API
|
||||
|
||||
void LuaScriptInterface::initRendererAPI()
|
||||
|
@ -123,6 +123,7 @@ class LuaScriptInterface: public CommandInterface
|
||||
static int simulation_removeCustomGol(lua_State *l);
|
||||
static int simulation_lastUpdatedID(lua_State *l);
|
||||
static int simulation_updateUpTo(lua_State *l);
|
||||
static int simulation_temperatureScale(lua_State *l);
|
||||
|
||||
|
||||
//Renderer
|
||||
|
Loading…
x
Reference in New Issue
Block a user