send all player's items to clients
This commit is contained in:
parent
8aff29e0b8
commit
85824ef22f
@ -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
|
||||||
}
|
}
|
||||||
|
@ -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"`
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user