Page 1 of 1

[2.0] Replacement for request_slot_count, set/get_request_slot

Posted: Tue Oct 22, 2024 7:22 am
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