Skip to content
This repository has been archived by the owner on Jan 6, 2022. It is now read-only.

Revert 434 modable burst fire rate #578

Open
wants to merge 2 commits into
base: revert-449-renderer-config
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions Sources/Sandbox.Game/Definitions/MyWeaponDefinition.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,18 +18,16 @@ public class MyWeaponDefinition : MyDefinitionBase
public class MyWeaponAmmoData
{
public int RateOfFire; // rounds per minute (round == 1 bullet)
public int BurstFireRate;
public MySoundPair ShootSound;
public int ShootIntervalInMiliseconds; // derivative of Rate of fire

public MyWeaponAmmoData(MyObjectBuilder_WeaponDefinition.WeaponAmmoData data) : this(data.RateOfFire, data.ShootSoundName, data.BurstFireRate)
public MyWeaponAmmoData(MyObjectBuilder_WeaponDefinition.WeaponAmmoData data) : this(data.RateOfFire, data.ShootSoundName)
{
}

public MyWeaponAmmoData(int rateOfFire, string soundName, int burstFireRate)
public MyWeaponAmmoData(int rateOfFire, string soundName)
{
this.RateOfFire = rateOfFire;
this.BurstFireRate = burstFireRate;
this.ShootSound = new MySoundPair(soundName);
this.ShootIntervalInMiliseconds = (int)(1000 / (RateOfFire * oneSixtieth));
}
Expand Down
5 changes: 0 additions & 5 deletions Sources/Sandbox.Game/Game/Weapons/Ammo/MyAmmoConstants.cs
Original file line number Diff line number Diff line change
Expand Up @@ -88,11 +88,6 @@ public int CurrentWeaponRateOfFire
get { return m_weaponDefinition.WeaponAmmoDatas[(int)AmmoDefinition.AmmoType].RateOfFire; }
}

public int CurrentWeaponBurstFireRate
{
get { return m_weaponDefinition.WeaponAmmoDatas[(int)AmmoDefinition.AmmoType].BurstFireRate; }
}

public int CurrentWeaponShootIntervalInMiliseconds
{
get { return m_weaponDefinition.WeaponAmmoDatas[(int)AmmoDefinition.AmmoType].ShootIntervalInMiliseconds; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,18 +24,11 @@ class MyLargeMissileBarrel : MyLargeBarrelBase
private int m_burstFireTime_ms = 0;
private int m_burstFireTimeLoadingIntervalConst_ms = 2000;
private bool m_burstFinish = false;
private const int m_burstFireCount = 4;
private int m_burstToFire = 0;

private MyEntity3DSoundEmitter m_soundEmitter;

private int BurstFireRate
{
get
{
return this.GunBase.BurstFireRate;
}
}

public MyLargeMissileBarrel()
{
m_soundEmitter = new MyEntity3DSoundEmitter(m_entity);
Expand All @@ -56,7 +49,7 @@ public override void Init(MyEntity entity, MyLargeTurretBase turretBase)

public void Init(Matrix localMatrix, MyLargeTurretBase parentObject)
{
m_burstToFire = BurstFireRate;
m_burstToFire = m_burstFireCount;
m_burstFireTime_ms = MySandboxGame.TotalGamePlayTimeInMilliseconds;

m_burstFireTime_ms = MySandboxGame.TotalGamePlayTimeInMilliseconds;
Expand Down Expand Up @@ -97,7 +90,7 @@ public override bool StartShooting()
MyHud.Notifications.Add(reloadingNotification);
}
m_burstFireTime_ms = MySandboxGame.TotalGamePlayTimeInMilliseconds;
m_burstToFire = BurstFireRate;
m_burstToFire = m_burstFireCount;
m_burstFinish = true;
}
if ((MySandboxGame.TotalGamePlayTimeInMilliseconds - m_burstFireTime_ms) > m_burstFireTimeLoadingIntervalConst_ms)
Expand Down
1 change: 0 additions & 1 deletion Sources/Sandbox.Game/Game/Weapons/Guns/MyGunBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,6 @@ public float BackkickForcePerSecond
public bool HasAmmoMagazines { get { return m_weaponProperties.WeaponDefinition.HasAmmoMagazines(); } }
public bool IsAmmoProjectile { get { return m_weaponProperties.IsAmmoProjectile; } }
public bool IsAmmoMissile { get { return m_weaponProperties.IsAmmoMissile; } }
public int BurstFireRate { get { return m_weaponProperties.CurrentWeaponBurstFireRate; } }

public bool HasDummies { get { return m_dummiesByAmmoType.Count > 0; } }
public MatrixD WorldMatrix
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,19 +21,12 @@ namespace Sandbox.Game.Weapons
[MyCubeBlockType(typeof(MyObjectBuilder_SmallMissileLauncherReload))]
class MySmallMissileLauncherReload : MySmallMissileLauncher, IMySmallMissileLauncherReload
{
const int NUM_ROCKETS_TO_COOLDOWN = 4;
const int COOLDOWN_TIME_MILISECONDS = 5000;
int m_numRocketsShot = 0;

private static readonly MyHudNotification MISSILE_RELOAD_NOTIFICATION = new MyHudNotification( MySpaceTexts.MissileLauncherReloadingNotification, COOLDOWN_TIME_MILISECONDS, level: MyNotificationLevel.Important);

private int BurstFireRate
{
get
{
return this.GunBase.BurstFireRate;
}
}

static MySmallMissileLauncherReload()
{
var useConveyor = new MyTerminalControlOnOffSwitch<MySmallMissileLauncher>("UseConveyor", MySpaceTexts.Terminal_UseConveyorSystem);
Expand All @@ -47,19 +40,19 @@ static MySmallMissileLauncherReload()
override public void Shoot(MyShootActionEnum action, Vector3 direction, string gunAction)
{
//small reloadable launcher have cooldown
if ((BurstFireRate == m_numRocketsShot) && (COOLDOWN_TIME_MILISECONDS > MySandboxGame.TotalGamePlayTimeInMilliseconds - m_lastTimeShoot))
if ((NUM_ROCKETS_TO_COOLDOWN == m_numRocketsShot) && (COOLDOWN_TIME_MILISECONDS > MySandboxGame.TotalGamePlayTimeInMilliseconds - m_lastTimeShoot))
{
return;
}
if (BurstFireRate == m_numRocketsShot)
if (NUM_ROCKETS_TO_COOLDOWN == m_numRocketsShot)
{
m_numRocketsShot = 0;
}
m_numRocketsShot++;

base.Shoot(action, direction, gunAction);

if (m_numRocketsShot == BurstFireRate)
if (m_numRocketsShot == NUM_ROCKETS_TO_COOLDOWN)
{
MyHud.Notifications.Add(MISSILE_RELOAD_NOTIFICATION);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,6 @@ public class WeaponAmmoData

[XmlAttribute]
public string ShootSoundName;

[XmlAttribute]
public int BurstFireRate = 4;
}

[ProtoContract]
Expand Down