mirror of
https://github.com/luanti-org/luanti.git
synced 2025-08-11 17:51:04 +00:00
Handle particle spawners in env and delete expired ids
Rebased by Zeno (2016-04-2016)
This commit is contained in:
parent
26a9a85129
commit
6278da296b
4 changed files with 62 additions and 22 deletions
|
@ -3194,19 +3194,7 @@ u32 Server::addParticleSpawner(u16 amount, float spawntime,
|
|||
peer_id = player->peer_id;
|
||||
}
|
||||
|
||||
u32 id = 0;
|
||||
for(;;) // look for unused particlespawner id
|
||||
{
|
||||
id++;
|
||||
if (std::find(m_particlespawner_ids.begin(),
|
||||
m_particlespawner_ids.end(), id)
|
||||
== m_particlespawner_ids.end())
|
||||
{
|
||||
m_particlespawner_ids.push_back(id);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
u32 id = m_env->addParticleSpawner(spawntime);
|
||||
SendAddParticleSpawner(peer_id, amount, spawntime,
|
||||
minpos, maxpos, minvel, maxvel, minacc, maxacc,
|
||||
minexptime, maxexptime, minsize, maxsize,
|
||||
|
@ -3229,13 +3217,16 @@ void Server::deleteParticleSpawner(const std::string &playername, u32 id)
|
|||
peer_id = player->peer_id;
|
||||
}
|
||||
|
||||
m_particlespawner_ids.erase(
|
||||
std::remove(m_particlespawner_ids.begin(),
|
||||
m_particlespawner_ids.end(), id),
|
||||
m_particlespawner_ids.end());
|
||||
m_env->deleteParticleSpawner(id);
|
||||
SendDeleteParticleSpawner(peer_id, id);
|
||||
}
|
||||
|
||||
void Server::deleteParticleSpawnerAll(u32 id)
|
||||
{
|
||||
m_env->deleteParticleSpawner(id);
|
||||
SendDeleteParticleSpawner(PEER_ID_INEXISTENT, id);
|
||||
}
|
||||
|
||||
Inventory* Server::createDetachedInventory(const std::string &name)
|
||||
{
|
||||
if(m_detached_inventories.count(name) > 0){
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue