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