send all player's items to clients

This commit is contained in:
Branden J Brown 2024-01-21 12:56:12 -06:00
parent 8aff29e0b8
commit 85824ef22f
2 changed files with 3 additions and 8 deletions

View File

@ -33,15 +33,10 @@ func (p *Player) StartGroup(rng *RNG, items int) {
func (p *Player) DTO() serve.Player { func (p *Player) DTO() serve.Player {
r := serve.Player{ r := serve.Player{
HP: p.hp, HP: p.hp,
Items: make([]string, 0, 8),
Cuffs: p.cuffs != Uncuffed, Cuffs: p.cuffs != Uncuffed,
} }
for _, i := range p.items { for k, i := range p.items {
s := i.String() r.Items[k] = i.String()
if s == "" {
continue
}
r.Items = append(r.Items, s)
} }
return r return r
} }

View File

@ -24,7 +24,7 @@ type Player struct {
// HP is the player's current health. // HP is the player's current health.
HP int8 `json:"hp"` HP int8 `json:"hp"`
// Items is the player's items. // Items is the player's items.
Items []string `json:"items,omitempty"` Items [8]string `json:"items"`
// Cuffs is whether the player is currently wearing cuffs. // Cuffs is whether the player is currently wearing cuffs.
Cuffs bool `json:"cuffs,omitempty"` Cuffs bool `json:"cuffs,omitempty"`
} }