Potted plants from TG.

This commit is contained in:
Pieter-Jan Briers
2020-04-23 13:56:16 +02:00
parent 70794f76f2
commit 6cad18bff4
34 changed files with 435 additions and 0 deletions

View File

@@ -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<string> {"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<SpriteComponent>().LayerSetState(0, _selectedState);
}
}
public void MapInit()
{
var random = IoCManager.Resolve<IRobustRandom>();
var list = _plastic ? PlasticPlantStates : RegularPlantStates;
_selectedState = random.Pick(list);
Owner.GetComponent<SpriteComponent>().LayerSetState(0, _selectedState);
}
}
}

View File

@@ -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

Binary file not shown.

After

Width:  |  Height:  |  Size: 669 B

View File

@@ -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
]
]
}
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 803 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 742 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 664 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 768 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 674 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 466 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 741 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 825 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 879 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 515 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 604 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 660 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 977 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 574 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 902 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 525 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 676 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 955 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 596 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 631 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 948 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 474 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 633 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 725 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 624 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 593 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB