-- outside the update function, in file scope
local decompositionTemperature = {
[ metal_1 ] = temp_1,
[ metal_2 ] = temp_2,
...
}
...
function()
...
-- inside the update function
local dt = decompositionTemperature[sim.partProperty(i, "ctype")]
if dt and sim.partProperty(i, "temp") < dt then
-- decompose
end
...
end
...