Remove duplicate holy water (#4)

This commit is contained in:
Aviu00
2024-01-31 10:57:56 +09:00
committed by GitHub
parent 9cb277af8d
commit 699f42c45b
6 changed files with 9 additions and 90 deletions

View File

@@ -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;

View File

@@ -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";
}

View File

@@ -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;
}
}
}
}
}

View File

@@ -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);
}

View File

@@ -457,20 +457,3 @@
effects:
- !type:SatiateThirst
factor: 0.6
#WD start
- type: reagent
id: HolyWater
name: reagent-name-holy-water
parent: Water
desc: reagent-desc-holy-water
metabolisms:
Drink:
effects:
- !type:SatiateThirst
factor: 4
- !type:DeconvertCultist
conditions:
- !type:ReagentThreshold
min: 25
#WD end

View File

@@ -1017,7 +1017,7 @@
Medicine:
effects:
- !type:HealthChange
condition:
conditions:
- !type:TotalDamage
max: 50
damage:
@@ -1027,6 +1027,10 @@
Heat: -0.2
Shock: -0.2
Cold: -0.2
- !type:DeconvertCultist
conditions:
- !type:ReagentThreshold
min: 15
- type: reagent
id: Pyrazine