Skip to content

Commit

Permalink
added stage block for cult armor
Browse files Browse the repository at this point in the history
  • Loading branch information
SkaldetSkaeg committed Jan 13, 2025
1 parent ebee5d7 commit c5d91fe
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,12 @@ public sealed partial class CultYoggCorruptedPrototype : IPrototype
[DataField("emptyStorage", required: false)]
public bool EmptyStorage { get; private set; }

/// <summary>
/// At what stage is this corruption result available
/// </summary>
[DataField("avaliableOnStage", required: false)]
public int AvaliableOnStage = 0;

}

[DataDefinition]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
using Robust.Shared.Random;
using Robust.Shared.Serialization;
using System.Diagnostics.CodeAnalysis;
using Robust.Shared.GameObjects;
using Content.Shared.Popups;

namespace Content.Shared.SS220.CultYogg.Corruption;

Expand All @@ -33,6 +35,7 @@ public sealed class SharedCultYoggCorruptedSystem : EntitySystem
[Dependency] private readonly SharedTransformSystem _transformSystem = default!;
[Dependency] private readonly IRobustRandom _random = default!;
[Dependency] private readonly SharedSoftDeleteSystem _softDeleteSystem = default!;
[Dependency] private readonly SharedPopupSystem _popup = default!;

private readonly TimeSpan _corruptionDuration = TimeSpan.FromSeconds(1.8);
private readonly Dictionary<ProtoId<EntityPrototype>, CultYoggCorruptedPrototype> _recipesBySourcePrototypeId = [];
Expand Down Expand Up @@ -138,10 +141,16 @@ public bool IsCorrupted(EntityUid entity)
/// <param name="isInHand">Flag indicating that the target entity is in hand</param>
/// <param name="callback">Optional callback to fire when finished</param>
/// <returns><see langword="true"/> if corruption process has been started, otherwise <see langword="false"/></returns>
public bool TryCorruptContinuously(EntityUid user, EntityUid entity, bool isInHand, Action<EntityUid?>? callback = null)
public bool TryCorruptContinuously(EntityUid user, CultYoggComponent comp, EntityUid entity, bool isInHand, Action<EntityUid?>? callback = null)
{
if (!TryGetCorruptionRecipe(entity, out var recipe))
{
_popup.PopupClient(Loc.GetString("cult-yogg-corrupt-no-proto"), entity, user);
return false;
}
if (comp.CurrentStage < recipe.AvaliableOnStage)
{
_popup.PopupClient(Loc.GetString("cult-yogg-corrupt-too-low-tier"), entity, user);
return false;
}
var e = new CultYoggCorruptDoAfterEvent(recipe, isInHand, callback);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,9 +89,8 @@ private void CorruptItemAction(Entity<CultYoggComponent> uid, ref CultYoggCorrup
return;
}

if (!_cultYoggCorruptedSystem.TryCorruptContinuously(uid, args.Target, false))
if (!_cultYoggCorruptedSystem.TryCorruptContinuously(uid, uid.Comp, args.Target, false))
{
_popup.PopupClient(Loc.GetString("cult-yogg-corrupt-no-proto"), args.Target, uid);
return;
}
args.Handled = true;
Expand Down Expand Up @@ -120,9 +119,8 @@ private void CorruptItemInHandAction(Entity<CultYoggComponent> uid, ref CultYogg
return;
}

if (!_cultYoggCorruptedSystem.TryCorruptContinuously(uid, handItem.Value, true))
if (!_cultYoggCorruptedSystem.TryCorruptContinuously(uid, uid.Comp, handItem.Value, true))
{
_popup.PopupClient(Loc.GetString("cult-yogg-corrupt-no-proto"), handItem.Value, uid);
return;
}
args.Handled = true;
Expand Down
1 change: 1 addition & 0 deletions Resources/Locale/ru-RU/ss220/cultYogg/cult_yogg_popups.ftl
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
cult-yogg-corrupt-no-proto = Предмет не имеет истинной формы
cult-yogg-corrupt-already-corrupted = Предмет уже обрел истинную форму
cult-yogg-corrupt-too-low-tier = Искажения будет доступно при большем числе принесенных жертв
cult-yogg-no-mind = Оболочка не имеет разума
cult-yogg-enslave-verb = [italic]Поработить[/italic]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -271,6 +271,7 @@
parentPrototypeId: ClothingOuterHardsuitBase
result: ClothingOuterHardsuitCultYogg
corruptionReverseEffect: ExorcismUncorruptEffect
avaliableOnStage: 2
# Hardsuit end

# Backpack beginning
Expand Down
4 changes: 2 additions & 2 deletions Resources/Prototypes/SS220/GameRules/roundstart.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
- type: GameRule
minPlayers: 40
delay:
min: 300
max: 600
min: 5
max: 10
- type: CultYoggRule
- type: AntagSelection
definitions:
Expand Down

0 comments on commit c5d91fe

Please sign in to comment.