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

Method GoMissing

internal/scripting/pet_func.go:135–157  ·  view source on GitHub ↗

GoMissing causes the pet to go absent for the given number of rounds. Pass 0 to return the pet immediately, firing PetReturn instead of PetLeave. Any positive value fires PetLeave and begins the countdown.

(rounds int)

Source from the content-addressed store, hash-verified

133// Pass 0 to return the pet immediately, firing PetReturn instead of PetLeave.
134// Any positive value fires PetLeave and begins the countdown.
135func (p ScriptPet) GoMissing(rounds int) {
136 if p.petRecord == nil {
137 return
138 }
139 if rounds <= 0 {
140 if !p.petRecord.IsMissing() {
141 return
142 }
143 p.petRecord.GoMissing(0)
144 if p.userId > 0 {
145 TryPetScriptEvent(`PetReturn`, p.userId)
146 }
147 return
148 }
149 if !p.petRecord.IsMissing() {
150 p.petRecord.GoMissing(rounds)
151 if p.userId > 0 {
152 TryPetScriptEvent(`PetLeave`, p.userId)
153 }
154 } else {
155 p.petRecord.GoMissing(rounds)
156 }
157}
158
159// HasScript returns true if this pet type has a script file on disk.
160func (p ScriptPet) HasScript() bool {

Callers

nothing calls this directly

Calls 2

TryPetScriptEventFunction · 0.85
IsMissingMethod · 0.45

Tested by

no test coverage detected