public override void Explode() { if (this.WaterFactor() >= 0.5f) { this.FinishUp(); return; } if (base.IsOn()) { return; } base.Invoke(new Action(this.FinishUp), this.smokeDuration); base.SetFlag(BaseEntity.Flags.On, true, false, true); base.SetFlag(BaseEntity.Flags.Open, true, false, true); base.InvalidateNetworkCache(); base.SendNetworkUpdateImmediate(false); SmokeGrenade.activeGrenades.Add(this); Sensation sensation = new Sensation() { Type = SensationType.Explosion, Position = this.creatorEntity.transform.position, Radius = this.explosionRadius * 17f, DamagePotential = 0f, InitiatorPlayer = this.creatorEntity as BasePlayer, Initiator = this.creatorEntity }; Sense.Stimulate(sensation); }
public override void OnSensation(Sensation sensation) { base.OnSensation(sensation); if (this.AiDomain != null && this.IsAlive()) { this.AiDomain.OnSensation(sensation); } }
public override void OnSensation(Sensation sensation) { base.OnSensation(sensation); if (AiDomain != null && IsAlive()) { AiDomain.OnSensation(sensation); } }
public override void OnSensation(Sensation sensation) { base.OnSensation(sensation); if (!Object.op_Inequality((Object)this.AiDomain, (Object)null) || !this.IsAlive()) { return; } this.AiDomain.OnSensation(sensation); }
private void CLProject(BaseEntity.RPCMessage msg) { BasePlayer basePlayer = msg.player; if (!this.VerifyClientAttack(basePlayer)) { base.SendNetworkUpdate(BasePlayer.NetworkQueue.Update); return; } if (this.reloadFinished && this.HasReloadCooldown()) { AntiHack.Log(basePlayer, AntiHackType.ProjectileHack, string.Concat("Reloading (", base.ShortPrefabName, ")")); basePlayer.stats.combat.Log(this, "reload_cooldown"); return; } this.reloadStarted = false; this.reloadFinished = false; if (this.primaryMagazine.contents <= 0 && !this.UsingInfiniteAmmoCheat) { AntiHack.Log(basePlayer, AntiHackType.ProjectileHack, string.Concat("Magazine empty (", base.ShortPrefabName, ")")); basePlayer.stats.combat.Log(this, "ammo_missing"); return; } ItemDefinition itemDefinition = this.primaryMagazine.ammoType; ProjectileShoot projectileShoot = ProjectileShoot.Deserialize(msg.read); if (itemDefinition.itemid != projectileShoot.ammoType) { AntiHack.Log(basePlayer, AntiHackType.ProjectileHack, string.Concat("Ammo mismatch (", base.ShortPrefabName, ")")); basePlayer.stats.combat.Log(this, "ammo_mismatch"); return; } if (!this.UsingInfiniteAmmoCheat) { this.primaryMagazine.contents--; } ItemModProjectile component = itemDefinition.GetComponent <ItemModProjectile>(); if (component == null) { AntiHack.Log(basePlayer, AntiHackType.ProjectileHack, string.Concat("Item mod not found (", base.ShortPrefabName, ")")); basePlayer.stats.combat.Log(this, "mod_missing"); return; } if (projectileShoot.projectiles.Count > component.numProjectiles) { AntiHack.Log(basePlayer, AntiHackType.ProjectileHack, string.Concat("Count mismatch (", base.ShortPrefabName, ")")); basePlayer.stats.combat.Log(this, "count_mismatch"); return; } Interface.CallHook("OnWeaponFired", this, msg.player, component, projectileShoot); base.SignalBroadcast(BaseEntity.Signal.Attack, string.Empty, msg.connection); basePlayer.CleanupExpiredProjectiles(); foreach (ProjectileShoot.Projectile projectile in projectileShoot.projectiles) { if (!basePlayer.HasFiredProjectile(projectile.projectileID)) { if (!base.ValidateEyePos(basePlayer, projectile.startPos)) { continue; } basePlayer.NoteFiredProjectile(projectile.projectileID, projectile.startPos, projectile.startVel, this, itemDefinition, null); this.CreateProjectileEffectClientside(component.projectileObject.resourcePath, projectile.startPos, projectile.startVel, projectile.seed, msg.connection, this.IsSilenced(), false); } else { AntiHack.Log(basePlayer, AntiHackType.ProjectileHack, string.Concat("Duplicate ID (", projectile.projectileID, ")")); basePlayer.stats.combat.Log(this, "duplicate_id"); } } basePlayer.stats.Add(string.Concat(component.category, "_fired"), projectileShoot.projectiles.Count <ProjectileShoot.Projectile>(), Stats.Steam); base.StartAttackCooldown(this.ScaleRepeatDelay(this.repeatDelay) + this.animationDelay); basePlayer.MarkHostileFor(60f); this.UpdateItemCondition(); this.DidAttackServerside(); float single = 0f; if (component.projectileObject != null) { GameObject gameObject = component.projectileObject.Get(); if (gameObject != null) { Projectile component1 = gameObject.GetComponent <Projectile>(); if (component1 != null) { foreach (DamageTypeEntry damageType in component1.damageTypes) { single += damageType.amount; } } } } float noiseRadius = this.NoiseRadius; if (this.IsSilenced()) { noiseRadius *= AI.npc_gun_noise_silencer_modifier; } Sensation sensation = new Sensation() { Type = SensationType.Gunshot, Position = basePlayer.transform.position, Radius = noiseRadius, DamagePotential = single, InitiatorPlayer = basePlayer, Initiator = basePlayer }; Sense.Stimulate(sensation); if (EACServer.playerTracker != null) { using (TimeWarning timeWarning = TimeWarning.New("LogPlayerShooting", 0.1f)) { UnityEngine.Vector3 networkPosition = basePlayer.GetNetworkPosition(); UnityEngine.Quaternion networkRotation = basePlayer.GetNetworkRotation(); Item item = this.GetItem(); int num = (item != null ? item.info.itemid : 0); EasyAntiCheat.Server.Hydra.Client client = EACServer.GetClient(basePlayer.net.connection); PlayerUseWeapon playerUseWeapon = new PlayerUseWeapon() { Position = new EasyAntiCheat.Server.Cerberus.Vector3(networkPosition.x, networkPosition.y, networkPosition.z), ViewRotation = new EasyAntiCheat.Server.Cerberus.Quaternion(networkRotation.x, networkRotation.y, networkRotation.z, networkRotation.w), WeaponID = num }; EACServer.playerTracker.LogPlayerUseWeapon(client, playerUseWeapon); } } }
private void DoThrow(BaseEntity.RPCMessage msg) { Sensation sensation; if (!base.HasItemAmount() || base.HasAttackCooldown()) { return; } Vector3 vector3 = msg.read.Vector3(); Vector3 vector31 = msg.read.Vector3().normalized; float single = Mathf.Clamp01(msg.read.Float()); if (msg.player.isMounted || msg.player.HasParent()) { vector3 = msg.player.eyes.position; } else if (!base.ValidateEyePos(msg.player, vector3)) { return; } BaseEntity baseEntity = GameManager.server.CreateEntity(this.prefabToThrow.resourcePath, vector3, Quaternion.LookRotation((this.overrideAngle == Vector3.zero ? -vector31 : this.overrideAngle)), true); if (baseEntity == null) { return; } baseEntity.creatorEntity = msg.player; baseEntity.SetVelocity((msg.player.GetInheritedThrowVelocity() + ((vector31 * this.maxThrowVelocity) * single)) + (msg.player.estimatedVelocity * 0.5f)); if (this.tumbleVelocity > 0f) { baseEntity.SetAngularVelocity(new Vector3(UnityEngine.Random.Range(-1f, 1f), UnityEngine.Random.Range(-1f, 1f), UnityEngine.Random.Range(-1f, 1f)) * this.tumbleVelocity); } baseEntity.Spawn(); base.StartAttackCooldown(this.repeatDelay); Interface.CallHook("OnExplosiveThrown", msg.player, baseEntity, this); base.UseItemAmount(1); BasePlayer basePlayer = msg.player; if (basePlayer != null) { TimedExplosive timedExplosive = baseEntity as TimedExplosive; if (timedExplosive != null) { float single1 = 0f; foreach (DamageTypeEntry damageType in timedExplosive.damageTypes) { single1 += damageType.amount; } sensation = new Sensation() { Type = SensationType.ThrownWeapon, Position = basePlayer.transform.position, Radius = 50f, DamagePotential = single1, InitiatorPlayer = basePlayer, Initiator = basePlayer, UsedEntity = timedExplosive }; Sense.Stimulate(sensation); return; } sensation = new Sensation() { Type = SensationType.ThrownWeapon, Position = basePlayer.transform.position, Radius = 50f, DamagePotential = 0f, InitiatorPlayer = basePlayer, Initiator = basePlayer, UsedEntity = this }; Sense.Stimulate(sensation); } }
public void ServerThrow(Vector3 targetPosition) { Sensation sensation; if (base.isClient) { return; } if (!base.HasItemAmount() || base.HasAttackCooldown()) { return; } BasePlayer ownerPlayer = base.GetOwnerPlayer(); if (ownerPlayer == null) { return; } Vector3 vector3 = ownerPlayer.eyes.position; Vector3 vector31 = ownerPlayer.eyes.BodyForward(); float single = 1f; base.SignalBroadcast(BaseEntity.Signal.Throw, string.Empty, null); BaseEntity baseEntity = GameManager.server.CreateEntity(this.prefabToThrow.resourcePath, vector3, Quaternion.LookRotation((this.overrideAngle == Vector3.zero ? -vector31 : this.overrideAngle)), true); if (baseEntity == null) { return; } baseEntity.creatorEntity = ownerPlayer; Vector3 vector32 = vector31 + (Quaternion.AngleAxis(10f, Vector3.right) * Vector3.up); float throwVelocity = this.GetThrowVelocity(vector3, targetPosition, vector32); if (float.IsNaN(throwVelocity)) { vector32 = vector31 + (Quaternion.AngleAxis(20f, Vector3.right) * Vector3.up); throwVelocity = this.GetThrowVelocity(vector3, targetPosition, vector32); if (float.IsNaN(throwVelocity)) { throwVelocity = 5f; } } baseEntity.SetVelocity((vector32 * throwVelocity) * single); if (this.tumbleVelocity > 0f) { baseEntity.SetAngularVelocity(new Vector3(UnityEngine.Random.Range(-1f, 1f), UnityEngine.Random.Range(-1f, 1f), UnityEngine.Random.Range(-1f, 1f)) * this.tumbleVelocity); } baseEntity.Spawn(); base.StartAttackCooldown(this.repeatDelay); base.UseItemAmount(1); TimedExplosive timedExplosive = baseEntity as TimedExplosive; if (timedExplosive == null) { sensation = new Sensation() { Type = SensationType.ThrownWeapon, Position = ownerPlayer.transform.position, Radius = 50f, DamagePotential = 0f, InitiatorPlayer = ownerPlayer, Initiator = ownerPlayer, UsedEntity = this }; Sense.Stimulate(sensation); return; } float single1 = 0f; foreach (DamageTypeEntry damageType in timedExplosive.damageTypes) { single1 += damageType.amount; } sensation = new Sensation() { Type = SensationType.ThrownWeapon, Position = ownerPlayer.transform.position, Radius = 50f, DamagePotential = single1, InitiatorPlayer = ownerPlayer, Initiator = ownerPlayer, UsedEntity = timedExplosive }; Sense.Stimulate(sensation); }
public abstract void OnSensation(Sensation sensation);
private void CLProject(BaseEntity.RPCMessage msg) { BasePlayer basePlayer = msg.player; if (!this.VerifyClientAttack(basePlayer)) { base.SendNetworkUpdate(BasePlayer.NetworkQueue.Update); return; } if (basePlayer == null) { return; } if (basePlayer.IsHeadUnderwater()) { return; } if (!this.canThrowAsProjectile) { AntiHack.Log(basePlayer, AntiHackType.ProjectileHack, string.Concat("Not throwable (", base.ShortPrefabName, ")")); basePlayer.stats.combat.Log(this, "not_throwable"); return; } Item item = this.GetItem(); if (item == null) { AntiHack.Log(basePlayer, AntiHackType.ProjectileHack, string.Concat("Item not found (", base.ShortPrefabName, ")")); basePlayer.stats.combat.Log(this, "item_missing"); return; } ItemModProjectile component = item.info.GetComponent <ItemModProjectile>(); if (component == null) { AntiHack.Log(basePlayer, AntiHackType.ProjectileHack, string.Concat("Item mod not found (", base.ShortPrefabName, ")")); basePlayer.stats.combat.Log(this, "mod_missing"); return; } ProjectileShoot projectileShoot = ProjectileShoot.Deserialize(msg.read); if (projectileShoot.projectiles.Count != 1) { AntiHack.Log(basePlayer, AntiHackType.ProjectileHack, string.Concat("Projectile count mismatch (", base.ShortPrefabName, ")")); basePlayer.stats.combat.Log(this, "count_mismatch"); return; } basePlayer.CleanupExpiredProjectiles(); foreach (ProjectileShoot.Projectile projectile in projectileShoot.projectiles) { if (!basePlayer.HasFiredProjectile(projectile.projectileID)) { if (!base.ValidateEyePos(basePlayer, projectile.startPos)) { continue; } basePlayer.NoteFiredProjectile(projectile.projectileID, projectile.startPos, projectile.startVel, this, item.info, item); Effect effect = new Effect(); effect.Init(Effect.Type.Projectile, projectile.startPos, projectile.startVel, msg.connection); effect.scale = 1f; effect.pooledString = component.projectileObject.resourcePath; effect.number = projectile.seed; EffectNetwork.Send(effect); } else { AntiHack.Log(basePlayer, AntiHackType.ProjectileHack, string.Concat("Duplicate ID (", projectile.projectileID, ")")); basePlayer.stats.combat.Log(this, "duplicate_id"); } } item.SetParent(null); Interface.CallHook("OnMeleeThrown", basePlayer, item); if (this.canAiHearIt) { float single = 0f; if (component.projectileObject != null) { GameObject gameObject = component.projectileObject.Get(); if (gameObject != null) { Projectile component1 = gameObject.GetComponent <Projectile>(); if (component1 != null) { foreach (DamageTypeEntry damageType in component1.damageTypes) { single += damageType.amount; } } } } if (basePlayer != null) { Sensation sensation = new Sensation() { Type = SensationType.ThrownWeapon, Position = basePlayer.transform.position, Radius = 50f, DamagePotential = single, InitiatorPlayer = basePlayer, Initiator = basePlayer }; Sense.Stimulate(sensation); } } }
private void CLProject(RPCMessage msg) { BasePlayer player = msg.player; if (!VerifyClientAttack(player)) { SendNetworkUpdate(); } else { if (player == null || player.IsHeadUnderwater()) { return; } if (!canThrowAsProjectile) { AntiHack.Log(player, AntiHackType.ProjectileHack, "Not throwable (" + base.ShortPrefabName + ")"); player.stats.combat.Log(this, "not_throwable"); return; } Item item = GetItem(); if (item == null) { AntiHack.Log(player, AntiHackType.ProjectileHack, "Item not found (" + base.ShortPrefabName + ")"); player.stats.combat.Log(this, "item_missing"); return; } ItemModProjectile component = item.info.GetComponent <ItemModProjectile>(); if (component == null) { AntiHack.Log(player, AntiHackType.ProjectileHack, "Item mod not found (" + base.ShortPrefabName + ")"); player.stats.combat.Log(this, "mod_missing"); return; } ProjectileShoot projectileShoot = ProjectileShoot.Deserialize(msg.read); if (projectileShoot.projectiles.Count != 1) { AntiHack.Log(player, AntiHackType.ProjectileHack, "Projectile count mismatch (" + base.ShortPrefabName + ")"); player.stats.combat.Log(this, "count_mismatch"); return; } player.CleanupExpiredProjectiles(); foreach (ProjectileShoot.Projectile projectile in projectileShoot.projectiles) { if (player.HasFiredProjectile(projectile.projectileID)) { AntiHack.Log(player, AntiHackType.ProjectileHack, "Duplicate ID (" + projectile.projectileID + ")"); player.stats.combat.Log(this, "duplicate_id"); } else if (ValidateEyePos(player, projectile.startPos)) { player.NoteFiredProjectile(projectile.projectileID, projectile.startPos, projectile.startVel, this, item.info, item); Effect effect = new Effect(); effect.Init(Effect.Type.Projectile, projectile.startPos, projectile.startVel, msg.connection); effect.scale = 1f; effect.pooledString = component.projectileObject.resourcePath; effect.number = projectile.seed; EffectNetwork.Send(effect); } } projectileShoot?.Dispose(); item.SetParent(null); Interface.CallHook("OnMeleeThrown", player, item); if (!canAiHearIt) { return; } float num = 0f; if (component.projectileObject != null) { GameObject gameObject = component.projectileObject.Get(); if (gameObject != null) { Projectile component2 = gameObject.GetComponent <Projectile>(); if (component2 != null) { foreach (DamageTypeEntry damageType in component2.damageTypes) { num += damageType.amount; } } } } if (player != null) { Sensation sensation = default(Sensation); sensation.Type = SensationType.ThrownWeapon; sensation.Position = player.transform.position; sensation.Radius = 50f; sensation.DamagePotential = num; sensation.InitiatorPlayer = player; sensation.Initiator = player; Sense.Stimulate(sensation); } } }
private void CLProject(RPCMessage msg) { BasePlayer player = msg.player; if (!VerifyClientAttack(player)) { SendNetworkUpdate(); return; } if (reloadFinished && HasReloadCooldown()) { AntiHack.Log(player, AntiHackType.ProjectileHack, "Reloading (" + base.ShortPrefabName + ")"); player.stats.combat.Log(this, "reload_cooldown"); return; } reloadStarted = false; reloadFinished = false; if (primaryMagazine.contents <= 0 && !UsingInfiniteAmmoCheat) { AntiHack.Log(player, AntiHackType.ProjectileHack, "Magazine empty (" + base.ShortPrefabName + ")"); player.stats.combat.Log(this, "ammo_missing"); return; } ItemDefinition primaryMagazineAmmo = PrimaryMagazineAmmo; ProjectileShoot projectileShoot = ProjectileShoot.Deserialize(msg.read); if (primaryMagazineAmmo.itemid != projectileShoot.ammoType) { AntiHack.Log(player, AntiHackType.ProjectileHack, "Ammo mismatch (" + base.ShortPrefabName + ")"); player.stats.combat.Log(this, "ammo_mismatch"); return; } if (!UsingInfiniteAmmoCheat) { primaryMagazine.contents--; } ItemModProjectile component = primaryMagazineAmmo.GetComponent <ItemModProjectile>(); if (component == null) { AntiHack.Log(player, AntiHackType.ProjectileHack, "Item mod not found (" + base.ShortPrefabName + ")"); player.stats.combat.Log(this, "mod_missing"); return; } if (projectileShoot.projectiles.Count > component.numProjectiles) { AntiHack.Log(player, AntiHackType.ProjectileHack, "Count mismatch (" + base.ShortPrefabName + ")"); player.stats.combat.Log(this, "count_mismatch"); return; } Interface.CallHook("OnWeaponFired", this, msg.player, component, projectileShoot); if (player.InGesture) { return; } SignalBroadcast(Signal.Attack, string.Empty, msg.connection); player.CleanupExpiredProjectiles(); foreach (ProjectileShoot.Projectile projectile in projectileShoot.projectiles) { if (player.HasFiredProjectile(projectile.projectileID)) { AntiHack.Log(player, AntiHackType.ProjectileHack, "Duplicate ID (" + projectile.projectileID + ")"); player.stats.combat.Log(this, "duplicate_id"); } else if (ValidateEyePos(player, projectile.startPos)) { player.NoteFiredProjectile(projectile.projectileID, projectile.startPos, projectile.startVel, this, primaryMagazineAmmo); if (!player.limitNetworking) { CreateProjectileEffectClientside(component.projectileObject.resourcePath, projectile.startPos, projectile.startVel, projectile.seed, msg.connection, IsSilenced()); } } } player.MakeNoise(player.transform.position, BaseCombatEntity.ActionVolume.Loud); player.stats.Add(component.category + "_fired", projectileShoot.projectiles.Count(), (Stats)5); player.LifeStoryShotFired(this); StartAttackCooldown(ScaleRepeatDelay(repeatDelay) + animationDelay); player.MarkHostileFor(); UpdateItemCondition(); DidAttackServerside(); float num = 0f; if (component.projectileObject != null) { GameObject gameObject = component.projectileObject.Get(); if (gameObject != null) { Projectile component2 = gameObject.GetComponent <Projectile>(); if (component2 != null) { foreach (DamageTypeEntry damageType in component2.damageTypes) { num += damageType.amount; } } } } float num2 = NoiseRadius; if (IsSilenced()) { num2 *= AI.npc_gun_noise_silencer_modifier; } Sensation sensation = default(Sensation); sensation.Type = SensationType.Gunshot; sensation.Position = player.transform.position; sensation.Radius = num2; sensation.DamagePotential = num; sensation.InitiatorPlayer = player; sensation.Initiator = player; Sense.Stimulate(sensation); if (EACServer.playerTracker != null) { using (TimeWarning.New("LogPlayerShooting")) { UnityEngine.Vector3 networkPosition = player.GetNetworkPosition(); UnityEngine.Quaternion networkRotation = player.GetNetworkRotation(); int weaponID = GetItem()?.info.itemid ?? 0; EasyAntiCheat.Server.Hydra.Client client = EACServer.GetClient(player.net.connection); PlayerUseWeapon eventParams = default(PlayerUseWeapon); eventParams.Position = new EasyAntiCheat.Server.Cerberus.Vector3(networkPosition.x, networkPosition.y, networkPosition.z); eventParams.ViewRotation = new EasyAntiCheat.Server.Cerberus.Quaternion(networkRotation.w, networkRotation.x, networkRotation.y, networkRotation.z); eventParams.WeaponID = weaponID; EACServer.playerTracker.LogPlayerUseWeapon(client, eventParams); } } }
public virtual void Explode() { BaseCombatEntity i; Sensation sensation; base.GetComponent <Collider>().enabled = false; if (this.explosionEffect.isValid) { Effect.server.Run(this.explosionEffect.resourcePath, base.PivotPoint(), (this.explosionUsesForward ? base.transform.forward : Vector3.up), null, true); } if (this.damageTypes.Count > 0) { if (!this.onlyDamageParent) { DamageUtil.RadiusDamage(this.creatorEntity, base.LookupPrefab(), base.CenterPoint(), this.minExplosionRadius, this.explosionRadius, this.damageTypes, 1075980544, true); if (this.creatorEntity != null && this.damageTypes != null) { float single = 0f; foreach (DamageTypeEntry damageType in this.damageTypes) { single += damageType.amount; } sensation = new Sensation() { Type = SensationType.Explosion, Position = this.creatorEntity.transform.position, Radius = this.explosionRadius * 17f, DamagePotential = single, InitiatorPlayer = this.creatorEntity as BasePlayer, Initiator = this.creatorEntity }; Sense.Stimulate(sensation); } } else { DamageUtil.RadiusDamage(this.creatorEntity, base.LookupPrefab(), base.CenterPoint(), this.minExplosionRadius, this.explosionRadius, this.damageTypes, 141568, true); BaseEntity parentEntity = base.GetParentEntity(); for (i = parentEntity as BaseCombatEntity; i == null && parentEntity != null && parentEntity.HasParent(); i = parentEntity as BaseCombatEntity) { parentEntity = parentEntity.GetParentEntity(); } if (i) { HitInfo hitInfo = new HitInfo() { Initiator = this.creatorEntity, WeaponPrefab = base.LookupPrefab() }; hitInfo.damageTypes.Add(this.damageTypes); i.Hurt(hitInfo); } if (this.creatorEntity != null && this.damageTypes != null) { float single1 = 0f; foreach (DamageTypeEntry damageTypeEntry in this.damageTypes) { single1 += damageTypeEntry.amount; } sensation = new Sensation() { Type = SensationType.Explosion, Position = this.creatorEntity.transform.position, Radius = this.explosionRadius * 17f, DamagePotential = single1, InitiatorPlayer = this.creatorEntity as BasePlayer, Initiator = this.creatorEntity }; Sense.Stimulate(sensation); } } } if (base.IsDestroyed) { return; } base.Kill(BaseNetworkable.DestroyMode.Gib); }