[Fix]Roof (#1147)
* roof * why you dont work... * fix and locale * weh check * Update no-roof-in-tile.ftl * Update no-roof-in-tile.ftl * Update roofs.yml --------- Co-authored-by: Ed <96445749+TheShuEd@users.noreply.github.com> Co-authored-by: Ed <edwardxperia2000@gmail.com>
This commit is contained in:
47
Content.Shared/_CP14/Roof/CP14NoRoofInTile.cs
Normal file
47
Content.Shared/_CP14/Roof/CP14NoRoofInTile.cs
Normal file
@@ -0,0 +1,47 @@
|
||||
using Content.Shared.Construction;
|
||||
using Content.Shared.Construction.Conditions;
|
||||
using JetBrains.Annotations;
|
||||
using Robust.Shared.Map;
|
||||
using Robust.Shared.Map.Components;
|
||||
|
||||
namespace Content.Shared._CP14.Roof;
|
||||
|
||||
[UsedImplicitly]
|
||||
[DataDefinition]
|
||||
public sealed partial class CP14NoRoofInTile : IConstructionCondition
|
||||
{
|
||||
public ConstructionGuideEntry GenerateGuideEntry()
|
||||
{
|
||||
return new ConstructionGuideEntry
|
||||
{
|
||||
Localization = "cp14-construction-step-condition-no-roof-in-tile",
|
||||
};
|
||||
}
|
||||
|
||||
public bool Condition(EntityUid user, EntityCoordinates location, Direction direction)
|
||||
{
|
||||
var entityManager = IoCManager.Resolve<IEntityManager>();
|
||||
var mapSystem = entityManager.System<SharedMapSystem>();
|
||||
var transformSystem = entityManager.System<SharedTransformSystem>();
|
||||
|
||||
var grid = transformSystem.GetGrid(user);
|
||||
|
||||
if (grid == null || !entityManager.TryGetComponent<MapGridComponent>(grid, out var gridComp))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
var targetPos = transformSystem.ToMapCoordinates(location);
|
||||
var anchored = mapSystem.GetAnchoredEntities(grid.Value, gridComp, targetPos);
|
||||
|
||||
foreach (var entt in anchored)
|
||||
{
|
||||
if (entityManager.HasComponent<CP14RoofComponent>(entt))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
cp14-construction-step-condition-no-roof-in-tile = There shouldn't be a roof.
|
||||
@@ -0,0 +1 @@
|
||||
cp14-construction-step-condition-no-roof-in-tile = Здесь не должно быть крыши.
|
||||
@@ -45,7 +45,7 @@
|
||||
- to: start
|
||||
completed:
|
||||
- !type:SpawnPrototype
|
||||
prototype: CP14Stone1
|
||||
prototype: CP14StoneBlock1
|
||||
amount: 1
|
||||
- !type:DeleteEntity {}
|
||||
steps:
|
||||
|
||||
@@ -13,6 +13,8 @@
|
||||
objectType: Structure
|
||||
placementMode: SnapgridCenter
|
||||
canBuildInImpassable: true
|
||||
conditions:
|
||||
- !type:CP14NoRoofInTile
|
||||
|
||||
- type: construction
|
||||
crystallPunkAllowed: true
|
||||
@@ -28,4 +30,6 @@
|
||||
state: full
|
||||
objectType: Structure
|
||||
placementMode: SnapgridCenter
|
||||
canBuildInImpassable: true
|
||||
canBuildInImpassable: true
|
||||
conditions:
|
||||
- !type:CP14NoRoofInTile
|
||||
Reference in New Issue
Block a user