summaryrefslogtreecommitdiff
path: root/src/elements/repl.c
diff options
context:
space:
mode:
authorSimon Robertshaw <simon@hardwired.org.uk>2012-02-25 10:26:02 (GMT)
committer Simon Robertshaw <simon@hardwired.org.uk>2012-02-25 10:26:02 (GMT)
commitf6696282e1d06081bb8b9d7a394483562b9f2165 (patch)
treee79cb452dc15bb2264cd1044ba56e9f916e4305e /src/elements/repl.c
parent1c4bce1f22d67c25b9bf7ec92dbef37628885f1e (diff)
downloadpowder-f6696282e1d06081bb8b9d7a394483562b9f2165.zip
powder-f6696282e1d06081bb8b9d7a394483562b9f2165.tar.gz
Added FRAY - Force-ray and RPEL - Repeller
Diffstat (limited to 'src/elements/repl.c')
-rw-r--r--src/elements/repl.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/elements/repl.c b/src/elements/repl.c
new file mode 100644
index 0000000..254e219
--- /dev/null
+++ b/src/elements/repl.c
@@ -0,0 +1,22 @@
+#include <element.h>
+
+int update_REPL(UPDATE_FUNC_ARGS) {
+ int r, rx, ry, ri;
+ for(ri = 0; ri <= 10; ri++)
+ {
+ rx = (rand()%20)-10;
+ ry = (rand()%20)-10;
+ if (x+rx>=0 && y+ry>0 && x+rx<XRES && y+ry<YRES && (rx || ry))
+ {
+ r = pmap[y+ry][x+rx];
+ if (!r)
+ r = photons[y+ry][x+rx];
+
+ if (r && !(ptypes[r&0xFF].properties & TYPE_SOLID)){
+ parts[r>>8].vx += isign(rx)*((parts[i].temp-273.15)/10.0f);
+ parts[r>>8].vy += isign(ry)*((parts[i].temp-273.15)/10.0f);
+ }
+ }
+ }
+ return 0;
+}