misc: Fix sim.partNeighbors table being 0-indexed, rename SIM_MAXVELOCITY to MAX_VELOCITY
This commit is contained in:
parent
7541273640
commit
dd5e5b1f3a
@ -31,7 +31,7 @@ constexpr int MAXSIGNS = 16;
|
||||
|
||||
constexpr int ISTP = CELL / 2;
|
||||
constexpr float CFDS = 4.0f / CELL;
|
||||
constexpr float SIM_MAXVELOCITY = 1e4f;
|
||||
constexpr float MAX_VELOCITY = 1e4f;
|
||||
|
||||
//Air constants
|
||||
constexpr float AIR_TSTEPP = 0.3f;
|
||||
|
@ -1233,7 +1233,7 @@ void LuaScriptInterface::initSimulationAPI()
|
||||
SETCONSTF(l, MIN_PRESSURE);
|
||||
SETCONST(l, ISTP);
|
||||
SETCONSTF(l, CFDS);
|
||||
SETCONSTF(l, SIM_MAXVELOCITY);
|
||||
SETCONSTF(l, MAX_VELOCITY);
|
||||
|
||||
SETCONST(l, TOOL_HEAT);
|
||||
SETCONST(l, TOOL_COOL);
|
||||
@ -1370,7 +1370,7 @@ void LuaScriptInterface::set_map(int x, int y, int width, int height, float valu
|
||||
int LuaScriptInterface::simulation_partNeighbours(lua_State * l)
|
||||
{
|
||||
lua_newtable(l);
|
||||
int id = 0;
|
||||
int id = 1;
|
||||
int x = lua_tointeger(l, 1), y = lua_tointeger(l, 2), r = lua_tointeger(l, 3), rx, ry, n;
|
||||
if(lua_gettop(l) == 5) // this is one more than the number of arguments because a table has just been pushed onto the stack with lua_newtable(l);
|
||||
{
|
||||
|
@ -2864,11 +2864,11 @@ killed:
|
||||
}
|
||||
else
|
||||
{
|
||||
if (mv > SIM_MAXVELOCITY)
|
||||
if (mv > MAX_VELOCITY)
|
||||
{
|
||||
parts[i].vx *= SIM_MAXVELOCITY/mv;
|
||||
parts[i].vy *= SIM_MAXVELOCITY/mv;
|
||||
mv = SIM_MAXVELOCITY;
|
||||
parts[i].vx *= MAX_VELOCITY/mv;
|
||||
parts[i].vy *= MAX_VELOCITY/mv;
|
||||
mv = MAX_VELOCITY;
|
||||
}
|
||||
// interpolate to see if there is anything in the way
|
||||
dx = parts[i].vx*ISTP/mv;
|
||||
|
@ -109,7 +109,7 @@ static int update(UPDATE_FUNC_ARGS)
|
||||
if (TYP(r) == PT_FILT)
|
||||
{
|
||||
int vel = parts[ID(r)].ctype - 0x10000000;
|
||||
if (vel >= 0 && vel < SIM_MAXVELOCITY)
|
||||
if (vel >= 0 && vel < MAX_VELOCITY)
|
||||
{
|
||||
doDeserialization = true;
|
||||
Vs = float(vel);
|
||||
|
Reference in New Issue
Block a user