May I ask how to clean items held by a robotic arm

Place to get help with not working mods / modding interface.
sdgmlj
Fast Inserter
Fast Inserter
Posts: 172
Joined: Sun Jul 04, 2021 11:12 pm
Contact:

May I ask how to clean items held by a robotic arm

Post by sdgmlj »

I am currently writing a mod for entity cloning, but there will be some residue after the cloning is completed, such as the handheld items of the robotic arm being copied together. How can I clean it up? thank you
The robotic arm I'm referring to is the 'inserter'. I couldn't find any instructions for cleaning. Can you help me?
sdgmlj
Fast Inserter
Fast Inserter
Posts: 172
Joined: Sun Jul 04, 2021 11:12 pm
Contact:

Re: May I ask how to clean items held by a robotic arm

Post by sdgmlj »

Code: Select all

	if entity.type == "inserter" then
		local stack = entity.held_stack
		if stack.valid_for_read
		then stack.clear()
		end
	end
	if entity.has_items_inside()
	then entity.clear_items_inside()
	end
	if entity.get_fluid_count() > 0
	then entity.clear_fluid_inside()
	end
Why are there still a small amount of residual items?
sdgmlj
Fast Inserter
Fast Inserter
Posts: 172
Joined: Sun Jul 04, 2021 11:12 pm
Contact:

Re: May I ask how to clean items held by a robotic arm

Post by sdgmlj »

I understand the reason now. It's not a problem with the robotic arm, it's the machine that has ongoing work and is still working after cloning. So, how can we make the machine cancel the ongoing work?
sdgmlj
Fast Inserter
Fast Inserter
Posts: 172
Joined: Sun Jul 04, 2021 11:12 pm
Contact:

Re: May I ask how to clean items held by a robotic arm

Post by sdgmlj »

Natha wrote: Thu Feb 06, 2025 1:52 pm https://lua-api.factorio.com/latest/cla ... g_progress may be your friend
Thank you, friend. This works, but what about the stove?
Post Reply

Return to “Modding help”