(id string)
| 52 | } |
| 53 | |
| 54 | func (p *Entity) Attribute(id string) *Attribute { |
| 55 | p.attr_mu.Lock() |
| 56 | defer p.attr_mu.Unlock() |
| 57 | i := slices.IndexFunc(p.attributes, func(att Attribute) bool { return att.Id == id }) |
| 58 | if i == -1 { |
| 59 | attr, ok := DefaultAttributes[id] |
| 60 | if !ok { |
| 61 | return nil |
| 62 | } |
| 63 | a := Attribute{ |
| 64 | Id: id, |
| 65 | Base: attr, |
| 66 | } |
| 67 | p.attributes = append(p.attributes, a) |
| 68 | return &a |
| 69 | } |
| 70 | attr := &p.attributes[i] |
| 71 | return attr |
| 72 | } |
| 73 | |
| 74 | // Attributes returns a clone of the attributes of this state |
| 75 | func (p *Entity) Attributes() []Attribute { |
nothing calls this directly
no outgoing calls
no test coverage detected