@@ -719,6 +719,29 @@ class ABMHandler
719
719
720
720
ServerMap *map = &m_env->getServerMap ();
721
721
722
+ // Find out how many objects the block contains
723
+ u32 active_object_count = block->m_static_objects .m_active .size ();
724
+ // Find out how many objects this and all the neighbors contain
725
+ u32 active_object_count_wider = 0 ;
726
+ u32 wider_unknown_count = 0 ;
727
+ for (s16 x=-1 ; x<=1 ; x++)
728
+ for (s16 y=-1 ; y<=1 ; y++)
729
+ for (s16 z=-1 ; z<=1 ; z++)
730
+ {
731
+ MapBlock *block2 = map->getBlockNoCreateNoEx (
732
+ block->getPos () + v3s16 (x,y,z));
733
+ if (block2==NULL ){
734
+ wider_unknown_count = 0 ;
735
+ continue ;
736
+ }
737
+ active_object_count_wider +=
738
+ block2->m_static_objects .m_active .size ()
739
+ + block2->m_static_objects .m_stored .size ();
740
+ }
741
+ // Extrapolate
742
+ u32 wider_known_count = 3 *3 *3 - wider_unknown_count;
743
+ active_object_count_wider += wider_unknown_count * active_object_count_wider / wider_known_count;
744
+
722
745
v3s16 p0;
723
746
for (p0.X =0 ; p0.X <MAP_BLOCKSIZE; p0.X ++)
724
747
for (p0.Y =0 ; p0.Y <MAP_BLOCKSIZE; p0.Y ++)
@@ -762,29 +785,6 @@ class ABMHandler
762
785
}
763
786
neighbor_found:
764
787
765
- // Find out how many objects the block contains
766
- u32 active_object_count = block->m_static_objects .m_active .size ();
767
- // Find out how many objects this and all the neighbors contain
768
- u32 active_object_count_wider = 0 ;
769
- u32 wider_unknown_count = 0 ;
770
- for (s16 x=-1 ; x<=1 ; x++)
771
- for (s16 y=-1 ; y<=1 ; y++)
772
- for (s16 z=-1 ; z<=1 ; z++)
773
- {
774
- MapBlock *block2 = map->getBlockNoCreateNoEx (
775
- block->getPos () + v3s16 (x,y,z));
776
- if (block2==NULL ){
777
- wider_unknown_count = 0 ;
778
- continue ;
779
- }
780
- active_object_count_wider +=
781
- block2->m_static_objects .m_active .size ()
782
- + block2->m_static_objects .m_stored .size ();
783
- }
784
- // Extrapolate
785
- u32 wider_known_count = 3 *3 *3 - wider_unknown_count;
786
- active_object_count_wider += wider_unknown_count * active_object_count_wider / wider_known_count;
787
-
788
788
// Call all the trigger variations
789
789
i->abm ->trigger (m_env, p, n);
790
790
i->abm ->trigger (m_env, p, n,
0 commit comments