Merge branch 'master' into buckle-locker-fix-1262

This commit is contained in:
DrSmugleaf
2020-07-07 00:20:07 +02:00
267 changed files with 3520 additions and 1075 deletions

View File

@@ -3,6 +3,7 @@ using System.Collections.Generic;
using Content.Server.GameObjects.Components.Items.Storage;
using Content.Server.GameObjects.Components.Weapon.Ranged.Barrels;
using Content.Server.GameObjects.EntitySystems;
using Content.Server.Interfaces.GameObjects.Components.Interaction;
using Content.Shared.Audio;
using Content.Shared.GameObjects;
using Content.Shared.GameObjects.Components.Weapons.Ranged.Barrels;

View File

@@ -3,6 +3,7 @@ using System.Collections.Generic;
using Content.Server.GameObjects.Components.Items.Storage;
using Content.Server.GameObjects.Components.Weapon.Ranged.Barrels;
using Content.Server.GameObjects.EntitySystems;
using Content.Server.Interfaces.GameObjects.Components.Interaction;
using Content.Shared.Audio;
using Content.Shared.GameObjects.Components.Weapons.Ranged.Barrels;
using Content.Shared.Interfaces;
@@ -33,7 +34,7 @@ namespace Content.Server.GameObjects.Components.Weapon.Ranged.Ammunition
public int ShotsLeft => _spawnedAmmo.Count + _unspawnedCount;
public int Capacity => _capacity;
private int _capacity;
public MagazineType MagazineType => _magazineType;
private MagazineType _magazineType;
public BallisticCaliber Caliber => _caliber;
@@ -88,7 +89,7 @@ namespace Content.Server.GameObjects.Components.Weapon.Ranged.Ammunition
{
_appearanceComponent = appearanceComponent;
}
_appearanceComponent?.SetData(MagazineBarrelVisuals.MagLoaded, true);
}
@@ -97,7 +98,7 @@ namespace Content.Server.GameObjects.Components.Weapon.Ranged.Ammunition
_appearanceComponent?.SetData(AmmoVisuals.AmmoCount, ShotsLeft);
_appearanceComponent?.SetData(AmmoVisuals.AmmoMax, Capacity);
}
public bool TryInsertAmmo(IEntity user, IEntity ammo)
{
if (!ammo.TryGetComponent(out AmmoComponent ammoComponent))
@@ -137,7 +138,7 @@ namespace Content.Server.GameObjects.Components.Weapon.Ranged.Ammunition
_unspawnedCount--;
ammo = Owner.EntityManager.SpawnEntity(_fillPrototype, Owner.Transform.GridPosition);
}
UpdateAppearance();
return ammo;
}

View File

@@ -2,6 +2,7 @@ using System.Collections.Generic;
using Content.Server.GameObjects.Components.Items.Storage;
using Content.Server.GameObjects.Components.Weapon.Ranged.Barrels;
using Content.Server.GameObjects.EntitySystems;
using Content.Server.Interfaces.GameObjects.Components.Interaction;
using Content.Shared.GameObjects.Components.Weapons.Ranged.Barrels;
using Content.Shared.Interfaces;
using Robust.Server.GameObjects;
@@ -39,7 +40,7 @@ namespace Content.Server.GameObjects.Components.Weapon.Ranged.Ammunition
serializer.DataField(ref _caliber, "caliber", BallisticCaliber.Unspecified);
serializer.DataField(ref _capacity, "capacity", 6);
serializer.DataField(ref _fillPrototype, "fillPrototype", null);
_spawnedAmmo = new Stack<IEntity>(_capacity);
}
@@ -57,7 +58,7 @@ namespace Content.Server.GameObjects.Components.Weapon.Ranged.Ammunition
}
}
}
void IMapInit.MapInit()
{
_unspawnedCount += _capacity;
@@ -92,7 +93,7 @@ namespace Content.Server.GameObjects.Components.Weapon.Ranged.Ammunition
Owner.PopupMessage(user, Loc.GetString("No room"));
return false;
}
_spawnedAmmo.Push(entity);
_ammoContainer.Insert(entity);
UpdateAppearance();
@@ -150,10 +151,10 @@ namespace Content.Server.GameObjects.Components.Weapon.Ranged.Ammunition
{
return;
}
// This area is dirty but not sure of an easier way to do it besides add an interface or somethin
bool changed = false;
if (eventArgs.Target.TryGetComponent(out RevolverBarrelComponent revolverBarrel))
{
for (var i = 0; i < Capacity; i++)
@@ -194,9 +195,9 @@ namespace Content.Server.GameObjects.Components.Weapon.Ranged.Ammunition
TryInsertAmmo(eventArgs.User, ammo);
break;
}
}
if (changed)
{
UpdateAppearance();
@@ -213,4 +214,4 @@ namespace Content.Server.GameObjects.Components.Weapon.Ranged.Ammunition
return UseEntity(eventArgs.User);
}
}
}
}