mirror of
https://github.com/space-syndicate/space-station-14.git
synced 2026-10-09 10:21:18 +03:00
* Remove Shared System IPrototypeManager instances * Remove RecipeManager IPrototypeManager instance * Fix ItemSystem IPrototypeManager refs, use TryComp * SharedItemSystem changes, EntWhitelist CompName * HasComponent->HasComp
37 lines
1.3 KiB
C#
37 lines
1.3 KiB
C#
using System.Linq;
|
|
using Content.Shared.Construction.Components;
|
|
using Robust.Shared.Map;
|
|
using static Content.Shared.Interaction.SharedInteractionSystem;
|
|
|
|
namespace Content.Shared.Construction
|
|
{
|
|
public abstract partial class SharedConstructionSystem : EntitySystem
|
|
{
|
|
[Dependency] private IMapManager _mapManager = default!;
|
|
[Dependency] private SharedMapSystem _map = default!;
|
|
[Dependency] protected SharedTransformSystem TransformSystem = default!;
|
|
|
|
/// <summary>
|
|
/// Get predicate for construction obstruction checks.
|
|
/// </summary>
|
|
public Ignored? GetPredicate(bool canBuildInImpassable, MapCoordinates coords)
|
|
{
|
|
if (!canBuildInImpassable)
|
|
return null;
|
|
|
|
if (!_mapManager.TryFindGridAt(coords, out var gridUid, out var grid))
|
|
return null;
|
|
|
|
var ignored = _map.GetAnchoredEntities((gridUid, grid), coords).ToHashSet();
|
|
return e => ignored.Contains(e);
|
|
}
|
|
|
|
public string GetExamineName(GenericPartInfo info)
|
|
{
|
|
if (info.ExamineName is not null)
|
|
return Loc.GetString(info.ExamineName.Value);
|
|
|
|
return ProtoMan.Index(info.DefaultPrototype).Name;
|
|
}
|
|
}
|
|
}
|