Skip to content

Commit

Permalink
Heretics changes part 1 (space-syndicate#615)
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

---------

Co-authored-by: whateverusername0 <whateveremail>
Co-authored-by: Piras314 <[email protected]>
  • Loading branch information
2 people authored and AverageNotDoingAnythingEnjoyer committed Nov 15, 2024
1 parent 906167d commit 0aa66a3
Show file tree
Hide file tree
Showing 26 changed files with 384 additions and 113 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,19 @@ private void OnVolcano(Entity<HereticComponent> ent, ref EventHereticVolcanoBlas
if (!TryUseAbility(ent, args))
return;

if (!_splitball.Spawn(ent))
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)
ignoredTargets.Add(e.Owner);

if (!_splitball.Spawn(ent, ignoredTargets))
return;

if (ent.Comp.Ascended)
if (ent.Comp.Ascended) // will only work on ash path
_flammable.AdjustFireStacks(ent, 20f, ignite: true);

args.Handled = true;
Expand All @@ -67,7 +76,7 @@ private void OnNWRebirth(Entity<HereticComponent> ent, ref EventHereticNightwatc

foreach (var look in lookup)
{
if (HasComp<HereticComponent>(look)
if ((TryComp<HereticComponent>(look, out var th) && th.CurrentPath == ent.Comp.CurrentPath)
|| HasComp<GhoulComponent>(look))
continue;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ private void OnFleshSurgery(Entity<HereticComponent> ent, ref EventHereticFleshS
return;

if (HasComp<GhoulComponent>(args.Target)
|| HasComp<HereticComponent>(args.Target))
|| (TryComp<HereticComponent>(args.Target, out var th) && th.CurrentPath == ent.Comp.CurrentPath))
{
var dargs = new DoAfterArgs(EntityManager, ent, 10f, new EventHereticFleshSurgeryDoAfter(args.Target), ent, args.Target)
{
Expand All @@ -35,6 +35,7 @@ private void OnFleshSurgery(Entity<HereticComponent> ent, ref EventHereticFleshS
BreakOnDropItem = false,
};
_doafter.TryStartDoAfter(dargs);
args.Handled = true;
return;
}

Expand Down Expand Up @@ -93,6 +94,7 @@ private void OnFleshSurgeryDoAfter(Entity<HereticComponent> ent, ref EventHereti

// heal teammates, mostly ghouls
_dmg.SetAllDamage((EntityUid) args.Target, dmg, 0);
args.Handled = true;
}
private void OnFleshAscendPolymorph(Entity<HereticComponent> ent, ref EventHereticFleshAscend args)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,14 +57,16 @@ public sealed partial class HereticAbilitySystem : EntitySystem
[Dependency] private readonly SharedStunSystem _stun = default!;
[Dependency] private readonly ThrowingSystem _throw = default!;

private List<EntityUid> GetNearbyPeople(EntityUid ent, float range)
private List<EntityUid> GetNearbyPeople(Entity<HereticComponent> ent, float range)
{
var list = new List<EntityUid>();
var lookup = _lookup.GetEntitiesInRange(Transform(ent).Coordinates, range);

foreach (var look in lookup)
{
if (HasComp<HereticComponent>(look) || HasComp<GhoulComponent>(look))
// ignore heretics with the same path*, affect everyone else
if ((TryComp<HereticComponent>(look, out var th) && th.CurrentPath == ent.Comp.CurrentPath)
|| HasComp<GhoulComponent>(look))
continue;

if (!HasComp<StatusEffectsComponent>(look))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,7 @@ namespace Content.Server.Heretic.Components;
public sealed partial class EldritchInfluenceComponent : Component
{
[DataField] public bool Spent = false;

// make sure to update it with the prototype !!!
[NonSerialized] public static int LayerMask = 69; // 69 idk why not lolol
}
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public void OnDoAfter(Entity<EldritchInfluenceComponent> ent, ref EldritchInflue

_heretic.UpdateKnowledge(args.User, heretic, ev.Handled ? 2 : 1);

Spawn("EldritchInfluenceSpent", Transform((EntityUid) args.Target).Coordinates);
Spawn("EldritchInfluenceIntermediate", Transform((EntityUid) args.Target).Coordinates);
QueueDel(args.Target);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,17 @@
using Robust.Shared.Audio.Systems;
using Robust.Shared.Prototypes;
using System.Text;
using System.Linq;
using Robust.Shared.Serialization.Manager;
using Content.Shared.Examine;

namespace Content.Server.Heretic.EntitySystems;

public sealed partial class HereticRitualSystem : EntitySystem
{
[Dependency] private readonly SharedPopupSystem _popup = default!;
[Dependency] private readonly IPrototypeManager _proto = default!;
[Dependency] private readonly ISerializationManager _series = default!;
[Dependency] private readonly EntityLookupSystem _lookup = default!;
[Dependency] private readonly HereticKnowledgeSystem _knowledge = default!;
[Dependency] private readonly SharedAudioSystem _audio = default!;
Expand All @@ -27,19 +31,33 @@ public HereticRitualPrototype GetRitual(ProtoId<HereticRitualPrototype>? id)
return _proto.Index<HereticRitualPrototype>(id);
}

/// <summary>
/// Try to perform a selected ritual
/// </summary>
/// <returns> If the ritual succeeded or not </returns>
public bool TryDoRitual(EntityUid performer, EntityUid platform, ProtoId<HereticRitualPrototype> ritualId)
{
// here i'm introducing locals for basically everything
// because if i access stuff directly shit is bound to break.
// please don't access stuff directly from the prototypes or else shit will break.
// regards

if (!TryComp<HereticComponent>(performer, out var hereticComp))
return false;

var rit = (HereticRitualPrototype) GetRitual(ritualId).Clone();
var lookup = _lookup.GetEntitiesInRange(platform, 0.5f);
var rit = _series.CreateCopy((HereticRitualPrototype) GetRitual(ritualId).Clone(), notNullableOverride: true);
var lookup = _lookup.GetEntitiesInRange(platform, .75f);

var missingList = new List<string>();
var toDelete = new List<EntityUid>();

// check for all conditions
foreach (var behavior in rit.CustomBehaviors ?? new())
// 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)
{
var ritData = new RitualData(performer, platform, ritualId, EntityManager);

Expand All @@ -51,50 +69,49 @@ public bool TryDoRitual(EntityUid performer, EntityUid platform, ProtoId<Heretic
}
}

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

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

foreach (var name in rit.RequiredEntityNames)
if (name.Value > 0)
missingList.Add(name.Key);
}

// check for matching tags
if (rit.RequiredTags != null)
{
foreach (var tag in rit.RequiredTags)
// check for matching tags
foreach (var tag in requiredTags)
{
foreach (var look in lookup)
if (!TryComp<TagComponent>(look, out var tags))
continue;
var ltags = tags.Tags;

if (ltags.Contains(tag.Key))
{
if (!TryComp<TagComponent>(look, out var tags))
continue;
var ltags = tags.Tags;
requiredTags[tag.Key] -= 1;

if (ltags.Contains(tag.Key))
{
rit.RequiredTags[tag.Key] -= 1;
// prevent deletion of more items than needed
if (requiredTags[tag.Key] >= 0)
toDelete.Add(look);
}
}
}

foreach (var tag in rit.RequiredTags)
if (tag.Value > 0)
missingList.Add(tag.Key);
}

// 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)
missingList.Add(tag.Key);

// are we missing anything?
if (missingList.Count > 0)
{
Expand All @@ -114,8 +131,11 @@ public bool TryDoRitual(EntityUid performer, EntityUid platform, ProtoId<Heretic

// yay! ritual successfull!

// reset fields to their initial values
// BECAUSE FOR SOME REASON IT DOESN'T FUCKING WORK OTHERWISE!!!

// finalize all of the custom ones
foreach (var behavior in rit.CustomBehaviors ?? new())
foreach (var behavior in behaviors)
{
var ritData = new RitualData(performer, platform, ritualId, EntityManager);
behavior.Finalize(ritData);
Expand All @@ -126,12 +146,11 @@ public bool TryDoRitual(EntityUid performer, EntityUid platform, ProtoId<Heretic
QueueDel(ent);

// add stuff
if (rit.Output != null)
{
foreach (var ent in rit.Output.Keys)
for (int i = 0; i < rit.Output[ent]; i++)
Spawn(ent, Transform(platform).Coordinates);
}
var output = rit.Output ?? new();
foreach (var ent in output.Keys)
for (int i = 0; i < output[ent]; i++)
Spawn(ent, Transform(platform).Coordinates);

if (rit.OutputEvent != null)
RaiseLocalEvent(performer, rit.OutputEvent, true);

Expand All @@ -140,12 +159,14 @@ public bool TryDoRitual(EntityUid performer, EntityUid platform, ProtoId<Heretic

return true;
}

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

SubscribeLocalEvent<HereticRitualRuneComponent, InteractHandEvent>(OnInteract);
SubscribeLocalEvent<HereticRitualRuneComponent, InteractUsingEvent>(OnInteractUsing);
SubscribeLocalEvent<HereticRitualRuneComponent, ExaminedEvent>(OnExamine);
}

private void OnInteract(Entity<HereticRitualRuneComponent> ent, ref InteractHandEvent args)
Expand Down Expand Up @@ -195,4 +216,14 @@ private void OnInteractUsing(Entity<HereticRitualRuneComponent> ent, ref Interac
_audio.PlayPvs(RitualSuccessSound, ent, AudioParams.Default.WithVolume(-3f));
Spawn("HereticRuneRitualAnimation", Transform(ent).Coordinates);
}

private void OnExamine(Entity<HereticRitualRuneComponent> ent, ref ExaminedEvent args)
{
if (!TryComp<HereticComponent>(args.Examiner, out var h))
return;

var ritual = h.ChosenRitual != null ? GetRitual(h.ChosenRitual).Name : null;
var name = ritual != null ? Loc.GetString(ritual) : "None";
args.PushMarkup(Loc.GetString("heretic-ritualrune-examine", ("rit", name)));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ public sealed partial class HereticSystem : EntitySystem
[Dependency] private readonly StoreSystem _store = default!;
[Dependency] private readonly HereticKnowledgeSystem _knowledge = default!;
[Dependency] private readonly ChatSystem _chat = default!;
[Dependency] private readonly SharedEyeSystem _eye = default!;

private float _timer = 0f;
private float _passivePointCooldown = 20f * 60f;
Expand Down Expand Up @@ -70,12 +71,19 @@ public void UpdateKnowledge(EntityUid uid, HereticComponent comp, float amount)

private void OnCompInit(Entity<HereticComponent> ent, ref ComponentInit args)
{
// add influence layer
if (TryComp<EyeComponent>(ent, out var eye))
_eye.SetVisibilityMask(ent, eye.VisibilityMask | EldritchInfluenceComponent.LayerMask);

foreach (var knowledge in ent.Comp.BaseKnowledge)
_knowledge.AddKnowledge(ent, ent.Comp, knowledge);
}

private void OnMagicItemExamine(Entity<HereticMagicItemComponent> ent, ref ExaminedEvent args)
{
if (!HasComp<HereticComponent>(args.Examiner))
return;

args.PushMarkup(Loc.GetString("heretic-magicitem-examine"));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,11 +64,10 @@ public void ApplyGraspEffect(EntityUid performer, EntityUid target, string path)

case "Flesh":
if (TryComp<MobStateComponent>(target, out var mobState) && mobState.CurrentState == Shared.Mobs.MobState.Dead)
if (!HasComp<GhoulComponent>(target))
{
var ghoul = EnsureComp<GhoulComponent>(target);
ghoul.BoundHeretic = performer;
}
{
var ghoul = EnsureComp<GhoulComponent>(target);
ghoul.BoundHeretic = performer;
}
break;

case "Rust":
Expand Down Expand Up @@ -116,7 +115,7 @@ private void OnAfterInteract(Entity<MansusGraspComponent> ent, ref AfterInteract

var target = (EntityUid) args.Target;

if (HasComp<HereticComponent>(target))
if ((TryComp<HereticComponent>(args.Target, out var th) && th.CurrentPath == ent.Comp.Path))
return;

if (HasComp<StatusEffectsComponent>(target))
Expand Down
14 changes: 11 additions & 3 deletions Content.Server/Goobstation/Magic/ChainFireballComponent.cs
Original file line number Diff line number Diff line change
@@ -1,9 +1,17 @@

namespace Content.Server.Magic;

[RegisterComponent]
public sealed partial class ChainFireballComponent : Component
{
public float Divisions = 0f;
[DataField] public float MaxDivisions = 4f;
/// <summary>
/// The added chance of the ball disappearing (in %)
/// </summary>
[DataField] public float DisappearChanceDelta = 0.5f;

/// <summary>
/// The chance of the ball disappearing (in %)
/// </summary>
[DataField] public float DisappearChance = 0f;

public List<EntityUid> IgnoredTargets = new();
}
Loading

0 comments on commit 0aa66a3

Please sign in to comment.