Remove duplicate holy water (#4)
This commit is contained in:
@@ -35,7 +35,7 @@ public sealed partial class CultRuleComponent : Component
|
||||
[DataField("eyeColor")]
|
||||
public static Color EyeColor = Color.FromHex("#f80000");
|
||||
|
||||
public static string HolyWaterReagent = "HolyWater";
|
||||
public static string HolyWaterReagent = "Holywater";
|
||||
|
||||
[DataField("redEyeThreshold")]
|
||||
public static int ReadEyeThreshold = 5;
|
||||
|
||||
@@ -1,11 +0,0 @@
|
||||
namespace Content.Server._White.Cult.HolyWater;
|
||||
|
||||
[RegisterComponent]
|
||||
public sealed partial class BibleWaterConvertComponent : Component
|
||||
{
|
||||
[DataField("convertedId"), ViewVariables(VVAccess.ReadWrite)]
|
||||
public string ConvertedId = "Water";
|
||||
|
||||
[DataField("ConvertedToId"), ViewVariables(VVAccess.ReadWrite)]
|
||||
public string ConvertedToId = "HolyWater";
|
||||
}
|
||||
@@ -1,59 +0,0 @@
|
||||
using System.Linq;
|
||||
using Content.Server.Stunnable;
|
||||
using Content.Shared.Chemistry.Components.SolutionManager;
|
||||
using Content.Shared.Interaction;
|
||||
using Content.Shared.Mobs.Components;
|
||||
using Content.Shared.Popups;
|
||||
using Robust.Server.Audio;
|
||||
using Robust.Server.GameObjects;
|
||||
|
||||
namespace Content.Server._White.Cult.HolyWater;
|
||||
|
||||
public sealed class HolyWaterSystem : EntitySystem
|
||||
{
|
||||
[Dependency] private readonly StunSystem _stun = default!;
|
||||
[Dependency] private readonly SharedPopupSystem _popup = default!;
|
||||
[Dependency] private readonly AudioSystem _audio = default!;
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
base.Initialize();
|
||||
|
||||
SubscribeLocalEvent<BibleWaterConvertComponent, AfterInteractEvent>(OnBibleInteract);
|
||||
}
|
||||
|
||||
private void OnBibleInteract(EntityUid uid, BibleWaterConvertComponent component, AfterInteractEvent args)
|
||||
{
|
||||
if (HasComp<MobStateComponent>(uid))
|
||||
return;
|
||||
|
||||
if (!TryComp<SolutionContainerManagerComponent>(args.Target, out var container))
|
||||
return;
|
||||
|
||||
if (container.Solutions != null)
|
||||
{
|
||||
foreach (var solution in container.Solutions.Values.Where(solution =>
|
||||
solution.ContainsReagent(component.ConvertedId, null)))
|
||||
{
|
||||
foreach (var reagent in solution.Contents)
|
||||
{
|
||||
if (reagent.Reagent.Prototype != component.ConvertedId)
|
||||
continue;
|
||||
|
||||
var amount = reagent.Quantity;
|
||||
|
||||
solution.RemoveReagent(reagent.Reagent.Prototype, reagent.Quantity);
|
||||
solution.AddReagent(component.ConvertedToId, amount);
|
||||
|
||||
if (args.Target == null)
|
||||
return;
|
||||
|
||||
_popup.PopupEntity(Loc.GetString("holy-water-converted"), args.Target.Value, args.User);
|
||||
_audio.PlayPvs("/Audio/Effects/holy.ogg", args.Target.Value);
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -311,7 +311,9 @@ public sealed partial class CultSystem : EntitySystem
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (solution.Solutions.TryGetValue("vapor", out var vapor) && vapor.Contents.Any(x => x.Reagent.Prototype == "HolyWater"))
|
||||
|
||||
if (solution.Solutions.TryGetValue("vapor", out var vapor) &&
|
||||
vapor.Contents.Any(x => x.Reagent.Prototype == CultRuleComponent.HolyWaterReagent))
|
||||
{
|
||||
Del(uid);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user