mirror of
https://github.com/luanti-org/luanti.git
synced 2025-07-02 16:38:41 +00:00
Fix particle spawners not visible since CSM spawner implementation (#8289)
* Drop the ID mapper, use a big u64 instead. This will permit to resync server ids properly with the manager code * Modernize some code parts (std::unordered_map, auto) * generate id on client part on U32_MAX + 1 ids, lower are for server ids
This commit is contained in:
parent
111f1dc9c5
commit
170dd409cb
6 changed files with 31 additions and 57 deletions
|
@ -1007,10 +1007,7 @@ 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();
|
||||
auto event = new ClientEvent();
|
||||
event->type = CE_ADD_PARTICLESPAWNER;
|
||||
event->add_particlespawner.amount = amount;
|
||||
event->add_particlespawner.spawntime = spawntime;
|
||||
|
@ -1030,7 +1027,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 = client_id;
|
||||
event->add_particlespawner.id = server_id;
|
||||
event->add_particlespawner.animation = animation;
|
||||
event->add_particlespawner.glow = glow;
|
||||
|
||||
|
@ -1043,16 +1040,9 @@ void Client::handleCommand_DeleteParticleSpawner(NetworkPacket* pkt)
|
|||
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 = client_id;
|
||||
event->delete_particlespawner.id = server_id;
|
||||
|
||||
m_client_event_queue.push(event);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue