Debug utility function and comments
This commit is contained in:
parent
57348f7ebf
commit
d13e04e2f4
@ -464,8 +464,18 @@ func (p *Player[C]) CanAct() bool {
|
|||||||
return p.ActionsRemaining > 0 && (len(p.Hand) > 0 || len(p.PermanentActions) > 0)
|
return p.ActionsRemaining > 0 && (len(p.Hand) > 0 || len(p.PermanentActions) > 0)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Debug adds a message to the player's temporary messages if their debug level
|
||||||
|
// is at least the level specified.
|
||||||
func (p *Player[C]) Debug(minLevel int, msg Message) {
|
func (p *Player[C]) Debug(minLevel int, msg Message) {
|
||||||
if p.DebugLevel < minLevel {
|
if p.DebugLevel < minLevel || msg == nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
p.TemporaryMessages = append(p.TemporaryMessages, msg)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Emit adds a message to the player's temporary messages.
|
||||||
|
func (p *Player[C]) Emit(msg Message) {
|
||||||
|
if msg == nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
p.TemporaryMessages = append(p.TemporaryMessages, msg)
|
p.TemporaryMessages = append(p.TemporaryMessages, msg)
|
||||||
|
Loading…
Reference in New Issue
Block a user