--- Creates callbacks and sets up initial state.

function ScopeHUD:init(props)
    self.Maid = Maid.new()
    self.LayoutRef = Roact.createRef()
    self.ContainerSize, self.UpdateContainerSize = Roact.createBinding(UDim2.new(0, 0, 0, 38/2))

    --- Processes input, listens for hover start
    function self.OnInputBegin(rbx, Input, WasProcessed)
        if WasProcessed then
            return
        end

        -- Set hovering state
        if (Input.UserInputType.Name == 'MouseMovement') or
           (Input.UserInputType.Name == 'Touch') then
            self:setState({
                IsHovering = true
            })
        end
    end

    --- Processes input, listens for hover end
    function self.OnInputEnd(rbx, Input, WasProcessed)
        if (Input.UserInputType.Name == 'MouseMovement') or
           (Input.UserInputType.Name == 'Touch') then
            self:setState({
                IsHovering = false
            })
        end
    end

    --- Processes requests from buttons to set scope
    function self.SetScopeFromButton(NewScope)
        self.props.Core.Targeting:SetScope(NewScope)
    end

    -- Set initial state
    self:UpdateTargetingState()
    self:setState({
        IsHovering = false;
        IsToolModeEnabled = (self.props.Core.Mode == 'Tool')
    })
end
