public void SpawnActorForPlayer(int inPlayerId, byte worldId) { SActor actor = (SActor)GameObjectRegistry.sInstance.CreateGameObject((uint32_t)GameObjectClassId.kActor, worldId); actor.SetColor(GameMode.sInstance.GetEntry((uint32_t)inPlayerId).GetColor()); actor.SetPlayerId((uint32_t)inPlayerId); actor.Possess(inPlayerId); actor.SetWorldId(worldId); //gotta pick a better spawn location than this... actor.SetLocation(core.Utility.GetRandomVector(-10, 10, 0)); Log.Information(string.Format("SpawnActorForPlayer player_id{0}, world{1}", inPlayerId, worldId)); }
public SActor SpawnActor(int inPlayerId, byte worldId, int team, int spawn_index) { SActor actor = (SActor)GameObjectRegistry.sInstance.CreateGameObject((UInt32)GameObjectClassId.Actor, true, worldId); var entry = World.Instance(worldId).GameMode.AddEntry(inPlayerId, this.mSessionId.ToString(), (ushort)team, spawn_index, actor.GetNetworkId()); actor.SpawnPoint = World.spawn_position[entry.seat].mapPos; actor.SpawnAngle = new Vector2(World.spawn_position[entry.seat].startVector.x, World.spawn_position[entry.seat].startVector.z).Angle(); actor.degree = actor.SpawnAngle; actor.SetWorldId(worldId); actor.SetLocation(actor.SpawnPoint); actor.SetPhysics(); actor.Team = entry.GetTeam(); actor.SetPlayerId(inPlayerId); //gotta pick a better spawn location than this... //actor.SetLocation(core.Utility.GetRandomVector(-10, 10, 0)); actor.SetCharacter(mSelectedCharacter, mCharacterLevel, UserId); Log.Information($"SpawnActor player_id{inPlayerId}, UserID:{actor.UserId}, network_id{actor.NetworkId}, world{worldId}, idx{entry.seat}, pos{actor.GetLocation()}, angle{actor.degree}, direction({World.spawn_position[entry.seat].startVector.x},{World.spawn_position[entry.seat].startVector.z})"); return(actor); }