public void OnDamage(ShMovable movable, DamageIndex damageIndex, float amount, ShPlayer attacker, Collider collider, float hitY) { base.OnDamage(movable, damageIndex, amount, attacker, collider, hitY); movable.svMovable.Send(SvSendType.Local, Channel.Reliable, ClPacket.UpdateHealth, movable.ID, movable.health); }
public void OnDamage(ShMovable movable, DamageIndex damageIndex, float amount, ShPlayer attacker, Collider collider, Vector3 source, Vector3 hitPoint) { base.OnDamage(movable, damageIndex, amount, attacker, collider, source, hitPoint); movable.svMovable.Send(SvSendType.Local, Channel.Reliable, ClPacket.UpdateHealth, movable.ID, movable.health, (hitPoint == default) ? 0f : movable.OutsideController ? movable.controller.GetFlatAngle(source) : movable.GetFlatAngle(source)); }
public void OnEvent(ShPlayer player, DamageIndex damageIndex, float amount, ShPlayer attacker, Collider collider) { if (!player.isHuman) { return; } if (player.GetExtendedPlayer().HasGodmode) { player.SendChatMessage($"Damage blocked: {amount}HP. (Attacker: {attacker.ID}: {attacker.username.SanitizeString()})"); } }
public static bool Damage(SvPlayer player, ref DamageIndex type, ref float amount, ref ShPlayer attacker, ref Collider collider) { if (CheckGodMode.Run(player, amount)) { return(true); } if (player.WillDieByDamage(amount)) { OnDeath(player, ref type, ref amount, ref attacker, ref collider); } return(false); }
public void OnDamage(ShDestroyable destroyable, DamageIndex damageIndex, float amount, ShPlayer attacker, Collider collider, float hitY) { if (destroyable.IsDead) { return; } destroyable.health -= amount; if (destroyable.health <= 0f) { destroyable.svDestroyable.thrower = attacker; destroyable.ShDie(); } }
public void OnDamage(ShPlayer player, DamageIndex damageIndex, float amount, ShPlayer attacker, Collider collider) { if (player.IsDead || player.IsShielded(damageIndex, collider)) { return; } if (player.IsBlocking(damageIndex)) { amount *= 0.3f; } else if (collider == player.headCollider) // Headshot { amount *= 2f; } if (!player.isHuman) { amount /= player.svPlayer.svManager.settings.difficulty; } amount -= amount * (player.armorLevel / player.maxStat * 0.5f); base.OnDamage(player, damageIndex, amount, attacker, collider); if (player.IsDead) { return; } // Still alive, do knockdown and Assault crimes if (player.stance.setable) { if (player.isHuman && player.health < 15f) { player.svPlayer.SvForceStance(StanceIndex.KnockedOut); // If knockout AI, set AI state Null } else if (UnityEngine.Random.value < player.manager.damageTypes[(int)damageIndex].fallChance) { player.StartCoroutine(player.svPlayer.KnockedDown()); } } if (attacker && attacker != player) { if (player.wantedLevel == 0) { if (attacker.curEquipable is ShGun) { attacker.svPlayer.SvAddCrime(CrimeIndex.ArmedAssault, player); } else { attacker.svPlayer.SvAddCrime(CrimeIndex.Assault, player); } } if (!player.isHuman) { player.svPlayer.targetEntity = attacker; player.svPlayer.SetState(StateIndex.Attack); } } }