Hristov & .60 changes - Hristov Rework, Part 2 (#31662)

* Initial commit

* Updated values to reflect new resistances

* Review fixes

* Review fixes

* LINQ BEGONETH
This commit is contained in:
SlamBamActionman
2025-02-04 22:55:09 +01:00
committed by GitHub
parent 87fa6a3b74
commit e58d031300
7 changed files with 140 additions and 12 deletions

View File

@@ -9,6 +9,7 @@ using Content.Shared.Interaction.Events;
using Content.Shared.Inventory.VirtualItem;
using Content.Shared.Item;
using Content.Shared.Movement.Components;
using Content.Shared.Movement.Systems;
using Content.Shared.Popups;
using Content.Shared.Timing;
using Content.Shared.Verbs;
@@ -27,6 +28,7 @@ namespace Content.Shared.Wieldable;
public abstract class SharedWieldableSystem : EntitySystem
{
[Dependency] private readonly MovementSpeedModifierSystem _movementSpeedModifier = default!;
[Dependency] private readonly IGameTiming _timing = default!;
[Dependency] private readonly INetManager _netManager = default!;
[Dependency] private readonly SharedAppearanceSystem _appearance = default!;
@@ -56,6 +58,9 @@ public abstract class SharedWieldableSystem : EntitySystem
SubscribeLocalEvent<GunWieldBonusComponent, ItemUnwieldedEvent>(OnGunUnwielded);
SubscribeLocalEvent<GunWieldBonusComponent, GunRefreshModifiersEvent>(OnGunRefreshModifiers);
SubscribeLocalEvent<GunWieldBonusComponent, ExaminedEvent>(OnExamine);
SubscribeLocalEvent<SpeedModifiedOnWieldComponent, ItemWieldedEvent>(OnSpeedModifierWielded);
SubscribeLocalEvent<SpeedModifiedOnWieldComponent, ItemUnwieldedEvent>(OnSpeedModifierUnwielded);
SubscribeLocalEvent<SpeedModifiedOnWieldComponent, HeldRelayedEvent<RefreshMovementSpeedModifiersEvent>>(OnRefreshSpeedWielded);
SubscribeLocalEvent<IncreaseDamageOnWieldComponent, GetMeleeDamageEvent>(OnGetMeleeDamage);
}
@@ -119,9 +124,29 @@ public abstract class SharedWieldableSystem : EntitySystem
}
}
private void OnSpeedModifierWielded(EntityUid uid, SpeedModifiedOnWieldComponent component, ItemWieldedEvent args)
{
if (args.User != null)
_movementSpeedModifier.RefreshMovementSpeedModifiers(args.User);
}
private void OnSpeedModifierUnwielded(EntityUid uid, SpeedModifiedOnWieldComponent component, ItemUnwieldedEvent args)
{
if (args.User != null)
_movementSpeedModifier.RefreshMovementSpeedModifiers(args.User);
}
private void OnRefreshSpeedWielded(EntityUid uid, SpeedModifiedOnWieldComponent component, ref HeldRelayedEvent<RefreshMovementSpeedModifiersEvent> args)
{
if (TryComp<WieldableComponent>(uid, out var wield) && wield.Wielded)
{
args.Args.ModifySpeed(component.WalkModifier, component.SprintModifier);
}
}
private void OnExamineRequires(Entity<GunRequiresWieldComponent> entity, ref ExaminedEvent args)
{
if(entity.Comp.WieldRequiresExamineMessage != null)
if (entity.Comp.WieldRequiresExamineMessage != null)
args.PushText(Loc.GetString(entity.Comp.WieldRequiresExamineMessage));
}