// Token: 0x060033AE RID: 13230 RVA: 0x0014F378 File Offset: 0x0014D778 public void Explode() { List <EPlayerKill> list; DamageTool.explode(base.transform.position, this.range, EDeathCause.GRENADE, this.killer, this.playerDamage, this.zombieDamage, this.animalDamage, this.barricadeDamage, this.structureDamage, this.vehicleDamage, this.resourceDamage, this.objectDamage, out list, EExplosionDamageType.CONVENTIONAL, 32f, true, false); EffectManager.sendEffect(this.explosion, EffectManager.LARGE, base.transform.position); UnityEngine.Object.Destroy(base.gameObject); }
// Token: 0x060020B4 RID: 8372 RVA: 0x000B363C File Offset: 0x000B1A3C public void detonate(CSteamID killer) { EffectManager.sendEffect(this.explosion2, EffectManager.LARGE, base.transform.position); List <EPlayerKill> list; DamageTool.explode(base.transform.position, this.range2, EDeathCause.CHARGE, killer, this.playerDamage, this.zombieDamage, this.animalDamage, this.barricadeDamage, this.structureDamage, this.vehicleDamage, this.resourceDamage, this.objectDamage, out list, EExplosionDamageType.CONVENTIONAL, 32f, true, false); BarricadeManager.damage(base.transform, 5f, 1f, false); }
// Token: 0x060033DD RID: 13277 RVA: 0x001512B7 File Offset: 0x0014F6B7 public static void damage(Animal animal, ELimb limb, Vector3 direction, AnimalDamageMultiplier multiplier, float times, out EPlayerKill kill, out uint xp) { if (animal == null) { kill = EPlayerKill.NONE; xp = 0u; return; } DamageTool.damage(animal, direction, multiplier.multiply(limb), times, out kill, out xp); }
// Token: 0x0600239F RID: 9119 RVA: 0x000C5EC0 File Offset: 0x000C42C0 private void OnTriggerEnter(Collider other) { if (Provider.isServer && other.transform.CompareTag("Player")) { Player player = DamageTool.getPlayer(other.transform); if (player != null) { EPlayerKill eplayerKill; player.life.askDamage(101, Vector3.up * 10f, EDeathCause.SUICIDE, ELimb.SKULL, CSteamID.Nil, out eplayerKill); } } }
private bool fire() { if (base.channel.isOwner) { Ray ray; ray..ctor(base.player.look.aim.position, base.player.look.aim.forward); RaycastInfo raycastInfo = DamageTool.raycast(ray, 3f, RayMasks.DAMAGE_CLIENT); if (raycastInfo.vehicle == null || !raycastInfo.vehicle.isTireReplaceable) { return(false); } int closestAliveTireIndex = raycastInfo.vehicle.getClosestAliveTireIndex(raycastInfo.point, ((ItemTireAsset)base.player.equipment.asset).mode == EUseableTireMode.REMOVE); if (closestAliveTireIndex == -1) { return(false); } base.player.input.sendRaycast(raycastInfo); } if (Provider.isServer) { if (!base.player.input.hasInputs()) { return(false); } InputInfo input = base.player.input.getInput(true); if (input == null) { return(false); } if ((input.point - base.player.look.aim.position).sqrMagnitude > 49f) { return(false); } if (input.type != ERaycastInfoType.VEHICLE) { return(false); } if (input.vehicle == null || !input.vehicle.isTireReplaceable) { return(false); } int closestAliveTireIndex2 = input.vehicle.getClosestAliveTireIndex(input.point, ((ItemTireAsset)base.player.equipment.asset).mode == EUseableTireMode.REMOVE); if (closestAliveTireIndex2 == -1) { return(false); } this.isAttaching = true; this.vehicle = input.vehicle; this.vehicleWheelIndex = closestAliveTireIndex2; } return(true); }
// Token: 0x060033D9 RID: 13273 RVA: 0x0015118B File Offset: 0x0014F58B public static void damage(Player player, EDeathCause cause, ELimb limb, CSteamID killer, Vector3 direction, PlayerDamageMultiplier multiplier, float times, bool armor, out EPlayerKill kill) { if (player == null) { kill = EPlayerKill.NONE; return; } if (armor) { times *= multiplier.armor(limb, player); } DamageTool.damage(player, cause, limb, killer, direction, multiplier.multiply(limb), times, out kill); }
public override void startSecondary() { if (base.player.equipment.isBusy) { return; } if (!this.hasAid) { return; } if (base.channel.isOwner) { Ray ray; ray..ctor(base.player.look.aim.position, base.player.look.aim.forward); RaycastInfo raycastInfo = DamageTool.raycast(ray, 3f, RayMasks.DAMAGE_CLIENT); base.player.input.sendRaycast(raycastInfo); if (!Provider.isServer && raycastInfo.player != null) { base.player.equipment.isBusy = true; this.startedUse = Time.realtimeSinceStartup; this.isUsing = true; this.consumeMode = EConsumeMode.AID; this.consume(); } } if (Provider.isServer) { if (!base.player.input.hasInputs()) { return; } InputInfo input = base.player.input.getInput(true); if (input == null) { return; } if (input.type == ERaycastInfoType.PLAYER && input.player != null) { this.enemy = input.player; base.player.equipment.isBusy = true; this.startedUse = Time.realtimeSinceStartup; this.isUsing = true; this.consumeMode = EConsumeMode.AID; this.consume(); base.channel.send("askConsume", ESteamCall.NOT_OWNER, ESteamPacket.UPDATE_UNRELIABLE_BUFFER, new object[] { (byte)this.consumeMode }); } } }
private bool fire() { if (base.channel.isOwner) { Ray ray; ray..ctor(base.player.look.aim.position, base.player.look.aim.forward); RaycastInfo raycastInfo = DamageTool.raycast(ray, 3f, RayMasks.DAMAGE_CLIENT); if (raycastInfo.transform == null || !raycastInfo.transform.CompareTag("Barricade")) { return(false); } InteractableFarm component = raycastInfo.transform.GetComponent <InteractableFarm>(); if (component == null) { return(false); } base.player.input.sendRaycast(raycastInfo); } if (Provider.isServer) { if (!base.player.input.hasInputs()) { return(false); } InputInfo input = base.player.input.getInput(true); if (input == null) { return(false); } if ((input.point - base.player.look.aim.position).sqrMagnitude > 49f) { return(false); } if (input.type != ERaycastInfoType.BARRICADE) { return(false); } if (input.transform == null || !input.transform.CompareTag("Barricade")) { return(false); } this.farm = input.transform.GetComponent <InteractableFarm>(); if (this.farm == null || this.farm.checkFarm()) { return(false); } } return(true); }
// Token: 0x0600269E RID: 9886 RVA: 0x000E4A60 File Offset: 0x000E2E60 private void OnTriggerEnter(Collider other) { bool flag; if (!Dedicator.isDedicated && !string.IsNullOrEmpty(this.achievement) && other.transform.CompareTag("Player") && other.transform == Player.player.transform && Provider.provider.achievementsService.getAchievement(this.achievement, out flag) && !flag) { Provider.provider.achievementsService.setAchievement(this.achievement); } if (Provider.isServer && other.transform.CompareTag("Player") && this.playerTeleported == null) { EffectManager.sendEffect(this.teleportEffect, 16f, this.effectHook.position); this.playerTeleported = DamageTool.getPlayer(other.transform); base.StartCoroutine("teleport"); } }
public override void startPrimary() { if (base.player.equipment.isBusy) { return; } if (base.channel.isOwner) { Ray ray; ray..ctor(base.player.look.aim.position, base.player.look.aim.forward); RaycastInfo raycastInfo = DamageTool.raycast(ray, 3f, RayMasks.DAMAGE_CLIENT); if (raycastInfo.player != null && raycastInfo.player.animator.gesture == EPlayerGesture.ARREST_START) { base.player.input.sendRaycast(raycastInfo); if (!Provider.isServer) { base.player.equipment.isBusy = true; this.startedUse = Time.realtimeSinceStartup; this.isUsing = true; this.arrest(); } } } if (Provider.isServer) { if (!base.player.input.hasInputs()) { return; } InputInfo input = base.player.input.getInput(true); if (input == null) { return; } if (input.type == ERaycastInfoType.PLAYER && input.player != null) { this.enemy = input.player; base.player.equipment.isBusy = true; this.startedUse = Time.realtimeSinceStartup; this.isUsing = true; this.arrest(); base.channel.send("askArrest", ESteamCall.NOT_OWNER, ESteamPacket.UPDATE_UNRELIABLE_BUFFER, new object[0]); } } }
// Token: 0x060033DB RID: 13275 RVA: 0x00151208 File Offset: 0x0014F608 public static void damage(Zombie zombie, ELimb limb, Vector3 direction, ZombieDamageMultiplier multiplier, float times, bool armor, out EPlayerKill kill, out uint xp) { if (zombie == null) { kill = EPlayerKill.NONE; xp = 0u; return; } if (armor) { times *= multiplier.armor(limb, zombie); if ((double)Vector3.Dot(zombie.transform.forward, direction) > 0.5) { times *= 1.25f; } } DamageTool.damage(zombie, direction, multiplier.multiply(limb), times, out kill, out xp); }
private bool fire() { if (base.channel.isOwner) { Ray ray; ray..ctor(base.player.look.aim.position, base.player.look.aim.forward); RaycastInfo raycastInfo = DamageTool.raycast(ray, 3f, RayMasks.DAMAGE_CLIENT); if (raycastInfo.vehicle == null || !raycastInfo.vehicle.isEmpty) { return(false); } base.player.input.sendRaycast(raycastInfo); } if (Provider.isServer) { if (!base.player.input.hasInputs()) { return(false); } InputInfo input = base.player.input.getInput(true); if (input == null) { return(false); } if ((input.point - base.player.look.aim.position).sqrMagnitude > 49f) { return(false); } if (input.type != ERaycastInfoType.VEHICLE) { return(false); } if (input.vehicle == null || !input.vehicle.isEmpty) { return(false); } this.isJacking = true; this.vehicle = input.vehicle; } return(true); }
private void OnTriggerEnter(Collider other) { if (this.isExploded) { return; } if (other.isTrigger) { return; } if (other.transform == this.ignoreTransform) { return; } this.isExploded = true; if (Provider.isServer) { DamageTool.explode(this.lastPos, this.range, EDeathCause.MISSILE, this.killer, this.playerDamage, this.zombieDamage, this.animalDamage, this.barricadeDamage, this.structureDamage, this.vehicleDamage, this.resourceDamage, this.objectDamage, EExplosionDamageType.CONVENTIONAL, 32f, true); EffectManager.sendEffect(this.explosion, EffectManager.LARGE, this.lastPos); } Object.Destroy(base.gameObject); }
// Token: 0x060033E8 RID: 13288 RVA: 0x00152238 File Offset: 0x00150638 public static RaycastInfo raycast(Ray ray, float range, int mask) { RaycastHit hit; PhysicsUtility.raycast(ray, out hit, range, mask, QueryTriggerInteraction.UseGlobal); RaycastInfo raycastInfo = new RaycastInfo(hit); raycastInfo.direction = ray.direction; if (hit.transform != null) { if (hit.transform.CompareTag("Enemy")) { raycastInfo.player = DamageTool.getPlayer(raycastInfo.transform); } if (hit.transform.CompareTag("Zombie")) { raycastInfo.zombie = DamageTool.getZombie(raycastInfo.transform); } if (hit.transform.CompareTag("Animal")) { raycastInfo.animal = DamageTool.getAnimal(raycastInfo.transform); } raycastInfo.limb = DamageTool.getLimb(raycastInfo.transform); if (hit.transform.CompareTag("Vehicle")) { raycastInfo.vehicle = DamageTool.getVehicle(raycastInfo.transform); } if (raycastInfo.zombie != null && raycastInfo.zombie.isRadioactive) { raycastInfo.material = EPhysicsMaterial.ALIEN_DYNAMIC; } else { raycastInfo.material = DamageTool.getMaterial(hit.point, hit.transform, hit.collider); } } return(raycastInfo); }
// Token: 0x060033D8 RID: 13272 RVA: 0x00151108 File Offset: 0x0014F508 public static void damage(Player player, EDeathCause cause, ELimb limb, CSteamID killer, Vector3 direction, float damage, float times, out EPlayerKill kill) { if (player == null) { kill = EPlayerKill.NONE; return; } bool flag = true; if (DamageTool.playerDamaged != null) { DamageTool.playerDamaged(player, ref cause, ref limb, ref killer, ref direction, ref damage, ref times, ref flag); } if (!flag) { kill = EPlayerKill.NONE; return; } times *= Provider.modeConfigData.Players.Armor_Multiplier; byte b = (byte)(damage * times); player.life.askDamage(b, direction * (float)b, cause, limb, killer, out kill); }
// Token: 0x060033B3 RID: 13235 RVA: 0x0014F4CC File Offset: 0x0014D8CC private void OnTriggerEnter(Collider other) { if (this.isExploded) { return; } if (other.isTrigger) { return; } if (other.transform == this.ignoreTransform) { return; } this.isExploded = true; if (Provider.isServer) { Vector3 point = this.lastPos; float damageRadius = this.range; EDeathCause cause = EDeathCause.MISSILE; CSteamID csteamID = this.killer; float num = this.playerDamage; float num2 = this.zombieDamage; float num3 = this.animalDamage; float num4 = this.barricadeDamage; float num5 = this.structureDamage; float num6 = this.vehicleDamage; float num7 = this.resourceDamage; float num8 = this.objectDamage; bool flag = this.penetrateBuildables; List <EPlayerKill> list; DamageTool.explode(point, damageRadius, cause, csteamID, num, num2, num3, num4, num5, num6, num7, num8, out list, EExplosionDamageType.CONVENTIONAL, 32f, true, flag); EffectManager.sendEffect(this.explosion, EffectManager.LARGE, this.lastPos); } UnityEngine.Object.Destroy(base.gameObject); }
// Token: 0x060033E3 RID: 13283 RVA: 0x00151418 File Offset: 0x0014F818 public static void explode(Vector3 point, float damageRadius, EDeathCause cause, CSteamID killer, float playerDamage, float zombieDamage, float animalDamage, float barricadeDamage, float structureDamage, float vehicleDamage, float resourceDamage, float objectDamage, out List <EPlayerKill> kills, EExplosionDamageType damageType = EExplosionDamageType.CONVENTIONAL, float alertRadius = 32f, bool playImpactEffect = true, bool penetrateBuildables = false) { DamageTool.explosionKills.Clear(); kills = DamageTool.explosionKills; DamageTool.explosionRangeComparator.point = point; float num = damageRadius * damageRadius; DamageTool.regionsInRadius.Clear(); Regions.getRegionsInRadius(point, damageRadius, DamageTool.regionsInRadius); int layerMask; if (penetrateBuildables) { layerMask = RayMasks.BLOCK_EXPLOSION_PENETRATE_BUILDABLES; } else { layerMask = RayMasks.BLOCK_EXPLOSION; } if (structureDamage > 0.5f) { DamageTool.structuresInRadius.Clear(); StructureManager.getStructuresInRadius(point, num, DamageTool.regionsInRadius, DamageTool.structuresInRadius); DamageTool.structuresInRadius.Sort(DamageTool.explosionRangeComparator); for (int i = 0; i < DamageTool.structuresInRadius.Count; i++) { Transform transform = DamageTool.structuresInRadius[i]; if (!(transform == null)) { ushort id; if (ushort.TryParse(transform.name, out id)) { ItemStructureAsset itemStructureAsset = (ItemStructureAsset)Assets.find(EAssetType.ITEM, id); if (itemStructureAsset != null && !itemStructureAsset.proofExplosion) { Vector3 a = transform.transform.position - point; float magnitude = a.magnitude; Vector3 direction = a / magnitude; if (magnitude > 0.5f) { RaycastHit raycastHit; PhysicsUtility.raycast(new Ray(point, direction), out raycastHit, magnitude - 0.5f, layerMask, QueryTriggerInteraction.UseGlobal); if (raycastHit.transform != null && raycastHit.transform != transform.transform) { goto IL_17D; } } StructureManager.damage(transform, a.normalized, structureDamage, 1f - magnitude / damageRadius, true); } } } IL_17D :; } } if (resourceDamage > 0.5f) { DamageTool.resourcesInRadius.Clear(); ResourceManager.getResourcesInRadius(point, num, DamageTool.regionsInRadius, DamageTool.resourcesInRadius); DamageTool.resourcesInRadius.Sort(DamageTool.explosionRangeComparator); for (int j = 0; j < DamageTool.resourcesInRadius.Count; j++) { Transform transform2 = DamageTool.resourcesInRadius[j]; if (!(transform2 == null)) { Vector3 a2 = transform2.transform.position - point; float magnitude2 = a2.magnitude; Vector3 direction2 = a2 / magnitude2; if (magnitude2 > 0.5f) { RaycastHit raycastHit; PhysicsUtility.raycast(new Ray(point, direction2), out raycastHit, magnitude2 - 0.5f, layerMask, QueryTriggerInteraction.UseGlobal); if (raycastHit.transform != null && raycastHit.transform != transform2.transform) { goto IL_2A2; } } EPlayerKill eplayerKill; uint num2; ResourceManager.damage(transform2, a2.normalized, resourceDamage, 1f - magnitude2 / damageRadius, 1f, out eplayerKill, out num2); if (eplayerKill != EPlayerKill.NONE) { kills.Add(eplayerKill); } } IL_2A2 :; } } if (objectDamage > 0.5f) { DamageTool.objectsInRadius.Clear(); ObjectManager.getObjectsInRadius(point, num, DamageTool.regionsInRadius, DamageTool.objectsInRadius); DamageTool.objectsInRadius.Sort(DamageTool.explosionRangeComparator); for (int k = 0; k < DamageTool.objectsInRadius.Count; k++) { Transform transform3 = DamageTool.objectsInRadius[k]; if (!(transform3 == null)) { InteractableObjectRubble component = transform3.GetComponent <InteractableObjectRubble>(); if (!(component == null)) { if (!component.asset.rubbleProofExplosion) { for (byte b = 0; b < component.getSectionCount(); b += 1) { Transform section = component.getSection(b); Vector3 a3 = section.position - point; if (a3.sqrMagnitude < num) { float magnitude3 = a3.magnitude; Vector3 direction3 = a3 / magnitude3; if (magnitude3 > 0.5f) { RaycastHit raycastHit; PhysicsUtility.raycast(new Ray(point, direction3), out raycastHit, magnitude3 - 0.5f, layerMask, QueryTriggerInteraction.UseGlobal); if (raycastHit.transform != null && raycastHit.transform != transform3.transform) { goto IL_40B; } } EPlayerKill eplayerKill; uint num2; ObjectManager.damage(transform3, a3.normalized, b, objectDamage, 1f - magnitude3 / damageRadius, out eplayerKill, out num2); if (eplayerKill != EPlayerKill.NONE) { kills.Add(eplayerKill); } } IL_40B :; } } } } } } if (barricadeDamage > 0.5f) { DamageTool.barricadesInRadius.Clear(); BarricadeManager.getBarricadesInRadius(point, num, DamageTool.regionsInRadius, DamageTool.barricadesInRadius); BarricadeManager.getBarricadesInRadius(point, num, DamageTool.barricadesInRadius); DamageTool.barricadesInRadius.Sort(DamageTool.explosionRangeComparator); for (int l = 0; l < DamageTool.barricadesInRadius.Count; l++) { Transform transform4 = DamageTool.barricadesInRadius[l]; if (!(transform4 == null)) { Vector3 a4 = transform4.transform.position - point; float magnitude4 = a4.magnitude; Vector3 direction4 = a4 / magnitude4; if (magnitude4 > 0.5f) { RaycastHit raycastHit; PhysicsUtility.raycast(new Ray(point, direction4), out raycastHit, magnitude4 - 0.5f, layerMask, QueryTriggerInteraction.UseGlobal); if (raycastHit.transform != null && raycastHit.transform != transform4.transform) { goto IL_568; } } ushort id2; if (ushort.TryParse(transform4.name, out id2)) { ItemBarricadeAsset itemBarricadeAsset = (ItemBarricadeAsset)Assets.find(EAssetType.ITEM, id2); if (itemBarricadeAsset != null && !itemBarricadeAsset.proofExplosion) { BarricadeManager.damage(transform4, barricadeDamage, 1f - magnitude4 / damageRadius, true); } } } IL_568 :; } } if ((Provider.isPvP || damageType == EExplosionDamageType.ZOMBIE_ACID || damageType == EExplosionDamageType.ZOMBIE_FIRE || damageType == EExplosionDamageType.ZOMBIE_ELECTRIC) && playerDamage > 0.5f) { DamageTool.playersInRadius.Clear(); PlayerTool.getPlayersInRadius(point, num, DamageTool.playersInRadius); for (int m = 0; m < DamageTool.playersInRadius.Count; m++) { Player player = DamageTool.playersInRadius[m]; if (!(player == null) && !player.life.isDead) { if (damageType != EExplosionDamageType.ZOMBIE_FIRE || player.clothing.shirtAsset == null || !player.clothing.shirtAsset.proofFire || player.clothing.pantsAsset == null || !player.clothing.pantsAsset.proofFire) { Vector3 a5 = player.transform.position - point; float magnitude5 = a5.magnitude; Vector3 vector = a5 / magnitude5; if (magnitude5 > 0.5f) { RaycastHit raycastHit; PhysicsUtility.raycast(new Ray(point, vector), out raycastHit, magnitude5 - 0.5f, layerMask, QueryTriggerInteraction.UseGlobal); if (raycastHit.transform != null && raycastHit.transform != player.transform) { goto IL_7AA; } } if (playImpactEffect) { EffectManager.sendEffect(5, EffectManager.SMALL, player.transform.position + Vector3.up, -vector); EffectManager.sendEffect(5, EffectManager.SMALL, player.transform.position + Vector3.up, Vector3.up); } float num3 = 1f - Mathf.Pow(magnitude5 / damageRadius, 2f); if (player.movement.getVehicle() != null && player.movement.getVehicle().asset != null) { num3 *= player.movement.getVehicle().asset.passengerExplosionArmor; } EPlayerKill eplayerKill; DamageTool.damage(player, cause, ELimb.SPINE, killer, vector, playerDamage, num3, out eplayerKill); if (eplayerKill != EPlayerKill.NONE) { kills.Add(eplayerKill); } } } IL_7AA :; } } if (damageType == EExplosionDamageType.ZOMBIE_FIRE || zombieDamage > 0.5f) { DamageTool.zombiesInRadius.Clear(); ZombieManager.getZombiesInRadius(point, num, DamageTool.zombiesInRadius); for (int n = 0; n < DamageTool.zombiesInRadius.Count; n++) { Zombie zombie = DamageTool.zombiesInRadius[n]; if (!(zombie == null) && !zombie.isDead) { if (damageType == EExplosionDamageType.ZOMBIE_FIRE) { if (zombie.speciality == EZombieSpeciality.NORMAL) { ZombieManager.sendZombieSpeciality(zombie, EZombieSpeciality.BURNER); } } else { Vector3 a6 = zombie.transform.position - point; float magnitude6 = a6.magnitude; Vector3 vector2 = a6 / magnitude6; if (magnitude6 > 0.5f) { RaycastHit raycastHit; PhysicsUtility.raycast(new Ray(point, vector2), out raycastHit, magnitude6 - 0.5f, layerMask, QueryTriggerInteraction.UseGlobal); if (raycastHit.transform != null && raycastHit.transform != zombie.transform) { goto IL_964; } } if (playImpactEffect) { EffectManager.sendEffect((!zombie.isRadioactive) ? 5 : 95, EffectManager.SMALL, zombie.transform.position + Vector3.up, -vector2); EffectManager.sendEffect((!zombie.isRadioactive) ? 5 : 95, EffectManager.SMALL, zombie.transform.position + Vector3.up, Vector3.up); } EPlayerKill eplayerKill; uint num2; DamageTool.damage(zombie, vector2, zombieDamage, 1f - magnitude6 / damageRadius, out eplayerKill, out num2); if (eplayerKill != EPlayerKill.NONE) { kills.Add(eplayerKill); } } } IL_964 :; } } if (animalDamage > 0.5f) { DamageTool.animalsInRadius.Clear(); AnimalManager.getAnimalsInRadius(point, num, DamageTool.animalsInRadius); for (int num4 = 0; num4 < DamageTool.animalsInRadius.Count; num4++) { Animal animal = DamageTool.animalsInRadius[num4]; if (!(animal == null) && !animal.isDead) { Vector3 a7 = animal.transform.position - point; float magnitude7 = a7.magnitude; Vector3 vector3 = a7 / magnitude7; if (magnitude7 > 0.5f) { RaycastHit raycastHit; PhysicsUtility.raycast(new Ray(point, vector3), out raycastHit, magnitude7 - 0.5f, layerMask, QueryTriggerInteraction.UseGlobal); if (raycastHit.transform != null && raycastHit.transform != animal.transform) { goto IL_ACC; } } if (playImpactEffect) { EffectManager.sendEffect(5, EffectManager.SMALL, animal.transform.position + Vector3.up, -vector3); EffectManager.sendEffect(5, EffectManager.SMALL, animal.transform.position + Vector3.up, Vector3.up); } EPlayerKill eplayerKill; uint num2; DamageTool.damage(animal, vector3, animalDamage, 1f - magnitude7 / damageRadius, out eplayerKill, out num2); if (eplayerKill != EPlayerKill.NONE) { kills.Add(eplayerKill); } } IL_ACC :; } } if (vehicleDamage > 0.5f) { DamageTool.vehiclesInRadius.Clear(); VehicleManager.getVehiclesInRadius(point, num, DamageTool.vehiclesInRadius); for (int num5 = 0; num5 < DamageTool.vehiclesInRadius.Count; num5++) { InteractableVehicle interactableVehicle = DamageTool.vehiclesInRadius[num5]; if (!(interactableVehicle == null) && !interactableVehicle.isDead) { if (interactableVehicle.asset != null && interactableVehicle.asset.isVulnerableToExplosions) { Vector3 a8 = interactableVehicle.transform.position - point; float magnitude8 = a8.magnitude; Vector3 direction5 = a8 / magnitude8; if (magnitude8 > 0.5f) { RaycastHit raycastHit; PhysicsUtility.raycast(new Ray(point, direction5), out raycastHit, magnitude8 - 0.5f, layerMask, QueryTriggerInteraction.UseGlobal); if (raycastHit.transform != null && raycastHit.transform != interactableVehicle.transform) { goto IL_BED; } } VehicleManager.damage(interactableVehicle, vehicleDamage, 1f - magnitude8 / damageRadius, false); } } IL_BED :; } } AlertTool.alert(point, alertRadius); }
// Token: 0x060033E5 RID: 13285 RVA: 0x0015205E File Offset: 0x0015045E public static void impact(Vector3 point, Vector3 normal, EPhysicsMaterial material, bool forceDynamic) { DamageTool.impact(point, normal, material, forceDynamic, CSteamID.Nil, point); }
// 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); } }
// Token: 0x060033E6 RID: 13286 RVA: 0x00152070 File Offset: 0x00150470 public static void impact(Vector3 point, Vector3 normal, EPhysicsMaterial material, bool forceDynamic, CSteamID spectatorID, Vector3 spectatorPoint) { if (material == EPhysicsMaterial.NONE) { return; } ushort id = 0; if (material == EPhysicsMaterial.CLOTH_DYNAMIC || material == EPhysicsMaterial.TILE_DYNAMIC || material == EPhysicsMaterial.CONCRETE_DYNAMIC) { id = 38; } else if (material == EPhysicsMaterial.CLOTH_STATIC || material == EPhysicsMaterial.TILE_STATIC || material == EPhysicsMaterial.CONCRETE_STATIC) { id = ((!forceDynamic) ? 13 : 38); } else if (material == EPhysicsMaterial.FLESH_DYNAMIC) { id = 5; } else if (material == EPhysicsMaterial.GRAVEL_DYNAMIC) { id = 44; } else if (material == EPhysicsMaterial.GRAVEL_STATIC) { id = ((!forceDynamic) ? 14 : 44); } else if (material == EPhysicsMaterial.METAL_DYNAMIC) { id = 18; } else if (material == EPhysicsMaterial.METAL_STATIC || material == EPhysicsMaterial.METAL_SLIP) { id = ((!forceDynamic) ? 12 : 18); } else if (material == EPhysicsMaterial.WOOD_DYNAMIC) { id = 17; } else if (material == EPhysicsMaterial.WOOD_STATIC) { id = ((!forceDynamic) ? 2 : 17); } else if (material == EPhysicsMaterial.FOLIAGE_STATIC || material == EPhysicsMaterial.FOLIAGE_DYNAMIC) { id = 15; } else if (material == EPhysicsMaterial.SNOW_STATIC || material == EPhysicsMaterial.ICE_STATIC) { id = 41; } else if (material == EPhysicsMaterial.WATER_STATIC) { id = 16; } else if (material == EPhysicsMaterial.ALIEN_DYNAMIC) { id = 95; } DamageTool.impact(point, normal, id, spectatorID, spectatorPoint); }
// Token: 0x06003953 RID: 14675 RVA: 0x001A8E8C File Offset: 0x001A728C public override void simulate(uint simulation, bool inputSteady) { if (this.isUsing && this.isUseable) { base.player.equipment.isBusy = false; this.isUsing = false; ItemConsumeableAsset itemConsumeableAsset = (ItemConsumeableAsset)base.player.equipment.asset; if (this.consumeMode == EConsumeMode.AID) { if (Provider.isServer) { if (itemConsumeableAsset != null && this.enemy != null) { byte health = this.enemy.life.health; byte virus = this.enemy.life.virus; bool isBleeding = this.enemy.life.isBleeding; bool isBroken = this.enemy.life.isBroken; this.enemy.life.askHeal((byte)((float)itemConsumeableAsset.health * (1f + base.player.skills.mastery(2, 0) * 0.5f)), itemConsumeableAsset.hasBleeding, itemConsumeableAsset.hasBroken); byte food = this.enemy.life.food; this.enemy.life.askEat((byte)((float)itemConsumeableAsset.food * ((float)base.player.equipment.quality / 100f))); byte food2 = this.enemy.life.food; byte b = (byte)((float)itemConsumeableAsset.water * ((float)base.player.equipment.quality / 100f)); if (itemConsumeableAsset.foodConstrainsWater) { b = (byte)Mathf.Min((int)b, (int)(food2 - food)); } this.enemy.life.askDrink(b); this.enemy.life.askInfect((byte)((float)itemConsumeableAsset.virus * (1f - this.enemy.skills.mastery(1, 2) * 0.5f))); this.enemy.life.askDisinfect((byte)((float)itemConsumeableAsset.disinfectant * (1f + this.enemy.skills.mastery(2, 0) * 0.5f))); if (base.player.equipment.quality < 50) { this.enemy.life.askInfect((byte)((float)(itemConsumeableAsset.food + itemConsumeableAsset.water) * 0.5f * (1f - (float)base.player.equipment.quality / 50f) * (1f - this.enemy.skills.mastery(1, 2) * 0.5f))); } byte health2 = this.enemy.life.health; byte virus2 = this.enemy.life.virus; bool isBleeding2 = this.enemy.life.isBleeding; bool isBroken2 = this.enemy.life.isBroken; uint num = 0u; int num2 = 0; if (health2 > health) { num += (uint)Mathf.RoundToInt((float)(health2 - health) / 2f); num2++; } if (virus2 > virus) { num += (uint)Mathf.RoundToInt((float)(virus2 - virus) / 2f); num2++; } if (isBleeding && !isBleeding2) { num += 15u; num2++; } if (isBroken && !isBroken2) { num += 15u; num2++; } if (num > 0u) { base.player.skills.askPay(num); } if (num2 > 0) { base.player.skills.askRep(num2); } } base.player.equipment.use(); } } else { if (itemConsumeableAsset != null) { base.player.life.askRest(itemConsumeableAsset.energy); base.player.life.askView((byte)((float)itemConsumeableAsset.vision * (1f - base.player.skills.mastery(1, 2)))); base.player.life.askWarm(itemConsumeableAsset.warmth); bool flag; if (base.channel.isOwner && itemConsumeableAsset.vision > 0 && Provider.provider.achievementsService.getAchievement("Berries", out flag) && !flag) { Provider.provider.achievementsService.setAchievement("Berries"); } } if (Provider.isServer) { Vector3 point = base.transform.position + Vector3.up; if (itemConsumeableAsset != null) { base.player.life.askHeal((byte)((float)itemConsumeableAsset.health * (1f + base.player.skills.mastery(2, 0) * 0.5f)), itemConsumeableAsset.hasBleeding, itemConsumeableAsset.hasBroken); byte food3 = base.player.life.food; base.player.life.askEat((byte)((float)itemConsumeableAsset.food * ((float)base.player.equipment.quality / 100f))); byte food4 = base.player.life.food; byte b2 = (byte)((float)itemConsumeableAsset.water * ((float)base.player.equipment.quality / 100f)); if (itemConsumeableAsset.foodConstrainsWater) { b2 = (byte)Mathf.Min((int)b2, (int)(food4 - food3)); } base.player.life.askDrink(b2); base.player.life.askInfect((byte)((float)itemConsumeableAsset.virus * (1f - base.player.skills.mastery(1, 2) * 0.5f))); base.player.life.askDisinfect((byte)((float)itemConsumeableAsset.disinfectant * (1f + base.player.skills.mastery(2, 0) * 0.5f))); base.player.life.askWarm(itemConsumeableAsset.warmth); if (base.player.equipment.quality < 50) { base.player.life.askInfect((byte)((float)(itemConsumeableAsset.food + itemConsumeableAsset.water) * 0.5f * (1f - (float)base.player.equipment.quality / 50f) * (1f - base.player.skills.mastery(1, 2) * 0.5f))); } } base.player.equipment.use(); if (itemConsumeableAsset != null && itemConsumeableAsset.explosion > 0) { EffectManager.sendEffect(itemConsumeableAsset.explosion, EffectManager.LARGE, point); List <EPlayerKill> list; DamageTool.explode(point, itemConsumeableAsset.range, EDeathCause.CHARGE, base.channel.owner.playerID.steamID, itemConsumeableAsset.playerDamageMultiplier.damage, itemConsumeableAsset.zombieDamageMultiplier.damage, itemConsumeableAsset.animalDamageMultiplier.damage, itemConsumeableAsset.barricadeDamage, itemConsumeableAsset.structureDamage, itemConsumeableAsset.vehicleDamage, itemConsumeableAsset.resourceDamage, itemConsumeableAsset.objectDamage, out list, EExplosionDamageType.CONVENTIONAL, 32f, true, false); if (itemConsumeableAsset.playerDamageMultiplier.damage > 0.5f) { EPlayerKill eplayerKill; base.player.life.askDamage(101, Vector3.up, EDeathCause.CHARGE, ELimb.SPINE, base.channel.owner.playerID.steamID, out eplayerKill); } } } } } }
// 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); } } } }
// Token: 0x06002219 RID: 8729 RVA: 0x000BB8A8 File Offset: 0x000B9CA8 private void OnTriggerEnter(Collider other) { if (other.isTrigger) { return; } if (Time.realtimeSinceStartup - this.lastActive < 0.25f) { return; } if (other.transform == base.transform.parent) { return; } if (Provider.isServer) { if (this.isExplosive) { if (other.transform.CompareTag("Player")) { if (Provider.isPvP && !other.transform.parent.CompareTag("Vehicle")) { EffectManager.sendEffect(this.explosion2, EffectManager.LARGE, base.transform.position); List <EPlayerKill> list; DamageTool.explode(base.transform.position, this.range2, EDeathCause.LANDMINE, CSteamID.Nil, this.playerDamage, this.zombieDamage, this.animalDamage, this.barricadeDamage, this.structureDamage, this.vehicleDamage, this.resourceDamage, this.objectDamage, out list, EExplosionDamageType.CONVENTIONAL, 32f, true, false); } } else { EffectManager.sendEffect(this.explosion2, EffectManager.LARGE, base.transform.position); List <EPlayerKill> list2; DamageTool.explode(base.transform.position, this.range2, EDeathCause.LANDMINE, CSteamID.Nil, this.playerDamage, this.zombieDamage, this.animalDamage, this.barricadeDamage, this.structureDamage, this.vehicleDamage, this.resourceDamage, this.objectDamage, out list2, EExplosionDamageType.CONVENTIONAL, 32f, true, false); } } else if (other.transform.CompareTag("Player")) { if (Provider.isPvP && !other.transform.parent.CompareTag("Vehicle")) { Player player = DamageTool.getPlayer(other.transform); if (player != null) { EPlayerKill eplayerKill; DamageTool.damage(player, EDeathCause.SHRED, ELimb.SPINE, CSteamID.Nil, Vector3.up, this.playerDamage, 1f, out eplayerKill); if (this.isBroken) { player.life.breakLegs(); } EffectManager.sendEffect(5, EffectManager.SMALL, base.transform.position + Vector3.up, Vector3.down); BarricadeManager.damage(base.transform.parent, 5f, 1f, false); } } } else if (other.transform.CompareTag("Agent")) { Zombie zombie = DamageTool.getZombie(other.transform); if (zombie != null) { EPlayerKill eplayerKill2; uint num; DamageTool.damage(zombie, base.transform.forward, this.zombieDamage, 1f, out eplayerKill2, out num); EffectManager.sendEffect((!zombie.isRadioactive) ? 5 : 95, EffectManager.SMALL, base.transform.position + Vector3.up, Vector3.down); BarricadeManager.damage(base.transform.parent, (!zombie.isHyper) ? 5f : 10f, 1f, false); } else { Animal animal = DamageTool.getAnimal(other.transform); if (animal != null) { EPlayerKill eplayerKill3; uint num2; DamageTool.damage(animal, base.transform.forward, this.animalDamage, 1f, out eplayerKill3, out num2); EffectManager.sendEffect(5, EffectManager.SMALL, base.transform.position + Vector3.up, Vector3.down); BarricadeManager.damage(base.transform.parent, 5f, 1f, false); } } } } }
// Token: 0x06002A36 RID: 10806 RVA: 0x00106B0C File Offset: 0x00104F0C private void onClickedMouse() { if (!MenuSurvivorsClothingUI.active && !MenuSurvivorsClothingItemUI.active) { return; } Ray ray = MainCamera.instance.ScreenPointToRay(Input.mousePosition); RaycastHit raycastHit; Physics.Raycast(ray, out raycastHit, 64f, RayMasks.CLOTHING_INTERACT); if (raycastHit.transform != null) { if (raycastHit.transform.CompareTag("Player")) { ELimb limb = DamageTool.getLimb(raycastHit.transform); if (limb == ELimb.LEFT_FOOT || limb == ELimb.LEFT_LEG || limb == ELimb.RIGHT_FOOT || limb == ELimb.RIGHT_LEG) { if (Characters.active.packagePants != 0UL) { Characters.package(Characters.active.packagePants); } } else if ((limb == ELimb.LEFT_HAND || limb == ELimb.LEFT_ARM || limb == ELimb.RIGHT_HAND || limb == ELimb.RIGHT_ARM || limb == ELimb.SPINE) && Characters.active.packageShirt != 0UL) { Characters.package(Characters.active.packageShirt); } } else if (raycastHit.transform.CompareTag("Enemy")) { if (raycastHit.transform.name == "Hat") { if (Characters.active.packageHat != 0UL) { Characters.package(Characters.active.packageHat); } } else if (raycastHit.transform.name == "Glasses") { if (Characters.active.packageGlasses != 0UL) { Characters.package(Characters.active.packageGlasses); } } else if (raycastHit.transform.name == "Mask") { if (Characters.active.packageMask != 0UL) { Characters.package(Characters.active.packageMask); } } else if (raycastHit.transform.name == "Vest") { if (Characters.active.packageVest != 0UL) { Characters.package(Characters.active.packageVest); } } else if (raycastHit.transform.name == "Backpack" && Characters.active.packageBackpack != 0UL) { Characters.package(Characters.active.packageBackpack); } } if (MenuSurvivorsClothingItemUI.active) { MenuSurvivorsClothingItemUI.viewItem(); } } }
// 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: 0x0600397E RID: 14718 RVA: 0x001AAFB4 File Offset: 0x001A93B4 private bool fire(bool mode) { if (base.channel.isOwner) { Ray ray = new Ray(base.player.look.aim.position, base.player.look.aim.forward); RaycastInfo raycastInfo = DamageTool.raycast(ray, 3f, RayMasks.DAMAGE_CLIENT); if (raycastInfo.vehicle != null) { if (mode) { if (this.fuel == 0) { return(false); } if (!raycastInfo.vehicle.isRefillable) { return(false); } } else { if (this.fuel == ((ItemFuelAsset)base.player.equipment.asset).fuel) { return(false); } if (!raycastInfo.vehicle.isSiphonable) { return(false); } } } else { if (!(raycastInfo.transform != null)) { return(false); } InteractableGenerator component = raycastInfo.transform.GetComponent <InteractableGenerator>(); InteractableOil component2 = raycastInfo.transform.GetComponent <InteractableOil>(); InteractableTank component3 = raycastInfo.transform.GetComponent <InteractableTank>(); InteractableObjectResource component4 = raycastInfo.transform.GetComponent <InteractableObjectResource>(); if (component != null) { if (mode) { if (this.fuel == 0) { return(false); } if (!component.isRefillable) { return(false); } } else { if (this.fuel == ((ItemFuelAsset)base.player.equipment.asset).fuel) { return(false); } if (!component.isSiphonable) { return(false); } } } else if (!(component2 != null)) { if (component3 != null) { if (component3.source != ETankSource.FUEL) { return(false); } if (mode) { if (this.fuel == 0) { return(false); } if (!component3.isRefillable) { return(false); } } else { if (this.fuel == ((ItemFuelAsset)base.player.equipment.asset).fuel) { return(false); } if (!component3.isSiphonable) { return(false); } } } else { if (!(component4 != null)) { return(false); } if (component4.objectAsset.interactability != EObjectInteractability.FUEL) { return(false); } if (mode) { if (this.fuel == 0) { return(false); } if (component4.amount == component4.capacity) { return(false); } } else { if (this.fuel == ((ItemFuelAsset)base.player.equipment.asset).fuel) { return(false); } if (component4.amount == 0) { return(false); } } } } } base.player.input.sendRaycast(raycastInfo); } if (Provider.isServer) { if (!base.player.input.hasInputs()) { return(false); } InputInfo input = base.player.input.getInput(true); if (input == null) { return(false); } if ((input.point - base.player.look.aim.position).sqrMagnitude > 49f) { return(false); } if (input.type == ERaycastInfoType.VEHICLE) { if (input.vehicle == null) { return(false); } if (mode) { if (this.fuel == 0) { return(false); } if (!input.vehicle.isRefillable) { return(false); } ushort num = (ushort)Mathf.Min((int)this.fuel, (int)(input.vehicle.asset.fuel - input.vehicle.fuel)); input.vehicle.askFillFuel(num); this.fuel -= num; } else { if (this.fuel == ((ItemFuelAsset)base.player.equipment.asset).fuel) { return(false); } if (!input.vehicle.isSiphonable) { return(false); } ushort num2 = (ushort)Mathf.Min((int)input.vehicle.fuel, (int)(((ItemFuelAsset)base.player.equipment.asset).fuel - this.fuel)); input.vehicle.askBurnFuel(num2); VehicleManager.sendVehicleFuel(input.vehicle, input.vehicle.fuel); this.fuel += num2; } } else if (input.type == ERaycastInfoType.BARRICADE) { if (input.transform == null || !input.transform.CompareTag("Barricade")) { return(false); } InteractableGenerator component5 = input.transform.GetComponent <InteractableGenerator>(); InteractableOil component6 = input.transform.GetComponent <InteractableOil>(); InteractableTank component7 = input.transform.GetComponent <InteractableTank>(); if (component5 != null) { if (mode) { if (this.fuel == 0) { return(false); } if (!component5.isRefillable) { return(false); } ushort num3 = (ushort)Mathf.Min((int)this.fuel, (int)(component5.capacity - component5.fuel)); component5.askFill(num3); BarricadeManager.sendFuel(input.transform, component5.fuel); this.fuel -= num3; } else { if (this.fuel == ((ItemFuelAsset)base.player.equipment.asset).fuel) { return(false); } if (!component5.isSiphonable) { return(false); } ushort num4 = (ushort)Mathf.Min((int)component5.fuel, (int)(((ItemFuelAsset)base.player.equipment.asset).fuel - this.fuel)); component5.askBurn(num4); BarricadeManager.sendFuel(input.transform, component5.fuel); this.fuel += num4; } } else if (component6 != null) { if (mode) { if (this.fuel == 0) { return(false); } if (!component6.isRefillable) { return(false); } ushort num5 = (ushort)Mathf.Min((int)this.fuel, (int)(component6.capacity - component6.fuel)); component6.askFill(num5); BarricadeManager.sendOil(input.transform, component6.fuel); this.fuel -= num5; } else { if (this.fuel == ((ItemFuelAsset)base.player.equipment.asset).fuel) { return(false); } if (!component6.isSiphonable) { return(false); } ushort num6 = (ushort)Mathf.Min((int)component6.fuel, (int)(((ItemFuelAsset)base.player.equipment.asset).fuel - this.fuel)); component6.askBurn(num6); BarricadeManager.sendOil(input.transform, component6.fuel); this.fuel += num6; } } else { if (!(component7 != null)) { return(false); } if (component7.source != ETankSource.FUEL) { return(false); } if (mode) { if (this.fuel == 0) { return(false); } if (!component7.isRefillable) { return(false); } ushort num7 = (ushort)Mathf.Min((int)this.fuel, (int)(component7.capacity - component7.amount)); BarricadeManager.updateTank(input.transform, component7.amount + num7); this.fuel -= num7; } else { if (this.fuel == ((ItemFuelAsset)base.player.equipment.asset).fuel) { return(false); } if (!component7.isSiphonable) { return(false); } ushort num8 = (ushort)Mathf.Min((int)component7.amount, (int)(((ItemFuelAsset)base.player.equipment.asset).fuel - this.fuel)); BarricadeManager.updateTank(input.transform, component7.amount - num8); this.fuel += num8; } } } else if (input.type == ERaycastInfoType.OBJECT) { if (input.transform == null) { return(false); } InteractableObjectResource component8 = input.transform.GetComponent <InteractableObjectResource>(); if (component8 == null || component8.objectAsset.interactability != EObjectInteractability.FUEL) { return(false); } if (mode) { if (this.fuel == 0) { return(false); } if (!component8.isRefillable) { return(false); } ushort num9 = (ushort)Mathf.Min((int)this.fuel, (int)(component8.capacity - component8.amount)); ObjectManager.updateObjectResource(component8.transform, component8.amount + num9, true); this.fuel -= num9; } else { if (this.fuel == ((ItemFuelAsset)base.player.equipment.asset).fuel) { return(false); } if (!component8.isSiphonable) { return(false); } ushort num10 = (ushort)Mathf.Min((int)component8.amount, (int)(((ItemFuelAsset)base.player.equipment.asset).fuel - this.fuel)); ObjectManager.updateObjectResource(component8.transform, component8.amount - num10, true); this.fuel += num10; } } } return(true); }
private void OnTriggerEnter(Collider other) { if (Provider.isServer) { if (other.isTrigger) { return; } if (other.CompareTag("Debris")) { return; } float num = Mathf.Clamp(this.vehicle.speed * this.vehicle.asset.bumperMultiplier, 0f, 10f); if (num < 3f) { return; } if (other.transform.parent.CompareTag("Vehicle")) { return; } if (other.transform.CompareTag("Player")) { if (Provider.isPvP && this.vehicle.isDriven) { Player player = DamageTool.getPlayer(other.transform); if (player != null && player.movement.getVehicle() == null && !this.vehicle.passengers[0].player.player.quests.isMemberOfSameGroupAs(player)) { EPlayerKill eplayerKill; DamageTool.damage(player, EDeathCause.ROADKILL, ELimb.SPINE, this.vehicle.passengers[0].player.playerID.steamID, base.transform.forward, Bumper.DAMAGE_PLAYER, num, out eplayerKill); EffectManager.sendEffect(5, EffectManager.SMALL, other.transform.position + other.transform.up, -base.transform.forward); this.vehicle.askDamage(2, true); } } } else if (other.transform.CompareTag("Agent")) { Zombie zombie = DamageTool.getZombie(other.transform); if (zombie != null) { EPlayerKill eplayerKill2; uint num2; DamageTool.damage(zombie, base.transform.forward, Bumper.DAMAGE_ZOMBIE, num, out eplayerKill2, out num2); EffectManager.sendEffect((!zombie.isRadioactive) ? 5 : 95, EffectManager.SMALL, other.transform.position + other.transform.up, -base.transform.forward); this.vehicle.askDamage(2, true); } else { Animal animal = DamageTool.getAnimal(other.transform); if (animal != null) { EPlayerKill eplayerKill3; uint num3; DamageTool.damage(animal, base.transform.forward, Bumper.DAMAGE_ANIMAL, num, out eplayerKill3, out num3); EffectManager.sendEffect(5, EffectManager.SMALL, other.transform.position + other.transform.up, -base.transform.forward); this.vehicle.askDamage(2, true); } } } else { if (!other.transform.CompareTag("Barricade")) { if (!other.transform.CompareTag("Structure")) { if (other.transform.CompareTag("Resource")) { DamageTool.impact(base.transform.position + base.transform.forward * ((BoxCollider)base.transform.GetComponent <Collider>()).size.z / 2f, -base.transform.forward, DamageTool.getMaterial(base.transform.position, other.transform, other.GetComponent <Collider>()), true); EPlayerKill eplayerKill4; uint num4; ResourceManager.damage(other.transform, base.transform.forward, Bumper.DAMAGE_RESOURCE, num, 1f, out eplayerKill4, out num4); this.vehicle.askDamage((ushort)(Bumper.DAMAGE_VEHICLE * num), true); } else { InteractableObjectRubble componentInParent = other.transform.GetComponentInParent <InteractableObjectRubble>(); if (componentInParent != null) { EPlayerKill eplayerKill5; uint num5; DamageTool.damage(componentInParent.transform, base.transform.forward, componentInParent.getSection(other.transform), Bumper.DAMAGE_OBJECT, num, out eplayerKill5, out num5); if (Time.realtimeSinceStartup - this.lastDamageImpact > 0.2f) { this.lastDamageImpact = Time.realtimeSinceStartup; DamageTool.impact(base.transform.position + base.transform.forward * ((BoxCollider)base.transform.GetComponent <Collider>()).size.z / 2f, -base.transform.forward, DamageTool.getMaterial(base.transform.position, other.transform, other.GetComponent <Collider>()), true); this.vehicle.askDamage((ushort)(Bumper.DAMAGE_VEHICLE * num), true); } } else if (Time.realtimeSinceStartup - this.lastDamageImpact > 0.2f) { ObjectAsset asset = LevelObjects.getAsset(other.transform); if (asset != null && !asset.isSoft) { this.lastDamageImpact = Time.realtimeSinceStartup; DamageTool.impact(base.transform.position + base.transform.forward * ((BoxCollider)base.transform.GetComponent <Collider>()).size.z / 2f, -base.transform.forward, DamageTool.getMaterial(base.transform.position, other.transform, other.GetComponent <Collider>()), true); this.vehicle.askDamage((ushort)(Bumper.DAMAGE_VEHICLE * num), true); } } } } } if (!this.vehicle.isDead && !other.transform.CompareTag("Border") && ((this.vehicle.asset.engine == EEngine.PLANE && this.vehicle.speed > 20f) || (this.vehicle.asset.engine == EEngine.HELICOPTER && this.vehicle.speed > 10f))) { this.vehicle.askDamage(20000, false); } } } }
// Token: 0x060039EC RID: 14828 RVA: 0x001BA558 File Offset: 0x001B8958 private bool fire(bool mode, out ERefillWaterType newWaterType) { newWaterType = ERefillWaterType.EMPTY; if (base.channel.isOwner) { Ray ray = new Ray(base.player.look.aim.position, base.player.look.aim.forward); RaycastInfo raycastInfo = DamageTool.raycast(ray, 3f, RayMasks.DAMAGE_CLIENT); if (!(raycastInfo.transform != null)) { return(false); } InteractableRainBarrel component = raycastInfo.transform.GetComponent <InteractableRainBarrel>(); InteractableTank component2 = raycastInfo.transform.GetComponent <InteractableTank>(); InteractableObjectResource component3 = raycastInfo.transform.GetComponent <InteractableObjectResource>(); WaterVolume waterVolume; if (WaterUtility.isPointUnderwater(raycastInfo.point, out waterVolume)) { if (mode) { return(false); } if (this.waterType != ERefillWaterType.EMPTY) { return(false); } if (waterVolume == null) { newWaterType = ERefillWaterType.SALTY; } else { newWaterType = waterVolume.waterType; } } else if (component != null) { if (mode) { if (this.waterType != ERefillWaterType.CLEAN) { return(false); } if (component.isFull) { return(false); } newWaterType = ERefillWaterType.EMPTY; } else { if (this.waterType == ERefillWaterType.CLEAN) { return(false); } if (!component.isFull) { return(false); } newWaterType = ERefillWaterType.CLEAN; } } else if (component2 != null) { if (component2.source != ETankSource.WATER) { return(false); } if (mode) { if (this.waterType != ERefillWaterType.CLEAN) { return(false); } if (component2.amount == component2.capacity) { return(false); } newWaterType = ERefillWaterType.EMPTY; } else { if (this.waterType == ERefillWaterType.CLEAN) { return(false); } if (component2.amount == 0) { return(false); } newWaterType = ERefillWaterType.CLEAN; } } else { if (!(component3 != null)) { return(false); } if (component3.objectAsset.interactability != EObjectInteractability.WATER) { return(false); } if (mode) { if (this.waterType == ERefillWaterType.EMPTY) { return(false); } if (component3.amount == component3.capacity) { return(false); } newWaterType = ERefillWaterType.EMPTY; } else { if (this.waterType == ERefillWaterType.CLEAN || this.waterType == ERefillWaterType.DIRTY) { return(false); } if (component3.amount == 0) { return(false); } newWaterType = ERefillWaterType.DIRTY; } } base.player.input.sendRaycast(raycastInfo); } if (Provider.isServer) { if (!base.player.input.hasInputs()) { return(false); } InputInfo input = base.player.input.getInput(true); if (input == null) { return(false); } if ((input.point - base.player.look.aim.position).sqrMagnitude > 49f) { return(false); } WaterVolume waterVolume2; if (WaterUtility.isPointUnderwater(input.point, out waterVolume2)) { if (mode) { return(false); } if (this.waterType != ERefillWaterType.EMPTY) { return(false); } if (waterVolume2 == null) { newWaterType = ERefillWaterType.SALTY; } else { newWaterType = waterVolume2.waterType; } } else if (input.type == ERaycastInfoType.BARRICADE) { if (input.transform == null || !input.transform.CompareTag("Barricade")) { return(false); } InteractableRainBarrel component4 = input.transform.GetComponent <InteractableRainBarrel>(); InteractableTank component5 = input.transform.GetComponent <InteractableTank>(); if (component4 != null) { if (mode) { if (this.waterType != ERefillWaterType.CLEAN) { return(false); } if (component4.isFull) { return(false); } BarricadeManager.updateRainBarrel(component4.transform, true, true); newWaterType = ERefillWaterType.EMPTY; } else { if (this.waterType == ERefillWaterType.CLEAN) { return(false); } if (!component4.isFull) { return(false); } BarricadeManager.updateRainBarrel(component4.transform, false, true); newWaterType = ERefillWaterType.CLEAN; } } else { if (!(component5 != null)) { return(false); } if (component5.source != ETankSource.WATER) { return(false); } if (mode) { if (this.waterType != ERefillWaterType.CLEAN) { return(false); } if (component5.amount == component5.capacity) { return(false); } BarricadeManager.updateTank(input.transform, (ushort)((byte)(component5.amount + 1))); newWaterType = ERefillWaterType.EMPTY; } else { if (this.waterType == ERefillWaterType.CLEAN) { return(false); } if (component5.amount == 0) { return(false); } BarricadeManager.updateTank(input.transform, (ushort)((byte)(component5.amount - 1))); newWaterType = ERefillWaterType.CLEAN; } } } else if (input.type == ERaycastInfoType.OBJECT) { if (input.transform == null) { return(false); } InteractableObjectResource component6 = input.transform.GetComponent <InteractableObjectResource>(); if (component6 == null || component6.objectAsset.interactability != EObjectInteractability.WATER) { return(false); } if (mode) { if (this.waterType == ERefillWaterType.EMPTY) { return(false); } if (component6.amount == component6.capacity) { return(false); } ObjectManager.updateObjectResource(component6.transform, (ushort)((byte)(component6.amount + 1)), true); newWaterType = ERefillWaterType.EMPTY; } else { if (this.waterType == ERefillWaterType.CLEAN || this.waterType == ERefillWaterType.DIRTY) { return(false); } if (component6.amount == 0) { return(false); } ObjectManager.updateObjectResource(component6.transform, (ushort)((byte)(component6.amount - 1)), true); newWaterType = ERefillWaterType.DIRTY; } } } return(true); }
// Token: 0x0600280E RID: 10254 RVA: 0x000F2934 File Offset: 0x000F0D34 public static Transform effect(ushort id, Vector3 point, Vector3 normal) { EffectAsset effectAsset = (EffectAsset)Assets.find(EAssetType.EFFECT, id); if (effectAsset == null) { return(null); } if (effectAsset.splatterTemperature != EPlayerTemperature.NONE) { Transform transform = new GameObject().transform; transform.name = "Temperature"; transform.parent = Level.effects; transform.position = point + Vector3.down * -2f; transform.localScale = Vector3.one * 6f; transform.gameObject.SetActive(false); transform.gameObject.AddComponent <TemperatureTrigger>().temperature = effectAsset.splatterTemperature; transform.gameObject.SetActive(true); UnityEngine.Object.Destroy(transform.gameObject, effectAsset.splatterLifetime - effectAsset.splatterLifetimeSpread); } if (Dedicator.isDedicated) { if (!effectAsset.spawnOnDedicatedServer) { return(null); } } else if (GraphicsSettings.effectQuality == EGraphicQuality.OFF && !effectAsset.splatterLiquid) { return(null); } Quaternion quaternion = Quaternion.LookRotation(normal); if (effectAsset.randomizeRotation) { quaternion *= Quaternion.Euler(0f, 0f, (float)UnityEngine.Random.Range(0, 360)); } Transform transform2 = EffectManager.pool.Instantiate(effectAsset.effect, point, quaternion).transform; transform2.name = id.ToString(); transform2.parent = Level.effects; if (effectAsset.splatter > 0 && (!effectAsset.gore || OptionsSettings.gore)) { for (int i = 0; i < (int)(effectAsset.splatter * ((effectAsset.splatterLiquid || !(Player.player != null) || Player.player.skills.boost != EPlayerBoost.SPLATTERIFIC) ? 1 : 8)); i++) { RaycastHit raycastHit; if (effectAsset.splatterLiquid) { float f = UnityEngine.Random.Range(0f, 6.28318548f); float num = UnityEngine.Random.Range(1f, 6f); Ray ray = new Ray(point + new Vector3(Mathf.Cos(f) * num, 0f, Mathf.Sin(f) * num), Vector3.down); int splatter = RayMasks.SPLATTER; LandscapeHoleUtility.raycastIgnoreLandscapeIfNecessary(ray, 8f, ref splatter); Physics.Raycast(ray, out raycastHit, 8f, splatter); } else { Ray ray2 = new Ray(point, -2f * normal + new Vector3(UnityEngine.Random.Range(-1f, 1f), UnityEngine.Random.Range(-1f, 1f), UnityEngine.Random.Range(-1f, 1f))); int splatter2 = RayMasks.SPLATTER; LandscapeHoleUtility.raycastIgnoreLandscapeIfNecessary(ray2, 8f, ref splatter2); Physics.Raycast(ray2, out raycastHit, 8f, splatter2); } if (raycastHit.transform != null) { EPhysicsMaterial material = DamageTool.getMaterial(raycastHit.point, raycastHit.transform, raycastHit.collider); if (!PhysicsTool.isMaterialDynamic(material)) { float num2 = UnityEngine.Random.Range(1f, 2f); Transform transform3 = EffectManager.pool.Instantiate(effectAsset.splatters[UnityEngine.Random.Range(0, effectAsset.splatters.Length)], raycastHit.point + raycastHit.normal * UnityEngine.Random.Range(0.04f, 0.06f), Quaternion.LookRotation(raycastHit.normal) * Quaternion.Euler(0f, 0f, (float)UnityEngine.Random.Range(0, 360))).transform; transform3.name = "Splatter"; transform3.parent = Level.effects; transform3.localScale = new Vector3(num2, num2, num2); transform3.gameObject.SetActive(true); if (effectAsset.splatterLifetime > 1.401298E-45f) { EffectManager.pool.Destroy(transform3.gameObject, effectAsset.splatterLifetime + UnityEngine.Random.Range(-effectAsset.splatterLifetimeSpread, effectAsset.splatterLifetimeSpread)); } else { EffectManager.pool.Destroy(transform3.gameObject, GraphicsSettings.effect); } } } } } if (effectAsset.gore) { transform2.GetComponent <ParticleSystem>().emission.enabled = OptionsSettings.gore; } if (!effectAsset.isStatic && transform2.GetComponent <AudioSource>() != null) { transform2.GetComponent <AudioSource>().pitch = UnityEngine.Random.Range(0.9f, 1.1f); } if (effectAsset.lifetime > 1.401298E-45f) { EffectManager.pool.Destroy(transform2.gameObject, effectAsset.lifetime + UnityEngine.Random.Range(-effectAsset.lifetimeSpread, effectAsset.lifetimeSpread)); } else { float num3 = 0f; MeshRenderer component = transform2.GetComponent <MeshRenderer>(); if (component == null) { ParticleSystem component2 = transform2.GetComponent <ParticleSystem>(); if (component2 != null) { if (component2.main.loop) { num3 = component2.main.startLifetime.constantMax; } else { num3 = component2.main.duration + component2.main.startLifetime.constantMax; } } AudioSource component3 = transform2.GetComponent <AudioSource>(); if (component3 != null && component3.clip != null && component3.clip.length > num3) { num3 = component3.clip.length; } } if (num3 < 1.401298E-45f) { num3 = GraphicsSettings.effect; } EffectManager.pool.Destroy(transform2.gameObject, num3); } if (effectAsset.blast > 0 && GraphicsSettings.blast && GraphicsSettings.renderMode == ERenderMode.DEFERRED) { EffectManager.effect(effectAsset.blast, point, new Vector3(UnityEngine.Random.Range(-0.1f, 0.1f), 1f, UnityEngine.Random.Range(-0.1f, 0.1f))); } return(transform2); }
private void Update() { if (Provider.isServer && this.power != null && this.power.isWired) { Vector3 vector = base.transform.position + new Vector3(0f, 0.65f, 0f); if (Time.realtimeSinceStartup - this.lastScan > 0.1f) { this.lastScan = Time.realtimeSinceStartup; float num = 48f; if (this.hasWeapon) { num = Mathf.Min(num, ((ItemWeaponAsset)this.displayAsset).range); } float num2 = num * num; float num3 = num2; Player player = null; Zombie zombie = null; if (Provider.isPvP) { InteractableSentry.playersInRadius.Clear(); PlayerTool.getPlayersInRadius(vector, num2, InteractableSentry.playersInRadius); for (int i = 0; i < InteractableSentry.playersInRadius.Count; i++) { Player player2 = InteractableSentry.playersInRadius[i]; if (!(player2.channel.owner.playerID.steamID == base.owner) && !player2.quests.isMemberOfGroup(base.group)) { if (!player2.life.isDead && player2.animator.gesture != EPlayerGesture.ARREST_START) { if ((!player2.movement.isSafe || !player2.movement.isSafeInfo.noWeapons) && player2.movement.canAddSimulationResultsToUpdates) { if (!(player != null) || player2.animator.gesture != EPlayerGesture.SURRENDER_START) { if (this.sentryMode != ESentryMode.FRIENDLY || Time.realtimeSinceStartup - player2.equipment.lastPunching <= 2f || (player2.equipment.isSelected && player2.equipment.asset != null && player2.equipment.asset.isDangerous)) { float sqrMagnitude = (player2.look.aim.position - vector).sqrMagnitude; if (sqrMagnitude <= num3) { Vector3 vector2 = player2.look.aim.position - vector; float magnitude = vector2.magnitude; Vector3 vector3 = vector2 / magnitude; if (!(player2 != this.targetPlayer) || Vector3.Dot(vector3, this.aimTransform.forward) >= 0.5f) { if (magnitude > 0.025f) { RaycastHit raycastHit; PhysicsUtility.raycast(new Ray(vector, vector3), out raycastHit, magnitude - 0.025f, RayMasks.BLOCK_SENTRY, 0); if (raycastHit.transform != null && raycastHit.transform != base.transform) { goto IL_35F; } PhysicsUtility.raycast(new Ray(vector + vector3 * (magnitude - 0.025f), -vector3), out raycastHit, magnitude - 0.025f, RayMasks.DAMAGE_SERVER, 0); if (raycastHit.transform != null && raycastHit.transform != base.transform) { goto IL_35F; } } num3 = sqrMagnitude; player = player2; } } } } } } } IL_35F :; } } InteractableSentry.zombiesInRadius.Clear(); ZombieManager.getZombiesInRadius(vector, num2, InteractableSentry.zombiesInRadius); for (int j = 0; j < InteractableSentry.zombiesInRadius.Count; j++) { Zombie zombie2 = InteractableSentry.zombiesInRadius[j]; if (!zombie2.isDead && zombie2.isHunting) { Vector3 vector4 = zombie2.transform.position; switch (zombie2.speciality) { case EZombieSpeciality.NORMAL: vector4 += new Vector3(0f, 1.75f, 0f); break; case EZombieSpeciality.MEGA: vector4 += new Vector3(0f, 2.625f, 0f); break; case EZombieSpeciality.CRAWLER: vector4 += new Vector3(0f, 0.25f, 0f); break; case EZombieSpeciality.SPRINTER: vector4 += new Vector3(0f, 1f, 0f); break; } float sqrMagnitude2 = (vector4 - vector).sqrMagnitude; if (sqrMagnitude2 <= num3) { Vector3 vector5 = vector4 - vector; float magnitude2 = vector5.magnitude; Vector3 vector6 = vector5 / magnitude2; if (!(zombie2 != this.targetZombie) || Vector3.Dot(vector6, this.aimTransform.forward) >= 0.5f) { if (magnitude2 > 0.025f) { RaycastHit raycastHit2; PhysicsUtility.raycast(new Ray(vector, vector6), out raycastHit2, magnitude2 - 0.025f, RayMasks.BLOCK_SENTRY, 0); if (raycastHit2.transform != null && raycastHit2.transform != base.transform) { goto IL_5B4; } PhysicsUtility.raycast(new Ray(vector + vector6 * (magnitude2 - 0.025f), -vector6), out raycastHit2, magnitude2 - 0.025f, RayMasks.DAMAGE_SERVER, 0); if (raycastHit2.transform != null && raycastHit2.transform != base.transform) { goto IL_5B4; } } num3 = sqrMagnitude2; player = null; zombie = zombie2; } } } IL_5B4 :; } if (player != this.targetPlayer || zombie != this.targetZombie) { this.targetPlayer = player; this.targetZombie = zombie; this.lastFire = Time.realtimeSinceStartup + 0.1f; } } if (this.targetPlayer != null) { ESentryMode esentryMode = this.sentryMode; if (esentryMode != ESentryMode.FRIENDLY && esentryMode != ESentryMode.NEUTRAL) { if (esentryMode == ESentryMode.HOSTILE) { this.isFiring = true; } } else { this.isFiring = (this.targetPlayer.animator.gesture != EPlayerGesture.SURRENDER_START); } this.isAiming = true; } else if (this.targetZombie != null) { this.isFiring = true; this.isAiming = true; } else { this.isFiring = false; this.isAiming = false; } if (this.isAiming && Time.realtimeSinceStartup - this.lastAim > Provider.UPDATE_TIME) { this.lastAim = Time.realtimeSinceStartup; Transform transform = null; Vector3 vector7 = Vector3.zero; if (this.targetPlayer != null) { transform = this.targetPlayer.transform; vector7 = this.targetPlayer.look.aim.position; } else if (this.targetZombie != null) { transform = this.targetZombie.transform; vector7 = this.targetZombie.transform.position; switch (this.targetZombie.speciality) { case EZombieSpeciality.NORMAL: vector7 += new Vector3(0f, 1.75f, 0f); break; case EZombieSpeciality.MEGA: vector7 += new Vector3(0f, 2.625f, 0f); break; case EZombieSpeciality.CRAWLER: vector7 += new Vector3(0f, 0.25f, 0f); break; case EZombieSpeciality.SPRINTER: vector7 += new Vector3(0f, 1f, 0f); break; } } if (transform != null) { float num4 = Mathf.Atan2(vector7.x - vector.x, vector7.z - vector.z) * 57.29578f; float num5 = Mathf.Sin((vector7.y - vector.y) / (vector7 - vector).magnitude) * 57.29578f; BarricadeManager.sendAlertSentry(base.transform, num4, num5); } } if (this.isFiring && this.hasWeapon && this.displayItem.state[10] > 0 && !this.isOpen && Time.realtimeSinceStartup - this.lastFire > this.fireTime) { this.lastFire += this.fireTime; if (Time.realtimeSinceStartup - this.lastFire > this.fireTime) { this.lastFire = Time.realtimeSinceStartup; } float num6 = (float)this.displayItem.quality / 100f; if (this.attachments.magazineAsset == null) { return; } byte[] state = this.displayItem.state; int num7 = 10; state[num7] -= 1; if (this.attachments.barrelAsset == null || !this.attachments.barrelAsset.isSilenced || this.displayItem.state[16] == 0) { AlertTool.alert(base.transform.position, 48f); } if (Provider.modeConfigData.Items.Has_Durability && this.displayItem.quality > 0 && Random.value < ((ItemWeaponAsset)this.displayAsset).durability) { if (this.displayItem.quality > ((ItemWeaponAsset)this.displayAsset).wear) { Item displayItem = this.displayItem; displayItem.quality -= ((ItemWeaponAsset)this.displayAsset).wear; } else { this.displayItem.quality = 0; } } float num8 = ((ItemGunAsset)this.displayAsset).spreadAim * ((num6 >= 0.5f) ? 1f : (1f + (1f - num6 * 2f))); if (this.attachments.tacticalAsset != null && this.interact) { num8 *= this.attachments.tacticalAsset.spread; } if (this.attachments.gripAsset != null) { num8 *= this.attachments.gripAsset.spread; } if (this.attachments.barrelAsset != null) { num8 *= this.attachments.barrelAsset.spread; } if (this.attachments.magazineAsset != null) { num8 *= this.attachments.magazineAsset.spread; } if (((ItemGunAsset)this.displayAsset).projectile == null) { BarricadeManager.sendShootSentry(base.transform); byte pellets = this.attachments.magazineAsset.pellets; for (byte b = 0; b < pellets; b += 1) { EPlayerKill eplayerKill = EPlayerKill.NONE; uint num9 = 0u; float num10 = 1f; num10 *= ((num6 >= 0.5f) ? 1f : (0.5f + num6)); Transform transform2; float magnitude3; if (this.targetPlayer != null) { transform2 = this.targetPlayer.transform; magnitude3 = (transform2.position - base.transform.position).magnitude; } else { transform2 = this.targetZombie.transform; magnitude3 = (transform2.position - base.transform.position).magnitude; } float num11 = magnitude3 / ((ItemWeaponAsset)this.displayAsset).range; num11 = 1f - num11; num11 *= 1f - ((ItemGunAsset)this.displayAsset).spreadHip; num11 *= 0.75f; if (transform2 == null || Random.value > num11) { Vector3 vector8 = this.aimTransform.forward; vector8 += this.aimTransform.right * Random.Range(-((ItemGunAsset)this.displayAsset).spreadHip, ((ItemGunAsset)this.displayAsset).spreadHip) * num8; vector8 += this.aimTransform.up * Random.Range(-((ItemGunAsset)this.displayAsset).spreadHip, ((ItemGunAsset)this.displayAsset).spreadHip) * num8; vector8.Normalize(); Ray ray; ray..ctor(this.aimTransform.position, vector8); RaycastInfo raycastInfo = DamageTool.raycast(ray, ((ItemWeaponAsset)this.displayAsset).range, RayMasks.DAMAGE_SERVER); if (!(raycastInfo.transform == null)) { DamageTool.impact(raycastInfo.point, raycastInfo.normal, raycastInfo.material, raycastInfo.vehicle != null || raycastInfo.transform.CompareTag("Barricade") || raycastInfo.transform.CompareTag("Structure") || raycastInfo.transform.CompareTag("Resource")); if (raycastInfo.vehicle != null) { DamageTool.damage(raycastInfo.vehicle, false, Vector3.zero, false, ((ItemGunAsset)this.displayAsset).vehicleDamage, num10, true, out eplayerKill); } else if (raycastInfo.transform != null) { if (raycastInfo.transform.CompareTag("Barricade")) { ushort id; if (ushort.TryParse(raycastInfo.transform.name, out id)) { ItemBarricadeAsset itemBarricadeAsset = (ItemBarricadeAsset)Assets.find(EAssetType.ITEM, id); if (itemBarricadeAsset != null && (itemBarricadeAsset.isVulnerable || ((ItemWeaponAsset)this.displayAsset).isInvulnerable)) { DamageTool.damage(raycastInfo.transform, false, ((ItemGunAsset)this.displayAsset).barricadeDamage, num10, out eplayerKill); } } } else if (raycastInfo.transform.CompareTag("Structure")) { ushort id2; if (ushort.TryParse(raycastInfo.transform.name, out id2)) { ItemStructureAsset itemStructureAsset = (ItemStructureAsset)Assets.find(EAssetType.ITEM, id2); if (itemStructureAsset != null && (itemStructureAsset.isVulnerable || ((ItemWeaponAsset)this.displayAsset).isInvulnerable)) { DamageTool.damage(raycastInfo.transform, false, raycastInfo.direction * Mathf.Ceil((float)this.attachments.magazineAsset.pellets / 2f), ((ItemGunAsset)this.displayAsset).structureDamage, num10, out eplayerKill); } } } else if (raycastInfo.transform.CompareTag("Resource")) { 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)this.displayAsset).bladeID) { DamageTool.damage(raycastInfo.transform, raycastInfo.direction * Mathf.Ceil((float)this.attachments.magazineAsset.pellets / 2f), ((ItemGunAsset)this.displayAsset).resourceDamage, num10, 1f, out eplayerKill, out num9); } } } else if (raycastInfo.section < 255) { InteractableObjectRubble component = raycastInfo.transform.GetComponent <InteractableObjectRubble>(); if (component != null && !component.isSectionDead(raycastInfo.section) && (component.asset.rubbleIsVulnerable || ((ItemWeaponAsset)this.displayAsset).isInvulnerable)) { DamageTool.damage(raycastInfo.transform, raycastInfo.direction, raycastInfo.section, ((ItemGunAsset)this.displayAsset).objectDamage, num10, out eplayerKill, out num9); } } } } } else { Vector3 vector9 = Vector3.zero; if (this.targetPlayer != null) { vector9 = this.targetPlayer.look.aim.position; } else if (this.targetZombie != null) { vector9 = this.targetZombie.transform.position; switch (this.targetZombie.speciality) { case EZombieSpeciality.NORMAL: vector9 += new Vector3(0f, 1.75f, 0f); break; case EZombieSpeciality.MEGA: vector9 += new Vector3(0f, 2.625f, 0f); break; case EZombieSpeciality.CRAWLER: vector9 += new Vector3(0f, 0.25f, 0f); break; case EZombieSpeciality.SPRINTER: vector9 += new Vector3(0f, 1f, 0f); break; } } DamageTool.impact(vector9, -this.aimTransform.forward, EPhysicsMaterial.FLESH_DYNAMIC, true); if (this.targetPlayer != null) { DamageTool.damage(this.targetPlayer, EDeathCause.SENTRY, ELimb.SPINE, base.owner, this.aimTransform.forward * Mathf.Ceil((float)this.attachments.magazineAsset.pellets / 2f), ((ItemGunAsset)this.displayAsset).playerDamageMultiplier, num10, true, out eplayerKill); } else if (this.targetZombie != null) { DamageTool.damage(this.targetZombie, ELimb.SPINE, this.aimTransform.forward * Mathf.Ceil((float)this.attachments.magazineAsset.pellets / 2f), ((ItemGunAsset)this.displayAsset).zombieDamageMultiplier, num10, true, out eplayerKill, out num9); } } } } base.rebuildState(); } } bool flag = Time.realtimeSinceStartup - this.lastAlert < 1f; if (flag != this.isAlert) { this.isAlert = flag; if (!Dedicator.isDedicated) { if (this.isAlert) { EffectManager.effect(92, base.transform.position, Vector3.up); } else { EffectManager.effect(93, base.transform.position, Vector3.up); } } if (!this.isAlert) { this.targetYaw = base.transform.localRotation.eulerAngles.y; } } if (this.power != null) { if (this.power.isWired) { if (this.isAlert) { this.lastDrift = Time.realtimeSinceStartup; this.yaw = Mathf.LerpAngle(this.yaw, this.targetYaw, 4f * Time.deltaTime); } else { this.yaw = Mathf.LerpAngle(this.yaw, this.targetYaw + Mathf.Sin(Time.realtimeSinceStartup - this.lastDrift) * 60f, 4f * Time.deltaTime); } this.pitch = Mathf.LerpAngle(this.pitch, this.targetPitch, 4f * Time.deltaTime); this.yawTransform.rotation = Quaternion.Euler(-90f, 0f, this.yaw); this.pitchTransform.localRotation = Quaternion.Euler(0f, -90f, this.pitch); } if (!Dedicator.isDedicated) { if (this.onGameObject != null) { this.onGameObject.SetActive(this.isAlert && this.power.isWired); } if (this.onModelGameObject != null) { this.onModelGameObject.SetActive(this.isAlert); if (this.onMaterial != null) { this.onMaterial.SetColor("_EmissionColor", (!this.isAlert || !this.power.isWired) ? Color.black : this.onMaterial.color); } } if (this.offGameObject != null) { this.offGameObject.SetActive(!this.isAlert && this.power.isWired); } if (this.offModelGameObject != null) { this.offModelGameObject.SetActive(!this.isAlert); if (this.offMaterial != null) { this.offMaterial.SetColor("_EmissionColor", (this.isAlert || !this.power.isWired) ? Color.black : this.offMaterial.color); } } if ((double)(Time.realtimeSinceStartup - this.lastShot) > 0.05 && this.muzzleEmitter != null) { this.muzzleEmitter.GetComponent <Light>().enabled = false; } } } }