Skip to content

Commit

Permalink
Merge remote-tracking branch 'wizard/master' into upstream-sync
Browse files Browse the repository at this point in the history
  • Loading branch information
Rxup committed Sep 25, 2023
2 parents dbf1b54 + 91a157d commit d0eee50
Show file tree
Hide file tree
Showing 114 changed files with 1,025 additions and 224 deletions.
8 changes: 4 additions & 4 deletions Content.Client/Ghost/GhostSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ public sealed class GhostSystem : SharedGhostSystem
[Dependency] private readonly IPlayerManager _playerManager = default!;
[Dependency] private readonly SharedActionsSystem _actions = default!;
[Dependency] private readonly ILightManager _lightManager = default!;
[Dependency] private readonly SharedPopupSystem _popup = default!;
[Dependency] private readonly ContentEyeSystem _contentEye = default!;

public int AvailableGhostRoleCount { get; private set; }
Expand Down Expand Up @@ -83,7 +82,7 @@ private void OnToggleLighting(EntityUid uid, GhostComponent component, ToggleLig
if (args.Handled)
return;

_popup.PopupEntity(Loc.GetString("ghost-gui-toggle-lighting-manager-popup"), args.Performer);
Popup.PopupEntity(Loc.GetString("ghost-gui-toggle-lighting-manager-popup"), args.Performer);
_lightManager.Enabled = !_lightManager.Enabled;
args.Handled = true;
}
Expand All @@ -93,7 +92,7 @@ private void OnToggleFoV(EntityUid uid, GhostComponent component, ToggleFoVActio
if (args.Handled)
return;

_popup.PopupEntity(Loc.GetString("ghost-gui-toggle-fov-popup"), args.Performer);
Popup.PopupEntity(Loc.GetString("ghost-gui-toggle-fov-popup"), args.Performer);
_contentEye.RequestToggleFov(uid);
args.Handled = true;
}
Expand All @@ -103,7 +102,7 @@ private void OnToggleGhosts(EntityUid uid, GhostComponent component, ToggleGhost
if (args.Handled)
return;

_popup.PopupEntity(Loc.GetString("ghost-gui-toggle-ghost-visibility-popup"), args.Performer);
Popup.PopupEntity(Loc.GetString("ghost-gui-toggle-ghost-visibility-popup"), args.Performer);
ToggleGhostVisibility();
args.Handled = true;
}
Expand All @@ -113,6 +112,7 @@ private void OnGhostRemove(EntityUid uid, GhostComponent component, ComponentRem
_actions.RemoveAction(uid, component.ToggleLightingActionEntity);
_actions.RemoveAction(uid, component.ToggleFoVActionEntity);
_actions.RemoveAction(uid, component.ToggleGhostsActionEntity);
_actions.RemoveAction(uid, component.ToggleGhostHearingActionEntity);

if (uid != _playerManager.LocalPlayer?.ControlledEntity)
return;
Expand Down
6 changes: 4 additions & 2 deletions Content.Client/Guidebook/Controls/GuideReagentEmbed.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,10 @@
VerticalAlignment="Center"/>
</BoxContainer>
<BoxContainer Orientation="Vertical" VerticalAlignment="Center">
<TextureRect TexturePath="/Textures/Interface/Misc/beakerlarge.png"/>
<Label Text="{Loc 'guidebook-reagent-recipes-mix'}"
<TextureRect TexturePath="/Textures/Interface/Misc/beakerlarge.png"
HorizontalAlignment="Center"/>
<Label Name="MixLabel"
Text="{Loc 'guidebook-reagent-recipes-mix'}"
HorizontalAlignment="Center"/>
</BoxContainer>
<BoxContainer Orientation="Vertical" HorizontalExpand="True" VerticalAlignment="Center">
Expand Down
6 changes: 6 additions & 0 deletions Content.Client/Guidebook/Controls/GuideReagentEmbed.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,12 @@ private void GenerateControl(ReagentPrototype reagent)
reactantMsg.Pop();
ReactantsLabel.SetMessage(reactantMsg);

if (reactionPrototype.MinimumTemperature > 0.0f)
{
MixLabel.Text = Loc.GetString("guidebook-reagent-recipes-mix-and-heat",
("temperature", reactionPrototype.MinimumTemperature));
}

var productMsg = new FormattedMessage();
var productCount = reactionPrototype.Products.Count;
var u = 0;
Expand Down
16 changes: 16 additions & 0 deletions Content.Client/MouseRotator/MouseRotatorSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,22 @@ public override void Update(float frameTime)

var curRot = _transform.GetWorldRotation(xform);

// 4-dir handling is separate --
// only raise event if the cardinal direction has changed
if (rotator.Simple4DirMode)
{
var angleDir = angle.GetCardinalDir();
if (angleDir == curRot.GetCardinalDir())
return;

RaisePredictiveEvent(new RequestMouseRotatorRotationSimpleEvent()
{
Direction = angleDir,
});

return;
}

// Don't raise event if mouse ~hasn't moved (or if too close to goal rotation already)
var diff = Angle.ShortestDistance(angle, curRot);
if (Math.Abs(diff.Theta) < rotator.AngleTolerance.Theta)
Expand Down
4 changes: 4 additions & 0 deletions Content.Client/Weapons/Melee/MeleeWeaponSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,10 @@ public override void Update(float frameTime)
target = screen.GetClickedEntity(mousePos);
}

// Don't light-attack if interaction will be handling this instead
if (Interaction.CombatModeCanHandInteract(entity, target))
return;

RaisePredictiveEvent(new LightAttackEvent(GetNetEntity(target), GetNetEntity(weaponUid), GetNetCoordinates(coordinates)));
}
}
Expand Down
4 changes: 4 additions & 0 deletions Content.IntegrationTests/Tests/Slipping/SlippingTest.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#nullable enable
using System.Collections.Generic;
using Content.IntegrationTests.Tests.Interaction;
using Content.Shared.Movement.Components;
using Content.Shared.Slippery;
using Content.Shared.Stunnable;
using Robust.Shared.GameObjects;
Expand Down Expand Up @@ -31,6 +32,9 @@ public async Task BananaSlipTest()
var sys = SEntMan.System<SlipTestSystem>();
await SpawnTarget("TrashBananaPeel");

var modifier = Comp<MovementSpeedModifierComponent>(Player).SprintSpeedModifier;
Assert.That(modifier, Is.EqualTo(1), "Player is not moving at full speed.");

// Player is to the left of the banana peel and has not slipped.
#pragma warning disable NUnit2045
Assert.That(Delta(), Is.GreaterThan(0.5f));
Expand Down
44 changes: 30 additions & 14 deletions Content.Server/Ame/EntitySystems/AmeControllerSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -68,17 +68,28 @@ private void UpdateController(EntityUid uid, TimeSpan curTime, AmeControllerComp

if (TryComp<AmeFuelContainerComponent>(controller.JarSlot.ContainedEntity, out var fuelJar))
{
var availableInject = Math.Min(controller.InjectionAmount, fuelJar.FuelAmount);
var powerOutput = group.InjectFuel(availableInject, out var overloading);
if (TryComp<PowerSupplierComponent>(uid, out var powerOutlet))
powerOutlet.MaxSupply = powerOutput;
fuelJar.FuelAmount -= availableInject;
_audioSystem.PlayPvs(controller.InjectSound, uid, AudioParams.Default.WithVolume(overloading ? 10f : 0f));
UpdateUi(uid, controller);
// if the jar is empty shut down the AME
if (fuelJar.FuelAmount <= 0)
{
SetInjecting(uid, false, null, controller);
}
else
{
var availableInject = Math.Min(controller.InjectionAmount, fuelJar.FuelAmount);
var powerOutput = group.InjectFuel(availableInject, out var overloading);
if (TryComp<PowerSupplierComponent>(uid, out var powerOutlet))
powerOutlet.MaxSupply = powerOutput;
fuelJar.FuelAmount -= availableInject;
// only play audio if we actually had an injection
if (availableInject > 0)
_audioSystem.PlayPvs(controller.InjectSound, uid, AudioParams.Default.WithVolume(overloading ? 10f : 0f));
UpdateUi(uid, controller);
}
}

controller.Stability = group.GetTotalStability();

group.UpdateCoreVisuals();
UpdateDisplay(uid, controller.Stability, controller);

if (controller.Stability <= 0)
Expand Down Expand Up @@ -155,7 +166,7 @@ public void SetInjecting(EntityUid uid, bool value, EntityUid? user = null, AmeC
return;

controller.Injecting = value;
_appearanceSystem.SetData(uid, AmeControllerVisuals.DisplayState, value ? AmeControllerState.On : AmeControllerState.Off);
UpdateDisplay(uid, controller.Stability, controller);
if (!value && TryComp<PowerSupplierComponent>(uid, out var powerOut))
powerOut.MaxSupply = 0;

Expand Down Expand Up @@ -215,15 +226,20 @@ private void UpdateDisplay(EntityUid uid, int stability, AmeControllerComponent?
if (!Resolve(uid, ref controller, ref appearance))
return;

var ameControllerState = stability switch
{
< 10 => AmeControllerState.Fuck,
< 50 => AmeControllerState.Critical,
_ => AmeControllerState.On,
};

if (!controller.Injecting)
ameControllerState = AmeControllerState.Off;

_appearanceSystem.SetData(
uid,
AmeControllerVisuals.DisplayState,
stability switch
{
< 10 => AmeControllerState.Fuck,
< 50 => AmeControllerState.Critical,
_ => AmeControllerState.On,
},
ameControllerState,
appearance
);
}
Expand Down
2 changes: 1 addition & 1 deletion Content.Server/Atmos/Components/GasTankComponent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ namespace Content.Server.Atmos.Components
[RegisterComponent]
public sealed partial class GasTankComponent : Component, IGasMixtureHolder
{
public const float MaxExplosionRange = 80f;
public const float MaxExplosionRange = 26f;
private const float DefaultLowPressure = 0f;
private const float DefaultOutputPressure = Atmospherics.OneAtmosphere;

Expand Down
6 changes: 3 additions & 3 deletions Content.Server/Chat/Systems/ChatSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -762,7 +762,7 @@ private Dictionary<ICommonSession, ICChatRecipientData> GetRecipients(EntityUid
// TODO proper speech occlusion

var recipients = new Dictionary<ICommonSession, ICChatRecipientData>();
var ghosts = GetEntityQuery<GhostComponent>();
var ghostHearing = GetEntityQuery<GhostHearingComponent>();
var xforms = GetEntityQuery<TransformComponent>();

var transformSource = xforms.GetComponent(source);
Expand All @@ -779,9 +779,9 @@ private Dictionary<ICommonSession, ICChatRecipientData> GetRecipients(EntityUid
if (transformEntity.MapID != sourceMapId)
continue;

var observer = ghosts.HasComponent(playerEntity);
var observer = ghostHearing.HasComponent(playerEntity);

// even if they are an observer, in some situations we still need the range
// even if they are a ghost hearer, in some situations we still need the range
if (sourceCoords.TryDistance(EntityManager, transformEntity.Coordinates, out var distance) && distance < voiceGetRange)
{
recipients.Add(player, new ICChatRecipientData(distance, observer));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ public void UpdateAppearance(EntityUid uid, Solution solution,

if (solution.GetPrimaryReagentId() is { } reagent)
{
_appearance.SetData(uid, SolutionContainerVisuals.BaseOverride, reagent, appearanceComponent);
_appearance.SetData(uid, SolutionContainerVisuals.BaseOverride, reagent.ToString(), appearanceComponent);
}
else
{
Expand Down
2 changes: 1 addition & 1 deletion Content.Server/Chemistry/EntitySystems/VaporSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ public void Start(VaporComponent vapor, TransformComponent vaporXform, Vector2 d
_physics.SetLinearDamping(physics, 0f);
_physics.SetAngularDamping(physics, 0f);

_throwing.TryThrow(vapor.Owner, dir, speed, user: user, pushbackRatio: ThrowingSystem.PushbackDefault * 10f);
_throwing.TryThrow(vapor.Owner, dir, speed, user: user);

var distance = (target.Position - vaporXform.WorldPosition).Length();
var time = (distance / physics.LinearVelocity.Length());
Expand Down
7 changes: 4 additions & 3 deletions Content.Server/Chemistry/ReagentEffects/SatiateThirst.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using Content.Server.Nutrition.EntitySystems;
using Content.Shared.Chemistry.Reagent;
using Content.Shared.Nutrition.Components;
using Content.Shared.Nutrition.EntitySystems;
using Robust.Shared.Prototypes;

namespace Content.Server.Chemistry.ReagentEffects
Expand All @@ -21,8 +21,9 @@ public sealed partial class SatiateThirst : ReagentEffect
/// Satiate thirst if a ThirstComponent can be found
public override void Effect(ReagentEffectArgs args)
{
if (args.EntityManager.TryGetComponent(args.SolutionEntity, out ThirstComponent? thirst))
EntitySystem.Get<ThirstSystem>().UpdateThirst(thirst, HydrationFactor);
var uid = args.SolutionEntity;
if (args.EntityManager.TryGetComponent(uid, out ThirstComponent? thirst))
EntitySystem.Get<ThirstSystem>().ModifyThirst(uid, thirst, HydrationFactor);
}

protected override string? ReagentEffectGuidebookText(IPrototypeManager prototype, IEntitySystemManager entSys)
Expand Down
13 changes: 9 additions & 4 deletions Content.Server/Communications/CommsHackerSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@
using Content.Shared.Communications;
using Content.Shared.DoAfter;
using Content.Shared.Interaction;
using Content.Shared.Random;
using Content.Shared.Random.Helpers;
using Robust.Shared.Prototypes;
using Robust.Shared.Random;
using Robust.Shared.Serialization;

Expand All @@ -13,6 +16,7 @@ public sealed class CommsHackerSystem : SharedCommsHackerSystem
{
[Dependency] private readonly ChatSystem _chat = default!;
[Dependency] private readonly GameTicker _gameTicker = default!;
[Dependency] private readonly IPrototypeManager _proto = default!;
[Dependency] private readonly IRobustRandom _random = default!;
// TODO: remove when generic check event is used
[Dependency] private readonly NinjaGlovesSystem _gloves = default!;
Expand Down Expand Up @@ -55,11 +59,12 @@ private void OnBeforeInteractHand(EntityUid uid, CommsHackerComponent comp, Befo
/// </summary>
private void OnDoAfter(EntityUid uid, CommsHackerComponent comp, TerrorDoAfterEvent args)
{
if (args.Cancelled || args.Handled || comp.Threats.Count == 0 || args.Target == null)
if (args.Cancelled || args.Handled || args.Target == null)
return;

var threat = _random.Pick(comp.Threats);
CallInThreat(threat);
var threats = _proto.Index<WeightedRandomPrototype>(comp.Threats);
var threat = threats.Pick(_random);
CallInThreat(_proto.Index<ThreatPrototype>(threat));

// prevent calling in multiple threats
RemComp<CommsHackerComponent>(uid);
Expand All @@ -71,7 +76,7 @@ private void OnDoAfter(EntityUid uid, CommsHackerComponent comp, TerrorDoAfterEv
/// <summary>
/// Makes announcement and adds game rule of the threat.
/// </summary>
public void CallInThreat(Threat threat)
public void CallInThreat(ThreatPrototype threat)
{
_gameTicker.StartGameRule(threat.Rule, out _);
_chat.DispatchGlobalAnnouncement(Loc.GetString(threat.Announcement), playSound: true, colorOverride: Color.Red);
Expand Down
23 changes: 14 additions & 9 deletions Content.Server/Fluids/Components/SprayComponent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
using Content.Shared.FixedPoint;
using Robust.Shared.Audio;
using Robust.Shared.Prototypes;
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype;

namespace Content.Server.Fluids.Components;

Expand All @@ -12,25 +11,31 @@ public sealed partial class SprayComponent : Component
{
public const string SolutionName = "spray";

[DataField("transferAmount")]
[ViewVariables(VVAccess.ReadWrite), DataField]
public FixedPoint2 TransferAmount = 10;

[ViewVariables(VVAccess.ReadWrite), DataField("sprayDistance")]
[ViewVariables(VVAccess.ReadWrite), DataField]
public float SprayDistance = 3.5f;

[ViewVariables(VVAccess.ReadWrite), DataField("sprayVelocity")]
[ViewVariables(VVAccess.ReadWrite), DataField]
public float SprayVelocity = 3.5f;

[ViewVariables(VVAccess.ReadWrite), DataField("sprayedPrototype", customTypeSerializer: typeof(PrototypeIdSerializer<EntityPrototype>))]
public string SprayedPrototype = "Vapor";
[ViewVariables(VVAccess.ReadWrite), DataField]
public EntProtoId SprayedPrototype = "Vapor";

[ViewVariables(VVAccess.ReadWrite), DataField("vaporAmount")]
[ViewVariables(VVAccess.ReadWrite), DataField]
public int VaporAmount = 1;

[ViewVariables(VVAccess.ReadWrite), DataField("vaporSpread")]
[ViewVariables(VVAccess.ReadWrite), DataField]
public float VaporSpread = 90f;

[ViewVariables(VVAccess.ReadWrite), DataField("spraySound", required: true)]
/// <summary>
/// How much the player is pushed back for each spray.
/// </summary>
[ViewVariables(VVAccess.ReadWrite), DataField]
public float PushbackAmount = 2f;

[ViewVariables(VVAccess.ReadWrite), DataField(required: true)]
[Access(typeof(SpraySystem), Other = AccessPermissions.ReadExecute)] // FIXME Friends
public SoundSpecifier SpraySound { get; private set; } = default!;
}
13 changes: 12 additions & 1 deletion Content.Server/Fluids/EntitySystems/SpraySystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,14 @@
using Content.Server.Cooldown;
using Content.Server.Extinguisher;
using Content.Server.Fluids.Components;
using Content.Server.Gravity;
using Content.Server.Popups;
using Content.Shared.Cooldown;
using Content.Shared.FixedPoint;
using Content.Shared.Interaction;
using Content.Shared.Vapor;
using Robust.Server.GameObjects;
using Robust.Shared.Physics.Components;
using Robust.Shared.Prototypes;
using Robust.Shared.Timing;

Expand All @@ -19,6 +21,8 @@ public sealed class SpraySystem : EntitySystem
{
[Dependency] private readonly IGameTiming _gameTiming = default!;
[Dependency] private readonly IPrototypeManager _proto = default!;
[Dependency] private readonly GravitySystem _gravity = default!;
[Dependency] private readonly PhysicsSystem _physics = default!;
[Dependency] private readonly PopupSystem _popupSystem = default!;
[Dependency] private readonly SharedAudioSystem _audio = default!;
[Dependency] private readonly SolutionContainerSystem _solutionContainer = default!;
Expand Down Expand Up @@ -104,7 +108,8 @@ private void OnAfterInteract(EntityUid uid, SprayComponent component, AfterInter
if (distance > component.SprayDistance)
target = userMapPos.Offset(diffNorm * component.SprayDistance);

var newSolution = _solutionContainer.SplitSolution(uid, solution, component.TransferAmount);
var adjustedSolutionAmount = component.TransferAmount / component.VaporAmount;
var newSolution = _solutionContainer.SplitSolution(uid, solution, adjustedSolutionAmount);

if (newSolution.Volume <= FixedPoint2.Zero)
break;
Expand Down Expand Up @@ -132,6 +137,12 @@ private void OnAfterInteract(EntityUid uid, SprayComponent component, AfterInter
cooldownTime = MathF.Max(time, cooldownTime);

_vapor.Start(vaporComponent, vaporXform, impulseDirection * diffLength, component.SprayVelocity, target, time, args.User);

if (TryComp<PhysicsComponent>(args.User, out var body))
{
if (_gravity.IsWeightless(args.User, body))
_physics.ApplyLinearImpulse(args.User, -impulseDirection.Normalized() * component.PushbackAmount, body: body);
}
}

_audio.PlayPvs(component.SpraySound, uid, component.SpraySound.Params.WithVariation(0.125f));
Expand Down
Loading

0 comments on commit d0eee50

Please sign in to comment.