예제 #1
0
        /// <summary>
        /// Updates the CPE model of an entity.
        /// </summary>
        /// <param name="id"></param>
        /// <param name="model"></param>
        void EModelChange(byte id, string model)
        {
            int extVer;

            if (!CS.CPEExtensions.TryGetValue("ChangeModel", out extVer))
                return;

            var modelPack = new ChangeModel {
                EntityId = id,
                ModelName = model,
            };

            SendQueue.Enqueue(modelPack);
        }
예제 #2
0
        /// <summary>
        /// Spawns a new entity on the client.
        /// </summary>
        /// <param name="name"></param>
        /// <param name="entity"></param>
        void ESpawn(string name, EntityStub entity)
        {
            int extVer;

            if (CS.CPEExtensions.TryGetValue("ExtPlayerList", out extVer) && extVer == 2) {
                CPESpawn(name, entity);
                return;
            }

            var spawn = new SpawnPlayer
            {
                PlayerName = name,
                X = entity.Location.X,
                Y = entity.Location.Y,
                Z = entity.Location.Z,
                Yaw = entity.Rot,
                Pitch = entity.Look
            };

            if (entity.Id == CS.MyEntity.Id)
                spawn.PlayerId = -1;
            else
                spawn.PlayerId = (sbyte)entity.ClientId;

            SendQueue.Enqueue(spawn);

            if (!CS.CPEExtensions.TryGetValue("ChangeModel", out extVer) || entity.Model == "default")
                return;

            var modelPack = new ChangeModel {
                EntityId = entity.ClientId,
                ModelName = entity.Model,
            };

            SendQueue.Enqueue(modelPack);
        }
예제 #3
0
        /// <summary>
        /// Sends a ExtAddEntity2 packet instead of a SpawnPlayer packet, for clients supporting ExtPlayerList v2.
        /// </summary>
        /// <param name="name"></param>
        /// <param name="entity"></param>
        void CPESpawn(string name, EntityStub entity)
        {
            var spawn2 = new ExtAddEntity2 {
                EntityId = entity.ClientId,
                InGameName = name,
                SkinName = name,
                Spawn = entity.Location,
                SpawnPitch = entity.Look,
                SpawnYaw = entity.Rot,
            };

            if (entity.Id == CS.MyEntity.Id)
                spawn2.EntityId = 255;

            SendQueue.Enqueue(spawn2);

            int extVer;

            if (!CS.CPEExtensions.TryGetValue("ChangeModel", out extVer) || entity.Model == "default")
                return;

            var modelPack = new ChangeModel {
                EntityId = entity.ClientId,
                ModelName = entity.Model,
            };

            SendQueue.Enqueue(modelPack);
        }