Skip to content

Commit

Permalink
Merge branch 'map-testing' of https://github.com/PubliclyExecutedPig/…
Browse files Browse the repository at this point in the history
…Delta-v into map-testing
  • Loading branch information
PubliclyExecutedPig committed Nov 11, 2024
2 parents 4c483c7 + c06618b commit 9486493
Show file tree
Hide file tree
Showing 27 changed files with 342 additions and 125 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
using Content.Shared.Abilities.Psionics;

namespace Content.Client.Abilities.Psionics;

public sealed class TelegnosisPowerSystem : SharedTelegnosisPowerSystem;
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
using Content.Server.Chat.Systems;
using Content.Shared.Administration;
using Robust.Shared.Audio;
using Robust.Shared.Console;
using Robust.Shared.ContentPack;
using Robust.Shared.Prototypes;

namespace Content.Server.Administration.Commands;

[AdminCommand(AdminFlags.Fun)]
public sealed class AnnounceCustomCommand : IConsoleCommand
{
[Dependency] private readonly IPrototypeManager _protoManager = default!;
[Dependency] private readonly IResourceManager _res = default!;

public string Command => "announcecustom";
public string Description => Loc.GetString("cmd-announcecustom-desc");
public string Help => Loc.GetString("cmd-announcecustom-help", ("command", Command));

public void Execute(IConsoleShell shell, string argStr, string[] args)
{
var chat = IoCManager.Resolve<IEntitySystemManager>().GetEntitySystem<ChatSystem>();

switch (args.Length)
{
case 0:
shell.WriteError(Loc.GetString("shell-need-minimum-one-argument"));
return;
case > 4:
shell.WriteError(Loc.GetString("shell-wrong-arguments-number"));
return;
}

var message = args[0];
var sender = "Central Command";
var color = Color.Gold;
var sound = new SoundPathSpecifier("/Audio/Announcements/announce.ogg");

// Optional sender argument
if (args.Length >= 2)
sender = args[1];

// Optional color argument
if (args.Length >= 3)
{
try
{
color = Color.FromHex(args[2]);
}
catch
{
shell.WriteError(Loc.GetString("shell-invalid-color-hex"));
return;
}
}

// Optional sound argument
if (args.Length >= 4)
sound = new SoundPathSpecifier(args[3]);

chat.DispatchGlobalAnnouncement(message, sender, true, sound, color);
shell.WriteLine(Loc.GetString("shell-command-success"));
}

public CompletionResult GetCompletion(IConsoleShell shell, string[] args)
{
return args.Length switch
{
1 => CompletionResult.FromHint(Loc.GetString("cmd-announcecustom-arg-message")),
2 => CompletionResult.FromHint(Loc.GetString("shell-argument-username-optional-hint")),
3 => CompletionResult.FromHint(Loc.GetString("cmd-announcecustom-arg-color")),
4 => CompletionResult.FromHintOptions(
CompletionHelper.AudioFilePath(args[3], _protoManager, _res),
Loc.GetString("cmd-announcecustom-arg-sound")
),
_ => CompletionResult.Empty
};
}
}
80 changes: 49 additions & 31 deletions Content.Server/Destructible/Thresholds/Behaviors/SpillBehavior.cs
Original file line number Diff line number Diff line change
@@ -1,42 +1,60 @@
using Content.Shared.Chemistry.EntitySystems;
using Content.Server.Fluids.EntitySystems;
using Content.Shared.Chemistry.Components;
using Content.Shared.Chemistry.EntitySystems;
using Content.Shared.Fluids.Components;
using JetBrains.Annotations;

namespace Content.Server.Destructible.Thresholds.Behaviors
namespace Content.Server.Destructible.Thresholds.Behaviors;

[UsedImplicitly]
[DataDefinition]
public sealed partial class SpillBehavior : IThresholdBehavior
{
[UsedImplicitly]
[DataDefinition]
public sealed partial class SpillBehavior : IThresholdBehavior
{
[DataField]
public string? Solution;
/// <summary>
/// Optional fallback solution name if SpillableComponent is not present.
/// </summary>
[DataField]
public string? Solution;

/// <summary>
/// If there is a SpillableComponent on EntityUidowner use it to create a puddle/smear.
/// Or whatever solution is specified in the behavior itself.
/// If none are available do nothing.
/// </summary>
/// <param name="owner">Entity on which behavior is executed</param>
/// <param name="system">system calling the behavior</param>
/// <param name="cause"></param>
public void Execute(EntityUid owner, DestructibleSystem system, EntityUid? cause = null)
{
var solutionContainerSystem = system.EntityManager.System<SharedSolutionContainerSystem>();
var spillableSystem = system.EntityManager.System<PuddleSystem>();
/// <summary>
/// When triggered, spills the entity's solution onto the ground.
/// Will first try to use the solution from a SpillableComponent if present,
/// otherwise falls back to the solution specified in the behavior's data fields.
/// The solution is properly drained/split before spilling to prevent double-spilling with other behaviors.
/// </summary>
/// <param name="owner">Entity whose solution will be spilled</param>
/// <param name="system">System calling this behavior</param>
/// <param name="cause">Optional entity that caused this behavior to trigger</param>
public void Execute(EntityUid owner, DestructibleSystem system, EntityUid? cause = null)
{
var solutionContainerSystem = system.EntityManager.System<SharedSolutionContainerSystem>();
var spillableSystem = system.EntityManager.System<PuddleSystem>();
var coordinates = system.EntityManager.GetComponent<TransformComponent>(owner).Coordinates;

var coordinates = system.EntityManager.GetComponent<TransformComponent>(owner).Coordinates;
Solution targetSolution;

if (system.EntityManager.TryGetComponent(owner, out SpillableComponent? spillableComponent) &&
solutionContainerSystem.TryGetSolution(owner, spillableComponent.SolutionName, out _, out var compSolution))
{
spillableSystem.TrySplashSpillAt(owner, coordinates, compSolution, out _, false, user: cause);
}
else if (Solution != null &&
solutionContainerSystem.TryGetSolution(owner, Solution, out _, out var behaviorSolution))
{
spillableSystem.TrySplashSpillAt(owner, coordinates, behaviorSolution, out _, user: cause);
}
// First try to get solution from SpillableComponent
if (system.EntityManager.TryGetComponent(owner, out SpillableComponent? spillableComponent) &&
solutionContainerSystem.TryGetSolution(owner, spillableComponent.SolutionName, out var solution, out var compSolution))
{
// If entity is drainable, drain the solution. Otherwise just split it.
// Both methods ensure the solution is properly removed.
targetSolution = system.EntityManager.HasComponent<DrainableSolutionComponent>(owner)
? solutionContainerSystem.Drain((owner, system.EntityManager.GetComponent<DrainableSolutionComponent>(owner)), solution.Value, compSolution.Volume)
: compSolution.SplitSolution(compSolution.Volume);
}
// Fallback to solution specified in behavior data
else if (Solution != null &&
solutionContainerSystem.TryGetSolution(owner, Solution, out var solutionEnt, out var behaviorSolution))
{
targetSolution = system.EntityManager.HasComponent<DrainableSolutionComponent>(owner)
? solutionContainerSystem.Drain((owner, system.EntityManager.GetComponent<DrainableSolutionComponent>(owner)), solutionEnt.Value, behaviorSolution.Volume)
: behaviorSolution.SplitSolution(behaviorSolution.Volume);
}
else
return;

// Spill the solution that was drained/split
spillableSystem.TrySplashSpillAt(owner, coordinates, targetSolution, out _, false, cause);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

namespace Content.Server.Abilities.Psionics
{
public sealed class TelegnosisPowerSystem : EntitySystem
public sealed class TelegnosisPowerSystem : SharedTelegnosisPowerSystem
{
[Dependency] private readonly IPrototypeManager _prototypeManager = default!;
[Dependency] private readonly StatusEffectsSystem _statusEffects = default!;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
using Content.Shared.Interaction.Events;

namespace Content.Shared.Abilities.Psionics;

public abstract class SharedTelegnosisPowerSystem : EntitySystem
{
public override void Initialize()
{
base.Initialize();

SubscribeLocalEvent<TelegnosticProjectionComponent, InteractionAttemptEvent>(OnInteractionAttempt);
}

private void OnInteractionAttempt(Entity<TelegnosticProjectionComponent> ent, ref InteractionAttemptEvent args)
{
// no astrally stealing someones shoes
args.Cancelled = true;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

namespace Content.Shared.Abilities.Psionics
{
[RegisterComponent]
[RegisterComponent, Access(typeof(SharedTelegnosisPowerSystem))]
public sealed partial class TelegnosisPowerComponent : Component
{
[DataField("prototype")]
Expand All @@ -20,4 +20,4 @@ public sealed partial class TelegnosisPowerComponent : Component
[DataField("telegnosisActionEntity")]
public EntityUid? TelegnosisActionEntity;
}
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
namespace Content.Shared.Abilities.Psionics
{
[RegisterComponent]
public sealed partial class TelegnosticProjectionComponent : Component
{}
}
namespace Content.Shared.Abilities.Psionics;

[RegisterComponent, Access(typeof(SharedTelegnosisPowerSystem))]
public sealed partial class TelegnosticProjectionComponent : Component;
108 changes: 57 additions & 51 deletions Resources/Changelog/DeltaVChangelog.yml
Original file line number Diff line number Diff line change
@@ -1,55 +1,4 @@
Entries:
- author: evilexecutive
changes:
- message: Harpies now have a visual indication when they're playing a Midi.
type: Add
- message: Harpies have been re-balanced so that they now actually have a numerical
positive.
type: Tweak
id: 161
time: '2023-12-06T20:10:49.0000000+00:00'
- author: DebugOk
changes:
- message: Due to abuse, prisoners now require whitelist to play.
type: Tweak
id: 162
time: '2023-12-07T13:22:03.0000000+00:00'
- author: ps3moira
changes:
- message: Removed bionic syrinx implanter from surplus crate.
type: Remove
id: 163
time: '2023-12-11T23:11:41.0000000+00:00'
- author: ps3moira
changes:
- message: Removed Carpotoxin from Sashimi, now they are sushi-grade!
type: Remove
id: 164
time: '2023-12-13T20:12:46.0000000+00:00'
- author: Adrian16199
changes:
- message: Crew has learned how to make a straw hat out of wheat bushels!
type: Add
id: 165
time: '2023-12-13T20:13:45.0000000+00:00'
- author: IamVelcroboy
changes:
- message: Added Yule! Happy Holidays!
type: Add
id: 166
time: '2023-12-13T20:21:34.0000000+00:00'
- author: ps3moira
changes:
- message: Added Fish n' Chips. Thank the British!
type: Add
id: 167
time: '2023-12-13T20:32:51.0000000+00:00'
- author: Adrian16199
changes:
- message: Felinids now meow out their words. They can also sigh now.
type: Tweak
id: 168
time: '2023-12-13T21:28:39.0000000+00:00'
- author: VMSolidus
changes:
- message: Harpies no longer choke on completely breathable air
Expand Down Expand Up @@ -3719,3 +3668,60 @@
id: 660
time: '2024-11-09T10:47:17.0000000+00:00'
url: https://github.com/DeltaV-Station/Delta-v/pull/2156
- author: MilonPL
changes:
- message: Fixed beaker solutions duplicating whenever it's thrown.
type: Fix
id: 661
time: '2024-11-09T12:46:34.0000000+00:00'
url: https://github.com/DeltaV-Station/Delta-v/pull/2157
- author: deltanedas
changes:
- message: The Synthesis Specialist's vendor can now be restocked.
type: Tweak
id: 662
time: '2024-11-09T13:16:44.0000000+00:00'
url: https://github.com/DeltaV-Station/Delta-v/pull/2143
- author: deltanedas
changes:
- message: Fixed telegnostic projections being able to interact with things.
type: Tweak
id: 663
time: '2024-11-09T19:27:59.0000000+00:00'
url: https://github.com/DeltaV-Station/Delta-v/pull/2117
- author: Unkn0wnGh0st333
changes:
- message: Synthesis Specialist ghost rules have been slightly adjusted.
type: Tweak
id: 664
time: '2024-11-09T19:44:28.0000000+00:00'
url: https://github.com/DeltaV-Station/Delta-v/pull/2152
- author: Colin-Tel
changes:
- message: Removed the "Raise Glimmer" objective for traitors.
type: Remove
id: 665
time: '2024-11-10T20:18:53.0000000+00:00'
url: https://github.com/DeltaV-Station/Delta-v/pull/2107
- author: Colin-Tel
changes:
- message: Adjusted antagonist rule C3 and the line about bribery in C1.
type: Tweak
id: 666
time: '2024-11-10T20:20:26.0000000+00:00'
url: https://github.com/DeltaV-Station/Delta-v/pull/2164
- author: Stop-Signs
changes:
- message: Removed the T3 Lockout on epi techs
type: Remove
id: 667
time: '2024-11-11T02:57:13.0000000+00:00'
url: https://github.com/DeltaV-Station/Delta-v/pull/2144
- author: Radezolid
changes:
- message: The syringe gun is now a researcheable technology in the T2 civilian
category. Get it from the medical techfab once it's researched.
type: Tweak
id: 668
time: '2024-11-11T15:41:44.0000000+00:00'
url: https://github.com/DeltaV-Station/Delta-v/pull/2169
Loading

0 comments on commit 9486493

Please sign in to comment.