mirror of
https://github.com/The-Powder-Toy/The-Powder-Toy.git
synced 2025-07-31 05:30:23 +02:00
Increase speed of MIX tool and make it work with liquids (#306)
* Make MIX tool work with liquids and gases
This commit is contained in:
@@ -19,7 +19,7 @@ int Tool_Mix::Perform(Simulation * sim, Particle * cpart, int x, int y, float st
|
|||||||
|
|
||||||
int distance = (int)(std::pow(strength, .5f) * 10);
|
int distance = (int)(std::pow(strength, .5f) * 10);
|
||||||
|
|
||||||
if(!(sim->elements[thisPart&0xFF].Properties & TYPE_PART))
|
if(!(sim->elements[thisPart&0xFF].Properties & (TYPE_PART | TYPE_LIQUID | TYPE_GAS)))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
int newX = x + (rand() % distance) - (distance/2);
|
int newX = x + (rand() % distance) - (distance/2);
|
||||||
@@ -32,7 +32,7 @@ int Tool_Mix::Perform(Simulation * sim, Particle * cpart, int x, int y, float st
|
|||||||
if(!thatPart)
|
if(!thatPart)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if(!(sim->elements[thatPart&0xFF].Properties & TYPE_PART))
|
if(!(sim->elements[thatPart&0xFF].Properties & (TYPE_PART | TYPE_LIQUID | TYPE_GAS)))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
sim->pmap[y][x] = thatPart;
|
sim->pmap[y][x] = thatPart;
|
||||||
|
Reference in New Issue
Block a user