Call goat protective services (#18812)
* Limit reproductivecomponent in confined areas * Slight bump
This commit is contained in:
@@ -11,6 +11,7 @@ using Content.Shared.Nutrition.Components;
|
|||||||
using Content.Shared.Nutrition.EntitySystems;
|
using Content.Shared.Nutrition.EntitySystems;
|
||||||
using Content.Shared.Storage;
|
using Content.Shared.Storage;
|
||||||
using Robust.Server.GameObjects;
|
using Robust.Server.GameObjects;
|
||||||
|
using Robust.Shared.Collections;
|
||||||
using Robust.Shared.Random;
|
using Robust.Shared.Random;
|
||||||
using Robust.Shared.Timing;
|
using Robust.Shared.Timing;
|
||||||
|
|
||||||
@@ -83,7 +84,12 @@ public sealed class AnimalHusbandrySystem : EntitySystem
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
var xform = Transform(uid);
|
var xform = Transform(uid);
|
||||||
|
|
||||||
var partners = _entityLookup.GetComponentsInRange<ReproductivePartnerComponent>(xform.Coordinates, component.BreedRange);
|
var partners = _entityLookup.GetComponentsInRange<ReproductivePartnerComponent>(xform.Coordinates, component.BreedRange);
|
||||||
|
|
||||||
|
if (partners.Count >= component.Capacity)
|
||||||
|
return false;
|
||||||
|
|
||||||
foreach (var comp in partners)
|
foreach (var comp in partners)
|
||||||
{
|
{
|
||||||
var partner = comp.Owner;
|
var partner = comp.Owner;
|
||||||
|
|||||||
@@ -38,6 +38,12 @@ public sealed class ReproductiveComponent : Component
|
|||||||
[DataField("breedRange"), ViewVariables(VVAccess.ReadWrite)]
|
[DataField("breedRange"), ViewVariables(VVAccess.ReadWrite)]
|
||||||
public float BreedRange = 3f;
|
public float BreedRange = 3f;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// How many other entities with this component are allowed in range before we stop.
|
||||||
|
/// </summary>
|
||||||
|
[DataField("capacity"), ViewVariables(VVAccess.ReadWrite)]
|
||||||
|
public int Capacity = 6;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The chance that, on a given attempt,
|
/// The chance that, on a given attempt,
|
||||||
/// for each valid partner, the entity will breed.
|
/// for each valid partner, the entity will breed.
|
||||||
|
|||||||
Reference in New Issue
Block a user