Get the first mob of the MobId type provided.
(mobId int, createIfMissing ...bool)
| 109 | |
| 110 | // Get the first mob of the MobId type provided. |
| 111 | func (r ScriptRoom) GetMob(mobId int, createIfMissing ...bool) *ScriptActor { |
| 112 | |
| 113 | for _, mobInstanceId := range r.roomRecord.GetMobs() { |
| 114 | a := GetActor(0, mobInstanceId) |
| 115 | if a == nil { |
| 116 | continue |
| 117 | } |
| 118 | |
| 119 | if a.MobTypeId() == mobId { |
| 120 | return a |
| 121 | } |
| 122 | } |
| 123 | |
| 124 | if len(createIfMissing) > 0 && createIfMissing[0] { |
| 125 | return r.SpawnMob(mobId) |
| 126 | } |
| 127 | |
| 128 | return nil |
| 129 | } |
| 130 | |
| 131 | func (r ScriptRoom) GetPlayers() []*ScriptActor { |
| 132 | actorList := []*ScriptActor{} |
no test coverage detected