forked from mtcontrib/boost_cart
		
	Compare commits
	
		
			2 Commits
		
	
	
		
			30e5558096
			...
			f0ce2517e5
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| f0ce2517e5 | |||
| 
						 | 
					3bd7d6f8ca | 
@@ -127,8 +127,13 @@ function cart_entity:on_punch(puncher, time_from_last_punch, tool_capabilities,
 | 
			
		||||
			boost_cart:manage_attachment(player, nil)
 | 
			
		||||
		end
 | 
			
		||||
		for _, obj_ in pairs(self.attached_items) do
 | 
			
		||||
			if obj_ then
 | 
			
		||||
			local ent = obj_ and obj_:get_luaentity()
 | 
			
		||||
			if ent then
 | 
			
		||||
				obj_:set_detach()
 | 
			
		||||
				-- Attention! Internal item API
 | 
			
		||||
				if ent.enable_physics then
 | 
			
		||||
					ent:enable_physics()
 | 
			
		||||
				end
 | 
			
		||||
			end
 | 
			
		||||
		end
 | 
			
		||||
 | 
			
		||||
@@ -348,8 +353,8 @@ function cart_entity:on_step(dtime)
 | 
			
		||||
		-- Collect dropped items
 | 
			
		||||
		for _, obj_ in pairs(minetest.get_objects_inside_radius(pos, 1)) do
 | 
			
		||||
			local ent = obj_:get_luaentity()
 | 
			
		||||
			-- Careful here: physical_state and disable_physics are item-internal APIs
 | 
			
		||||
			if ent and ent.name == "__builtin:item" and ent.physical_state then
 | 
			
		||||
			-- Attention! Physics must be disabled prior to attach
 | 
			
		||||
			if ent and ent.name == "__builtin:item" and not obj_:get_attach() then
 | 
			
		||||
				-- Check API to support 5.2.0 and older
 | 
			
		||||
				if ent.disable_physics then
 | 
			
		||||
					ent:disable_physics()
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user