pub fn click(
        this: URef<Character>,
        cursor: &Cursor,
        button: usize,
    ) -> Result<UniverseTransaction, ToolError> {
        let tb = this.borrow();
        let slot_index = tb
            .selected_slots
            .get(button)
            .copied()
            .unwrap_or(tb.selected_slots[0]);
        tb.inventory.use_tool(
            cursor,
            this,
            if cursor.space == tb.space {
                // Use inventory tools on world
                Some(slot_index)
            } else {
                // Assuming this is the UI space, just click on it
                // TODO: Bad design; we should perhaps not route these clicks through Character::click at all.
                None
            },
        )
    }
/// Use this character's selected tool on the given cursor.
///
/// TODO: Dubious API: shouldn't this only work with the character's space?
/// We want to refactor click handling in general, so keep an eye on that.
Use this character's selected tool on the given cursor.
TODO: Dubious API: shouldn't this only work with the character's space.
We want to refactor click handling in general, so keep an eye on that.
Use this character ' s selected tool on the given cursor . TODO : Dubious API : shouldn ' t this only work with the character ' s space . We want to refactor click handling in general so keep an eye on that .
pub fn click(
        this: URef<Character>,
        cursor: &Cursor,
        button: usize,
    ) -> Result<UniverseTransaction, ToolError> {
        let tb = this.borrow();
        let slot_index = tb
            .selected_slots
            .get(button)
            .copied()
            .unwrap_or(tb.selected_slots[0]);
        tb.inventory.use_tool(
            cursor,
            this,
            if cursor.space == tb.space {
                // Use inventory tools on world
                Some(slot_index)
            } else {
                // Assuming this is the UI space, just click on it
                // TODO: Bad design; we should perhaps not route these clicks through Character::click at all.
                None
            },
        )
    }
pub fn click ( this : URef < Character > , cursor : & Cursor , button : usize , ) -> Result < UniverseTransaction , ToolError > { let tb = this . borrow ( ) ; let slot_index = tb . selected_slots . get ( button ) . copied ( ) . unwrap_or ( tb . selected_slots [ 0 ] ) ; tb . inventory . use_tool ( cursor , this , if cursor . space == tb . space { // Use inventory tools on world Some ( slot_index ) } else { // Assuming this is the UI space, just click on it // TODO: Bad design; we should perhaps not route these clicks through Character::click at all. None } , ) }
Use this character's selected tool on the given cursor.
Use this character ' s selected tool on the given cursor .
this
URef<Character>
cursor
&Cursor
button
usize