Add sim.temperatureScale

This commit is contained in:
jacob1 2023-01-02 13:24:35 -05:00
parent 55524bc27a
commit 3a7cdeefd9
No known key found for this signature in database
GPG Key ID: 4E58A32D510E1995
2 changed files with 17 additions and 0 deletions

View File

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

View File

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