Mods.Common Effects

Moved over more effects to Mods.Common
This commit is contained in:
steelphase
2014-10-04 16:01:20 -04:00
parent 2f4a267ba7
commit 3c60794e2e
24 changed files with 51 additions and 50 deletions

View File

@@ -13,7 +13,7 @@ using System.Collections.Generic;
using OpenRA.Effects; using OpenRA.Effects;
using OpenRA.Graphics; using OpenRA.Graphics;
namespace OpenRA.Mods.RA.Effects namespace OpenRA.Mods.Common.Effects
{ {
public class Beacon : IEffect public class Beacon : IEffect
{ {

View File

@@ -15,11 +15,10 @@ using System.Linq;
using OpenRA.Effects; using OpenRA.Effects;
using OpenRA.GameRules; using OpenRA.GameRules;
using OpenRA.Graphics; using OpenRA.Graphics;
using OpenRA.Mods.Common.Effects;
using OpenRA.Mods.Common.Graphics; using OpenRA.Mods.Common.Graphics;
using OpenRA.Traits; using OpenRA.Traits;
namespace OpenRA.Mods.RA.Effects namespace OpenRA.Mods.Common.Effects
{ {
public class BulletInfo : IProjectileInfo public class BulletInfo : IProjectileInfo
{ {
@@ -83,12 +82,12 @@ namespace OpenRA.Mods.RA.Effects
target = args.PassiveTarget; target = args.PassiveTarget;
if (info.Inaccuracy.Range > 0) if (info.Inaccuracy.Range > 0)
{ {
var inaccuracy = Traits.Util.ApplyPercentageModifiers(info.Inaccuracy.Range, args.InaccuracyModifiers); var inaccuracy = OpenRA.Traits.Util.ApplyPercentageModifiers(info.Inaccuracy.Range, args.InaccuracyModifiers);
var maxOffset = inaccuracy * (target - pos).Length / args.Weapon.Range.Range; var maxOffset = inaccuracy * (target - pos).Length / args.Weapon.Range.Range;
target += WVec.FromPDF(world.SharedRandom, 2) * maxOffset / 1024; target += WVec.FromPDF(world.SharedRandom, 2) * maxOffset / 1024;
} }
facing = Traits.Util.GetFacing(target - pos, 0); facing = OpenRA.Traits.Util.GetFacing(target - pos, 0);
length = Math.Max((target - pos).Length / speed.Range, 1); length = Math.Max((target - pos).Length / speed.Range, 1);
if (info.Image != null) if (info.Image != null)

View File

@@ -11,11 +11,10 @@
using System.Collections.Generic; using System.Collections.Generic;
using System.Drawing; using System.Drawing;
using OpenRA.Graphics; using OpenRA.Graphics;
using OpenRA.Mods.Common.Effects;
using OpenRA.Mods.Common.Graphics; using OpenRA.Mods.Common.Graphics;
using OpenRA.Traits; using OpenRA.Traits;
namespace OpenRA.Mods.RA namespace OpenRA.Mods.Common.Effects
{ {
[Desc("Draw a colored contrail behind this actor when they move.")] [Desc("Draw a colored contrail behind this actor when they move.")]
class ContrailInfo : ITraitInfo, Requires<IBodyOrientationInfo> class ContrailInfo : ITraitInfo, Requires<IBodyOrientationInfo>

View File

@@ -12,7 +12,7 @@ using System.Collections.Generic;
using OpenRA.Effects; using OpenRA.Effects;
using OpenRA.Graphics; using OpenRA.Graphics;
namespace OpenRA.Mods.RA.Effects namespace OpenRA.Mods.Common.Effects
{ {
public class Corpse : IEffect public class Corpse : IEffect
{ {

View File

@@ -12,9 +12,9 @@ using System.Collections.Generic;
using OpenRA.Effects; using OpenRA.Effects;
using OpenRA.Graphics; using OpenRA.Graphics;
namespace OpenRA.Mods.RA.Effects namespace OpenRA.Mods.Common.Effects
{ {
class CrateEffect : IEffect public class CrateEffect : IEffect
{ {
readonly string palette; readonly string palette;
readonly Actor a; readonly Actor a;

View File

@@ -14,7 +14,7 @@ using OpenRA.GameRules;
using OpenRA.Graphics; using OpenRA.Graphics;
using OpenRA.Traits; using OpenRA.Traits;
namespace OpenRA.Mods.RA.Effects namespace OpenRA.Mods.Common.Effects
{ {
public class GravityBombInfo : IProjectileInfo public class GravityBombInfo : IProjectileInfo
{ {

View File

@@ -13,10 +13,11 @@ using System.Drawing;
using OpenRA.Effects; using OpenRA.Effects;
using OpenRA.GameRules; using OpenRA.GameRules;
using OpenRA.Graphics; using OpenRA.Graphics;
using OpenRA.Traits;
using OpenRA.Mods.Common.Graphics; using OpenRA.Mods.Common.Graphics;
using OpenRA.Traits;
namespace OpenRA.Mods.RA.Effects
namespace OpenRA.Mods.Common.Effects
{ {
[Desc("Not a sprite, but an engine effect.")] [Desc("Not a sprite, but an engine effect.")]
class LaserZapInfo : IProjectileInfo class LaserZapInfo : IProjectileInfo

View File

@@ -14,11 +14,11 @@ using System.Linq;
using OpenRA.Effects; using OpenRA.Effects;
using OpenRA.GameRules; using OpenRA.GameRules;
using OpenRA.Graphics; using OpenRA.Graphics;
using OpenRA.Mods.Common.Effects;
using OpenRA.Mods.Common.Graphics; using OpenRA.Mods.Common.Graphics;
using OpenRA.Mods.Common.Traits;
using OpenRA.Traits; using OpenRA.Traits;
namespace OpenRA.Mods.RA.Effects namespace OpenRA.Mods.Common.Effects
{ {
class MissileInfo : IProjectileInfo class MissileInfo : IProjectileInfo
{ {
@@ -97,7 +97,7 @@ namespace OpenRA.Mods.RA.Effects
if (info.Inaccuracy.Range > 0) if (info.Inaccuracy.Range > 0)
{ {
var inaccuracy = Traits.Util.ApplyPercentageModifiers(info.Inaccuracy.Range, args.InaccuracyModifiers); var inaccuracy = OpenRA.Traits.Util.ApplyPercentageModifiers(info.Inaccuracy.Range, args.InaccuracyModifiers);
offset = WVec.FromPDF(world.SharedRandom, 2) * inaccuracy / 1024; offset = WVec.FromPDF(world.SharedRandom, 2) * inaccuracy / 1024;
} }
@@ -135,7 +135,7 @@ namespace OpenRA.Mods.RA.Effects
targetPosition = args.GuidedTarget.CenterPosition; targetPosition = args.GuidedTarget.CenterPosition;
var dist = targetPosition + offset - pos; var dist = targetPosition + offset - pos;
var desiredFacing = Traits.Util.GetFacing(dist, facing); var desiredFacing = OpenRA.Traits.Util.GetFacing(dist, facing);
var desiredAltitude = targetPosition.Z; var desiredAltitude = targetPosition.Z;
var jammed = info.Jammable && world.ActorsWithTrait<JamsMissiles>().Any(JammedBy); var jammed = info.Jammable && world.ActorsWithTrait<JamsMissiles>().Any(JammedBy);
@@ -147,7 +147,7 @@ namespace OpenRA.Mods.RA.Effects
else if (!args.GuidedTarget.IsValidFor(args.SourceActor)) else if (!args.GuidedTarget.IsValidFor(args.SourceActor))
desiredFacing = facing; desiredFacing = facing;
facing = Traits.Util.TickFacing(facing, desiredFacing, info.ROT); facing = OpenRA.Traits.Util.TickFacing(facing, desiredFacing, info.ROT);
var move = new WVec(0, -1024, 0).Rotate(WRot.FromFacing(facing)) * info.Speed.Range / 1024; var move = new WVec(0, -1024, 0).Rotate(WRot.FromFacing(facing)) * info.Speed.Range / 1024;
if (targetPosition.Z > 0 && info.TurboBoost) if (targetPosition.Z > 0 && info.TurboBoost)
move = (move * 3) / 2; move = (move * 3) / 2;

View File

@@ -13,12 +13,12 @@ using System.Linq;
using OpenRA.Effects; using OpenRA.Effects;
using OpenRA.Graphics; using OpenRA.Graphics;
namespace OpenRA.Mods.RA.Effects namespace OpenRA.Mods.Common.Effects
{ {
class RallyPoint : IEffect class RallyPoint : IEffect
{ {
readonly Actor building; readonly Actor building;
readonly RA.RallyPoint rp; readonly Common.RallyPoint rp;
readonly string palettePrefix; readonly string palettePrefix;
readonly Animation flag; readonly Animation flag;
readonly Animation circles; readonly Animation circles;
@@ -28,7 +28,7 @@ namespace OpenRA.Mods.RA.Effects
this.building = building; this.building = building;
this.palettePrefix = palettePrefix; this.palettePrefix = palettePrefix;
rp = building.Trait<RA.RallyPoint>(); rp = building.Trait<Common.RallyPoint>();
flag = new Animation(building.World, "rallypoint"); flag = new Animation(building.World, "rallypoint");
circles = new Animation(building.World, "rallypoint"); circles = new Animation(building.World, "rallypoint");

View File

@@ -42,9 +42,18 @@
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Compile Include="CommonTraitsInterfaces.cs" /> <Compile Include="CommonTraitsInterfaces.cs" />
<Compile Include="Effects\Beacon.cs" />
<Compile Include="Effects\Bullet.cs" />
<Compile Include="Effects\Contrail.cs" />
<Compile Include="Effects\ContrailFader.cs" /> <Compile Include="Effects\ContrailFader.cs" />
<Compile Include="Effects\Corpse.cs" />
<Compile Include="Effects\CrateEffect.cs" />
<Compile Include="Effects\Explosion.cs" /> <Compile Include="Effects\Explosion.cs" />
<Compile Include="Effects\FloatingText.cs" /> <Compile Include="Effects\FloatingText.cs" />
<Compile Include="Effects\GravityBomb.cs" />
<Compile Include="Effects\LaserZap.cs" />
<Compile Include="Effects\Missile.cs" />
<Compile Include="Effects\RallyPoint.cs" />
<Compile Include="Effects\Smoke.cs" /> <Compile Include="Effects\Smoke.cs" />
<Compile Include="Console\ChatCommands.cs" /> <Compile Include="Console\ChatCommands.cs" />
<Compile Include="Console\DevCommands.cs" /> <Compile Include="Console\DevCommands.cs" />
@@ -60,9 +69,11 @@
<Compile Include="Graphics\VoxelRenderable.cs" /> <Compile Include="Graphics\VoxelRenderable.cs" />
<Compile Include="ModChooserLoadScreen.cs" /> <Compile Include="ModChooserLoadScreen.cs" />
<Compile Include="PaletteFromFile.cs" /> <Compile Include="PaletteFromFile.cs" />
<Compile Include="RallyPoint.cs" />
<Compile Include="ServerTraits\ColorValidator.cs" /> <Compile Include="ServerTraits\ColorValidator.cs" />
<Compile Include="ServerTraits\MasterServerPinger.cs" /> <Compile Include="ServerTraits\MasterServerPinger.cs" />
<Compile Include="ServerTraits\PlayerPinger.cs" /> <Compile Include="ServerTraits\PlayerPinger.cs" />
<Compile Include="Traits\JamsMissiles.cs" />
<Compile Include="Traits\ProvidesRadar.cs" /> <Compile Include="Traits\ProvidesRadar.cs" />
<Compile Include="UtilityCommands\ConvertPngToShpCommand.cs" /> <Compile Include="UtilityCommands\ConvertPngToShpCommand.cs" />
<Compile Include="UtilityCommands\ConvertSpriteToPngCommand.cs" /> <Compile Include="UtilityCommands\ConvertSpriteToPngCommand.cs" />

View File

@@ -11,7 +11,7 @@
using System.Collections.Generic; using System.Collections.Generic;
using OpenRA.Traits; using OpenRA.Traits;
namespace OpenRA.Mods.RA namespace OpenRA.Mods.Common
{ {
[Desc("Used to waypoint units after production or repair is finished.")] [Desc("Used to waypoint units after production or repair is finished.")]
public class RallyPointInfo : ITraitInfo public class RallyPointInfo : ITraitInfo

View File

@@ -10,9 +10,9 @@
using OpenRA.Traits; using OpenRA.Traits;
namespace OpenRA.Mods.RA namespace OpenRA.Mods.Common.Traits
{ {
class JamsMissilesInfo : ITraitInfo public class JamsMissilesInfo : ITraitInfo
{ {
public readonly int Range = 0; public readonly int Range = 0;
public readonly bool AlliedMissiles = true; public readonly bool AlliedMissiles = true;

View File

@@ -11,6 +11,7 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using OpenRA.Mods.Common;
using OpenRA.Mods.RA.Activities; using OpenRA.Mods.RA.Activities;
using OpenRA.Mods.RA.Air; using OpenRA.Mods.RA.Air;
using OpenRA.Mods.RA.Buildings; using OpenRA.Mods.RA.Buildings;

View File

@@ -8,6 +8,7 @@
*/ */
#endregion #endregion
using OpenRA.Mods.Common;
using OpenRA.Traits; using OpenRA.Traits;
namespace OpenRA.Mods.RA.Air namespace OpenRA.Mods.RA.Air

View File

@@ -9,7 +9,7 @@
#endregion #endregion
using System.Linq; using System.Linq;
using OpenRA.Mods.RA.Effects; using OpenRA.Mods.Common.Effects;
using OpenRA.Traits; using OpenRA.Traits;
namespace OpenRA.Mods.RA namespace OpenRA.Mods.RA

View File

@@ -11,7 +11,7 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using OpenRA.GameRules; using OpenRA.Mods.Common.Effects;
using OpenRA.Mods.RA.Effects; using OpenRA.Mods.RA.Effects;
using OpenRA.Primitives; using OpenRA.Primitives;
using OpenRA.Traits; using OpenRA.Traits;

View File

@@ -120,10 +120,15 @@
<Compile Include="Air\AttackPlane.cs" /> <Compile Include="Air\AttackPlane.cs" />
<Compile Include="AI\SupportPowerDecision.cs" /> <Compile Include="AI\SupportPowerDecision.cs" />
<Compile Include="Crates\DuplicateUnitCrateAction.cs" /> <Compile Include="Crates\DuplicateUnitCrateAction.cs" />
<Compile Include="Effects\GpsSatellite.cs" />
<Compile Include="Effects\Rank.cs" />
<Compile Include="Effects\SatelliteLaunch.cs" />
<Compile Include="Effects\TeslaZap.cs" />
<Compile Include="TeslaZapRenderable.cs" />
<Compile Include="GainsExperience.cs" />
<Compile Include="Infiltration\InfiltrateForPowerOutage.cs" /> <Compile Include="Infiltration\InfiltrateForPowerOutage.cs" />
<Compile Include="Power\AffectedByPowerOutage.cs" /> <Compile Include="Power\AffectedByPowerOutage.cs" />
<Compile Include="Power\Power.cs" /> <Compile Include="Power\Power.cs" />
<Compile Include="Effects\Beacon.cs" />
<Compile Include="Player\PlaceBeacon.cs" /> <Compile Include="Player\PlaceBeacon.cs" />
<Compile Include="MenuPaletteEffect.cs" /> <Compile Include="MenuPaletteEffect.cs" />
<Compile Include="EjectOnDeath.cs" /> <Compile Include="EjectOnDeath.cs" />
@@ -210,28 +215,16 @@
<Compile Include="DeathSounds.cs" /> <Compile Include="DeathSounds.cs" />
<Compile Include="DemoTruck.cs" /> <Compile Include="DemoTruck.cs" />
<Compile Include="DetectCloaked.cs" /> <Compile Include="DetectCloaked.cs" />
<Compile Include="Effects\Bullet.cs" />
<Compile Include="Effects\Contrail.cs" />
<Compile Include="Effects\Corpse.cs" />
<Compile Include="Effects\CrateEffect.cs" />
<Compile Include="Effects\GpsDot.cs" /> <Compile Include="Effects\GpsDot.cs" />
<Compile Include="Effects\GpsSatellite.cs" />
<Compile Include="Effects\GravityBomb.cs" />
<Compile Include="Effects\LaserZap.cs" />
<Compile Include="Effects\Missile.cs" />
<Compile Include="Effects\NukeLaunch.cs" /> <Compile Include="Effects\NukeLaunch.cs" />
<Compile Include="Effects\Parachute.cs" /> <Compile Include="Effects\Parachute.cs" />
<Compile Include="Effects\PowerdownIndicator.cs" /> <Compile Include="Effects\PowerdownIndicator.cs" />
<Compile Include="Effects\RallyPoint.cs" />
<Compile Include="Effects\RepairIndicator.cs" /> <Compile Include="Effects\RepairIndicator.cs" />
<Compile Include="Effects\SatelliteLaunch.cs" />
<Compile Include="Effects\TeslaZap.cs" />
<Compile Include="EmitInfantryOnSell.cs" /> <Compile Include="EmitInfantryOnSell.cs" />
<Compile Include="EngineerRepair.cs" /> <Compile Include="EngineerRepair.cs" />
<Compile Include="Explodes.cs" /> <Compile Include="Explodes.cs" />
<Compile Include="Fake.cs" /> <Compile Include="Fake.cs" />
<Compile Include="FreeActor.cs" /> <Compile Include="FreeActor.cs" />
<Compile Include="GainsExperience.cs" />
<Compile Include="GivesBounty.cs" /> <Compile Include="GivesBounty.cs" />
<Compile Include="GivesExperience.cs" /> <Compile Include="GivesExperience.cs" />
<Compile Include="Guard.cs" /> <Compile Include="Guard.cs" />
@@ -240,7 +233,6 @@
<Compile Include="Husk.cs" /> <Compile Include="Husk.cs" />
<Compile Include="Infiltration\InfiltrateForSupportPower.cs" /> <Compile Include="Infiltration\InfiltrateForSupportPower.cs" />
<Compile Include="Invulnerable.cs" /> <Compile Include="Invulnerable.cs" />
<Compile Include="JamsMissiles.cs" />
<Compile Include="LeavesHusk.cs" /> <Compile Include="LeavesHusk.cs" />
<Compile Include="Captures.cs" /> <Compile Include="Captures.cs" />
<Compile Include="LightPaletteRotator.cs" /> <Compile Include="LightPaletteRotator.cs" />
@@ -298,7 +290,6 @@
<Compile Include="ProximityCapturable.cs" /> <Compile Include="ProximityCapturable.cs" />
<Compile Include="DefaultLoadScreen.cs" /> <Compile Include="DefaultLoadScreen.cs" />
<Compile Include="RadarColorFromTerrain.cs" /> <Compile Include="RadarColorFromTerrain.cs" />
<Compile Include="RallyPoint.cs" />
<Compile Include="Reloads.cs" /> <Compile Include="Reloads.cs" />
<Compile Include="RenderDetectionCircle.cs" /> <Compile Include="RenderDetectionCircle.cs" />
<Compile Include="RenderJammerCircle.cs" /> <Compile Include="RenderJammerCircle.cs" />
@@ -426,7 +417,6 @@
<Compile Include="World\DomainIndex.cs" /> <Compile Include="World\DomainIndex.cs" />
<Compile Include="MPStartUnits.cs" /> <Compile Include="MPStartUnits.cs" />
<Compile Include="Widgets\Logic\WorldTooltipLogic.cs" /> <Compile Include="Widgets\Logic\WorldTooltipLogic.cs" />
<Compile Include="TeslaZapRenderable.cs" />
<Compile Include="Buildings\Bib.cs" /> <Compile Include="Buildings\Bib.cs" />
<Compile Include="Orders\EnterAlliedActorTargeter.cs" /> <Compile Include="Orders\EnterAlliedActorTargeter.cs" />
<Compile Include="Render\WithIdleOverlay.cs" /> <Compile Include="Render\WithIdleOverlay.cs" />
@@ -441,7 +431,6 @@
<Compile Include="World\PathfinderDebugOverlay.cs" /> <Compile Include="World\PathfinderDebugOverlay.cs" />
<Compile Include="Widgets\Logic\SettingsLogic.cs" /> <Compile Include="Widgets\Logic\SettingsLogic.cs" />
<Compile Include="AttackBomber.cs" /> <Compile Include="AttackBomber.cs" />
<Compile Include="Effects\Rank.cs" />
<Compile Include="ShroudRenderer.cs" /> <Compile Include="ShroudRenderer.cs" />
<Compile Include="Render\WithCrateBody.cs" /> <Compile Include="Render\WithCrateBody.cs" />
<Compile Include="Buildings\Demolishable.cs" /> <Compile Include="Buildings\Demolishable.cs" />

View File

@@ -9,7 +9,7 @@
#endregion #endregion
using OpenRA.Mods.Common; using OpenRA.Mods.Common;
using OpenRA.Mods.RA.Effects; using OpenRA.Mods.Common.Effects;
using OpenRA.Traits; using OpenRA.Traits;
namespace OpenRA.Mods.RA namespace OpenRA.Mods.RA

View File

@@ -10,8 +10,8 @@
using System; using System;
using System.Drawing; using System.Drawing;
using System.Collections.Generic;
using System.Linq; using System.Linq;
using OpenRA.Mods.Common;
using OpenRA.Mods.RA.Move; using OpenRA.Mods.RA.Move;
using OpenRA.Primitives; using OpenRA.Primitives;
using OpenRA.Traits; using OpenRA.Traits;

View File

@@ -8,9 +8,7 @@
*/ */
#endregion #endregion
using System.Linq; using OpenRA.Mods.Common.Effects;
using OpenRA.Mods.RA.Effects;
using OpenRA.Mods.RA.Render;
using OpenRA.Traits; using OpenRA.Traits;
namespace OpenRA.Mods.RA.Render namespace OpenRA.Mods.RA.Render

View File

@@ -15,6 +15,7 @@ using OpenRA.Mods.RA.Activities;
using OpenRA.Mods.RA.Buildings; using OpenRA.Mods.RA.Buildings;
using OpenRA.Mods.RA.Orders; using OpenRA.Mods.RA.Orders;
using OpenRA.Traits; using OpenRA.Traits;
using OpenRA.Mods.Common;
namespace OpenRA.Mods.RA namespace OpenRA.Mods.RA
{ {

View File

@@ -11,9 +11,9 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using OpenRA.Mods.Common.Effects;
using OpenRA.Mods.RA.Activities; using OpenRA.Mods.RA.Activities;
using OpenRA.Mods.RA.Air; using OpenRA.Mods.RA.Air;
using OpenRA.Mods.RA.Effects;
using OpenRA.Primitives; using OpenRA.Primitives;
using OpenRA.Traits; using OpenRA.Traits;

View File

@@ -10,6 +10,7 @@
using System; using System;
using OpenRA.Effects; using OpenRA.Effects;
using OpenRA.Mods.Common.Effects;
using OpenRA.Mods.RA.Activities; using OpenRA.Mods.RA.Activities;
using OpenRA.Mods.RA.Effects; using OpenRA.Mods.RA.Effects;
using OpenRA.Mods.RA.Render; using OpenRA.Mods.RA.Render;

View File

@@ -11,9 +11,9 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using OpenRA.Mods.Common.Effects;
using OpenRA.Mods.RA.Activities; using OpenRA.Mods.RA.Activities;
using OpenRA.Mods.RA.Air; using OpenRA.Mods.RA.Air;
using OpenRA.Mods.RA.Effects;
using OpenRA.Primitives; using OpenRA.Primitives;
using OpenRA.Traits; using OpenRA.Traits;