Skip to content

Commit

Permalink
fix: fixes after master merge
Browse files Browse the repository at this point in the history
Signed-off-by: Remuchi <[email protected]>
  • Loading branch information
Remuchi committed Nov 19, 2024
1 parent 75bb806 commit 213497f
Show file tree
Hide file tree
Showing 18 changed files with 67 additions and 97 deletions.
1 change: 0 additions & 1 deletion Content.Client/WhiteDream/BloodCult/BloodCultistSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ private void OnPentagramRemoved(EntityUid uid, PentagramComponent component, Com
sprite.RemoveLayer(layer);
}


/// <summary>
/// Determine whether a client should display the cult icon.
/// </summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,13 +52,14 @@ public sealed partial class BloodRitesAuraComponent : Component
public FixedPoint2 TotalHealing = 20;

[DataField]
public SoundSpecifier BloodRitesAudio = new SoundPathSpecifier(new ResPath("/Audio/WhiteDream/BloodCult/rites.ogg"),
public SoundSpecifier BloodRitesAudio = new SoundPathSpecifier(
new ResPath("/Audio/WhiteDream/BloodCult/rites.ogg"),
AudioParams.Default.WithVolume(-3));

[DataField]
public Dictionary<EntProtoId, float> Crafts = new()
{
["BloodSpear"] = 300,
["BloodSpear"] = 300
};

public DoAfterId? ExtractDoAfterId;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,8 @@ public override void Initialize()
SubscribeLocalEvent<BloodRitesAuraComponent, BloodRitesMessage>(OnRitesMessage);
}

private void OnExamining(Entity<BloodRitesAuraComponent> rites, ref ExaminedEvent args)
{
private void OnExamining(Entity<BloodRitesAuraComponent> rites, ref ExaminedEvent args) =>
args.PushMarkup(Loc.GetString("blood-rites-stored-blood", ("amount", rites.Comp.StoredBlood.ToString())));
}

private void OnAfterInteract(Entity<BloodRitesAuraComponent> rites, ref AfterInteractEvent args)
{
Expand Down Expand Up @@ -206,9 +204,11 @@ private bool Heal(Entity<BloodRitesAuraComponent> rites, EntityUid user, Entity<
return true;
}

private bool RestoreBloodLevel(Entity<BloodRitesAuraComponent> rites,
private bool RestoreBloodLevel(
Entity<BloodRitesAuraComponent> rites,
EntityUid user,
Entity<BloodstreamComponent> target)
Entity<BloodstreamComponent> target
)
{
if (target.Comp.BloodSolution is null)
return false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,38 +11,19 @@ public sealed partial class ConstructShellComponent : Component

public readonly string ShardSlotId = "Shard";


[DataField]
public List<RadialSelectorEntry> Constructs = new()
{
new RadialSelectorEntry
{
Prototype = "ConstructJuggernaut"
},
new RadialSelectorEntry
{
Prototype = "ConstructArtificer"
},
new RadialSelectorEntry
{
Prototype = "ConstructWraith"
}
new() { Prototype = "ConstructJuggernaut", },
new() { Prototype = "ConstructArtificer", },
new() { Prototype = "ConstructWraith", }
};

[DataField]
public List<RadialSelectorEntry> PurifiedConstructs = new()
{
new RadialSelectorEntry
{
Prototype = "ConstructJuggernautHoly"
},
new RadialSelectorEntry
{
Prototype = "ConstructArtificerHoly"
},
new RadialSelectorEntry
{
Prototype = "ConstructWraithHoly"
}
new() { Prototype = "ConstructJuggernautHoly", },
new() { Prototype = "ConstructArtificerHoly", },
new() { Prototype = "ConstructWraithHoly", }
};
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
namespace Content.Server.WhiteDream.BloodCult.Empower;
using Content.Shared.Alert;
using Robust.Shared.Prototypes;

namespace Content.Server.WhiteDream.BloodCult.Empower;

[RegisterComponent]
public sealed partial class BloodCultEmpoweredComponent : Component
Expand Down Expand Up @@ -33,6 +36,9 @@ public sealed partial class BloodCultEmpoweredComponent : Component
[DataField]
public string CultTile = "CultFloor";

[DataField]
public ProtoId<AlertPrototype> EmpoweredAlert = "CultEmpowered";

[ViewVariables(VVAccess.ReadOnly)]
public TimeSpan TimeRemaining = TimeSpan.Zero;
}
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,14 @@ public override void Update(float frameTime)

private void OnEmpowerStartup(Entity<BloodCultEmpoweredComponent> cultist, ref ComponentStartup args)
{
_alerts.ShowAlert(cultist, AlertType.CultEmpowered);
_alerts.ShowAlert(cultist, cultist.Comp.EmpoweredAlert);
if (TryComp(cultist, out BloodCultSpellsHolderComponent? spellsHolder))
spellsHolder.MaxSpells += cultist.Comp.ExtraSpells;
}

private void OnEmpowerShutdown(Entity<BloodCultEmpoweredComponent> cultist, ref ComponentShutdown args)
{
_alerts.ClearAlert(cultist, AlertType.CultEmpowered);
_alerts.ClearAlert(cultist, cultist.Comp.EmpoweredAlert);
if (TryComp(cultist, out BloodCultSpellsHolderComponent? spellsHolder))
spellsHolder.MaxSpells -= cultist.Comp.ExtraSpells;
}
Expand Down Expand Up @@ -78,7 +78,8 @@ private bool AnyCultTilesNearby(Entity<BloodCultEmpoweredComponent> ent)
var cultTile = _tileDefinition[ent.Comp.CultTile];

var radius = ent.Comp.NearbyCultTileRadius;
var tilesRefs = _map.GetLocalTilesIntersecting(gridUid.Value,
var tilesRefs = _map.GetLocalTilesIntersecting(
gridUid.Value,
grid,
new Box2(localpos + new Vector2(-radius, -radius), localpos + new Vector2(radius, radius)));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,14 +56,14 @@ public enum CultWinCondition : byte
{
Draw,
Win,
Failure,
Failure
}

public enum CultStage : byte
{
Start,
RedEyes,
Pentagram,
Pentagram
}

public sealed class BloodCultNarsieSummoned : EntityEventArgs;
52 changes: 16 additions & 36 deletions Content.Server/WhiteDream/BloodCult/Gamerule/BloodCultRuleSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
using Content.Server.Antag;
using Content.Server.Antag.Components;
using Content.Server.GameTicking;
using Content.Server.GameTicking.Components;
using Content.Server.GameTicking.Rules;
using Content.Server.Hands.Systems;
using Content.Server.Language;
Expand All @@ -18,6 +17,7 @@
using Content.Shared.Body.Systems;
using Content.Shared.Cloning;
using Content.Shared.Cuffs.Components;
using Content.Shared.GameTicking.Components;
using Content.Shared.Humanoid;
using Content.Shared.Inventory;
using Content.Shared.Mind;
Expand Down Expand Up @@ -70,20 +70,24 @@ public override void Initialize()
SubscribeLocalEvent<BloodCultistRoleComponent, GetBriefingEvent>(OnGetBriefing);
}

protected override void Started(EntityUid uid,
protected override void Started(
EntityUid uid,
BloodCultRuleComponent component,
GameRuleComponent gameRule,
GameRuleStartedEvent args)
GameRuleStartedEvent args
)
{
base.Started(uid, component, gameRule, args);

component.OfferingTarget = FindTarget();
}

protected override void AppendRoundEndText(EntityUid uid,
protected override void AppendRoundEndText(
EntityUid uid,
BloodCultRuleComponent component,
GameRuleComponent gameRule,
ref RoundEndTextAppendEvent args)
ref RoundEndTextAppendEvent args
)
{
base.AppendRoundEndText(uid, component, gameRule, ref args);
var winText = Loc.GetString($"blood-cult-condition-{component.WinCondition.ToString().ToLower()}");
Expand All @@ -99,10 +103,8 @@ protected override void AppendRoundEndText(EntityUid uid,
}
}

private void AfterEntitySelected(Entity<BloodCultRuleComponent> ent, ref AfterAntagEntitySelectedEvent args)
{
private void AfterEntitySelected(Entity<BloodCultRuleComponent> ent, ref AfterAntagEntitySelectedEvent args) =>
MakeCultist(args.EntityUid, ent);
}

private void OnNarsieSummon(BloodCultNarsieSummoned ev)
{
Expand Down Expand Up @@ -144,9 +146,7 @@ private void OnCultistComponentRemoved(Entity<BloodCultistComponent> cultist, re
{
var query = QueryActiveRules();
while (query.MoveNext(out _, out var cult, out _))
{
cult.Cultists.Remove(cultist);
}

CheckRoundShouldEnd();

Expand All @@ -163,9 +163,7 @@ private void OnCultistComponentRemoved(Entity<BloodCultistComponent> cultist, re
return;

foreach (var power in powersHolder.SelectedSpells)
{
_actions.RemoveAction(cultist.Owner, power);
}
}

private void OnCultistsStateChanged(Entity<BloodCultistComponent> ent, ref MobStateChangedEvent args)
Expand All @@ -174,15 +172,10 @@ private void OnCultistsStateChanged(Entity<BloodCultistComponent> ent, ref MobSt
CheckRoundShouldEnd();
}

private void OnClone(Entity<BloodCultistComponent> ent, ref CloningEvent args)
{
RemoveObjectiveAndRole(ent);
}
private void OnClone(Entity<BloodCultistComponent> ent, ref CloningEvent args) => RemoveObjectiveAndRole(ent);

private void OnGetBriefing(Entity<BloodCultistRoleComponent> ent, ref GetBriefingEvent args)
{
private void OnGetBriefing(Entity<BloodCultistRoleComponent> ent, ref GetBriefingEvent args) =>
args.Append(Loc.GetString("blood-cult-role-briefing-short"));
}

public void Convert(EntityUid target)
{
Expand Down Expand Up @@ -213,10 +206,8 @@ public bool TryGetTarget([NotNullWhen(true)] out EntityUid? target)
{
var query = QueryActiveRules();
while (query.MoveNext(out _, out var bloodCultRule, out _))
{
if (bloodCultRule.OfferingTarget.HasValue)
return bloodCultRule.OfferingTarget.Value;
}

return null;
}
Expand All @@ -225,9 +216,7 @@ public bool IsTarget(EntityUid entityUid)
{
var query = QueryActiveRules();
while (query.MoveNext(out _, out var bloodCultRule, out _))
{
return entityUid == bloodCultRule.OfferingTarget;
}

return false;
}
Expand All @@ -239,9 +228,7 @@ public void RemoveObjectiveAndRole(EntityUid uid)

var objectives = mind.Objectives.FindAll(HasComp<KillTargetCultComponent>);
foreach (var obj in objectives)
{
_mindSystem.TryRemoveObjective(mindId, mind, mind.Objectives.IndexOf(obj));
}

if (_roleSystem.MindHasRole<BloodCultistRoleComponent>(mindId))
_roleSystem.MindRemoveRole<BloodCultistRoleComponent>(mindId);
Expand Down Expand Up @@ -303,17 +290,13 @@ private void RemoveAllCultItems(Entity<BloodCultistComponent> cultist)

_bloodSpear.DetachSpearFromMaster(cultist);
while (enumerator.MoveNext(out var container))
{
if (container.ContainedEntity != null && HasComp<CultItemComponent>(container.ContainedEntity.Value))
_container.Remove(container.ContainedEntity.Value, container, true, true);
}

foreach (var item in _hands.EnumerateHeld(cultist))
{
if (TryComp(item, out CultItemComponent? cultItem) && !cultItem.AllowUseToEveryone &&
!_hands.TryDrop(cultist, item, null, false, false))
QueueDel(item);
}
}

private void RemoveCultistAppearance(Entity<BloodCultistComponent> cultist)
Expand Down Expand Up @@ -352,9 +335,7 @@ private void UpdateCultistsAppearance(BloodCultRuleComponent cultRule, CultStage
{
case CultStage.Start when prevStage == CultStage.RedEyes:
foreach (var cultist in cultRule.Cultists)
{
RemoveCultistAppearance(cultist);
}

break;
case CultStage.RedEyes when prevStage == CultStage.Start:
Expand All @@ -370,9 +351,7 @@ private void UpdateCultistsAppearance(BloodCultRuleComponent cultRule, CultStage
break;
case CultStage.Pentagram:
foreach (var cultist in cultRule.Cultists)
{
EnsureComp<PentagramComponent>(cultist);
}

break;
}
Expand All @@ -387,9 +366,10 @@ private void SelectRandomLeader(BloodCultRuleComponent cultRule)
return;

var candidats = cultRule.Cultists;
candidats.RemoveAll(entity =>
TryComp(entity, out PullableComponent? pullable) && pullable.BeingPulled ||
TryComp(entity, out CuffableComponent? cuffable) && cuffable.CuffedHandCount > 0);
candidats.RemoveAll(
entity =>
TryComp(entity, out PullableComponent? pullable) && pullable.BeingPulled ||
TryComp(entity, out CuffableComponent? cuffable) && cuffable.CuffedHandCount > 0);

if (candidats.Count == 0)
return;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ public sealed partial class BloodSpearComponent : Component
public EntityUid? RecallAction;

[DataField]
public SoundSpecifier BloodRitesAudio = new SoundPathSpecifier(new ResPath("/Audio/WhiteDream/BloodCult/rites.ogg"),
public SoundSpecifier RecallAudio = new SoundPathSpecifier(
new ResPath("/Audio/WhiteDream/BloodCult/rites.ogg"),
AudioParams.Default.WithVolume(-3));
}
Original file line number Diff line number Diff line change
Expand Up @@ -59,12 +59,12 @@ private void OnPickedUp(Entity<BloodSpearComponent> spear, ref GettingPickedUpAt

private void OnSpearRecalled(Entity<BloodCultistComponent> cultist, ref BloodSpearRecalledEvent args)
{
var spear = cultist.Comp.BloodSpear;
if (!spear.HasValue)
var spearUid = cultist.Comp.BloodSpear;
if (!spearUid.HasValue || !TryComp(spearUid, out BloodSpearComponent? spear))
return;

_hands.TryForcePickupAnyHand(cultist, spear.Value);
_audio.PlayPvs()
_hands.TryForcePickupAnyHand(cultist, spearUid.Value);
_audio.PlayPvs(spear.RecallAudio, spearUid.Value);
}

public void DetachSpearFromMaster(Entity<BloodCultistComponent> cultist)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
id: ActionBloodSpearRecall
name: Recall spear
description: Recalls your blood spear back to your hand.
noSpawn: true
categories: [ HideSpawnMenu ]
components:
- type: Sprite
sprite: WhiteDream/BloodCult/actions.rsi
Expand Down
Loading

0 comments on commit 213497f

Please sign in to comment.