Example #1
0
        // Token: 0x0600339D RID: 13213 RVA: 0x0014ECF0 File Offset: 0x0014D0F0
        private void OnTriggerEnter(Collider other)
        {
            if (this.isExploded)
            {
                return;
            }
            if (other.isTrigger)
            {
                return;
            }
            if (other.transform.CompareTag("Agent"))
            {
                return;
            }
            this.isExploded = true;
            Vector3 normalized = (base.transform.position - this.lastPos).normalized;

            if (Provider.isServer)
            {
                float num = Mathf.Clamp(base.transform.parent.GetComponent <Rigidbody>().velocity.magnitude, 0f, 20f);
                if (num < 3f)
                {
                    return;
                }
                if (other.transform.CompareTag("Player"))
                {
                    Player player = DamageTool.getPlayer(other.transform);
                    if (player != null)
                    {
                        EPlayerKill eplayerKill;
                        DamageTool.damage(player, EDeathCause.BOULDER, ELimb.SPINE, CSteamID.Nil, normalized, Boulder.DAMAGE_PLAYER, num, out eplayerKill);
                    }
                }
                else if (other.transform.CompareTag("Vehicle"))
                {
                    InteractableVehicle component = other.transform.GetComponent <InteractableVehicle>();
                    if (component != null && component.asset != null && component.asset.isVulnerableToEnvironment)
                    {
                        VehicleManager.damage(component, Boulder.DAMAGE_VEHICLE, num, true);
                    }
                }
                else if (other.transform.CompareTag("Barricade"))
                {
                    Transform             transform  = other.transform;
                    InteractableDoorHinge component2 = transform.GetComponent <InteractableDoorHinge>();
                    if (component2 != null)
                    {
                        transform = component2.transform.parent.parent;
                    }
                    BarricadeManager.damage(transform, Boulder.DAMAGE_BARRICADE, num, true);
                }
                else if (other.transform.CompareTag("Structure"))
                {
                    StructureManager.damage(other.transform, normalized, Boulder.DAMAGE_STRUCTURE, num, true);
                }
                else if (other.transform.CompareTag("Resource"))
                {
                    EPlayerKill eplayerKill2;
                    uint        num2;
                    ResourceManager.damage(other.transform, normalized, Boulder.DAMAGE_RESOURCE, num, 1f, out eplayerKill2, out num2);
                }
                else
                {
                    InteractableObjectRubble componentInParent = other.transform.GetComponentInParent <InteractableObjectRubble>();
                    if (componentInParent != null)
                    {
                        EPlayerKill eplayerKill3;
                        uint        num3;
                        DamageTool.damage(componentInParent.transform, normalized, componentInParent.getSection(other.transform), Boulder.DAMAGE_OBJECT, num, out eplayerKill3, out num3);
                    }
                }
            }
            if (!Dedicator.isDedicated)
            {
                EffectManager.effect(52, base.transform.position, -normalized);
            }
        }
Example #2
0
        // Token: 0x060039D1 RID: 14801 RVA: 0x001B7FEC File Offset: 0x001B63EC
        private void fire()
        {
            float num = (float)base.player.equipment.quality / 100f;

            if (Provider.isServer)
            {
                AlertTool.alert(base.transform.position, ((ItemMeleeAsset)base.player.equipment.asset).alertRadius);
                if (Provider.modeConfigData.Items.Has_Durability && base.player.equipment.quality > 0 && UnityEngine.Random.value < ((ItemWeaponAsset)base.player.equipment.asset).durability)
                {
                    if (base.player.equipment.quality > ((ItemWeaponAsset)base.player.equipment.asset).wear)
                    {
                        PlayerEquipment equipment = base.player.equipment;
                        equipment.quality -= ((ItemWeaponAsset)base.player.equipment.asset).wear;
                    }
                    else
                    {
                        base.player.equipment.quality = 0;
                    }
                    base.player.equipment.sendUpdateQuality();
                }
            }
            if (base.channel.isOwner)
            {
                int num2;
                if (Provider.provider.statisticsService.userStatisticsService.getStatistic("Accuracy_Shot", out num2))
                {
                    Provider.provider.statisticsService.userStatisticsService.setStatistic("Accuracy_Shot", num2 + 1);
                }
                Ray         ray         = new Ray(base.player.look.aim.position, base.player.look.aim.forward);
                RaycastInfo raycastInfo = DamageTool.raycast(ray, ((ItemWeaponAsset)base.player.equipment.asset).range, RayMasks.DAMAGE_CLIENT);
                if (raycastInfo.player != null && ((ItemMeleeAsset)base.player.equipment.asset).playerDamageMultiplier.damage > 1f && !base.player.quests.isMemberOfSameGroupAs(raycastInfo.player) && Provider.isPvP)
                {
                    if (Provider.provider.statisticsService.userStatisticsService.getStatistic("Accuracy_Hit", out num2))
                    {
                        Provider.provider.statisticsService.userStatisticsService.setStatistic("Accuracy_Hit", num2 + 1);
                    }
                    if (raycastInfo.limb == ELimb.SKULL && Provider.provider.statisticsService.userStatisticsService.getStatistic("Headshots", out num2))
                    {
                        Provider.provider.statisticsService.userStatisticsService.setStatistic("Headshots", num2 + 1);
                    }
                    PlayerUI.hitmark(0, raycastInfo.point, false, (raycastInfo.limb != ELimb.SKULL) ? EPlayerHit.ENTITIY : EPlayerHit.CRITICAL);
                }
                else if ((raycastInfo.zombie != null && ((ItemMeleeAsset)base.player.equipment.asset).zombieDamageMultiplier.damage > 1f) || (raycastInfo.animal != null && ((ItemMeleeAsset)base.player.equipment.asset).animalDamageMultiplier.damage > 1f))
                {
                    if (Provider.provider.statisticsService.userStatisticsService.getStatistic("Accuracy_Hit", out num2))
                    {
                        Provider.provider.statisticsService.userStatisticsService.setStatistic("Accuracy_Hit", num2 + 1);
                    }
                    if (raycastInfo.limb == ELimb.SKULL && Provider.provider.statisticsService.userStatisticsService.getStatistic("Headshots", out num2))
                    {
                        Provider.provider.statisticsService.userStatisticsService.setStatistic("Headshots", num2 + 1);
                    }
                    PlayerUI.hitmark(0, raycastInfo.point, false, (raycastInfo.limb != ELimb.SKULL) ? EPlayerHit.ENTITIY : EPlayerHit.CRITICAL);
                }
                else if (raycastInfo.vehicle != null && ((ItemMeleeAsset)base.player.equipment.asset).vehicleDamage > 1f)
                {
                    if (((ItemMeleeAsset)base.player.equipment.asset).isRepair)
                    {
                        if (!raycastInfo.vehicle.isExploded && !raycastInfo.vehicle.isRepaired)
                        {
                            if (Provider.provider.statisticsService.userStatisticsService.getStatistic("Accuracy_Hit", out num2))
                            {
                                Provider.provider.statisticsService.userStatisticsService.setStatistic("Accuracy_Hit", num2 + 1);
                            }
                            PlayerUI.hitmark(0, raycastInfo.point, false, EPlayerHit.BUILD);
                        }
                    }
                    else if (!raycastInfo.vehicle.isDead && raycastInfo.vehicle.asset != null && raycastInfo.vehicle.canBeDamaged && (raycastInfo.vehicle.asset.isVulnerable || ((ItemWeaponAsset)base.player.equipment.asset).isInvulnerable))
                    {
                        if (Provider.provider.statisticsService.userStatisticsService.getStatistic("Accuracy_Hit", out num2))
                        {
                            Provider.provider.statisticsService.userStatisticsService.setStatistic("Accuracy_Hit", num2 + 1);
                        }
                        PlayerUI.hitmark(0, raycastInfo.point, false, EPlayerHit.BUILD);
                    }
                }
                else if (raycastInfo.transform != null && raycastInfo.transform.CompareTag("Barricade") && ((ItemMeleeAsset)base.player.equipment.asset).barricadeDamage > 1f)
                {
                    InteractableDoorHinge component = raycastInfo.transform.GetComponent <InteractableDoorHinge>();
                    if (component != null)
                    {
                        raycastInfo.transform = component.transform.parent.parent;
                    }
                    ushort id;
                    if (ushort.TryParse(raycastInfo.transform.name, out id))
                    {
                        ItemBarricadeAsset itemBarricadeAsset = (ItemBarricadeAsset)Assets.find(EAssetType.ITEM, id);
                        if (itemBarricadeAsset != null)
                        {
                            if (((ItemMeleeAsset)base.player.equipment.asset).isRepair)
                            {
                                Interactable2HP component2 = raycastInfo.transform.GetComponent <Interactable2HP>();
                                if (component2 != null && itemBarricadeAsset.isRepairable && component2.hp < 100)
                                {
                                    if (Provider.provider.statisticsService.userStatisticsService.getStatistic("Accuracy_Hit", out num2))
                                    {
                                        Provider.provider.statisticsService.userStatisticsService.setStatistic("Accuracy_Hit", num2 + 1);
                                    }
                                    PlayerUI.hitmark(0, raycastInfo.point, false, EPlayerHit.BUILD);
                                }
                            }
                            else if (itemBarricadeAsset.isVulnerable || ((ItemWeaponAsset)base.player.equipment.asset).isInvulnerable)
                            {
                                if (Provider.provider.statisticsService.userStatisticsService.getStatistic("Accuracy_Hit", out num2))
                                {
                                    Provider.provider.statisticsService.userStatisticsService.setStatistic("Accuracy_Hit", num2 + 1);
                                }
                                PlayerUI.hitmark(0, raycastInfo.point, false, EPlayerHit.BUILD);
                            }
                        }
                    }
                }
                else if (raycastInfo.transform != null && raycastInfo.transform.CompareTag("Structure") && ((ItemMeleeAsset)base.player.equipment.asset).structureDamage > 1f)
                {
                    ushort id2;
                    if (ushort.TryParse(raycastInfo.transform.name, out id2))
                    {
                        ItemStructureAsset itemStructureAsset = (ItemStructureAsset)Assets.find(EAssetType.ITEM, id2);
                        if (itemStructureAsset != null)
                        {
                            if (((ItemMeleeAsset)base.player.equipment.asset).isRepair)
                            {
                                Interactable2HP component3 = raycastInfo.transform.GetComponent <Interactable2HP>();
                                if (component3 != null && itemStructureAsset.isRepairable && component3.hp < 100)
                                {
                                    if (Provider.provider.statisticsService.userStatisticsService.getStatistic("Accuracy_Hit", out num2))
                                    {
                                        Provider.provider.statisticsService.userStatisticsService.setStatistic("Accuracy_Hit", num2 + 1);
                                    }
                                    PlayerUI.hitmark(0, raycastInfo.point, false, EPlayerHit.BUILD);
                                }
                            }
                            else if (itemStructureAsset.isVulnerable || ((ItemWeaponAsset)base.player.equipment.asset).isInvulnerable)
                            {
                                if (Provider.provider.statisticsService.userStatisticsService.getStatistic("Accuracy_Hit", out num2))
                                {
                                    Provider.provider.statisticsService.userStatisticsService.setStatistic("Accuracy_Hit", num2 + 1);
                                }
                                PlayerUI.hitmark(0, raycastInfo.point, false, EPlayerHit.BUILD);
                            }
                        }
                    }
                }
                else if (raycastInfo.transform != null && raycastInfo.transform.CompareTag("Resource") && ((ItemMeleeAsset)base.player.equipment.asset).resourceDamage > 1f)
                {
                    byte   x;
                    byte   y;
                    ushort index;
                    if (ResourceManager.tryGetRegion(raycastInfo.transform, out x, out y, out index))
                    {
                        ResourceSpawnpoint resourceSpawnpoint = ResourceManager.getResourceSpawnpoint(x, y, index);
                        if (resourceSpawnpoint != null && !resourceSpawnpoint.isDead && resourceSpawnpoint.asset.bladeID == ((ItemWeaponAsset)base.player.equipment.asset).bladeID)
                        {
                            if (Provider.provider.statisticsService.userStatisticsService.getStatistic("Accuracy_Hit", out num2))
                            {
                                Provider.provider.statisticsService.userStatisticsService.setStatistic("Accuracy_Hit", num2 + 1);
                            }
                            PlayerUI.hitmark(0, raycastInfo.point, false, EPlayerHit.BUILD);
                        }
                    }
                }
                else if (raycastInfo.transform != null && ((ItemMeleeAsset)base.player.equipment.asset).objectDamage > 1f)
                {
                    InteractableObjectRubble component4 = raycastInfo.transform.GetComponent <InteractableObjectRubble>();
                    if (component4 != null)
                    {
                        raycastInfo.section = component4.getSection(raycastInfo.collider.transform);
                        if (!component4.isSectionDead(raycastInfo.section) && (component4.asset.rubbleIsVulnerable || ((ItemWeaponAsset)base.player.equipment.asset).isInvulnerable))
                        {
                            if (Provider.provider.statisticsService.userStatisticsService.getStatistic("Accuracy_Hit", out num2))
                            {
                                Provider.provider.statisticsService.userStatisticsService.setStatistic("Accuracy_Hit", num2 + 1);
                            }
                            PlayerUI.hitmark(0, raycastInfo.point, false, EPlayerHit.BUILD);
                        }
                    }
                }
                base.player.input.sendRaycast(raycastInfo);
            }
            if (Provider.isServer)
            {
                if (!base.player.input.hasInputs())
                {
                    return;
                }
                InputInfo input = base.player.input.getInput(true);
                if (input == null)
                {
                    return;
                }
                if ((input.point - base.player.look.aim.position).sqrMagnitude > Mathf.Pow(((ItemMeleeAsset)base.player.equipment.asset).range + 4f, 2f))
                {
                    return;
                }
                if (!((ItemMeleeAsset)base.player.equipment.asset).isRepair)
                {
                    DamageTool.impact(input.point, input.normal, input.material, input.type != ERaycastInfoType.NONE && input.type != ERaycastInfoType.OBJECT);
                }
                EPlayerKill eplayerKill = EPlayerKill.NONE;
                uint        num3        = 0u;
                float       num4        = 1f;
                num4 *= 1f + base.channel.owner.player.skills.mastery(0, 0) * 0.5f;
                num4 *= ((this.swingMode != ESwingMode.STRONG) ? 1f : ((ItemMeleeAsset)base.player.equipment.asset).strength);
                num4 *= ((num >= 0.5f) ? 1f : (0.5f + num));
                if (input.type == ERaycastInfoType.PLAYER)
                {
                    if (input.player != null && !base.player.quests.isMemberOfSameGroupAs(input.player) && Provider.isPvP)
                    {
                        DamageTool.damage(input.player, EDeathCause.MELEE, input.limb, base.channel.owner.playerID.steamID, input.direction, ((ItemMeleeAsset)base.player.equipment.asset).playerDamageMultiplier, num4, true, out eplayerKill);
                    }
                }
                else if (input.type == ERaycastInfoType.ZOMBIE)
                {
                    if (input.zombie != null)
                    {
                        DamageTool.damage(input.zombie, input.limb, input.direction, ((ItemMeleeAsset)base.player.equipment.asset).zombieDamageMultiplier, num4, true, out eplayerKill, out num3);
                        if (base.player.movement.nav != 255)
                        {
                            input.zombie.alert(base.transform.position, true);
                        }
                    }
                }
                else if (input.type == ERaycastInfoType.ANIMAL)
                {
                    if (input.animal != null)
                    {
                        DamageTool.damage(input.animal, input.limb, input.direction, ((ItemMeleeAsset)base.player.equipment.asset).animalDamageMultiplier, num4, out eplayerKill, out num3);
                        input.animal.alertPoint(base.transform.position, true);
                    }
                }
                else if (input.type == ERaycastInfoType.VEHICLE)
                {
                    if (input.vehicle != null && input.vehicle.asset != null && input.vehicle.canBeDamaged && (input.vehicle.asset.isVulnerable || ((ItemWeaponAsset)base.player.equipment.asset).isInvulnerable || ((ItemMeleeAsset)base.player.equipment.asset).isRepair))
                    {
                        if (((ItemMeleeAsset)base.player.equipment.asset).isRepair)
                        {
                            num4 *= 1f + base.channel.owner.player.skills.mastery(2, 6);
                        }
                        DamageTool.damage(input.vehicle, true, input.point, ((ItemMeleeAsset)base.player.equipment.asset).isRepair, ((ItemMeleeAsset)base.player.equipment.asset).vehicleDamage, num4, true, out eplayerKill);
                    }
                }
                else if (input.type == ERaycastInfoType.BARRICADE)
                {
                    ushort id3;
                    if (input.transform != null && input.transform.CompareTag("Barricade") && ushort.TryParse(input.transform.name, out id3))
                    {
                        ItemBarricadeAsset itemBarricadeAsset2 = (ItemBarricadeAsset)Assets.find(EAssetType.ITEM, id3);
                        if (itemBarricadeAsset2 != null)
                        {
                            if (((ItemMeleeAsset)base.player.equipment.asset).isRepair)
                            {
                                if (itemBarricadeAsset2.isRepairable)
                                {
                                    num4 *= 1f + base.channel.owner.player.skills.mastery(2, 6);
                                    DamageTool.damage(input.transform, true, ((ItemMeleeAsset)base.player.equipment.asset).barricadeDamage, num4, out eplayerKill);
                                }
                            }
                            else if (itemBarricadeAsset2.isVulnerable || ((ItemWeaponAsset)base.player.equipment.asset).isInvulnerable)
                            {
                                DamageTool.damage(input.transform, false, ((ItemMeleeAsset)base.player.equipment.asset).barricadeDamage, num4, out eplayerKill);
                            }
                        }
                    }
                }
                else if (input.type == ERaycastInfoType.STRUCTURE)
                {
                    ushort id4;
                    if (input.transform != null && input.transform.CompareTag("Structure") && ushort.TryParse(input.transform.name, out id4))
                    {
                        ItemStructureAsset itemStructureAsset2 = (ItemStructureAsset)Assets.find(EAssetType.ITEM, id4);
                        if (itemStructureAsset2 != null)
                        {
                            if (((ItemMeleeAsset)base.player.equipment.asset).isRepair)
                            {
                                if (itemStructureAsset2.isRepairable)
                                {
                                    num4 *= 1f + base.channel.owner.player.skills.mastery(2, 6);
                                    DamageTool.damage(input.transform, true, input.direction, ((ItemMeleeAsset)base.player.equipment.asset).structureDamage, num4, out eplayerKill);
                                }
                            }
                            else if (itemStructureAsset2.isVulnerable || ((ItemWeaponAsset)base.player.equipment.asset).isInvulnerable)
                            {
                                DamageTool.damage(input.transform, false, input.direction, ((ItemMeleeAsset)base.player.equipment.asset).structureDamage, num4, out eplayerKill);
                            }
                        }
                    }
                }
                else if (input.type == ERaycastInfoType.RESOURCE)
                {
                    if (input.transform != null && input.transform.CompareTag("Resource"))
                    {
                        num4 *= 1f + base.channel.owner.player.skills.mastery(2, 2) * 0.5f;
                        byte   x2;
                        byte   y2;
                        ushort index2;
                        if (ResourceManager.tryGetRegion(input.transform, out x2, out y2, out index2))
                        {
                            ResourceSpawnpoint resourceSpawnpoint2 = ResourceManager.getResourceSpawnpoint(x2, y2, index2);
                            if (resourceSpawnpoint2 != null && !resourceSpawnpoint2.isDead && resourceSpawnpoint2.asset.bladeID == ((ItemWeaponAsset)base.player.equipment.asset).bladeID)
                            {
                                DamageTool.damage(input.transform, input.direction, ((ItemMeleeAsset)base.player.equipment.asset).resourceDamage, num4, 1f + base.channel.owner.player.skills.mastery(2, 2) * 0.5f, out eplayerKill, out num3);
                            }
                        }
                    }
                }
                else if (input.type == ERaycastInfoType.OBJECT && input.transform != null && input.section < 255)
                {
                    InteractableObjectRubble component5 = input.transform.GetComponent <InteractableObjectRubble>();
                    if (component5 != null && !component5.isSectionDead(input.section) && (component5.asset.rubbleIsVulnerable || ((ItemWeaponAsset)base.player.equipment.asset).isInvulnerable))
                    {
                        DamageTool.damage(input.transform, input.direction, input.section, ((ItemMeleeAsset)base.player.equipment.asset).objectDamage, num4, out eplayerKill, out num3);
                    }
                }
                if (input.type != ERaycastInfoType.PLAYER && input.type != ERaycastInfoType.ZOMBIE && input.type != ERaycastInfoType.ANIMAL && !base.player.life.isAggressor)
                {
                    float num5 = ((ItemMeleeAsset)base.player.equipment.asset).range + Provider.modeConfigData.Players.Ray_Aggressor_Distance;
                    num5 *= num5;
                    float num6 = Provider.modeConfigData.Players.Ray_Aggressor_Distance;
                    num6 *= num6;
                    Vector3 forward = base.player.look.aim.forward;
                    for (int i = 0; i < Provider.clients.Count; i++)
                    {
                        if (Provider.clients[i] != base.channel.owner)
                        {
                            Player player = Provider.clients[i].player;
                            if (!(player == null))
                            {
                                Vector3 vector = player.look.aim.position - base.player.look.aim.position;
                                Vector3 a      = Vector3.Project(vector, forward);
                                if (a.sqrMagnitude < num5 && (a - vector).sqrMagnitude < num6)
                                {
                                    base.player.life.markAggressive(false, true);
                                }
                            }
                        }
                    }
                }
                if (Level.info.type == ELevelType.HORDE)
                {
                    if (input.zombie != null)
                    {
                        if (input.limb == ELimb.SKULL)
                        {
                            base.player.skills.askPay(10u);
                        }
                        else
                        {
                            base.player.skills.askPay(5u);
                        }
                    }
                    if (eplayerKill == EPlayerKill.ZOMBIE)
                    {
                        if (input.limb == ELimb.SKULL)
                        {
                            base.player.skills.askPay(50u);
                        }
                        else
                        {
                            base.player.skills.askPay(25u);
                        }
                    }
                }
                else
                {
                    if (eplayerKill == EPlayerKill.PLAYER && Level.info.type == ELevelType.ARENA)
                    {
                        base.player.skills.askPay(100u);
                    }
                    base.player.sendStat(eplayerKill);
                    if (num3 > 0u)
                    {
                        base.player.skills.askPay(num3);
                    }
                }
            }
        }
Example #3
0
 // Token: 0x06002C0E RID: 11278 RVA: 0x00117EA4 File Offset: 0x001162A4
 private void Update()
 {
     if (base.channel.isOwner)
     {
         if (base.player.stance.stance != EPlayerStance.DRIVING && base.player.stance.stance != EPlayerStance.SITTING && !base.player.life.isDead && !base.player.workzone.isBuilding)
         {
             if (Time.realtimeSinceStartup - PlayerInteract.lastInteract > 0.1f)
             {
                 PlayerInteract.lastInteract = Time.realtimeSinceStartup;
                 if (base.player.look.isCam)
                 {
                     PhysicsUtility.raycast(new Ray(base.player.look.aim.position, base.player.look.aim.forward), out PlayerInteract.hit, 4f, RayMasks.PLAYER_INTERACT, QueryTriggerInteraction.UseGlobal);
                 }
                 else
                 {
                     PhysicsUtility.raycast(new Ray(MainCamera.instance.transform.position, MainCamera.instance.transform.forward), out PlayerInteract.hit, (float)((base.player.look.perspective != EPlayerPerspective.THIRD) ? 4 : 6), RayMasks.PLAYER_INTERACT, QueryTriggerInteraction.UseGlobal);
                 }
             }
             if (PlayerInteract.hit.transform != PlayerInteract.focus)
             {
                 if (PlayerInteract.focus != null && PlayerInteract.interactable != null)
                 {
                     InteractableDoorHinge component = PlayerInteract.focus.GetComponent <InteractableDoorHinge>();
                     if (component != null)
                     {
                         HighlighterTool.unhighlight(PlayerInteract.focus.parent.parent);
                     }
                     else
                     {
                         HighlighterTool.unhighlight(PlayerInteract.focus);
                     }
                 }
                 PlayerInteract.focus          = null;
                 PlayerInteract.target         = null;
                 PlayerInteract._interactable  = null;
                 PlayerInteract._interactable2 = null;
                 if (PlayerInteract.hit.transform != null)
                 {
                     PlayerInteract.focus          = PlayerInteract.hit.transform;
                     PlayerInteract._interactable  = PlayerInteract.focus.GetComponent <Interactable>();
                     PlayerInteract._interactable2 = PlayerInteract.focus.GetComponent <Interactable2>();
                     if (PlayerInteract.interactable != null)
                     {
                         PlayerInteract.target = PlayerInteract.focus.FindChildRecursive("Target");
                         if (PlayerInteract.interactable.checkInteractable())
                         {
                             if (PlayerUI.window.isEnabled)
                             {
                                 if (PlayerInteract.interactable.checkUseable())
                                 {
                                     Color color;
                                     if (!PlayerInteract.interactable.checkHighlight(out color))
                                     {
                                         color = Color.green;
                                     }
                                     InteractableDoorHinge component2 = PlayerInteract.focus.GetComponent <InteractableDoorHinge>();
                                     if (component2 != null)
                                     {
                                         HighlighterTool.highlight(PlayerInteract.focus.parent.parent, color);
                                     }
                                     else
                                     {
                                         HighlighterTool.highlight(PlayerInteract.focus, color);
                                     }
                                 }
                                 else
                                 {
                                     Color color = Color.red;
                                     InteractableDoorHinge component3 = PlayerInteract.focus.GetComponent <InteractableDoorHinge>();
                                     if (component3 != null)
                                     {
                                         HighlighterTool.highlight(PlayerInteract.focus.parent.parent, color);
                                     }
                                     else
                                     {
                                         HighlighterTool.highlight(PlayerInteract.focus, color);
                                     }
                                 }
                             }
                         }
                         else
                         {
                             PlayerInteract.target        = null;
                             PlayerInteract._interactable = null;
                         }
                     }
                 }
             }
         }
         else
         {
             if (PlayerInteract.focus != null && PlayerInteract.interactable != null)
             {
                 InteractableDoorHinge component4 = PlayerInteract.focus.GetComponent <InteractableDoorHinge>();
                 if (component4 != null)
                 {
                     HighlighterTool.unhighlight(PlayerInteract.focus.parent.parent);
                 }
                 else
                 {
                     HighlighterTool.unhighlight(PlayerInteract.focus);
                 }
             }
             PlayerInteract.focus          = null;
             PlayerInteract.target         = null;
             PlayerInteract._interactable  = null;
             PlayerInteract._interactable2 = null;
         }
     }
     if (base.channel.isOwner && !base.player.life.isDead)
     {
         if (PlayerInteract.interactable != null)
         {
             EPlayerMessage message;
             string         text;
             Color          color2;
             if (PlayerInteract.interactable.checkHint(out message, out text, out color2) && !PlayerUI.window.showCursor)
             {
                 if (PlayerInteract.interactable.CompareTag("Item"))
                 {
                     PlayerUI.hint((!(PlayerInteract.target != null)) ? PlayerInteract.focus : PlayerInteract.target, message, text, color2, new object[]
                     {
                         ((InteractableItem)PlayerInteract.interactable).item,
                         ((InteractableItem)PlayerInteract.interactable).asset
                     });
                 }
                 else
                 {
                     PlayerUI.hint((!(PlayerInteract.target != null)) ? PlayerInteract.focus : PlayerInteract.target, message, text, color2, new object[0]);
                 }
             }
         }
         else if (PlayerInteract.purchaseAsset != null && base.player.movement.purchaseNode != null && !PlayerUI.window.showCursor)
         {
             PlayerUI.hint(null, EPlayerMessage.PURCHASE, string.Empty, Color.white, new object[]
             {
                 PlayerInteract.purchaseAsset.itemName,
                 base.player.movement.purchaseNode.cost
             });
         }
         else if (PlayerInteract.focus != null && PlayerInteract.focus.CompareTag("Enemy"))
         {
             Player player = DamageTool.getPlayer(PlayerInteract.focus);
             if (player != null && player != Player.player && !PlayerUI.window.showCursor)
             {
                 PlayerUI.hint(null, EPlayerMessage.ENEMY, string.Empty, Color.white, new object[]
                 {
                     player.channel.owner
                 });
             }
         }
         EPlayerMessage message2;
         float          data;
         if (PlayerInteract.interactable2 != null && PlayerInteract.interactable2.checkHint(out message2, out data) && !PlayerUI.window.showCursor)
         {
             PlayerUI.hint2(message2, (!PlayerInteract.isHoldingKey) ? 0f : ((Time.realtimeSinceStartup - PlayerInteract.lastKeyDown) / this.salvageTime), data);
         }
         if ((base.player.stance.stance == EPlayerStance.DRIVING || base.player.stance.stance == EPlayerStance.SITTING) && !Input.GetKey(KeyCode.LeftShift))
         {
             if (Input.GetKeyDown(KeyCode.F1))
             {
                 this.hotkey(0);
             }
             if (Input.GetKeyDown(KeyCode.F2))
             {
                 this.hotkey(1);
             }
             if (Input.GetKeyDown(KeyCode.F3))
             {
                 this.hotkey(2);
             }
             if (Input.GetKeyDown(KeyCode.F4))
             {
                 this.hotkey(3);
             }
             if (Input.GetKeyDown(KeyCode.F5))
             {
                 this.hotkey(4);
             }
             if (Input.GetKeyDown(KeyCode.F6))
             {
                 this.hotkey(5);
             }
             if (Input.GetKeyDown(KeyCode.F7))
             {
                 this.hotkey(6);
             }
             if (Input.GetKeyDown(KeyCode.F8))
             {
                 this.hotkey(7);
             }
             if (Input.GetKeyDown(KeyCode.F9))
             {
                 this.hotkey(8);
             }
             if (Input.GetKeyDown(KeyCode.F10))
             {
                 this.hotkey(9);
             }
         }
         if (Input.GetKeyDown(ControlsSettings.interact))
         {
             PlayerInteract.lastKeyDown  = Time.realtimeSinceStartup;
             PlayerInteract.isHoldingKey = true;
         }
         if (Input.GetKeyDown(ControlsSettings.inspect) && ControlsSettings.inspect != ControlsSettings.interact && base.player.equipment.canInspect)
         {
             base.channel.send("askInspect", ESteamCall.SERVER, ESteamPacket.UPDATE_UNRELIABLE_BUFFER, new object[0]);
         }
         if (PlayerInteract.isHoldingKey)
         {
             if (Input.GetKeyUp(ControlsSettings.interact))
             {
                 PlayerInteract.isHoldingKey = false;
                 if (PlayerUI.window.showCursor)
                 {
                     if (base.player.inventory.isStoring && base.player.inventory.shouldInteractCloseStorage)
                     {
                         PlayerDashboardUI.close();
                         PlayerLifeUI.open();
                     }
                     else if (PlayerBarricadeSignUI.active)
                     {
                         PlayerBarricadeSignUI.close();
                         PlayerLifeUI.open();
                     }
                     else if (PlayerBarricadeStereoUI.active)
                     {
                         PlayerBarricadeStereoUI.close();
                         PlayerLifeUI.open();
                     }
                     else if (PlayerBarricadeLibraryUI.active)
                     {
                         PlayerBarricadeLibraryUI.close();
                         PlayerLifeUI.open();
                     }
                     else if (PlayerBarricadeMannequinUI.active)
                     {
                         PlayerBarricadeMannequinUI.close();
                         PlayerLifeUI.open();
                     }
                     else if (PlayerNPCDialogueUI.active)
                     {
                         if (PlayerNPCDialogueUI.dialogueAnimating)
                         {
                             PlayerNPCDialogueUI.skipText();
                         }
                         else if (PlayerNPCDialogueUI.dialogueHasNextPage)
                         {
                             PlayerNPCDialogueUI.nextPage();
                         }
                         else
                         {
                             PlayerNPCDialogueUI.close();
                             PlayerLifeUI.open();
                         }
                     }
                     else if (PlayerNPCQuestUI.active)
                     {
                         PlayerNPCQuestUI.closeNicely();
                     }
                     else if (PlayerNPCVendorUI.active)
                     {
                         PlayerNPCVendorUI.closeNicely();
                     }
                 }
                 else if (base.player.stance.stance == EPlayerStance.DRIVING || base.player.stance.stance == EPlayerStance.SITTING)
                 {
                     VehicleManager.exitVehicle();
                 }
                 else if (PlayerInteract.focus != null && PlayerInteract.interactable != null)
                 {
                     if (PlayerInteract.interactable.checkUseable())
                     {
                         PlayerInteract.interactable.use();
                     }
                 }
                 else if (PlayerInteract.purchaseAsset != null)
                 {
                     if (base.player.skills.experience >= base.player.movement.purchaseNode.cost)
                     {
                         base.player.skills.sendPurchase(base.player.movement.purchaseNode);
                     }
                 }
                 else if (ControlsSettings.inspect == ControlsSettings.interact && base.player.equipment.canInspect)
                 {
                     base.channel.send("askInspect", ESteamCall.SERVER, ESteamPacket.UPDATE_UNRELIABLE_BUFFER, new object[0]);
                 }
             }
             else if (Time.realtimeSinceStartup - PlayerInteract.lastKeyDown > this.salvageTime)
             {
                 PlayerInteract.isHoldingKey = false;
                 if (!PlayerUI.window.showCursor && PlayerInteract.interactable2 != null)
                 {
                     PlayerInteract.interactable2.use();
                 }
             }
         }
     }
 }
 // Token: 0x06002EB3 RID: 11955 RVA: 0x001309B4 File Offset: 0x0012EDB4
 private void Update()
 {
     if (!this.isBuilding)
     {
         return;
     }
     this.ray = MainCamera.instance.ScreenPointToRay(Input.mousePosition);
     Physics.Raycast(this.ray, out this.worldHit, 256f, RayMasks.EDITOR_WORLD);
     Physics.Raycast(this.ray, out this.buildableHit, 256f, RayMasks.EDITOR_BUILDABLE);
     Physics.Raycast(this.ray, out this.logicHit, 256f, RayMasks.VIEWMODEL);
     if (GUIUtility.hotControl == 0)
     {
         if (Input.GetKey(ControlsSettings.secondary))
         {
             this.handleType = EDragType.NONE;
             if (this.isDragging)
             {
                 this._dragStart  = Vector2.zero;
                 this._dragEnd    = Vector2.zero;
                 this._isDragging = false;
                 if (this.onDragStopped != null)
                 {
                     this.onDragStopped();
                 }
                 this.clearSelection();
             }
             return;
         }
         if (this.handleType != EDragType.NONE)
         {
             if (!Input.GetKey(ControlsSettings.primary))
             {
                 this.applySelection();
                 this.handleType = EDragType.NONE;
             }
             else
             {
                 if (this.handleType == EDragType.TRANSFORM_X)
                 {
                     this.transformGroup(this.handle.right, this.handle.up);
                 }
                 else if (this.handleType == EDragType.TRANSFORM_Y)
                 {
                     this.transformGroup(this.handle.up, this.handle.right);
                 }
                 else if (this.handleType == EDragType.TRANSFORM_Z)
                 {
                     this.transformGroup(this.handle.forward, this.handle.up);
                 }
                 else if (this.handleType == EDragType.PLANE_X)
                 {
                     this.planeGroup(this.handle.right);
                 }
                 else if (this.handleType == EDragType.PLANE_Y)
                 {
                     this.planeGroup(this.handle.up);
                 }
                 else if (this.handleType == EDragType.PLANE_Z)
                 {
                     this.planeGroup(this.handle.forward);
                 }
                 if (this.handleType == EDragType.ROTATION_X)
                 {
                     this.rotateGroup(this.handle.right, Vector3.right);
                 }
                 else if (this.handleType == EDragType.ROTATION_Y)
                 {
                     this.rotateGroup(this.handle.up, Vector3.up);
                 }
                 else if (this.handleType == EDragType.ROTATION_Z)
                 {
                     this.rotateGroup(this.handle.forward, Vector3.forward);
                 }
             }
         }
         if (Input.GetKeyDown(ControlsSettings.tool_0))
         {
             this.dragMode = EDragMode.TRANSFORM;
         }
         if (Input.GetKeyDown(ControlsSettings.tool_1))
         {
             this.dragMode = EDragMode.ROTATE;
         }
         if (Input.GetKeyDown(KeyCode.B) && this.selection.Count > 0 && Input.GetKey(KeyCode.LeftControl))
         {
             this.copyPosition = this.handle.position;
             this.copyRotation = this.handle.rotation;
         }
         if (Input.GetKeyDown(KeyCode.N) && this.selection.Count > 0 && this.copyPosition != Vector3.zero && Input.GetKey(KeyCode.LeftControl))
         {
             this.pointSelection();
             this.handle.position = this.copyPosition;
             this.handle.rotation = this.copyRotation;
             this.updateGroup();
             this.applySelection();
         }
         if (this.handleType == EDragType.NONE)
         {
             if (Input.GetKeyDown(ControlsSettings.primary))
             {
                 if (this.logicHit.transform != null && (this.logicHit.transform.name == "Arrow_X" || this.logicHit.transform.name == "Arrow_Y" || this.logicHit.transform.name == "Arrow_Z" || this.logicHit.transform.name == "Plane_X" || this.logicHit.transform.name == "Plane_Y" || this.logicHit.transform.name == "Plane_Z" || this.logicHit.transform.name == "Circle_X" || this.logicHit.transform.name == "Circle_Y" || this.logicHit.transform.name == "Circle_Z"))
                 {
                     this.mouseOrigin     = Input.mousePosition;
                     this.transformOrigin = this.handle.position;
                     this.rotateOrigin    = this.handle.rotation;
                     this.handleOffset    = this.logicHit.point - this.handle.position;
                     this.pointSelection();
                     if (this.logicHit.transform.name == "Arrow_X")
                     {
                         this.handleType = EDragType.TRANSFORM_X;
                     }
                     else if (this.logicHit.transform.name == "Arrow_Y")
                     {
                         this.handleType = EDragType.TRANSFORM_Y;
                     }
                     else if (this.logicHit.transform.name == "Arrow_Z")
                     {
                         this.handleType = EDragType.TRANSFORM_Z;
                     }
                     else if (this.logicHit.transform.name == "Plane_X")
                     {
                         this.handleType = EDragType.PLANE_X;
                     }
                     else if (this.logicHit.transform.name == "Plane_Y")
                     {
                         this.handleType = EDragType.PLANE_Y;
                     }
                     else if (this.logicHit.transform.name == "Plane_Z")
                     {
                         this.handleType = EDragType.PLANE_Z;
                     }
                     else if (this.logicHit.transform.name == "Circle_X")
                     {
                         this.rotateInverted = (Vector3.Dot(this.logicHit.point - this.handle.position, MainCamera.instance.transform.up) < 0f);
                         this.handleType     = EDragType.ROTATION_X;
                     }
                     else if (this.logicHit.transform.name == "Circle_Y")
                     {
                         this.rotateInverted = (Vector3.Dot(this.logicHit.point - this.handle.position, MainCamera.instance.transform.up) < 0f);
                         this.handleType     = EDragType.ROTATION_Y;
                     }
                     else if (this.logicHit.transform.name == "Circle_Z")
                     {
                         this.rotateInverted = (Vector3.Dot(this.logicHit.point - this.handle.position, MainCamera.instance.transform.up) < 0f);
                         this.handleType     = EDragType.ROTATION_Z;
                     }
                 }
                 else
                 {
                     Transform transform = this.buildableHit.transform;
                     if (transform != null && (transform.CompareTag("Barricade") || transform.CompareTag("Structure")))
                     {
                         InteractableDoorHinge component = transform.GetComponent <InteractableDoorHinge>();
                         if (component != null)
                         {
                             transform = component.transform.parent.parent;
                         }
                         if (Input.GetKey(ControlsSettings.modify))
                         {
                             if (this.containsSelection(transform))
                             {
                                 this.removeSelection(transform);
                             }
                             else
                             {
                                 this.addSelection(transform);
                             }
                         }
                         else if (this.containsSelection(transform))
                         {
                             this.clearSelection();
                         }
                         else
                         {
                             this.clearSelection();
                             this.addSelection(transform);
                         }
                     }
                     else
                     {
                         if (!this.isDragging)
                         {
                             this._dragStart.x = PlayerUI.window.mouse_x;
                             this._dragStart.y = PlayerUI.window.mouse_y;
                         }
                         if (!Input.GetKey(ControlsSettings.modify))
                         {
                             this.clearSelection();
                         }
                     }
                 }
             }
             else if (Input.GetKey(ControlsSettings.primary) && this.dragStart.x != 0f)
             {
                 this._dragEnd.x = PlayerUI.window.mouse_x;
                 this._dragEnd.y = PlayerUI.window.mouse_y;
                 if (this.isDragging || Mathf.Abs(this.dragEnd.x - this.dragStart.x) > 50f || Mathf.Abs(this.dragEnd.x - this.dragStart.x) > 50f)
                 {
                     int num  = (int)this.dragStart.x;
                     int num2 = (int)this.dragStart.y;
                     if (this.dragEnd.x < this.dragStart.x)
                     {
                         num = (int)this.dragEnd.x;
                     }
                     if (this.dragEnd.y < this.dragStart.y)
                     {
                         num2 = (int)this.dragEnd.y;
                     }
                     int num3 = (int)this.dragEnd.x;
                     int num4 = (int)this.dragEnd.y;
                     if (this.dragStart.x > this.dragEnd.x)
                     {
                         num3 = (int)this.dragStart.x;
                     }
                     if (this.dragStart.y > this.dragEnd.y)
                     {
                         num4 = (int)this.dragStart.y;
                     }
                     if (this.onDragStarted != null)
                     {
                         this.onDragStarted(num, num2, num3, num4);
                     }
                     if (!this.isDragging)
                     {
                         this._isDragging = true;
                         this.dragable.Clear();
                         byte region_x = Player.player.movement.region_x;
                         byte region_y = Player.player.movement.region_y;
                         if (Regions.checkSafe((int)region_x, (int)region_y))
                         {
                             for (int i = 0; i < BarricadeManager.plants.Count; i++)
                             {
                                 BarricadeRegion barricadeRegion = BarricadeManager.plants[i];
                                 for (int j = 0; j < barricadeRegion.drops.Count; j++)
                                 {
                                     BarricadeDrop barricadeDrop = barricadeRegion.drops[j];
                                     if (!(barricadeDrop.model == null))
                                     {
                                         Vector3 newScreen = MainCamera.instance.WorldToScreenPoint(barricadeDrop.model.position);
                                         if (newScreen.z >= 0f)
                                         {
                                             newScreen.y = (float)Screen.height - newScreen.y;
                                             this.dragable.Add(new EditorDrag(barricadeDrop.model, newScreen));
                                         }
                                     }
                                 }
                             }
                             for (int k = (int)(region_x - 1); k <= (int)(region_x + 1); k++)
                             {
                                 for (int l = (int)(region_y - 1); l <= (int)(region_y + 1); l++)
                                 {
                                     if (Regions.checkSafe((int)((byte)k), (int)((byte)l)))
                                     {
                                         for (int m = 0; m < BarricadeManager.regions[k, l].drops.Count; m++)
                                         {
                                             BarricadeDrop barricadeDrop2 = BarricadeManager.regions[k, l].drops[m];
                                             if (!(barricadeDrop2.model == null))
                                             {
                                                 Vector3 newScreen2 = MainCamera.instance.WorldToScreenPoint(barricadeDrop2.model.position);
                                                 if (newScreen2.z >= 0f)
                                                 {
                                                     newScreen2.y = (float)Screen.height - newScreen2.y;
                                                     this.dragable.Add(new EditorDrag(barricadeDrop2.model, newScreen2));
                                                 }
                                             }
                                         }
                                         for (int n = 0; n < StructureManager.regions[k, l].drops.Count; n++)
                                         {
                                             StructureDrop structureDrop = StructureManager.regions[k, l].drops[n];
                                             if (structureDrop != null)
                                             {
                                                 Vector3 newScreen3 = MainCamera.instance.WorldToScreenPoint(structureDrop.model.position);
                                                 if (newScreen3.z >= 0f)
                                                 {
                                                     newScreen3.y = (float)Screen.height - newScreen3.y;
                                                     this.dragable.Add(new EditorDrag(structureDrop.model, newScreen3));
                                                 }
                                             }
                                         }
                                     }
                                 }
                             }
                         }
                     }
                     if (!Input.GetKey(ControlsSettings.modify))
                     {
                         for (int num5 = 0; num5 < this.selection.Count; num5++)
                         {
                             if (!(this.selection[num5].transform == null))
                             {
                                 Vector3 vector = MainCamera.instance.WorldToScreenPoint(this.selection[num5].transform.position);
                                 if (vector.z < 0f)
                                 {
                                     this.removeSelection(this.selection[num5].transform);
                                 }
                                 else
                                 {
                                     vector.y = (float)Screen.height - vector.y;
                                     if (vector.x < (float)num || vector.y < (float)num2 || vector.x > (float)num3 || vector.y > (float)num4)
                                     {
                                         this.removeSelection(this.selection[num5].transform);
                                     }
                                 }
                             }
                         }
                     }
                     for (int num6 = 0; num6 < this.dragable.Count; num6++)
                     {
                         EditorDrag editorDrag = this.dragable[num6];
                         if (!(editorDrag.transform == null))
                         {
                             if (!(editorDrag.transform.parent == this.group))
                             {
                                 if (editorDrag.screen.x >= (float)num && editorDrag.screen.y >= (float)num2 && editorDrag.screen.x <= (float)num3 && editorDrag.screen.y <= (float)num4)
                                 {
                                     this.addSelection(editorDrag.transform);
                                 }
                             }
                         }
                     }
                 }
             }
             if (this.selection.Count > 0 && Input.GetKeyDown(ControlsSettings.tool_2) && this.worldHit.transform != null)
             {
                 this.pointSelection();
                 this.handle.position = this.worldHit.point;
                 if (Input.GetKey(ControlsSettings.snap))
                 {
                     this.handle.position += this.worldHit.normal * this.snapTransform;
                 }
                 this.updateGroup();
                 this.applySelection();
             }
         }
     }
     if (Input.GetKeyUp(ControlsSettings.primary) && this.dragStart.x != 0f)
     {
         this._dragStart = Vector2.zero;
         if (this.isDragging)
         {
             this._dragEnd    = Vector2.zero;
             this._isDragging = false;
             if (this.onDragStopped != null)
             {
                 this.onDragStopped();
             }
         }
     }
 }
Example #5
0
 public virtual void write(SteamChannel channel)
 {
     channel.write(this.sequence);
     channel.write(this.recov);
     channel.write(this.keys);
     if (this.clientsideInputs == null)
     {
         channel.write(0);
     }
     else
     {
         channel.write((byte)this.clientsideInputs.Count);
         foreach (RaycastInfo raycastInfo in this.clientsideInputs)
         {
             if (raycastInfo.player != null)
             {
                 channel.write(3);
                 channel.write(raycastInfo.point);
                 channel.write(raycastInfo.direction);
                 channel.write(raycastInfo.normal);
                 channel.write((byte)raycastInfo.limb);
                 channel.write(raycastInfo.player.channel.owner.playerID.steamID);
             }
             else if (raycastInfo.zombie != null)
             {
                 channel.write(4);
                 channel.write(raycastInfo.point);
                 channel.write(raycastInfo.direction);
                 channel.write(raycastInfo.normal);
                 channel.write((byte)raycastInfo.limb);
                 channel.write(raycastInfo.zombie.id);
             }
             else if (raycastInfo.animal != null)
             {
                 channel.write(5);
                 channel.write(raycastInfo.point);
                 channel.write(raycastInfo.direction);
                 channel.write(raycastInfo.normal);
                 channel.write((byte)raycastInfo.limb);
                 channel.write(raycastInfo.animal.index);
             }
             else if (raycastInfo.vehicle != null)
             {
                 channel.write(6);
                 channel.write(raycastInfo.point);
                 channel.write(raycastInfo.normal);
                 channel.write((byte)raycastInfo.material);
                 channel.write(raycastInfo.vehicle.instanceID);
             }
             else if (raycastInfo.transform != null)
             {
                 if (raycastInfo.transform.CompareTag("Barricade"))
                 {
                     channel.write(7);
                     InteractableDoorHinge component = raycastInfo.transform.GetComponent <InteractableDoorHinge>();
                     if (component != null)
                     {
                         raycastInfo.transform = component.transform.parent.parent;
                     }
                     byte            b;
                     byte            b2;
                     ushort          num;
                     ushort          num2;
                     BarricadeRegion barricadeRegion;
                     if (BarricadeManager.tryGetInfo(raycastInfo.transform, out b, out b2, out num, out num2, out barricadeRegion))
                     {
                         channel.write(raycastInfo.point);
                         channel.write(raycastInfo.normal);
                         channel.write((byte)raycastInfo.material);
                         channel.write(b);
                         channel.write(b2);
                         channel.write(num);
                         channel.write(num2);
                     }
                     else
                     {
                         channel.write(Vector3.zero);
                         channel.write(Vector3.up);
                         channel.write(0);
                         channel.write(0);
                         channel.write(0);
                         channel.write(ushort.MaxValue);
                         channel.write(ushort.MaxValue);
                     }
                 }
                 else if (raycastInfo.transform.CompareTag("Structure"))
                 {
                     channel.write(8);
                     byte            b3;
                     byte            b4;
                     ushort          num3;
                     StructureRegion structureRegion;
                     if (StructureManager.tryGetInfo(raycastInfo.transform, out b3, out b4, out num3, out structureRegion))
                     {
                         channel.write(raycastInfo.point);
                         channel.write(raycastInfo.direction);
                         channel.write(raycastInfo.normal);
                         channel.write((byte)raycastInfo.material);
                         channel.write(b3);
                         channel.write(b4);
                         channel.write(num3);
                     }
                     else
                     {
                         channel.write(Vector3.zero);
                         channel.write(Vector3.up);
                         channel.write(Vector3.up);
                         channel.write(0);
                         channel.write(0);
                         channel.write(0);
                         channel.write(ushort.MaxValue);
                     }
                 }
                 else if (raycastInfo.transform.CompareTag("Resource"))
                 {
                     channel.write(9);
                     byte   b5;
                     byte   b6;
                     ushort num4;
                     if (ResourceManager.tryGetRegion(raycastInfo.transform, out b5, out b6, out num4))
                     {
                         channel.write(raycastInfo.point);
                         channel.write(raycastInfo.direction);
                         channel.write(raycastInfo.normal);
                         channel.write((byte)raycastInfo.material);
                         channel.write(b5);
                         channel.write(b6);
                         channel.write(num4);
                     }
                     else
                     {
                         channel.write(Vector3.zero);
                         channel.write(Vector3.up);
                         channel.write(Vector3.up);
                         channel.write(0);
                         channel.write(0);
                         channel.write(0);
                         channel.write(ushort.MaxValue);
                     }
                 }
                 else if (raycastInfo.transform.CompareTag("Small") || raycastInfo.transform.CompareTag("Medium") || raycastInfo.transform.CompareTag("Large"))
                 {
                     channel.write(2);
                     byte   b7;
                     byte   b8;
                     ushort num5;
                     if (ObjectManager.tryGetRegion(raycastInfo.transform, out b7, out b8, out num5))
                     {
                         channel.write(raycastInfo.point);
                         channel.write(raycastInfo.direction);
                         channel.write(raycastInfo.normal);
                         channel.write((byte)raycastInfo.material);
                         channel.write(raycastInfo.section);
                         channel.write(b7);
                         channel.write(b8);
                         channel.write(num5);
                     }
                     else
                     {
                         channel.write(Vector3.zero);
                         channel.write(Vector3.up);
                         channel.write(Vector3.up);
                         channel.write(0);
                         channel.write(byte.MaxValue);
                         channel.write(0);
                         channel.write(0);
                         channel.write(ushort.MaxValue);
                     }
                 }
                 else if (raycastInfo.transform.CompareTag("Ground") || raycastInfo.transform.CompareTag("Environment"))
                 {
                     channel.write(0);
                     channel.write(raycastInfo.point);
                     channel.write(raycastInfo.normal);
                     channel.write((byte)raycastInfo.material);
                 }
                 else
                 {
                     channel.write(1);
                 }
             }
             else
             {
                 channel.write(1);
             }
         }
     }
 }