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

Function GetActor

internal/scripting/actor_func.go:870–891  ·  view source on GitHub ↗

# These functions get exported to the scripting engine

(userId int, mobInstanceId int)

Source from the content-addressed store, hash-verified

868//
869// ////////////////////////////////////////////////////////
870func GetActor(userId int, mobInstanceId int) *ScriptActor {
871
872 if userId > 0 {
873 if user := users.GetByUserId(userId); user != nil {
874 return &ScriptActor{
875 userId: userId,
876 userRecord: user,
877 characterRecord: user.Character,
878 }
879 }
880 } else if mobInstanceId > 0 {
881 if mob := mobs.GetInstance(mobInstanceId); mob != nil {
882 return &ScriptActor{
883 mobInstanceId: mobInstanceId,
884 mobRecord: mob,
885 characterRecord: &mob.Character,
886 }
887 }
888 }
889
890 return nil
891}
892
893func GetUser(userId int) *ScriptActor {
894 return GetActor(userId, 0)

Callers 15

TrySpellScriptEventFunction · 0.85
TryRoomScriptEventFunction · 0.85
TryRoomTryEnterEventFunction · 0.85
TryRoomTryExitEventFunction · 0.85
TryItemScriptEventFunction · 0.85
TryItemCommandFunction · 0.85
TryItemTryPurchaseEventFunction · 0.85
TryBuffScriptEventFunction · 0.85
TryBuffCommandFunction · 0.85
GetMobsMethod · 0.85
GetMobMethod · 0.85

Calls 2

GetByUserIdFunction · 0.92
GetInstanceFunction · 0.92

Tested by

no test coverage detected