Fix part_change_type not being called by sim.partProperty

This commit is contained in:
Tamás Bálint Misius 2019-06-03 12:59:39 +02:00
parent 8671332e60
commit 97bde1111d
No known key found for this signature in database
GPG Key ID: 5B472A12F6ECA9F2

View File

@ -1051,8 +1051,15 @@ int LuaScriptInterface::simulation_partProperty(lua_State * l)
intptr_t propertyAddress = (intptr_t)(((unsigned char*)&luacon_sim->parts[particleID]) + prop->Offset);
if(argCount == 3)
{
if (prop == properties.begin() + 0) // i.e. it's .type
{
luacon_sim->part_change_type(particleID, luacon_sim->parts[particleID].x+0.5f, luacon_sim->parts[particleID].y+0.5f, luaL_checkinteger(l, 3));
}
else
{
LuaSetProperty(l, *prop, propertyAddress, 3);
}
return 0;
}
else