Botany (#2357)
* plants and seeds go brrrr * update plants * P L A N T * brrrr * Hydroponics actually work! How about that? * Reuse resource path in visualizer * They lied to us. * Several stuffs * more werk * Add a bunch of plants * Logs go brr. * Brrr moment. * Remove unused method * Important comment. * Seed inventory, yo! * tomato moment * Balance consumption * Makes hydroponics pourable * Adds plant metabolism effect for sugar, the same as glucose. * Eggplant moment * Apple moment * Corn moment * Chanterelle mushroom moment * prototype tweaks * Seed extractor moment * typo * IPlantMetabolizable doc improvement * I should trust my gut instinct more often. * egg-plant..... * localization * Make WaterLevel and NutritionLevel setters private * Less code repetition! Wooo!
This commit is contained in:
committed by
GitHub
parent
7c57d10531
commit
484eb0bba4
@@ -23,9 +23,11 @@ namespace Content.Shared.Chemistry
|
||||
private string _description;
|
||||
private string _physicalDescription;
|
||||
private Color _substanceColor;
|
||||
private List<IMetabolizable> _metabolism;
|
||||
private string _spritePath;
|
||||
private List<IMetabolizable> _metabolism;
|
||||
private List<ITileReaction> _tileReactions;
|
||||
private List<IPlantMetabolizable> _plantMetabolism;
|
||||
private float _customPlantMetabolism = 1f;
|
||||
|
||||
public string ID => _id;
|
||||
public string Name => _name;
|
||||
@@ -34,8 +36,9 @@ namespace Content.Shared.Chemistry
|
||||
public Color SubstanceColor => _substanceColor;
|
||||
|
||||
//List of metabolism effects this reagent has, should really only be used server-side.
|
||||
public List<IMetabolizable> Metabolism => _metabolism;
|
||||
public List<ITileReaction> TileReactions => _tileReactions;
|
||||
public IReadOnlyList<IMetabolizable> Metabolism => _metabolism;
|
||||
public IReadOnlyList<ITileReaction> TileReactions => _tileReactions;
|
||||
public IReadOnlyList<IPlantMetabolizable> PlantMetabolism => _plantMetabolism;
|
||||
public string SpriteReplacementPath => _spritePath;
|
||||
|
||||
public ReagentPrototype()
|
||||
@@ -53,16 +56,19 @@ namespace Content.Shared.Chemistry
|
||||
serializer.DataField(ref _physicalDescription, "physicalDesc", string.Empty);
|
||||
serializer.DataField(ref _substanceColor, "color", Color.White);
|
||||
serializer.DataField(ref _spritePath, "spritePath", string.Empty);
|
||||
serializer.DataField(ref _customPlantMetabolism, "customPlantMetabolism", 1f);
|
||||
|
||||
if (_moduleManager.IsServerModule)
|
||||
{
|
||||
serializer.DataField(ref _metabolism, "metabolism", new List<IMetabolizable> { new DefaultMetabolizable() });
|
||||
serializer.DataField(ref _tileReactions, "tileReactions", new List<ITileReaction> { });
|
||||
serializer.DataField(ref _plantMetabolism, "plantMetabolism", new List<IPlantMetabolizable> { });
|
||||
}
|
||||
else
|
||||
{
|
||||
_metabolism = new List<IMetabolizable> { new DefaultMetabolizable() };
|
||||
_tileReactions = new List<ITileReaction>();
|
||||
_tileReactions = new List<ITileReaction>(0);
|
||||
_plantMetabolism = new List<IPlantMetabolizable>(0);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -136,5 +142,16 @@ namespace Content.Shared.Chemistry
|
||||
|
||||
return removed;
|
||||
}
|
||||
|
||||
public void ReactionPlant(IEntity plantHolder)
|
||||
{
|
||||
if (plantHolder == null || plantHolder.Deleted)
|
||||
return;
|
||||
|
||||
foreach (var plantMetabolizable in _plantMetabolism)
|
||||
{
|
||||
plantMetabolizable.Metabolize(plantHolder, _customPlantMetabolism);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user