Skip to content

Commit

Permalink
Merge branch 'master' of ssh://github.com/space-wizards/space-station…
Browse files Browse the repository at this point in the history
…-14 into staging
  • Loading branch information
VasilisThePikachu committed Feb 6, 2025
2 parents 6824ab4 + 3a3268b commit 36e42fb
Show file tree
Hide file tree
Showing 651 changed files with 14,317 additions and 7,797 deletions.
2 changes: 1 addition & 1 deletion Content.Client/Atmos/UI/SpaceHeaterWindow.xaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<DefaultWindow xmlns="https://spacestation14.io"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
MinSize="280 160" Title="Temperature Control Unit">
MinSize="280 160" Title="{Loc comp-space-heater-ui-title}">

<BoxContainer Name="VboxContainer" Orientation="Vertical" Margin="5 5 5 5" SeparationOverride="10">

Expand Down
24 changes: 22 additions & 2 deletions Content.Client/Ghost/GhostSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ public sealed class GhostSystem : SharedGhostSystem
[Dependency] private readonly IClientConsoleHost _console = default!;
[Dependency] private readonly IPlayerManager _playerManager = default!;
[Dependency] private readonly SharedActionsSystem _actions = default!;
[Dependency] private readonly PointLightSystem _pointLightSystem = default!;
[Dependency] private readonly ContentEyeSystem _contentEye = default!;

public int AvailableGhostRoleCount { get; private set; }
Expand Down Expand Up @@ -79,8 +80,27 @@ private void OnToggleLighting(EntityUid uid, EyeComponent component, ToggleLight
if (args.Handled)
return;

Popup.PopupEntity(Loc.GetString("ghost-gui-toggle-lighting-manager-popup"), args.Performer);
_contentEye.RequestToggleLight(uid, component);
TryComp<PointLightComponent>(uid, out var light);

if (!component.DrawLight)
{
// normal lighting
Popup.PopupEntity(Loc.GetString("ghost-gui-toggle-lighting-manager-popup-normal"), args.Performer);
_contentEye.RequestEye(component.DrawFov, true);
}
else if (!light?.Enabled ?? false) // skip this option if we have no PointLightComponent
{
// enable personal light
Popup.PopupEntity(Loc.GetString("ghost-gui-toggle-lighting-manager-popup-personal-light"), args.Performer);
_pointLightSystem.SetEnabled(uid, true, light);
}
else
{
// fullbright mode
Popup.PopupEntity(Loc.GetString("ghost-gui-toggle-lighting-manager-popup-fullbright"), args.Performer);
_contentEye.RequestEye(component.DrawFov, false);
_pointLightSystem.SetEnabled(uid, false, light);
}
args.Handled = true;
}

Expand Down
5 changes: 4 additions & 1 deletion Content.Client/Magic/MagicSystem.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
using Content.Shared.Magic;
using Content.Shared.Magic.Events;

namespace Content.Client.Magic;

public sealed class MagicSystem : SharedMagicSystem;
public sealed class MagicSystem : SharedMagicSystem
{
}
54 changes: 7 additions & 47 deletions Content.Client/Orbit/OrbitVisualsSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,16 @@
using Robust.Client.GameObjects;
using Robust.Shared.Animations;
using Robust.Shared.Random;
using Robust.Shared.Timing;

namespace Content.Client.Orbit;

public sealed class OrbitVisualsSystem : EntitySystem
{
[Dependency] private readonly IRobustRandom _robustRandom = default!;
[Dependency] private readonly AnimationPlayerSystem _animations = default!;
[Dependency] private readonly IGameTiming _timing = default!;

private readonly string _orbitAnimationKey = "orbiting";
private readonly string _orbitStopKey = "orbiting_stop";

public override void Initialize()
Expand All @@ -21,11 +22,11 @@ public override void Initialize()

SubscribeLocalEvent<OrbitVisualsComponent, ComponentInit>(OnComponentInit);
SubscribeLocalEvent<OrbitVisualsComponent, ComponentRemove>(OnComponentRemove);
SubscribeLocalEvent<OrbitVisualsComponent, AnimationCompletedEvent>(OnAnimationCompleted);
}

private void OnComponentInit(EntityUid uid, OrbitVisualsComponent component, ComponentInit args)
{
_robustRandom.SetSeed((int)_timing.CurTime.TotalMilliseconds);
component.OrbitDistance =
_robustRandom.NextFloat(0.75f * component.OrbitDistance, 1.25f * component.OrbitDistance);

Expand All @@ -38,15 +39,10 @@ private void OnComponentInit(EntityUid uid, OrbitVisualsComponent component, Com
}

var animationPlayer = EnsureComp<AnimationPlayerComponent>(uid);
if (_animations.HasRunningAnimation(uid, animationPlayer, _orbitAnimationKey))
return;

if (_animations.HasRunningAnimation(uid, animationPlayer, _orbitStopKey))
{
_animations.Stop(uid, animationPlayer, _orbitStopKey);
_animations.Stop((uid, animationPlayer), _orbitStopKey);
}

_animations.Play(uid, animationPlayer, GetOrbitAnimation(component), _orbitAnimationKey);
}

private void OnComponentRemove(EntityUid uid, OrbitVisualsComponent component, ComponentRemove args)
Expand All @@ -57,14 +53,9 @@ private void OnComponentRemove(EntityUid uid, OrbitVisualsComponent component, C
sprite.EnableDirectionOverride = false;

var animationPlayer = EnsureComp<AnimationPlayerComponent>(uid);
if (_animations.HasRunningAnimation(uid, animationPlayer, _orbitAnimationKey))
{
_animations.Stop(uid, animationPlayer, _orbitAnimationKey);
}

if (!_animations.HasRunningAnimation(uid, animationPlayer, _orbitStopKey))
{
_animations.Play(uid, animationPlayer, GetStopAnimation(component, sprite), _orbitStopKey);
_animations.Play((uid, animationPlayer), GetStopAnimation(component, sprite), _orbitStopKey);
}
}

Expand All @@ -74,46 +65,15 @@ public override void FrameUpdate(float frameTime)

foreach (var (orbit, sprite) in EntityManager.EntityQuery<OrbitVisualsComponent, SpriteComponent>())
{
var angle = new Angle(Math.PI * 2 * orbit.Orbit);
var progress = (float)(_timing.CurTime.TotalSeconds / orbit.OrbitLength) % 1;
var angle = new Angle(Math.PI * 2 * progress);
var vec = angle.RotateVec(new Vector2(orbit.OrbitDistance, 0));

sprite.Rotation = angle;
sprite.Offset = vec;
}
}

private void OnAnimationCompleted(EntityUid uid, OrbitVisualsComponent component, AnimationCompletedEvent args)
{
if (args.Key == _orbitAnimationKey && TryComp(uid, out AnimationPlayerComponent? animationPlayer))
{
_animations.Play(uid, animationPlayer, GetOrbitAnimation(component), _orbitAnimationKey);
}
}

private Animation GetOrbitAnimation(OrbitVisualsComponent component)
{
var length = component.OrbitLength;

return new Animation()
{
Length = TimeSpan.FromSeconds(length),
AnimationTracks =
{
new AnimationTrackComponentProperty()
{
ComponentType = typeof(OrbitVisualsComponent),
Property = nameof(OrbitVisualsComponent.Orbit),
KeyFrames =
{
new AnimationTrackProperty.KeyFrame(0.0f, 0f),
new AnimationTrackProperty.KeyFrame(1.0f, length),
},
InterpolationMode = AnimationInterpolationMode.Linear
}
}
};
}

private Animation GetStopAnimation(OrbitVisualsComponent component, SpriteComponent sprite)
{
var length = component.OrbitStopLength;
Expand Down
5 changes: 5 additions & 0 deletions Content.IntegrationTests/Tests/StoreTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
using Content.Server.Traitor.Uplink;
using Content.Shared.FixedPoint;
using Content.Shared.Inventory;
using Content.Shared.Mind;
using Content.Shared.Store;
using Content.Shared.Store.Components;
using Content.Shared.StoreDiscount.Components;
Expand Down Expand Up @@ -64,6 +65,7 @@ public async Task StoreDiscountAndRefund()
await server.WaitAssertion(() =>
{
var invSystem = entManager.System<InventorySystem>();
var mindSystem = entManager.System<SharedMindSystem>();

human = entManager.SpawnEntity("HumanUniformDummy", coordinates);
uniform = entManager.SpawnEntity("UniformDummy", coordinates);
Expand All @@ -72,6 +74,9 @@ await server.WaitAssertion(() =>
Assert.That(invSystem.TryEquip(human, uniform, "jumpsuit"));
Assert.That(invSystem.TryEquip(human, pda, "id"));

var mind = mindSystem.CreateMind(null);
mindSystem.TransferTo(mind, human, mind: mind);

FixedPoint2 originalBalance = 20;
uplinkSystem.AddUplink(human, originalBalance, null, true);

Expand Down
31 changes: 31 additions & 0 deletions Content.Server/Administration/Systems/AdminVerbSystem.Smites.cs
Original file line number Diff line number Diff line change
Expand Up @@ -892,5 +892,36 @@ private void AddSmiteVerbs(GetVerbsEvent<Verb> args)
Message = string.Join(": ", superslipName, Loc.GetString("admin-smite-super-slip-description"))
};
args.Verbs.Add(superslip);

var omniaccentName = Loc.GetString("admin-smite-omni-accent-name").ToLowerInvariant();
Verb omniaccent = new()
{
Text = omniaccentName,
Category = VerbCategory.Smite,
Icon = new SpriteSpecifier.Rsi(new("Interface/Actions/voice-mask.rsi"), "icon"),
Act = () =>
{
EnsureComp<BarkAccentComponent>(args.Target);
EnsureComp<BleatingAccentComponent>(args.Target);
EnsureComp<FrenchAccentComponent>(args.Target);
EnsureComp<GermanAccentComponent>(args.Target);
EnsureComp<LizardAccentComponent>(args.Target);
EnsureComp<MobsterAccentComponent>(args.Target);
EnsureComp<MothAccentComponent>(args.Target);
EnsureComp<OwOAccentComponent>(args.Target);
EnsureComp<SkeletonAccentComponent>(args.Target);
EnsureComp<SouthernAccentComponent>(args.Target);
EnsureComp<SpanishAccentComponent>(args.Target);
EnsureComp<StutteringAccentComponent>(args.Target);

if (_random.Next(0, 8) == 0)
{
EnsureComp<BackwardsAccentComponent>(args.Target); // was asked to make this at a low chance idk
}
},
Impact = LogImpact.Extreme,
Message = string.Join(": ", omniaccentName, Loc.GetString("admin-smite-omni-accent-description"))
};
args.Verbs.Add(omniaccent);
}
}
1 change: 1 addition & 0 deletions Content.Server/Botany/Systems/LogSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -45,5 +45,6 @@ private void OnInteractUsing(EntityUid uid, LogComponent component, InteractUsin
}

QueueDel(uid);
args.Handled = true;
}
}
1 change: 1 addition & 0 deletions Content.Server/Cargo/Systems/CargoSystem.Orders.cs
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ private void OnInteractUsing(EntityUid uid, CargoOrderConsoleComponent component
_audio.PlayPvs(component.ConfirmSound, uid);
UpdateBankAccount(stationUid.Value, bank, (int) price);
QueueDel(args.Used);
args.Handled = true;
}

private void OnInit(EntityUid uid, CargoOrderConsoleComponent orderConsole, ComponentInit args)
Expand Down
13 changes: 13 additions & 0 deletions Content.Server/Magic/MagicSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,17 @@ private void OnSpellSpoken(ref SpeakSpellEvent args)
{
_chat.TrySendInGameICMessage(args.Performer, Loc.GetString(args.Speech), InGameICChatType.Speak, false);
}

public override void OnVoidApplause(VoidApplauseSpellEvent ev)
{
base.OnVoidApplause(ev);

_chat.TryEmoteWithChat(ev.Performer, ev.Emote);

var perfXForm = Transform(ev.Performer);
var targetXForm = Transform(ev.Target);

Spawn(ev.Effect, perfXForm.Coordinates);
Spawn(ev.Effect, targetXForm.Coordinates);
}
}
32 changes: 21 additions & 11 deletions Content.Server/Medical/HealingSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -118,15 +118,15 @@ entity.Comp.DamageContainerID is not null &&
_audio.PlayPvs(healing.HealingEndSound, entity.Owner, AudioHelpers.WithVariation(0.125f, _random).WithVolume(1f));

// Logic to determine the whether or not to repeat the healing action
args.Repeat = (HasDamage(entity.Comp, healing) && !dontRepeat);
args.Repeat = (HasDamage(entity, healing) && !dontRepeat);
if (!args.Repeat && !dontRepeat)
_popupSystem.PopupEntity(Loc.GetString("medical-item-finished-using", ("item", args.Used)), entity.Owner, args.User);
args.Handled = true;
}

private bool HasDamage(DamageableComponent component, HealingComponent healing)
private bool HasDamage(Entity<DamageableComponent> ent, HealingComponent healing)
{
var damageableDict = component.Damage.DamageDict;
var damageableDict = ent.Comp.Damage.DamageDict;
var healingDict = healing.Damage.DamageDict;
foreach (var type in healingDict)
{
Expand All @@ -136,6 +136,23 @@ private bool HasDamage(DamageableComponent component, HealingComponent healing)
}
}

if (TryComp<BloodstreamComponent>(ent, out var bloodstream))
{
// Is ent missing blood that we can restore?
if (healing.ModifyBloodLevel > 0
&& _solutionContainerSystem.ResolveSolution(ent.Owner, bloodstream.BloodSolutionName, ref bloodstream.BloodSolution, out var bloodSolution)
&& bloodSolution.Volume < bloodSolution.MaxVolume)
{
return true;
}

// Is ent bleeding and can we stop it?
if (healing.BloodlossModifier < 0 && bloodstream.BleedAmount > 0)
{
return true;
}
}

return false;
}

Expand Down Expand Up @@ -175,14 +192,7 @@ targetDamage.DamageContainerID is not null &&
if (TryComp<StackComponent>(uid, out var stack) && stack.Count < 1)
return false;

var anythingToDo =
HasDamage(targetDamage, component) ||
component.ModifyBloodLevel > 0 // Special case if healing item can restore lost blood...
&& TryComp<BloodstreamComponent>(target, out var bloodstream)
&& _solutionContainerSystem.ResolveSolution(target, bloodstream.BloodSolutionName, ref bloodstream.BloodSolution, out var bloodSolution)
&& bloodSolution.Volume < bloodSolution.MaxVolume; // ...and there is lost blood to restore.

if (!anythingToDo)
if (!HasDamage((target, targetDamage), component))
{
_popupSystem.PopupEntity(Loc.GetString("medical-item-cant-use", ("item", uid)), uid, user);
return false;
Expand Down
7 changes: 3 additions & 4 deletions Content.Server/Store/Conditions/BuyerAntagCondition.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,12 @@ public sealed partial class BuyerAntagCondition : ListingCondition
public override bool Condition(ListingConditionArgs args)
{
var ent = args.EntityManager;
var minds = ent.System<SharedMindSystem>();

if (!minds.TryGetMind(args.Buyer, out var mindId, out var mind))
return true;
if (!ent.HasComponent<MindComponent>(args.Buyer))
return true; // inanimate objects don't have minds

var roleSystem = ent.System<SharedRoleSystem>();
var roles = roleSystem.MindGetAllRoleInfo(mindId);
var roles = roleSystem.MindGetAllRoleInfo(args.Buyer);

if (Blacklist != null)
{
Expand Down
8 changes: 3 additions & 5 deletions Content.Server/Store/Conditions/BuyerDepartmentCondition.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,12 @@ public override bool Condition(ListingConditionArgs args)
var prototypeManager = IoCManager.Resolve<IPrototypeManager>();

var ent = args.EntityManager;
var minds = ent.System<SharedMindSystem>();

// this is for things like surplus crate
if (!minds.TryGetMind(args.Buyer, out var mindId, out _))
return true;
if (!ent.TryGetComponent<MindComponent>(args.Buyer, out var _))
return true; // inanimate objects don't have minds

var jobs = ent.System<SharedJobSystem>();
jobs.MindTryGetJob(mindId, out var job);
jobs.MindTryGetJob(args.Buyer, out var job);

if (Blacklist != null && job != null)
{
Expand Down
8 changes: 3 additions & 5 deletions Content.Server/Store/Conditions/BuyerJobCondition.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,12 @@ public sealed partial class BuyerJobCondition : ListingCondition
public override bool Condition(ListingConditionArgs args)
{
var ent = args.EntityManager;
var minds = ent.System<SharedMindSystem>();

// this is for things like surplus crate
if (!minds.TryGetMind(args.Buyer, out var mindId, out _))
return true;
if (!ent.TryGetComponent<MindComponent>(args.Buyer, out var _))
return true; // inanimate objects don't have minds

var jobs = ent.System<SharedJobSystem>();
jobs.MindTryGetJob(mindId, out var job);
jobs.MindTryGetJob(args.Buyer, out var job);

if (Blacklist != null)
{
Expand Down
6 changes: 5 additions & 1 deletion Content.Server/Store/Conditions/BuyerSpeciesCondition.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using Content.Shared.Store;
using Content.Shared.Humanoid.Prototypes;
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype.Set;
using Content.Shared.Mind;

namespace Content.Server.Store.Conditions;

Expand All @@ -27,7 +28,10 @@ public override bool Condition(ListingConditionArgs args)
{
var ent = args.EntityManager;

if (!ent.TryGetComponent<HumanoidAppearanceComponent>(args.Buyer, out var appearance))
if (!ent.TryGetComponent<MindComponent>(args.Buyer, out var mind))
return true; // needed to obtain body entityuid to check for humanoid appearance

if (!ent.TryGetComponent<HumanoidAppearanceComponent>(mind.OwnedEntity, out var appearance))
return true; // inanimate or non-humanoid entities should be handled elsewhere, main example being surplus crates

if (Blacklist != null)
Expand Down
Loading

0 comments on commit 36e42fb

Please sign in to comment.