2020-07-30 15:04:05 -04:00
|
|
|
package d2mapentity
|
|
|
|
|
|
|
|
import (
|
|
|
|
"github.com/OpenDiablo2/OpenDiablo2/d2common/d2math/d2vector"
|
|
|
|
"github.com/OpenDiablo2/OpenDiablo2/d2core/d2item/diablo2item"
|
|
|
|
)
|
|
|
|
|
|
|
|
const (
|
|
|
|
errInvalidItemCodes = "invalid item codes supplied"
|
|
|
|
)
|
|
|
|
|
2020-07-31 17:55:11 -04:00
|
|
|
// Item is a map entity for an item
|
2020-07-30 15:04:05 -04:00
|
|
|
type Item struct {
|
|
|
|
*AnimatedEntity
|
|
|
|
Item *diablo2item.Item
|
|
|
|
}
|
|
|
|
|
2020-07-31 17:55:11 -04:00
|
|
|
// GetPosition returns the item position vector
|
2020-07-30 15:04:05 -04:00
|
|
|
func (i *Item) GetPosition() d2vector.Position {
|
|
|
|
return i.AnimatedEntity.Position
|
|
|
|
}
|
|
|
|
|
2020-07-31 17:55:11 -04:00
|
|
|
// GetVelocity returns the item velocity vector
|
2020-07-30 15:04:05 -04:00
|
|
|
func (i *Item) GetVelocity() d2vector.Vector {
|
|
|
|
return i.AnimatedEntity.velocity
|
|
|
|
}
|
|
|
|
|
2020-07-31 17:55:11 -04:00
|
|
|
// Selectable always returns true for items
|
|
|
|
func (i *Item) Selectable() bool {
|
|
|
|
return true
|
|
|
|
}
|
2020-07-30 15:04:05 -04:00
|
|
|
|
2020-07-31 17:55:11 -04:00
|
|
|
// Highlight sets the highlight flag for a single render tick
|
|
|
|
func (i *Item) Highlight() {
|
|
|
|
i.AnimatedEntity.highlight = true
|
|
|
|
}
|
2020-07-30 15:04:05 -04:00
|
|
|
|
2020-07-31 17:55:11 -04:00
|
|
|
// Name returns the item name
|
|
|
|
func (i *Item) Name() string {
|
|
|
|
return i.Item.Name()
|
2020-07-30 15:04:05 -04:00
|
|
|
}
|