Баффы (#510)
* Moodsystem cleanups * remove overhydrated and overfed mood debuffs * admins now join game deadmined + new player timers * faster arrivals * recharging rcd with metal, glass, plastic or cable coils * better timings and costs + building apc and camera * preparing for rpd * RPD + make RCD more generic * add rpd to atmos lockers, rcd to engivend * rcd and rpd to technologies * dont deadmin me in debug * rcd ammo buff * add ChargeCountModifier logic for non stackable items * increase time to become experienced player * Dynamic Radial Menus (#29678) * fix * Clean Some Code * Some Commentaries * Update Content.Client/UserInterface/Controls/RadialContainer.cs * Update Content.Client/UserInterface/Controls/RadialContainer.cs --------- Co-authored-by: metalgearsloth <31366439+metalgearsloth@users.noreply.github.com> * more dynamically parameters --------- Co-authored-by: Rinary <72972221+Rinary1@users.noreply.github.com> Co-authored-by: metalgearsloth <31366439+metalgearsloth@users.noreply.github.com>
This commit is contained in:
@@ -4,6 +4,7 @@ using Content.Shared.Examine;
|
||||
using Content.Shared.Interaction;
|
||||
using Content.Shared.Popups;
|
||||
using Content.Shared.RCD.Components;
|
||||
using Content.Shared.Stacks;
|
||||
using Robust.Shared.Timing;
|
||||
|
||||
namespace Content.Shared.RCD.Systems;
|
||||
@@ -13,20 +14,37 @@ public sealed class RCDAmmoSystem : EntitySystem
|
||||
[Dependency] private readonly SharedChargesSystem _charges = default!;
|
||||
[Dependency] private readonly SharedPopupSystem _popup = default!;
|
||||
[Dependency] private readonly IGameTiming _timing = default!;
|
||||
[Dependency] private readonly SharedStackSystem _stack = default!;
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
base.Initialize();
|
||||
|
||||
SubscribeLocalEvent<RCDAmmoComponent, ComponentInit>(OnInit); // WD edit
|
||||
|
||||
SubscribeLocalEvent<RCDAmmoComponent, ExaminedEvent>(OnExamine);
|
||||
SubscribeLocalEvent<RCDAmmoComponent, AfterInteractEvent>(OnAfterInteract);
|
||||
}
|
||||
|
||||
// WD edit start
|
||||
private void OnInit(EntityUid uid, RCDAmmoComponent rcdAmmoComponent, ComponentInit _)
|
||||
{
|
||||
if (TryComp<StackComponent>(uid, out var stackComponent))
|
||||
rcdAmmoComponent.Charges = (int) (stackComponent.Count * rcdAmmoComponent.ChargeCountModifier);
|
||||
else
|
||||
rcdAmmoComponent.Charges = (int) (rcdAmmoComponent.Charges * rcdAmmoComponent.ChargeCountModifier);
|
||||
|
||||
}
|
||||
// WD edit end
|
||||
|
||||
private void OnExamine(EntityUid uid, RCDAmmoComponent comp, ExaminedEvent args)
|
||||
{
|
||||
if (!args.IsInDetailsRange)
|
||||
return;
|
||||
|
||||
if (!comp.CanBeExamined) // WD edit
|
||||
return;
|
||||
|
||||
var examineMessage = Loc.GetString("rcd-ammo-component-on-examine", ("charges", comp.Charges));
|
||||
args.PushText(examineMessage);
|
||||
}
|
||||
@@ -51,6 +69,15 @@ public sealed class RCDAmmoSystem : EntitySystem
|
||||
}
|
||||
|
||||
_popup.PopupClient(Loc.GetString("rcd-ammo-component-after-interact-refilled"), target, user);
|
||||
|
||||
// WD edit start
|
||||
if (TryComp<StackComponent>(uid, out var stackComponent))
|
||||
{
|
||||
var spent = (int) (count / comp.ChargeCountModifier) == 0 ? 1 : (int) (count / comp.ChargeCountModifier);
|
||||
_stack.SetCount(uid, stackComponent.Count - spent);
|
||||
}
|
||||
// WD edit end
|
||||
|
||||
_charges.AddCharges(target, count, charges);
|
||||
comp.Charges -= count;
|
||||
Dirty(uid, comp);
|
||||
|
||||
Reference in New Issue
Block a user