summaryrefslogtreecommitdiff
path: root/src/server.cpp
diff options
context:
space:
mode:
authorraymoo <uguu@installgentoo.com>2016-08-04 13:09:21 -0700
committerNer'zhul <nerzhul@users.noreply.github.com>2016-10-13 17:33:16 +0200
commitc9e7a27eeb628be78a835abadf8afe1177eb90c5 (patch)
tree119a8747a0d33f69f5e14c6a563f3e9df673f923 /src/server.cpp
parent0b27a70b294590d7fb2bb25bf2d207a719ce8d98 (diff)
downloadminetest-c9e7a27eeb628be78a835abadf8afe1177eb90c5.tar.gz
minetest-c9e7a27eeb628be78a835abadf8afe1177eb90c5.tar.bz2
minetest-c9e7a27eeb628be78a835abadf8afe1177eb90c5.zip
Attached particle spawners
Diffstat (limited to 'src/server.cpp')
-rw-r--r--src/server.cpp17
1 files changed, 13 insertions, 4 deletions
diff --git a/src/server.cpp b/src/server.cpp
index a93c143c7..e67f37d56 100644
--- a/src/server.cpp
+++ b/src/server.cpp
@@ -1678,7 +1678,7 @@ void Server::SendSpawnParticle(u16 peer_id, v3f pos, v3f velocity, v3f accelerat
void Server::SendAddParticleSpawner(u16 peer_id, u16 amount, float spawntime, v3f minpos, v3f maxpos,
v3f minvel, v3f maxvel, v3f minacc, v3f maxacc, float minexptime, float maxexptime,
float minsize, float maxsize, bool collisiondetection, bool collision_removal,
- bool vertical, const std::string &texture, u32 id)
+ u16 attached_id, bool vertical, const std::string &texture, u32 id)
{
DSTACK(FUNCTION_NAME);
@@ -1692,6 +1692,7 @@ void Server::SendAddParticleSpawner(u16 peer_id, u16 amount, float spawntime, v3
pkt << id << vertical;
pkt << collision_removal;
+ pkt << attached_id;
if (peer_id != PEER_ID_INEXISTENT) {
Send(&pkt);
@@ -3156,7 +3157,7 @@ u32 Server::addParticleSpawner(u16 amount, float spawntime,
v3f minpos, v3f maxpos, v3f minvel, v3f maxvel, v3f minacc, v3f maxacc,
float minexptime, float maxexptime, float minsize, float maxsize,
bool collisiondetection, bool collision_removal,
- bool vertical, const std::string &texture,
+ ServerActiveObject *attached, bool vertical, const std::string &texture,
const std::string &playername)
{
// m_env will be NULL if the server is initializing
@@ -3171,11 +3172,19 @@ u32 Server::addParticleSpawner(u16 amount, float spawntime,
peer_id = player->peer_id;
}
- u32 id = m_env->addParticleSpawner(spawntime);
+ u16 attached_id = attached ? attached->getId() : 0;
+
+ u32 id;
+ if (attached_id == 0)
+ id = m_env->addParticleSpawner(spawntime);
+ else
+ id = m_env->addParticleSpawner(spawntime, attached_id);
+
SendAddParticleSpawner(peer_id, amount, spawntime,
minpos, maxpos, minvel, maxvel, minacc, maxacc,
minexptime, maxexptime, minsize, maxsize,
- collisiondetection, collision_removal, vertical, texture, id);
+ collisiondetection, collision_removal, attached_id, vertical,
+ texture, id);
return id;
}