mirror of
https://github.com/moparisthebest/minetest
synced 2025-01-11 13:48:39 -05:00
Fix active_object_count and active_object_count_wider not getting updated between ABM calls causing huge amounts of DMs and rats and stuff
This commit is contained in:
parent
dde22d26a8
commit
1c19f959db
@ -618,6 +618,27 @@ public:
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
ServerMap *map = &m_env->getServerMap();
|
ServerMap *map = &m_env->getServerMap();
|
||||||
|
|
||||||
|
v3s16 p0;
|
||||||
|
for(p0.X=0; p0.X<MAP_BLOCKSIZE; p0.X++)
|
||||||
|
for(p0.Y=0; p0.Y<MAP_BLOCKSIZE; p0.Y++)
|
||||||
|
for(p0.Z=0; p0.Z<MAP_BLOCKSIZE; p0.Z++)
|
||||||
|
{
|
||||||
|
MapNode n = block->getNodeNoEx(p0);
|
||||||
|
content_t c = n.getContent();
|
||||||
|
v3s16 p = p0 + block->getPosRelative();
|
||||||
|
|
||||||
|
std::map<content_t, std::list<ActiveABM> >::iterator j;
|
||||||
|
j = m_aabms.find(c);
|
||||||
|
if(j == m_aabms.end())
|
||||||
|
continue;
|
||||||
|
|
||||||
|
for(std::list<ActiveABM>::iterator
|
||||||
|
i = j->second.begin(); i != j->second.end(); i++)
|
||||||
|
{
|
||||||
|
if(myrand() % i->chance != 0)
|
||||||
|
continue;
|
||||||
|
|
||||||
// Find out how many objects the block contains
|
// Find out how many objects the block contains
|
||||||
u32 active_object_count = block->m_static_objects.m_active.size();
|
u32 active_object_count = block->m_static_objects.m_active.size();
|
||||||
// Find out how many objects this and all the neighbors contain
|
// Find out how many objects this and all the neighbors contain
|
||||||
@ -635,24 +656,6 @@ public:
|
|||||||
+ block2->m_static_objects.m_stored.size();
|
+ block2->m_static_objects.m_stored.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
v3s16 p0;
|
|
||||||
for(p0.X=0; p0.X<MAP_BLOCKSIZE; p0.X++)
|
|
||||||
for(p0.Y=0; p0.Y<MAP_BLOCKSIZE; p0.Y++)
|
|
||||||
for(p0.Z=0; p0.Z<MAP_BLOCKSIZE; p0.Z++)
|
|
||||||
{
|
|
||||||
MapNode n = block->getNodeNoEx(p0);
|
|
||||||
content_t c = n.getContent();
|
|
||||||
v3s16 p = p0 + block->getPosRelative();
|
|
||||||
|
|
||||||
std::map<content_t, std::list<ActiveABM> >::iterator j;
|
|
||||||
j = m_aabms.find(c);
|
|
||||||
if(j == m_aabms.end())
|
|
||||||
continue;
|
|
||||||
|
|
||||||
for(std::list<ActiveABM>::iterator
|
|
||||||
i = j->second.begin(); i != j->second.end(); i++){
|
|
||||||
if(myrand() % i->chance != 0)
|
|
||||||
continue;
|
|
||||||
// Call all the trigger variations
|
// Call all the trigger variations
|
||||||
i->abm->trigger(m_env, p, n);
|
i->abm->trigger(m_env, p, n);
|
||||||
i->abm->trigger(m_env, p, n,
|
i->abm->trigger(m_env, p, n,
|
||||||
|
Loading…
Reference in New Issue
Block a user