This commit is contained in:
Clyybber
2020-05-23 17:23:25 +02:00
committed by GitHub
parent 05b910d9db
commit 1ad9a10050
40 changed files with 200 additions and 199 deletions

View File

@@ -25,7 +25,7 @@ using Robust.Shared.Utility;
namespace Content.Server.GameObjects.Components.Weapon.Ranged.Hitscan
{
[RegisterComponent]
public class HitscanWeaponComponent : Component, IAttackBy
public class HitscanWeaponComponent : Component, IInteractUsing
{
private const float MaxLength = 20;
public override string Name => "HitscanWeapon";
@@ -68,9 +68,9 @@ namespace Content.Server.GameObjects.Components.Weapon.Ranged.Hitscan
}
public bool AttackBy(AttackByEventArgs eventArgs)
public bool InteractUsing(InteractUsingEventArgs eventArgs)
{
if (!eventArgs.AttackWith.TryGetComponent(out PowerStorageComponent component))
if (!eventArgs.Using.TryGetComponent(out PowerStorageComponent component))
{
return false;
}

View File

@@ -15,7 +15,7 @@ using Robust.Shared.ViewVariables;
namespace Content.Server.GameObjects.Components.Weapon.Ranged.Projectile
{
[RegisterComponent]
public class AmmoBoxComponent : Component, IAttackBy, IMapInit
public class AmmoBoxComponent : Component, IInteractUsing, IMapInit
// TODO: Potential improvements:
// Add verbs for stack splitting
// Behaviour is largely the same as BallisticMagazine except you can't insert it into a gun.
@@ -145,12 +145,12 @@ namespace Content.Server.GameObjects.Components.Weapon.Ranged.Projectile
}
}
bool IAttackBy.AttackBy(AttackByEventArgs eventArgs)
bool IInteractUsing.InteractUsing(InteractUsingEventArgs eventArgs)
{
var ammoBoxTransfer = CanTransferFrom(eventArgs.AttackWith);
var ammoBoxTransfer = CanTransferFrom(eventArgs.Using);
if (ammoBoxTransfer.Result) {
IEntity bullet;
if (eventArgs.AttackWith.TryGetComponent(out BallisticMagazineComponent magazineComponent))
if (eventArgs.Using.TryGetComponent(out BallisticMagazineComponent magazineComponent))
{
int fillCount = Math.Min(magazineComponent.CountLoaded, Capacity - CountLeft);
for (int i = 0; i < fillCount; i++)
@@ -161,7 +161,7 @@ namespace Content.Server.GameObjects.Components.Weapon.Ranged.Projectile
eventArgs.User.PopupMessage(eventArgs.User, $"Transferred {fillCount} rounds");
return true;
}
if (eventArgs.AttackWith.TryGetComponent(out AmmoBoxComponent boxComponent))
if (eventArgs.Using.TryGetComponent(out AmmoBoxComponent boxComponent))
{
int fillCount = Math.Min(boxComponent.CountLeft, Capacity - CountLeft);
for (int i = 0; i < fillCount; i++)

View File

@@ -15,7 +15,7 @@ using Robust.Shared.ViewVariables;
namespace Content.Server.GameObjects.Components.Weapon.Ranged.Projectile
{
[RegisterComponent]
public class BallisticMagazineComponent : Component, IMapInit, IAttackBy
public class BallisticMagazineComponent : Component, IMapInit, IInteractUsing
{
public override string Name => "BallisticMagazine";
@@ -189,12 +189,12 @@ namespace Content.Server.GameObjects.Components.Weapon.Ranged.Projectile
}
}
bool IAttackBy.AttackBy(AttackByEventArgs eventArgs)
bool IInteractUsing.InteractUsing(InteractUsingEventArgs eventArgs)
{
var ammoMagTransfer = CanTransferFrom(eventArgs.AttackWith);
var ammoMagTransfer = CanTransferFrom(eventArgs.Using);
if (ammoMagTransfer.Result) {
IEntity bullet;
if (eventArgs.AttackWith.TryGetComponent(out BallisticMagazineComponent magazineComponent))
if (eventArgs.Using.TryGetComponent(out BallisticMagazineComponent magazineComponent))
{
int fillCount = Math.Min(magazineComponent.CountLoaded, Capacity - CountLoaded);
for (int i = 0; i < fillCount; i++)
@@ -205,7 +205,7 @@ namespace Content.Server.GameObjects.Components.Weapon.Ranged.Projectile
eventArgs.User.PopupMessage(eventArgs.User, $"Transferred {fillCount} rounds");
return true;
}
if (eventArgs.AttackWith.TryGetComponent(out AmmoBoxComponent boxComponent))
if (eventArgs.Using.TryGetComponent(out AmmoBoxComponent boxComponent))
{
int fillCount = Math.Min(boxComponent.CountLeft, Capacity - CountLoaded);
for (int i = 0; i < fillCount; i++)

View File

@@ -26,7 +26,7 @@ namespace Content.Server.GameObjects.Components.Weapon.Ranged.Projectile
/// Guns that have a magazine.
/// </summary>
[RegisterComponent]
public class BallisticMagazineWeaponComponent : BallisticWeaponComponent, IUse, IAttackBy, IMapInit
public class BallisticMagazineWeaponComponent : BallisticWeaponComponent, IUse, IInteractUsing, IMapInit
{
private const float BulletOffset = 0.2f;
@@ -210,9 +210,9 @@ namespace Content.Server.GameObjects.Components.Weapon.Ranged.Projectile
return true;
}
public bool AttackBy(AttackByEventArgs eventArgs)
public bool InteractUsing(InteractUsingEventArgs eventArgs)
{
if (!eventArgs.AttackWith.TryGetComponent(out BallisticMagazineComponent component))
if (!eventArgs.Using.TryGetComponent(out BallisticMagazineComponent component))
{
return false;
}
@@ -226,7 +226,7 @@ namespace Content.Server.GameObjects.Components.Weapon.Ranged.Projectile
Owner.PopupMessage(eventArgs.User, "Magazine doesn't fit.");
return false;
}
return InsertMagazine(eventArgs.AttackWith);
return InsertMagazine(eventArgs.Using);
}
private void MagazineAmmoCountChanged()