Particle position lookup with sim.partID
This commit is contained in:
parent
52d0bb918d
commit
27a60e7b71
@ -435,6 +435,7 @@ void LuaScriptInterface::initSimulationAPI()
|
||||
{"partCreate", simulation_partCreate},
|
||||
{"partProperty", simulation_partProperty},
|
||||
{"partPosition", simulation_partPosition},
|
||||
{"partID", simulation_partID},
|
||||
{"partKill", simulation_partKill},
|
||||
{"pressure", simulation_pressure},
|
||||
{"ambientHeat", simulation_ambientHeat},
|
||||
@ -558,6 +559,24 @@ int LuaScriptInterface::simulation_partCreate(lua_State * l)
|
||||
return 1;
|
||||
}
|
||||
|
||||
int LuaScriptInterface::simulation_partID(lua_State * l)
|
||||
{
|
||||
int x = lua_tointeger(l, 1);
|
||||
int y = lua_tointeger(l, 2);
|
||||
|
||||
if(x < 0 || x >= XRES || y < 0 || y >= YRES)
|
||||
{
|
||||
lua_pushnil(l);
|
||||
return 1;
|
||||
}
|
||||
|
||||
int amalgam = luacon_sim->pmap[y][x];
|
||||
if(!amalgam)
|
||||
amalgam = luacon_sim->photons[y][x];
|
||||
lua_pushinteger(l, amalgam >> 8);
|
||||
return 1;
|
||||
}
|
||||
|
||||
int LuaScriptInterface::simulation_partPosition(lua_State * l)
|
||||
{
|
||||
int particleID = lua_tointeger(l, 1);
|
||||
|
@ -64,6 +64,7 @@ class LuaScriptInterface: public CommandInterface
|
||||
static int simulation_partCreate(lua_State * l);
|
||||
static int simulation_partProperty(lua_State * l);
|
||||
static int simulation_partPosition(lua_State * l);
|
||||
static int simulation_partID(lua_State * l);
|
||||
static int simulation_partKill(lua_State * l);
|
||||
static int simulation_pressure(lua_State * l);
|
||||
static int simulation_velocityX(lua_State * l);
|
||||
|
Reference in New Issue
Block a user