aaaaaaaaaaaaaaaaaaaaaaaaaaaaa (#743)

This commit is contained in:
haiwwkes
2024-10-22 23:19:41 +05:00
committed by GitHub
parent dd1f10b576
commit 350ce8e297

View File

@@ -400,14 +400,30 @@ public class RCDSystem : EntitySystem
} }
// Entity specific rules // Entity specific rules
if (component.CachedPrototype.Mode == RcdMode.ConstructObject)
// Check rule: The tile is unoccupied {
var isWindow = component.CachedPrototype.ConstructionRules.Contains(RcdConstructionRule.IsWindow); // Check for existing identical entities in the same tile
var isCatwalk = component.CachedPrototype.ConstructionRules.Contains(RcdConstructionRule.IsCatwalk);
_intersectingEntities.Clear(); _intersectingEntities.Clear();
_lookup.GetLocalEntitiesIntersecting(mapGridData.GridUid, mapGridData.Position, _intersectingEntities, -0.05f, LookupFlags.Uncontained); _lookup.GetLocalEntitiesIntersecting(mapGridData.GridUid, mapGridData.Position, _intersectingEntities, -0.05f, LookupFlags.Uncontained);
if (component.CachedPrototype.Prototype != null)
{
foreach (var entity in _intersectingEntities)
{
// Check if the entity has the same prototype ID
if (MetaData(entity).EntityPrototype?.ID == component.CachedPrototype.Prototype)
{
if (popMsgs)
_popup.PopupClient("An identical object already exists in this location.", uid, user);
return false;
}
}
}
var isWindow = component.CachedPrototype.ConstructionRules.Contains(RcdConstructionRule.IsWindow);
var isCatwalk = component.CachedPrototype.ConstructionRules.Contains(RcdConstructionRule.IsCatwalk);
foreach (var ent in _intersectingEntities) foreach (var ent in _intersectingEntities)
{ {
if (isWindow && HasComp<SharedCanBuildWindowOnTopComponent>(ent)) if (isWindow && HasComp<SharedCanBuildWindowOnTopComponent>(ent))
@@ -442,6 +458,7 @@ public class RCDSystem : EntitySystem
} }
} }
} }
}
return true; return true;
} }