[2.0] Replacement for request_slot_count, set/get_request_slot

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

[2.0] Replacement for request_slot_count, set/get_request_slot

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
Post Reply

Return to “Modding help”