summaryrefslogtreecommitdiff
path: root/src/particles.cpp
diff options
context:
space:
mode:
authorraymoo <raymoo@users.noreply.github.com>2017-09-30 06:23:52 -0700
committerLoïc Blot <nerzhul@users.noreply.github.com>2017-09-30 15:23:51 +0200
commit8c16f18fdbe99aa6781a0e6e6c5b9c50d4c0b874 (patch)
tree3a9fbcfc6e74373e28bb2195f1213185d75da32e /src/particles.cpp
parentbe10c0893e2e6d1852a027abccc4cd3cdc85a140 (diff)
downloadminetest-8c16f18fdbe99aa6781a0e6e6c5b9c50d4c0b874.tar.gz
minetest-8c16f18fdbe99aa6781a0e6e6c5b9c50d4c0b874.tar.bz2
minetest-8c16f18fdbe99aa6781a0e6e6c5b9c50d4c0b874.zip
Fix attached particle spawners far from spawn (#6479)
* Fix attached particle spawners far from spawn When far from spawn, attached particle spawners did not spawn particles.
Diffstat (limited to 'src/particles.cpp')
-rw-r--r--src/particles.cpp12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/particles.cpp b/src/particles.cpp
index faf8063ed..c588fa7a7 100644
--- a/src/particles.cpp
+++ b/src/particles.cpp
@@ -317,6 +317,11 @@ void ParticleSpawner::step(float dtime, ClientEnvironment* env)
v3f ppos = m_player->getPosition() / BS;
v3f pos = random_v3f(m_minpos, m_maxpos);
+ // Need to apply this first or the following check
+ // will be wrong for attached spawners
+ if (is_attached)
+ pos += attached_pos;
+
if (pos.getDistanceFrom(ppos) <= radius) {
v3f vel = random_v3f(m_minvel, m_maxvel);
v3f acc = random_v3f(m_minacc, m_maxacc);
@@ -324,7 +329,6 @@ void ParticleSpawner::step(float dtime, ClientEnvironment* env)
if (is_attached) {
// Apply attachment yaw and position
pos.rotateXZBy(attached_yaw);
- pos += attached_pos;
vel.rotateXZBy(attached_yaw);
acc.rotateXZBy(attached_yaw);
}
@@ -377,6 +381,11 @@ void ParticleSpawner::step(float dtime, ClientEnvironment* env)
v3f ppos = m_player->getPosition() / BS;
v3f pos = random_v3f(m_minpos, m_maxpos);
+ // Need to apply this first or the following check
+ // will be wrong for attached spawners
+ if (is_attached)
+ pos += attached_pos;
+
if (pos.getDistanceFrom(ppos) <= radius) {
v3f vel = random_v3f(m_minvel, m_maxvel);
v3f acc = random_v3f(m_minacc, m_maxacc);
@@ -384,7 +393,6 @@ void ParticleSpawner::step(float dtime, ClientEnvironment* env)
if (is_attached) {
// Apply attachment yaw and position
pos.rotateXZBy(attached_yaw);
- pos += attached_pos;
vel.rotateXZBy(attached_yaw);
acc.rotateXZBy(attached_yaw);
}