Skip to content

Commit

Permalink
Cult! (#770)
Browse files Browse the repository at this point in the history
Co-authored-by: FunTust <[email protected]>
Co-authored-by: Svarshik <[email protected]>
Co-authored-by: Svarshik <[email protected]>
Co-authored-by: stalengd <[email protected]>
Co-authored-by: Theywod <[email protected]>
Co-authored-by: Gnomeev <[email protected]>
Co-authored-by: Kirus59 <[email protected]>
Co-authored-by: EstKemran <[email protected]>
  • Loading branch information
9 people authored Dec 27, 2024
1 parent d47d933 commit 2a86b5f
Show file tree
Hide file tree
Showing 702 changed files with 16,853 additions and 50 deletions.
15 changes: 12 additions & 3 deletions Content.Client/Inventory/ClientInventorySystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -163,18 +163,24 @@ public void SetSlotHighlight(EntityUid owner, InventorySlotsComponent component,
}

public void UpdateSlot(EntityUid owner, InventorySlotsComponent component, string slotName,
bool? blocked = null, bool? highlight = null)
bool? blocked = null, bool? highlight = null, bool? stuckOnEquip = null)//ss220 StuckOnEquip
{
var oldData = component.SlotData[slotName];
var newHighlight = oldData.Highlighted;
var newBlocked = oldData.Blocked;
var newStuckOnEquip = oldData.StuckOnEquip;//ss220 StuckOnEquip

if (blocked != null)
newBlocked = blocked.Value;

if (highlight != null)
newHighlight = highlight.Value;

//ss220 StuckOnEquip begin
if (stuckOnEquip != null)
newStuckOnEquip = stuckOnEquip.Value;
//ss220 StuckOnEquip end

var newData = component.SlotData[slotName] =
new SlotData(component.SlotData[slotName], newHighlight, newBlocked);
if (owner == _playerManager.LocalEntity)
Expand Down Expand Up @@ -255,6 +261,7 @@ public sealed class SlotData
public EntityUid? HeldEntity => Container?.ContainedEntity;
public bool Blocked;
public bool Highlighted;
public bool StuckOnEquip; //ss220 StuckOnEquip

[ViewVariables]
public ContainerSlot? Container;
Expand All @@ -268,20 +275,22 @@ public sealed class SlotData
public string FullTextureName => SlotDef.FullTextureName;

public SlotData(SlotDefinition slotDef, ContainerSlot? container = null, bool highlighted = false,
bool blocked = false)
bool blocked = false, bool stuckOnEquip = false)//ss220 StuckOnEquip
{
SlotDef = slotDef;
Highlighted = highlighted;
Blocked = blocked;
Container = container;
StuckOnEquip = stuckOnEquip; //ss220 StuckOnEquip
}

public SlotData(SlotData oldData, bool highlighted = false, bool blocked = false)
public SlotData(SlotData oldData, bool highlighted = false, bool blocked = false, bool stuckOnEquip = false)//ss220 StuckOnEquip
{
SlotDef = oldData.SlotDef;
Highlighted = highlighted;
Container = oldData.Container;
Blocked = blocked;
StuckOnEquip = stuckOnEquip; //ss220 StuckOnEquip
}

public static implicit operator SlotData(SlotDefinition s)
Expand Down
38 changes: 38 additions & 0 deletions Content.Client/SS220/Bible/ExorcismPerformerSystem.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
// © SS220, An EULA/CLA with a hosting restriction, full text: https://raw.githubusercontent.com/SerbiaStrong-220/space-station-14/master/CLA.txt
using Content.Client.Light.Components;
using Content.Client.Light.EntitySystems;
using Content.Shared.SS220.Bible;
using Robust.Client.GameObjects;

namespace Content.Client.SS220.Bible;

public sealed class ExorcismPerformerSystem : SharedExorcismPerformerSystem
{

[Dependency] private readonly LightBehaviorSystem _lightBehavior = default!;
public override void Initialize()
{
SubscribeLocalEvent<ExorcismPerformerComponent, AppearanceChangeEvent>(OnAppearanceChanged);
}

private void OnAppearanceChanged(Entity<ExorcismPerformerComponent> entity, ref AppearanceChangeEvent args)
{
if (!args.AppearanceData.TryGetValue(ExorcismPerformerVisualState.State, out var value) || value is not ExorcismPerformerVisualState state)
{
return;
}
//ToDo its broken ... Stalen?
/*
if (TryComp(entity, out LightBehaviourComponent? lightBehaviour))
{
// Reset any running behaviour to reset the animated properties back to the original value, to avoid conflicts between resets
_lightBehavior.StopLightBehaviour((entity, lightBehaviour));
if (state == ExorcismPerformerVisualState.Performing)
{
_lightBehavior.StartLightBehaviour(entity.Comp.LightBehaviourId);
}
}
*/
}
}
51 changes: 51 additions & 0 deletions Content.Client/SS220/Bible/UI/ExorcismBoundUserInterface.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
// © SS220, An EULA/CLA with a hosting restriction, full text: https://raw.githubusercontent.com/SerbiaStrong-220/space-station-14/master/CLA.txt
using Content.Shared.SS220.Bible;

namespace Content.Client.SS220.Bible.UI;

public sealed class ExorcismBoundUserInterface : BoundUserInterface
{
[ViewVariables]
private ExorcismMenu? _menu;

[ViewVariables]
public int LengthMin { get; private set; }
[ViewVariables]
public int LengthMax { get; private set; }


public ExorcismBoundUserInterface(EntityUid owner, Enum uiKey) : base(owner, uiKey)
{
}

protected override void Open()
{
_menu = new ExorcismMenu(this);
_menu.OnClose += Close;
_menu.OpenCentered();
}

public void ReadButtonPressed(string message)
{
SendMessage(new ExorcismReadMessage(message));
_menu?.Close();
}

protected override void UpdateState(BoundUserInterfaceState state)
{
if (state is not ExorcismInterfaceState exorcismState)
return;

LengthMin = exorcismState.LengthMin;
LengthMax = exorcismState.LengthMax;
_menu?.RefreshLengthCounter();
}

protected override void Dispose(bool disposing)
{
base.Dispose(disposing);
if (!disposing) return;

_menu?.Dispose();
}
}
11 changes: 11 additions & 0 deletions Content.Client/SS220/Bible/UI/ExorcismMenu.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<!-- © SS220, An EULA/CLA with a hosting restriction, full text: https://raw.githubusercontent.com/SerbiaStrong-220/space-station-14/master/CLA.txt -->
<controls:FancyWindow xmlns="https://spacestation14.io"
xmlns:controls="clr-namespace:Content.Client.UserInterface.Controls"
Title="{Loc 'bible-exorcism-menu-title'}"
MinSize="400 225">
<BoxContainer Orientation="Vertical" HorizontalExpand="True" VerticalExpand="True" Margin="5">
<TextEdit Name="MessageInput" HorizontalExpand="True" VerticalExpand="True" Margin="0 0 0 5" MinHeight="100" />
<Label Name="LengthLabel"></Label>
<Button Name="ReadButton" Text="{Loc 'bible-exorcism-menu-read-button'}" StyleClasses="OpenLeft" Access="Public" />
</BoxContainer>
</controls:FancyWindow>
76 changes: 76 additions & 0 deletions Content.Client/SS220/Bible/UI/ExorcismMenu.xaml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
// © SS220, An EULA/CLA with a hosting restriction, full text: https://raw.githubusercontent.com/SerbiaStrong-220/space-station-14/master/CLA.txt
using Content.Client.UserInterface.Controls;
using Content.Shared.SS220.Bible;
using Robust.Client.AutoGenerated;
using Robust.Client.UserInterface.XAML;
using Robust.Shared.Utility;

namespace Content.Client.SS220.Bible.UI;

[GenerateTypedNameReferences]
public sealed partial class ExorcismMenu : FancyWindow
{
private ExorcismBoundUserInterface Owner { get; set; }

public ExorcismMenu(ExorcismBoundUserInterface owner)
{
IoCManager.InjectDependencies(this);
RobustXamlLoader.Load(this);

Owner = owner;

var loc = IoCManager.Resolve<ILocalizationManager>();
MessageInput.Placeholder = new Rope.Leaf(loc.GetString("bible-exorcism-menu-message-placeholder"));

MessageInput.OnTextChanged += (args) =>
{
var len = GetLength();
if (len < Owner.LengthMin)
{
ReadButton.Disabled = true;
ReadButton.ToolTip = Loc.GetString("bible-exorcism-message-too-short");
}
else if (len > Owner.LengthMax)
{
ReadButton.Disabled = true;
ReadButton.ToolTip = Loc.GetString("bible-exorcism-message-too-long");
}
else
{
ReadButton.Disabled = false;
ReadButton.ToolTip = null;
}
RefreshLengthCounter(len);
};

RefreshLengthCounter();

ReadButton.OnPressed += _ => Owner.ReadButtonPressed(Rope.Collapse(MessageInput.TextRope));
ReadButton.Disabled = true;
}

public override void Close()
{
base.Close();
}

public void RefreshLengthCounter()
{
RefreshLengthCounter(GetLength());
}

protected override void Dispose(bool disposing)
{
base.Dispose(disposing);
}

private void RefreshLengthCounter(int length)
{
LengthLabel.Text = $"{length}/{Owner.LengthMin}";
}

private int GetLength()
{
return ExorcismUtils.GetSanitazedMessageLength(Rope.Collapse(MessageInput.TextRope));
}
}
15 changes: 15 additions & 0 deletions Content.Client/SS220/CultYogg/Altar/CultYoggAltarSystem.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
// © SS220, An EULA/CLA with a hosting restriction, full text: https://raw.githubusercontent.com/SerbiaStrong-220/space-station-14/master/CLA.txt

using Content.Shared.SS220.CultYogg;
using Content.Shared.SS220.CultYogg.Altar;
using Robust.Client.GameObjects;

namespace Content.Client.SS220.CultYogg.Altar;

public sealed partial class CultYoggAltarSystem : SharedCultYoggAltarSystem
{
public override void Initialize()
{
base.Initialize();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
// © SS220, An EULA/CLA with a hosting restriction, full text: https://raw.githubusercontent.com/SerbiaStrong-220/space-station-14/master/CLA.txt
using Content.Shared.StatusIcon;
using Content.Shared.StatusIcon.Components;
using Robust.Shared.Prototypes;
using Content.Shared.SS220.CultYogg.CultYoggIcons;
using Content.Shared.SS220.CultYogg.Sacraficials;
using Robust.Client.Player;

namespace Content.Client.SS220.CultYogg.CultYoggIcon;

public sealed class ShowCultYoggIconsSystem : EntitySystem
{
[Dependency] private readonly IPrototypeManager _prototype = default!;
[Dependency] private readonly IPlayerManager _playerManager = default!;


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

SubscribeLocalEvent<ShowCultYoggIconsComponent, GetStatusIconsEvent>(OnGetCultistsIconsEvent);
SubscribeLocalEvent<CultYoggSacrificialComponent, GetStatusIconsEvent>(OnGetSacraficialIconsEvent);
}

private void OnGetCultistsIconsEvent(Entity<ShowCultYoggIconsComponent> uid, ref GetStatusIconsEvent ev)
{

if (!TryComp<ShowCultYoggIconsComponent>(uid, out var cultComp))
return;

var iconId = cultComp.StatusIcon;

if (_prototype.TryIndex<FactionIconPrototype>(iconId, out var iconPrototype))
ev.StatusIcons.Add(iconPrototype);
else
Log.Error($"Invalid faction icon prototype: {iconPrototype}");
}
private void OnGetSacraficialIconsEvent(Entity<CultYoggSacrificialComponent> uid, ref GetStatusIconsEvent ev)
{
var viewer = _playerManager.LocalSession?.AttachedEntity;
if (viewer == uid)
return;

if (!TryComp<CultYoggSacrificialComponent>(uid, out var sacrComp))
return;

var iconId = sacrComp.StatusIcon;

if (_prototype.TryIndex<FactionIconPrototype>(iconId, out var iconPrototype))
ev.StatusIcons.Add(iconPrototype);
else
Log.Error($"Invalid faction icon prototype: {iconPrototype}");
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
// © SS220, An EULA/CLA with a hosting restriction, full text: https://raw.githubusercontent.com/SerbiaStrong-220/space-station-14/master/CLA.txt
using Content.Shared.SS220.CultYogg.Cultists;
using Robust.Client.GameObjects;

namespace Content.Client.SS220.CultYogg.Cultists;

/// <summary>
/// </summary>
public sealed class AcsendingVisualizerSystem : VisualizerSystem<AcsendingComponent>
{
public override void Initialize()
{
base.Initialize();

SubscribeLocalEvent<AcsendingComponent, ComponentInit>(OnComponentInit);
SubscribeLocalEvent<AcsendingComponent, ComponentShutdown>(OnShutdown);
}

private void OnShutdown(Entity<AcsendingComponent> uid, ref ComponentShutdown args)
{
// Need LayerMapTryGet because Init fails if there's no existing sprite / appearancecomp
// which means in some setups (most frequently no AppearanceComp) the layer never exists.
if (TryComp<SpriteComponent>(uid, out var sprite) &&
sprite.LayerMapTryGet(AcsendingVisualLayers.Particles, out var layer))
{
sprite.RemoveLayer(layer);
}
}

private void OnComponentInit(Entity<AcsendingComponent> uid, ref ComponentInit args)
{
if (!TryComp<SpriteComponent>(uid, out var sprite) || !TryComp(uid, out AppearanceComponent? appearance))
return;

sprite.LayerMapReserveBlank(AcsendingVisualLayers.Particles);
sprite.LayerSetVisible(AcsendingVisualLayers.Particles, true);
sprite.LayerSetShader(AcsendingVisualLayers.Particles, "unshaded");

if (uid.Comp.Sprite != null)
{
sprite.LayerSetRSI(AcsendingVisualLayers.Particles, uid.Comp.Sprite.RsiPath);
sprite.LayerSetState(AcsendingVisualLayers.Particles, uid.Comp.Sprite.RsiState);
}
}
}

public enum AcsendingVisualLayers : byte
{
Particles
}
Loading

0 comments on commit 2a86b5f

Please sign in to comment.