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

Method GetMob

internal/scripting/room_func.go:111–129  ·  view source on GitHub ↗

Get the first mob of the MobId type provided.

(mobId int, createIfMissing ...bool)

Source from the content-addressed store, hash-verified

109
110// Get the first mob of the MobId type provided.
111func (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
131func (r ScriptRoom) GetPlayers() []*ScriptActor {
132 actorList := []*ScriptActor{}

Callers 15

getTeacherFunction · 0.80
destroyTeacherFunction · 0.80
getTeacherFunction · 0.80
destroyTeacherFunction · 0.80
getTeacherFunction · 0.80
destroyTeacherFunction · 0.80
getDummyFunction · 0.80
destroyDummyFunction · 0.80
getTeacherFunction · 0.80
destroyTeacherFunction · 0.80
onDieFunction · 0.80
getTeacherFunction · 0.80

Calls 4

SpawnMobMethod · 0.95
GetActorFunction · 0.85
MobTypeIdMethod · 0.80
GetMobsMethod · 0.45

Tested by

no test coverage detected