Nearly There
This commit is contained in:
@@ -13,34 +13,44 @@ namespace OpenRA.Traits
|
||||
{
|
||||
public class DeveloperModeInfo : ITraitInfo
|
||||
{
|
||||
public int InitialCash = 20000;
|
||||
public int BuildSpeed = 1;
|
||||
public int ChargeTime = 1;
|
||||
public int Cash = 20000;
|
||||
public bool FastBuild = false;
|
||||
public bool FastCharge = false;
|
||||
|
||||
public object Create (ActorInitializer init) { return new DeveloperMode(this); }
|
||||
|
||||
}
|
||||
|
||||
public class DeveloperMode : IResolveOrder
|
||||
{
|
||||
DeveloperModeInfo Info;
|
||||
[Sync]
|
||||
public bool FastCharge;
|
||||
public bool FastBuild;
|
||||
|
||||
public DeveloperMode(DeveloperModeInfo info)
|
||||
{
|
||||
Info = info;
|
||||
FastBuild = Info.FastBuild;
|
||||
FastCharge = Info.FastCharge;
|
||||
}
|
||||
|
||||
public void ResolveOrder (Actor self, Order order)
|
||||
{
|
||||
switch(order.OrderString)
|
||||
{
|
||||
case "DevModeGiveCash":
|
||||
self.World.AddFrameEndTask( w =>
|
||||
case "DevModeFastCharge":
|
||||
{
|
||||
self.Owner.PlayerActor.traits.Get<PlayerResources>().GiveCash(Info.InitialCash);
|
||||
});
|
||||
FastCharge ^= true;
|
||||
break;
|
||||
}
|
||||
case "DevModeFastBuild":
|
||||
{
|
||||
FastBuild ^= true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@ namespace OpenRA.Traits
|
||||
public object Create(ActorInitializer init) { return new PlayerResources(init.self); }
|
||||
}
|
||||
|
||||
public class PlayerResources : ITick
|
||||
public class PlayerResources : ITick, IResolveOrder
|
||||
{
|
||||
Player Owner;
|
||||
int AdviceInterval;
|
||||
@@ -187,5 +187,22 @@ namespace OpenRA.Traits
|
||||
TickPower();
|
||||
TickOre(self);
|
||||
}
|
||||
|
||||
public void ResolveOrder (Actor self, Order order)
|
||||
{
|
||||
switch (order.OrderString)
|
||||
{
|
||||
case "DevModeGiveCash":
|
||||
{
|
||||
if (!Game.LobbyInfo.GlobalSettings.AllowCheats) break;
|
||||
self.World.AddFrameEndTask( w =>
|
||||
{
|
||||
var amt = order.Subject.Info.Traits.Get<DeveloperModeInfo>().Cash;
|
||||
GiveCash(amt);
|
||||
});
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -101,6 +101,7 @@ namespace OpenRA.Traits
|
||||
if (unit == null || ! unit.Traits.Contains<BuildableInfo>())
|
||||
return 0;
|
||||
|
||||
if (self.traits.Get<DeveloperMode>().FastBuild) return 0;
|
||||
var ui = unit.Traits.Get<BuildableInfo>();
|
||||
var time = ui.Cost
|
||||
* self.Owner.PlayerActor.Info.Traits.Get<ProductionQueueInfo>().BuildSpeed /* todo: country-specific build speed bonus */
|
||||
|
||||
@@ -69,6 +69,7 @@ namespace OpenRA.Traits
|
||||
|
||||
if (IsAvailable && (!Info.RequiresPower || IsPowered()))
|
||||
{
|
||||
if (self.traits.Get<DeveloperMode>().FastCharge) RemainingTime = 0;
|
||||
if (RemainingTime > 0) --RemainingTime;
|
||||
if (!notifiedCharging)
|
||||
{
|
||||
|
||||
@@ -84,19 +84,21 @@ namespace OpenRA.Widgets.Delegates
|
||||
() => true;
|
||||
devmodeBG.GetWidget<CheckboxWidget>("SETTINGS_GIVE_CASH").OnMouseDown = mi =>
|
||||
{
|
||||
Game.IssueOrder(new Order("DevModeGiveCash", Game.world.LocalPlayer.PlayerActor));
|
||||
return true;
|
||||
};
|
||||
|
||||
devmodeBG.GetWidget<CheckboxWidget>("SETTINGS_BUILD_SPEED").OnMouseDown = mi =>
|
||||
{
|
||||
Game.IssueOrder(new Order("DevModeFastBuild", Game.world.LocalPlayer.PlayerActor));
|
||||
return true;
|
||||
};
|
||||
devmodeBG.GetWidget<CheckboxWidget>("SETTINGS_BUILD_SPEED").Checked =
|
||||
() => true;
|
||||
|
||||
|
||||
devmodeBG.GetWidget<CheckboxWidget>("SETTINGS_CHARGE_TIME").OnMouseDown = mi =>
|
||||
{
|
||||
Game.IssueOrder(new Order("DevModeFastCharge", Game.world.LocalPlayer.PlayerActor));
|
||||
return true;
|
||||
};
|
||||
devmodeBG.GetWidget<CheckboxWidget>("SETTINGS_CHARGE_TIME").Checked =
|
||||
|
||||
Reference in New Issue
Block a user