From d5c5cbeaf41f640431d74f1034bc8d9e86b90907 Mon Sep 17 00:00:00 2001 From: Moony Date: Thu, 25 Nov 2021 00:06:13 -0600 Subject: [PATCH] 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 --- .../HasTagCondition.cs | 25 ++++ .../Chemistry/ReagentEffects/Electrocute.cs | 25 ++++ .../TileReactions/CleanTileReaction.cs | 6 +- .../TileReactions/CreateEntityReaction.cs | 13 +- .../en-US/reagents/buzzochloricbees.ftl | 15 +++ .../Prototypes/Entities/Mobs/NPCs/animals.yml | 3 + .../Entities/Objects/Fun/instruments.yml | 6 + .../Prototypes/Entities/Objects/Fun/toys.yml | 7 +- .../Entities/Objects/Power/powercells.yml | 5 + Resources/Prototypes/Reagents/fun.yml | 115 ++++++++++++++++++ .../Prototypes/Recipes/Reactions/fun.yml | 16 +++ Resources/Prototypes/tags.yml | 4 +- 12 files changed, 236 insertions(+), 4 deletions(-) create mode 100644 Content.Server/Chemistry/ReagentEffectConditions/HasTagCondition.cs create mode 100644 Content.Server/Chemistry/ReagentEffects/Electrocute.cs create mode 100644 Resources/Locale/en-US/reagents/buzzochloricbees.ftl diff --git a/Content.Server/Chemistry/ReagentEffectConditions/HasTagCondition.cs b/Content.Server/Chemistry/ReagentEffectConditions/HasTagCondition.cs new file mode 100644 index 0000000000..c87fd6d5ea --- /dev/null +++ b/Content.Server/Chemistry/ReagentEffectConditions/HasTagCondition.cs @@ -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))] + public string Tag = default!; + + [DataField("invert")] + public bool Invert = false; + + public override bool Condition(ReagentEffectArgs args) + { + if (args.EntityManager.TryGetComponent(args.SolutionEntity, out var tag)) + return tag.HasTag(Tag) ^ Invert; + + return false; + } +} diff --git a/Content.Server/Chemistry/ReagentEffects/Electrocute.cs b/Content.Server/Chemistry/ReagentEffects/Electrocute.cs new file mode 100644 index 0000000000..8b1389aedf --- /dev/null +++ b/Content.Server/Chemistry/ReagentEffects/Electrocute.cs @@ -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().TryDoElectrocution(args.SolutionEntity, null, + Math.Max((args.Quantity * ElectrocuteDamageScale).Int(), 1), TimeSpan.FromSeconds(ElectrocuteTime)); + + args.Source?.RemoveReagent(args.Reagent.ID, args.Quantity); + } +} diff --git a/Content.Server/Chemistry/TileReactions/CleanTileReaction.cs b/Content.Server/Chemistry/TileReactions/CleanTileReaction.cs index 58aed70422..7f0fd17062 100644 --- a/Content.Server/Chemistry/TileReactions/CleanTileReaction.cs +++ b/Content.Server/Chemistry/TileReactions/CleanTileReaction.cs @@ -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; diff --git a/Content.Server/Chemistry/TileReactions/CreateEntityReaction.cs b/Content.Server/Chemistry/TileReactions/CreateEntityReaction.cs index a779aec33a..35cbfafc9f 100644 --- a/Content.Server/Chemistry/TileReactions/CreateEntityReaction.cs +++ b/Content.Server/Chemistry/TileReactions/CreateEntityReaction.cs @@ -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(); + 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; } diff --git a/Resources/Locale/en-US/reagents/buzzochloricbees.ftl b/Resources/Locale/en-US/reagents/buzzochloricbees.ftl new file mode 100644 index 0000000000..c6eeb984cf --- /dev/null +++ b/Resources/Locale/en-US/reagents/buzzochloricbees.ftl @@ -0,0 +1,15 @@ +buzzochloricbees-effect-oh-god-bees = You are swarmed by many, many bees. +buzzochloricbees-effect-its-the-bees = It's the bees, oh god the bees. +buzzochloricbees-effect-why-am-i-covered-in-bees = You are covered in angry bees. +buzzochloricbees-effect-one-with-the-bees = You are one with the bees. +buzzochloricbees-effect-squeaky-clean = You feel squeaky clean as the bees try and get rid of you. +buzzochloricbees-effect-histamine-bee-allergy = You are highly allergic to bees, apparently. +buzzochloricbees-effect-histamine-swells = You swell like a balloon in the presence of the bees. +buzzochloricbees-effect-histamine-numb-to-the-bees = You are numb to the bees. +buzzochloricbees-effect-histamine-cannot-be-one-with-the-bees = You are not one with the bees. +buzzochloricbees-effect-licoxide-electrifying = The bees are electrifying. +buzzochloricbees-effect-licoxide-shocked-by-bee-facts = You are shocked by these five bee facts. +buzzochloricbees-effect-licoxide-buzzed = You feel buzzed. +buzzochloricbees-effect-licoxide-buzzes = You buzz with the bees. +buzzochloricbees-effect-fiber-hairy = You feel fuzzy, like a bee. +buzzochloricbees-effect-fiber-soft = You feel some exceptionally soft bees. diff --git a/Resources/Prototypes/Entities/Mobs/NPCs/animals.yml b/Resources/Prototypes/Entities/Mobs/NPCs/animals.yml index e42429fa6f..f9c7687618 100644 --- a/Resources/Prototypes/Entities/Mobs/NPCs/animals.yml +++ b/Resources/Prototypes/Entities/Mobs/NPCs/animals.yml @@ -76,6 +76,9 @@ normal: 0 crit: dead dead: dead + - type: Tag + tags: + - Bee - type: entity name: chicken diff --git a/Resources/Prototypes/Entities/Objects/Fun/instruments.yml b/Resources/Prototypes/Entities/Objects/Fun/instruments.yml index 217f1437b5..b4ac113fdc 100644 --- a/Resources/Prototypes/Entities/Objects/Fun/instruments.yml +++ b/Resources/Prototypes/Entities/Objects/Fun/instruments.yml @@ -161,6 +161,7 @@ parent: BaseHandheldInstrument id: SaxophoneInstrument name: saxophone + description: An instrument. You could probably grind this into raw jazz. components: - type: Instrument program: 67 @@ -170,6 +171,11 @@ - type: Item size: 24 sprite: Objects/Fun/Instruments/saxophone.rsi + - type: Extractable + grindableSolution: + reagents: + - ReagentId: Saxoite + Quantity: 10 - type: entity parent: BaseHandheldInstrument diff --git a/Resources/Prototypes/Entities/Objects/Fun/toys.yml b/Resources/Prototypes/Entities/Objects/Fun/toys.yml index 388d45acbb..d8378ab4be 100644 --- a/Resources/Prototypes/Entities/Objects/Fun/toys.yml +++ b/Resources/Prototypes/Entities/Objects/Fun/toys.yml @@ -22,11 +22,16 @@ parent: BasePlushie id: PlushieBee name: bee plushie - description: A cute toy that resembles an even cuter programmer. + description: A cute toy that resembles an even cuter programmer. You'd have to be a monster to grind this up. components: - type: Sprite sprite: Objects/Fun/toys.rsi state: plushie_h + - type: Extractable + grindableSolution: + reagents: + - ReagentId: GroundBee + Quantity: 10 - type: entity parent: BasePlushie diff --git a/Resources/Prototypes/Entities/Objects/Power/powercells.yml b/Resources/Prototypes/Entities/Objects/Power/powercells.yml index fbd4a17eb4..1cd43ba94e 100644 --- a/Resources/Prototypes/Entities/Objects/Power/powercells.yml +++ b/Resources/Prototypes/Entities/Objects/Power/powercells.yml @@ -17,6 +17,11 @@ solution: powerCell - type: DrawableSolution solution: powerCell + - type: Extractable + juiceSolution: + reagents: + - ReagentId: Licoxide + Quantity: 5 - type: entity id: PowerCellSmallBase diff --git a/Resources/Prototypes/Reagents/fun.yml b/Resources/Prototypes/Reagents/fun.yml index da0b8523c1..5a150020c7 100644 --- a/Resources/Prototypes/Reagents/fun.yml +++ b/Resources/Prototypes/Reagents/fun.yml @@ -23,3 +23,118 @@ desc: A raw material, usually extracted from wool or other fabric products. physicalDesc: fibrous color: "#808080" + +- type: reagent + id: BuzzochloricBees + name: Buzzochloric Bees + desc: "Liquid bees. Oh god it's LIQUID BEES NO-" + physicalDesc: buzzy + color: "#FFD35D" + tileReactions: + - !type:CreateEntityReaction + entity: MobBee + usage: 5 + maxOnTile: 2 + randomOffsetMax: 0.3 + maxOnTileWhitelist: + tags: [ Bee ] + - !type:CleanTileReaction # Bees are extremely obsessive about cleanliness within what they consider their hive. + cleanAmountMultiplier: 0 # Consume absolutely zero bees. Buzz buzz. + metabolisms: + Poison: + effects: + - !type:PopupMessage + type: Local + messages: + - "buzzochloricbees-effect-oh-god-bees" + - "buzzochloricbees-effect-its-the-bees" + - "buzzochloricbees-effect-why-am-i-covered-in-bees" + - "buzzochloricbees-effect-one-with-the-bees" + - "buzzochloricbees-effect-squeaky-clean" + probability: 0.1 + conditions: + - !type:ReagentThreshold + max: 0 + reagent: Histamine + - !type:HasTag + invert: true + tag: Bee + - !type:PopupMessage + type: Local + messages: + - "buzzochloricbees-effect-histamine-bee-allergy" + - "buzzochloricbees-effect-histamine-swells" + - "buzzochloricbees-effect-histamine-numb-to-the-bees" + - "buzzochloricbees-effect-histamine-cannot-be-one-with-the-bees" + - "buzzochloricbees-effect-squeaky-clean" + probability: 0.05 + conditions: + - !type:ReagentThreshold + min: 0.01 + reagent: Histamine + - !type:HasTag + invert: true + tag: Bee + - !type:PopupMessage + type: Local + messages: + - "buzzochloricbees-effect-licoxide-electrifying" + - "buzzochloricbees-effect-licoxide-shocked-by-bee-facts" + - "buzzochloricbees-effect-licoxide-buzzed" + - "buzzochloricbees-effect-licoxide-buzzes" + probability: 0.05 + conditions: + - !type:HasTag + invert: true + tag: Bee + - !type:ReagentThreshold + min: 0.01 + reagent: Licoxide + - !type:PopupMessage + type: Local + messages: + - "buzzochloricbees-effect-fiber-hairy" + - "buzzochloricbees-effect-fiber-soft" + probability: 0.05 + conditions: + - !type:HasTag + invert: true + tag: Bee + - !type:ReagentThreshold + min: 0.01 + reagent: Fiber + - !type:HealthChange + damage: + types: + Poison: 2 + Piercing: 2 + conditions: + - !type:HasTag + invert: true + tag: Bee + +- type: reagent + id: GroundBee + name: Ground Bee + desc: Bee grounds. Gross. + physicalDesc: bee guts + color: "#86530E" + +- type: reagent + id: Saxoite + name: Saxoite + desc: Smells like jazz. + physicalDesc: ground brass + color: "#B8A603" + +- type: reagent + id: Licoxide + name: Licoxide + desc: It looks... electrifying. + physicalDesc: electric + color: "#FDD023" + metabolisms: + Poison: + effects: + - !type:Electrocute + probability: 0.5 diff --git a/Resources/Prototypes/Recipes/Reactions/fun.yml b/Resources/Prototypes/Recipes/Reactions/fun.yml index 5dcd48eb6f..a6097ea407 100644 --- a/Resources/Prototypes/Recipes/Reactions/fun.yml +++ b/Resources/Prototypes/Recipes/Reactions/fun.yml @@ -7,3 +7,19 @@ amount: 2 products: Carpetium: 3 + +- type: reaction + id: BuzzochloricBees + reactants: + Saxoite: # do you like jazz (not sorry) + amount: 1 + Fiber: # bees are fuzzy + amount: 1 + GroundBee: # you need bee for the bees + amount: 1 + Chlorine: # the chloric part of buzzochloric + amount: 1 + UnstableMutagen: # to bring the buzz to life + amount: 1 + products: + BuzzochloricBees: 3 diff --git a/Resources/Prototypes/tags.yml b/Resources/Prototypes/tags.yml index 176567e0fb..1f4e4f543c 100644 --- a/Resources/Prototypes/tags.yml +++ b/Resources/Prototypes/tags.yml @@ -3,6 +3,9 @@ - type: Tag id: Baguette +- type: Tag + id: Bee + - type: Tag id: Brutepack @@ -236,4 +239,3 @@ - type: Tag id: Write -