Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add space ferrets as a midround event #1045

Closed
Closed
Show file tree
Hide file tree
Changes from 32 commits
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
f341a4a
Skug brainrot wawa rain world backflip cat (#26168)
FairlySadPanda Mar 25, 2024
07c6750
Quick hotfix since panda is screaming at me in vc
VasilisThePikachu Mar 31, 2024
524b1bc
Skug
NullWanderer Apr 1, 2024
2588150
Unrot the brain
NullWanderer Apr 1, 2024
ddd1218
Its just spaceferret now
NullWanderer Apr 1, 2024
c039441
Wawa!
NullWanderer Apr 1, 2024
95d664d
Wawa?
NullWanderer Apr 1, 2024
d56e2df
Deshitter the species part 1
NullWanderer Apr 1, 2024
d11b4d7
Separate out upstream changes
NullWanderer Apr 1, 2024
9b6c8c2
Remove csproj brainrot
NullWanderer Apr 1, 2024
4219094
Finally cut everything out into separate files
NullWanderer Apr 1, 2024
f8779fc
Wawa...
NullWanderer Apr 1, 2024
ab0245f
Localized wawa
NullWanderer Apr 1, 2024
be49ffc
Am kinda dum
NullWanderer Apr 1, 2024
04d6d28
Event
NullWanderer Apr 1, 2024
f38f97b
Wawa
NullWanderer Apr 1, 2024
b196164
Hopefully the final wa
NullWanderer Apr 1, 2024
4ddea05
He do flip tho
NullWanderer Apr 1, 2024
a0a494e
Brainrot
NullWanderer Apr 1, 2024
2305f30
Fix inventory
NullWanderer Apr 1, 2024
28025c9
Objective
NullWanderer Apr 1, 2024
8457d90
Whoops!
NullWanderer Apr 1, 2024
2f4ee71
Name
NullWanderer Apr 3, 2024
7bf955e
100 nutrients instead of 300, should make them slightly less shit
NullWanderer Apr 3, 2024
353057c
No more ID card
NullWanderer Apr 3, 2024
1904830
Remove ability to wear a headset
NullWanderer Apr 3, 2024
0865d08
No more nom, no more nyoom
NullWanderer Apr 3, 2024
993ddf7
Play time requirement
NullWanderer Apr 3, 2024
36000ff
Rule changes
NullWanderer Apr 3, 2024
56b4138
Merge branch 'master' into 2024/04/01-Slugcats
NullWanderer Apr 3, 2024
2345cd6
Actually commit the hunger change
NullWanderer Apr 3, 2024
c176c31
Merge remote-tracking branch 'origin/2024/04/01-Slugcats' into 2024/0…
NullWanderer Apr 3, 2024
577b6cd
Remove last LDSF mentions and replace them with just space ferret. No…
NullWanderer Apr 3, 2024
eda1502
Add notes for core modifications
NullWanderer Apr 3, 2024
32d8f2b
Backflip event cleanup
NullWanderer Apr 3, 2024
18215a2
Purge last LDSF mentions
NullWanderer Apr 3, 2024
7bb068b
Put objective localization in the prototype
NullWanderer Apr 3, 2024
301fca8
CanHibernate changes, may need to come back to this one...
NullWanderer Apr 3, 2024
f104fef
Wawa!
NullWanderer Apr 3, 2024
6ac2aec
The brainrot is getting to me
NullWanderer Apr 3, 2024
48d02ce
Misc changes
NullWanderer Apr 3, 2024
7b50156
Revert Content.Shared.csproj changes
NullWanderer Apr 3, 2024
6a9ea44
I think I need eepy irl
NullWanderer Apr 3, 2024
3a0722a
Merge branch 'master' into 2024/04/01-Slugcats
A-z-z-y May 8, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 54 additions & 0 deletions Content.Client/DeltaV/SpaceFerret/CanBackflipSystem.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
using Content.Shared.DeltaV.SpaceFerret;
using Robust.Client.Animations;
using Robust.Client.Audio;
using Robust.Client.GameObjects;
using Robust.Shared.Animations;
using Robust.Shared.Audio;
using Robust.Shared.Player;

namespace Content.Client.DeltaV.SpaceFerret;

public sealed class CanBackflipSystem : EntitySystem
{
[Dependency] private readonly AnimationPlayerSystem _animation = default!;
[Dependency] private readonly AudioSystem _audio = default!;

public const string BackflipKey = "backflip";

public override void Initialize()
{
base.Initialize();

SubscribeNetworkEvent<DoABackFlipEvent>(OnBackflipEvent);
}

public void OnBackflipEvent(DoABackFlipEvent args)
{
if (!TryGetEntity(args.Actioner, out var uid))
{
return;
}

_animation.Play(uid.Value, new Animation
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no validation of any kind here either...

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure what you mean here?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it used to let malf clients play any sound which is Not Good

now it cant do that, also can probably get mob from message session so player cant even spoof the entity of an actual ferret

{
Length = TimeSpan.FromSeconds(0.66),
AnimationTracks =
{
new AnimationTrackComponentProperty()
{
ComponentType = typeof(SpriteComponent),
Property = nameof(SpriteComponent.Rotation),
InterpolationMode = AnimationInterpolationMode.Linear,
KeyFrames =
{
new AnimationTrackProperty.KeyFrame(Angle.FromDegrees(0), 0f),
new AnimationTrackProperty.KeyFrame(Angle.FromDegrees(180), 0.33f),
new AnimationTrackProperty.KeyFrame(Angle.FromDegrees(360), 0.33f),
}
}
}
}, BackflipKey);

_audio.PlayEntity(new SoundPathSpecifier(args.SfxSource), Filter.Local(), uid.Value, false);
NullWanderer marked this conversation as resolved.
Show resolved Hide resolved
}
}
29 changes: 29 additions & 0 deletions Content.Client/DeltaV/SpaceFerret/CanHibernateSystem.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
using Content.Shared.DeltaV.SpaceFerret;
using Robust.Client.GameObjects;

namespace Content.Client.DeltaV.SpaceFerret;

public sealed class CanHibernateSystem : EntitySystem
{
public override void Initialize()
{
base.Initialize();

SubscribeNetworkEvent<EntityHasHibernated>(OnHibernateEvent);
}

public void OnHibernateEvent(EntityHasHibernated args)
{
if (!TryGetEntity(args.Hibernator, out var uid))
{
return;
}

if (!TryComp<SpriteComponent>(uid, out var comp))
{
return;
}

comp.LayerSetState(0, args.SpriteStateId);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ideally use appearance for this otherwise remove from the event and just use the component directly along with actual validation

}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
using Content.Server.DeltaV.SpaceFerret.Systems;
using Content.Shared.Roles;

namespace Content.Server.DeltaV.SpaceFerret.Components;

[RegisterComponent, Access(typeof(SpaceFerretSystem)), ExclusiveAntagonist]
public sealed partial class SpaceFerretRoleComponent : AntagonistRoleComponent;
29 changes: 29 additions & 0 deletions Content.Server/DeltaV/SpaceFerret/Systems/CanBackflipSystem.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
using Content.Server.Actions;
using Content.Shared.DeltaV.SpaceFerret;

namespace Content.Server.DeltaV.SpaceFerret.Systems;

public sealed class CanBackflipSystem : EntitySystem
{
[Dependency] private readonly ActionsSystem _actions = default!;

public override void Initialize()
{
base.Initialize();

SubscribeLocalEvent<CanBackflipComponent, MapInitEvent>(OnInit);
SubscribeLocalEvent<CanBackflipComponent, BackflipActionEvent>(OnBackflipAction);
}

private void OnInit(EntityUid uid, CanBackflipComponent component, MapInitEvent args)
{
_actions.AddAction(uid, ref component.BackflipActionEntity, component.BackflipAction, uid);
}

public void OnBackflipAction(EntityUid uid, CanBackflipComponent comp, BackflipActionEvent args)
{
RaiseNetworkEvent(new DoABackFlipEvent(GetNetEntity(uid), comp.ClappaSfx));
NullWanderer marked this conversation as resolved.
Show resolved Hide resolved

args.Handled = true;
}
}
86 changes: 86 additions & 0 deletions Content.Server/DeltaV/SpaceFerret/Systems/CanHibernateSystem.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
using Content.Server.Actions;
using Content.Server.Atmos.Piping.Unary.Components;
using Content.Server.GameTicking;
using Content.Server.Ghost.Roles.Components;
using Content.Server.Popups;
using Content.Shared.DeltaV.SpaceFerret;
using Content.Shared.Interaction.Components;
using Content.Shared.Mind;
using Content.Shared.NPC;
using Content.Shared.Popups;
using Robust.Server.Audio;
using Robust.Shared.Audio;

namespace Content.Server.DeltaV.SpaceFerret.Systems;

public sealed class CanHibernateSystem : EntitySystem
{
[Dependency] private readonly ActionsSystem _actions = default!;
[Dependency] private readonly EntityLookupSystem _lookup = default!;
[Dependency] private readonly PopupSystem _popup = default!;
[Dependency] private readonly SharedMindSystem _mind = default!;
[Dependency] private readonly GameTicker _ticker = default!;
[Dependency] private readonly AudioSystem _audio = default!;

public override void Initialize()
{
base.Initialize();

SubscribeLocalEvent<CanHibernateComponent, MapInitEvent>(OnInit);
SubscribeLocalEvent<CanHibernateComponent, EepyActionEvent>(OnEepyAction);
}

private void OnInit(EntityUid uid, CanHibernateComponent component, MapInitEvent args)
{
_actions.AddAction(uid, ref component.EepyActionEntity, component.EepyAction, uid);
}

public void OnEepyAction(EntityUid uid, CanHibernateComponent comp, EepyActionEvent args)
{
// If you require food before hibernating, assert that this condition has been fulfilled.
if (_mind.TryGetObjectiveComp<ConsumeNutrientsConditionComponent>(uid, out var nutrientsCondition) && nutrientsCondition.NutrientsConsumed / nutrientsCondition.NutrientsRequired < 1.0)
{
_popup.PopupEntity(Loc.GetString(comp.NotEnoughNutrientsMessage), uid, PopupType.SmallCaution);

return;
}

// Assert that you're near a hibernation point (scrubbers)
var scrubbers = _lookup.GetEntitiesInRange<GasVentScrubberComponent>(Transform(uid).Coordinates, 2f);
if (scrubbers.Count <= 0)
{
_popup.PopupEntity(Loc.GetString(comp.TooFarFromHibernationSpot), uid, PopupType.SmallCaution);

return;
}

if (_mind.TryGetObjectiveComp<HibernateConditionComponent>(uid, out var hibernateCondition))
{
_audio.PlayPvs(new SoundPathSpecifier(hibernateCondition.SuccessSfx), uid);
_popup.PopupEntity(Loc.GetString(hibernateCondition.SuccessMessage), uid, PopupType.Large);
hibernateCondition.Hibernated = true;
}

// Kick player out
var mind = _mind.GetMind(uid);
if (mind != null)
{
_ticker.OnGhostAttempt(mind.Value, false);
}

// End ghost-role
AddComp<BlockMovementComponent>(uid);
RemComp<ActiveNPCComponent>(uid);
RemComp<GhostTakeoverAvailableComponent>(uid);

// Notify
RaiseNetworkEvent(new EntityHasHibernated(GetNetEntity(uid), comp.SpriteStateId));
NullWanderer marked this conversation as resolved.
Show resolved Hide resolved

args.Handled = true;
}
}

public struct EntityHibernateAttemptSuccessEvent(EntityUid entity)
{
public EntityUid Entity = entity;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
using Content.Shared.DeltaV.SpaceFerret;
using Content.Shared.Objectives.Components;

namespace Content.Server.DeltaV.SpaceFerret.Systems;

public sealed class ConsumeNutrientsObjectiveSystem : EntitySystem
{
public override void Initialize()
{
base.Initialize();

SubscribeLocalEvent<ConsumeNutrientsConditionComponent, ObjectiveGetProgressEvent>(OnConsumeNutrientsGetProgress);
}

private static void OnConsumeNutrientsGetProgress(EntityUid uid, ConsumeNutrientsConditionComponent comp, ref ObjectiveGetProgressEvent args)
{
args.Progress = comp.NutrientsConsumed / comp.NutrientsRequired;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
using Content.Shared.DeltaV.SpaceFerret;
using Content.Shared.Objectives.Components;

namespace Content.Server.DeltaV.SpaceFerret.Systems;

public sealed class HibernateObjectiveSystem : EntitySystem
{
public override void Initialize()
{
base.Initialize();

SubscribeLocalEvent<HibernateConditionComponent, ObjectiveGetProgressEvent>(OnHibernateGetProgress);
}

private static void OnHibernateGetProgress(EntityUid uid, HibernateConditionComponent comp, ref ObjectiveGetProgressEvent args)
{
args.Progress = comp.Hibernated ? 1.0f : 0.0f;
}
}
60 changes: 60 additions & 0 deletions Content.Server/DeltaV/SpaceFerret/Systems/SpaceFerretSystem.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
using Content.Server.Chat.Managers;
using Content.Server.DeltaV.SpaceFerret.Components;
using Content.Server.GenericAntag;
using Content.Server.Roles;
using Content.Shared.DeltaV.SpaceFerret;
using Content.Shared.Interaction.Events;
using Content.Shared.Mind;
using Content.Shared.Nutrition;
using Robust.Shared.Audio;

namespace Content.Server.DeltaV.SpaceFerret.Systems;

public sealed class SpaceFerretSystem : EntitySystem
{
[Dependency] private readonly RoleSystem _role = default!;
[Dependency] private readonly IChatManager _chatMan = default!;
[Dependency] private readonly SharedMindSystem _mind = default!;

public override void Initialize()
{
base.Initialize();

SubscribeLocalEvent<SpaceFerretComponent, GenericAntagCreatedEvent>(OnInit);
SubscribeLocalEvent<SpaceFerretComponent, InteractionAttemptFailed>(OnInteractFailed);
SubscribeLocalEvent<SpaceFerretComponent, HungerModifiedEvent>(OnHungerModified);
}

private void OnInit(EntityUid uid, SpaceFerretComponent component, GenericAntagCreatedEvent args)
{
var mind = args.Mind;

if (mind.Session == null)
return;

var session = mind.Session;
_role.MindAddRole(args.MindId, new RoleBriefingComponent
{
Briefing = Loc.GetString(component.RoleBriefing)
}, mind);
_role.MindAddRole(args.MindId, new SpaceFerretRoleComponent()
{
PrototypeId = component.AntagProtoId
}, mind);
_role.MindPlaySound(args.MindId, new SoundPathSpecifier(component.RoleIntroSfx), mind);
_chatMan.DispatchServerMessage(session, Loc.GetString(component.RoleGreeting));
}

public void OnInteractFailed(EntityUid uid, SpaceFerretComponent _, InteractionAttemptFailed args)
{
RaiseLocalEvent(uid, new BackflipActionEvent());
}

private void OnHungerModified(EntityUid uid, SpaceFerretComponent comp, HungerModifiedEvent args)
{
if (_mind.TryGetObjectiveComp<ConsumeNutrientsConditionComponent>(uid, out var nutrientsCondition) && args.Amount > 0)
{
nutrientsCondition.NutrientsConsumed += args.Amount;
}
}
}
3 changes: 3 additions & 0 deletions Content.Server/Interaction/InteractionPopupSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
using Content.Shared.Bed.Sleep;
using Content.Shared.IdentityManagement;
using Content.Shared.Interaction;
using Content.Shared.Interaction.Events;
NullWanderer marked this conversation as resolved.
Show resolved Hide resolved
using Content.Shared.Mobs.Components;
using Content.Shared.Mobs.Systems;
using Robust.Shared.Audio;
Expand Down Expand Up @@ -96,6 +97,8 @@ private void SharedInteract(

if (component.InteractFailureSpawn != null)
Spawn(component.InteractFailureSpawn, _transform.GetMapCoordinates(uid));

RaiseLocalEvent(target, new InteractionAttemptFailed(target));
NullWanderer marked this conversation as resolved.
Show resolved Hide resolved
}

if (component.MessagePerceivedByOthers != null)
Expand Down
3 changes: 0 additions & 3 deletions Content.Shared/Content.Shared.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,6 @@
<Private>false</Private>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<Folder Include="DeltaV\Abilities\" />
NullWanderer marked this conversation as resolved.
Show resolved Hide resolved
</ItemGroup>
<Import Project="..\RobustToolbox\MSBuild\Robust.Properties.targets" />
<Import Project="..\RobustToolbox\MSBuild\Robust.CompNetworkGenerator.targets" />
</Project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
namespace Content.Shared.Interaction.Events;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

deltav namespace + record struct instead of class


public sealed class InteractionAttemptFailed(EntityUid target)
{
public EntityUid Target = target;
}
6 changes: 6 additions & 0 deletions Content.Shared/DeltaV/Nutrition/Events.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
namespace Content.Shared.Nutrition;

public sealed class HungerModifiedEvent(float amount) : EntityEventArgs
NullWanderer marked this conversation as resolved.
Show resolved Hide resolved
{
public float Amount = amount;
}
29 changes: 29 additions & 0 deletions Content.Shared/DeltaV/SpaceFerret/CanBackflipComponent.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
using Content.Shared.Actions;
using Robust.Shared.Prototypes;
using Robust.Shared.Serialization;

namespace Content.Shared.DeltaV.SpaceFerret;

[RegisterComponent]
public sealed partial class CanBackflipComponent : Component
{
[DataField]
public EntProtoId BackflipAction = "ActionBackflip";

[DataField]
public EntityUid? BackflipActionEntity;

[DataField]
NullWanderer marked this conversation as resolved.
Show resolved Hide resolved
public string ClappaSfx = "";
}

public sealed partial class BackflipActionEvent : InstantActionEvent
{
}

[Serializable] [NetSerializable]
public sealed class DoABackFlipEvent(NetEntity actioner, string sfxSource) : EntityEventArgs
Copy link
Member

@deltanedas deltanedas Apr 3, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

from before remove sfxsource

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Aren't these supposed to be sealed classes?

Copy link
Member

@deltanedas deltanedas Apr 3, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh you right RaiseNetworkEvent requires it to be a class

either way have these events just take NetEntity nothing else

{
public NetEntity Actioner = actioner;
public string SfxSource = sfxSource;
}
Loading
Loading