Skip to content

Commit 2fc2e41

Browse files
Desert Wasteland Plains
1 parent ba7e520 commit 2fc2e41

3 files changed

Lines changed: 52 additions & 0 deletions

File tree

src/OpenRP.Framework/Features/BiomeGenerator/Enums/BiomeType.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ public enum BiomeType
1818
LosSantosPlains,
1919
SanFierroMain,
2020
Desert,
21+
DesertWastelands,
2122
DesertRestrictedZone,
2223
Shrublands,
2324
Savanna,

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ public static IServiceCollection AddBiomeGenerator(this IServiceCollection self)
7272
.AddSingleton<DesertRestrictedZoneLocustForestBiome>()
7373
.AddSingleton<DesertRestrictedZonePalmsBiome>()
7474
.AddSingleton<DesertRestrictedZonePlainsBiome>()
75+
.AddSingleton<DesertWastelandPlainsBiome>()
7576
.AddSingleton<ElmForestBiome>()
7677
.AddSingleton<FarmlandBiome>()
7778
.AddSingleton<FogbeltElmForestBiome>()
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
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(255, "Desert Wasteland Plains", BiomeType.DesertWastelands)]
16+
public class DesertWastelandPlainsBiome : IBiome
17+
{
18+
private readonly IBiomeObjectFactory _factory;
19+
private readonly WeightedRandom<string> _weightedRandom;
20+
private readonly Color _biomeOutputColor;
21+
22+
public DesertWastelandPlainsBiome(IBiomeObjectFactory factory)
23+
{
24+
_factory = factory;
25+
_weightedRandom = new WeightedRandom<string>(new Dictionary<string, int>
26+
{
27+
{ "DesertDryBush", 55 },
28+
{ "SmallRock", 15 },
29+
{ "Nothing", 930 }
30+
});
31+
_biomeOutputColor = GetBiomeOutputColor();
32+
}
33+
34+
public ConcurrentBag<BiomeObject> Generate(Vector2 virtualPosition, Vector3 gamePosition, Vector3 gameRotation, Vector3 defaultRotation, Vector3 maxAngleRotation)
35+
{
36+
string selectedType = _weightedRandom.GetRandomItem();
37+
var assets = new ConcurrentBag<BiomeObject>();
38+
39+
if (selectedType != "Nothing")
40+
{
41+
BiomeObject element = _factory.Generate(selectedType, virtualPosition, gamePosition, gameRotation, defaultRotation, maxAngleRotation, _biomeOutputColor);
42+
assets.Add(element);
43+
}
44+
45+
return assets;
46+
}
47+
48+
public Color GetBiomeOutputColor() => new Color(158, 151, 137);
49+
}
50+
}

0 commit comments

Comments
 (0)