What are the new ways of getting request_slot_count?

Place to get help with not working mods / modding interface.
Post Reply
sensenmann
Burner Inserter
Burner Inserter
Posts: 10
Joined: Tue Feb 28, 2017 5:04 pm
Contact:

What are the new ways of getting request_slot_count?

Post by sensenmann »

Removed LuaEntity::clear_request_slot(), get_request_slot() and set_request_slot() methods.
Removed LuaEntity::request_slot_count read.
What are the new ways of getting request_slot_count?

How do i migrate get_request_slot and set_request_slot in my mod to 2.0?

My code is

Code: Select all

			
for i = 1, entity.request_slot_count do
	local slot = entity.get_request_slot(i)
	if slot ~= nil and slot.name == "alien-hyper-module-" .. storage.currentmodulelevel[forceName] - 1 then
		entity.set_request_slot({ name = "alien-hyper-module-" .. storage.currentmodulelevel[forceName], count = slot.count }, i)
	end

	if settings.startup["alien-module-hyper-ammo-enabled"].value and slot ~= nil and slot.name == "alien-hyper-magazine-" .. storage.currentmodulelevel[forceName] - 1 then
		entity.set_request_slot({ name = "alien-hyper-magazine-" .. storage.currentmodulelevel[forceName], count = slot.count }, i)
	end
end

Koub
Global Moderator
Global Moderator
Posts: 7527
Joined: Fri May 30, 2014 8:54 am
Contact:

Re: What are the new ways of getting request_slot_count?

Post by Koub »

[Koub] Split from the release thread, and made it into its own thread in the modding help subforum
Koub - Please consider English is not my native language.

firebladed3
Manual Inserter
Manual Inserter
Posts: 4
Joined: Fri Jun 30, 2017 5:22 pm
Contact:

Re: What are the new ways of getting request_slot_count?

Post by firebladed3 »

This appears to require iterating through the LuaLogisticPoint.sections you can get from LuaControl.get_requester_point()

Post Reply

Return to “Modding help”