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

Function GetPet

internal/scripting/pet_func.go:184–193  ·  view source on GitHub ↗

GetPet returns a ScriptPet wrapping the given pet pointer. Returns nil if pet is nil or does not exist. Pass the owner's userId as the optional second argument to enable script-triggered events such as GoMissing.

(pet *pets.Pet, userId ...int)

Source from the content-addressed store, hash-verified

182// Pass the owner's userId as the optional second argument to enable
183// script-triggered events such as GoMissing.
184func GetPet(pet *pets.Pet, userId ...int) *ScriptPet {
185 if pet == nil || !pet.Exists() {
186 return nil
187 }
188 sp := &ScriptPet{petRecord: pet}
189 if len(userId) > 0 {
190 sp.userId = userId[0]
191 }
192 return sp
193}
194
195// ////////////////////////////////////////////////////////
196//

Callers 3

GetPetMethod · 0.85
TryPetScriptEventFunction · 0.85
TryPetCommandFunction · 0.85

Calls 1

ExistsMethod · 0.45

Tested by

no test coverage detected