mirror of
https://github.com/luanti-org/luanti.git
synced 2025-07-02 16:38:41 +00:00
Revert "Revert CSM particles commit to fix particle spawner bug for 5.0.0 (#8288)"
This reverts commit 01cd63bd3b
.
This commit is contained in:
parent
911db0e256
commit
111f1dc9c5
10 changed files with 337 additions and 8 deletions
|
@ -977,7 +977,7 @@ void Client::handleCommand_AddParticleSpawner(NetworkPacket* pkt)
|
|||
float minsize;
|
||||
float maxsize;
|
||||
bool collisiondetection;
|
||||
u32 id;
|
||||
u32 server_id;
|
||||
|
||||
*pkt >> amount >> spawntime >> minpos >> maxpos >> minvel >> maxvel
|
||||
>> minacc >> maxacc >> minexptime >> maxexptime >> minsize
|
||||
|
@ -985,7 +985,7 @@ void Client::handleCommand_AddParticleSpawner(NetworkPacket* pkt)
|
|||
|
||||
std::string texture = pkt->readLongString();
|
||||
|
||||
*pkt >> id;
|
||||
*pkt >> server_id;
|
||||
|
||||
bool vertical = false;
|
||||
bool collision_removal = false;
|
||||
|
@ -1007,6 +1007,9 @@ void Client::handleCommand_AddParticleSpawner(NetworkPacket* pkt)
|
|||
object_collision = readU8(is);
|
||||
} catch (...) {}
|
||||
|
||||
u32 client_id = m_particle_manager.getSpawnerId();
|
||||
m_particles_server_to_client[server_id] = client_id;
|
||||
|
||||
ClientEvent *event = new ClientEvent();
|
||||
event->type = CE_ADD_PARTICLESPAWNER;
|
||||
event->add_particlespawner.amount = amount;
|
||||
|
@ -1027,7 +1030,7 @@ void Client::handleCommand_AddParticleSpawner(NetworkPacket* pkt)
|
|||
event->add_particlespawner.attached_id = attached_id;
|
||||
event->add_particlespawner.vertical = vertical;
|
||||
event->add_particlespawner.texture = new std::string(texture);
|
||||
event->add_particlespawner.id = id;
|
||||
event->add_particlespawner.id = client_id;
|
||||
event->add_particlespawner.animation = animation;
|
||||
event->add_particlespawner.glow = glow;
|
||||
|
||||
|
@ -1037,12 +1040,19 @@ void Client::handleCommand_AddParticleSpawner(NetworkPacket* pkt)
|
|||
|
||||
void Client::handleCommand_DeleteParticleSpawner(NetworkPacket* pkt)
|
||||
{
|
||||
u32 id;
|
||||
*pkt >> id;
|
||||
u32 server_id;
|
||||
*pkt >> server_id;
|
||||
|
||||
u32 client_id;
|
||||
auto i = m_particles_server_to_client.find(server_id);
|
||||
if (i != m_particles_server_to_client.end())
|
||||
client_id = i->second;
|
||||
else
|
||||
return;
|
||||
|
||||
ClientEvent *event = new ClientEvent();
|
||||
event->type = CE_DELETE_PARTICLESPAWNER;
|
||||
event->delete_particlespawner.id = id;
|
||||
event->delete_particlespawner.id = client_id;
|
||||
|
||||
m_client_event_queue.push(event);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue