Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
using Content.Client._DEN.Holosign.UI;
using Content.Shared._DEN.Holosign.Components;
using Content.Shared._DEN.Holosign.Events;
using Content.Shared._DEN.Holosign.Systems;
using Robust.Client.GameObjects;


namespace Content.Client._DEN.Holosign.Systems;


public sealed partial class LabelableHolosignProjectorSystem : SharedLabelableHolosignProjectorSystem
{
protected override void UpdateUI(Entity<LabelableHolosignProjectorComponent> ent)
{
if (_uiSystem.TryGetOpenUi(ent.Owner, LabelableHolosignUIKey.Description, out var bui)
&& bui is LabelableHolosignProjectorDescriptionBUI cBui)
{
cBui.Reload();
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
using Content.Shared._DEN.Holosign.Components;
using Content.Shared._DEN.Holosign.Events;
using JetBrains.Annotations;
using Robust.Client.UserInterface;

namespace Content.Client._DEN.Holosign.UI;

[UsedImplicitly]
public sealed partial class LabelableHolosignProjectorDescriptionBUI : BoundUserInterface
{
[Dependency] private IEntityManager _entManager = default!;

[ViewVariables]
private LabelableHolosignProjectorWindow? _window;

public LabelableHolosignProjectorDescriptionBUI(EntityUid owner, Enum uiKey) : base(owner, uiKey)
{
IoCManager.InjectDependencies(this);
}

protected override void Open()
{
base.Open();
_window = this.CreateWindow<LabelableHolosignProjectorWindow>();
_window.OnDescriptionChanged += OnDescriptionChanged;
Reload();
}

private void OnDescriptionChanged(string description, bool isNsfw)
{
if (_entManager.TryGetComponent(Owner, out LabelableHolosignProjectorComponent? projector) &&
projector.BarrierDescription.Equals(description) && projector.IsNsfw == isNsfw)
return;

SendPredictedMessage(new LabelableHolosignDescriptionMessage(description, isNsfw));
}

public void Reload()
{
if (_window == null || !_entManager.TryGetComponent(Owner, out LabelableHolosignProjectorComponent? projector))
return;

_window.SetCurrentDescription(projector.BarrierDescription);
_window.SetCurrentNsfw(projector.IsNsfw);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
using Content.Client.UserInterface.Controls;
using Content.Shared._DEN.Holosign.Components;
using Content.Shared._DEN.Holosign.Events;
using JetBrains.Annotations;
using Robust.Client.GameObjects;
using Robust.Client.Player;
using Robust.Client.UserInterface;
using Robust.Shared.Prototypes;
using Robust.Shared.Utility;

namespace Content.Client._DEN.Holosign.UI;

[UsedImplicitly]
public sealed partial class LabelableHolosignProjectorSignBUI : BoundUserInterface
{
[Dependency] private IEntityManager _entManager = default!;
[Dependency] private IPrototypeManager _protoManager = default!;

[ViewVariables] private SimpleRadialMenu? _menu;

public LabelableHolosignProjectorSignBUI(EntityUid owner, Enum uiKey) : base(owner, uiKey)
{
IoCManager.InjectDependencies(this);
}

protected override void Open()
{
base.Open();

_menu = this.CreateWindow<SimpleRadialMenu>();
_menu.Track(Owner);

var controls = new List<RadialMenuActionOptionBase>();
controls.Add(new RadialMenuActionOption<LabelableHolosignUIKey>(OpenDescriptionWindow, LabelableHolosignUIKey.Description)
{
IconSpecifier = RadialMenuIconSpecifier.With(new SpriteSpecifier.Texture(new("/Textures/Interface/examine-star.png"))),
ToolTip = Loc.GetString("labelable-holoprojector-ui-set-description")
});

if (_entManager.TryGetComponent(Owner, out LabelableHolosignProjectorComponent? projector))
{
foreach (var proto in projector.SignProtos)
{
if (_protoManager.TryIndex(proto, out var entProto))
{
controls.Add(
new RadialMenuActionOption<EntProtoId>(SelectSignProto, proto)
{
IconSpecifier = RadialMenuIconSpecifier.With(entProto),
ToolTip = Loc.GetString(entProto.Name),
});
}
}
}
_menu.SetButtons(controls);
}

private void SelectSignProto(EntProtoId protoId)
{
if (!_entManager.TryGetComponent(Owner, out LabelableHolosignProjectorComponent? projector))
return;

var selected = projector.SignProtos.IndexOf(protoId);
SendPredictedMessage(new LabelableHolosignSignChosen(selected));
}

private void OpenDescriptionWindow(LabelableHolosignUIKey key)
{
SendPredictedMessage(new LabelableHolosignOpenOtherUI());
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<DefaultWindow xmlns="https://spacestation14.io"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="{Loc 'labelable-holoprojector-ui-header'}"
MinHeight="180"
MinWidth="340">
<BoxContainer
Orientation="Vertical"
HorizontalExpand="False"
VerticalExpand="True"
Margin="3">
<Label Name="CurrentTextLabel" Text="{Loc 'labelable-holoprojector-current-text-label'}" />
<TextEdit Name="DescriptionTextEdit"
VerticalExpand="True"
HorizontalExpand="True"
VerticalAlignment="Stretch"
HorizontalAlignment="Stretch"
MinHeight="100"/>
<BoxContainer Orientation="Horizontal" Margin="3">
<CheckBox Name="IsNSFW" />
<Label Text="{Loc 'labelable-holoprojector-is-nsfw-label'}" />
</BoxContainer>
</BoxContainer>
</DefaultWindow>
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
using Robust.Client.AutoGenerated;
using Robust.Client.UserInterface.CustomControls;
using Robust.Client.UserInterface.XAML;
using Robust.Shared.Utility;

namespace Content.Client._DEN.Holosign.UI;

[GenerateTypedNameReferences]
public sealed partial class LabelableHolosignProjectorWindow : DefaultWindow
{
public event Action<string, bool>? OnDescriptionChanged;

private string _description = string.Empty;

public LabelableHolosignProjectorWindow()
{
RobustXamlLoader.Load(this);

DescriptionTextEdit.OnTextChanged += e =>
{
var text = Rope.Collapse(e.TextRope).Trim();
_description = text;
OnDescriptionChanged?.Invoke(_description, IsNSFW.Pressed);
};

IsNSFW.OnPressed += e =>
{
var text = Rope.Collapse(DescriptionTextEdit.TextRope).Trim();
_description = text;
OnDescriptionChanged?.Invoke(_description, IsNSFW.Pressed);
};
}

public void SetCurrentDescription(string description)
{
if (description == _description)
return;

_description = description;
if (!DescriptionTextEdit.HasKeyboardFocus())
{
var rope = new Rope.Leaf(description);
DescriptionTextEdit.TextRope = rope;
}
}

public void SetCurrentNsfw(bool isNsfw)
{
IsNSFW.Pressed = isNsfw;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
using Content.Shared._DEN.Holosign.Systems;


namespace Content.Server._DEN.Holosign.Systems;


public sealed class LabelableHolosignProjectorSystem : SharedLabelableHolosignProjectorSystem
{
}
6 changes: 6 additions & 0 deletions Content.Shared/Climbing/Components/ClimbableComponent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,5 +38,11 @@ public sealed partial class ClimbableComponent : Component
/// </summary>
[DataField("finishClimbSound")]
public SoundSpecifier? FinishClimbSound = null;

// DEN: Allow climbing while clumsy
/// <summary>
/// Should this be climbable even while clumsy?
/// </summary>
[DataField] public bool BypassClumsy = false;
}
}
4 changes: 4 additions & 0 deletions Content.Shared/Clumsy/ClumsySystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,10 @@ private void OnBeforeClimbEvent(Entity<ClumsyComponent> ent, ref SelfBeforeClimb
if (!ent.Comp.ClumsyVaulting)
return;

// DEN: Allow climbables to bypass clumsy.
if (args.BeingClimbedOn.Comp.BypassClumsy)
return;

if (!_cfg.GetCVar(CCVars.GameTableBonk)
&& !SharedRandomExtensions.PredictedProb(_timing, ent.Comp.ClumsyDefaultCheck, GetNetEntity(ent)))
return;
Expand Down
5 changes: 5 additions & 0 deletions Content.Shared/PDA/PdaComponent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ public sealed partial class PdaComponent : Component
public const string PdaIdSlotId = "PDA-id";
public const string PdaPenSlotId = "PDA-pen";
public const string PdaPaiSlotId = "PDA-pai";
public const string ProjectorSlotId = "PDA-projector"; // DEN: Projector slot in PDA.

[DataField("idSlot")]
public ItemSlot IdSlot = new();
Expand All @@ -20,6 +21,10 @@ public sealed partial class PdaComponent : Component
public ItemSlot PenSlot = new();
[DataField("paiSlot")]
public ItemSlot PaiSlot = new();

// DEN: Allow slotting civilian projectors into the PDA.
[DataField("projectorSlot")]
public ItemSlot ProjectorSlot = new();

// Really this should just be using ItemSlot.StartingItem. However, seeing as we have so many different starting
// PDA's and no nice way to inherit the other fields from the ItemSlot data definition, this makes the yaml much
Expand Down
2 changes: 2 additions & 0 deletions Content.Shared/PDA/SharedPdaSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ protected virtual void OnComponentInit(EntityUid uid, PdaComponent pda, Componen
ItemSlotsSystem.AddItemSlot(uid, PdaComponent.PdaIdSlotId, pda.IdSlot);
ItemSlotsSystem.AddItemSlot(uid, PdaComponent.PdaPenSlotId, pda.PenSlot);
ItemSlotsSystem.AddItemSlot(uid, PdaComponent.PdaPaiSlotId, pda.PaiSlot);
ItemSlotsSystem.AddItemSlot(uid, PdaComponent.ProjectorSlotId, pda.ProjectorSlot); // DEN: Projector Slot

UpdatePdaAppearance(uid, pda);
}
Expand All @@ -40,6 +41,7 @@ private void OnComponentRemove(EntityUid uid, PdaComponent pda, ComponentRemove
ItemSlotsSystem.RemoveItemSlot(uid, pda.IdSlot);
ItemSlotsSystem.RemoveItemSlot(uid, pda.PenSlot);
ItemSlotsSystem.RemoveItemSlot(uid, pda.PaiSlot);
ItemSlotsSystem.RemoveItemSlot(uid, pda.ProjectorSlot); // DEN: Projector Slot
}

protected virtual void OnItemInserted(EntityUid uid, PdaComponent pda, EntInsertedIntoContainerMessage args)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
using Content.Shared._DEN.Holosign.Systems;
using Content.Shared.Whitelist;
using Robust.Shared.GameStates;
using Robust.Shared.Prototypes;

namespace Content.Shared._DEN.Holosign.Components;

[RegisterComponent, NetworkedComponent, AutoGenerateComponentState(true), Access(typeof(SharedLabelableHolosignProjectorSystem))]
public sealed partial class LabelableHolosignProjectorComponent : Component
{
/// <summary>
/// The entity to spawn with this projector.
/// </summary>
[DataField(required: true), Access(Other = AccessPermissions.ReadWriteExecute)]
public List<EntProtoId> SignProtos;

[DataField, AutoNetworkedField] public EntProtoId? SelectedSignProto;

[DataField]
public EntityWhitelist SignWhitelist;

[DataField]
public bool UsesCharges = false;

[ViewVariables(VVAccess.ReadWrite), Access(Other = AccessPermissions.ReadWriteExecute)]
[DataField, AutoNetworkedField]
public string BarrierDescription = string.Empty;

/// <summary>
/// The maximum length of a description that can be attached to a barrier.
/// </summary>
[ViewVariables(VVAccess.ReadWrite)]
[DataField, AutoNetworkedField]
public int MaxDescriptionChars = 512;

[DataField, AutoNetworkedField]
public bool IsNsfw;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
using Content.Shared._DEN.Holosign.Systems;
using Robust.Shared.GameStates;


namespace Content.Shared._DEN.Holosign.Components;

[RegisterComponent, NetworkedComponent, AutoGenerateComponentState, Access(typeof(SharedLabelableHolosignProjectorSystem))]
public sealed partial class LabeledHolosignComponent : Component
{
[DataField, AutoNetworkedField]
public string Description;

[DataField, AutoNetworkedField]
public bool IsNSFW;
}
26 changes: 26 additions & 0 deletions Content.Shared/_DEN/Holosign/Events/LabelableHolosignEvents.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
using Robust.Shared.Serialization;

namespace Content.Shared._DEN.Holosign.Events;

[Serializable, NetSerializable]
public enum LabelableHolosignUIKey
{
Signs,
Description,
}

[Serializable, NetSerializable]
public sealed class LabelableHolosignDescriptionMessage(string description, bool isNsfw) : BoundUserInterfaceMessage
{
public string Description { get; } = description;
public bool IsNsfw { get; } = isNsfw;
}

[Serializable, NetSerializable]
public sealed class LabelableHolosignSignChosen(int selection) : BoundUserInterfaceMessage
{
public int Selection { get; } = selection;
}

[Serializable, NetSerializable]
public sealed class LabelableHolosignOpenOtherUI : BoundUserInterfaceMessage;
Loading
Loading