more POLO fixes

This commit is contained in:
jacob1
2017-06-04 16:57:37 -04:00
parent 53bb1f4802
commit 48a95ac5d5

View File

@@ -45,21 +45,21 @@ Element_POLO::Element_POLO()
Graphics = &Element_POLO::graphics; Graphics = &Element_POLO::graphics;
} }
#define COOLDOWN 15
#define LIMIT 5
//#TPT-Directive ElementHeader Element_POLO static int update(UPDATE_FUNC_ARGS) //#TPT-Directive ElementHeader Element_POLO static int update(UPDATE_FUNC_ARGS)
int Element_POLO::update(UPDATE_FUNC_ARGS) int Element_POLO::update(UPDATE_FUNC_ARGS)
{ {
const int cooldown = 15;
const int limit = 5;
int r = sim->photons[y][x]; int r = sim->photons[y][x];
if (parts[i].tmp < limit && !parts[i].life) if (parts[i].tmp < LIMIT && !parts[i].life)
{ {
if (!(rand()%1000) &&!parts[i].tmp) if (!(rand()%10000) && !parts[i].tmp)
{ {
int s = sim->create_part(-3, x, y, PT_NEUT); int s = sim->create_part(-3, x, y, PT_NEUT);
if (s >= 0) if (s >= 0)
{ {
parts[i].life = cooldown; parts[i].life = COOLDOWN;
parts[i].tmp++; parts[i].tmp++;
parts[i].temp = ((parts[i].temp + parts[s].temp) + 600.0f) / 2.0f; parts[i].temp = ((parts[i].temp + parts[s].temp) + 600.0f) / 2.0f;
@@ -67,14 +67,13 @@ int Element_POLO::update(UPDATE_FUNC_ARGS)
} }
} }
if (r && !(rand()%100))
if (!(rand()%10000))
{ {
int s = sim->create_part(-3, x, y, PT_NEUT); int s = sim->create_part(-3, x, y, PT_NEUT);
if (s >= 0) if (s >= 0)
{ {
parts[i].temp = ((parts[i].temp + parts[r>>8].temp + parts[r>>8].temp) + 600.0f) / 3.0f; parts[i].temp = ((parts[i].temp + parts[r>>8].temp + parts[r>>8].temp) + 600.0f) / 3.0f;
parts[i].life = cooldown; parts[i].life = COOLDOWN;
parts[i].tmp++; parts[i].tmp++;
parts[r>>8].temp = parts[i].temp; parts[r>>8].temp = parts[i].temp;
@@ -85,7 +84,7 @@ int Element_POLO::update(UPDATE_FUNC_ARGS)
} }
} }
} }
if (parts[i].tmp2 >= 20) if (parts[i].tmp2 >= 6)
{ {
sim->part_change_type(i,x,y,PT_PLUT); sim->part_change_type(i,x,y,PT_PLUT);
parts[i].temp = (parts[i].temp+600.0f)/2.0f; parts[i].temp = (parts[i].temp+600.0f)/2.0f;
@@ -97,29 +96,23 @@ int Element_POLO::update(UPDATE_FUNC_ARGS)
sim->kill_part(r>>8); sim->kill_part(r>>8);
} }
if (parts[i].temp < 388.15f) if (parts[i].temp < 388.15f)
{
if (parts[i].temp >= 388.15f-0.2f)
{ {
parts[i].temp += 0.2f; parts[i].temp += 0.2f;
} }
else
{
//no overheating!
parts[i].temp += 388.15f-parts[i].temp;
}
}
return 0; return 0;
} }
//#TPT-Directive ElementHeader Element_POLO static int graphics(GRAPHICS_FUNC_ARGS) //#TPT-Directive ElementHeader Element_POLO static int graphics(GRAPHICS_FUNC_ARGS)
int Element_POLO::graphics(GRAPHICS_FUNC_ARGS) int Element_POLO::graphics(GRAPHICS_FUNC_ARGS)
{ {
if (cpart->tmp >= 5) if (cpart->tmp >= LIMIT)
{ {
*colr = 0x70; *colr = 0x70;
*colg = 0x70; *colg = 0x70;
*colb = 0x70; *colb = 0x70;
} }
else
*pixel_mode |= PMODE_GLOW;
return 0; return 0;
} }