Skip to content

Commit 5c1bfc8

Browse files
committed
add-modifiers-to-firemodes
1 parent 48ca915 commit 5c1bfc8

File tree

3 files changed

+57
-7
lines changed

3 files changed

+57
-7
lines changed

Content.Shared/Weapons/Ranged/Components/BatteryWeaponFireModesComponent.cs

+39-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
using Content.Shared.Weapons.Ranged.Systems;
2+
using Robust.Shared.Audio;
23
using Robust.Shared.GameStates;
34
using Robust.Shared.Prototypes;
45
using Robust.Shared.Serialization;
@@ -45,10 +46,10 @@ public sealed partial class BatteryWeaponFireMode
4546
public string? FireModeName;
4647

4748
/// <summary>
48-
/// Sound of a gunshot that is used in the selected fire mode
49+
/// Gun modifiers of this fire mode
4950
/// </summary>
5051
[DataField]
51-
public string? SoundGunshot;
52+
public FireModeGunModifiers? GunModifiers;
5253

5354
/// <summary>
5455
/// Sprite of the remaining charge that is used in the selected fire mode
@@ -63,3 +64,39 @@ public sealed partial class BatteryWeaponFireMode
6364
[DataField]
6465
public float FireCost = 100;
6566
}
67+
68+
//SS220 Add firemode modificators begin
69+
/// <summary>
70+
/// Gun modifiers that can be applied in each fire mode
71+
/// </summary>
72+
[DataDefinition, Serializable, NetSerializable]
73+
public sealed partial class FireModeGunModifiers
74+
{
75+
[DataField]
76+
public SoundSpecifier? SoundGunshot;
77+
78+
[DataField]
79+
public float? CameraRecoilScala;
80+
81+
[DataField]
82+
public Angle? AngleIncrease;
83+
84+
[DataField]
85+
public Angle? AngleDecay;
86+
87+
[DataField]
88+
public Angle? MaxAngle;
89+
90+
[DataField]
91+
public Angle? MinAngle;
92+
93+
[DataField]
94+
public int? ShotsPerBurst;
95+
96+
[DataField]
97+
public float? FireRate;
98+
99+
[DataField]
100+
public float? ProjectileSpeed;
101+
}
102+
//SS220 Add firemode modificators end

Content.Shared/Weapons/Ranged/Systems/BatteryWeaponFireModesSystem.cs

+12-2
Original file line numberDiff line numberDiff line change
@@ -216,8 +216,18 @@ private void OnRefreshModifiers(Entity<BatteryWeaponFireModesComponent> ent, ref
216216
{
217217
var firemode = GetMode(ent.Comp);
218218

219-
if (firemode.SoundGunshot is not null)
220-
args.SoundGunshot = new SoundPathSpecifier(firemode.SoundGunshot);
219+
if (firemode.GunModifiers is not { } modifiers ||
220+
!TryComp<GunComponent>(ent.Owner, out var gunComponent))
221+
return;
222+
223+
args.SoundGunshot = modifiers.SoundGunshot ?? gunComponent.SoundGunshot;
224+
args.AngleIncrease = modifiers.AngleIncrease ?? gunComponent.AngleIncrease;
225+
args.AngleDecay = modifiers.AngleDecay ?? gunComponent.AngleDecay;
226+
args.MaxAngle = modifiers.MaxAngle ?? gunComponent.MaxAngle;
227+
args.MinAngle = modifiers.MinAngle ?? gunComponent.MinAngle;
228+
args.ShotsPerBurst = modifiers.ShotsPerBurst ?? gunComponent.ShotsPerBurst;
229+
args.FireRate = modifiers.FireRate ?? gunComponent.FireRate;
230+
args.ProjectileSpeed = modifiers.ProjectileSpeed ?? gunComponent.ProjectileSpeed;
221231
}
222232
//SS220 Add Multifaze gun end
223233
}

Resources/Prototypes/SS220/Entities/Objects/Weapons/Guns/multiphase_energy_gun.yml

+6-3
Original file line numberDiff line numberDiff line change
@@ -20,17 +20,20 @@
2020
- proto: BulletDisabler
2121
name: firemode-name-disabler
2222
fireCost: 40
23-
soundGunshot: /Audio/Weapons/Guns/Gunshots/taser2.ogg
23+
gunModifiers:
24+
soundGunshot: /Audio/Weapons/Guns/Gunshots/taser2.ogg
2425
magState: disabler-mag
2526
- proto: RedMediumLaser
2627
name: firemode-name-laser
2728
fireCost: 62.5
28-
soundGunshot: /Audio/Weapons/Guns/Gunshots/laser_cannon.ogg
29+
gunModifiers:
30+
soundGunshot: /Audio/Weapons/Guns/Gunshots/laser_cannon.ogg
2931
magState: laser-mag
3032
- proto: BulletEMP
3133
name: firemode-name-emp
3234
fireCost: 200
33-
soundGunshot: /Audio/Weapons/Guns/Gunshots/taser.ogg
35+
gunModifiers:
36+
soundGunshot: /Audio/Weapons/Guns/Gunshots/taser.ogg
3437
magState: emp-mag
3538
- type: ProjectileBatteryAmmoProvider
3639
proto: BulletDisabler

0 commit comments

Comments
 (0)