MCPcopy Create free account
hub / github.com/GoMudEngine/GoMud / GetMobs

Method GetMobs

internal/scripting/room_func.go:90–108  ·  view source on GitHub ↗

Optionally can provide a MobId to look for

(mobId ...int)

Source from the content-addressed store, hash-verified

88
89// Optionally can provide a MobId to look for
90func (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.
111func (r ScriptRoom) GetMob(mobId int, createIfMissing ...bool) *ScriptActor {

Callers 4

TryRoomCommandFunction · 0.45
GetMobMethod · 0.45
GetAllActorsMethod · 0.45
GetAutoCompleteFunction · 0.45

Calls 2

GetActorFunction · 0.85
MobTypeIdMethod · 0.80

Tested by

no test coverage detected