buzz buzz (#5490)
* buzz buzz * Darn now i'm all out of periods thanks mirror fix toy issue * desc edits. * rng and alphabee * adds some missed parens
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
using Content.Shared.Chemistry.Reagent;
|
||||
using Content.Shared.Tag;
|
||||
using JetBrains.Annotations;
|
||||
using Robust.Shared.Serialization.Manager.Attributes;
|
||||
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype;
|
||||
|
||||
namespace Content.Server.Chemistry.ReagentEffectConditions;
|
||||
|
||||
[UsedImplicitly]
|
||||
public class HasTag : ReagentEffectCondition
|
||||
{
|
||||
[DataField("tag", customTypeSerializer: typeof(PrototypeIdSerializer<TagPrototype>))]
|
||||
public string Tag = default!;
|
||||
|
||||
[DataField("invert")]
|
||||
public bool Invert = false;
|
||||
|
||||
public override bool Condition(ReagentEffectArgs args)
|
||||
{
|
||||
if (args.EntityManager.TryGetComponent<TagComponent>(args.SolutionEntity, out var tag))
|
||||
return tag.HasTag(Tag) ^ Invert;
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
25
Content.Server/Chemistry/ReagentEffects/Electrocute.cs
Normal file
25
Content.Server/Chemistry/ReagentEffects/Electrocute.cs
Normal file
@@ -0,0 +1,25 @@
|
||||
using System;
|
||||
using Content.Server.Atmos.Components;
|
||||
using Content.Server.Atmos.EntitySystems;
|
||||
using Content.Server.Electrocution;
|
||||
using Content.Shared.Chemistry.Reagent;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.Log;
|
||||
using Robust.Shared.Serialization.Manager.Attributes;
|
||||
|
||||
namespace Content.Server.Chemistry.ReagentEffects;
|
||||
|
||||
public class Electrocute : ReagentEffect
|
||||
{
|
||||
[DataField("electrocuteTime")] public int ElectrocuteTime = 2;
|
||||
|
||||
[DataField("electrocuteDamageScale")] public int ElectrocuteDamageScale = 5;
|
||||
|
||||
public override void Effect(ReagentEffectArgs args)
|
||||
{
|
||||
EntitySystem.Get<ElectrocutionSystem>().TryDoElectrocution(args.SolutionEntity, null,
|
||||
Math.Max((args.Quantity * ElectrocuteDamageScale).Int(), 1), TimeSpan.FromSeconds(ElectrocuteTime));
|
||||
|
||||
args.Source?.RemoveReagent(args.Reagent.ID, args.Quantity);
|
||||
}
|
||||
}
|
||||
@@ -13,6 +13,10 @@ namespace Content.Server.Chemistry.TileReactions
|
||||
[DataDefinition]
|
||||
public class CleanTileReaction : ITileReaction
|
||||
{
|
||||
|
||||
[DataField("cleanAmountMultiplier")]
|
||||
public float CleanAmountMultiplier { get; private set; } = 1.0f;
|
||||
|
||||
FixedPoint2 ITileReaction.TileReact(TileRef tile, ReagentPrototype reagent, FixedPoint2 reactVolume)
|
||||
{
|
||||
var entities = tile.GetEntitiesInTileFast().ToArray();
|
||||
@@ -21,7 +25,7 @@ namespace Content.Server.Chemistry.TileReactions
|
||||
{
|
||||
if (entity.TryGetComponent(out CleanableComponent? cleanable))
|
||||
{
|
||||
var next = amount + cleanable.CleanAmount;
|
||||
var next = (amount + cleanable.CleanAmount) * CleanAmountMultiplier;
|
||||
// Nothing left?
|
||||
if (reactVolume < next)
|
||||
break;
|
||||
|
||||
@@ -2,12 +2,14 @@
|
||||
using Content.Shared.Chemistry.Reagent;
|
||||
using Content.Shared.FixedPoint;
|
||||
using Content.Shared.Maps;
|
||||
using Content.Shared.Random.Helpers;
|
||||
using Content.Shared.Whitelist;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.IoC;
|
||||
using Robust.Shared.Map;
|
||||
using Robust.Shared.Maths;
|
||||
using Robust.Shared.Prototypes;
|
||||
using Robust.Shared.Random;
|
||||
using Robust.Shared.Serialization.Manager.Attributes;
|
||||
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype;
|
||||
|
||||
@@ -34,6 +36,9 @@ public class CreateEntityReaction : ITileReaction
|
||||
[DataField("maxOnTileWhitelist")]
|
||||
public EntityWhitelist? Whitelist;
|
||||
|
||||
[DataField("randomOffsetMax")]
|
||||
public float RandomOffsetMax = 0.0f;
|
||||
|
||||
public FixedPoint2 TileReact(TileRef tile, ReagentPrototype reagent, FixedPoint2 reactVolume)
|
||||
{
|
||||
if (reactVolume >= Usage)
|
||||
@@ -54,7 +59,13 @@ public class CreateEntityReaction : ITileReaction
|
||||
}
|
||||
}
|
||||
|
||||
entMan.SpawnEntity(Entity, tile.GridPosition().Offset(new Vector2(0.5f, 0.5f)));
|
||||
var random = IoCManager.Resolve<IRobustRandom>();
|
||||
var xoffs = random.NextFloat(-RandomOffsetMax, RandomOffsetMax);
|
||||
var yoffs = random.NextFloat(-RandomOffsetMax, RandomOffsetMax);
|
||||
|
||||
var pos = tile.GridPosition().Offset(new Vector2(0.5f + xoffs, 0.5f + yoffs));
|
||||
entMan.SpawnEntity(Entity, pos);
|
||||
|
||||
return Usage;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user