* 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:
ArZarLordOfMango
2025-04-26 14:23:11 +02:00
committed by GitHub
parent 7941be4490
commit 07132cdbd8
5 changed files with 55 additions and 2 deletions

View 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;
}
}

View File

@@ -0,0 +1 @@
cp14-construction-step-condition-no-roof-in-tile = There shouldn't be a roof.

View File

@@ -0,0 +1 @@
cp14-construction-step-condition-no-roof-in-tile = Здесь не должно быть крыши.

View File

@@ -45,7 +45,7 @@
- to: start
completed:
- !type:SpawnPrototype
prototype: CP14Stone1
prototype: CP14StoneBlock1
amount: 1
- !type:DeleteEntity {}
steps:

View File

@@ -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