load ALL the weaponinfo properly
This commit is contained in:
@@ -25,6 +25,26 @@ using OpenRA.Traits;
|
|||||||
|
|
||||||
namespace OpenRA.Effects
|
namespace OpenRA.Effects
|
||||||
{
|
{
|
||||||
|
class BulletInfo : IProjectileInfo
|
||||||
|
{
|
||||||
|
public readonly int Speed = 1;
|
||||||
|
public readonly bool AA = false;
|
||||||
|
public readonly bool AG = true;
|
||||||
|
public readonly bool ASW = false;
|
||||||
|
public readonly string Trail = null;
|
||||||
|
public readonly bool Inaccurate = false;
|
||||||
|
public readonly string Image = null;
|
||||||
|
public readonly bool High = false;
|
||||||
|
public readonly bool Arcing = false;
|
||||||
|
public readonly int RangeLimit = 0;
|
||||||
|
public readonly int Arm = 0;
|
||||||
|
public readonly bool UnderWater = false;
|
||||||
|
public readonly bool Shadow = false;
|
||||||
|
public readonly bool Proximity = false;
|
||||||
|
|
||||||
|
public IEffect Create(ProjectileArgs args) { return null; }
|
||||||
|
}
|
||||||
|
|
||||||
public class Bullet : IEffect
|
public class Bullet : IEffect
|
||||||
{
|
{
|
||||||
readonly Player Owner;
|
readonly Player Owner;
|
||||||
|
|||||||
@@ -26,6 +26,26 @@ using OpenRA.Traits;
|
|||||||
|
|
||||||
namespace OpenRA.Effects
|
namespace OpenRA.Effects
|
||||||
{
|
{
|
||||||
|
class MissileInfo : IProjectileInfo
|
||||||
|
{
|
||||||
|
public readonly int Speed = 1;
|
||||||
|
public readonly int Arm = 0;
|
||||||
|
public readonly bool High = false;
|
||||||
|
public readonly bool Shadow = true;
|
||||||
|
public readonly bool Proximity = false;
|
||||||
|
public readonly string Trail = null;
|
||||||
|
public readonly bool Inaccurate = false;
|
||||||
|
public readonly bool AA = false;
|
||||||
|
public readonly bool AG = true;
|
||||||
|
public readonly bool ASW = false;
|
||||||
|
public readonly string Image = null;
|
||||||
|
public readonly int ROT = 5;
|
||||||
|
public readonly int RangeLimit = 0;
|
||||||
|
public readonly bool TurboBoost = false;
|
||||||
|
|
||||||
|
public IEffect Create(ProjectileArgs args) { return null; }
|
||||||
|
}
|
||||||
|
|
||||||
class Missile : IEffect
|
class Missile : IEffect
|
||||||
{
|
{
|
||||||
readonly Actor FiredBy;
|
readonly Actor FiredBy;
|
||||||
|
|||||||
@@ -28,6 +28,12 @@ using OpenRA.Graphics;
|
|||||||
|
|
||||||
namespace OpenRA.Effects
|
namespace OpenRA.Effects
|
||||||
{
|
{
|
||||||
|
class NukeInfo : IProjectileInfo
|
||||||
|
{
|
||||||
|
public readonly string Image = null;
|
||||||
|
public IEffect Create(ProjectileArgs args) { return null; }
|
||||||
|
}
|
||||||
|
|
||||||
class NukeLaunch : IEffect
|
class NukeLaunch : IEffect
|
||||||
{
|
{
|
||||||
readonly ProjectileInfo projectileUp, projectileDown;
|
readonly ProjectileInfo projectileUp, projectileDown;
|
||||||
|
|||||||
@@ -21,9 +21,15 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using OpenRA.Graphics;
|
using OpenRA.Graphics;
|
||||||
using OpenRA.Traits;
|
using OpenRA.Traits;
|
||||||
|
using OpenRA.GameRules;
|
||||||
|
|
||||||
namespace OpenRA.Effects
|
namespace OpenRA.Effects
|
||||||
{
|
{
|
||||||
|
class TeslaZapInfo : IProjectileInfo
|
||||||
|
{
|
||||||
|
public IEffect Create(ProjectileArgs args) { return null; }
|
||||||
|
}
|
||||||
|
|
||||||
class TeslaZap : IEffect
|
class TeslaZap : IEffect
|
||||||
{
|
{
|
||||||
readonly int2 from, to;
|
readonly int2 from, to;
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ namespace OpenRA.GameRules
|
|||||||
|
|
||||||
foreach( var t in mergedNode )
|
foreach( var t in mergedNode )
|
||||||
if( t.Key != "Inherits" && t.Key != "Category" && !t.Key.StartsWith("-") )
|
if( t.Key != "Inherits" && t.Key != "Category" && !t.Key.StartsWith("-") )
|
||||||
Traits.Add( LoadTraitInfo( t.Key, t.Value ) );
|
Traits.Add( LoadTraitInfo( t.Key.Split('@')[0], t.Value ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
static MiniYaml GetParent( MiniYaml node, Dictionary<string, MiniYaml> allUnits )
|
static MiniYaml GetParent( MiniYaml node, Dictionary<string, MiniYaml> allUnits )
|
||||||
@@ -71,9 +71,6 @@ namespace OpenRA.GameRules
|
|||||||
|
|
||||||
static ITraitInfo LoadTraitInfo(string traitName, MiniYaml my)
|
static ITraitInfo LoadTraitInfo(string traitName, MiniYaml my)
|
||||||
{
|
{
|
||||||
if (traitName.Contains('@'))
|
|
||||||
traitName = traitName.Substring(0, traitName.IndexOf('@'));
|
|
||||||
|
|
||||||
foreach (var mod in Game.ModAssemblies)
|
foreach (var mod in Game.ModAssemblies)
|
||||||
{
|
{
|
||||||
var fullTypeName = mod.Second + "." + traitName + "Info";
|
var fullTypeName = mod.Second + "." + traitName + "Info";
|
||||||
|
|||||||
@@ -21,12 +21,25 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using OpenRA.FileFormats;
|
using OpenRA.FileFormats;
|
||||||
using OpenRA.Effects;
|
using OpenRA.Effects;
|
||||||
|
using System;
|
||||||
|
|
||||||
namespace OpenRA.GameRules
|
namespace OpenRA.GameRules
|
||||||
{
|
{
|
||||||
|
public class ProjectileArgs
|
||||||
|
{
|
||||||
|
public NewWeaponInfo weapon;
|
||||||
|
public Actor firedBy;
|
||||||
|
public int2 offset;
|
||||||
|
public int srcAltitude;
|
||||||
|
public int facing;
|
||||||
|
public Actor target;
|
||||||
|
public int2 dest;
|
||||||
|
public int destAltitude;
|
||||||
|
}
|
||||||
|
|
||||||
public interface IProjectileInfo
|
public interface IProjectileInfo
|
||||||
{
|
{
|
||||||
IEffect Create(); // todo: args for this
|
IEffect Create(ProjectileArgs args);
|
||||||
}
|
}
|
||||||
|
|
||||||
public class NewWeaponInfo
|
public class NewWeaponInfo
|
||||||
@@ -34,6 +47,8 @@ namespace OpenRA.GameRules
|
|||||||
public readonly float Range = 0;
|
public readonly float Range = 0;
|
||||||
public readonly string Report = null;
|
public readonly string Report = null;
|
||||||
public readonly int ROF = 1;
|
public readonly int ROF = 1;
|
||||||
|
public readonly int Burst = 1;
|
||||||
|
public readonly bool Charges = false;
|
||||||
|
|
||||||
public IProjectileInfo Projectile;
|
public IProjectileInfo Projectile;
|
||||||
public List<WarheadInfo> Warheads = new List<WarheadInfo>();
|
public List<WarheadInfo> Warheads = new List<WarheadInfo>();
|
||||||
@@ -48,6 +63,8 @@ namespace OpenRA.GameRules
|
|||||||
case "Range": FieldLoader.LoadField(this, "Range", content.Nodes["Range"].Value); break;
|
case "Range": FieldLoader.LoadField(this, "Range", content.Nodes["Range"].Value); break;
|
||||||
case "ROF": FieldLoader.LoadField(this, "ROF", content.Nodes["ROF"].Value); break;
|
case "ROF": FieldLoader.LoadField(this, "ROF", content.Nodes["ROF"].Value); break;
|
||||||
case "Report": FieldLoader.LoadField(this, "Report", content.Nodes["Report"].Value); break;
|
case "Report": FieldLoader.LoadField(this, "Report", content.Nodes["Report"].Value); break;
|
||||||
|
case "Burst": FieldLoader.LoadField(this, "Burst", content.Nodes["Burst"].Value); break;
|
||||||
|
case "Charges": FieldLoader.LoadField(this, "Charges", content.Nodes["Charges"].Value); break;
|
||||||
|
|
||||||
case "Warhead":
|
case "Warhead":
|
||||||
{
|
{
|
||||||
@@ -59,9 +76,11 @@ namespace OpenRA.GameRules
|
|||||||
// in this case, it's an implementation of IProjectileInfo
|
// in this case, it's an implementation of IProjectileInfo
|
||||||
default:
|
default:
|
||||||
{
|
{
|
||||||
// todo: create the right implementation!
|
var fullTypeName = typeof(IEffect).Namespace + "." + key + "Info";
|
||||||
// fill it with the args
|
Projectile = (IProjectileInfo)typeof(IEffect).Assembly.CreateInstance(fullTypeName);
|
||||||
// etc etc
|
if (Projectile == null)
|
||||||
|
throw new InvalidOperationException("Cannot locate projectile type: {0}".F(key));
|
||||||
|
FieldLoader.Load(Projectile, kv.Value);
|
||||||
} break;
|
} break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -195,7 +195,7 @@ Grenade:
|
|||||||
Bullet:
|
Bullet:
|
||||||
Speed: 5
|
Speed: 5
|
||||||
High: true
|
High: true
|
||||||
Arching: true
|
Arcing: true
|
||||||
Inaccurate: true
|
Inaccurate: true
|
||||||
Image: BOMB
|
Image: BOMB
|
||||||
Warhead:
|
Warhead:
|
||||||
@@ -328,7 +328,7 @@ MammothTusk:
|
|||||||
Bullet:
|
Bullet:
|
||||||
Speed: 12
|
Speed: 12
|
||||||
High: true
|
High: true
|
||||||
Arching: true
|
Arcing: true
|
||||||
Inaccurate:true
|
Inaccurate:true
|
||||||
Image: 120MM
|
Image: 120MM
|
||||||
Warhead:
|
Warhead:
|
||||||
@@ -458,7 +458,7 @@ RedEye:
|
|||||||
Bullet:
|
Bullet:
|
||||||
Speed: 12
|
Speed: 12
|
||||||
High: true
|
High: true
|
||||||
Arching: true
|
Arcing: true
|
||||||
Inaccurate:true
|
Inaccurate:true
|
||||||
Image: 120MM
|
Image: 120MM
|
||||||
Warhead:
|
Warhead:
|
||||||
@@ -539,7 +539,7 @@ DepthCharge:
|
|||||||
Bullet:
|
Bullet:
|
||||||
Speed: 5
|
Speed: 5
|
||||||
Image: BOMB
|
Image: BOMB
|
||||||
Arching: true
|
Arcing: true
|
||||||
High: true
|
High: true
|
||||||
Inaccurate: true
|
Inaccurate: true
|
||||||
ASW: true
|
ASW: true
|
||||||
|
|||||||
Reference in New Issue
Block a user