function init()
	isOutsideTrigger = true
	trigger = FindTrigger("refillzone")
	refillSound = LoadSound("tool_pickup.ogg")
end

function tick(dt)
	if IsPointInTrigger(trigger, GetPlayerPos()) then 
		if isOutsideTrigger then
			Refill() 
			isOutsideTrigger = false
		end
	else
		isOutsideTrigger = true
	end
end

function Refill()
	for _, toolId in pairs(ListKeys("game.tool")) do
		if GetBool("game.tool." .. toolId .. ".enabled") then
			SetInt("game.tool." .. toolId .. ".ammo", GetInt("game.tool." .. toolId .. ".ammo.max"))
			if toolId == "powder" then
				SetString("game.tool.powder.ammo.display", string.format("%.1f", GetFloat("game.tool.powder.ammo")))
			end
		end
	end
	PlaySound(refillSound)
	SetString("hud.notification", GetTranslatedStringByKey("UI_HUD_NOTE_AMMO_REFILL"))
end