made silos more flexible for d2k mod
This commit is contained in:
committed by
Chris Forbes
parent
bda4bfa4f3
commit
85678de9f0
@@ -14,24 +14,27 @@ namespace OpenRA.Mods.RA.Render
|
||||
{
|
||||
class RenderBuildingSiloInfo : RenderBuildingInfo
|
||||
{
|
||||
public readonly int FillSteps = 49;
|
||||
public override object Create(ActorInitializer init) { return new RenderBuildingSilo(init, this); }
|
||||
}
|
||||
|
||||
class RenderBuildingSilo : RenderBuilding, INotifyBuildComplete, INotifyCapture
|
||||
{
|
||||
PlayerResources playerResources;
|
||||
readonly RenderBuildingSiloInfo Info;
|
||||
|
||||
public RenderBuildingSilo( ActorInitializer init, RenderBuildingInfo info )
|
||||
public RenderBuildingSilo( ActorInitializer init, RenderBuildingSiloInfo info )
|
||||
: base(init, info)
|
||||
{
|
||||
playerResources = init.self.Owner.PlayerActor.Trait<PlayerResources>();
|
||||
Info = info;
|
||||
}
|
||||
|
||||
public void BuildingComplete( Actor self )
|
||||
{
|
||||
anim.PlayFetchIndex("idle",
|
||||
() => playerResources.OreCapacity != 0
|
||||
? (49 * playerResources.Ore) / (10 * playerResources.OreCapacity)
|
||||
? (Info.FillSteps * playerResources.Ore) / (10 * playerResources.OreCapacity)
|
||||
: 0);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user