| 325 | } |
| 326 | |
| 327 | void LuaSetParticleProperty(lua_State *L, int particleID, StructProperty property, intptr_t propertyAddress, int stackPos) |
| 328 | { |
| 329 | auto *lsi = GetLSI(); |
| 330 | auto *sim = lsi->sim; |
| 331 | if (property.Name == "type") |
| 332 | { |
| 333 | lsi->AssertMonopartAccessEvent(-1); |
| 334 | sim->part_change_type(particleID, int(sim->parts[particleID].x+0.5f), int(sim->parts[particleID].y+0.5f), luaL_checkinteger(L, 3)); |
| 335 | } |
| 336 | else if (property.Name == "x" || property.Name == "y") |
| 337 | { |
| 338 | lsi->AssertMonopartAccessEvent(-1); |
| 339 | float val = luaL_checknumber(L, 3); |
| 340 | float x = sim->parts[particleID].x; |
| 341 | float y = sim->parts[particleID].y; |
| 342 | float nx = property.Name == "x" ? val : x; |
| 343 | float ny = property.Name == "y" ? val : y; |
| 344 | sim->move(particleID, (int)(x + 0.5f), (int)(y + 0.5f), nx, ny); |
| 345 | } |
| 346 | else |
| 347 | { |
| 348 | lsi->AssertMonopartAccessEvent(particleID); |
| 349 | LuaSetProperty(L, property, propertyAddress, 3); |
| 350 | } |
| 351 | } |
| 352 | |
| 353 | static int pushGameControllerEvent(lua_State *L, const GameControllerEvent &event) |
| 354 | { |
no test coverage detected