mirror of
https://github.com/The-Powder-Toy/The-Powder-Toy.git
synced 2025-07-31 05:30:23 +02:00
Limit MERC tmp to valid range
This preents "anti-mercury" (negative tmp from console) and also slightly reduces how overpowered it can be in walls (enormous positive tmp from console).
This commit is contained in:
@@ -48,9 +48,20 @@ Element_MERC::Element_MERC()
|
|||||||
int Element_MERC::update(UPDATE_FUNC_ARGS)
|
int Element_MERC::update(UPDATE_FUNC_ARGS)
|
||||||
{
|
{
|
||||||
int r, rx, ry, trade, np;
|
int r, rx, ry, trade, np;
|
||||||
int maxtmp = ((10000/(parts[i].temp + 1))-1);
|
const int absorbScale = 10000;// max number of particles that can be condensed into one
|
||||||
if ((10000%((int)parts[i].temp+1))>rand()%((int)parts[i].temp+1))
|
int maxtmp = ((absorbScale/(parts[i].temp + 1))-1);
|
||||||
|
if ((absorbScale%((int)parts[i].temp+1))>rand()%((int)parts[i].temp+1))
|
||||||
maxtmp ++;
|
maxtmp ++;
|
||||||
|
|
||||||
|
if (parts[i].tmp < 0)
|
||||||
|
{
|
||||||
|
parts[i].tmp = 0;
|
||||||
|
}
|
||||||
|
if (parts[i].tmp > absorbScale)
|
||||||
|
{
|
||||||
|
parts[i].tmp = absorbScale;
|
||||||
|
}
|
||||||
|
|
||||||
if (parts[i].tmp < maxtmp)
|
if (parts[i].tmp < maxtmp)
|
||||||
{
|
{
|
||||||
for (rx=-1; rx<2; rx++)
|
for (rx=-1; rx<2; rx++)
|
||||||
|
Reference in New Issue
Block a user