Skip to content

Commit

Permalink
Add cleararea and spaces
Browse files Browse the repository at this point in the history
Monsters could interfere with interacting with a chest/rack/stand. Added cleararea before object ineraction. Added some spaces to code.
  • Loading branch information
braccali1 authored Feb 7, 2025
1 parent 6105e32 commit 80a3215
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions internal/run/mephisto.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,15 +100,21 @@ func (m Mephisto) Run() error {

// Interact with the closest object
closestObject := crs[0]

// Move to the chest/rack
err = action.MoveToCoords(closestObject.Position)
if err != nil {
return err
}
// Clear around chest for clean interaction
action.ClearAreaAroundPlayer(7, m.ctx.Data.MonsterFilterAnyReachable())

// Interact with chest/rack/stand
err = action.InteractObject(closestObject, func() bool {
object, _ := m.ctx.Data.Objects.FindByID(closestObject.ID)
return !object.Selectable
})

if err != nil {
m.ctx.Logger.Warn(fmt.Sprintf("[%s] failed interacting with object [%v] in Area: [%s]", m.ctx.Name, closestObject.Name, m.ctx.Data.PlayerUnit.Area.Area().Name), err)
}
Expand Down

0 comments on commit 80a3215

Please sign in to comment.