Skip to content

Commit

Permalink
Heretics update part 3 (space-syndicate#726)
Browse files Browse the repository at this point in the history
* i got that dawg in me

* dasasdsaddas

* jhkhkjj

* my lazy ass is not doing the rest

* finally.

* finally.

* jesus christ 1

* help me

* jesus christ 2

* UAAAAWHGHHGG BUABHAUBHAUBHHGH

* jesus christ 3

* sdfjsdkghjdfkljbhsfuobd

* 1984

* ash lore update

* THE CURSE OF 220

* ultra violencce

* fart

* fdgfdgbfdbf

* fgbdfgndfgn

* it's raw propheting time

* blbkblbkglbgkbgbgbgdfbfgbbb AAAAAAAAAAAAAAAAAAAAAAAAA

* fdbfsgbybdf

* bkbgkblkgbgbngfkb

* void path part 1

* REAL!!!!!!

* it is working

* ok looks good to me

* random influence spawn

* hey shitass, wanna see me bypass yaml linter?

* RAAAAAAAAAAGH

* dghgdfbsfdgbsdf

* dfvsfvavsd

* help

* help

* bbnvbnvmvbnmvbnmvbn

* guiedbook

* fhfdsghfgdhdfgh

* AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA

* please

* fucking
die

* vlkblvkbbgjhjfbhnbkvbnf A

* i am malding

* 6666 lines

* FUCK

* GOD SAVE MY SOUL!!

* revert store shitassery

* dfvdfgdf

* Reapply "Uplink discounts (space-syndicate#580)"

This reverts commit 55540db.

* more uplink shittery revert

* FUCK

* based

* dvsfv

* dghfgghfgh

* blnkbnbknlbnklb

* :finnadie:

* finally. :finnadie:

* yeah

* bnbnmbvnm

* vblknknvblnkvblknklvbn

* fuck

* gaming

* bnkb,nkvbnklvbknvb

* final fixez

* I AM GOING TO KILL MYSELF

* finally

* yay guidebook

* ugh

* fuck

* fuck

* bruh.

* guidebook

* bruh

* source

* f-

---------

Co-authored-by: whateverusername0 <whateveremail>
Co-authored-by: Piras314 <[email protected]>
  • Loading branch information
whateverusername0 and Piras314 authored Oct 5, 2024
1 parent 3af5e38 commit 42cb6ed
Show file tree
Hide file tree
Showing 31 changed files with 535 additions and 124 deletions.
16 changes: 16 additions & 0 deletions Content.Client/_Goobstation/Heretic/UI/LivingHeartMenu.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<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">

<ui:RadialContainer Name="Main"
VerticalExpand="True"
HorizontalExpand="True"
Radius="64"
ReserveSpaceForHiddenChildren="False"/>


</ui:RadialMenu>
97 changes: 97 additions & 0 deletions Content.Client/_Goobstation/Heretic/UI/LivingHeartMenu.xaml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
using Content.Client.UserInterface.Controls;
using Content.Shared.Heretic;
using Robust.Client.Player;
using Robust.Client.UserInterface.Controls;
using Robust.Client.UserInterface.XAML;
using Robust.Shared.Prototypes;
using System.Numerics;

namespace Content.Client._Goobstation.Heretic.UI;

public sealed partial class LivingHeartMenu : RadialMenu
{
[Dependency] private readonly EntityManager _ent = default!;
[Dependency] private readonly IPrototypeManager _prot = default!;
[Dependency] private readonly IPlayerManager _player = default!;

public EntityUid Entity { get; private set; }

public event Action<NetEntity>? SendActivateMessageAction;

public LivingHeartMenu()
{
IoCManager.InjectDependencies(this);
RobustXamlLoader.Load(this);
}

public void SetEntity(EntityUid ent)
{
Entity = ent;
UpdateUI();
}

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

var player = _player.LocalEntity;

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

foreach (var target in heretic.SacrificeTargets)
{
if (target == null) continue;

var ent = _ent.GetEntity(target);
if (ent == null)
continue;

var button = new EmbeddedEntityMenuButton
{
StyleClasses = { "RadialMenuButton" },
SetSize = new Vector2(64, 64),
ToolTip = _ent.TryGetComponent<MetaDataComponent>(ent.Value, out var md) ? md.EntityName : "Unknown",
NetEntity = (NetEntity) target,
};

var texture = new SpriteView(ent.Value, _ent)
{
OverrideDirection = Direction.South,
VerticalAlignment = VAlignment.Center,
SetSize = new Vector2(64, 64),
VerticalExpand = true,
Stretch = SpriteView.StretchMode.Fill,
};
button.AddChild(texture);

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

private void AddAction(RadialContainer main)
{
if (main == null)
return;

foreach (var child in main.Children)
{
var castChild = child as EmbeddedEntityMenuButton;
if (castChild == null)
continue;

castChild.OnButtonUp += _ =>
{
SendActivateMessageAction?.Invoke(castChild.NetEntity);
Close();
};
}
}

public sealed class EmbeddedEntityMenuButton : RadialMenuTextureButton
{
public NetEntity NetEntity;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
using Content.Shared.Heretic;
using Robust.Client.Graphics;
using Robust.Client.Input;
using Robust.Client.UserInterface;

namespace Content.Client._Goobstation.Heretic.UI;

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

[NonSerialized] private LivingHeartMenu? _menu;

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

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

_menu = this.CreateWindow<LivingHeartMenu>();
_menu.SetEntity(Owner);
_menu.SendActivateMessageAction += SendMessage;
_menu.OpenCenteredAt(_inputManager.MouseScreenPosition.Position / _displayManager.ScreenSize);
}

private void SendMessage(NetEntity netent)
{
base.SendMessage(new EventHereticLivingHeartActivate() { Target = netent });
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,11 @@ private void OnVolcano(Entity<HereticComponent> ent, ref EventHereticVolcanoBlas
return;

var ignoredTargets = new List<EntityUid>();

// all ghouls are immune to heretic shittery
foreach (var e in EntityQuery<GhoulComponent>())
ignoredTargets.Add(e.Owner);

// all heretics with the same path are also immune
foreach (var e in EntityQuery<HereticComponent>())
if (e.CurrentPath == ent.Comp.CurrentPath)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,9 @@ private void OnFleshSurgery(Entity<HereticComponent> ent, ref EventHereticFleshS
}
private void OnFleshSurgeryDoAfter(Entity<HereticComponent> ent, ref EventHereticFleshSurgeryDoAfter args)
{
if (args.Cancelled)
return;

if (args.Target == null) // shouldn't really happen. just in case
return;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@
using Robust.Shared.Map;
using Content.Shared.StatusEffect;
using Content.Shared.Throwing;
using Content.Server.Station.Systems;
using Content.Shared.Localizations;
using Robust.Shared.Audio;
using Content.Shared.Mobs.Components;

namespace Content.Server.Heretic.Abilities;

Expand Down Expand Up @@ -56,6 +60,9 @@ public sealed partial class HereticAbilitySystem : EntitySystem
[Dependency] private readonly PhysicsSystem _phys = default!;
[Dependency] private readonly SharedStunSystem _stun = default!;
[Dependency] private readonly ThrowingSystem _throw = default!;
[Dependency] private readonly SharedUserInterfaceSystem _ui = default!;
[Dependency] private readonly StationSystem _station = default!;
[Dependency] private readonly IMapManager _mapMan = default!;

private List<EntityUid> GetNearbyPeople(Entity<HereticComponent> ent, float range)
{
Expand Down Expand Up @@ -86,6 +93,9 @@ public override void Initialize()
SubscribeLocalEvent<HereticComponent, EventHereticOpenStore>(OnStore);
SubscribeLocalEvent<HereticComponent, EventHereticMansusGrasp>(OnMansusGrasp);

SubscribeLocalEvent<HereticComponent, EventHereticLivingHeart>(OnLivingHeart);
SubscribeLocalEvent<HereticComponent, EventHereticLivingHeartActivate>(OnLivingHeartActivate);

SubscribeLocalEvent<GhoulComponent, EventHereticMansusLink>(OnMansusLink);
SubscribeLocalEvent<GhoulComponent, HereticMansusLinkDoAfter>(OnMansusLinkDoafter);

Expand All @@ -105,9 +115,6 @@ private bool TryUseAbility(EntityUid ent, BaseActionEvent args)
// check if any magic items are worn
if (TryComp<HereticComponent>(ent, out var hereticComp) && actionComp.RequireMagicItem && !hereticComp.Ascended)
{
if (hereticComp.CodexActive)
return true;

var ev = new CheckMagicItemEvent();
RaiseLocalEvent(ent, ev);

Expand Down Expand Up @@ -160,6 +167,59 @@ private void OnMansusGrasp(Entity<HereticComponent> ent, ref EventHereticMansusG
ent.Comp.MansusGraspActive = true;
args.Handled = true;
}
private void OnLivingHeart(Entity<HereticComponent> ent, ref EventHereticLivingHeart args)
{
if (!TryUseAbility(ent, args))
return;

if (!TryComp<UserInterfaceComponent>(ent, out var uic))
return;

if (ent.Comp.SacrificeTargets.Count == 0)
{
_popup.PopupEntity(Loc.GetString("heretic-livingheart-notargets"), ent, ent);
args.Handled = true;
return;
}

_ui.OpenUi((ent, uic), HereticLivingHeartKey.Key, ent);
args.Handled = true;
}
private void OnLivingHeartActivate(Entity<HereticComponent> ent, ref EventHereticLivingHeartActivate args)
{
var loc = string.Empty;

var target = GetEntity(args.Target);
if (target == null)
return;

if (!TryComp<MobStateComponent>(target, out var mobstate))
return;
var state = mobstate.CurrentState;

var xquery = GetEntityQuery<TransformComponent>();
var targetStation = _station.GetOwningStation(target);
var ownStation = _station.GetOwningStation(ent);

var isOnStation = targetStation != null && targetStation == ownStation;

var ang = Angle.Zero;
if (_mapMan.TryFindGridAt(_transform.GetMapCoordinates(Transform(ent)), out var grid, out var _))
ang = Transform(grid).LocalRotation;

var vector = _transform.GetWorldPosition((EntityUid) target, xquery) - _transform.GetWorldPosition(ent, xquery);
var direction = (vector.ToWorldAngle() - ang).GetDir();

var locdir = ContentLocalizationManager.FormatDirection(direction).ToLower();
var locstate = state.ToString().ToLower();

if (isOnStation)
loc = Loc.GetString("heretic-livingheart-onstation", ("state", locstate), ("direction", locdir));
else loc = Loc.GetString("heretic-livingheart-offstation", ("state", locstate), ("direction", locdir));

_popup.PopupEntity(loc, ent, ent, PopupType.Medium);
_aud.PlayPvs(new SoundPathSpecifier("/Audio/_Goobstation/Heretic/heartbeat.ogg"), ent, AudioParams.Default.WithVolume(-3f));
}

private void OnMansusLink(Entity<GhoulComponent> ent, ref EventHereticMansusLink args)
{
Expand Down Expand Up @@ -191,6 +251,9 @@ private void OnMansusLink(Entity<GhoulComponent> ent, ref EventHereticMansusLink
}
private void OnMansusLinkDoafter(Entity<GhoulComponent> ent, ref HereticMansusLinkDoAfter args)
{
if (args.Cancelled)
return;

var reciever = EnsureComp<IntrinsicRadioReceiverComponent>(args.Target);
var transmitter = EnsureComp<IntrinsicRadioTransmitterComponent>(args.Target);
var radio = EnsureComp<ActiveRadioComponent>(args.Target);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ private void Cycle(Entity<AristocratComponent> ent)
continue;

if (TryComp<TemperatureComponent>(look, out var temp))
_temp.ChangeHeat(look, -100f, true, temp);
_temp.ChangeHeat(look, -200f, true, temp);

_statusEffect.TryAddStatusEffect<MutedComponent>(look, "Muted", TimeSpan.FromSeconds(5), true);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@ public void AddKnowledge(EntityUid uid, HereticComponent comp, ProtoId<HereticKn
comp.CurrentPath = data.Path;
}

if (data.Stage > comp.PathStage)
// make sure we only progress when buying current path knowledge
if (data.Stage > comp.PathStage && data.Path == comp.CurrentPath)
comp.PathStage = data.Stage;

if (!silent)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ public bool TryDoRitual(EntityUid performer, EntityUid platform, ProtoId<Heretic
// check for all conditions
// this is god awful but it is that it is
var behaviors = rit.CustomBehaviors ?? new();
var requiredNames = rit.RequiredEntityNames?.ToDictionary(e => e.Key, e => e.Value) ?? new();
var requiredTags = rit.RequiredTags?.ToDictionary(e => e.Key, e => e.Value) ?? new();

foreach (var behavior in behaviors)
Expand All @@ -71,19 +70,6 @@ public bool TryDoRitual(EntityUid performer, EntityUid platform, ProtoId<Heretic

foreach (var look in lookup)
{
// check for matching entity names
foreach (var name in requiredNames)
{
if (Name(look) == name.Key)
{
requiredNames[name.Key] -= 1;

// prevent deletion of more items than needed
if (requiredNames[name.Key] >= 0)
toDelete.Add(look);
}
}

// check for matching tags
foreach (var tag in requiredTags)
{
Expand All @@ -102,11 +88,6 @@ public bool TryDoRitual(EntityUid performer, EntityUid platform, ProtoId<Heretic
}
}

// add missing names
foreach (var name in requiredNames)
if (name.Value > 0)
missingList.Add(name.Key);

// add missing tags
foreach (var tag in requiredTags)
if (tag.Value > 0)
Expand Down Expand Up @@ -214,6 +195,7 @@ private void OnInteractUsing(Entity<HereticRitualRuneComponent> ent, ref Interac
return;

_audio.PlayPvs(RitualSuccessSound, ent, AudioParams.Default.WithVolume(-3f));
_popup.PopupEntity(Loc.GetString("heretic-ritual-success"), ent, args.User);
Spawn("HereticRuneRitualAnimation", Transform(ent).Coordinates);
}

Expand Down
Loading

0 comments on commit 42cb6ed

Please sign in to comment.