eradicate dumb UserSettings stuff that causes desyncs

This commit is contained in:
Chris Forbes
2010-03-16 20:14:57 +13:00
parent 7114f4b4ba
commit 2dde4eff07
4 changed files with 14 additions and 22 deletions

View File

@@ -24,20 +24,25 @@ namespace OpenRA.Traits
public void OnClick() { Game.controller.ToggleInputMode<SellOrderGenerator>(); }
}
class RepairButtonInfo : StatelessTraitInfo<RepairButton> { }
class RepairButtonInfo : ITraitInfo
{
public readonly bool RequiresConstructionYard = true;
public object Create(Actor self) { return new RepairButton(this); }
}
class RepairButton : IChromeButton
{
public string Image { get { return "repair"; } } // todo: art
RepairButtonInfo info;
public RepairButton( RepairButtonInfo info ) { this.info = info; }
public string Image { get { return "repair"; } }
public bool Enabled
{
get
{
if (!Game.Settings.RepairRequiresConyard)
return true;
return Game.world.Queries.OwnedBy[Game.world.LocalPlayer]
.WithTrait<ConstructionYard>().Any();
return !info.RequiresConstructionYard ||
Game.world.Queries.OwnedBy[Game.world.LocalPlayer]
.WithTrait<ConstructionYard>().Any();
}
}