mirror of
https://github.com/The-Powder-Toy/The-Powder-Toy.git
synced 2025-09-01 12:02:40 +02:00
BREAKING NEWS: Hell has frozen over
New element, GOLD, a corrosion resistant metal that can conduct electricity faster, molten GOLD will turn into molten VIBR on contact with EXOT
This commit is contained in:
@@ -70,7 +70,7 @@ int Element_EXOT::update(UPDATE_FUNC_ARGS) {
|
||||
}
|
||||
else if (rt == PT_LAVA)
|
||||
{
|
||||
if (parts[r>>8].ctype == PT_TTAN && !(rand()%10))
|
||||
if ((parts[r>>8].ctype == PT_TTAN || parts[r>>8].ctype == PT_GOLD) && !(rand()%10))
|
||||
{
|
||||
parts[r>>8].ctype = PT_VIBR;
|
||||
sim->kill_part(i);
|
||||
|
92
src/simulation/elements/GOLD.cpp
Normal file
92
src/simulation/elements/GOLD.cpp
Normal file
@@ -0,0 +1,92 @@
|
||||
#include "simulation/Elements.h"
|
||||
#include "simulation/Air.h"
|
||||
//#TPT-Directive ElementClass Element_GOLD PT_GOLD 170
|
||||
Element_GOLD::Element_GOLD()
|
||||
{
|
||||
Identifier = "DEFAULT_PT_GOLD";
|
||||
Name = "GOLD";
|
||||
Colour = PIXPACK(0xDCAD2C);
|
||||
MenuVisible = 1;
|
||||
MenuSection = SC_SOLIDS;
|
||||
Enabled = 1;
|
||||
|
||||
Advection = 0.0f;
|
||||
AirDrag = 0.00f * CFDS;
|
||||
AirLoss = 0.90f;
|
||||
Loss = 0.00f;
|
||||
Collision = 0.0f;
|
||||
Gravity = 0.0f;
|
||||
Diffusion = 0.00f;
|
||||
HotAir = 0.000f * CFDS;
|
||||
Falldown = 0;
|
||||
|
||||
Flammable = 0;
|
||||
Explosive = 0;
|
||||
Meltable = 1;
|
||||
Hardness = 0;
|
||||
|
||||
Weight = 100;
|
||||
|
||||
Temperature = R_TEMP+0.0f +273.15f;
|
||||
HeatConduct = 251;
|
||||
Description = "Corrosion resistant metal, will reverse corrosion of iron";
|
||||
|
||||
State = ST_SOLID;
|
||||
Properties = TYPE_SOLID|PROP_CONDUCTS|PROP_HOT_GLOW|PROP_LIFE_DEC;
|
||||
|
||||
LowPressure = IPL;
|
||||
LowPressureTransition = NT;
|
||||
HighPressure = IPH;
|
||||
HighPressureTransition = NT;
|
||||
LowTemperature = ITL;
|
||||
LowTemperatureTransition = NT;
|
||||
HighTemperature = 1941.0f;
|
||||
HighTemperatureTransition = PT_LAVA;
|
||||
|
||||
Update = &Element_GOLD::update;
|
||||
|
||||
}
|
||||
|
||||
//#TPT-Directive ElementHeader Element_GOLD static int update(UPDATE_FUNC_ARGS)
|
||||
int Element_GOLD::update(UPDATE_FUNC_ARGS)
|
||||
{
|
||||
int rx, ry, r, blocking = 0;
|
||||
static int checkCoordsX[] = { -4, 4, 0, 0 };
|
||||
static int checkCoordsY[] = { 0, 0, -4, 4 };
|
||||
//Find nearby rusted iron (BMTL with tmp 1+)
|
||||
for(int j = 0; j < 8; j++){
|
||||
rx = (rand()%9)-4;
|
||||
ry = (rand()%9)-4;
|
||||
if ((!rx != !ry) && BOUNDS_CHECK) {
|
||||
r = pmap[y+ry][x+rx];
|
||||
if(!r) continue;
|
||||
if((r&0xFF)==PT_BMTL && parts[r>>8].tmp)
|
||||
{
|
||||
parts[r>>8].tmp = 0;
|
||||
sim->part_change_type(r>>8, x+rx, y+ry, PT_IRON);
|
||||
}
|
||||
}
|
||||
}
|
||||
//Find sparks
|
||||
if(!parts[i].life)
|
||||
{
|
||||
for(int j = 0; j < 4; j++){
|
||||
rx = checkCoordsX[j];
|
||||
ry = checkCoordsY[j];
|
||||
if ((!rx != !ry) && BOUNDS_CHECK) {
|
||||
r = pmap[y+ry][x+rx];
|
||||
if(!r) continue;
|
||||
if((r&0xFF)==PT_SPRK && parts[r>>8].life)
|
||||
{
|
||||
parts[i].life = 4;
|
||||
parts[i].type = PT_SPRK;
|
||||
parts[i].ctype = PT_GOLD;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
Element_GOLD::~Element_GOLD() {}
|
Reference in New Issue
Block a user