Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make Concrete under buildings indestructible. #15944

Merged
merged 1 commit into from Dec 24, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 4 additions & 1 deletion OpenRA.Mods.D2k/Traits/World/BuildableTerrainLayer.cs
Expand Up @@ -11,6 +11,7 @@

using System.Collections.Generic;
using OpenRA.Graphics;
using OpenRA.Mods.Common.Traits;
using OpenRA.Traits;

namespace OpenRA.Mods.D2k.Traits
Expand All @@ -34,6 +35,7 @@ public class BuildableTerrainLayer : IRenderOverlay, IWorldLoaded, ITickRender,
readonly Map map;
readonly CellLayer<int> strength;

BuildingInfluence bi;
TerrainSpriteLayer render;
Theater theater;
bool disposed;
Expand All @@ -48,6 +50,7 @@ public BuildableTerrainLayer(Actor self, BuildableTerrainLayerInfo info)
public void WorldLoaded(World w, WorldRenderer wr)
{
theater = wr.Theater;
bi = w.WorldActor.Trait<BuildingInfluence>();
render = new TerrainSpriteLayer(w, wr, theater.Sheet, BlendMode.Alpha, wr.Palette(info.Palette), wr.World.Type != WorldType.Editor);
}

Expand All @@ -66,7 +69,7 @@ public void AddTile(CPos cell, TerrainTile tile)

public void HitTile(CPos cell, int damage)
{
if (!strength.Contains(cell) || strength[cell] == 0)
if (!strength.Contains(cell) || strength[cell] == 0 || bi.GetBuildingAt(cell) != null)
return;

strength[cell] = strength[cell] - damage;
Expand Down