Fix Harvester crash when multiple resource renderers are used.
This commit is contained in:
@@ -380,10 +380,12 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
if (!self.Owner.Shroud.IsExplored(location))
|
if (!self.Owner.Shroud.IsExplored(location))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
var res = self.World.WorldActor.Trait<ResourceRenderer>().GetRenderedResourceType(location);
|
|
||||||
var info = self.Info.TraitInfo<HarvesterInfo>();
|
var info = self.Info.TraitInfo<HarvesterInfo>();
|
||||||
|
var res = self.World.WorldActor.TraitsImplementing<ResourceRenderer>()
|
||||||
|
.Select(r => r.GetRenderedResourceType(location))
|
||||||
|
.FirstOrDefault(r => r != null && info.Resources.Contains(r.Info.Type));
|
||||||
|
|
||||||
if (res == null || !info.Resources.Contains(res.Info.Type))
|
if (res == null)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
cursor = "harvest";
|
cursor = "harvest";
|
||||||
|
|||||||
Reference in New Issue
Block a user