Add sim.partExists and elem.exists
This commit is contained in:
parent
289c2c4528
commit
766ffd4ad6
@ -804,6 +804,7 @@ void LuaScriptInterface::initSimulationAPI()
|
|||||||
{"partPosition", simulation_partPosition},
|
{"partPosition", simulation_partPosition},
|
||||||
{"partID", simulation_partID},
|
{"partID", simulation_partID},
|
||||||
{"partKill", simulation_partKill},
|
{"partKill", simulation_partKill},
|
||||||
|
{"partExists", simulation_partExists},
|
||||||
{"pressure", simulation_pressure},
|
{"pressure", simulation_pressure},
|
||||||
{"ambientHeat", simulation_ambientHeat},
|
{"ambientHeat", simulation_ambientHeat},
|
||||||
{"velocityX", simulation_velocityX},
|
{"velocityX", simulation_velocityX},
|
||||||
@ -1167,6 +1168,13 @@ int LuaScriptInterface::simulation_partKill(lua_State * l)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int LuaScriptInterface::simulation_partExists(lua_State * l)
|
||||||
|
{
|
||||||
|
int i = luaL_checkinteger(l, 1);
|
||||||
|
lua_pushboolean(l, i >= 0 && i < NPART && luacon_sim->parts[i].type);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
int LuaScriptInterface::simulation_pressure(lua_State* l)
|
int LuaScriptInterface::simulation_pressure(lua_State* l)
|
||||||
{
|
{
|
||||||
int argCount = lua_gettop(l);
|
int argCount = lua_gettop(l);
|
||||||
@ -2643,6 +2651,7 @@ void LuaScriptInterface::initElementsAPI()
|
|||||||
{"element", elements_element},
|
{"element", elements_element},
|
||||||
{"property", elements_property},
|
{"property", elements_property},
|
||||||
{"free", elements_free},
|
{"free", elements_free},
|
||||||
|
{"exists", elements_exists},
|
||||||
{"loadDefault", elements_loadDefault},
|
{"loadDefault", elements_loadDefault},
|
||||||
{NULL, NULL}
|
{NULL, NULL}
|
||||||
};
|
};
|
||||||
@ -3483,6 +3492,12 @@ int LuaScriptInterface::elements_free(lua_State * l)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int LuaScriptInterface::elements_exists(lua_State * l)
|
||||||
|
{
|
||||||
|
lua_pushboolean(l, luacon_sim->IsElement(luaL_checkinteger(l, 1)));
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
void LuaScriptInterface::initGraphicsAPI()
|
void LuaScriptInterface::initGraphicsAPI()
|
||||||
{
|
{
|
||||||
//Methods
|
//Methods
|
||||||
|
@ -63,6 +63,7 @@ class LuaScriptInterface: public CommandInterface
|
|||||||
static int simulation_partPosition(lua_State * l);
|
static int simulation_partPosition(lua_State * l);
|
||||||
static int simulation_partID(lua_State * l);
|
static int simulation_partID(lua_State * l);
|
||||||
static int simulation_partKill(lua_State * l);
|
static int simulation_partKill(lua_State * l);
|
||||||
|
static int simulation_partExists(lua_State * l);
|
||||||
static int simulation_pressure(lua_State * l);
|
static int simulation_pressure(lua_State * l);
|
||||||
static int simulation_velocityX(lua_State * l);
|
static int simulation_velocityX(lua_State * l);
|
||||||
static int simulation_velocityY(lua_State * l);
|
static int simulation_velocityY(lua_State * l);
|
||||||
@ -140,6 +141,7 @@ class LuaScriptInterface: public CommandInterface
|
|||||||
static int elements_property(lua_State * l);
|
static int elements_property(lua_State * l);
|
||||||
static int elements_loadDefault(lua_State * l);
|
static int elements_loadDefault(lua_State * l);
|
||||||
static int elements_free(lua_State * l);
|
static int elements_free(lua_State * l);
|
||||||
|
static int elements_exists(lua_State * l);
|
||||||
|
|
||||||
//Interface
|
//Interface
|
||||||
void initInterfaceAPI();
|
void initInterfaceAPI();
|
||||||
|
Reference in New Issue
Block a user