Merge remote-tracking branch 'upstream/master' into ups

This commit is contained in:
Jabak
2024-07-24 19:13:19 +03:00
88 changed files with 2043 additions and 422 deletions

View File

@@ -227,9 +227,17 @@ public abstract partial class SharedHandsSystem
return true;
}
public bool IsHolding(EntityUid uid, EntityUid? entity, [NotNullWhen(true)] out Hand? inHand, HandsComponent? handsComp = null)
public bool IsHolding(Entity<HandsComponent?> entity, [NotNullWhen(true)] EntityUid? item)
{
return IsHolding(entity, item, out _, entity);
}
public bool IsHolding(EntityUid uid, [NotNullWhen(true)] EntityUid? entity, [NotNullWhen(true)] out Hand? inHand, HandsComponent? handsComp = null)
{
inHand = null;
if (entity == null)
return false;
if (!Resolve(uid, ref handsComp, false))
return false;
@@ -241,7 +249,6 @@ public abstract partial class SharedHandsSystem
return true;
}
}
return false;
}

View File

@@ -227,16 +227,31 @@ namespace Content.Shared.Preferences
}
// TODO: This should eventually not be a visual change only.
public static HumanoidCharacterProfile Random(HashSet<string>? ignoredSpecies = null)
public static HumanoidCharacterProfile Random(HashSet<string>? ignoredSpecies = null, bool includeSponsor = false)
{
var prototypeManager = IoCManager.Resolve<IPrototypeManager>();
var random = IoCManager.Resolve<IRobustRandom>();
// WD edit - fix free sponsor species
var speciesToIgnore = ignoredSpecies != null
? new HashSet<string>(ignoredSpecies)
: new HashSet<string>();
if (!includeSponsor)
{
var sponsorSpecies = prototypeManager.EnumeratePrototypes<SpeciesPrototype>()
.Where(x => x.SponsorOnly)
.Select(x => x.ID);
speciesToIgnore.UnionWith(sponsorSpecies);
}
var species = random.Pick(prototypeManager
.EnumeratePrototypes<SpeciesPrototype>()
.Where(x => ignoredSpecies == null ? x.RoundStart : x.RoundStart && !ignoredSpecies.Contains(x.ID))
.Where(x => !x.SponsorOnly && x.RoundStart && !speciesToIgnore.Contains(x.ID))
.ToArray()
).ID;
// WD edit end
return RandomWithSpecies(species);
}