diff --git a/Content.Server/GameObjects/Components/RandomPottedPlantComponent.cs b/Content.Server/GameObjects/Components/RandomPottedPlantComponent.cs new file mode 100644 index 0000000000..753a9b63c8 --- /dev/null +++ b/Content.Server/GameObjects/Components/RandomPottedPlantComponent.cs @@ -0,0 +1,74 @@ +using System.Collections.Generic; +using Robust.Server.GameObjects; +using Robust.Server.Interfaces.GameObjects; +using Robust.Shared.GameObjects; +using Robust.Shared.Interfaces.Random; +using Robust.Shared.IoC; +using Robust.Shared.Random; +using Robust.Shared.Serialization; + +namespace Content.Server.GameObjects.Components +{ + [RegisterComponent] + public class RandomPottedPlantComponent : Component, IMapInit + { + public override string Name => "RandomPottedPlant"; + + private static readonly string[] RegularPlantStates; + private static readonly string[] PlasticPlantStates; + + private string _selectedState; + private bool _plastic; + + + static RandomPottedPlantComponent() + { + // ReSharper disable once StringLiteralTypo + var states = new List {"applebush"}; + + for (var i = 1; i < 25; i++) + { + states.Add($"plant-{i:D2}"); + } + + RegularPlantStates = states.ToArray(); + + states.Clear(); + + for (var i = 26; i < 30; i++) + { + states.Add($"plant-{i:D2}"); + } + + PlasticPlantStates = states.ToArray(); + } + + public override void ExposeData(ObjectSerializer serializer) + { + base.ExposeData(serializer); + + serializer.DataField(ref _selectedState, "selected", null); + serializer.DataField(ref _plastic, "plastic", false); + } + + protected override void Startup() + { + base.Startup(); + + if (_selectedState != null) + { + Owner.GetComponent().LayerSetState(0, _selectedState); + } + } + + public void MapInit() + { + var random = IoCManager.Resolve(); + + var list = _plastic ? PlasticPlantStates : RegularPlantStates; + _selectedState = random.Pick(list); + + Owner.GetComponent().LayerSetState(0, _selectedState); + } + } +} diff --git a/Resources/Prototypes/Entities/pottedPlants.yml b/Resources/Prototypes/Entities/pottedPlants.yml new file mode 100644 index 0000000000..d3a7e943f6 --- /dev/null +++ b/Resources/Prototypes/Entities/pottedPlants.yml @@ -0,0 +1,73 @@ +- type: entity + id: PottedPlantBase + abstract: true + components: + - type: Clickable + - type: InteractionOutline + - type: Collidable + - type: Sprite + sprite: Objects/potted_plants.rsi + + - type: Icon + sprite: Objects/potted_plants.rsi + + +- type: entity + id: PottedPlantRandom + parent: PottedPlantBase + name: potted plant + description: A little bit of nature contained in a pot. + components: + - type: Sprite + state: random + + - type: Icon + state: random + + - type: RandomPottedPlant + + +- type: entity + id: PottedPlantRandomPlastic + 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: Icon + state: plant-26 + + - type: RandomPottedPlant + plastic: true + +- type: entity + id: PottedPlantRD + 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 + + - type: Icon + state: plant-25 + + +- type: entity + id: PottedPlantBioluminscent + parent: PottedPlantBase + name: "bioluminescent potted plant" + description: "It produces light!" + components: + - type: Sprite + state: plant-09 + + - type: Icon + state: plant-09 + + - type: PointLight + radius: 2 + color: "#2cb2e8" + power: 0.25 diff --git a/Resources/Textures/Objects/potted_plants.rsi/applebush.png b/Resources/Textures/Objects/potted_plants.rsi/applebush.png new file mode 100644 index 0000000000..9cdc400b80 Binary files /dev/null and b/Resources/Textures/Objects/potted_plants.rsi/applebush.png differ diff --git a/Resources/Textures/Objects/potted_plants.rsi/meta.json b/Resources/Textures/Objects/potted_plants.rsi/meta.json new file mode 100644 index 0000000000..f822214960 --- /dev/null +++ b/Resources/Textures/Objects/potted_plants.rsi/meta.json @@ -0,0 +1,288 @@ +{ + "version": 1, + "size": { + "x": 32, + "y": 32 + }, + "states": [ + { + "name": "random", + "directions": 1, + "delays": [ + [ + 1.0 + ] + ] + }, + { + "name": "applebush", + "directions": 1, + "delays": [ + [ + 1.0 + ] + ] + }, + { + "name": "plant-01", + "directions": 1, + "delays": [ + [ + 1.0 + ] + ] + }, + { + "name": "plant-02", + "directions": 1, + "delays": [ + [ + 1.0 + ] + ] + }, + { + "name": "plant-03", + "directions": 1, + "delays": [ + [ + 1.0 + ] + ] + }, + { + "name": "plant-04", + "directions": 1, + "delays": [ + [ + 1.0 + ] + ] + }, + { + "name": "plant-05", + "directions": 1, + "delays": [ + [ + 1.0 + ] + ] + }, + { + "name": "plant-06", + "directions": 1, + "delays": [ + [ + 1.0 + ] + ] + }, + { + "name": "plant-07", + "directions": 1, + "delays": [ + [ + 1.0 + ] + ] + }, + { + "name": "plant-08", + "directions": 1, + "delays": [ + [ + 1.0 + ] + ] + }, + { + "name": "plant-09", + "directions": 1, + "delays": [ + [ + 1.0 + ] + ] + }, + { + "name": "plant-10", + "directions": 1, + "delays": [ + [ + 1.0 + ] + ] + }, + { + "name": "plant-11", + "directions": 1, + "delays": [ + [ + 1.0 + ] + ] + }, + { + "name": "plant-12", + "directions": 1, + "delays": [ + [ + 1.0 + ] + ] + }, + { + "name": "plant-13", + "directions": 1, + "delays": [ + [ + 1.0 + ] + ] + }, + { + "name": "plant-14", + "directions": 1, + "delays": [ + [ + 1.0 + ] + ] + }, + { + "name": "plant-15", + "directions": 1, + "delays": [ + [ + 1.0 + ] + ] + }, + { + "name": "plant-16", + "directions": 1, + "delays": [ + [ + 1.0 + ] + ] + }, + { + "name": "plant-17", + "directions": 1, + "delays": [ + [ + 1.0 + ] + ] + }, + { + "name": "plant-18", + "directions": 1, + "delays": [ + [ + 1.0 + ] + ] + }, + { + "name": "plant-19", + "directions": 1, + "delays": [ + [ + 1.0 + ] + ] + }, + { + "name": "plant-20", + "directions": 1, + "delays": [ + [ + 1.0 + ] + ] + }, + { + "name": "plant-21", + "directions": 1, + "delays": [ + [ + 1.0 + ] + ] + }, + { + "name": "plant-22", + "directions": 1, + "delays": [ + [ + 1.0 + ] + ] + }, + { + "name": "plant-23", + "directions": 1, + "delays": [ + [ + 1.0 + ] + ] + }, + { + "name": "plant-24", + "directions": 1, + "delays": [ + [ + 1.0 + ] + ] + }, + { + "name": "plant-25", + "directions": 1, + "delays": [ + [ + 1.0 + ] + ] + }, + { + "name": "plant-26", + "directions": 1, + "delays": [ + [ + 1.0 + ] + ] + }, + { + "name": "plant-27", + "directions": 1, + "delays": [ + [ + 1.0 + ] + ] + }, + { + "name": "plant-28", + "directions": 1, + "delays": [ + [ + 1.0 + ] + ] + }, + { + "name": "plant-29", + "directions": 1, + "delays": [ + [ + 1.0 + ] + ] + } + ] +} \ No newline at end of file diff --git a/Resources/Textures/Objects/potted_plants.rsi/plant-01.png b/Resources/Textures/Objects/potted_plants.rsi/plant-01.png new file mode 100644 index 0000000000..c6fda1b99f Binary files /dev/null and b/Resources/Textures/Objects/potted_plants.rsi/plant-01.png differ diff --git a/Resources/Textures/Objects/potted_plants.rsi/plant-02.png b/Resources/Textures/Objects/potted_plants.rsi/plant-02.png new file mode 100644 index 0000000000..1cca1304c3 Binary files /dev/null and b/Resources/Textures/Objects/potted_plants.rsi/plant-02.png differ diff --git a/Resources/Textures/Objects/potted_plants.rsi/plant-03.png b/Resources/Textures/Objects/potted_plants.rsi/plant-03.png new file mode 100644 index 0000000000..0c877df656 Binary files /dev/null and b/Resources/Textures/Objects/potted_plants.rsi/plant-03.png differ diff --git a/Resources/Textures/Objects/potted_plants.rsi/plant-04.png b/Resources/Textures/Objects/potted_plants.rsi/plant-04.png new file mode 100644 index 0000000000..98235a60c9 Binary files /dev/null and b/Resources/Textures/Objects/potted_plants.rsi/plant-04.png differ diff --git a/Resources/Textures/Objects/potted_plants.rsi/plant-05.png b/Resources/Textures/Objects/potted_plants.rsi/plant-05.png new file mode 100644 index 0000000000..7d530e15f3 Binary files /dev/null and b/Resources/Textures/Objects/potted_plants.rsi/plant-05.png differ diff --git a/Resources/Textures/Objects/potted_plants.rsi/plant-06.png b/Resources/Textures/Objects/potted_plants.rsi/plant-06.png new file mode 100644 index 0000000000..697769224b Binary files /dev/null and b/Resources/Textures/Objects/potted_plants.rsi/plant-06.png differ diff --git a/Resources/Textures/Objects/potted_plants.rsi/plant-07.png b/Resources/Textures/Objects/potted_plants.rsi/plant-07.png new file mode 100644 index 0000000000..9300152d7d Binary files /dev/null and b/Resources/Textures/Objects/potted_plants.rsi/plant-07.png differ diff --git a/Resources/Textures/Objects/potted_plants.rsi/plant-08.png b/Resources/Textures/Objects/potted_plants.rsi/plant-08.png new file mode 100644 index 0000000000..a0a1a5cf74 Binary files /dev/null and b/Resources/Textures/Objects/potted_plants.rsi/plant-08.png differ diff --git a/Resources/Textures/Objects/potted_plants.rsi/plant-09.png b/Resources/Textures/Objects/potted_plants.rsi/plant-09.png new file mode 100644 index 0000000000..5d4859b200 Binary files /dev/null and b/Resources/Textures/Objects/potted_plants.rsi/plant-09.png differ diff --git a/Resources/Textures/Objects/potted_plants.rsi/plant-10.png b/Resources/Textures/Objects/potted_plants.rsi/plant-10.png new file mode 100644 index 0000000000..98f370b424 Binary files /dev/null and b/Resources/Textures/Objects/potted_plants.rsi/plant-10.png differ diff --git a/Resources/Textures/Objects/potted_plants.rsi/plant-11.png b/Resources/Textures/Objects/potted_plants.rsi/plant-11.png new file mode 100644 index 0000000000..a5c4baa93a Binary files /dev/null and b/Resources/Textures/Objects/potted_plants.rsi/plant-11.png differ diff --git a/Resources/Textures/Objects/potted_plants.rsi/plant-12.png b/Resources/Textures/Objects/potted_plants.rsi/plant-12.png new file mode 100644 index 0000000000..12ea1eb3bd Binary files /dev/null and b/Resources/Textures/Objects/potted_plants.rsi/plant-12.png differ diff --git a/Resources/Textures/Objects/potted_plants.rsi/plant-13.png b/Resources/Textures/Objects/potted_plants.rsi/plant-13.png new file mode 100644 index 0000000000..e991d846bd Binary files /dev/null and b/Resources/Textures/Objects/potted_plants.rsi/plant-13.png differ diff --git a/Resources/Textures/Objects/potted_plants.rsi/plant-14.png b/Resources/Textures/Objects/potted_plants.rsi/plant-14.png new file mode 100644 index 0000000000..918b136d55 Binary files /dev/null and b/Resources/Textures/Objects/potted_plants.rsi/plant-14.png differ diff --git a/Resources/Textures/Objects/potted_plants.rsi/plant-15.png b/Resources/Textures/Objects/potted_plants.rsi/plant-15.png new file mode 100644 index 0000000000..28441978ae Binary files /dev/null and b/Resources/Textures/Objects/potted_plants.rsi/plant-15.png differ diff --git a/Resources/Textures/Objects/potted_plants.rsi/plant-16.png b/Resources/Textures/Objects/potted_plants.rsi/plant-16.png new file mode 100644 index 0000000000..b8f8d40622 Binary files /dev/null and b/Resources/Textures/Objects/potted_plants.rsi/plant-16.png differ diff --git a/Resources/Textures/Objects/potted_plants.rsi/plant-17.png b/Resources/Textures/Objects/potted_plants.rsi/plant-17.png new file mode 100644 index 0000000000..2e87d125a8 Binary files /dev/null and b/Resources/Textures/Objects/potted_plants.rsi/plant-17.png differ diff --git a/Resources/Textures/Objects/potted_plants.rsi/plant-18.png b/Resources/Textures/Objects/potted_plants.rsi/plant-18.png new file mode 100644 index 0000000000..8a53650256 Binary files /dev/null and b/Resources/Textures/Objects/potted_plants.rsi/plant-18.png differ diff --git a/Resources/Textures/Objects/potted_plants.rsi/plant-19.png b/Resources/Textures/Objects/potted_plants.rsi/plant-19.png new file mode 100644 index 0000000000..3a4deaf8b7 Binary files /dev/null and b/Resources/Textures/Objects/potted_plants.rsi/plant-19.png differ diff --git a/Resources/Textures/Objects/potted_plants.rsi/plant-20.png b/Resources/Textures/Objects/potted_plants.rsi/plant-20.png new file mode 100644 index 0000000000..e484496e5d Binary files /dev/null and b/Resources/Textures/Objects/potted_plants.rsi/plant-20.png differ diff --git a/Resources/Textures/Objects/potted_plants.rsi/plant-21.png b/Resources/Textures/Objects/potted_plants.rsi/plant-21.png new file mode 100644 index 0000000000..a0e43ddf26 Binary files /dev/null and b/Resources/Textures/Objects/potted_plants.rsi/plant-21.png differ diff --git a/Resources/Textures/Objects/potted_plants.rsi/plant-22.png b/Resources/Textures/Objects/potted_plants.rsi/plant-22.png new file mode 100644 index 0000000000..b498d80306 Binary files /dev/null and b/Resources/Textures/Objects/potted_plants.rsi/plant-22.png differ diff --git a/Resources/Textures/Objects/potted_plants.rsi/plant-23.png b/Resources/Textures/Objects/potted_plants.rsi/plant-23.png new file mode 100644 index 0000000000..4f29c37381 Binary files /dev/null and b/Resources/Textures/Objects/potted_plants.rsi/plant-23.png differ diff --git a/Resources/Textures/Objects/potted_plants.rsi/plant-24.png b/Resources/Textures/Objects/potted_plants.rsi/plant-24.png new file mode 100644 index 0000000000..403c96dace Binary files /dev/null and b/Resources/Textures/Objects/potted_plants.rsi/plant-24.png differ diff --git a/Resources/Textures/Objects/potted_plants.rsi/plant-25.png b/Resources/Textures/Objects/potted_plants.rsi/plant-25.png new file mode 100644 index 0000000000..f483738e23 Binary files /dev/null and b/Resources/Textures/Objects/potted_plants.rsi/plant-25.png differ diff --git a/Resources/Textures/Objects/potted_plants.rsi/plant-26.png b/Resources/Textures/Objects/potted_plants.rsi/plant-26.png new file mode 100644 index 0000000000..a79b9e2da8 Binary files /dev/null and b/Resources/Textures/Objects/potted_plants.rsi/plant-26.png differ diff --git a/Resources/Textures/Objects/potted_plants.rsi/plant-27.png b/Resources/Textures/Objects/potted_plants.rsi/plant-27.png new file mode 100644 index 0000000000..1019885b91 Binary files /dev/null and b/Resources/Textures/Objects/potted_plants.rsi/plant-27.png differ diff --git a/Resources/Textures/Objects/potted_plants.rsi/plant-28.png b/Resources/Textures/Objects/potted_plants.rsi/plant-28.png new file mode 100644 index 0000000000..d5cbefe63a Binary files /dev/null and b/Resources/Textures/Objects/potted_plants.rsi/plant-28.png differ diff --git a/Resources/Textures/Objects/potted_plants.rsi/plant-29.png b/Resources/Textures/Objects/potted_plants.rsi/plant-29.png new file mode 100644 index 0000000000..c59c7e4277 Binary files /dev/null and b/Resources/Textures/Objects/potted_plants.rsi/plant-29.png differ diff --git a/Resources/Textures/Objects/potted_plants.rsi/random.png b/Resources/Textures/Objects/potted_plants.rsi/random.png new file mode 100644 index 0000000000..d3e800576e Binary files /dev/null and b/Resources/Textures/Objects/potted_plants.rsi/random.png differ