Optionally can provide a MobId to look for
(mobId ...int)
| 88 | |
| 89 | // Optionally can provide a MobId to look for |
| 90 | func (r ScriptRoom) GetMobs(mobId ...int) []*ScriptActor { |
| 91 | actorList := []*ScriptActor{} |
| 92 | |
| 93 | targetMobId := 0 |
| 94 | if len(mobId) > 0 { |
| 95 | targetMobId = mobId[0] |
| 96 | } |
| 97 | |
| 98 | for _, mobInstanceId := range r.roomRecord.GetMobs() { |
| 99 | a := GetActor(0, mobInstanceId) |
| 100 | if a == nil { |
| 101 | continue |
| 102 | } |
| 103 | if targetMobId == 0 || a.MobTypeId() == targetMobId { |
| 104 | actorList = append(actorList, a) |
| 105 | } |
| 106 | } |
| 107 | return actorList |
| 108 | } |
| 109 | |
| 110 | // Get the first mob of the MobId type provided. |
| 111 | func (r ScriptRoom) GetMob(mobId int, createIfMissing ...bool) *ScriptActor { |
no test coverage detected