Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master' into munitions-descriptions
Browse files Browse the repository at this point in the history
# Conflicts:
#	Resources/Prototypes/Entities/Objects/Weapons/Guns/Ammunition/Magazines/magnum.yml
  • Loading branch information
Nox38 committed Feb 5, 2025
2 parents bd44f91 + 3a3268b commit f69a70a
Show file tree
Hide file tree
Showing 61 changed files with 911 additions and 552 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
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
28 changes: 0 additions & 28 deletions Content.Server/Weapons/Melee/EnergySword/EnergySwordComponent.cs

This file was deleted.

12 changes: 12 additions & 0 deletions Content.Shared/Containers/DragInsertContainerComponent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,16 @@ public sealed partial class DragInsertContainerComponent : Component
/// </summary>
[DataField, ViewVariables(VVAccess.ReadWrite)]
public bool UseVerbs = true;

/// <summary>
/// The delay in seconds before a drag will be completed.
/// </summary>
[DataField]
public TimeSpan EntryDelay = TimeSpan.Zero;

/// <summary>
/// If entry delay isn't zero, this sets whether an entity dragging itself into the container should be delayed.
/// </summary>
[DataField]
public bool DelaySelfEntry = false;
}
40 changes: 38 additions & 2 deletions Content.Shared/Containers/DragInsertContainerSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,28 @@
using Content.Shared.Administration.Logs;
using Content.Shared.Climbing.Systems;
using Content.Shared.Database;
using Content.Shared.DoAfter;
using Content.Shared.DragDrop;
using Content.Shared.Verbs;
using Robust.Shared.Containers;
using Robust.Shared.Serialization;

namespace Content.Shared.Containers;

public sealed class DragInsertContainerSystem : EntitySystem
public sealed partial class DragInsertContainerSystem : EntitySystem
{
[Dependency] private readonly ISharedAdminLogManager _adminLog = default!;
[Dependency] private readonly ActionBlockerSystem _actionBlocker = default!;
[Dependency] private readonly ClimbSystem _climb = default!;
[Dependency] private readonly SharedContainerSystem _container = default!;
[Dependency] private readonly SharedDoAfterSystem _doAfter = default!;

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

SubscribeLocalEvent<DragInsertContainerComponent, DragDropTargetEvent>(OnDragDropOn, before: new []{ typeof(ClimbSystem)});
SubscribeLocalEvent<DragInsertContainerComponent, DragInsertContainerDoAfterEvent>(OnDragFinished);
SubscribeLocalEvent<DragInsertContainerComponent, CanDropTargetEvent>(OnCanDragDropOn);
SubscribeLocalEvent<DragInsertContainerComponent, GetVerbsEvent<AlternativeVerb>>(OnGetAlternativeVerb);
}
Expand All @@ -33,7 +37,34 @@ private void OnDragDropOn(Entity<DragInsertContainerComponent> ent, ref DragDrop
if (!_container.TryGetContainer(ent, comp.ContainerId, out var container))
return;

args.Handled = Insert(args.Dragged, args.User, ent, container);
if (comp.EntryDelay <= TimeSpan.Zero ||
!comp.DelaySelfEntry && args.User == args.Dragged)
{
//instant insertion
args.Handled = Insert(args.Dragged, args.User, ent, container);
return;
}

//delayed insertion
var doAfterArgs = new DoAfterArgs(EntityManager, args.User, comp.EntryDelay, new DragInsertContainerDoAfterEvent(), ent, args.Dragged, ent)
{
BreakOnDamage = true,
BreakOnMove = true,
NeedHand = false,
};
_doAfter.TryStartDoAfter(doAfterArgs);
args.Handled = true;
}

private void OnDragFinished(Entity<DragInsertContainerComponent> ent, ref DragInsertContainerDoAfterEvent args)
{
if (args.Handled || args.Cancelled || args.Args.Target == null)
return;

if (!_container.TryGetContainer(ent, ent.Comp.ContainerId, out var container))
return;

Insert(args.Args.Target.Value, args.User, ent, container);
}

private void OnCanDragDropOn(Entity<DragInsertContainerComponent> ent, ref CanDropTargetEvent args)
Expand Down Expand Up @@ -117,4 +148,9 @@ public bool Insert(EntityUid target, EntityUid user, EntityUid containerEntity,
_adminLog.Add(LogType.Action, LogImpact.Medium, $"{ToPrettyString(user):player} inserted {ToPrettyString(target):player} into container {ToPrettyString(containerEntity)}");
return true;
}

[Serializable, NetSerializable]
public sealed partial class DragInsertContainerDoAfterEvent : SimpleDoAfterEvent
{
}
}
40 changes: 40 additions & 0 deletions Content.Shared/Weapons/Melee/EnergySword/EnergySwordComponent.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
using Robust.Shared.GameStates;

namespace Content.Shared.Weapons.Melee.EnergySword;

[RegisterComponent, NetworkedComponent, Access(typeof(EnergySwordSystem))]
[AutoGenerateComponentState]
public sealed partial class EnergySwordComponent : Component
{
/// <summary>
/// What color the blade will be when activated.
/// </summary>
[DataField, AutoNetworkedField]
public Color ActivatedColor = Color.DodgerBlue;

/// <summary>
/// A color option list for the random color picker.
/// </summary>
[DataField]
public List<Color> ColorOptions = new()
{
Color.Tomato,
Color.DodgerBlue,
Color.Aqua,
Color.MediumSpringGreen,
Color.MediumOrchid
};

/// <summary>
/// Whether the energy sword has been pulsed by a multitool,
/// causing the blade to cycle RGB colors.
/// </summary>
[DataField, AutoNetworkedField]
public bool Hacked;

/// <summary>
/// RGB cycle rate for hacked e-swords.
/// </summary>
[DataField]
public float CycleRate = 1f;
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
using Content.Shared.Tools.Systems;
using Robust.Shared.Random;

namespace Content.Server.Weapons.Melee.EnergySword;
namespace Content.Shared.Weapons.Melee.EnergySword;

public sealed class EnergySwordSystem : EntitySystem
{
Expand All @@ -22,18 +22,22 @@ public override void Initialize()
SubscribeLocalEvent<EnergySwordComponent, InteractUsingEvent>(OnInteractUsing);
}
// Used to pick a random color for the blade on map init.
private void OnMapInit(EntityUid uid, EnergySwordComponent comp, MapInitEvent args)
private void OnMapInit(Entity<EnergySwordComponent> entity, ref MapInitEvent args)
{
if (comp.ColorOptions.Count != 0)
comp.ActivatedColor = _random.Pick(comp.ColorOptions);
if (entity.Comp.ColorOptions.Count != 0)
{
entity.Comp.ActivatedColor = _random.Pick(entity.Comp.ColorOptions);
Dirty(entity);
}

if (!TryComp(uid, out AppearanceComponent? appearanceComponent))
if (!TryComp(entity, out AppearanceComponent? appearanceComponent))
return;
_appearance.SetData(uid, ToggleableLightVisuals.Color, comp.ActivatedColor, appearanceComponent);

_appearance.SetData(entity, ToggleableLightVisuals.Color, entity.Comp.ActivatedColor, appearanceComponent);
}

// Used to make the make the blade multicolored when using a multitool on it.
private void OnInteractUsing(EntityUid uid, EnergySwordComponent comp, InteractUsingEvent args)
// Used to make the blade multicolored when using a multitool on it.
private void OnInteractUsing(Entity<EnergySwordComponent> entity, ref InteractUsingEvent args)
{
if (args.Handled)
return;
Expand All @@ -42,14 +46,16 @@ private void OnInteractUsing(EntityUid uid, EnergySwordComponent comp, InteractU
return;

args.Handled = true;
comp.Hacked = !comp.Hacked;
entity.Comp.Hacked = !entity.Comp.Hacked;

if (comp.Hacked)
if (entity.Comp.Hacked)
{
var rgb = EnsureComp<RgbLightControllerComponent>(uid);
_rgbSystem.SetCycleRate(uid, comp.CycleRate, rgb);
var rgb = EnsureComp<RgbLightControllerComponent>(entity);
_rgbSystem.SetCycleRate(entity, entity.Comp.CycleRate, rgb);
}
else
RemComp<RgbLightControllerComponent>(uid);
RemComp<RgbLightControllerComponent>(entity);

Dirty(entity);
}
}
Loading

0 comments on commit f69a70a

Please sign in to comment.