--[[
	If a Repair Kit touches the system, increase the health - if it's a monster, decrease its health.
]]

local function onTouched(self, otherPart)
	if otherPart.Anchored then
		return
	end

	if CollectionService:HasTag(otherPart, Constants.Tag.Tool.RepairKit) then
		if self._health ~= self._maxHealth then
			otherPart:Destroy()
			self:incrementHealth(DEFAULT_TOOLKIT_HEALING_AMOUNT)
		end
	elseif CollectionService:HasTag(otherPart, Constants.Tag.Monster) and not self._monsterDebounce then
		self._monsterDebounce = true

		self:incrementHealth(-MONSTER_DAMAGE)

		delay(
			MONSTER_DEBOUNCE_TIME,
			function()
				self._monsterDebounce = false
			end
		)
	end
end

local BaseSystem = ClassUtils.makeClass(script.Name)
