Permalink
Browse files

move some stuff around (without changes) in Simulation.cpp, add sim.u…

…pdateParticles function
  • Loading branch information...
jacob1 committed Jan 11, 2015
1 parent dce8744 commit 577ae3400f94f5ca3e05452f97590f5362960f35
@@ -882,7 +882,7 @@ void GameController::Update()
gameView->SetSample(gameModel->GetSimulation()->GetSample(pos.X, pos.Y));
Simulation * sim = gameModel->GetSimulation();
sim->update_particles();
sim->Update();
//if either STKM or STK2 isn't out, reset it's selected element. Defaults to PT_DUST unless right selected is something else
//This won't run if the stickmen dies in a frame, since it respawns instantly
@@ -592,6 +592,7 @@ void LuaScriptInterface::initSimulationAPI()
{"photons", simulation_photons},
{"neighbours", simulation_neighbours},
{"neighbors", simulation_neighbours},
{"updateParticles", simulation_update_particles},
{NULL, NULL}
};
luaL_register(l, "simulation", simulationAPIMethods);
@@ -1780,6 +1781,16 @@ int LuaScriptInterface::simulation_neighbours(lua_State * l)
return 1;
}
int LuaScriptInterface::simulation_update_particles(lua_State * l)
{
int start = luaL_optint(l, 1, 0);
int end = luaL_optint(l, 2, luacon_sim->parts_lastActiveIndex);
if (start < 0 || end >= NPART || start > end)
return luaL_error(l, "Invalid start / end positions: (%i, %i)", start, end);
luacon_sim->UpdateParticles(start, end);
return 0;
}
//// Begin Renderer API
void LuaScriptInterface::initRendererAPI()
@@ -99,6 +99,7 @@ class LuaScriptInterface: public CommandInterface
static int simulation_pmap(lua_State * l);
static int simulation_photons(lua_State * l);
static int simulation_neighbours(lua_State * l);
static int simulation_update_particles(lua_State * l);
//Renderer
void initRendererAPI();
Oops, something went wrong.

0 comments on commit 577ae34

Please sign in to comment.