Potted plants from TG.
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
73
Resources/Prototypes/Entities/pottedPlants.yml
Normal 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
|
||||
BIN
Resources/Textures/Objects/potted_plants.rsi/applebush.png
Normal file
|
After Width: | Height: | Size: 669 B |
288
Resources/Textures/Objects/potted_plants.rsi/meta.json
Normal 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
|
||||
]
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
BIN
Resources/Textures/Objects/potted_plants.rsi/plant-01.png
Normal file
|
After Width: | Height: | Size: 803 B |
BIN
Resources/Textures/Objects/potted_plants.rsi/plant-02.png
Normal file
|
After Width: | Height: | Size: 742 B |
BIN
Resources/Textures/Objects/potted_plants.rsi/plant-03.png
Normal file
|
After Width: | Height: | Size: 1.2 KiB |
BIN
Resources/Textures/Objects/potted_plants.rsi/plant-04.png
Normal file
|
After Width: | Height: | Size: 664 B |
BIN
Resources/Textures/Objects/potted_plants.rsi/plant-05.png
Normal file
|
After Width: | Height: | Size: 768 B |
BIN
Resources/Textures/Objects/potted_plants.rsi/plant-06.png
Normal file
|
After Width: | Height: | Size: 674 B |
BIN
Resources/Textures/Objects/potted_plants.rsi/plant-07.png
Normal file
|
After Width: | Height: | Size: 466 B |
BIN
Resources/Textures/Objects/potted_plants.rsi/plant-08.png
Normal file
|
After Width: | Height: | Size: 741 B |
BIN
Resources/Textures/Objects/potted_plants.rsi/plant-09.png
Normal file
|
After Width: | Height: | Size: 825 B |
BIN
Resources/Textures/Objects/potted_plants.rsi/plant-10.png
Normal file
|
After Width: | Height: | Size: 879 B |
BIN
Resources/Textures/Objects/potted_plants.rsi/plant-11.png
Normal file
|
After Width: | Height: | Size: 515 B |
BIN
Resources/Textures/Objects/potted_plants.rsi/plant-12.png
Normal file
|
After Width: | Height: | Size: 604 B |
BIN
Resources/Textures/Objects/potted_plants.rsi/plant-13.png
Normal file
|
After Width: | Height: | Size: 660 B |
BIN
Resources/Textures/Objects/potted_plants.rsi/plant-14.png
Normal file
|
After Width: | Height: | Size: 977 B |
BIN
Resources/Textures/Objects/potted_plants.rsi/plant-15.png
Normal file
|
After Width: | Height: | Size: 574 B |
BIN
Resources/Textures/Objects/potted_plants.rsi/plant-16.png
Normal file
|
After Width: | Height: | Size: 902 B |
BIN
Resources/Textures/Objects/potted_plants.rsi/plant-17.png
Normal file
|
After Width: | Height: | Size: 525 B |
BIN
Resources/Textures/Objects/potted_plants.rsi/plant-18.png
Normal file
|
After Width: | Height: | Size: 676 B |
BIN
Resources/Textures/Objects/potted_plants.rsi/plant-19.png
Normal file
|
After Width: | Height: | Size: 1.2 KiB |
BIN
Resources/Textures/Objects/potted_plants.rsi/plant-20.png
Normal file
|
After Width: | Height: | Size: 955 B |
BIN
Resources/Textures/Objects/potted_plants.rsi/plant-21.png
Normal file
|
After Width: | Height: | Size: 1.0 KiB |
BIN
Resources/Textures/Objects/potted_plants.rsi/plant-22.png
Normal file
|
After Width: | Height: | Size: 596 B |
BIN
Resources/Textures/Objects/potted_plants.rsi/plant-23.png
Normal file
|
After Width: | Height: | Size: 631 B |
BIN
Resources/Textures/Objects/potted_plants.rsi/plant-24.png
Normal file
|
After Width: | Height: | Size: 948 B |
BIN
Resources/Textures/Objects/potted_plants.rsi/plant-25.png
Normal file
|
After Width: | Height: | Size: 474 B |
BIN
Resources/Textures/Objects/potted_plants.rsi/plant-26.png
Normal file
|
After Width: | Height: | Size: 633 B |
BIN
Resources/Textures/Objects/potted_plants.rsi/plant-27.png
Normal file
|
After Width: | Height: | Size: 725 B |
BIN
Resources/Textures/Objects/potted_plants.rsi/plant-28.png
Normal file
|
After Width: | Height: | Size: 624 B |
BIN
Resources/Textures/Objects/potted_plants.rsi/plant-29.png
Normal file
|
After Width: | Height: | Size: 593 B |
BIN
Resources/Textures/Objects/potted_plants.rsi/random.png
Normal file
|
After Width: | Height: | Size: 1.5 KiB |