Skip to content

Commit

Permalink
move some stuff around (without changes) in Simulation.cpp, add sim.u…
Browse files Browse the repository at this point in the history
…pdateParticles function
  • Loading branch information
jacob1 committed Jan 11, 2015
1 parent dce8744 commit 577ae34
Show file tree
Hide file tree
Showing 5 changed files with 340 additions and 328 deletions.
2 changes: 1 addition & 1 deletion src/gui/game/GameController.cpp
Expand Up @@ -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
Expand Down
11 changes: 11 additions & 0 deletions src/lua/LuaScriptInterface.cpp
Expand Up @@ -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);
Expand Down Expand Up @@ -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()
Expand Down
1 change: 1 addition & 0 deletions src/lua/LuaScriptInterface.h
Expand Up @@ -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();
Expand Down

0 comments on commit 577ae34

Please sign in to comment.