Aspects (#266)
* - add: Revive fast and furious aspect. * - add: Update accents. * - add: More buzzing for moth. * - tweak: Change desc. * - fix: Fixes. * - add: RandomItemAspect. * - fix: Fix arachnid socks. * - tweak: Update desc part 2.
This commit is contained in:
@@ -0,0 +1,8 @@
|
||||
namespace Content.Server._White.AspectsSystem.Aspects.Components;
|
||||
|
||||
[RegisterComponent]
|
||||
public sealed partial class RandomItemAspectComponent : Component
|
||||
{
|
||||
[ViewVariables]
|
||||
public string? Item;
|
||||
}
|
||||
@@ -3,6 +3,7 @@ using Content.Server.GameTicking;
|
||||
using Content.Server.GameTicking.Rules.Components;
|
||||
using Content.Server._White.AspectsSystem.Aspects.Components;
|
||||
using Content.Server._White.AspectsSystem.Base;
|
||||
using Content.Server._White.Other.FastAndFuriousSystem;
|
||||
using Content.Shared.Cloning;
|
||||
using Content.Shared.Movement.Components;
|
||||
using Content.Shared.Movement.Systems;
|
||||
@@ -11,8 +12,6 @@ namespace Content.Server._White.AspectsSystem.Aspects;
|
||||
|
||||
public sealed class FastAndFuriousAspect : AspectSystem<FastAndFuriousAspectComponent>
|
||||
{
|
||||
[Dependency] private readonly MovementSpeedModifierSystem _movementSystem = default!;
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
base.Initialize();
|
||||
@@ -25,10 +24,9 @@ public sealed class FastAndFuriousAspect : AspectSystem<FastAndFuriousAspectComp
|
||||
{
|
||||
base.Started(uid, component, gameRule, args);
|
||||
var query = EntityQueryEnumerator<MovementSpeedModifierComponent>();
|
||||
while (query.MoveNext(out var ent, out var speedModifierComponent))
|
||||
while (query.MoveNext(out var ent, out _))
|
||||
{
|
||||
_movementSystem.ChangeBaseSpeed(ent, speedModifierComponent.BaseWalkSpeed,
|
||||
speedModifierComponent.BaseSprintSpeed + 3, speedModifierComponent.Acceleration);
|
||||
EnsureComp<FastAndFuriousComponent>(ent);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -37,10 +35,9 @@ public sealed class FastAndFuriousAspect : AspectSystem<FastAndFuriousAspectComp
|
||||
{
|
||||
base.Ended(uid, component, gameRule, args);
|
||||
var query = EntityQueryEnumerator<MovementSpeedModifierComponent>();
|
||||
while (query.MoveNext(out var ent, out var speedModifierComponent))
|
||||
while (query.MoveNext(out var ent, out _))
|
||||
{
|
||||
_movementSystem.ChangeBaseSpeed(ent, speedModifierComponent.BaseWalkSpeed,
|
||||
speedModifierComponent.BaseSprintSpeed, speedModifierComponent.Acceleration);
|
||||
EnsureComp<FastAndFuriousComponent>(ent);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -65,11 +62,10 @@ public sealed class FastAndFuriousAspect : AspectSystem<FastAndFuriousAspectComp
|
||||
if (!GameTicker.IsGameRuleAdded(ruleEntity, gameRule))
|
||||
continue;
|
||||
|
||||
if (!TryComp<MovementSpeedModifierComponent>(mob, out var speedModifierComponent))
|
||||
if (!HasComp<MovementSpeedModifierComponent>(mob))
|
||||
return;
|
||||
|
||||
_movementSystem.ChangeBaseSpeed(mob, speedModifierComponent.BaseWalkSpeed,
|
||||
speedModifierComponent.BaseSprintSpeed + 3, speedModifierComponent.Acceleration);
|
||||
EnsureComp<FastAndFuriousComponent>(mob);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -58,7 +58,10 @@ public sealed class RandomAccentAspect : AspectSystem<RandomAccentAspectComponen
|
||||
Russian,
|
||||
Anime,
|
||||
Lizard,
|
||||
Backwards
|
||||
Backwards,
|
||||
Bark,
|
||||
Anxiety,
|
||||
Moth
|
||||
}
|
||||
|
||||
private void ApplyRandomAccent(EntityUid uid)
|
||||
@@ -100,6 +103,19 @@ public sealed class RandomAccentAspect : AspectSystem<RandomAccentAspectComponen
|
||||
case AccentType.Backwards:
|
||||
EntityManager.EnsureComponent<BackwardsAccentComponent>(uid);
|
||||
break;
|
||||
case AccentType.Bark:
|
||||
EntityManager.EnsureComponent<BarkAccentComponent>(uid);
|
||||
break;
|
||||
case AccentType.Anxiety:
|
||||
var stutter = EntityManager.EnsureComponent<StutteringAccentComponent>(uid);
|
||||
stutter.MatchRandomProb = 0.2f;
|
||||
stutter.FourRandomProb = 0f;
|
||||
stutter.ThreeRandomProb = 0.3f;
|
||||
stutter.CutRandomProb = 0f;
|
||||
break;
|
||||
case AccentType.Moth:
|
||||
EntityManager.EnsureComponent<MothAccentComponent>(uid);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,76 @@
|
||||
using Content.Server.GameTicking;
|
||||
using Content.Server.GameTicking.Rules.Components;
|
||||
using Content.Server._White.AspectsSystem.Aspects.Components;
|
||||
using Content.Server._White.AspectsSystem.Base;
|
||||
using Content.Server.Holiday.Christmas;
|
||||
using Content.Shared.Hands.Components;
|
||||
using Content.Shared.Hands.EntitySystems;
|
||||
using Content.Shared.Humanoid;
|
||||
|
||||
namespace Content.Server._White.AspectsSystem.Aspects;
|
||||
|
||||
public sealed class RandomItemAspect : AspectSystem<RandomItemAspectComponent>
|
||||
{
|
||||
[Dependency] private readonly SharedHandsSystem _handsSystem = default!;
|
||||
[Dependency] private readonly RandomGiftSystem _giftSystem = default!;
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
base.Initialize();
|
||||
|
||||
SubscribeLocalEvent<PlayerSpawnCompleteEvent>(HandleLateJoin);
|
||||
}
|
||||
|
||||
protected override void Started(EntityUid uid, RandomItemAspectComponent component, GameRuleComponent gameRule, GameRuleStartedEvent args)
|
||||
{
|
||||
base.Started(uid, component, gameRule, args);
|
||||
|
||||
var query = EntityQueryEnumerator<HumanoidAppearanceComponent>();
|
||||
while (query.MoveNext(out var ent, out _))
|
||||
{
|
||||
GiveItem(ent, component);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void HandleLateJoin(PlayerSpawnCompleteEvent ev)
|
||||
{
|
||||
var query = EntityQueryEnumerator<RandomItemAspectComponent, GameRuleComponent>();
|
||||
while (query.MoveNext(out var ruleEntity, out var component, out var gameRule))
|
||||
{
|
||||
if (!GameTicker.IsGameRuleAdded(ruleEntity, gameRule))
|
||||
continue;
|
||||
|
||||
if (!ev.LateJoin)
|
||||
return;
|
||||
|
||||
var mob = ev.Mob;
|
||||
|
||||
GiveItem(mob, component);
|
||||
}
|
||||
}
|
||||
|
||||
#region Helpers
|
||||
|
||||
private void GiveItem(EntityUid player, RandomItemAspectComponent component)
|
||||
{
|
||||
component.Item ??= _giftSystem.PickRandomItem();
|
||||
|
||||
if (component.Item == null)
|
||||
return;
|
||||
|
||||
var transform = CompOrNull<TransformComponent>(player);
|
||||
|
||||
if(transform == null)
|
||||
return;
|
||||
|
||||
if(!HasComp<HandsComponent>(player))
|
||||
return;
|
||||
|
||||
var weaponEntity = EntityManager.SpawnEntity(component.Item, transform.Coordinates);
|
||||
|
||||
_handsSystem.PickupOrDrop(player, weaponEntity);
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
namespace Content.Server._White.Other.FastAndFuriousSystem;
|
||||
|
||||
[RegisterComponent]
|
||||
public sealed partial class FastAndFuriousComponent : Component
|
||||
{
|
||||
[ViewVariables(VVAccess.ReadWrite)]
|
||||
public float SprintModifier = 1.6f;
|
||||
|
||||
[ViewVariables(VVAccess.ReadWrite)]
|
||||
public float WalkModifier = 1;
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
using Content.Shared.Movement.Systems;
|
||||
|
||||
namespace Content.Server._White.Other.FastAndFuriousSystem;
|
||||
|
||||
public sealed class FastAndFuriousSystem : EntitySystem
|
||||
{
|
||||
[Dependency] private readonly MovementSpeedModifierSystem _movementSpeedModifierSystem = default!;
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
base.Initialize();
|
||||
|
||||
SubscribeLocalEvent<FastAndFuriousComponent, MapInitEvent>(OnMapInit);
|
||||
SubscribeLocalEvent<FastAndFuriousComponent, RefreshMovementSpeedModifiersEvent>(OnRefresh);
|
||||
}
|
||||
|
||||
private void OnRefresh(Entity<FastAndFuriousComponent> ent, ref RefreshMovementSpeedModifiersEvent args)
|
||||
{
|
||||
args.ModifySpeed(ent.Comp.WalkModifier, ent.Comp.SprintModifier);
|
||||
}
|
||||
|
||||
private void OnMapInit(Entity<FastAndFuriousComponent> ent, ref MapInitEvent args)
|
||||
{
|
||||
_movementSpeedModifierSystem.RefreshMovementSpeedModifiers(ent);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user