add spawner probability
This commit is contained in:
@@ -13,6 +13,9 @@ public sealed partial class CP14RoomSpawnerComponent : Component
|
||||
[DataField(required: true)]
|
||||
public List<ProtoId<TagPrototype>> RoomsTag;
|
||||
|
||||
[DataField]
|
||||
public float Prob = 1f;
|
||||
|
||||
[DataField]
|
||||
public bool Rotation = true;
|
||||
|
||||
|
||||
@@ -29,6 +29,9 @@ public sealed class CP14RoomSpawnerSystem : EntitySystem
|
||||
|
||||
private void SpawnRoom(Entity<CP14RoomSpawnerComponent> spawner)
|
||||
{
|
||||
if (!_random.Prob(spawner.Comp.Prob))
|
||||
return;
|
||||
|
||||
var rooms = new HashSet<DungeonRoomPrototype>();
|
||||
|
||||
foreach (var roomProto in _proto.EnumeratePrototypes<DungeonRoomPrototype>())
|
||||
|
||||
Reference in New Issue
Block a user