mirror of
https://github.com/The-Powder-Toy/The-Powder-Toy.git
synced 2025-09-02 04:22:34 +02:00
Make gravity mask accessible from Lua
This commit is contained in:
@@ -206,6 +206,14 @@ static int gravityMass(lua_State *L)
|
||||
});
|
||||
}
|
||||
|
||||
static int gravityMask(lua_State *L)
|
||||
{
|
||||
auto *lsi = GetLSI();
|
||||
return LuaBlockMap(L, [lsi](Vec2<int> p) -> uint32_t & {
|
||||
return lsi->sim->gravIn.mask[p];
|
||||
});
|
||||
}
|
||||
|
||||
static int gravityField(lua_State *L)
|
||||
{
|
||||
auto *lsi = GetLSI();
|
||||
@@ -1931,6 +1939,7 @@ void LuaSimulation::Open(lua_State *L)
|
||||
LFUNC(ensureDeterminism),
|
||||
LFUNC(paused),
|
||||
LFUNC(gravityMass),
|
||||
LFUNC(gravityMask),
|
||||
LFUNC(gravityField),
|
||||
LFUNC(resetSpark),
|
||||
LFUNC(resetVelocity),
|
||||
|
@@ -3595,7 +3595,7 @@ void Simulation::BeforeSim()
|
||||
air->update_airh();
|
||||
|
||||
DispatchNewtonianGravity();
|
||||
// gravIn is now potentially garbage, which is ok, we were going to clear it for the frame anyway
|
||||
// gravIn::mass is now potentially garbage, which is ok, we were going to clear it for the frame anyway
|
||||
for (auto p : gravIn.mass.Size().OriginRect())
|
||||
{
|
||||
gravIn.mass[p] = 0.f;
|
||||
|
Reference in New Issue
Block a user