Skip to content

Commit 32e1f91

Browse files
Desert Plains
1 parent 632c467 commit 32e1f91

5 files changed

Lines changed: 58 additions & 6 deletions

File tree

src/OpenRP.Framework/Features/BiomeGenerator/Extensions/ServiceCollectionExtensions.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ public static IServiceCollection AddBiomeGenerator(this IServiceCollection self)
6363
.AddSingleton<DeadForestBiome>()
6464
.AddSingleton<DeadForestBiomeWithTrees>()
6565
.AddSingleton<DenseFirForestBiome>()
66-
.AddSingleton<DesertBiome>()
66+
.AddSingleton<DesertCactusBiome>()
6767
.AddSingleton<DesertLocustForestBiome>()
6868
.AddSingleton<DesertPalmsBiome>()
6969
.AddSingleton<ElmForestBiome>()

src/OpenRP.Framework/Features/BiomeGenerator/Services/Generators/Biomes/DesertBiome.cs renamed to src/OpenRP.Framework/Features/BiomeGenerator/Services/Generators/Biomes/DesertCactusBiome.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,14 @@
1212

1313
namespace OpenRP.Framework.Features.BiomeGenerator.Services.Generators.Biomes
1414
{
15-
[Biome(155, "Desert", BiomeType.Desert)]
16-
public class DesertBiome : IBiome
15+
[Biome(75, "Desert Cactus", BiomeType.Desert)]
16+
public class DesertCactusBiome : IBiome
1717
{
1818
private readonly IBiomeObjectFactory _factory;
1919
private readonly WeightedRandom<string> _weightedRandom;
2020
private readonly Color _biomeOutputColor;
2121

22-
public DesertBiome(IBiomeObjectFactory factory)
22+
public DesertCactusBiome(IBiomeObjectFactory factory)
2323
{
2424
_factory = factory;
2525
_weightedRandom = new WeightedRandom<string>(new Dictionary<string, int>

src/OpenRP.Framework/Features/BiomeGenerator/Services/Generators/Biomes/DesertLocustForestBiome.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
namespace OpenRP.Framework.Features.BiomeGenerator.Services.Generators.Biomes
1414
{
15-
[Biome(50, "Desert Locust Forest", BiomeType.Desert)]
15+
[Biome(40, "Desert Locust Forest", BiomeType.Desert)]
1616
public class DesertLocustForestBiome : IBiome
1717
{
1818
private readonly IBiomeObjectFactory _factory;

src/OpenRP.Framework/Features/BiomeGenerator/Services/Generators/Biomes/DesertPalmsBiome.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
namespace OpenRP.Framework.Features.BiomeGenerator.Services.Generators.Biomes
1414
{
15-
[Biome(50, "Desert Palms", BiomeType.Desert)]
15+
[Biome(40, "Desert Palms", BiomeType.Desert)]
1616
public class DesertPalmsBiome : IBiome
1717
{
1818
private readonly IBiomeObjectFactory _factory;
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
using OpenRP.Framework.Features.BiomeGenerator.Attributes;
2+
using OpenRP.Framework.Features.BiomeGenerator.Entities;
3+
using OpenRP.Framework.Features.BiomeGenerator.Enums;
4+
using OpenRP.Framework.Features.BiomeGenerator.Helpers;
5+
using SampSharp.Entities.SAMP;
6+
using System;
7+
using System.Collections.Concurrent;
8+
using System.Collections.Generic;
9+
using System.Linq;
10+
using System.Text;
11+
using System.Threading.Tasks;
12+
13+
namespace OpenRP.Framework.Features.BiomeGenerator.Services.Generators.Biomes
14+
{
15+
[Biome(100, "Desert Plains", BiomeType.Desert)]
16+
public class DesertPlainsBiome : IBiome
17+
{
18+
private readonly IBiomeObjectFactory _factory;
19+
private readonly WeightedRandom<string> _weightedRandom;
20+
private readonly Color _biomeOutputColor;
21+
22+
public DesertPlainsBiome(IBiomeObjectFactory factory)
23+
{
24+
_factory = factory;
25+
_weightedRandom = new WeightedRandom<string>(new Dictionary<string, int>
26+
{
27+
{ "DesertBush", 25 },
28+
{ "DesertDryBush", 30 },
29+
{ "SandJoshPlant", 25 },
30+
{ "DesertRock", 15 },
31+
{ "Nothing", 905 }
32+
});
33+
_biomeOutputColor = GetBiomeOutputColor();
34+
}
35+
36+
public ConcurrentBag<BiomeObject> Generate(Vector2 virtualPosition, Vector3 gamePosition, Vector3 gameRotation, Vector3 defaultRotation, Vector3 maxAngleRotation)
37+
{
38+
string selectedType = _weightedRandom.GetRandomItem();
39+
var assets = new ConcurrentBag<BiomeObject>();
40+
41+
if (selectedType != "Nothing")
42+
{
43+
BiomeObject element = _factory.Generate(selectedType, virtualPosition, gamePosition, gameRotation, defaultRotation, maxAngleRotation, _biomeOutputColor);
44+
assets.Add(element);
45+
}
46+
47+
return assets;
48+
}
49+
50+
public Color GetBiomeOutputColor() => new Color(128, 0, 0);
51+
}
52+
}

0 commit comments

Comments
 (0)