mapserver/mapobject/phonograph.go
1F616EMO~nya 2c0edb328f
Support Phonographs (#376)
* Support Phonographs

* Fix comment

* Add missing import

* Fix variable name
2024-06-06 19:23:23 +02:00

25 lines
536 B
Go

package mapobject
import (
"mapserver/mapobjectdb"
"mapserver/types"
"github.com/minetest-go/mapparser"
)
type Phonograph struct{}
func (this *Phonograph) onMapObject(mbpos *types.MapBlockCoords, x, y, z int, block *mapparser.MapBlock) *mapobjectdb.MapObject {
md := block.Metadata.GetMetadata(x, y, z)
if _, ok := md["song_title"]; !ok {
return nil
}
o := mapobjectdb.NewMapObject(mbpos, x, y, z, "phonograph")
o.Attributes["song_title"] = md["song_title"]
o.Attributes["song_artist"] = md["song_artist"]
return o
}