GUNS PELASE WORK.
This commit is contained in:
@@ -104,7 +104,7 @@ namespace Content.Server.GameObjects.Components.Weapon.Ranged.Ammunition
|
||||
}
|
||||
}
|
||||
|
||||
public IEntity TakeBullet()
|
||||
public IEntity TakeBullet(GridCoordinates spawnAt)
|
||||
{
|
||||
if (_ammoIsProjectile)
|
||||
{
|
||||
@@ -122,7 +122,7 @@ namespace Content.Server.GameObjects.Components.Weapon.Ranged.Ammunition
|
||||
appearanceComponent.SetData(AmmoVisuals.Spent, true);
|
||||
}
|
||||
|
||||
var entity = Owner.EntityManager.SpawnEntity(_projectileId, Owner.Transform.GridPosition);
|
||||
var entity = Owner.EntityManager.SpawnEntity(_projectileId, spawnAt);
|
||||
DebugTools.AssertNotNull(entity);
|
||||
return entity;
|
||||
}
|
||||
|
||||
@@ -16,6 +16,7 @@ using Robust.Shared.GameObjects.Systems;
|
||||
using Robust.Shared.Interfaces.GameObjects;
|
||||
using Robust.Shared.IoC;
|
||||
using Robust.Shared.Localization;
|
||||
using Robust.Shared.Map;
|
||||
using Robust.Shared.Serialization;
|
||||
|
||||
namespace Content.Server.GameObjects.Components.Weapon.Ranged.Barrels
|
||||
@@ -161,14 +162,14 @@ namespace Content.Server.GameObjects.Components.Weapon.Ranged.Barrels
|
||||
return _chamberContainer.ContainedEntity;
|
||||
}
|
||||
|
||||
public override IEntity TakeProjectile()
|
||||
public override IEntity TakeProjectile(GridCoordinates spawnAt)
|
||||
{
|
||||
var chamberEntity = _chamberContainer.ContainedEntity;
|
||||
if (_autoCycle)
|
||||
{
|
||||
Cycle();
|
||||
}
|
||||
return chamberEntity?.GetComponent<AmmoComponent>().TakeBullet();
|
||||
return chamberEntity?.GetComponent<AmmoComponent>().TakeBullet(spawnAt);
|
||||
}
|
||||
|
||||
protected override bool WeaponCanFire()
|
||||
|
||||
@@ -14,6 +14,7 @@ using Robust.Shared.GameObjects.Systems;
|
||||
using Robust.Shared.Interfaces.GameObjects;
|
||||
using Robust.Shared.IoC;
|
||||
using Robust.Shared.Localization;
|
||||
using Robust.Shared.Map;
|
||||
using Robust.Shared.Serialization;
|
||||
|
||||
namespace Content.Server.GameObjects.Components.Weapon.Ranged.Barrels
|
||||
@@ -122,14 +123,14 @@ namespace Content.Server.GameObjects.Components.Weapon.Ranged.Barrels
|
||||
return _chamberContainer.ContainedEntity;
|
||||
}
|
||||
|
||||
public override IEntity TakeProjectile()
|
||||
public override IEntity TakeProjectile(GridCoordinates spawnAt)
|
||||
{
|
||||
var chamberEntity = _chamberContainer.ContainedEntity;
|
||||
if (!_manualCycle)
|
||||
{
|
||||
Cycle();
|
||||
}
|
||||
return chamberEntity?.GetComponent<AmmoComponent>().TakeBullet();
|
||||
return chamberEntity?.GetComponent<AmmoComponent>().TakeBullet(spawnAt);
|
||||
}
|
||||
|
||||
private void Cycle(bool manual = false)
|
||||
|
||||
@@ -15,6 +15,7 @@ using Robust.Shared.Interfaces.GameObjects;
|
||||
using Robust.Shared.Interfaces.Random;
|
||||
using Robust.Shared.IoC;
|
||||
using Robust.Shared.Localization;
|
||||
using Robust.Shared.Map;
|
||||
using Robust.Shared.Serialization;
|
||||
|
||||
namespace Content.Server.GameObjects.Components.Weapon.Ranged.Barrels
|
||||
@@ -169,16 +170,17 @@ namespace Content.Server.GameObjects.Components.Weapon.Ranged.Barrels
|
||||
/// Takes a projectile out if possible
|
||||
/// IEnumerable just to make supporting shotguns saner
|
||||
/// </summary>
|
||||
/// <param name="spawnAt"></param>
|
||||
/// <returns></returns>
|
||||
/// <exception cref="NotImplementedException"></exception>
|
||||
public override IEntity TakeProjectile()
|
||||
public override IEntity TakeProjectile(GridCoordinates spawnAt)
|
||||
{
|
||||
var ammo = _ammoSlots[_currentSlot];
|
||||
IEntity bullet = null;
|
||||
if (ammo != null)
|
||||
{
|
||||
var ammoComponent = ammo.GetComponent<AmmoComponent>();
|
||||
bullet = ammoComponent.TakeBullet();
|
||||
bullet = ammoComponent.TakeBullet(spawnAt);
|
||||
if (ammoComponent.Caseless)
|
||||
{
|
||||
_ammoSlots[_currentSlot] = null;
|
||||
|
||||
@@ -14,6 +14,7 @@ using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.GameObjects.Systems;
|
||||
using Robust.Shared.Interfaces.GameObjects;
|
||||
using Robust.Shared.IoC;
|
||||
using Robust.Shared.Map;
|
||||
using Robust.Shared.Serialization;
|
||||
using Robust.Shared.ViewVariables;
|
||||
using Logger = Robust.Shared.Log.Logger;
|
||||
@@ -134,7 +135,7 @@ namespace Content.Server.GameObjects.Components.Weapon.Ranged.Barrels
|
||||
return ammo;
|
||||
}
|
||||
|
||||
public override IEntity TakeProjectile()
|
||||
public override IEntity TakeProjectile(GridCoordinates spawnAt)
|
||||
{
|
||||
var powerCellEntity = _powerCellContainer.ContainedEntity;
|
||||
|
||||
|
||||
@@ -15,6 +15,7 @@ using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.GameObjects.Systems;
|
||||
using Robust.Shared.Interfaces.GameObjects;
|
||||
using Robust.Shared.Localization;
|
||||
using Robust.Shared.Map;
|
||||
using Robust.Shared.Serialization;
|
||||
using Robust.Shared.ViewVariables;
|
||||
|
||||
@@ -180,7 +181,7 @@ namespace Content.Server.GameObjects.Components.Weapon.Ranged.Barrels
|
||||
return BoltOpen ? null : _chamberContainer.ContainedEntity;
|
||||
}
|
||||
|
||||
public override IEntity TakeProjectile()
|
||||
public override IEntity TakeProjectile(GridCoordinates spawnAt)
|
||||
{
|
||||
if (BoltOpen)
|
||||
{
|
||||
@@ -189,7 +190,7 @@ namespace Content.Server.GameObjects.Components.Weapon.Ranged.Barrels
|
||||
var entity = _chamberContainer.ContainedEntity;
|
||||
|
||||
Cycle();
|
||||
return entity?.GetComponent<AmmoComponent>().TakeBullet();
|
||||
return entity?.GetComponent<AmmoComponent>().TakeBullet(spawnAt);
|
||||
}
|
||||
|
||||
private void Cycle(bool manual = false)
|
||||
|
||||
@@ -56,7 +56,7 @@ namespace Content.Server.GameObjects.Components.Weapon.Ranged.Barrels
|
||||
private TimeSpan _lastFire;
|
||||
|
||||
public abstract IEntity PeekAmmo();
|
||||
public abstract IEntity TakeProjectile();
|
||||
public abstract IEntity TakeProjectile(GridCoordinates spawnAt);
|
||||
|
||||
// Recoil / spray control
|
||||
private Angle _minAngle;
|
||||
@@ -193,7 +193,7 @@ namespace Content.Server.GameObjects.Components.Weapon.Ranged.Barrels
|
||||
}
|
||||
|
||||
var ammo = PeekAmmo();
|
||||
var projectile = TakeProjectile();
|
||||
var projectile = TakeProjectile(shooter.Transform.GridPosition);
|
||||
if (projectile == null)
|
||||
{
|
||||
soundSystem.PlayAtCoords(_soundEmpty, Owner.Transform.GridPosition);
|
||||
|
||||
Reference in New Issue
Block a user