Selectively power-up/down buildings via chrome

This commit is contained in:
Paul Chote
2010-01-04 21:04:57 +13:00
parent 3b0fd0e22c
commit 88c3e21ed0
10 changed files with 115 additions and 13 deletions

View File

@@ -1,5 +1,6 @@
using System;
using System.Linq;
using System.Collections.Generic;
using OpenRa.Game.GameRules;
using OpenRa.Game.Graphics;
using OpenRa.Game.Traits;
@@ -52,11 +53,11 @@ namespace OpenRa.Game
foreach (var a in myBuildings)
{
var bi = a.Info as BuildingInfo;
if (bi.Power > 0) /* todo: is this how real-ra scales it? */
PowerProvided += (a.Health * bi.Power) / bi.Strength;
var p = a.traits.Get<Building>().GetPowerUsage();
if (p > 0)
PowerProvided += p;
else
PowerDrained -= bi.Power;
PowerDrained -= p;
}
if (PowerProvided - PowerDrained < 0)