Skip to content
Draft
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
46 changes: 46 additions & 0 deletions Content.Client/_Goobstation/Heretic/EntitySystems/GhoulSystem.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
using Content.Shared.Examine;
using Content.Shared.Ghost.Roles.Components;
using Content.Shared.Heretic;
using Content.Shared.Humanoid;
using Content.Shared.Interaction.Events;
using Content.Shared.Mobs;
using Content.Shared.Mobs.Components;
using Content.Shared.Nutrition.AnimalHusbandry;
using Content.Shared.Nutrition.Components;
using Content.Shared.Zombies;
using Robust.Client.GameObjects;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Content.Client.Heretic.EntitySystems
{
public sealed partial class GhoulSystem : Shared.Heretic.EntitySystems.SharedGhoulSystem
{
public override void Initialize()
{
base.Initialize();

SubscribeLocalEvent<GhoulComponent, ComponentStartup>(OnStartup);

}


public void OnStartup(EntityUid uid, GhoulComponent component, ComponentStartup args) {
var ghoulcolor = Color.FromHex("#505050");

if (!HasComp<HumanoidAppearanceComponent>(uid))
{
if (!TryComp<SpriteComponent>(uid, out var sprite))
return;

for (var i = 0; i < sprite.AllLayers.Count(); i++)
{
sprite.LayerSetColor(i, ghoulcolor);
}
}
}
}
}
61 changes: 61 additions & 0 deletions Content.Client/_Goobstation/Heretic/HereticCombatMarkSystem.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
using Content.Shared.Heretic;
using Robust.Client.GameObjects;
using Robust.Shared.Utility;

namespace Content.Client.Heretic;

public sealed partial class HereticCombatMarkSystem : EntitySystem
{
public override void Initialize()
{
base.Initialize();

SubscribeLocalEvent<HereticCombatMarkComponent, ComponentStartup>(OnStartup);
SubscribeLocalEvent<HereticCombatMarkComponent, ComponentShutdown>(OnShutdown);
}
public override void Update(float frameTime)
{
base.Update(frameTime);

// i can't think of a better way to do this. everything else has failed
// god i hate client server i hate client server i hate client server i hate
foreach (var mark in EntityQuery<HereticCombatMarkComponent>())
{
if (!TryComp<SpriteComponent>(mark.Owner, out var sprite))
continue;

if (!sprite.LayerMapTryGet(0, out var layer))
continue;

sprite.LayerSetState(layer, mark.Path.ToLower());
}
}

private void OnStartup(Entity<HereticCombatMarkComponent> ent, ref ComponentStartup args)
{
if (!TryComp<SpriteComponent>(ent, out var sprite))
return;

if (sprite.LayerMapTryGet(0, out var l))
{
sprite.LayerSetState(l, ent.Comp.Path.ToLower());
return;
}

var rsi = new SpriteSpecifier.Rsi(new ResPath("_Goobstation/Heretic/combat_marks.rsi"), ent.Comp.Path.ToLower());
var layer = sprite.AddLayer(rsi);

sprite.LayerMapSet(0, layer);
sprite.LayerSetShader(layer, "unshaded");
}
private void OnShutdown(Entity<HereticCombatMarkComponent> ent, ref ComponentShutdown args)
{
if (!TryComp<SpriteComponent>(ent, out var sprite))
return;

if (!sprite.LayerMapTryGet(0, out var layer))
return;

sprite.RemoveLayer(layer);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
using Content.Client._Goobstation.Heretic.UI;
using Content.Shared._Goobstation.Heretic.Components;
using Content.Shared.Heretic.Prototypes;
using Robust.Client.Graphics;
using Robust.Client.Input;
using Robust.Client.UserInterface;
using Robust.Shared.Prototypes;

namespace Content.Client._Goobstation.Heretic;

public sealed class HereticRitualRuneBoundUserInterface : BoundUserInterface
{
[Dependency] private readonly IClyde _displayManager = default!;
[Dependency] private readonly IInputManager _inputManager = default!;

private HereticRitualRuneRadialMenu? _hereticRitualMenu;

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

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

_hereticRitualMenu = this.CreateWindow<HereticRitualRuneRadialMenu>();
_hereticRitualMenu.SetEntity(Owner);
_hereticRitualMenu.SendHereticRitualRuneMessageAction += SendHereticRitualMessage;

var vpSize = _displayManager.ScreenSize;
_hereticRitualMenu.OpenCenteredAt(_inputManager.MouseScreenPosition.Position / vpSize);
}

private void SendHereticRitualMessage(ProtoId<HereticRitualPrototype> protoId)
{
SendMessage(new HereticRitualMessage(protoId));
}
}
67 changes: 67 additions & 0 deletions Content.Client/_Goobstation/Heretic/Ritual.CustomBehaviors.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
using Content.Shared.Heretic.Prototypes;

namespace Content.Client.Heretic;

// these do nothing and are there just for yaml limter to shut the fuck up.
// make sure they stay up in sync with the server counterpart.
// regards.
// - john

public sealed partial class RitualAshAscendBehavior : RitualSacrificeBehavior { }
public sealed partial class RitualMuteGhoulifyBehavior : RitualSacrificeBehavior { }

[Virtual] public partial class RitualSacrificeBehavior : RitualCustomBehavior
{
public override bool Execute(RitualData args, out string? outstr)
{
outstr = null;
return true;
}

public override void Finalize(RitualData args)
{
// do nothing
}
}

public sealed partial class RitualTemperatureBehavior : RitualCustomBehavior
{
public override bool Execute(RitualData args, out string? outstr)
{
outstr = null;
return true;
}

public override void Finalize(RitualData args)
{
// do nothing
}
}

public sealed partial class RitualReagentPuddleBehavior : RitualCustomBehavior
{
public override bool Execute(RitualData args, out string? outstr)
{
outstr = null;
return true;
}

public override void Finalize(RitualData args)
{
// do nothing
}
}

public sealed partial class RitualKnowledgeBehavior : RitualCustomBehavior
{
public override bool Execute(RitualData args, out string? outstr)
{
outstr = null;
return true;
}

public override void Finalize(RitualData args)
{
// do nothing
}
}
25 changes: 25 additions & 0 deletions Content.Client/_Goobstation/Heretic/UI/HellMemoryEui.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
using Content.Client.Eui;

namespace Content.Client._Goobstation.Heretic.UI;

public sealed class HellMemoryEui : BaseEui
{
private readonly HellMemoryMenu _menu;

public HellMemoryEui()
{
_menu = new HellMemoryMenu();
}

public override void Opened()
{
_menu.OpenCentered();
}

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

_menu.Close();
}
}
10 changes: 10 additions & 0 deletions Content.Client/_Goobstation/Heretic/UI/HellMemoryMenu.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<controls:FancyWindow xmlns="https://spacestation14.io"
xmlns:controls="clr-namespace:Content.Client.UserInterface.Controls"
Title="{Loc 'hell-memory-title'}">
<BoxContainer Orientation="Vertical" Margin="5">
<Label Text="{Loc 'hell-memory-text'}"/>
<BoxContainer Orientation="Horizontal" Align="Center">
<Button Name="ConfirmButton" Text="{Loc 'hell-memory-confirm'}"/>
</BoxContainer>
</BoxContainer>
</controls:FancyWindow>
17 changes: 17 additions & 0 deletions Content.Client/_Goobstation/Heretic/UI/HellMemoryMenu.xaml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
using Content.Client.UserInterface.Controls;
using Robust.Client.AutoGenerated;
using Robust.Client.UserInterface.XAML;

namespace Content.Client._Goobstation.Heretic.UI;


[GenerateTypedNameReferences]
public sealed partial class HellMemoryMenu : FancyWindow
{
public HellMemoryMenu()
{
RobustXamlLoader.Load(this);

ConfirmButton.OnPressed += _ => Close();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<ui:RadialMenu xmlns="https://spacestation14.io"
xmlns:ui="clr-namespace:Content.Client.UserInterface.Controls"
BackButtonStyleClass="RadialMenuBackButton"
CloseButtonStyleClass="RadialMenuCloseButton"
VerticalExpand="True"
HorizontalExpand="True"
MinSize="450 450">

<!-- Main -->
<ui:RadialContainer Name="Main" VerticalExpand="True" HorizontalExpand="True" InitialRadius="100" ReserveSpaceForHiddenChildren="False">
</ui:RadialContainer>

</ui:RadialMenu>
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
using Content.Client.UserInterface.Controls;
using Content.Shared.Heretic;
using Content.Shared.Heretic.Prototypes;
using Robust.Client.GameObjects;
using Robust.Client.UserInterface.Controls;
using Robust.Client.UserInterface.XAML;
using Robust.Shared.Player;
using Robust.Shared.Prototypes;
using System.Numerics;

namespace Content.Client._Goobstation.Heretic.UI;

public sealed partial class HereticRitualRuneRadialMenu : RadialMenu
{
[Dependency] private readonly EntityManager _entityManager = default!;
[Dependency] private readonly IEntitySystemManager _entitySystem = default!;
[Dependency] private readonly IPrototypeManager _prototypeManager = default!;
[Dependency] private readonly ISharedPlayerManager _playerManager = default!;
private readonly SpriteSystem _spriteSystem;

public event Action<ProtoId<HereticRitualPrototype>>? SendHereticRitualRuneMessageAction;

public EntityUid Entity { get; set; }

public HereticRitualRuneRadialMenu()
{
IoCManager.InjectDependencies(this);
RobustXamlLoader.Load(this);
_spriteSystem = _entitySystem.GetEntitySystem<SpriteSystem>();
}

public void SetEntity(EntityUid uid)
{
Entity = uid;
RefreshUI();
}

private void RefreshUI()
{
var main = FindControl<RadialContainer>("Main");
if (main == null)
return;

var player = _playerManager.LocalEntity;

if (!_entityManager.TryGetComponent<HereticComponent>(player, out var heretic))
return;

foreach (var ritual in heretic.KnownRituals)
{
if (!_prototypeManager.TryIndex(ritual, out var ritualPrototype))
continue;

var button = new HereticRitualMenuButton
{
SetSize = new Vector2(64, 64),
ToolTip = Loc.GetString(ritualPrototype.LocName),
ProtoId = ritualPrototype.ID
};

var texture = new TextureRect
{
VerticalAlignment = VAlignment.Center,
HorizontalAlignment = HAlignment.Center,
Texture = _spriteSystem.Frame0(ritualPrototype.Icon),
TextureScale = new Vector2(2f, 2f)
};

button.AddChild(texture);
main.AddChild(button);
}

AddHereticRitualMenuButtonOnClickAction(main);
}

private void AddHereticRitualMenuButtonOnClickAction(RadialContainer mainControl)
{
if (mainControl == null)
return;

foreach(var child in mainControl.Children)
{
var castChild = child as HereticRitualMenuButton;

if (castChild == null)
continue;

castChild.OnButtonUp += _ =>
{
SendHereticRitualRuneMessageAction?.Invoke(castChild.ProtoId);
Close();
};
}
}

public sealed class HereticRitualMenuButton : RadialMenuTextureButtonWithSector
{
public ProtoId<HereticRitualPrototype> ProtoId { get; set; }
}
}
Loading
Loading