1
1
mirror of https://github.com/OpenDiablo2/OpenDiablo2 synced 2024-11-14 00:06:45 -05:00
OpenDiablo2/d2core/d2map/d2mapentity/item.go
lord 1275a7f654
D2item hover highlight + name (#656)
* added highlight to animated entity

* moving provider functions for item, missile, npc, player into package export file d2mapentity.go

* changed `Create` to `New` in map entity provider functions

* add item highlight on hover

* add Name method to item entity
2020-07-31 17:55:11 -04:00

42 lines
898 B
Go

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