Disposable turret explodes when empty (#18175)
* turret go boom * fix ammo * universal function name * Also explodes when destroyed * comment added * Triggerwhenemptycomponent added * comment adjusted * Updated uplink description * Moved to own event file * file namespace * rerun tests --------- Co-authored-by: Slava0135 <super.novalskiy_0135@inbox.ru>
This commit is contained in:
@@ -130,15 +130,14 @@ public abstract partial class SharedGunSystem
|
||||
|
||||
private void OnBallisticVerb(EntityUid uid, BallisticAmmoProviderComponent component, GetVerbsEvent<Verb> args)
|
||||
{
|
||||
if (!args.CanAccess || !args.CanInteract || args.Hands == null)
|
||||
if (!args.CanAccess || !args.CanInteract || args.Hands == null || !component.Cycleable)
|
||||
return;
|
||||
if (component.Cycleable == true)
|
||||
args.Verbs.Add(new Verb()
|
||||
{
|
||||
Text = Loc.GetString("gun-ballistic-cycle"),
|
||||
Disabled = GetBallisticShots(component) == 0,
|
||||
Act = () => ManualCycle(uid, component, Transform(uid).MapPosition, args.User),
|
||||
});
|
||||
args.Verbs.Add(new Verb()
|
||||
{
|
||||
Text = Loc.GetString("gun-ballistic-cycle"),
|
||||
Disabled = GetBallisticShots(component) == 0,
|
||||
Act = () => ManualCycle(uid, component, Transform(uid).MapPosition, args.User),
|
||||
});
|
||||
}
|
||||
|
||||
private void OnBallisticExamine(EntityUid uid, BallisticAmmoProviderComponent component, ExaminedEvent args)
|
||||
@@ -151,6 +150,9 @@ public abstract partial class SharedGunSystem
|
||||
|
||||
private void ManualCycle(EntityUid uid, BallisticAmmoProviderComponent component, MapCoordinates coordinates, EntityUid? user = null, GunComponent? gunComp = null)
|
||||
{
|
||||
if (!component.Cycleable)
|
||||
return;
|
||||
|
||||
// Reset shotting for cycling
|
||||
if (Resolve(uid, ref gunComp, false) &&
|
||||
gunComp is { FireRate: > 0f } &&
|
||||
|
||||
Reference in New Issue
Block a user