add complete strings that aren't defined in content files to allow them to be mapped (#1105)

This commit is contained in:
Tyler Young
2020-06-11 22:15:10 -04:00
committed by GitHub
parent cf2d1d4a77
commit 077e726c33
8 changed files with 116 additions and 4 deletions

View File

@@ -6,6 +6,7 @@ using Content.Server.Utility;
using Content.Shared.GameObjects;
using Content.Shared.GameObjects.Components.Weapons.Ranged;
using Content.Shared.Interfaces;
using JetBrains.Annotations;
using Robust.Server.GameObjects;
using Robust.Server.GameObjects.Components.Container;
using Robust.Server.GameObjects.EntitySystems;
@@ -148,6 +149,15 @@ namespace Content.Server.GameObjects.Components.Weapon.Ranged.Projectile
return false;
}
// these are complete strings for the sake of the shared string dict
[UsedImplicitly]
private static readonly string[] _bulletDropSounds =
{
"/Audio/Guns/Casings/casingfall1.ogg",
"/Audio/Guns/Casings/casingfall2.ogg",
"/Audio/Guns/Casings/casingfall3.ogg"
};
protected override void CycleChamberedBullet(int chamber)
{
DebugTools.Assert(chamber == 0);
@@ -161,7 +171,8 @@ namespace Content.Server.GameObjects.Components.Weapon.Ranged.Projectile
var offsetPos = (CalcBulletOffset(), CalcBulletOffset());
entity.Transform.GridPosition = Owner.Transform.GridPosition.Offset(offsetPos);
entity.Transform.LocalRotation = _bulletDropRandom.Pick(RandomBulletDirs).ToAngle();
var effect = $"/Audio/Guns/Casings/casingfall{_bulletDropRandom.Next(1, 4)}.ogg";
var bulletDropNext = _bulletDropRandom.Next(1, 3);
var effect = _bulletDropSounds[bulletDropNext];
EntitySystem.Get<AudioSystem>().PlayFromEntity(effect, Owner, AudioParams.Default.WithVolume(-3));
if (Magazine != null)

View File

@@ -5,6 +5,7 @@ using Robust.Shared.Map;
using Robust.Shared.Serialization;
using Robust.Shared.ViewVariables;
using System;
using JetBrains.Annotations;
using Robust.Server.GameObjects.EntitySystems;
using Robust.Shared.GameObjects.Systems;
using Robust.Shared.IoC;
@@ -68,6 +69,22 @@ namespace Content.Server.GameObjects.Components.Weapon.Ranged.Projectile
serializer.DataField(ref _chamberCount, "chambers", 1);
}
// for shared string dict, since we don't define these anywhere in content
[UsedImplicitly]
private static readonly string[] _ballisticsChambersStrings =
{
"ballistics_chamber_0",
"ballistics_chamber_1",
"ballistics_chamber_2",
"ballistics_chamber_3",
"ballistics_chamber_4",
"ballistics_chamber_5",
"ballistics_chamber_6",
"ballistics_chamber_7",
"ballistics_chamber_8",
"ballistics_chamber_9",
};
public override void Initialize()
{
base.Initialize();