diff --git a/OpenRA.Game/Graphics/VoxelRenderable.cs b/OpenRA.Game/Graphics/VoxelRenderable.cs index 3d6fe80e4f..d951a31d30 100644 --- a/OpenRA.Game/Graphics/VoxelRenderable.cs +++ b/OpenRA.Game/Graphics/VoxelRenderable.cs @@ -1,6 +1,6 @@ #region Copyright & License Information /* - * Copyright 2007-2013 The OpenRA Developers (see AUTHORS) + * Copyright 2007-2014 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, @@ -89,10 +89,12 @@ namespace OpenRA.Graphics static readonly float[] groundNormal = new float[] {0,0,1,1}; public void BeforeRender(WorldRenderer wr) { + var draw = voxels.Where(v => v.DisableFunc == null || !v.DisableFunc()); + renderProxy = Game.Renderer.WorldVoxelRenderer.RenderAsync( - wr, voxels, camera, scale, groundNormal, lightSource, + wr, draw, camera, scale, groundNormal, lightSource, lightAmbientColor, lightDiffuseColor, - palette, normalsPalette, shadowPalette); + palette, normalsPalette, shadowPalette); } public void Render(WorldRenderer wr) diff --git a/OpenRA.Mods.TS/Activities/VoxelHarvesterDockSequence.cs b/OpenRA.Mods.TS/Activities/VoxelHarvesterDockSequence.cs new file mode 100644 index 0000000000..142756c4d5 --- /dev/null +++ b/OpenRA.Mods.TS/Activities/VoxelHarvesterDockSequence.cs @@ -0,0 +1,77 @@ +#region Copyright & License Information +/* + * Copyright 2007-2014 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 COPYING. + */ +#endregion + +using System; +using System.Collections.Generic; +using OpenRA.Mods.RA; +using OpenRA.Mods.RA.Activities; +using OpenRA.Mods.RA.Move; +using OpenRA.Mods.RA.Render; +using OpenRA.Traits; + +namespace OpenRA.Mods.TS +{ + public class VoxelHarvesterDockSequence : Activity + { + enum State { Turn, Dock, Loop, Undock } + + readonly Actor proc; + readonly Harvester harv; + readonly WithVoxelUnloadBody body; + State state; + + public VoxelHarvesterDockSequence(Actor self, Actor proc) + { + this.proc = proc; + state = State.Turn; + harv = self.Trait(); + body = self.Trait(); + } + + public override Activity Tick(Actor self) + { + switch (state) + { + case State.Turn: + state = State.Dock; + return Util.SequenceActivities(new Turn(160), this); + case State.Dock: + if (proc.IsInWorld && !proc.IsDead()) + foreach (var nd in proc.TraitsImplementing()) + nd.Docked(proc, self); + state = State.Loop; + body.Docked = true; + return this; + case State.Loop: + if (!proc.IsInWorld || proc.IsDead() || harv.TickUnload(self, proc)) + state = State.Undock; + return this; + case State.Undock: + if (proc.IsInWorld && !proc.IsDead()) + foreach (var nd in proc.TraitsImplementing()) + nd.Undocked(proc, self); + body.Docked = false; + return NextActivity; + } + + throw new InvalidOperationException("Invalid harvester dock state"); + } + + public override void Cancel(Actor self) + { + state = State.Undock; + } + + public override IEnumerable GetTargets(Actor self) + { + yield return Target.FromActor(proc); + } + } +} diff --git a/OpenRA.Mods.TS/OpenRA.Mods.TS.csproj b/OpenRA.Mods.TS/OpenRA.Mods.TS.csproj index f7054807f5..17c23d245a 100644 --- a/OpenRA.Mods.TS/OpenRA.Mods.TS.csproj +++ b/OpenRA.Mods.TS/OpenRA.Mods.TS.csproj @@ -40,10 +40,17 @@ {0DFB103F-2962-400F-8C6D-E2C28CCBA633} OpenRA.Game + + {4A8A43B5-A9EF-4ED0-99DD-4BAB10A0DB6E} + OpenRA.Mods.RA + + + +