summaryrefslogtreecommitdiff
path: root/src/simulation/elements/PROT.cpp
diff options
context:
space:
mode:
authorjacob1 <jfu614@gmail.com>2013-09-14 02:02:03 (GMT)
committer jacob1 <jfu614@gmail.com>2013-09-14 02:02:03 (GMT)
commitae8e5e5c343d033914515d72c44ad511b0aca2a3 (patch)
tree773508fe58102f43cd2d9b83d24638487e3004c0 /src/simulation/elements/PROT.cpp
parent830bb3ba5e37f547f836a9c793f6084b305a4bfb (diff)
downloadpowder-ae8e5e5c343d033914515d72c44ad511b0aca2a3.zip
powder-ae8e5e5c343d033914515d72c44ad511b0aca2a3.tar.gz
PROT+DEUT causes DEUT implosion (same as with NEUT, just negative pressure)
Also PHOT+H2 now also make PROT+ELEC (which will not combine to make more H2)
Diffstat (limited to 'src/simulation/elements/PROT.cpp')
-rw-r--r--src/simulation/elements/PROT.cpp29
1 files changed, 29 insertions, 0 deletions
diff --git a/src/simulation/elements/PROT.cpp b/src/simulation/elements/PROT.cpp
index 4302244..3e6a661 100644
--- a/src/simulation/elements/PROT.cpp
+++ b/src/simulation/elements/PROT.cpp
@@ -65,6 +65,14 @@ int Element_PROT::update(UPDATE_FUNC_ARGS)
parts[under>>8].life = 44+parts[under>>8].life;
parts[under>>8].ctype = 0;
}
+ else if ((under&0xFF) == PT_DEUT)
+ {
+ if ((-((int)sim->pv[y/CELL][x/CELL]-4)+(parts[under>>8].life/100)) > rand()%200)
+ {
+ DeutImplosion(sim, parts[under>>8].life, x, y, restrict_flt(parts[under>>8].temp + parts[under>>8].life*500, MIN_TEMP, MAX_TEMP), PT_PROT);
+ sim->kill_part(under>>8);
+ }
+ }
//prevent inactive sparkable elements from being sparked
else if ((sim->elements[under&0xFF].Properties&PROP_CONDUCTS) && parts[under>>8].life <= 4)
{
@@ -138,6 +146,27 @@ int Element_PROT::update(UPDATE_FUNC_ARGS)
return 0;
}
+//#TPT-Directive ElementHeader Element_PROT static int DeutImplosion(Simulation * sim, int n, int x, int y, float temp, int t)
+int Element_PROT::DeutImplosion(Simulation * sim, int n, int x, int y, float temp, int t)
+{
+ int i;
+ n = (n/50);
+ if (n<1)
+ n = 1;
+ else if (n>340)
+ n = 340;
+
+ for (int c=0; c<n; c++)
+ {
+ i = sim->create_part(-3, x, y, t);
+ if (i >= 0)
+ sim->parts[i].temp = temp;
+
+ sim->pv[y/CELL][x/CELL] -= 6.0f * CFDS;
+ }
+ return 0;
+}
+
//#TPT-Directive ElementHeader Element_PROT static int graphics(GRAPHICS_FUNC_ARGS)
int Element_PROT::graphics(GRAPHICS_FUNC_ARGS)
{