NPXcoot / nssm

Not So Simple Mobs mod for Minetest
14 stars 9 forks source link

Simple fix for a severe performance issue. #22

Open lhofhansl opened 6 years ago

lhofhansl commented 6 years ago

The first part fixes a very bad problem, where icelamanders and mese_dragons update the same blocks over and over again, marking them dirty even when they are not changed. That causes the pipeline of blocks from server to client to stall and no other blocks are transmitted anymore.

The second part is an API change in MineTest

diff --git a/nssm_api.lua b/nssm_api.lua                                        
index 1cf8819..2005196 100644                                                   
--- a/nssm_api.lua                                                              
+++ b/nssm_api.lua                                                              
@@ -507,7 +507,7 @@ function midas_ability(             --ability to transform every blocks it touches in the m                                                 
                                local p = {x=pos.x+dx, y=pos.y+dy, z=pos.z+dz}  
                                local n = minetest.env:get_node(p).name         

-                               if minetest.get_item_group(n, "unbreakable") == 1 or minetest.is_protected(p, "") or n=="air" or (n == "bones:bones" and not nssm:affectbones(self)) then                                                       
+                               if minetest.get_item_group(n, "unbreakable") == 1 or minetest.is_protected(p, "") or n=="air" or (n == "bones:bones" and not nssm:affectbones(self)) or n==m_block then                                         
                                else                                            
                                        minetest.env:set_node(p, {name=m_block})
                                end                                             
@@ -847,7 +847,7 @@ local function tnt_explode(pos, radius, ignore_protection, ignore_on_blast)                                                                 
                local s = vector.add(pos, rad)                                  
                local r = vector.length(rad)                                    
                if r / radius < 1.4 then
-                       nodeupdate_single(s)
+                       core.check_single_for_falling(s)
                end
        end
        end
lhofhansl commented 6 years ago

Is nssm still alive?

This small fix is the difference between Minetest stopping to load the world (since unnecessary block changes from nssm fill the block queue) and normal expected behavior.

mckaygerhard commented 2 years ago

thanks for the fix.. i opened this https://github.com/NPXcoot/nssm/issues/27 but i only use 0.4 i will put my fork in codeberg and a mirror here in M$ crap of github