Potted Plants Cleanup (#9196)

* pray for me

* yippee

* collision fix
This commit is contained in:
EmoGarbage404
2022-06-28 06:49:26 -04:00
committed by GitHub
parent 97c74d5903
commit ef3a02397a
4 changed files with 254 additions and 72 deletions

View File

@@ -1,17 +0,0 @@
using Content.Server.Plants.Systems;
namespace Content.Server.Plants.Components
{
[RegisterComponent]
[Access(typeof(RandomPottedPlantSystem))]
public sealed class RandomPottedPlantComponent : Component
{
[ViewVariables(VVAccess.ReadOnly)]
[DataField("selected")]
public string? State;
[ViewVariables(VVAccess.ReadOnly)]
[DataField("plastic")]
public bool Plastic;
}
}

View File

@@ -1,35 +0,0 @@
using Content.Server.Plants.Components;
using Robust.Server.GameObjects;
using Robust.Shared.Random;
namespace Content.Server.Plants.Systems
{
public sealed class RandomPottedPlantSystem : EntitySystem
{
[Dependency] private readonly IRobustRandom _random = default!;
private static readonly string[] RegularPlantStates =
{
"plant-01", "plant-02", "plant-03", "plant-04", "plant-05",
"plant-06", "plant-07", "plant-08", "plant-09", "plant-10",
"plant-11", "plant-12", "plant-13", "plant-14", "plant-15",
"plant-16", "plant-17", "plant-18", "plant-19", "plant-20",
"plant-21", "plant-22", "plant-23", "plant-24", "applebush"
};
private static readonly string[] PlasticPlantStates =
{
"plant-26", "plant-27", "plant-28", "plant-29"
};
public override void Initialize()
{
SubscribeLocalEvent<RandomPottedPlantComponent, MapInitEvent>(OnMapInit);
}
private void OnMapInit(EntityUid uid, RandomPottedPlantComponent component, MapInitEvent args)
{
component.State ??= _random.Pick(component.Plastic ? PlasticPlantStates : RegularPlantStates);
Comp<SpriteComponent>(uid).LayerSetState(0, component.State);
}
}
}

View File

@@ -0,0 +1,55 @@
- type: entity
parent: MarkerBase
id: PottedPlantRandom
name: random potted plant spawner
components:
- type: Sprite
layers:
- state: red
- texture: Structures/Furniture/potted_plants.rsi/random.png
- type: RandomSpawner
offset: 0
prototypes:
- PottedPlant0
- PottedPlant1
- PottedPlant2
- PottedPlant3
- PottedPlant4
- PottedPlant5
- PottedPlant6
- PottedPlant7
- PottedPlant8
- PottedPlant10
- PottedPlant11
- PottedPlant12
- PottedPlant13
- PottedPlant14
- PottedPlant15
- PottedPlant16
- PottedPlant17
- PottedPlant18
- PottedPlant19
- PottedPlant20
- PottedPlant21
- PottedPlant22
- PottedPlant23
- PottedPlant24
chance: 1
- type: entity
parent: MarkerBase
id: PottedPlantRandomPlastic
name: random plastic potted plant spawner
components:
- type: Sprite
layers:
- state: red
- texture: Structures/Furniture/potted_plants.rsi/plant-26.png
- type: RandomSpawner
offset: 0
prototypes:
- PottedPlant26
- PottedPlant27
- PottedPlant28
- PottedPlant29
chance: 1

View File

@@ -1,6 +1,8 @@
- type: entity
id: PottedPlantBase
parent: BaseStructureDynamic
name: potted plant
description: A little bit of nature contained in a pot.
abstract: true
components:
- type: Transform
@@ -12,13 +14,10 @@
fixtures:
- shape:
!type:PhysShapeCircle
radius: 0.2
radius: 0.1
mass: 25
mask:
- Impassable
layer:
- Opaque
- BulletImpassable
- type: Sprite
drawdepth: Overdoors
offset: "0.0,0.3"
@@ -42,37 +41,70 @@
path: /Audio/Effects/plant_rustle.ogg
- type: entity
id: PottedPlantRandom
id: PottedPlant0
parent: PottedPlantBase
name: potted plant
description: A little bit of nature contained in a pot.
components:
- type: Sprite
state: random
- type: RandomPottedPlant
state: applebush #whoever named this texture in the rsi sucks
- type: entity
id: PottedPlantRandomPlastic
id: PottedPlant1
parent: PottedPlantBase
name: plastic potted plant
description: A fake, cheap looking, plastic tree. Perfect for people who kill every plant they touch.
components:
- type: Sprite
state: plant-26
- type: RandomPottedPlant
plastic: true
state: plant-01
- type: entity
id: PottedPlantRD
id: PottedPlant2
parent: PottedPlantBase
name: "RD's potted plant"
description: "A gift from the botanical staff, presented after the RD's reassignment. There's a tag on it that says \"Y'all come back now, y'hear?\"\nIt doesn't look very healthy..."
components:
- type: Sprite
state: plant-25
state: plant-02
- type: entity
id: PottedPlantBioluminscent
id: PottedPlant3
parent: PottedPlantBase
components:
- type: Sprite
state: plant-03
- type: entity
id: PottedPlant4
parent: PottedPlantBase
components:
- type: Sprite
state: plant-04
- type: entity
id: PottedPlant5
parent: PottedPlantBase
components:
- type: Sprite
state: plant-05
- type: entity
id: PottedPlant6
parent: PottedPlantBase
components:
- type: Sprite
state: plant-06
- type: entity
id: PottedPlant7
parent: PottedPlantBase
components:
- type: Sprite
state: plant-07
- type: entity
id: PottedPlant8
parent: PottedPlantBase
components:
- type: Sprite
state: plant-08
- type: entity
id: PottedPlantBioluminscent #PottedPlant9 but i didn't want map conflicts
parent: PottedPlantBase
name: "bioluminescent potted plant"
description: "It produces light!"
@@ -82,3 +114,150 @@
- type: PointLight
radius: 2
color: "#2cb2e8"
- type: entity
id: PottedPlant10
parent: PottedPlantBase
description: A pretty piece of nature contained in a pot.
components:
- type: Sprite
state: plant-10
- type: entity
id: PottedPlant11
parent: PottedPlantBase
components:
- type: Sprite
state: plant-11
- type: entity
id: PottedPlant12
parent: PottedPlantBase
components:
- type: Sprite
state: plant-12
- type: entity
id: PottedPlant13
parent: PottedPlantBase
components:
- type: Sprite
state: plant-13
- type: entity
id: PottedPlant14
parent: PottedPlantBase
components:
- type: Sprite
state: plant-14
- type: entity
id: PottedPlant15
parent: PottedPlantBase
components:
- type: Sprite
state: plant-15
- type: entity
id: PottedPlant16
parent: PottedPlantBase
components:
- type: Sprite
state: plant-16
- type: entity
id: PottedPlant17
parent: PottedPlantBase
components:
- type: Sprite
state: plant-17
- type: entity
id: PottedPlant18
parent: PottedPlantBase
components:
- type: Sprite
state: plant-18
- type: entity
id: PottedPlant19
parent: PottedPlantBase
components:
- type: Sprite
state: plant-19
- type: entity
id: PottedPlant20
parent: PottedPlantBase
components:
- type: Sprite
state: plant-20
- type: entity
id: PottedPlant21
parent: PottedPlantBase
components:
- type: Sprite
state: plant-21
- type: entity
id: PottedPlant22
parent: PottedPlantBase
components:
- type: Sprite
state: plant-22
- type: entity
id: PottedPlant23
parent: PottedPlantBase
components:
- type: Sprite
state: plant-23
- type: entity
id: PottedPlant24
parent: PottedPlantBase
components:
- type: Sprite
state: plant-24
- type: entity
id: PottedPlantRD #PottedPlant25
parent: PottedPlantBase
name: "RD's potted plant"
description: "A gift from the botanical staff, presented after the RD's reassignment. There's a tag on it that says \"Y'all come back now, y'hear?\"\nIt doesn't look very healthy..."
components:
- type: Sprite
state: plant-25
#these are all the plastic plants. They inherit from the first one because they don't have
#enough differences to warrant getting a unique abstract prototype. It's just the name and description.
- type: entity
id: PottedPlant26
parent: PottedPlantBase
name: plastic potted plant
description: A fake, cheap looking, plastic tree. Perfect for people who kill every plant they touch.
components:
- type: Sprite
state: plant-26
- type: entity
id: PottedPlant27
parent: PottedPlant26
components:
- type: Sprite
state: plant-27
- type: entity
id: PottedPlant28
parent: PottedPlant26
components:
- type: Sprite
state: plant-28
- type: entity
id: PottedPlant29
parent: PottedPlant26
components:
- type: Sprite
state: plant-29