Replace ResourceLayer references with IResourceLayer in traits/warheads.
This commit is contained in:
@@ -61,8 +61,8 @@ namespace OpenRA.Mods.D2k.Traits
|
||||
public class SpiceBloom : ITick, INotifyKilled
|
||||
{
|
||||
readonly SpiceBloomInfo info;
|
||||
readonly ResourceType resType;
|
||||
readonly ResourceLayer resLayer;
|
||||
readonly ResourceType resourceType;
|
||||
readonly IResourceLayer resourceLayer;
|
||||
readonly Animation body;
|
||||
readonly Animation spurt;
|
||||
readonly int growTicks;
|
||||
@@ -75,8 +75,8 @@ namespace OpenRA.Mods.D2k.Traits
|
||||
{
|
||||
this.info = info;
|
||||
|
||||
resLayer = self.World.WorldActor.Trait<ResourceLayer>();
|
||||
resType = self.World.WorldActor.TraitsImplementing<ResourceType>().First(t => t.Info.Type == info.ResourceType);
|
||||
resourceLayer = self.World.WorldActor.Trait<IResourceLayer>();
|
||||
resourceType = self.World.WorldActor.TraitsImplementing<ResourceType>().First(t => t.Info.Type == info.ResourceType);
|
||||
|
||||
var rs = self.Trait<RenderSprites>();
|
||||
body = new Animation(self.World, rs.GetImage(self));
|
||||
@@ -126,7 +126,11 @@ namespace OpenRA.Mods.D2k.Traits
|
||||
|
||||
for (var i = 0; i < pieces; i++)
|
||||
{
|
||||
var cell = cells.SkipWhile(p => resLayer.GetResourceType(p) == resType && resLayer.IsFull(p)).Cast<CPos?>().RandomOrDefault(self.World.SharedRandom);
|
||||
var cell = cells
|
||||
.SkipWhile(p => resourceLayer.GetResource(p).Type == resourceType && !resourceLayer.CanAddResource(resourceType, p))
|
||||
.Cast<CPos?>()
|
||||
.RandomOrDefault(self.World.SharedRandom);
|
||||
|
||||
if (cell == null)
|
||||
cell = cells.Random(self.World.SharedRandom);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user