示例#1
0
func (b *Basic) Init(d recordjar.Decoder, refs map[string]recordjar.Unmarshaler) {
	b.Thing.Init(d, refs)

	// Link directional exits to locations via direction/location reference pairs
	// e.g. Exits: E→L2 S→L3 NW→L4
	for _, pair := range d.PairList("exits") {

		dir, loc := pair[0], pair[1]

		if l, ok := refs[loc].(Interface); ok {
			if dirIndex, ok := directionShortIndex[dir]; ok {
				b.LinkExit(dirIndex, l)
			}
		}
	}

}