]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
Killer tomatoes (#26053)
authorEd <96445749+TheShuEd@users.noreply.github.com>
Thu, 18 Apr 2024 11:21:56 +0000 (14:21 +0300)
committerGitHub <noreply@github.com>
Thu, 18 Apr 2024 11:21:56 +0000 (21:21 +1000)
* make tomatoes

* many friends! many mommies

* finish

* renaming system

* fix

* Update miscellaneous.yml

* Update Content.Server/NPC/Systems/NPCImpritingBehaviourSystem.cs

Co-authored-by: faint <46868845+ficcialfaint@users.noreply.github.com>
* N

* deleete exception?

* merge conflict fix

* fix?

* fuck you

* sloth fixes

* fixess?

* fix

---------

Co-authored-by: faint <46868845+ficcialfaint@users.noreply.github.com>
Co-authored-by: metalgearsloth <comedian_vs_clown@hotmail.com>
20 files changed:
Content.Server/NPC/Components/NPCImprintingOnSpawnBehaviourComponent.cs [new file with mode: 0644]
Content.Server/NPC/Systems/NPCImprintingOnSpawnBehaviourSystem.cs [new file with mode: 0644]
Content.Server/NPC/Systems/NPCSystem.cs
Content.Shared/NPC/Components/FactionExceptionComponent.cs
Content.Shared/NPC/Systems/SharedNPCImprintingOnSpawnBehaviourSystem.cs [new file with mode: 0644]
Content.Shared/NPC/Systems/SharedNPCSystem.cs [new file with mode: 0644]
Resources/Locale/en-US/seeds/seeds.ftl
Resources/Prototypes/Entities/Mobs/NPCs/miscellaneous.yml
Resources/Prototypes/Entities/Objects/Specific/Hydroponics/seeds.yml
Resources/Prototypes/Hydroponics/seeds.yml
Resources/Prototypes/NPCs/mob.yml
Resources/Textures/Mobs/Demons/tomatokiller.rsi/alive.png [new file with mode: 0644]
Resources/Textures/Mobs/Demons/tomatokiller.rsi/dead.png [new file with mode: 0644]
Resources/Textures/Mobs/Demons/tomatokiller.rsi/meta.json [new file with mode: 0644]
Resources/Textures/Objects/Specific/Hydroponics/tomatokiller.rsi/dead.png [new file with mode: 0644]
Resources/Textures/Objects/Specific/Hydroponics/tomatokiller.rsi/harvest.png [new file with mode: 0644]
Resources/Textures/Objects/Specific/Hydroponics/tomatokiller.rsi/meta.json [new file with mode: 0644]
Resources/Textures/Objects/Specific/Hydroponics/tomatokiller.rsi/seed.png [new file with mode: 0644]
Resources/Textures/Objects/Specific/Hydroponics/tomatokiller.rsi/stage-1.png [new file with mode: 0644]
Resources/Textures/Objects/Specific/Hydroponics/tomatokiller.rsi/stage-2.png [new file with mode: 0644]

diff --git a/Content.Server/NPC/Components/NPCImprintingOnSpawnBehaviourComponent.cs b/Content.Server/NPC/Components/NPCImprintingOnSpawnBehaviourComponent.cs
new file mode 100644 (file)
index 0000000..26439d2
--- /dev/null
@@ -0,0 +1,34 @@
+using Content.Shared.Whitelist;
+using Robust.Shared.Collections;
+
+namespace Content.Server.NPC.Components;
+/// <summary>
+/// A component that makes the entity friendly to nearby creatures it sees on init.
+/// </summary>
+[RegisterComponent]
+public sealed partial class NPCImprintingOnSpawnBehaviourComponent : Component
+{
+    /// <summary>
+    /// filter who can be a friend to this creature
+    /// </summary>
+    [DataField]
+    public EntityWhitelist? Whitelist;
+
+    /// <summary>
+    /// when a creature appears, it will memorize all creatures in the radius to remember them as friends
+    /// </summary>
+    [DataField]
+    public float SpawnFriendsSearchRadius = 3f;
+
+    /// <summary>
+    /// if there is a FollowCompound in HTN, the target of the following will be selected from random nearby targets when it appears
+    /// </summary>
+    [DataField]
+    public bool Follow = true;
+
+    /// <summary>
+    /// is used to determine who became a friend from this component
+    /// </summary>
+    [DataField]
+    public List<EntityUid> Friends = new();
+}
diff --git a/Content.Server/NPC/Systems/NPCImprintingOnSpawnBehaviourSystem.cs b/Content.Server/NPC/Systems/NPCImprintingOnSpawnBehaviourSystem.cs
new file mode 100644 (file)
index 0000000..cfd3b08
--- /dev/null
@@ -0,0 +1,49 @@
+using System.Numerics;
+using Content.Shared.NPC.Components;
+using Content.Shared.NPC.Systems;
+using Robust.Shared.Collections;
+using Robust.Shared.Map;
+using Robust.Shared.Random;
+using NPCImprintingOnSpawnBehaviourComponent = Content.Server.NPC.Components.NPCImprintingOnSpawnBehaviourComponent;
+
+namespace Content.Server.NPC.Systems;
+
+public sealed partial class NPCImprintingOnSpawnBehaviourSystem : SharedNPCImprintingOnSpawnBehaviourSystem
+{
+    [Dependency] private readonly EntityLookupSystem _lookup = default!;
+    [Dependency] private readonly NPCSystem _npc = default!;
+    [Dependency] private readonly IRobustRandom _random = default!;
+
+    public override void Initialize()
+    {
+        base.Initialize();
+        SubscribeLocalEvent<NPCImprintingOnSpawnBehaviourComponent, MapInitEvent>(OnMapInit);
+    }
+
+    private void OnMapInit(Entity<NPCImprintingOnSpawnBehaviourComponent> imprinting, ref MapInitEvent args)
+    {
+        HashSet<EntityUid> friends = new();
+        _lookup.GetEntitiesInRange(imprinting, imprinting.Comp.SpawnFriendsSearchRadius, friends);
+
+        foreach (var friend in friends)
+        {
+            if (imprinting.Comp.Whitelist?.IsValid(friend) != false)
+            {
+                AddImprintingTarget(imprinting, friend, imprinting.Comp);
+            }
+        }
+
+        if (imprinting.Comp.Follow && imprinting.Comp.Friends.Count > 0)
+        {
+            var mommy = _random.Pick(imprinting.Comp.Friends);
+            _npc.SetBlackboard(imprinting, NPCBlackboard.FollowTarget, new EntityCoordinates(mommy, Vector2.Zero));
+        }
+    }
+
+    public void AddImprintingTarget(EntityUid entity, EntityUid friend, NPCImprintingOnSpawnBehaviourComponent component)
+    {
+        component.Friends.Add(friend);
+        var exception = EnsureComp<FactionExceptionComponent>(entity);
+        exception.Ignored.Add(friend);
+    }
+}
index 8abe0f7f54cce8051b1d5d152e85d70d6369ac88..910862943502895b7627b6d3ccccef459ac95405 100644 (file)
@@ -5,6 +5,7 @@ using Content.Shared.CCVar;
 using Content.Shared.Mobs;
 using Content.Shared.Mobs.Systems;
 using Content.Shared.NPC;
+using Content.Shared.NPC.Systems;
 using Robust.Server.GameObjects;
 using Robust.Shared.Configuration;
 using Robust.Shared.Player;
index 54de0404c2fd747d52ba168e269a4e54cdc1769f..ba7940d502767f1d84b541365c702773cfcd7820 100644 (file)
@@ -7,7 +7,7 @@ namespace Content.Shared.NPC.Components;
 /// Prevents an NPC from attacking ignored entities from enemy factions.
 /// Can be added to if pettable, see PettableFriendComponent.
 /// </summary>
-[RegisterComponent, NetworkedComponent, Access(typeof(NpcFactionSystem))]
+[RegisterComponent, NetworkedComponent, Access(typeof(NpcFactionSystem), typeof(SharedNPCImprintingOnSpawnBehaviourSystem))] // TO DO (Metalgearsloth): If we start adding a billion access overrides they should be going through a system as then there's no reason to have access, but I'll fix this when I rework npcs.
 public sealed partial class FactionExceptionComponent : Component
 {
     /// <summary>
diff --git a/Content.Shared/NPC/Systems/SharedNPCImprintingOnSpawnBehaviourSystem.cs b/Content.Shared/NPC/Systems/SharedNPCImprintingOnSpawnBehaviourSystem.cs
new file mode 100644 (file)
index 0000000..f06d496
--- /dev/null
@@ -0,0 +1,5 @@
+namespace Content.Shared.NPC.Systems;
+
+public abstract partial class SharedNPCImprintingOnSpawnBehaviourSystem : EntitySystem
+{
+}
diff --git a/Content.Shared/NPC/Systems/SharedNPCSystem.cs b/Content.Shared/NPC/Systems/SharedNPCSystem.cs
new file mode 100644 (file)
index 0000000..247ab47
--- /dev/null
@@ -0,0 +1,5 @@
+namespace Content.Shared.NPC.Systems;
+
+public abstract partial class SharedNPCSystem : EntitySystem
+{
+}
index b39837828830d28b321b6618059d54984535e703..10eb533770438ce41b1396140c47579e6d712d60 100644 (file)
@@ -41,6 +41,8 @@ seeds-bluetomato-name = blue tomato
 seeds-bluetomato-display-name = blue tomato plant
 seeds-bloodtomato-name = blood tomato
 seeds-bloodtomato-display-name = blood tomato plant
+seeds-killertomato-name = tomato killer
+seeds-killertomato-display-name = tomato killer plant
 seeds-eggplant-name = eggplant
 seeds-eggplant-display-name = eggplants
 seeds-apple-name = apple
index 633a4ff3cac704d97e082cf1ce6940437a12096a..6fca4e6a63ed9835c7ac25dd4329700f6a1e074a 100644 (file)
       interactFailureString: petting-failure-generic
       interactSuccessSound:
         path: /Audio/Animals/lizard_happy.ogg
+
+- type: entity
+  id: MobTomatoKiller
+  parent: 
+  - BaseSimpleMob
+  - MobDamageable
+  - MobBloodstream
+  - MobFlammable
+  - MobCombat
+  name: tomato killer
+  description: it seems today it's not you eating tomatoes, it's the tomatoes eating you.
+  components:
+  - type: Item
+    size: Huge
+  - type: NpcFactionMember
+    factions:
+      - SimpleHostile
+  - type: HTN
+    rootTask:
+      task: KillerTomatoCompound
+  - type: NPCImprintingOnSpawnBehaviour
+    whitelist:
+      components:
+      - HumanoidAppearance
+  - type: Sprite
+    sprite: Mobs/Demons/tomatokiller.rsi 
+    noRot: true
+    layers:
+      - map: [ "enum.DamageStateVisualLayers.Base" ]
+        state: alive
+  - type: Bloodstream
+    bloodReagent: JuiceTomato
+    bloodMaxVolume: 50
+    chemicalMaxVolume: 30
+  - type: DamageStateVisuals
+    states:
+      Alive:
+        Base: alive
+      Dead:
+        Base: dead
+  - type: Butcherable
+    spawned:
+    - id: FoodMeatTomato
+      amount: 2
+  - type: Destructible
+    thresholds:
+    - trigger:
+        !type:DamageTypeTrigger
+        damageType: Blunt
+        damage: 100
+      behaviors:
+      - !type:GibBehavior { }
+  - type: MobThresholds
+    thresholds:
+      0: Alive
+      24: Dead
+  - type: Fixtures
+    fixtures:
+      fix1:
+        shape:
+          !type:PhysShapeCircle
+          radius: 0.30
+        density: 80
+        mask:
+          - MobMask
+        layer:
+          - MobLayer
+  - type: MeleeWeapon
+    hidden: true
+    damage:
+      groups:
+        Brute: 4
+    animation: WeaponArcBite
+  - type: Climbing
+  - type: NameIdentifier
+    group: GenericNumber
+  - type: SlowOnDamage
+    speedModifierThresholds:
+      60: 0.7
+      80: 0.5
+  - type: FootstepModifier
+    footstepSoundCollection:
+      path: /Audio/Effects/Footsteps/slime1.ogg
+      params:
+        volume: 3
+  - type: Tag
+    tags:
+      - FootstepSound
+      - Fruit
+  - type: Extractable
+    grindableSolutionName: bloodstream
+  - type: PotencyVisuals
+  - type: Appearance
+  - type: Produce
+    seedId: killerTomato
index 2b232d643d37c2d83c9477f812909c0752248996..0a084dc2463903d7b0109400c314a5102c4607ca 100644 (file)
     - type: Sprite
       sprite: Objects/Specific/Hydroponics/blood_tomato.rsi
 
+- type: entity
+  parent: SeedBase
+  name: packet of killer tomato seeds
+  id: KillerTomatoSeeds
+  components:
+    - type: Seed
+      seedId: killerTomato
+    - type: Sprite
+      sprite: Objects/Specific/Hydroponics/tomatokiller.rsi
+
 - type: entity
   parent: SeedBase
   name: packet of eggplant seeds
index 71b20440f5e13bc1609aadd32d9e846104955a03..8bbbed6135f29bcfd8712f5570e4ed178600422d 100644 (file)
   packetPrototype: BloodTomatoSeeds
   productPrototypes:
     - FoodBloodTomato
+  mutationPrototypes:
+    - killerTomato
   harvestRepeat: Repeat
-  lifespan: 25
+  lifespan: 60
   maturation: 8
   production: 6
   yield: 2
       Max: 4
       PotencyDivisor: 25
 
+- type: seed
+  id: killerTomato
+  name: seeds-killertomato-name
+  noun: seeds-noun-seeds
+  displayName: seeds-killertomato-display-name
+  plantRsi: Objects/Specific/Hydroponics/tomatokiller.rsi
+  packetPrototype: KillerTomatoSeeds
+  productPrototypes:
+    - MobTomatoKiller
+  harvestRepeat: Repeat
+  lifespan: 25
+  maturation: 15
+  production: 6
+  yield: 2
+  potency: 10
+  waterConsumption: 0.60
+  nutrientConsumption: 0.70
+  idealLight: 8
+  idealHeat: 298
+  juicy: true
+  growthStages: 2
+  splatPrototype: PuddleSplatter
+  chemicals:
+    Blood:
+      Min: 1
+      Max: 10
+      PotencyDivisor: 10
+    JuiceTomato:
+      Min: 1
+      Max: 4
+      PotencyDivisor: 25
+
 - type: seed
   id: eggplant
   name: seeds-eggplant-name
index 740f7ca5767bb305c6a53fe367b640ccaf60c450..b0e1c8ae9b98f580d026cfae7a0fcd136c5d0b40 100644 (file)
     - tasks:
         - !type:HTNCompoundTask
           task: IdleCompound
+
+- type: htnCompound
+  id: KillerTomatoCompound
+  branches:
+    - tasks:
+        - !type:HTNCompoundTask
+          task: MeleeCombatCompound
+    - tasks:
+        - !type:HTNCompoundTask
+          task: FollowCompound
+    - tasks:
+        - !type:HTNCompoundTask
+          task: IdleCompound
diff --git a/Resources/Textures/Mobs/Demons/tomatokiller.rsi/alive.png b/Resources/Textures/Mobs/Demons/tomatokiller.rsi/alive.png
new file mode 100644 (file)
index 0000000..5f459d5
Binary files /dev/null and b/Resources/Textures/Mobs/Demons/tomatokiller.rsi/alive.png differ
diff --git a/Resources/Textures/Mobs/Demons/tomatokiller.rsi/dead.png b/Resources/Textures/Mobs/Demons/tomatokiller.rsi/dead.png
new file mode 100644 (file)
index 0000000..4b3ee97
Binary files /dev/null and b/Resources/Textures/Mobs/Demons/tomatokiller.rsi/dead.png differ
diff --git a/Resources/Textures/Mobs/Demons/tomatokiller.rsi/meta.json b/Resources/Textures/Mobs/Demons/tomatokiller.rsi/meta.json
new file mode 100644 (file)
index 0000000..57e4c73
--- /dev/null
@@ -0,0 +1,40 @@
+{
+  "version": 1,
+  "size": {
+    "x": 32,
+    "y": 32
+  },
+  "license": "CC-BY-SA-3.0",
+  "copyright": " taken from TG on commit https://github.com/tgstation/tgstation/commit/7e5f13f558253e76865e81c9641b7ec68e57754b",
+  "states": [
+    {
+      "name": "alive",
+      "directions": 4,
+      "delays": [
+        [
+          0.2,
+          0.2,
+          0.2
+        ],
+        [
+          0.2,
+          0.2,
+          0.2
+        ],
+        [
+          0.2,
+          0.2,
+          0.2
+        ],
+        [
+          0.2,
+          0.2,
+          0.2
+        ]
+      ]
+    },
+    {
+      "name": "dead"
+    }
+  ]
+}
diff --git a/Resources/Textures/Objects/Specific/Hydroponics/tomatokiller.rsi/dead.png b/Resources/Textures/Objects/Specific/Hydroponics/tomatokiller.rsi/dead.png
new file mode 100644 (file)
index 0000000..0051c4d
Binary files /dev/null and b/Resources/Textures/Objects/Specific/Hydroponics/tomatokiller.rsi/dead.png differ
diff --git a/Resources/Textures/Objects/Specific/Hydroponics/tomatokiller.rsi/harvest.png b/Resources/Textures/Objects/Specific/Hydroponics/tomatokiller.rsi/harvest.png
new file mode 100644 (file)
index 0000000..46a3b38
Binary files /dev/null and b/Resources/Textures/Objects/Specific/Hydroponics/tomatokiller.rsi/harvest.png differ
diff --git a/Resources/Textures/Objects/Specific/Hydroponics/tomatokiller.rsi/meta.json b/Resources/Textures/Objects/Specific/Hydroponics/tomatokiller.rsi/meta.json
new file mode 100644 (file)
index 0000000..84a4237
--- /dev/null
@@ -0,0 +1,26 @@
+{
+  "version": 1,
+   "license": "CC-BY-SA-3.0",
+  "copyright": "Taken from https://github.com/vgstation-coders/vgstation13 at 1dbcf389b0ec6b2c51b002df5fef8dd1519f8068",
+  "size": {
+    "x": 32,
+    "y": 32
+  },
+  "states": [
+    {
+      "name": "dead"
+    },
+    {
+      "name": "harvest"
+    },
+    {
+      "name": "seed"
+    },
+    {
+      "name": "stage-1"
+    },
+    {
+      "name": "stage-2"
+    }
+  ]
+}
diff --git a/Resources/Textures/Objects/Specific/Hydroponics/tomatokiller.rsi/seed.png b/Resources/Textures/Objects/Specific/Hydroponics/tomatokiller.rsi/seed.png
new file mode 100644 (file)
index 0000000..110dc64
Binary files /dev/null and b/Resources/Textures/Objects/Specific/Hydroponics/tomatokiller.rsi/seed.png differ
diff --git a/Resources/Textures/Objects/Specific/Hydroponics/tomatokiller.rsi/stage-1.png b/Resources/Textures/Objects/Specific/Hydroponics/tomatokiller.rsi/stage-1.png
new file mode 100644 (file)
index 0000000..0b1d58d
Binary files /dev/null and b/Resources/Textures/Objects/Specific/Hydroponics/tomatokiller.rsi/stage-1.png differ
diff --git a/Resources/Textures/Objects/Specific/Hydroponics/tomatokiller.rsi/stage-2.png b/Resources/Textures/Objects/Specific/Hydroponics/tomatokiller.rsi/stage-2.png
new file mode 100644 (file)
index 0000000..6225f0c
Binary files /dev/null and b/Resources/Textures/Objects/Specific/Hydroponics/tomatokiller.rsi/stage-2.png differ