Particles: Do not add digging particles for airlike nodes (#6392)
authorSmallJoker <SmallJoker@users.noreply.github.com>
Fri, 8 Sep 2017 16:39:24 +0000 (18:39 +0200)
committerGitHub <noreply@github.com>
Fri, 8 Sep 2017 16:39:24 +0000 (18:39 +0200)
src/game.cpp
src/particles.cpp
src/particles.h

index c9d314fa15e88859191478cdc2012de2d6258d36..bb1875cf37c951d8337993985107a6475ae0f3be 100644 (file)
@@ -4032,7 +4032,7 @@ void Game::handleDigging(const PointedThing &pointed, const v3s16 &nodepos,
 
                if (m_cache_enable_particles) {
                        const ContentFeatures &features = client->getNodeDefManager()->get(n);
-                       client->getParticleManager()->addPunchingParticles(client,
+                       client->getParticleManager()->addNodeParticle(client,
                                        player, nodepos, n, features);
                }
        }
index 4839e45c4b9ab702b19db72e408119c59d4aacb2..faf8063edd4f72d025cabf957d06935465ece7f3 100644 (file)
@@ -601,21 +601,23 @@ void ParticleManager::handleParticleEvent(ClientEvent *event, Client *client,
 void ParticleManager::addDiggingParticles(IGameDef* gamedef,
        LocalPlayer *player, v3s16 pos, const MapNode &n, const ContentFeatures &f)
 {
+       // No particles for "airlike" nodes
+       if (f.drawtype == NDT_AIRLIKE)
+               return;
+
        // set the amount of particles here
        for (u16 j = 0; j < 32; j++) {
                addNodeParticle(gamedef, player, pos, n, f);
        }
 }
 
-void ParticleManager::addPunchingParticles(IGameDef* gamedef,
-       LocalPlayer *player, v3s16 pos, const MapNode &n, const ContentFeatures &f)
-{
-       addNodeParticle(gamedef, player, pos, n, f);
-}
-
 void ParticleManager::addNodeParticle(IGameDef* gamedef,
        LocalPlayer *player, v3s16 pos, const MapNode &n, const ContentFeatures &f)
 {
+       // No particles for "airlike" nodes
+       if (f.drawtype == NDT_AIRLIKE)
+               return;
+
        // Texture
        u8 texid = myrand_range(0, 5);
        const TileLayer &tile = f.tiles[texid].layers[0];
index 1956580452cf6f8f91c67608a57061d566dc6337..11ccd6218c4c163f0c1b9c7178b9205724942b51 100644 (file)
@@ -185,9 +185,6 @@ public:
        void addDiggingParticles(IGameDef *gamedef, LocalPlayer *player, v3s16 pos,
                const MapNode &n, const ContentFeatures &f);
 
-       void addPunchingParticles(IGameDef *gamedef, LocalPlayer *player, v3s16 pos,
-               const MapNode &n, const ContentFeatures &f);
-
        void addNodeParticle(IGameDef *gamedef, LocalPlayer *player, v3s16 pos,
                const MapNode &n, const ContentFeatures &f);