Refactor stations to properly use entity prototypes. (stationsv3) (#16570)
* Update StationSpawningSystem.cs Web-edit to allow feeding in an existing entity. * Update StationSpawningSystem.cs value type moment * Update StationSpawningSystem.cs * Oh goddamnit this is a refactor now. * awawawa * aaaaaaaaaaa * ee * forgot records. * no records? no records. * What's in a name? * Sloth forcing me to do the refactor properly smh. * e * optional evac in test. * tests pls work * awa --------- Co-authored-by: moonheart08 <moonheart08@users.noreply.github.com>
This commit is contained in:
@@ -153,7 +153,7 @@ public sealed class FactionSystem : EntitySystem
|
||||
}
|
||||
}
|
||||
|
||||
public bool IsFriendly(EntityUid uidA, EntityUid uidB, FactionComponent? factionA = null, FactionComponent? factionB = null)
|
||||
public bool IsEntityFriendly(EntityUid uidA, EntityUid uidB, FactionComponent? factionA = null, FactionComponent? factionB = null)
|
||||
{
|
||||
if (!Resolve(uidA, ref factionA, false) || !Resolve(uidB, ref factionB, false))
|
||||
return false;
|
||||
@@ -161,6 +161,39 @@ public sealed class FactionSystem : EntitySystem
|
||||
return factionA.Factions.Overlaps(factionB.Factions) || factionA.FriendlyFactions.Overlaps(factionB.Factions);
|
||||
}
|
||||
|
||||
public bool IsFactionFriendly(string target, string with)
|
||||
{
|
||||
return _factions[target].Friendly.Contains(with) && _factions[with].Friendly.Contains(target);
|
||||
}
|
||||
|
||||
public bool IsFactionFriendly(string target, EntityUid with, FactionComponent? factionWith = null)
|
||||
{
|
||||
if (!Resolve(with, ref factionWith, false))
|
||||
return false;
|
||||
|
||||
return factionWith.Factions.All(x => IsFactionFriendly(target, x)) ||
|
||||
factionWith.FriendlyFactions.Contains(target);
|
||||
}
|
||||
|
||||
public bool IsFactionHostile(string target, string with)
|
||||
{
|
||||
return _factions[target].Hostile.Contains(with) && _factions[with].Hostile.Contains(target);
|
||||
}
|
||||
|
||||
public bool IsFactionHostile(string target, EntityUid with, FactionComponent? factionWith = null)
|
||||
{
|
||||
if (!Resolve(with, ref factionWith, false))
|
||||
return false;
|
||||
|
||||
return factionWith.Factions.All(x => IsFactionHostile(target, x)) ||
|
||||
factionWith.HostileFactions.Contains(target);
|
||||
}
|
||||
|
||||
public bool IsFactionNeutral(string target, string with)
|
||||
{
|
||||
return !IsFactionFriendly(target, with) && !IsFactionHostile(target, with);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Makes the source faction friendly to the target faction, 1-way.
|
||||
/// </summary>
|
||||
|
||||
@@ -470,7 +470,7 @@ public sealed partial class NPCSteeringSystem
|
||||
(mask & otherBody.CollisionLayer) == 0x0 &&
|
||||
(layer & otherBody.CollisionMask) == 0x0 ||
|
||||
!factionQuery.TryGetComponent(ent, out var otherFaction) ||
|
||||
!_faction.IsFriendly(uid, ent, ourFaction, otherFaction) ||
|
||||
!_faction.IsEntityFriendly(uid, ent, ourFaction, otherFaction) ||
|
||||
// Use <= 0 so we ignore stationary friends in case.
|
||||
Vector2.Dot(otherBody.LinearVelocity, ourVelocity) <= 0f)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user