Skip to content

Commit

Permalink
add-modifiers-to-firemodes
Browse files Browse the repository at this point in the history
  • Loading branch information
Kirus59 committed Dec 7, 2024
1 parent 48ca915 commit 5c1bfc8
Show file tree
Hide file tree
Showing 3 changed files with 57 additions and 7 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using Content.Shared.Weapons.Ranged.Systems;
using Robust.Shared.Audio;
using Robust.Shared.GameStates;
using Robust.Shared.Prototypes;
using Robust.Shared.Serialization;
Expand Down Expand Up @@ -45,10 +46,10 @@ public sealed partial class BatteryWeaponFireMode
public string? FireModeName;

/// <summary>
/// Sound of a gunshot that is used in the selected fire mode
/// Gun modifiers of this fire mode
/// </summary>
[DataField]
public string? SoundGunshot;
public FireModeGunModifiers? GunModifiers;

/// <summary>
/// Sprite of the remaining charge that is used in the selected fire mode
Expand All @@ -63,3 +64,39 @@ public sealed partial class BatteryWeaponFireMode
[DataField]
public float FireCost = 100;
}

//SS220 Add firemode modificators begin
/// <summary>
/// Gun modifiers that can be applied in each fire mode
/// </summary>
[DataDefinition, Serializable, NetSerializable]
public sealed partial class FireModeGunModifiers
{
[DataField]
public SoundSpecifier? SoundGunshot;

[DataField]
public float? CameraRecoilScala;

[DataField]
public Angle? AngleIncrease;

[DataField]
public Angle? AngleDecay;

[DataField]
public Angle? MaxAngle;

[DataField]
public Angle? MinAngle;

[DataField]
public int? ShotsPerBurst;

[DataField]
public float? FireRate;

[DataField]
public float? ProjectileSpeed;
}
//SS220 Add firemode modificators end
Original file line number Diff line number Diff line change
Expand Up @@ -216,8 +216,18 @@ private void OnRefreshModifiers(Entity<BatteryWeaponFireModesComponent> ent, ref
{
var firemode = GetMode(ent.Comp);

if (firemode.SoundGunshot is not null)
args.SoundGunshot = new SoundPathSpecifier(firemode.SoundGunshot);
if (firemode.GunModifiers is not { } modifiers ||
!TryComp<GunComponent>(ent.Owner, out var gunComponent))
return;

args.SoundGunshot = modifiers.SoundGunshot ?? gunComponent.SoundGunshot;
args.AngleIncrease = modifiers.AngleIncrease ?? gunComponent.AngleIncrease;
args.AngleDecay = modifiers.AngleDecay ?? gunComponent.AngleDecay;
args.MaxAngle = modifiers.MaxAngle ?? gunComponent.MaxAngle;
args.MinAngle = modifiers.MinAngle ?? gunComponent.MinAngle;
args.ShotsPerBurst = modifiers.ShotsPerBurst ?? gunComponent.ShotsPerBurst;
args.FireRate = modifiers.FireRate ?? gunComponent.FireRate;
args.ProjectileSpeed = modifiers.ProjectileSpeed ?? gunComponent.ProjectileSpeed;
}
//SS220 Add Multifaze gun end
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,17 +20,20 @@
- proto: BulletDisabler
name: firemode-name-disabler
fireCost: 40
soundGunshot: /Audio/Weapons/Guns/Gunshots/taser2.ogg
gunModifiers:
soundGunshot: /Audio/Weapons/Guns/Gunshots/taser2.ogg
magState: disabler-mag
- proto: RedMediumLaser
name: firemode-name-laser
fireCost: 62.5
soundGunshot: /Audio/Weapons/Guns/Gunshots/laser_cannon.ogg
gunModifiers:
soundGunshot: /Audio/Weapons/Guns/Gunshots/laser_cannon.ogg
magState: laser-mag
- proto: BulletEMP
name: firemode-name-emp
fireCost: 200
soundGunshot: /Audio/Weapons/Guns/Gunshots/taser.ogg
gunModifiers:
soundGunshot: /Audio/Weapons/Guns/Gunshots/taser.ogg
magState: emp-mag
- type: ProjectileBatteryAmmoProvider
proto: BulletDisabler
Expand Down

0 comments on commit 5c1bfc8

Please sign in to comment.