mirror of
https://github.com/WWhiteDreamProject/wwdpublic.git
synced 2026-04-17 21:48:58 +03:00
* I hate it * Added ability to choose target body part on item throwing * забыл * WeaponRandom works with throwable weapon * RadialEntityMorph & RadialBUI fix * ru&en localization * Я себя зарежу нахуй за такое * Правки рисованной хуйни и прототипы с лодаутами * fuck * ну хорошо блять, убедил, одну пустую строчку уберу * loadout move to _White * Я после тех 3х банок не помню нахуй это нужно было * 1 more fix
69 lines
2.7 KiB
C#
69 lines
2.7 KiB
C#
using Content.Shared.Camera;
|
|
using Content.Shared.CombatMode.Pacification;
|
|
using Content.Shared.Damage;
|
|
using Content.Shared.Damage.Components;
|
|
using Content.Shared.Damage.Events;
|
|
using Content.Shared.Damage.Systems;
|
|
using Content.Shared.Database;
|
|
using Content.Shared.Effects;
|
|
using Content.Shared.Item.ItemToggle.Components;
|
|
using Content.Shared.Mobs.Components;
|
|
using Content.Shared.Projectiles;
|
|
using Content.Shared.Popups;
|
|
using Content.Shared.Throwing;
|
|
using Content.Shared.Weapons.Melee;
|
|
using Content.Server.Weapons.Melee;
|
|
using Robust.Server.GameObjects;
|
|
using Robust.Shared.Audio;
|
|
using Robust.Shared.Physics.Components;
|
|
using Robust.Shared.Player;
|
|
using Robust.Shared.Prototypes;
|
|
using Robust.Shared.Utility;
|
|
|
|
namespace Content.Server.Damage.Systems
|
|
{
|
|
public sealed class DamageOtherOnHitSystem : SharedDamageOtherOnHitSystem
|
|
{
|
|
[Dependency] private readonly DamageExamineSystem _damageExamine = default!;
|
|
[Dependency] private readonly SharedPopupSystem _popup = default!;
|
|
[Dependency] private readonly StaminaSystem _stamina = default!;
|
|
|
|
public override void Initialize()
|
|
{
|
|
base.Initialize();
|
|
|
|
SubscribeLocalEvent<StaminaComponent, BeforeThrowEvent>(OnBeforeThrow, after: [typeof(PacificationSystem)]);
|
|
SubscribeLocalEvent<DamageOtherOnHitComponent, DamageExamineEvent>(OnDamageExamine, after: [typeof(MeleeWeaponSystem)]);
|
|
}
|
|
|
|
private void OnBeforeThrow(EntityUid uid, StaminaComponent component, ref BeforeThrowEvent args)
|
|
{
|
|
if (args.Cancelled || !TryComp<DamageOtherOnHitComponent>(args.ItemUid, out var damage))
|
|
return;
|
|
|
|
if (component.CritThreshold - component.StaminaDamage <= damage.StaminaCost)
|
|
{
|
|
args.Cancelled = true;
|
|
_popup.PopupEntity(Loc.GetString("throw-no-stamina", ("item", args.ItemUid)), uid, uid);
|
|
return;
|
|
}
|
|
|
|
_stamina.TakeStaminaDamage(uid, damage.StaminaCost, component, visual: false);
|
|
}
|
|
|
|
private void OnDamageExamine(EntityUid uid, DamageOtherOnHitComponent component, ref DamageExamineEvent args)
|
|
{
|
|
_damageExamine.AddDamageExamine(args.Message, GetDamage(uid, component, args.User, true), Loc.GetString("damage-throw"));//WWDP EDIT
|
|
|
|
if (component.StaminaCost == 0)
|
|
return;
|
|
|
|
var staminaCostMarkup = FormattedMessage.FromMarkupOrThrow(
|
|
Loc.GetString("damage-stamina-cost",
|
|
("type", Loc.GetString("damage-throw")), ("cost", Math.Round(component.StaminaCost, 2).ToString("0.##"))));
|
|
args.Message.PushNewline();
|
|
args.Message.AddMessage(staminaCostMarkup);
|
|
}
|
|
}
|
|
}
|