mirror of
				https://github.com/sys4-fr/server-nalc.git
				synced 2025-11-04 05:55:28 +01:00 
			
		
		
		
	[item_drop] Optimize a bit; reduce ticking rate to 0.2s
This commit is contained in:
		@@ -26,9 +26,10 @@ minetest.register_globalstep(function(dtime)
 | 
			
		||||
			pos.y = pos.y + 0.9
 | 
			
		||||
			local inv = player:get_inventory()
 | 
			
		||||
 | 
			
		||||
			if inv then
 | 
			
		||||
				for _,object in ipairs(minetest.get_objects_inside_radius(pos, scan_range)) do
 | 
			
		||||
					local luaEnt = object:get_luaentity()
 | 
			
		||||
				if not object:is_player() and luaEnt and luaEnt.name == "__builtin:item" then
 | 
			
		||||
					if and luaEnt and luaEnt.name == "__builtin:item" then
 | 
			
		||||
						local ticky = luaEnt.item_drop_min_tstamp
 | 
			
		||||
						if ticky then
 | 
			
		||||
							if tstamp >= ticky then
 | 
			
		||||
@@ -47,7 +48,7 @@ minetest.register_globalstep(function(dtime)
 | 
			
		||||
							local playerDistance = dX*dX+dZ*dZ
 | 
			
		||||
							if playerDistance <= pickup_range_squared then
 | 
			
		||||
								local itemStack = ItemStack(luaEnt.itemstring)
 | 
			
		||||
							if inv and inv:room_for_item("main", itemStack) then
 | 
			
		||||
								if inv:room_for_item("main", itemStack) then
 | 
			
		||||
									local pos1 = pos
 | 
			
		||||
									pos1.y = pos1.y-player_half_height+0.5
 | 
			
		||||
									local vec = {x=dX, y=pos1.y-pos2.y, z=dZ}
 | 
			
		||||
@@ -90,6 +91,7 @@ minetest.register_globalstep(function(dtime)
 | 
			
		||||
				end
 | 
			
		||||
			end
 | 
			
		||||
		end
 | 
			
		||||
	end
 | 
			
		||||
end)
 | 
			
		||||
 | 
			
		||||
function minetest.handle_node_drops(pos, drops, digger)
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user