Fix building repair; Kill GlobalDefaults.
This commit is contained in:
@@ -23,7 +23,7 @@ namespace OpenRA.Effects
|
||||
public RepairIndicator(Actor a)
|
||||
{
|
||||
this.a = a; anim.PlayRepeating("repair");
|
||||
framesLeft = (int)(a.World.Defaults.RepairRate * 25 * 60 / 2);
|
||||
framesLeft = (int)(a.Info.Traits.Get<RepairableBuildingInfo>().RepairRate * 25 * 60 / 2);
|
||||
}
|
||||
|
||||
public void Tick( World world )
|
||||
|
||||
@@ -199,7 +199,6 @@
|
||||
<Compile Include="Widgets\BackgroundWidget.cs" />
|
||||
<Compile Include="Widgets\LabelWidget.cs" />
|
||||
<Compile Include="Widgets\CheckboxWidget.cs" />
|
||||
<Compile Include="Traits\World\GlobalDefaults.cs" />
|
||||
<Compile Include="Traits\World\BibLayer.cs" />
|
||||
<Compile Include="Traits\World\SmudgeLayer.cs" />
|
||||
<Compile Include="Widgets\Delegates\IngameChromeDelegate.cs" />
|
||||
|
||||
@@ -89,8 +89,6 @@ namespace OpenRA
|
||||
|
||||
public void GiveAdvice(string advice)
|
||||
{
|
||||
// todo: store the condition or something.
|
||||
// repeat after World.Defaults.SpeakDelay, as long as the condition holds.
|
||||
Sound.PlayToPlayer(this, advice);
|
||||
}
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@ namespace OpenRA.Traits.Activities
|
||||
var cost = csv != null ? csv.Value : self.Info.Traits.Get<ValuedInfo>().Cost;
|
||||
|
||||
var health = self.traits.GetOrDefault<Health>();
|
||||
var refundFraction = self.World.Defaults.RefundPercent * (health == null ? 1f : health.HPFraction);
|
||||
var refundFraction = self.Info.Traits.Get<BuildingInfo>().RefundPercent * (health == null ? 1f : health.HPFraction);
|
||||
|
||||
self.Owner.PlayerActor.traits.Get<PlayerResources>().GiveCash((int)(refundFraction * cost));
|
||||
self.Kill(self);
|
||||
|
||||
@@ -25,11 +25,11 @@ namespace OpenRA.Traits
|
||||
public readonly bool WaterBound = false;
|
||||
public readonly int Adjacent = 2;
|
||||
public readonly bool Capturable = false;
|
||||
public readonly bool Repairable = true;
|
||||
public readonly string Footprint = "x";
|
||||
public readonly int2 Dimensions = new int2(1, 1);
|
||||
public readonly bool Unsellable = false;
|
||||
|
||||
public readonly float RefundPercent = 0.5f;
|
||||
|
||||
public readonly string[] BuildSounds = {"placbldg.aud", "build5.aud"};
|
||||
public readonly string[] SellSounds = {"cashturn.aud"};
|
||||
public readonly string DamagedSound = "kaboom1.aud";
|
||||
|
||||
@@ -1,25 +0,0 @@
|
||||
#region Copyright & License Information
|
||||
/*
|
||||
* Copyright 2007-2010 The OpenRA Developers (see AUTHORS)
|
||||
* This file is part of OpenRA, which is free software. It is made
|
||||
* available to you under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation. For more information,
|
||||
* see LICENSE.
|
||||
*/
|
||||
#endregion
|
||||
|
||||
// THIS STUFF NEEDS TO GO DIE IN A FIRE.
|
||||
|
||||
namespace OpenRA.Traits
|
||||
{
|
||||
public class GlobalDefaultsInfo : TraitInfo<GlobalDefaults>
|
||||
{
|
||||
/* Repair & Refit */
|
||||
public readonly float RefundPercent = 0.5f;
|
||||
public readonly float RepairPercent = 0.2f;
|
||||
public readonly float RepairRate = 0.016f;
|
||||
public readonly int RepairStep = 7;
|
||||
}
|
||||
|
||||
public class GlobalDefaults {}
|
||||
}
|
||||
@@ -53,7 +53,6 @@ namespace OpenRA
|
||||
|
||||
public readonly Map Map;
|
||||
public readonly TileSet TileSet;
|
||||
public GlobalDefaultsInfo Defaults { get {return WorldActor.Info.Traits.Get<GlobalDefaultsInfo>();}}
|
||||
|
||||
public readonly WorldRenderer WorldRenderer;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user