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

Method userBuryCommand

modules/cleanup/cleanup.go:147–177  ·  view source on GitHub ↗
(rest string, user *users.UserRecord, room *rooms.Room, flags events.EventFlag)

Source from the content-addressed store, hash-verified

145}
146
147func (c *CleanupModule) userBuryCommand(rest string, user *users.UserRecord, room *rooms.Room, flags events.EventFlag) (bool, error) {
148
149 args := util.SplitButRespectQuotes(strings.ToLower(rest))
150
151 if len(args) == 0 {
152 user.SendText("Bury what?")
153 return true, nil
154 }
155
156 if corpse, corpseFound := room.FindCorpse(rest); corpseFound {
157
158 if room.RemoveCorpse(corpse) {
159
160 corpseColor := `mob-corpse`
161 if corpse.UserId > 0 {
162 corpseColor = `user-corpse`
163 }
164
165 user.SendText(fmt.Sprintf(`You bury the <ansi fg="%s">%s corpse</ansi>.`, corpseColor, corpse.Character.Name))
166 room.SendText(fmt.Sprintf(`<ansi fg="username">%s</ansi> buries the <ansi fg="%s">%s corpse</ansi>.`, user.Character.Name, corpseColor, corpse.Character.Name), user.UserId)
167 return true, nil
168
169 }
170
171 return true, nil
172 }
173
174 user.SendText(fmt.Sprintf("You don't see a %s around for burying.", rest))
175
176 return true, nil
177}
178
179func (c *CleanupModule) mobBuryCommand(rest string, mob *mobs.Mob, room *rooms.Room) (bool, error) {
180

Callers

nothing calls this directly

Calls 4

SplitButRespectQuotesFunction · 0.92
FindCorpseMethod · 0.80
RemoveCorpseMethod · 0.80
SendTextMethod · 0.45

Tested by

no test coverage detected