public override void read(SteamChannel channel)
 {
     base.read(channel);
     this.analog   = (byte)channel.read(Types.BYTE_TYPE);
     this.position = (Vector3)channel.read(Types.VECTOR3_TYPE);
     this.yaw      = (float)channel.read(Types.SINGLE_TYPE);
     this.pitch    = (float)channel.read(Types.SINGLE_TYPE);
 }
Exemple #2
0
 public override void read(SteamChannel channel)
 {
     base.read(channel);
     this.position     = (Vector3)channel.read(Types.VECTOR3_TYPE);
     this.angle_x      = (byte)channel.read(Types.BYTE_TYPE);
     this.angle_y      = (byte)channel.read(Types.BYTE_TYPE);
     this.angle_z      = (byte)channel.read(Types.BYTE_TYPE);
     this.speed        = (byte)channel.read(Types.BYTE_TYPE);
     this.physicsSpeed = (byte)channel.read(Types.BYTE_TYPE);
     this.turn         = (byte)channel.read(Types.BYTE_TYPE);
 }
Exemple #3
0
        public virtual void read(SteamChannel channel)
        {
            this.sequence = (int)channel.read(Types.INT32_TYPE);
            this.recov    = (int)channel.read(Types.INT32_TYPE);
            this.keys     = (ushort)channel.read(Types.UINT16_TYPE);
            byte b = (byte)channel.read(Types.BYTE_TYPE);

            if (b > 0)
            {
                this.serversideInputs = new Queue <InputInfo>((int)b);
                for (byte b2 = 0; b2 < b; b2 += 1)
                {
                    InputInfo inputInfo = new InputInfo();
                    inputInfo.type = (ERaycastInfoType)((byte)channel.read(Types.BYTE_TYPE));
                    switch (inputInfo.type)
                    {
                    case ERaycastInfoType.NONE:
                        inputInfo.point    = (Vector3)channel.read(Types.VECTOR3_TYPE);
                        inputInfo.normal   = (Vector3)channel.read(Types.VECTOR3_TYPE);
                        inputInfo.material = (EPhysicsMaterial)((byte)channel.read(Types.BYTE_TYPE));
                        break;

                    case ERaycastInfoType.SKIP:
                        inputInfo = null;
                        break;

                    case ERaycastInfoType.OBJECT:
                    {
                        inputInfo.point     = (Vector3)channel.read(Types.VECTOR3_TYPE);
                        inputInfo.direction = (Vector3)channel.read(Types.VECTOR3_TYPE);
                        inputInfo.normal    = (Vector3)channel.read(Types.VECTOR3_TYPE);
                        inputInfo.material  = (EPhysicsMaterial)((byte)channel.read(Types.BYTE_TYPE));
                        inputInfo.section   = (byte)channel.read(Types.BYTE_TYPE);
                        byte        x       = (byte)channel.read(Types.BYTE_TYPE);
                        byte        y       = (byte)channel.read(Types.BYTE_TYPE);
                        ushort      index   = (ushort)channel.read(Types.UINT16_TYPE);
                        LevelObject @object = ObjectManager.getObject(x, y, index);
                        if (@object != null && @object.transform != null && (inputInfo.point - @object.transform.position).sqrMagnitude < 256f)
                        {
                            inputInfo.transform = @object.transform;
                        }
                        else
                        {
                            inputInfo.type = ERaycastInfoType.NONE;
                        }
                        break;
                    }

                    case ERaycastInfoType.PLAYER:
                    {
                        inputInfo.point     = (Vector3)channel.read(Types.VECTOR3_TYPE);
                        inputInfo.direction = (Vector3)channel.read(Types.VECTOR3_TYPE);
                        inputInfo.normal    = (Vector3)channel.read(Types.VECTOR3_TYPE);
                        inputInfo.limb      = (ELimb)((byte)channel.read(Types.BYTE_TYPE));
                        CSteamID steamID = (CSteamID)channel.read(Types.STEAM_ID_TYPE);
                        Player   player  = PlayerTool.getPlayer(steamID);
                        if (player != null && (inputInfo.point - player.transform.position).sqrMagnitude < 256f)
                        {
                            inputInfo.material  = EPhysicsMaterial.FLESH_DYNAMIC;
                            inputInfo.player    = player;
                            inputInfo.transform = player.transform;
                        }
                        else
                        {
                            inputInfo = null;
                        }
                        break;
                    }

                    case ERaycastInfoType.ZOMBIE:
                    {
                        inputInfo.point     = (Vector3)channel.read(Types.VECTOR3_TYPE);
                        inputInfo.direction = (Vector3)channel.read(Types.VECTOR3_TYPE);
                        inputInfo.normal    = (Vector3)channel.read(Types.VECTOR3_TYPE);
                        inputInfo.limb      = (ELimb)((byte)channel.read(Types.BYTE_TYPE));
                        ushort id     = (ushort)channel.read(Types.UINT16_TYPE);
                        Zombie zombie = ZombieManager.getZombie(inputInfo.point, id);
                        if (zombie != null && (inputInfo.point - zombie.transform.position).sqrMagnitude < 256f)
                        {
                            if (zombie.isRadioactive)
                            {
                                inputInfo.material = EPhysicsMaterial.ALIEN_DYNAMIC;
                            }
                            else
                            {
                                inputInfo.material = EPhysicsMaterial.FLESH_DYNAMIC;
                            }
                            inputInfo.zombie    = zombie;
                            inputInfo.transform = zombie.transform;
                        }
                        else
                        {
                            inputInfo = null;
                        }
                        break;
                    }

                    case ERaycastInfoType.ANIMAL:
                    {
                        inputInfo.point     = (Vector3)channel.read(Types.VECTOR3_TYPE);
                        inputInfo.direction = (Vector3)channel.read(Types.VECTOR3_TYPE);
                        inputInfo.normal    = (Vector3)channel.read(Types.VECTOR3_TYPE);
                        inputInfo.limb      = (ELimb)((byte)channel.read(Types.BYTE_TYPE));
                        ushort index2 = (ushort)channel.read(Types.UINT16_TYPE);
                        Animal animal = AnimalManager.getAnimal(index2);
                        if (animal != null && (inputInfo.point - animal.transform.position).sqrMagnitude < 256f)
                        {
                            inputInfo.material  = EPhysicsMaterial.FLESH_DYNAMIC;
                            inputInfo.animal    = animal;
                            inputInfo.transform = animal.transform;
                        }
                        else
                        {
                            inputInfo = null;
                        }
                        break;
                    }

                    case ERaycastInfoType.VEHICLE:
                    {
                        inputInfo.point    = (Vector3)channel.read(Types.VECTOR3_TYPE);
                        inputInfo.normal   = (Vector3)channel.read(Types.VECTOR3_TYPE);
                        inputInfo.material = (EPhysicsMaterial)((byte)channel.read(Types.BYTE_TYPE));
                        uint instanceID             = (uint)channel.read(Types.UINT32_TYPE);
                        InteractableVehicle vehicle = VehicleManager.getVehicle(instanceID);
                        if (vehicle != null && (vehicle == channel.owner.player.movement.getVehicle() || (inputInfo.point - vehicle.transform.position).sqrMagnitude < 4096f))
                        {
                            inputInfo.vehicle   = vehicle;
                            inputInfo.transform = vehicle.transform;
                        }
                        else
                        {
                            inputInfo = null;
                        }
                        break;
                    }

                    case ERaycastInfoType.BARRICADE:
                    {
                        inputInfo.point    = (Vector3)channel.read(Types.VECTOR3_TYPE);
                        inputInfo.normal   = (Vector3)channel.read(Types.VECTOR3_TYPE);
                        inputInfo.material = (EPhysicsMaterial)((byte)channel.read(Types.BYTE_TYPE));
                        byte            x2    = (byte)channel.read(Types.BYTE_TYPE);
                        byte            y2    = (byte)channel.read(Types.BYTE_TYPE);
                        ushort          plant = (ushort)channel.read(Types.UINT16_TYPE);
                        ushort          num   = (ushort)channel.read(Types.UINT16_TYPE);
                        BarricadeRegion barricadeRegion;
                        if (BarricadeManager.tryGetRegion(x2, y2, plant, out barricadeRegion) && (int)num < barricadeRegion.drops.Count)
                        {
                            Transform model = barricadeRegion.drops[(int)num].model;
                            if (model != null && (inputInfo.point - model.transform.position).sqrMagnitude < 256f)
                            {
                                inputInfo.transform = model;
                            }
                            else
                            {
                                inputInfo = null;
                            }
                        }
                        else
                        {
                            inputInfo = null;
                        }
                        break;
                    }

                    case ERaycastInfoType.STRUCTURE:
                    {
                        inputInfo.point     = (Vector3)channel.read(Types.VECTOR3_TYPE);
                        inputInfo.direction = (Vector3)channel.read(Types.VECTOR3_TYPE);
                        inputInfo.normal    = (Vector3)channel.read(Types.VECTOR3_TYPE);
                        inputInfo.material  = (EPhysicsMaterial)((byte)channel.read(Types.BYTE_TYPE));
                        byte            x3   = (byte)channel.read(Types.BYTE_TYPE);
                        byte            y3   = (byte)channel.read(Types.BYTE_TYPE);
                        ushort          num2 = (ushort)channel.read(Types.UINT16_TYPE);
                        StructureRegion structureRegion;
                        if (StructureManager.tryGetRegion(x3, y3, out structureRegion) && (int)num2 < structureRegion.drops.Count)
                        {
                            Transform model2 = structureRegion.drops[(int)num2].model;
                            if (model2 != null && (inputInfo.point - model2.transform.position).sqrMagnitude < 256f)
                            {
                                inputInfo.transform = model2;
                            }
                            else
                            {
                                inputInfo = null;
                            }
                        }
                        else
                        {
                            inputInfo = null;
                        }
                        break;
                    }

                    case ERaycastInfoType.RESOURCE:
                    {
                        inputInfo.point     = (Vector3)channel.read(Types.VECTOR3_TYPE);
                        inputInfo.direction = (Vector3)channel.read(Types.VECTOR3_TYPE);
                        inputInfo.normal    = (Vector3)channel.read(Types.VECTOR3_TYPE);
                        inputInfo.material  = (EPhysicsMaterial)((byte)channel.read(Types.BYTE_TYPE));
                        byte      x4       = (byte)channel.read(Types.BYTE_TYPE);
                        byte      y4       = (byte)channel.read(Types.BYTE_TYPE);
                        ushort    index3   = (ushort)channel.read(Types.UINT16_TYPE);
                        Transform resource = ResourceManager.getResource(x4, y4, index3);
                        if (resource != null && (inputInfo.point - resource.transform.position).sqrMagnitude < 256f)
                        {
                            inputInfo.transform = resource;
                        }
                        else
                        {
                            inputInfo = null;
                        }
                        break;
                    }
                    }
                    if (inputInfo != null)
                    {
                        this.serversideInputs.Enqueue(inputInfo);
                    }
                }
            }
        }