aboutsummaryrefslogtreecommitdiff
path: root/internal/game/act_use_interaction.go
blob: 9c64b5694927712514108702e86c0b5113f29556 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
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
	}
	g.writePlayerMessage(sess, d.Message, p.Name, nil)
	g.applyStepAction(sess, p, d.Action, p.RoomID, scopePlayer, nil)
	g.broadcastAction(sess, "%s uses the %s.", p.Name, d.ObjName)
	g.cancelAction(p)
}