Skip to content

Commit

Permalink
[13] Added a template for some new Component types, and added support…
Browse files Browse the repository at this point in the history
… for CRD types
  • Loading branch information
wilson212 committed Feb 19, 2016
1 parent 0e7d903 commit c01a77d
Show file tree
Hide file tree
Showing 17 changed files with 460 additions and 26 deletions.
11 changes: 10 additions & 1 deletion BF2ScriptingEngine/BF2ScriptingEngine.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,16 @@
<Compile Include="ReferenceManager.cs" />
<Compile Include="ScopeType.cs" />
<Compile Include="Scripting\Abstract\CollisionManager.cs" />
<Compile Include="Scripting\Components\Abstract\TargetComp.cs" />
<Compile Include="Scripting\Components\DefaultAmmoComp.cs" />
<Compile Include="Scripting\Components\DefaultCollisionComp.cs" />
<Compile Include="Scripting\Components\DefaultDetonationComp.cs" />
<Compile Include="Scripting\Components\DefaultPenetrateComp.cs" />
<Compile Include="Scripting\Components\DefaultProjSoundComp.cs" />
<Compile Include="Scripting\Components\DefaultRicochetComp.cs" />
<Compile Include="Scripting\Components\DefaultZoomComp.cs" />
<Compile Include="Scripting\Components\Abstract\FireComp.cs" />
<Compile Include="Scripting\Components\LPTargetComp.cs" />
<Compile Include="Scripting\Components\MultiFireComp.cs" />
<Compile Include="Scripting\Components\SimpleDeviationComp.cs" />
<Compile Include="Scripting\Components\SingleFireComp.cs" />
Expand Down Expand Up @@ -82,7 +89,9 @@
<Compile Include="Scripting\ObjectTemplates\SupplyObject.cs" />
<Compile Include="Scripting\ObjectTemplates\UAVVehicle.cs" />
<Compile Include="Scripting\ObjectTemplates\Wing.cs" />
<Compile Include="Scripting\Point3D.cs" />
<Compile Include="Scripting\ValueTypes\CRD.cs" />
<Compile Include="Scripting\ValueTypes\CrdType.cs" />
<Compile Include="Scripting\ValueTypes\Point3D.cs" />
<Compile Include="Scripting\RunStatement.cs" />
<Compile Include="ReferenceType.cs" />
<Compile Include="Scope.cs" />
Expand Down
28 changes: 24 additions & 4 deletions BF2ScriptingEngine/Scripting/Components/Abstract/FireComp.cs
Original file line number Diff line number Diff line change
@@ -1,13 +1,33 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using BF2ScriptingEngine.Scripting.Attributes;

namespace BF2ScriptingEngine.Scripting.Components
{
public abstract class FireComp : ConFileObject, IComponent
{
/// <summary>
/// Gets or Sets How fast the weapon can be fired. Value must be a factor of 1800."
/// </summary>
/// <remarks>
/// 300, 360, 450, 600, 900, 1200, 1800
/// </remarks>
[PropertyName("roundsPerMinute")]
public ObjectProperty<int> RoundsPerMinute { get; internal set; }

/// <summary>
/// Gets or Sets the time in seconds from when you pull a trigger
/// to when the projectile is actually fired.
/// </summary>
[PropertyName("fireStartDelay")]
public ObjectProperty<CRD> FireStartDelay { get; internal set; }

/// <summary>
/// Use for hand fire arms. Fire the projectile from the center of
/// the crosshair as opposed to the center of the weapon model.
/// </summary>
[PropertyName("fireInCameraDof")]
public ObjectProperty<bool> FireInCameraDof { get; internal set; }

public FireComp(string name, Token token) : base(name, token)
{

Expand Down
12 changes: 12 additions & 0 deletions BF2ScriptingEngine/Scripting/Components/Abstract/TargetComp.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
using System;

namespace BF2ScriptingEngine.Scripting.Components
{
public abstract class TargetComp : ObjectTemplate, IComponent
{
public TargetComp(string name, Token token) : base(name, token)
{

}
}
}
11 changes: 7 additions & 4 deletions BF2ScriptingEngine/Scripting/Components/Abstract/ZoomComp.cs
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using BF2ScriptingEngine.Scripting.Attributes;

namespace BF2ScriptingEngine.Scripting.Components
{
public abstract class ZoomComp : ConFileObject, IComponent
{
[PropertyName("startCameraId")]
public ObjectProperty<int> StartCameraId { get; internal set; }

[PropertyName("startCameraViewMode")]
public ObjectProperty<int> StartCameraViewMode { get; internal set; }

public ZoomComp(string name, Token token) : base(name, token)
{

Expand Down
44 changes: 40 additions & 4 deletions BF2ScriptingEngine/Scripting/Components/DefaultAmmoComp.cs
Original file line number Diff line number Diff line change
@@ -1,13 +1,49 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using BF2ScriptingEngine.Scripting.Attributes;

namespace BF2ScriptingEngine.Scripting.Components
{
public class DefaultAmmoComp : ConFileObject, IComponent
{
/// <summary>
///
/// </summary>
[PropertyName("ammoType")]
public ObjectProperty<int> AmmoType { get; internal set; }

/// <summary>
/// Gets or Sets the number of magazines in soldier
/// or vehicle inventory when fully loaded.
/// </summary>
[PropertyName("nrOfMags")]
public ObjectProperty<int> NumberOfMags { get; internal set; }

/// <summary>
/// Gets or Sets the number of shots in 1 magazine
/// </summary>
[PropertyName("magSize")]
public ObjectProperty<int> MagSize { get; internal set; }

/// <summary>
/// Gets or Sets how long after loading sequence is initiated before the
/// weapon can be fired again (in seconds). Should be synced with reload
/// animation.
/// </summary>
[PropertyName("reloadTime")]
public ObjectProperty<int> ReloadTime { get; internal set; }

/// <summary>
/// Gets or Sets whether the weapon will auto reload
/// </summary>
[PropertyName("autoReload")]
public ObjectProperty<bool> AutoReload { get; internal set; }

/// <summary>
/// Gets or Sets whether the weapon will auto reload
/// </summary>
[PropertyName("reloadWithoutPlayer")]
public ObjectProperty<bool> ReloadWithoutPlayer { get; internal set; }

public DefaultAmmoComp(string name, Token token) : base("DefaultAmmoComp", token)
{

Expand Down
16 changes: 16 additions & 0 deletions BF2ScriptingEngine/Scripting/Components/DefaultCollisionComp.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BF2ScriptingEngine.Scripting.Components
{
public class DefaultCollisionComp : ObjectTemplate, IComponent
{
public DefaultCollisionComp(string name, Token token) : base(name, token)
{

}
}
}
12 changes: 12 additions & 0 deletions BF2ScriptingEngine/Scripting/Components/DefaultDetonationComp.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
using System;

namespace BF2ScriptingEngine.Scripting.Components
{
public class DefaultDetonationComp : ConFileObject, IComponent
{
public DefaultDetonationComp(string name, Token token) : base(name, token)
{

}
}
}
12 changes: 12 additions & 0 deletions BF2ScriptingEngine/Scripting/Components/DefaultPenetrateComp.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
using System;

namespace BF2ScriptingEngine.Scripting.Components
{
public class DefaultPenetrateComp : ObjectTemplate, IComponent
{
public DefaultPenetrateComp(string name, Token token) : base(name, token)
{

}
}
}
12 changes: 12 additions & 0 deletions BF2ScriptingEngine/Scripting/Components/DefaultProjSoundComp.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
using System;

namespace BF2ScriptingEngine.Scripting.Components
{
public class DefaultProjSoundComp : ObjectTemplate, IComponent
{
public DefaultProjSoundComp(string name, Token token) : base(name, token)
{

}
}
}
12 changes: 12 additions & 0 deletions BF2ScriptingEngine/Scripting/Components/LPTargetComp.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
using System;

namespace BF2ScriptingEngine.Scripting.Components
{
public class LPTargetComp : TargetComp
{
public LPTargetComp(string name, Token token) : base(name, token)
{

}
}
}
12 changes: 8 additions & 4 deletions BF2ScriptingEngine/Scripting/Components/SimpleDeviationComp.cs
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using BF2ScriptingEngine.Scripting.Attributes;

namespace BF2ScriptingEngine.Scripting.Components
{
public class SimpleDeviationComp : ConFileObject, IComponent
{
/// <summary>
/// Gets or Sets the minimum deviation for the weapon.
/// Deviation can never become less than this.
/// </summary>
[PropertyName("minDev")]
public ObjectProperty<double> MinDeviation { get; internal set; }

public SimpleDeviationComp(string name, Token token)
: base("SimpleDeviationComp", token)
{
Expand Down
23 changes: 19 additions & 4 deletions BF2ScriptingEngine/Scripting/Components/WeaponBasedRecoilComp.cs
Original file line number Diff line number Diff line change
@@ -1,13 +1,28 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using BF2ScriptingEngine.Scripting.Attributes;

namespace BF2ScriptingEngine.Scripting.Components
{
public class WeaponBasedRecoilComp : ConFileObject, IComponent
{
/// <summary>
///
/// </summary>
[PropertyName("recoilSize")]
public ObjectProperty<decimal> RecoilSize { get; internal set; }

/// <summary>
///
/// </summary>
[PropertyName("cameraRecoilSpeed")]
public ObjectProperty<int> CameraRecoilSpeed { get; internal set; }

/// <summary>
///
/// </summary>
[PropertyName("cameraRecoilSize")]
public ObjectProperty<double> CameraRecoilSize { get; internal set; }

public WeaponBasedRecoilComp(string name, Token token)
: base("WeaponBasedRecoilComp", token)
{
Expand Down
89 changes: 85 additions & 4 deletions BF2ScriptingEngine/Scripting/Components/WeaponHud.cs
Original file line number Diff line number Diff line change
@@ -1,14 +1,95 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using BF2ScriptingEngine.Scripting.Attributes;

namespace BF2ScriptingEngine.Scripting.Components
{
public class WeaponHud : ConFileObject, IComponent
{
/// <summary>
///
/// </summary>
[PropertyName("weaponIcon")]
public ObjectProperty<string> WeaponIcon { get; internal set; }

/// <summary>
///
/// </summary>
[PropertyName("selectIcon")]
public ObjectProperty<string> SelectIcon { get; internal set; }

/// <summary>
/// Gets or Sets the name that will be displayed in the HUD
/// when using the weapon.
/// </summary>
[PropertyName("hudName")]
public ObjectProperty<string> HudName { get; internal set; }

/// <summary>
///
/// </summary>
[PropertyName("guiIndex")]
public ObjectProperty<int> GuiIndex { get; internal set; }

/// <summary>
///
/// </summary>
[PropertyName("hasFireRate")]
public ObjectProperty<bool> HasFireRate { get; internal set; }

/// <summary>
///
/// </summary>
[PropertyName("addShowOnCamMode")]
public ObjectProperty<int> AddShowOnCamMode { get; internal set; }

/// <summary>
///
/// </summary>
[PropertyName("showClips")]
public ObjectProperty<bool> ShowClips { get; internal set; }

/// <summary>
///
/// </summary>
[PropertyName("displaySelectOnActivation")]
public ObjectProperty<bool> DisplaySelectOnActivation { get; internal set; }

/// <summary>
///
/// </summary>
[PropertyName("overheatSound")]
public ObjectProperty<string> OverheatSound { get; internal set; }

/// <summary>
///
/// </summary>
[PropertyName("crosshairIcon")]
public ObjectProperty<string> CrosshairIcon { get; internal set; }

/// <summary>
///
/// </summary>
[PropertyName("crosshairIconSize")]
public ObjectProperty<int> CrosshairIconSize { get; internal set; }

/// <summary>
///
/// </summary>
[PropertyName("altCrosshairIcon")]
public ObjectProperty<string> AltCrosshairIcon { get; internal set; }

/// <summary>
///
/// </summary>
[PropertyName("enableMouse")]
public ObjectProperty<bool> EnableMouse { get; internal set; }

/// <summary>
///
/// </summary>
[PropertyName("enablePostProcessingOnGuiIndex")]
public ObjectProperty<int> EnablePostProcessingOnGuiIndex { get; internal set; }

public WeaponHud(string name, Token token) : base("WeaponHud", token)
{

Expand Down
2 changes: 1 addition & 1 deletion BF2ScriptingEngine/Scripting/ValueInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ public string ToFileFormat()
else if (propertyType == typeof(Double))
{
double dVal = (double)Convert.ChangeType(value, TypeCode.Double);
return dVal.ToString("0.0###", CultureInfo.InvariantCulture);
return dVal.ToString("0.####", CultureInfo.InvariantCulture);
}
else if (propertyType == typeof(Decimal))
{
Expand Down
Loading

0 comments on commit c01a77d

Please sign in to comment.