mirror of
https://github.com/WWhiteDreamProject/wwdpublic.git
synced 2026-04-18 14:07:53 +03:00
<!-- This is a semi-strict format, you can add/remove sections as needed but the order/format should be kept the same Remove these comments before submitting --> # Description <!-- Explain this PR in as much detail as applicable Some example prompts to consider: How might this affect the game? The codebase? What might be some alternatives to this? How/Who does this benefit/hurt [the game/codebase]? --> Finishes BSO and Nanorep. --- # TODO - [x] Jobs - [x] Clothing - [x] BSO weapons - [x] Loadouts - [x] Mapping - [x] Set map prototypes --- # Changelog <!-- You can add an author after the `🆑` to change the name that appears in the changelog (ex: `🆑 Death`) Leaving it blank will default to your GitHub display name This includes all available types for the changelog --> 🆑 sleepyapril, Goob Station contributors - add: Added Nanotrasen Representative and Blueshield Officer - add: Added Admin Assistant, Nanorep, and Blueshield Officer spawns to all maps. BSO and Nanorep don't get an office, they get a unique teleporter. (as of now) Ask your resident mapper to fix this. - add: Added the loadout options for Nanotrasen Representative and Blueshield Officer. --------- Co-authored-by: Aidenkrz <aiden@djkraz.com> Co-authored-by: Icepick <122653407+Icepicked@users.noreply.github.com> Co-authored-by: Memeji <greyalphawolf7@gmail.com> Co-authored-by: Theapug <159912420+Teapug@users.noreply.github.com> Co-authored-by: DarkenedSynergy <70016079+DarkenedSynergy@users.noreply.github.com> Co-authored-by: Solstice <solsticeofthewinter@gmail.com> Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> Co-authored-by: BombasterDS <115770678+BombasterDS@users.noreply.github.com> Co-authored-by: starch <starchpersonal@gmail.com> Co-authored-by: BombasterDS2 <shvalovdenis.workmail@gmail.com> Co-authored-by: BombasterDS <deniskaporoshok@gmail.com> Co-authored-by: Piras314 <p1r4s@proton.me> (cherry picked from commit a848973a49df8e84d23d13620f7599d2673ccbe7)
102 lines
3.6 KiB
C#
102 lines
3.6 KiB
C#
using Content.Shared.DoAfter;
|
|
using Content.Shared.Ensnaring.Components;
|
|
using Content.Shared.Movement.Systems;
|
|
using Robust.Shared.GameStates;
|
|
using Robust.Shared.Serialization;
|
|
|
|
namespace Content.Shared.Ensnaring;
|
|
|
|
[Serializable, NetSerializable]
|
|
public sealed partial class EnsnareableDoAfterEvent : SimpleDoAfterEvent
|
|
{
|
|
}
|
|
|
|
public abstract class SharedEnsnareableSystem : EntitySystem
|
|
{
|
|
[Dependency] private readonly MovementSpeedModifierSystem _speedModifier = default!;
|
|
[Dependency] protected readonly SharedAppearanceSystem Appearance = default!;
|
|
|
|
public override void Initialize()
|
|
{
|
|
base.Initialize();
|
|
|
|
SubscribeLocalEvent<EnsnareableComponent, RefreshMovementSpeedModifiersEvent>(MovementSpeedModify);
|
|
SubscribeLocalEvent<EnsnareableComponent, EnsnareEvent>(OnEnsnare);
|
|
SubscribeLocalEvent<EnsnareableComponent, EnsnareRemoveEvent>(OnEnsnareRemove);
|
|
SubscribeLocalEvent<EnsnareableComponent, EnsnaredChangedEvent>(OnEnsnareChange);
|
|
//SubscribeLocalEvent<EnsnaringComponent, ProjectileHitEvent>(OnProjectileHit); // Goobstation - TODO: add after ensnareable refactor
|
|
SubscribeLocalEvent<EnsnareableComponent, ComponentGetState>(OnGetState);
|
|
SubscribeLocalEvent<EnsnareableComponent, ComponentHandleState>(OnHandleState);
|
|
}
|
|
|
|
// // Goobstation - TODO: add after ensnareable refactor
|
|
// private void OnProjectileHit(EntityUid uid, EnsnaringComponent component, ProjectileHitEvent args)
|
|
// {
|
|
// if (!component.CanThrowTrigger)
|
|
// return;
|
|
//
|
|
// if (TryEnsnare(args.Target, uid, component))
|
|
// {
|
|
// _audio.PlayPvs(component.EnsnareSound, uid);
|
|
// }
|
|
// }
|
|
|
|
private void OnHandleState(EntityUid uid, EnsnareableComponent component, ref ComponentHandleState args)
|
|
{
|
|
if (args.Current is not EnsnareableComponentState state)
|
|
return;
|
|
|
|
if (state.IsEnsnared == component.IsEnsnared)
|
|
return;
|
|
|
|
component.IsEnsnared = state.IsEnsnared;
|
|
RaiseLocalEvent(uid, new EnsnaredChangedEvent(component.IsEnsnared));
|
|
}
|
|
|
|
private void OnGetState(EntityUid uid, EnsnareableComponent component, ref ComponentGetState args)
|
|
{
|
|
args.State = new EnsnareableComponentState(component.IsEnsnared);
|
|
}
|
|
|
|
private void OnEnsnare(EntityUid uid, EnsnareableComponent component, EnsnareEvent args)
|
|
{
|
|
component.WalkSpeed *= args.WalkSpeed;
|
|
component.SprintSpeed *= args.SprintSpeed;
|
|
|
|
_speedModifier.RefreshMovementSpeedModifiers(uid);
|
|
|
|
var ev = new EnsnaredChangedEvent(component.IsEnsnared);
|
|
RaiseLocalEvent(uid, ev);
|
|
}
|
|
|
|
private void OnEnsnareRemove(EntityUid uid, EnsnareableComponent component, EnsnareRemoveEvent args)
|
|
{
|
|
component.WalkSpeed /= args.WalkSpeed;
|
|
component.SprintSpeed /= args.SprintSpeed;
|
|
|
|
_speedModifier.RefreshMovementSpeedModifiers(uid);
|
|
|
|
var ev = new EnsnaredChangedEvent(component.IsEnsnared);
|
|
RaiseLocalEvent(uid, ev);
|
|
}
|
|
|
|
private void OnEnsnareChange(EntityUid uid, EnsnareableComponent component, EnsnaredChangedEvent args)
|
|
{
|
|
UpdateAppearance(uid, component);
|
|
}
|
|
|
|
private void UpdateAppearance(EntityUid uid, EnsnareableComponent component, AppearanceComponent? appearance = null)
|
|
{
|
|
Appearance.SetData(uid, EnsnareableVisuals.IsEnsnared, component.IsEnsnared, appearance);
|
|
}
|
|
|
|
private void MovementSpeedModify(EntityUid uid, EnsnareableComponent component,
|
|
RefreshMovementSpeedModifiersEvent args)
|
|
{
|
|
if (!component.IsEnsnared)
|
|
return;
|
|
|
|
args.ModifySpeed(component.WalkSpeed, component.SprintSpeed);
|
|
}
|
|
}
|