summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorraymoo <raymoo@users.noreply.github.com>2017-09-30 06:23:52 -0700
committerSmallJoker <mk939@ymail.com>2018-06-03 17:31:59 +0200
commit017815161b8583c07f0636dcfa05d654acbdfacd (patch)
treed2bb181f74fa18fcc7522305ff7c72f146b0106e
parentab72100a2cf76a64218bbdf8a4dc9f3eae25a72f (diff)
downloadminetest-017815161b8583c07f0636dcfa05d654acbdfacd.tar.gz
minetest-017815161b8583c07f0636dcfa05d654acbdfacd.tar.bz2
minetest-017815161b8583c07f0636dcfa05d654acbdfacd.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.
-rw-r--r--src/particles.cpp12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/particles.cpp b/src/particles.cpp
index e89e182e6..0caa4f796 100644
--- a/src/particles.cpp
+++ b/src/particles.cpp
@@ -326,6 +326,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);
@@ -333,7 +338,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);
}
@@ -387,6 +391,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);
@@ -394,7 +403,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);
}