aboutsummaryrefslogtreecommitdiff
path: root/internal/game/act_use_interaction.go
blob: b96aaa33f1f5d7f530290a1d396265f4ae320918 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
package game

import (
	"thehouseoficarus/internal/behavior"
	"thehouseoficarus/internal/net"
	"thehouseoficarus/internal/player"
)

func (g *Game) advanceUseInteraction(sess *net.Session, p *player.Player) {
	d, ok := p.Action.Data.(*behavior.UseInteractionData)
	if !ok {
		g.cancelAction(p)
		return
	}
	if d.Message != "" {
		sess.WriteLine(d.Message)
	}
	if d.Action != nil {
		g.applyNodeAction(sess, d.Action)
	}
	g.broadcastAction(sess, "%s uses the %s.", p.Name, d.ObjName)
	g.cancelAction(p)
}