mirror of
https://github.com/luanti-org/luanti.git
synced 2025-08-11 17:51:04 +00:00
Attached particle spawners
This commit is contained in:
parent
0b27a70b29
commit
c9e7a27eeb
13 changed files with 131 additions and 36 deletions
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue