summaryrefslogtreecommitdiff
path: root/src/simulation/elements/GOLD.cpp
diff options
context:
space:
mode:
authormmbob <mmbob+github@outlook.com>2013-04-30 01:50:12 (GMT)
committer mmbob <mmbob+github@outlook.com>2013-04-30 01:50:12 (GMT)
commit9d4cbd3112a6a21858054deebc76b6bf30eec6df (patch)
tree40774e20fe7090a085c4f4be9b9f8ec2095ef6ee /src/simulation/elements/GOLD.cpp
parente166640cbbe6d990175e835ae9ff463d9bae34f1 (diff)
parentb83043e2a6293e83d5d7fbad70a7e20b131ba33b (diff)
downloadpowder-9d4cbd3112a6a21858054deebc76b6bf30eec6df.zip
powder-9d4cbd3112a6a21858054deebc76b6bf30eec6df.tar.gz
Merge remote-tracking branch 'upstream/master'
Diffstat (limited to 'src/simulation/elements/GOLD.cpp')
-rw-r--r--src/simulation/elements/GOLD.cpp92
1 files changed, 92 insertions, 0 deletions
diff --git a/src/simulation/elements/GOLD.cpp b/src/simulation/elements/GOLD.cpp
new file mode 100644
index 0000000..e3837d7
--- /dev/null
+++ b/src/simulation/elements/GOLD.cpp
@@ -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[r>>8].life<4)
+ {
+ parts[i].life = 4;
+ parts[i].type = PT_SPRK;
+ parts[i].ctype = PT_GOLD;
+ }
+ }
+ }
+ }
+ return 0;
+}
+
+
+Element_GOLD::~Element_GOLD() {}