summaryrefslogtreecommitdiff
path: root/src/elements/deut.cpp
diff options
context:
space:
mode:
authorSimon Robertshaw <simon@hardwired.org.uk>2012-04-17 16:48:12 (GMT)
committer Simon Robertshaw <simon@hardwired.org.uk>2012-04-17 16:48:12 (GMT)
commit89788d43c3c45bf0535b200a7703b91e0297208b (patch)
treea0ed987576d1f911c10dc1ad4841358e8f8cb5f9 /src/elements/deut.cpp
parentdf303dc4911c55031c74d30e13a58e02b27e7068 (diff)
downloadpowder-89788d43c3c45bf0535b200a7703b91e0297208b.zip
powder-89788d43c3c45bf0535b200a7703b91e0297208b.tar.gz
TPT: Make DEUT compress when Newtonian gravity is applied to it c960c29f72
Diffstat (limited to 'src/elements/deut.cpp')
-rw-r--r--src/elements/deut.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/elements/deut.cpp b/src/elements/deut.cpp
index cee38de..e5efe53 100644
--- a/src/elements/deut.cpp
+++ b/src/elements/deut.cpp
@@ -2,9 +2,13 @@
int update_DEUT(UPDATE_FUNC_ARGS) {
int r, rx, ry, trade, np;
+ float gravtot = fabs(sim->gravy[(y/CELL)*(XRES/CELL)+(x/CELL)])+fabs(sim->gravx[(y/CELL)*(XRES/CELL)+(x/CELL)]);
int maxlife = ((10000/(parts[i].temp + 1))-1);
if ((10000%((int)parts[i].temp+1))>rand()%((int)parts[i].temp+1))
maxlife ++;
+ // Compress when Newtonian gravity is applied
+ // multiplier=1 when gravtot=0, multiplier -> 5 as gravtot -> inf
+ maxlife = maxlife*(5.0f - 8.0f/(gravtot+2.0f));
if (parts[i].life < maxlife)
{
for (rx=-1; rx<2; rx++)