Add events for GunComponent values, muzzle flashes and cartridge spread (#24077)
* Add a modifier event for GunComponent values * Add docs * Add VV readwrite to modified values * Add more docs * More docs * Add Gun parameter to GunRefreshModifiersEvent * Add another event for handling cartridge spread * Fix pneumatic speed
This commit is contained in:
@@ -56,11 +56,11 @@ public sealed class GunSpreadOverlay : Overlay
|
||||
return;
|
||||
|
||||
// (☞゚ヮ゚)☞
|
||||
var maxSpread = gun.MaxAngle;
|
||||
var minSpread = gun.MinAngle;
|
||||
var maxSpread = gun.MaxAngleModified;
|
||||
var minSpread = gun.MinAngleModified;
|
||||
var timeSinceLastFire = (_timing.CurTime - gun.NextFire).TotalSeconds;
|
||||
var currentAngle = new Angle(MathHelper.Clamp(gun.CurrentAngle.Theta - gun.AngleDecay.Theta * timeSinceLastFire,
|
||||
gun.MinAngle.Theta, gun.MaxAngle.Theta));
|
||||
var currentAngle = new Angle(MathHelper.Clamp(gun.CurrentAngle.Theta - gun.AngleDecayModified.Theta * timeSinceLastFire,
|
||||
gun.MinAngleModified.Theta, gun.MaxAngleModified.Theta));
|
||||
var direction = (mousePos.Position - mapPos.Position);
|
||||
|
||||
worldHandle.DrawLine(mapPos.Position, mousePos.Position + direction, Color.Orange);
|
||||
|
||||
@@ -3,7 +3,6 @@ using Content.Client.Items;
|
||||
using Content.Client.Weapons.Ranged.Components;
|
||||
using Content.Shared.Camera;
|
||||
using Content.Shared.CombatMode;
|
||||
using Robust.Shared.Spawners;
|
||||
using Content.Shared.Weapons.Ranged;
|
||||
using Content.Shared.Weapons.Ranged.Components;
|
||||
using Content.Shared.Weapons.Ranged.Events;
|
||||
@@ -195,7 +194,7 @@ public sealed partial class GunSystem : SharedGunSystem
|
||||
{
|
||||
if (throwItems)
|
||||
{
|
||||
Recoil(user, direction, gun.CameraRecoilScalar);
|
||||
Recoil(user, direction, gun.CameraRecoilScalarModified);
|
||||
if (IsClientSide(ent!.Value))
|
||||
Del(ent.Value);
|
||||
else
|
||||
@@ -210,8 +209,8 @@ public sealed partial class GunSystem : SharedGunSystem
|
||||
{
|
||||
SetCartridgeSpent(ent!.Value, cartridge, true);
|
||||
MuzzleFlash(gunUid, cartridge, user);
|
||||
Audio.PlayPredicted(gun.SoundGunshot, gunUid, user);
|
||||
Recoil(user, direction, gun.CameraRecoilScalar);
|
||||
Audio.PlayPredicted(gun.SoundGunshotModified, gunUid, user);
|
||||
Recoil(user, direction, gun.CameraRecoilScalarModified);
|
||||
// TODO: Can't predict entity deletions.
|
||||
//if (cartridge.DeleteOnSpawn)
|
||||
// Del(cartridge.Owner);
|
||||
@@ -228,16 +227,16 @@ public sealed partial class GunSystem : SharedGunSystem
|
||||
break;
|
||||
case AmmoComponent newAmmo:
|
||||
MuzzleFlash(gunUid, newAmmo, user);
|
||||
Audio.PlayPredicted(gun.SoundGunshot, gunUid, user);
|
||||
Recoil(user, direction, gun.CameraRecoilScalar);
|
||||
Audio.PlayPredicted(gun.SoundGunshotModified, gunUid, user);
|
||||
Recoil(user, direction, gun.CameraRecoilScalarModified);
|
||||
if (IsClientSide(ent!.Value))
|
||||
Del(ent.Value);
|
||||
else
|
||||
RemoveShootable(ent.Value);
|
||||
break;
|
||||
case HitscanPrototype:
|
||||
Audio.PlayPredicted(gun.SoundGunshot, gunUid, user);
|
||||
Recoil(user, direction, gun.CameraRecoilScalar);
|
||||
Audio.PlayPredicted(gun.SoundGunshotModified, gunUid, user);
|
||||
Recoil(user, direction, gun.CameraRecoilScalarModified);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user