Crossbow (#327)
* Add powered crossbow * Add spear embedding (#18578) * Add spear embedding * fuck this copy-paste * Juicier * the river * Add crossbow embedding * Fix crossbow construction * Finish crossbow * Remove unused --------- Co-authored-by: metalgearsloth <31366439+metalgearsloth@users.noreply.github.com>
This commit is contained in:
@@ -167,6 +167,16 @@ public partial class GunComponent : Component
|
||||
/// </summary>
|
||||
[DataField("clumsyProof"), ViewVariables(VVAccess.ReadWrite)]
|
||||
public bool ClumsyProof = false;
|
||||
|
||||
// WD START
|
||||
[DataField("forceThrowingAngle")]
|
||||
[ViewVariables(VVAccess.ReadWrite)]
|
||||
public bool ForceThrowingAngle;
|
||||
|
||||
[DataField("angle")]
|
||||
[ViewVariables(VVAccess.ReadWrite)]
|
||||
public Angle Angle;
|
||||
// WD END
|
||||
}
|
||||
|
||||
[Flags]
|
||||
|
||||
@@ -2,6 +2,7 @@ using Content.Shared.DoAfter;
|
||||
using Content.Shared.Examine;
|
||||
using Content.Shared.Interaction;
|
||||
using Content.Shared.Interaction.Events;
|
||||
using Content.Shared.Stacks;
|
||||
using Content.Shared.Verbs;
|
||||
using Content.Shared.Weapons.Ranged.Components;
|
||||
using Content.Shared.Weapons.Ranged.Events;
|
||||
@@ -47,8 +48,17 @@ public abstract partial class SharedGunSystem
|
||||
if (GetBallisticShots(component) >= component.Capacity)
|
||||
return;
|
||||
|
||||
component.Entities.Add(args.Used);
|
||||
Containers.Insert(args.Used, component.Container);
|
||||
var entity = args.Used; // WD EDIT START
|
||||
var doInsert = true;
|
||||
if (TryComp(args.Used, out StackComponent? stack) && stack.Count > 1)
|
||||
{
|
||||
entity = GetStackEntity(args.Used, stack);
|
||||
doInsert = false;
|
||||
}
|
||||
|
||||
component.Entities.Add(entity);
|
||||
if (_netManager.IsServer || doInsert)
|
||||
Containers.Insert(entity, component.Container); // WD EDIT END
|
||||
// Not predicted so
|
||||
Audio.PlayPredicted(component.SoundInsert, uid, args.User);
|
||||
args.Handled = true;
|
||||
@@ -56,6 +66,8 @@ public abstract partial class SharedGunSystem
|
||||
Dirty(uid, component);
|
||||
}
|
||||
|
||||
protected virtual EntityUid GetStackEntity(EntityUid uid, StackComponent stack) { return uid; }
|
||||
|
||||
private void OnBallisticAfterInteract(EntityUid uid, BallisticAmmoProviderComponent component, AfterInteractEvent args)
|
||||
{
|
||||
if (args.Handled ||
|
||||
|
||||
Reference in New Issue
Block a user