on_player_removed_equipment returns a value for the equipment being removed, bit it IS the value:
In control.lua:
local function remove_used_battery_equipment(e)
local player = game.players[e.player_index]
-- local eqp = e.equipment -- Always return nil, so not useful
-- local count = e.count
-- if eqp.name:match("^primary%-battery%-equipment") then
player.remove_item{name = "primary-battery-equipment-used", count = 100}
-- end
end
you note here that e.equipment returns nil. The equipment name is actually just the value of e in this function
an easy fix (so you can give us back either the dry battery or the acid battery used) would be something like:
local function remove_used_battery_equipment(e)
local player = game.players[e.player_index]
local eqp = e
local count = e.count
if eqp:match("^primary%-battery%-equipment") then
player.remove_item{name = "primary-battery-equipment-used", count = 100}
-- end
end
Just something I wanted to help with as a big fan of your mods :)