Merge pull request #5874 from pchote/revert-desyncs
Revert TickRender and PauseState changes
This commit is contained in:
@@ -69,12 +69,6 @@ namespace OpenRA.Graphics
|
||||
return Render(pos, WVec.Zero, 0, palette, 1f);
|
||||
}
|
||||
|
||||
public void Initialize(string sequenceName)
|
||||
{
|
||||
CurrentSequence = sequenceProvider.GetSequence(name, sequenceName);
|
||||
tickAlways = true;
|
||||
}
|
||||
|
||||
public void Play(string sequenceName)
|
||||
{
|
||||
PlayThen(sequenceName, null);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#region Copyright & License Information
|
||||
/*
|
||||
* Copyright 2007-2014 The OpenRA Developers (see AUTHORS)
|
||||
* Copyright 2007-2011 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,
|
||||
@@ -102,15 +102,15 @@ namespace OpenRA.Network
|
||||
var client = orderManager.LobbyInfo.ClientWithIndex(clientId);
|
||||
if (client != null)
|
||||
{
|
||||
var pauseState = order.TargetString == "Pause" ? World.PauseState.Paused : World.PauseState.Active;
|
||||
if (orderManager.world.Paused != pauseState && !world.LobbyInfo.IsSinglePlayer)
|
||||
var pause = order.TargetString == "Pause";
|
||||
if (orderManager.world.Paused != pause && !world.LobbyInfo.IsSinglePlayer)
|
||||
{
|
||||
var pausetext = "The game is {0} by {1}.".F(pauseState == World.PauseState.Paused ? "paused" : "un-paused", client.Name);
|
||||
var pausetext = "The game is {0} by {1}".F(pause ? "paused" : "un-paused", client.Name);
|
||||
Game.AddChatLine(Color.White, "", pausetext);
|
||||
}
|
||||
|
||||
orderManager.world.Paused = pauseState;
|
||||
orderManager.world.PredictedPaused = pauseState;
|
||||
orderManager.world.Paused = pause;
|
||||
orderManager.world.PredictedPaused = pause;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -18,7 +18,7 @@ namespace OpenRA.Traits
|
||||
public class DebugPauseState : ISync
|
||||
{
|
||||
World world;
|
||||
[Sync] public bool Paused { get { return world.Paused == World.PauseState.Paused; } }
|
||||
[Sync] public bool Paused { get { return world.Paused; } }
|
||||
public DebugPauseState(World world) { this.world = world; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -41,7 +41,7 @@ namespace OpenRA.Traits
|
||||
public RenderSimple(Actor self)
|
||||
: this(self, MakeFacingFunc(self))
|
||||
{
|
||||
DefaultAnimation.PlayRepeating("idle");
|
||||
DefaultAnimation.PlayRepeating(NormalizeSequence(self, "idle"));
|
||||
self.Trait<IBodyOrientation>().SetAutodetectedFacings(DefaultAnimation.CurrentSequence.Facings);
|
||||
}
|
||||
|
||||
|
||||
7
OpenRA.Game/Traits/Render/RenderSprites.cs
Normal file → Executable file
7
OpenRA.Game/Traits/Render/RenderSprites.cs
Normal file → Executable file
@@ -31,7 +31,7 @@ namespace OpenRA.Traits
|
||||
public virtual object Create(ActorInitializer init) { return new RenderSprites(init.self); }
|
||||
}
|
||||
|
||||
public class RenderSprites : IRender, ITickRender, INotifyOwnerChanged, INotifyEffectiveOwnerChanged
|
||||
public class RenderSprites : IRender, ITick, INotifyOwnerChanged, INotifyEffectiveOwnerChanged
|
||||
{
|
||||
class AnimationWrapper
|
||||
{
|
||||
@@ -126,11 +126,8 @@ namespace OpenRA.Traits
|
||||
}
|
||||
}
|
||||
|
||||
public virtual void TickRender(WorldRenderer wr, Actor self)
|
||||
public virtual void Tick(Actor self)
|
||||
{
|
||||
if (wr.world.Paused == World.PauseState.Paused)
|
||||
return;
|
||||
|
||||
foreach (var a in anims.Values)
|
||||
a.Animation.Animation.Tick();
|
||||
}
|
||||
|
||||
@@ -199,7 +199,7 @@ namespace OpenRA.Widgets
|
||||
var key = Hotkey.FromKeyInput(e);
|
||||
|
||||
if (key == Game.Settings.Keys.PauseKey && World.LocalPlayer != null) // Disable pausing for spectators
|
||||
World.SetPauseState(World.Paused != World.PauseState.Paused);
|
||||
World.SetPauseState(!World.Paused);
|
||||
else if (key == Game.Settings.Keys.SelectAllUnitsKey)
|
||||
{
|
||||
var ownUnitsOnScreen = SelectActorsInBox(World, worldRenderer.Viewport.TopLeft, worldRenderer.Viewport.BottomRight,
|
||||
|
||||
@@ -203,9 +203,8 @@ namespace OpenRA
|
||||
public event Action<Actor> ActorAdded = _ => { };
|
||||
public event Action<Actor> ActorRemoved = _ => { };
|
||||
|
||||
public enum PauseState { Active, Paused, Editor }
|
||||
public PauseState Paused { get; internal set; }
|
||||
public PauseState PredictedPaused { get; internal set; }
|
||||
public bool Paused { get; internal set; }
|
||||
public bool PredictedPaused { get; internal set; }
|
||||
public bool PauseStateLocked { get; set; }
|
||||
public bool IsShellmap = false;
|
||||
public int WorldTick { get; private set; }
|
||||
@@ -216,17 +215,17 @@ namespace OpenRA
|
||||
return;
|
||||
|
||||
IssueOrder(Order.PauseGame(paused));
|
||||
PredictedPaused = paused ? PauseState.Paused : PauseState.Active;
|
||||
PredictedPaused = paused;
|
||||
}
|
||||
|
||||
public void SetLocalPauseState(bool paused)
|
||||
{
|
||||
Paused = PredictedPaused = paused ? PauseState.Paused : PauseState.Active;
|
||||
Paused = PredictedPaused = paused;
|
||||
}
|
||||
|
||||
public void Tick()
|
||||
{
|
||||
if (Paused != PauseState.Paused && (!IsShellmap || Game.Settings.Game.ShowShellmap))
|
||||
if (!Paused && (!IsShellmap || Game.Settings.Game.ShowShellmap))
|
||||
{
|
||||
WorldTick++;
|
||||
|
||||
|
||||
@@ -41,7 +41,7 @@ namespace OpenRA.Mods.Cnc.Widgets.Logic
|
||||
|
||||
public void OptionsClicked()
|
||||
{
|
||||
var cachedPause = world.PredictedPaused == World.PauseState.Paused;
|
||||
var cachedPause = world.PredictedPaused;
|
||||
|
||||
ingameRoot.IsVisible = () => false;
|
||||
if (world.LobbyInfo.IsSinglePlayer)
|
||||
|
||||
@@ -34,16 +34,19 @@ namespace OpenRA.Mods.RA.Render
|
||||
|
||||
public WithCrumbleOverlay(ActorInitializer init, WithCrumbleOverlayInfo info)
|
||||
{
|
||||
if (init.Contains<SkipMakeAnimsInit>())
|
||||
return;
|
||||
|
||||
var key = "make_overlay_{0}".F(info.Sequence);
|
||||
var rs = init.self.Trait<RenderSprites>();
|
||||
|
||||
if (!init.Contains<SkipMakeAnimsInit>())
|
||||
{
|
||||
var overlay = new Animation(init.world, rs.GetImage(init.self));
|
||||
overlay.PlayThen(info.Sequence, () => buildComplete = false);
|
||||
rs.Add("make_overlay_{0}".F(info.Sequence),
|
||||
new AnimationWithOffset(overlay, null, () => !buildComplete),
|
||||
info.Palette, info.IsPlayerPalette);
|
||||
}
|
||||
var overlay = new Animation(init.world, rs.GetImage(init.self));
|
||||
|
||||
// Remove the animation once it is complete
|
||||
overlay.PlayThen(info.Sequence, () => init.world.AddFrameEndTask(w => rs.Remove(key)));
|
||||
|
||||
rs.Add(key, new AnimationWithOffset(overlay, null, () => !buildComplete),
|
||||
info.Palette, info.IsPlayerPalette);
|
||||
}
|
||||
|
||||
public void BuildingComplete(Actor self)
|
||||
|
||||
@@ -40,7 +40,7 @@ namespace OpenRA.Mods.RA
|
||||
public override object Create(ActorInitializer init) { return new AttackGarrisoned(init.self, this); }
|
||||
}
|
||||
|
||||
public class AttackGarrisoned : AttackFollow, INotifyPassengerEntered, INotifyPassengerExited, IRender, ITickRender
|
||||
public class AttackGarrisoned : AttackFollow, INotifyPassengerEntered, INotifyPassengerExited, IRender
|
||||
{
|
||||
public readonly FirePort[] Ports;
|
||||
|
||||
@@ -183,10 +183,9 @@ namespace OpenRA.Mods.RA
|
||||
yield return r;
|
||||
}
|
||||
|
||||
public void TickRender(WorldRenderer wr, Actor self)
|
||||
public override void Tick(Actor self)
|
||||
{
|
||||
if (wr.world.Paused == World.PauseState.Paused)
|
||||
return;
|
||||
base.Tick(self);
|
||||
|
||||
// Take a copy so that Tick() can remove animations
|
||||
foreach (var m in muzzles.ToList())
|
||||
|
||||
@@ -13,6 +13,7 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using OpenRA.Primitives;
|
||||
using OpenRA.Traits;
|
||||
using OpenRA.Mods.RA.Render;
|
||||
|
||||
namespace OpenRA.Mods.RA.Buildings
|
||||
{
|
||||
@@ -100,12 +101,13 @@ namespace OpenRA.Mods.RA.Buildings
|
||||
}
|
||||
}
|
||||
|
||||
public class Building : INotifyDamage, IOccupySpace, INotifyCapture, INotifyBuildComplete, INotifySold, INotifyTransform, ISync, ITechTreePrerequisite, INotifyAddedToWorld, INotifyRemovedFromWorld
|
||||
public class Building : INotifyDamage, IOccupySpace, INotifyCapture, ITick, INotifySold, INotifyTransform, ISync, ITechTreePrerequisite, INotifyAddedToWorld, INotifyRemovedFromWorld
|
||||
{
|
||||
public readonly BuildingInfo Info;
|
||||
public bool BuildComplete { get; private set; }
|
||||
[Sync] readonly CPos topLeft;
|
||||
readonly Actor self;
|
||||
readonly bool skipMakeAnimation;
|
||||
|
||||
PowerManager PlayerPower;
|
||||
|
||||
@@ -139,7 +141,7 @@ namespace OpenRA.Mods.RA.Buildings
|
||||
.Select(c => Pair.New(c, SubCell.FullCell)).ToArray();
|
||||
|
||||
CenterPosition = init.world.Map.CenterOfCell(topLeft) + FootprintUtils.CenterOffset(init.world, Info);
|
||||
BuildComplete = init.Contains<SkipMakeAnimsInit>();
|
||||
skipMakeAnimation = init.Contains<SkipMakeAnimsInit>();
|
||||
}
|
||||
|
||||
public int GetPowerUsage()
|
||||
@@ -180,10 +182,22 @@ namespace OpenRA.Mods.RA.Buildings
|
||||
self.World.ScreenMap.Remove(self);
|
||||
}
|
||||
|
||||
public void BuildingComplete(Actor self)
|
||||
public void Tick(Actor self)
|
||||
{
|
||||
if (!BuildComplete && (skipMakeAnimation || !self.HasTrait<WithMakeAnimation>()))
|
||||
NotifyBuildingComplete(self);
|
||||
}
|
||||
|
||||
public void NotifyBuildingComplete(Actor self)
|
||||
{
|
||||
if (BuildComplete)
|
||||
return;
|
||||
|
||||
BuildComplete = true;
|
||||
Locked = false;
|
||||
|
||||
foreach (var notify in self.TraitsImplementing<INotifyBuildComplete>())
|
||||
notify.BuildingComplete(self);
|
||||
}
|
||||
|
||||
public void Selling(Actor self)
|
||||
@@ -193,6 +207,7 @@ namespace OpenRA.Mods.RA.Buildings
|
||||
|
||||
BuildComplete = false;
|
||||
}
|
||||
|
||||
public void Sold(Actor self) { }
|
||||
|
||||
public void BeforeTransform(Actor self)
|
||||
|
||||
@@ -17,7 +17,7 @@ namespace OpenRA.Mods.RA
|
||||
{
|
||||
class ChronoshiftPaletteEffectInfo : TraitInfo<ChronoshiftPaletteEffect> { }
|
||||
|
||||
public class ChronoshiftPaletteEffect : IPaletteModifier, ITickRender
|
||||
public class ChronoshiftPaletteEffect : IPaletteModifier, ITick
|
||||
{
|
||||
const int chronoEffectLength = 60;
|
||||
int remainingFrames;
|
||||
@@ -27,11 +27,8 @@ namespace OpenRA.Mods.RA
|
||||
remainingFrames = chronoEffectLength;
|
||||
}
|
||||
|
||||
public void TickRender(WorldRenderer wr, Actor self)
|
||||
public void Tick(Actor self)
|
||||
{
|
||||
if (wr.world.Paused == World.PauseState.Paused)
|
||||
return;
|
||||
|
||||
if (remainingFrames > 0)
|
||||
remainingFrames--;
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#region Copyright & License Information
|
||||
/*
|
||||
* Copyright 2007-2014 The OpenRA Developers (see AUTHORS)
|
||||
* Copyright 2007-2011 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,
|
||||
@@ -17,7 +17,7 @@ namespace OpenRA.Mods.RA
|
||||
{
|
||||
public class CloakPaletteEffectInfo : TraitInfo<CloakPaletteEffect> { }
|
||||
|
||||
public class CloakPaletteEffect : IPaletteModifier, ITickRender
|
||||
public class CloakPaletteEffect : IPaletteModifier, ITick
|
||||
{
|
||||
float t = 0;
|
||||
string paletteName = "cloak";
|
||||
@@ -41,11 +41,8 @@ namespace OpenRA.Mods.RA
|
||||
}
|
||||
}
|
||||
|
||||
public void TickRender(WorldRenderer wr, Actor self)
|
||||
public void Tick(Actor self)
|
||||
{
|
||||
if (wr.world.Paused == World.PauseState.Paused)
|
||||
return;
|
||||
|
||||
t += 0.25f;
|
||||
if (t >= 256) t = 0;
|
||||
}
|
||||
|
||||
@@ -37,7 +37,7 @@ namespace OpenRA.Mods.RA
|
||||
{
|
||||
case "pause":
|
||||
world.IssueOrder(new Order("PauseGame", null, false)
|
||||
{ TargetString = world.Paused == World.PauseState.Paused ? "UnPause" : "Pause" });
|
||||
{ TargetString = world.Paused ? "UnPause" : "Pause" });
|
||||
break;
|
||||
case "surrender":
|
||||
world.IssueOrder(new Order("Surrender", world.LocalPlayer.PlayerActor, false));
|
||||
|
||||
0
OpenRA.Mods.RA/Effects/Bullet.cs
Normal file → Executable file
0
OpenRA.Mods.RA/Effects/Bullet.cs
Normal file → Executable file
@@ -25,7 +25,7 @@ namespace OpenRA.Mods.RA.Effects
|
||||
this.b = a.Trait<IronCurtainable>();
|
||||
}
|
||||
|
||||
public void Tick(World world)
|
||||
public void Tick( World world )
|
||||
{
|
||||
if (a.IsDead() || b.GetDamageModifier(null, null) > 0)
|
||||
world.AddFrameEndTask(w => w.Remove(this));
|
||||
|
||||
0
OpenRA.Mods.RA/Effects/Missile.cs
Normal file → Executable file
0
OpenRA.Mods.RA/Effects/Missile.cs
Normal file → Executable file
0
OpenRA.Mods.RA/Effects/NukeLaunch.cs
Normal file → Executable file
0
OpenRA.Mods.RA/Effects/NukeLaunch.cs
Normal file → Executable file
0
OpenRA.Mods.RA/Effects/RepairIndicator.cs
Normal file → Executable file
0
OpenRA.Mods.RA/Effects/RepairIndicator.cs
Normal file → Executable file
@@ -21,7 +21,7 @@ namespace OpenRA.Mods.RA.Effects
|
||||
public readonly string Palette = "effect";
|
||||
public readonly int BrightZaps = 1;
|
||||
public readonly int DimZaps = 2;
|
||||
public IEffect Create(ProjectileArgs args) { return new TeslaZap(this, args); }
|
||||
public IEffect Create(ProjectileArgs args) { return new TeslaZap( this, args ); }
|
||||
}
|
||||
|
||||
class TeslaZap : IEffect
|
||||
|
||||
@@ -23,14 +23,11 @@ namespace OpenRA.Mods.RA
|
||||
public object Create(ActorInitializer init) { return new LightPaletteRotator(this); }
|
||||
}
|
||||
|
||||
class LightPaletteRotator : ITickRender, IPaletteModifier
|
||||
class LightPaletteRotator : ITick, IPaletteModifier
|
||||
{
|
||||
float t = 0;
|
||||
public void TickRender(WorldRenderer wr, Actor self)
|
||||
public void Tick(Actor self)
|
||||
{
|
||||
if (wr.world.Paused == World.PauseState.Paused)
|
||||
return;
|
||||
|
||||
t += .5f;
|
||||
}
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@ namespace OpenRA.Mods.RA
|
||||
{
|
||||
class NukePaletteEffectInfo : TraitInfo<NukePaletteEffect> { }
|
||||
|
||||
public class NukePaletteEffect : IPaletteModifier, ITickRender
|
||||
public class NukePaletteEffect : IPaletteModifier, ITick
|
||||
{
|
||||
const int nukeEffectLength = 20;
|
||||
int remainingFrames;
|
||||
@@ -27,11 +27,8 @@ namespace OpenRA.Mods.RA
|
||||
remainingFrames = nukeEffectLength;
|
||||
}
|
||||
|
||||
public void TickRender(WorldRenderer wr, Actor self)
|
||||
public void Tick(Actor self)
|
||||
{
|
||||
if (wr.world.Paused == World.PauseState.Paused)
|
||||
return;
|
||||
|
||||
if (remainingFrames > 0)
|
||||
remainingFrames--;
|
||||
}
|
||||
|
||||
@@ -54,7 +54,7 @@ namespace OpenRA.Mods.RA.Orders
|
||||
|
||||
IEnumerable<Order> InnerOrder(World world, CPos xy, MouseInput mi)
|
||||
{
|
||||
if (world.Paused == World.PauseState.Paused)
|
||||
if (world.Paused)
|
||||
yield break;
|
||||
|
||||
if (mi.Button == MouseButton.Left)
|
||||
|
||||
@@ -36,8 +36,6 @@ namespace OpenRA.Mods.RA.Render
|
||||
public class RenderBuilding : RenderSimple, INotifyDamageStateChanged, INotifyBuildComplete
|
||||
{
|
||||
RenderBuildingInfo info;
|
||||
bool buildComplete;
|
||||
bool skipMakeAnimation;
|
||||
|
||||
public RenderBuilding(ActorInitializer init, RenderBuildingInfo info)
|
||||
: this(init, info, () => 0) { }
|
||||
@@ -47,29 +45,12 @@ namespace OpenRA.Mods.RA.Render
|
||||
{
|
||||
var self = init.self;
|
||||
this.info = info;
|
||||
skipMakeAnimation = init.Contains<SkipMakeAnimsInit>();
|
||||
|
||||
DefaultAnimation.Initialize(NormalizeSequence(self, "idle"));
|
||||
DefaultAnimation.PlayRepeating(NormalizeSequence(self, "idle"));
|
||||
|
||||
self.Trait<IBodyOrientation>().SetAutodetectedFacings(DefaultAnimation.CurrentSequence.Facings);
|
||||
}
|
||||
|
||||
public override void TickRender(WorldRenderer wr, Actor self)
|
||||
{
|
||||
if (wr.world.Paused == World.PauseState.Paused)
|
||||
return;
|
||||
|
||||
base.TickRender(wr, self);
|
||||
|
||||
if (buildComplete)
|
||||
return;
|
||||
|
||||
buildComplete = true;
|
||||
if (!self.HasTrait<WithMakeAnimation>() || skipMakeAnimation)
|
||||
foreach (var notify in self.TraitsImplementing<INotifyBuildComplete>())
|
||||
notify.BuildingComplete(self);
|
||||
}
|
||||
|
||||
public virtual void BuildingComplete(Actor self)
|
||||
{
|
||||
DefaultAnimation.PlayRepeating(NormalizeSequence(self, "idle"));
|
||||
@@ -108,7 +89,7 @@ namespace OpenRA.Mods.RA.Render
|
||||
public virtual void DamageStateChanged(Actor self, AttackInfo e)
|
||||
{
|
||||
if (DefaultAnimation.CurrentSequence != null)
|
||||
DefaultAnimation.ReplaceAnim(NormalizeSequence(self, "idle"));
|
||||
DefaultAnimation.ReplaceAnim(NormalizeSequence(self, DefaultAnimation.CurrentSequence.Name));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,7 +9,6 @@
|
||||
#endregion
|
||||
|
||||
using System.Linq;
|
||||
using OpenRA.Graphics;
|
||||
using OpenRA.Traits;
|
||||
|
||||
namespace OpenRA.Mods.RA.Render
|
||||
@@ -22,7 +21,7 @@ namespace OpenRA.Mods.RA.Render
|
||||
public override object Create(ActorInitializer init) { return new RenderBuildingWall(init, this); }
|
||||
}
|
||||
|
||||
class RenderBuildingWall : RenderBuilding, INotifyAddedToWorld, INotifyRemovedFromWorld, ITick
|
||||
class RenderBuildingWall : RenderBuilding, INotifyAddedToWorld, INotifyRemovedFromWorld
|
||||
{
|
||||
readonly RenderBuildingWallInfo info;
|
||||
int adjacent = 0;
|
||||
@@ -45,16 +44,10 @@ namespace OpenRA.Mods.RA.Render
|
||||
DefaultAnimation.PlayFetchIndex(NormalizeSequence(DefaultAnimation, e.DamageState, info.Sequence), () => adjacent);
|
||||
}
|
||||
|
||||
public override void TickRender(WorldRenderer wr, Actor self)
|
||||
public override void Tick(Actor self)
|
||||
{
|
||||
if (wr.world.Paused == World.PauseState.Paused)
|
||||
return;
|
||||
base.Tick(self);
|
||||
|
||||
base.TickRender(wr, self);
|
||||
}
|
||||
|
||||
public void Tick(Actor self)
|
||||
{
|
||||
if (!dirty)
|
||||
return;
|
||||
|
||||
|
||||
@@ -36,7 +36,7 @@ namespace OpenRA.Mods.RA.Render
|
||||
}
|
||||
}
|
||||
|
||||
class RenderBuildingWarFactory : RenderBuilding, INotifyBuildComplete, ITickRender, INotifyProduction, INotifySold, ISync
|
||||
class RenderBuildingWarFactory : RenderBuilding, INotifyBuildComplete, ITick, INotifyProduction, INotifySold, ISync
|
||||
{
|
||||
Animation roof;
|
||||
[Sync] bool isOpen;
|
||||
@@ -62,13 +62,9 @@ namespace OpenRA.Mods.RA.Render
|
||||
buildComplete = true;
|
||||
}
|
||||
|
||||
public override void TickRender(WorldRenderer wr, Actor self)
|
||||
public override void Tick(Actor self)
|
||||
{
|
||||
if (wr.world.Paused == World.PauseState.Paused)
|
||||
return;
|
||||
|
||||
base.TickRender(wr, self);
|
||||
|
||||
base.Tick(self);
|
||||
if (isOpen && !self.World.ActorMap.GetUnitsAt(openExit).Any( a => a != self ))
|
||||
{
|
||||
isOpen = false;
|
||||
|
||||
@@ -9,7 +9,6 @@
|
||||
#endregion
|
||||
|
||||
using OpenRA.Traits;
|
||||
using OpenRA.Graphics;
|
||||
|
||||
namespace OpenRA.Mods.RA.Render
|
||||
{
|
||||
@@ -32,11 +31,8 @@ namespace OpenRA.Mods.RA.Render
|
||||
intendedSprite = disguise.AsSprite;
|
||||
}
|
||||
|
||||
public override void TickRender(WorldRenderer wr, Actor self)
|
||||
public override void Tick(Actor self)
|
||||
{
|
||||
if (wr.world.Paused == World.PauseState.Paused)
|
||||
return;
|
||||
|
||||
if (disguise.AsSprite != intendedSprite)
|
||||
{
|
||||
intendedSprite = disguise.AsSprite;
|
||||
@@ -44,7 +40,7 @@ namespace OpenRA.Mods.RA.Render
|
||||
UpdatePalette();
|
||||
}
|
||||
|
||||
base.TickRender(wr, self);
|
||||
base.Tick(self);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -35,18 +35,15 @@ namespace OpenRA.Mods.RA.Render
|
||||
new Animation(self.World, image);
|
||||
}
|
||||
|
||||
public override void TickRender(WorldRenderer wr, Actor self)
|
||||
public override void Tick(Actor self)
|
||||
{
|
||||
if (wr.world.Paused == World.PauseState.Paused)
|
||||
return;
|
||||
|
||||
var desiredState = harv.Fullness * (info.ImagesByFullness.Length - 1) / 100;
|
||||
var desiredImage = info.ImagesByFullness[desiredState];
|
||||
|
||||
if (DefaultAnimation.Name != desiredImage)
|
||||
DefaultAnimation.ChangeImage(desiredImage, "idle");
|
||||
|
||||
base.TickRender(wr, self);
|
||||
base.Tick(self);
|
||||
}
|
||||
|
||||
public void Harvested(Actor self, ResourceType resource)
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#region Copyright & License Information
|
||||
/*
|
||||
* Copyright 2007-2014 The OpenRA Developers (see AUTHORS)
|
||||
* Copyright 2007-2013 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,
|
||||
@@ -8,7 +8,6 @@
|
||||
*/
|
||||
#endregion
|
||||
|
||||
using OpenRA.Graphics;
|
||||
using OpenRA.Mods.RA.Effects;
|
||||
using OpenRA.Traits;
|
||||
|
||||
@@ -80,12 +79,9 @@ namespace OpenRA.Mods.RA.Render
|
||||
Attacking(self, target);
|
||||
}
|
||||
|
||||
public override void TickRender(WorldRenderer wr, Actor self)
|
||||
public override void Tick(Actor self)
|
||||
{
|
||||
if (wr.world.Paused == World.PauseState.Paused)
|
||||
return;
|
||||
|
||||
base.TickRender(wr, self);
|
||||
base.Tick(self);
|
||||
|
||||
if ((State == AnimationState.Moving || dirty) && !move.IsMoving)
|
||||
{
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#region Copyright & License Information
|
||||
/*
|
||||
* Copyright 2007-2014 The OpenRA Developers (see AUTHORS)
|
||||
* Copyright 2007-2011 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,
|
||||
@@ -8,7 +8,6 @@
|
||||
*/
|
||||
#endregion
|
||||
|
||||
using OpenRA.Graphics;
|
||||
using OpenRA.Traits;
|
||||
|
||||
namespace OpenRA.Mods.RA.Render
|
||||
@@ -44,16 +43,13 @@ namespace OpenRA.Mods.RA.Render
|
||||
return base.AllowIdleAnimation(self) && !sc.Panicking;
|
||||
}
|
||||
|
||||
public override void TickRender(WorldRenderer wr, Actor self)
|
||||
public override void Tick (Actor self)
|
||||
{
|
||||
if (wr.world.Paused == World.PauseState.Paused)
|
||||
return;
|
||||
|
||||
if (wasPanic != sc.Panicking)
|
||||
dirty = true;
|
||||
|
||||
wasPanic = sc.Panicking;
|
||||
base.TickRender(wr, self);
|
||||
base.Tick(self);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,7 +9,6 @@
|
||||
#endregion
|
||||
|
||||
using System.Linq;
|
||||
using OpenRA.Graphics;
|
||||
using OpenRA.Traits;
|
||||
|
||||
namespace OpenRA.Mods.RA.Render
|
||||
@@ -42,7 +41,7 @@ namespace OpenRA.Mods.RA.Render
|
||||
|
||||
public bool ShouldBeOpen()
|
||||
{
|
||||
if (self.CenterPosition.Z > 0 || move.IsMoving || cargo.CurrentAdjacentCells == null)
|
||||
if (self.CenterPosition.Z > 0 || move.IsMoving)
|
||||
return false;
|
||||
|
||||
return cargo.CurrentAdjacentCells.Any(c => self.World.Map.Contains(c)
|
||||
@@ -71,17 +70,14 @@ namespace OpenRA.Mods.RA.Render
|
||||
PlayCustomAnimBackwards(self, info.OpenAnim, null);
|
||||
}
|
||||
|
||||
public override void TickRender(WorldRenderer wr, Actor self)
|
||||
public override void Tick(Actor self)
|
||||
{
|
||||
if (wr.world.Paused == World.PauseState.Paused)
|
||||
return;
|
||||
|
||||
if (ShouldBeOpen())
|
||||
Open();
|
||||
else
|
||||
Close();
|
||||
|
||||
base.TickRender(wr, self);
|
||||
base.Tick(self);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,7 +9,6 @@
|
||||
#endregion
|
||||
|
||||
using System.Linq;
|
||||
using OpenRA.Graphics;
|
||||
using OpenRA.Traits;
|
||||
|
||||
namespace OpenRA.Mods.RA.Render
|
||||
@@ -35,16 +34,13 @@ namespace OpenRA.Mods.RA.Render
|
||||
.Single(a => a.Info.Name == info.Armament);
|
||||
}
|
||||
|
||||
public override void TickRender(WorldRenderer wr, Actor self)
|
||||
public override void Tick(Actor self)
|
||||
{
|
||||
if (wr.world.Paused == World.PauseState.Paused)
|
||||
return;
|
||||
|
||||
var sequence = (armament.IsReloading ? "empty-" : "") + (attack.IsAttacking ? "aim" : "idle");
|
||||
if (sequence != DefaultAnimation.CurrentSequence.Name)
|
||||
DefaultAnimation.ReplaceAnim(sequence);
|
||||
|
||||
base.TickRender(wr, self);
|
||||
base.Tick(self);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,7 +28,7 @@ namespace OpenRA.Mods.RA.Render
|
||||
public object Create(ActorInitializer init) { return new WithActiveAnimation(init.self, this); }
|
||||
}
|
||||
|
||||
public class WithActiveAnimation : ITickRender, INotifyBuildComplete, INotifySold
|
||||
public class WithActiveAnimation : ITick, INotifyBuildComplete, INotifySold
|
||||
{
|
||||
readonly IEnumerable<IDisable> disabled;
|
||||
readonly WithActiveAnimationInfo info;
|
||||
@@ -42,11 +42,8 @@ namespace OpenRA.Mods.RA.Render
|
||||
}
|
||||
|
||||
int ticks;
|
||||
public void TickRender(WorldRenderer wr, Actor self)
|
||||
public void Tick(Actor self)
|
||||
{
|
||||
if (wr.world.Paused == World.PauseState.Paused)
|
||||
return;
|
||||
|
||||
if (!buildComplete)
|
||||
return;
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@ using OpenRA.Traits;
|
||||
|
||||
namespace OpenRA.Mods.RA.Render
|
||||
{
|
||||
public class WithMakeAnimationInfo : ITraitInfo, Requires<RenderBuildingInfo>
|
||||
public class WithMakeAnimationInfo : ITraitInfo, Requires<BuildingInfo>, Requires<RenderBuildingInfo>
|
||||
{
|
||||
[Desc("Sequence name to use")]
|
||||
public readonly string Sequence = "make";
|
||||
@@ -26,40 +26,35 @@ namespace OpenRA.Mods.RA.Render
|
||||
public object Create(ActorInitializer init) { return new WithMakeAnimation(init, this); }
|
||||
}
|
||||
|
||||
public class WithMakeAnimation : ITickRender
|
||||
public class WithMakeAnimation
|
||||
{
|
||||
WithMakeAnimationInfo info;
|
||||
RenderBuilding building;
|
||||
bool buildComplete;
|
||||
readonly WithMakeAnimationInfo info;
|
||||
readonly RenderBuilding renderBuilding;
|
||||
|
||||
public WithMakeAnimation(ActorInitializer init, WithMakeAnimationInfo info)
|
||||
{
|
||||
building = init.self.Trait<RenderBuilding>();
|
||||
this.info = info;
|
||||
buildComplete = init.Contains<SkipMakeAnimsInit>();
|
||||
}
|
||||
var self = init.self;
|
||||
renderBuilding = self.Trait<RenderBuilding>();
|
||||
|
||||
public void TickRender(WorldRenderer wr, Actor self)
|
||||
{
|
||||
if (wr.world.Paused == World.PauseState.Paused)
|
||||
return;
|
||||
|
||||
if (self.IsDead() || buildComplete)
|
||||
return;
|
||||
|
||||
buildComplete = true;
|
||||
|
||||
building.PlayCustomAnimThen(self, info.Sequence, () =>
|
||||
var building = self.Trait<Building>();
|
||||
if (!init.Contains<SkipMakeAnimsInit>())
|
||||
{
|
||||
foreach (var notify in self.TraitsImplementing<INotifyBuildComplete>())
|
||||
notify.BuildingComplete(self);
|
||||
});
|
||||
renderBuilding.PlayCustomAnimThen(self, info.Sequence, () =>
|
||||
{
|
||||
building.NotifyBuildingComplete(self);
|
||||
});
|
||||
}
|
||||
else
|
||||
building.NotifyBuildingComplete(self);
|
||||
}
|
||||
|
||||
public void Reverse(Actor self, Activity activity)
|
||||
{
|
||||
building.PlayCustomAnimBackwards(self, info.Sequence, () => {
|
||||
building.PlayCustomAnim(self, info.Sequence); // avoids visual glitches as we wait for the actor to get destroyed
|
||||
renderBuilding.PlayCustomAnimBackwards(self, info.Sequence, () =>
|
||||
{
|
||||
// avoids visual glitches as we wait for the actor to get destroyed
|
||||
renderBuilding.DefaultAnimation.PlayFetchIndex(info.Sequence, () => 0);
|
||||
self.QueueActivity(activity);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -25,7 +25,7 @@ namespace OpenRA.Mods.RA.Render
|
||||
public object Create(ActorInitializer init) { return new WithMuzzleFlash(init.self, this); }
|
||||
}
|
||||
|
||||
class WithMuzzleFlash : INotifyAttack, IRender, ITickRender
|
||||
class WithMuzzleFlash : INotifyAttack, IRender, ITick
|
||||
{
|
||||
Dictionary<Barrel, bool> visible = new Dictionary<Barrel, bool>();
|
||||
Dictionary<Barrel, AnimationWithOffset> anims = new Dictionary<Barrel, AnimationWithOffset>();
|
||||
@@ -95,11 +95,8 @@ namespace OpenRA.Mods.RA.Render
|
||||
}
|
||||
}
|
||||
|
||||
public void TickRender(WorldRenderer wr, Actor self)
|
||||
public void Tick(Actor self)
|
||||
{
|
||||
if (wr.world.Paused == World.PauseState.Paused)
|
||||
return;
|
||||
|
||||
foreach (var a in anims.Values)
|
||||
a.Animation.Tick();
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#region Copyright & License Information
|
||||
/*
|
||||
* Copyright 2007-2014 The OpenRA Developers (see AUTHORS)
|
||||
* Copyright 2007-2011 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,
|
||||
@@ -9,7 +9,6 @@
|
||||
#endregion
|
||||
|
||||
using OpenRA.GameRules;
|
||||
using OpenRA.Graphics;
|
||||
using OpenRA.Mods.RA.Render;
|
||||
using OpenRA.Traits;
|
||||
|
||||
@@ -53,7 +52,6 @@ namespace OpenRA.Mods.RA
|
||||
public override void Tick(Actor self)
|
||||
{
|
||||
base.Tick(self);
|
||||
|
||||
if (IsProne && --remainingProneTime == 0)
|
||||
LocalOffset = WVec.Zero;
|
||||
}
|
||||
@@ -100,17 +98,13 @@ namespace OpenRA.Mods.RA
|
||||
return base.AllowIdleAnimation(self) && !tc.IsProne;
|
||||
}
|
||||
|
||||
public override void TickRender(WorldRenderer wr, Actor self)
|
||||
public override void Tick(Actor self)
|
||||
{
|
||||
if (wr.world.Paused == World.PauseState.Paused)
|
||||
return;
|
||||
|
||||
if (wasProne != tc.IsProne)
|
||||
dirty = true;
|
||||
|
||||
wasProne = tc.IsProne;
|
||||
|
||||
base.TickRender(wr, self);
|
||||
base.Tick(self);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,7 +23,7 @@ namespace OpenRA.Mods.RA
|
||||
public object Create(ActorInitializer init) { return new WaterPaletteRotation(init.world, this); }
|
||||
}
|
||||
|
||||
class WaterPaletteRotation : ITickRender, IPaletteModifier
|
||||
class WaterPaletteRotation : ITick, IPaletteModifier
|
||||
{
|
||||
float t = 0;
|
||||
|
||||
@@ -36,13 +36,7 @@ namespace OpenRA.Mods.RA
|
||||
this.info = info;
|
||||
}
|
||||
|
||||
public void TickRender(WorldRenderer wr, Actor self)
|
||||
{
|
||||
if (wr.world.Paused == World.PauseState.Paused)
|
||||
return;
|
||||
|
||||
t += .25f;
|
||||
}
|
||||
public void Tick(Actor self) { t += .25f; }
|
||||
|
||||
uint[] temp = new uint[7]; /* allocating this on the fly actually hurts our profile */
|
||||
|
||||
|
||||
@@ -27,12 +27,12 @@ namespace OpenRA.Mods.RA.Widgets.Logic
|
||||
{
|
||||
var startTick = Ui.LastTickTime;
|
||||
// Blink the status line
|
||||
status.IsVisible = () => (world.Paused == World.PauseState.Paused || world.Timestep != Game.Timestep)
|
||||
status.IsVisible = () => (world.Paused || world.Timestep != Game.Timestep)
|
||||
&& (Ui.LastTickTime - startTick) / 1000 % 2 == 0;
|
||||
|
||||
status.GetText = () =>
|
||||
{
|
||||
if (world.Paused == World.PauseState.Paused || world.Timestep == 0)
|
||||
if (world.Paused || world.Timestep == 0)
|
||||
return "Paused";
|
||||
|
||||
if (world.Timestep == 1)
|
||||
|
||||
@@ -57,7 +57,7 @@ namespace OpenRA.Mods.RA.Widgets.Logic
|
||||
optionsBG.Visible ^= true;
|
||||
if (optionsBG.Visible)
|
||||
{
|
||||
cachedPause = world.PredictedPaused == World.PauseState.Paused;
|
||||
cachedPause = world.PredictedPaused;
|
||||
|
||||
if (world.LobbyInfo.IsSinglePlayer)
|
||||
world.SetPauseState(true);
|
||||
|
||||
0
OpenRA.Mods.RA/Widgets/SupportPowerBinWidget.cs
Normal file → Executable file
0
OpenRA.Mods.RA/Widgets/SupportPowerBinWidget.cs
Normal file → Executable file
@@ -493,6 +493,7 @@ WALL:
|
||||
DetectCloaked:
|
||||
Range: 5
|
||||
-WithCrumbleOverlay:
|
||||
-WithMakeAnimation:
|
||||
LineBuildNode:
|
||||
Types: turret
|
||||
|
||||
@@ -544,6 +545,7 @@ WALL:
|
||||
DetectCloaked:
|
||||
Range: 6
|
||||
-WithCrumbleOverlay:
|
||||
-WithMakeAnimation:
|
||||
LineBuildNode:
|
||||
Types: turret
|
||||
|
||||
|
||||
Reference in New Issue
Block a user