summaryrefslogtreecommitdiff
path: root/src/server.h
diff options
context:
space:
mode:
authorAuke Kok <sofar+github@foo-projects.org>2016-05-27 21:08:23 -0700
committerkwolekr <kwolekr@minetest.net>2016-05-28 00:08:23 -0400
commitd499ec483837fa7210176ef39beba2d5a3a5a61d (patch)
tree8476d09d0c351481a7b14fc32e51b95a4e07dd3e /src/server.h
parent62d15ac7c1fcd7214a9e45d46bbc560f998edb95 (diff)
downloadminetest-d499ec483837fa7210176ef39beba2d5a3a5a61d.tar.gz
minetest-d499ec483837fa7210176ef39beba2d5a3a5a61d.tar.bz2
minetest-d499ec483837fa7210176ef39beba2d5a3a5a61d.zip
Particles: Add option to remove particles on collision
Adds the particle option `collision_removal = bool` Some particles are hard to use right now since they either go through solid blocks (without collision detection), and with collision detection enabled they (e.g. raindrops) would just stop dead on the floor and sit there until they expire, or worse, scrape along a wall or ceiling. We can solve the problem by adding a boolean flag that tells the particle to be removed if it ever collides with something. This will make it easier to add rain that doesn't fall through your roof or stick on the top of it. Or clouds and smoke that don't go through trees. Particles that collide with this flag are marked expired unconditionally, causing them to be treated like normal expired particles and cleaned up normally. Documentation is adjusted accordingly. An added bonus of this patch is that particles can potentially collide many times with nodes, and this reduces the amount of collisions to 1 (max), which may end up reducing particle load on the client.
Diffstat (limited to 'src/server.h')
-rw-r--r--src/server.h12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/server.h b/src/server.h
index daf51dee1..7ee15a463 100644
--- a/src/server.h
+++ b/src/server.h
@@ -275,7 +275,8 @@ public:
void spawnParticle(const std::string &playername,
v3f pos, v3f velocity, v3f acceleration,
float expirationtime, float size,
- bool collisiondetection, bool vertical, const std::string &texture);
+ bool collisiondetection, bool collision_removal,
+ bool vertical, const std::string &texture);
u32 addParticleSpawner(u16 amount, float spawntime,
v3f minpos, v3f maxpos,
@@ -283,7 +284,8 @@ public:
v3f minacc, v3f maxacc,
float minexptime, float maxexptime,
float minsize, float maxsize,
- bool collisiondetection, bool vertical, const std::string &texture,
+ bool collisiondetection, bool collision_removal,
+ bool vertical, const std::string &texture,
const std::string &playername);
void deleteParticleSpawner(const std::string &playername, u32 id);
@@ -456,7 +458,8 @@ private:
v3f minacc, v3f maxacc,
float minexptime, float maxexptime,
float minsize, float maxsize,
- bool collisiondetection, bool vertical, std::string texture, u32 id);
+ bool collisiondetection, bool collision_removal,
+ bool vertical, const std::string &texture, u32 id);
void SendDeleteParticleSpawner(u16 peer_id, u32 id);
@@ -464,7 +467,8 @@ private:
void SendSpawnParticle(u16 peer_id,
v3f pos, v3f velocity, v3f acceleration,
float expirationtime, float size,
- bool collisiondetection, bool vertical, std::string texture);
+ bool collisiondetection, bool collision_removal,
+ bool vertical, const std::string &texture);
u32 SendActiveObjectRemoveAdd(u16 peer_id, const std::string &datas);
void SendActiveObjectMessages(u16 peer_id, const std::string &datas, bool reliable = true);