Example #1
0
 public static void WriteRemoveGuidable(GameClient client, GuidedVob vob)
 {
     guideWriter.Write((byte)ServerMessages.GuideRemoveMessage);
     guideWriter.Write((ushort)vob.ID);
     client.Send(guideWriter, NetPriority.Low, NetReliability.ReliableOrdered, 'W');
     guideWriter.Reset();
 }
Example #2
0
        public override void Start(GuidedVob vob)
        {
            if (!Commands.TryGetValue(targetID, out List <TargetCmd> cmdList))
            {
                cmdList = new List <TargetCmd>();
                Commands.Add(targetID, cmdList);
            }
            cmdList.Add(this);

            World.Current.TryGetVob(targetID, out target);
        }
Example #3
0
        public override void Stop(GuidedVob vob)
        {
            if (Commands.TryGetValue(targetID, out List <TargetCmd> cmdList))
            {
                cmdList.Remove(this);
                if (cmdList.Count == 0)
                {
                    Commands.Remove(targetID);
                }
            }

            this.target = null;
        }
Example #4
0
            public static void WriteGuidableCmd(GameClient client, GuidedVob vob, GuideCmd cmd)
            {
                if (cmd == null)
                {
                    guideWriter.Write((byte)ServerMessages.GuideRemoveCmdMessage);
                }
                else
                {
                    guideWriter.Write((byte)ServerMessages.GuideSetCmdMessage);
                    guideWriter.Write(cmd.CmdType);
                    cmd.WriteStream(guideWriter);
                }

                guideWriter.Write((ushort)vob.ID);
                client.Send(guideWriter, NetPriority.Low, NetReliability.ReliableOrdered, 'W');
                guideWriter.Reset();
            }
Example #5
0
            public static void WritePosDirMessage(GuidedVob vob, Vec3f pos, Angles ang, VobEnvironment env)
            {
                PacketWriter stream = GameClient.SetupStream(ClientMessages.GuidedVobMessage);

                stream.Write((ushort)vob.ID);
                stream.WriteCompressedPosition(pos);
                stream.WriteCompressedAngles(ang);

                // compress environment
                int bitfield = env.InAir ? 0x8000 : 0;

                bitfield |= (int)(env.WaterDepth * 0x7F) << 8;
                bitfield |= (int)(env.WaterLevel * 0xFF);
                stream.Write((short)bitfield);

                GameClient.Send(stream, NetPriority.Low, NetReliability.Unreliable);
            }
Example #6
0
 public abstract void Stop(GuidedVob vob);
Example #7
0
 public abstract void Update(GuidedVob vob, long now);
Example #8
0
 public abstract void Start(GuidedVob vob);