--Override this function to include equipment amount on interaction
--Usage: See interactiontweakdata: *.special_equipment = *

--BEWARE: Will crash with other equipment-based interactions... Somehow
---^UPDATE: Shouldn't crash no more but haven't investigated thouroughly... Use with caution!

function PlayerManager:has_special_equipment(equipment)
	
	local _name = equipment.name or equipment or ""
	local _amount = equipment.amount or 0
	
	local _eqp = self._equipment.specials[_name]
	local _quantity = (_eqp and _eqp.amount and Application:digest_value(_eqp.amount, false)) or 1
	
	if(_eqp and (_quantity >= _amount)) then
		return _eqp
	else
		return nil
	end
end


PlayerManager.q011_parcigov = PlayerManager.remove_special

function PlayerManager:remove_special(equipment)
	
	local _name = equipment.name or equipment or ""
	local _amount = equipment.amount or 1
	local special_equipment = self._equipment.specials[_name]
	
	if special_equipment and _amount > 1 then
		local special_amount = special_equipment.amount and Application:digest_value(special_equipment.amount, false)
		
		if special_amount and special_amount ~= -1 then
			special_amount = math.max(0, special_amount - (_amount - 1))
		end
		
		special_equipment.amount = Application:digest_value(special_amount, true)
	end
	
	self:q011_parcigov(_name)
end