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

Function SetLinkDeadUser

internal/users/users.go:321–357  ·  view source on GitHub ↗
(userId int)

Source from the content-addressed store, hash-verified

319}
320
321func SetLinkDeadUser(userId int) {
322 userManagerMu.Lock()
323 u, ok := userManager.Users[userId]
324 userManagerMu.Unlock()
325
326 if !ok {
327 return
328 }
329
330 u.Character.RemoveBuff(0)
331 u.Character.SetAdjective(`zombie`, true)
332
333 // Special case for `newbieguide` module exported function check
334 // If module was loaded, this function should exist.
335 if fn, ok := GetExportedFunction(`PlayerGuideMobId`); ok {
336 guideMobId := 0
337 if guideMobIdFn, ok := fn.(func() int); ok {
338 guideMobId = guideMobIdFn()
339 }
340
341 // Prevent guide mob dupes
342 for _, miid := range u.Character.CharmedMobs {
343 if m := mobs.GetInstance(miid); m != nil {
344 if m.MobId == mobs.MobId(guideMobId) && m.Character.Charmed != nil {
345 m.Character.Charmed.RoundsRemaining = 0
346 }
347 }
348 }
349 }
350
351 userManagerMu.Lock()
352 if _, ok := userManager.LinkDeadConnections[u.connectionId]; !ok {
353 u.isLinkDead = true
354 userManager.LinkDeadConnections[u.connectionId] = util.GetTurnCount()
355 }
356 userManagerMu.Unlock()
357}
358
359func SaveAllUsers(isAutoSave ...bool) {
360 userManagerMu.RLock()

Callers 3

MainWorkerMethod · 0.92
KickMethod · 0.92
FinalizeLoginOrCreateFunction · 0.92

Calls 8

GetInstanceFunction · 0.92
MobIdTypeAlias · 0.92
GetTurnCountFunction · 0.92
LockMethod · 0.80
UnlockMethod · 0.80
GetExportedFunctionFunction · 0.70
RemoveBuffMethod · 0.45
SetAdjectiveMethod · 0.45

Tested by

no test coverage detected