diff --git a/includes/powder.h b/includes/powder.h
index 00d9d6858..5c54290de 100644
--- a/includes/powder.h
+++ b/includes/powder.h
@@ -236,7 +236,8 @@
#define PT_FRAY 159
#define PT_REPL 160
#define PT_PPIP 161
-#define PT_NUM 162
+#define PT_DTEC 162
+#define PT_NUM 163
#define R_TEMP 22
#define MAX_TEMP 9999
@@ -389,6 +390,7 @@ int update_CLNE(UPDATE_FUNC_ARGS);
int update_COAL(UPDATE_FUNC_ARGS);
int update_DEUT(UPDATE_FUNC_ARGS);
int update_DSTW(UPDATE_FUNC_ARGS);
+int update_DTEC(UPDATE_FUNC_ARGS);
int update_EMBR(UPDATE_FUNC_ARGS);
int update_FOG(UPDATE_FUNC_ARGS);
int update_FRZW(UPDATE_FUNC_ARGS);
diff --git a/src/elementdata.c b/src/elementdata.c
index 7c226c0c4..e7803fef2 100644
--- a/src/elementdata.c
+++ b/src/elementdata.c
@@ -192,7 +192,8 @@ part_type ptypes[PT_NUM] =
{"FIGH", PIXPACK(0xFFE0A0), 0.5f, 0.00f * CFDS, 0.2f, 1.0f, 0.0f, 0.0f, 0.0f, 0.00f * CFDS, 0, 0, 0, 0, 0, 1, 1, 50, SC_SPECIAL, R_TEMP+14.6f+273.15f, 0, "Fighter. Tries to kill stickmen.", ST_NONE, 0, &update_FIGH, &graphics_STKM},
{"FRAY", PIXPACK(0x00BBFF), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, 1, 100, SC_FORCE, 20.0f+0.0f +273.15f, 0, "Force Emitter. Push or pull objects based on temp value, use like ARAY", ST_SOLID, TYPE_SOLID|PROP_LIFE_DEC, &update_FRAY, NULL},
{"RPEL", PIXPACK(0x99CC00), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 1, 1, 1, 100, SC_FORCE, 20.0f+0.0f +273.15f, 0, "Repel or attract particles based on temp value.", ST_NONE, TYPE_SOLID, &update_REPL, NULL},
- {"PPIP", PIXPACK(0x444466), 0.0f, 0.00f * CFDS, 0.95f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 0, 1, 1, 100, SC_POWERED, 273.15f, 0, "Powered version of pipe", ST_SOLID, TYPE_SOLID|PROP_LIFE_DEC, &update_PIPE, &graphics_PIPE},
+ {"PPIP", PIXPACK(0x444466), 0.0f, 0.00f * CFDS, 0.95f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 0, 1, 1, 100, SC_POWERED, 273.15f, 0, "Powered pipe", ST_SOLID, TYPE_SOLID|PROP_LIFE_DEC, &update_PIPE, &graphics_PIPE},
+ {"DTEC", PIXPACK(0xFD9D18), 0.0f, 0.00f * CFDS, 0.96f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 1, 1, 1, 100, SC_SPECIAL, R_TEMP+273.15f, 0, "Creates a spark when something with its ctype is nearby", ST_SOLID, TYPE_SOLID, &update_DTEC, NULL},
//Name Colour Advec Airdrag Airloss Loss Collid Grav Diffus Hotair Fal Burn Exp Mel Hrd M Use Weight Section H Ins Description
};
@@ -370,6 +371,7 @@ part_transition ptransitions[PT_NUM] =
/* FRAY */ {IPL, NT, IPH, NT, ITL, NT, ITH, NT},
/* REPL */ {IPL, NT, IPH, NT, ITL, NT, ITH, NT},
/* PPIP */ {IPL, NT, IPH, NT, ITL, NT, ITH, NT},
+ /* DTEC */ {IPL, NT, IPH, NT, ITL, NT, ITH, NT},
};
// This is an enthalpy values table, converted into TPT imaginary units
@@ -538,6 +540,7 @@ unsigned int platent[PT_NUM] =
/* FRAY */ 0,
/* REPL */ 0,
/* PPIP */ 0,
+ /* DTEC */ 0,
};
#undef IPL
#undef IPH
diff --git a/src/elements/dtec.c b/src/elements/dtec.c
new file mode 100644
index 000000000..28058e78d
--- /dev/null
+++ b/src/elements/dtec.c
@@ -0,0 +1,59 @@
+/*
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+#include
+
+int update_DTEC(UPDATE_FUNC_ARGS) {
+ int r, rx, ry, rt, rd = parts[i].tmp2;
+ if (rd > 25) parts[i].tmp2 = rd = 25;
+ if (parts[i].life)
+ {
+ parts[i].life = 0;
+ for (rx=-2; rx<3; rx++)
+ for (ry=-2; ry<3; ry++)
+ if (x+rx>=0 && y+ry>0 && x+rx>8].type;
+ if (parts_avg(i,r>>8,PT_INSL) != PT_INSL)
+ {
+ if ((ptypes[rt].properties&PROP_CONDUCTS) && !(rt==PT_WATR||rt==PT_SLTW||rt==PT_NTCT||rt==PT_PTCT||rt==PT_INWR) && parts[r>>8].life==0 && in_radius(rd, rx, ry))
+ {
+ parts[r>>8].life = 4;
+ parts[r>>8].ctype = rt;
+ part_change_type(r>>8,x+rx,y+ry,PT_SPRK);
+ }
+ }
+ }
+ }
+ for (rx=-rd; rx=0 && y+ry>0 && x+rx>8].type == parts[i].ctype && (parts[i].ctype != PT_LIFE || parts[i].tmp == parts[r>>8].tmp))
+ parts[i].life = 1;
+ }
+ return 0;
+}
+
+int in_radius(int rd, int x, int y)
+{
+ return (pow((double)x,2)*pow((double)rd,2)+pow((double)y,2)*pow((double)rd,2)<=pow((double)rd,2)*pow((double)rd,2));
+}
\ No newline at end of file
diff --git a/src/powder.c b/src/powder.c
index ce3e4a98b..71e8596cf 100644
--- a/src/powder.c
+++ b/src/powder.c
@@ -876,13 +876,14 @@ inline int create_part(int p, int x, int y, int tv)//the function for creating a
{
if (pmap[y][x])
{
+ int pmaptype = (pmap[y][x]&0xFF);
if ((
- ((pmap[y][x]&0xFF)==PT_STOR&&!(ptypes[t].properties&TYPE_SOLID))||
- (pmap[y][x]&0xFF)==PT_CLNE||
- (pmap[y][x]&0xFF)==PT_BCLN||
- (pmap[y][x]&0xFF)==PT_CONV||
- ((pmap[y][x]&0xFF)==PT_PCLN&&t!=PT_PSCN&&t!=PT_NSCN)||
- ((pmap[y][x]&0xFF)==PT_PBCN&&t!=PT_PSCN&&t!=PT_NSCN)
+ (pmaptype==PT_STOR&&!(ptypes[t].properties&TYPE_SOLID))||
+ pmaptype==PT_CLNE||
+ pmaptype==PT_BCLN||
+ pmaptype==PT_CONV||
+ (pmaptype==PT_PCLN&&t!=PT_PSCN&&t!=PT_NSCN)||
+ (pmaptype==PT_PBCN&&t!=PT_PSCN&&t!=PT_NSCN)
)&&(
t!=PT_CLNE&&t!=PT_PCLN&&
t!=PT_BCLN&&t!=PT_STKM&&
@@ -893,6 +894,11 @@ inline int create_part(int p, int x, int y, int tv)//the function for creating a
parts[pmap[y][x]>>8].ctype = t;
if (t==PT_LIFE && v>8].tmp = v;
}
+ else if (pmaptype == PT_DTEC && pmaptype != t)
+ {
+ parts[pmap[y][x]>>8].ctype = t;
+ if (t==PT_LIFE && v>8].tmp = v;
+ }
return -1;
}
if (photons[y][x] && (ptypes[t].properties & TYPE_ENERGY))
@@ -1114,6 +1120,9 @@ inline int create_part(int p, int x, int y, int tv)//the function for creating a
case PT_BIZR: case PT_BIZRG: case PT_BIZRS:
parts[i].ctype = 0x47FFFF;
break;
+ case PT_DTEC:
+ parts[i].tmp2 = 2;
+ break;
default:
if (t==PT_FIGH)
{