Fix a few warnings (#11576)
This commit is contained in:
@@ -26,7 +26,7 @@ namespace Content.Client.Atmos.UI
|
||||
{
|
||||
base.Open();
|
||||
|
||||
var atmosSystem = EntitySystem.Get<AtmosphereSystem>();
|
||||
var atmosSystem = IoCManager.Resolve<IEntitySystemManager>().GetEntitySystem<AtmosphereSystem>();
|
||||
|
||||
_window = new GasFilterWindow(atmosSystem.Gases);
|
||||
|
||||
@@ -59,7 +59,7 @@ namespace Content.Client.Atmos.UI
|
||||
private void OnSelectGasPressed()
|
||||
{
|
||||
if (_window is null || _window.SelectedGas is null) return;
|
||||
if (!Int32.TryParse(_window.SelectedGas, out var gas)) return;
|
||||
if (!int.TryParse(_window.SelectedGas, out var gas)) return;
|
||||
SendMessage(new GasFilterSelectGasMessage(gas));
|
||||
}
|
||||
|
||||
@@ -78,7 +78,7 @@ namespace Content.Client.Atmos.UI
|
||||
_window.SetTransferRate(cast.TransferRate);
|
||||
if (cast.FilteredGas is not null)
|
||||
{
|
||||
var atmos = EntitySystem.Get<AtmosphereSystem>();
|
||||
var atmos = IoCManager.Resolve<IEntitySystemManager>().GetEntitySystem<AtmosphereSystem>();
|
||||
var gas = atmos.GetGas((Gas) cast.FilteredGas);
|
||||
_window.SetGasFiltered(gas.ID, gas.Name);
|
||||
}
|
||||
|
||||
@@ -24,7 +24,8 @@ namespace Content.Client.Audio
|
||||
/// </summary>
|
||||
public sealed class AmbientSoundSystem : SharedAmbientSoundSystem
|
||||
{
|
||||
[Dependency] private EntityLookupSystem _lookup = default!;
|
||||
[Dependency] private readonly EntityLookupSystem _lookup = default!;
|
||||
[Dependency] private readonly SharedAudioSystem _audio = default!;
|
||||
[Dependency] private readonly IConfigurationManager _cfg = default!;
|
||||
[Dependency] private readonly IGameTiming _gameTiming = default!;
|
||||
[Dependency] private readonly IPlayerManager _playerManager = default!;
|
||||
@@ -43,7 +44,7 @@ namespace Content.Client.Audio
|
||||
/// </summary>
|
||||
private int MaxSingleSound => (int) (_maxAmbientCount / (16.0f / 6.0f));
|
||||
|
||||
private Dictionary<AmbientSoundComponent, (IPlayingAudioStream? Stream, string Sound)> _playingSounds = new();
|
||||
private readonly Dictionary<AmbientSoundComponent, (IPlayingAudioStream? Stream, string Sound)> _playingSounds = new();
|
||||
|
||||
private const float RangeBuffer = 3f;
|
||||
|
||||
@@ -58,7 +59,7 @@ namespace Content.Client.Audio
|
||||
|
||||
if (_overlayEnabled)
|
||||
{
|
||||
_overlay = new AmbientSoundOverlay(EntityManager, this, Get<EntityLookupSystem>());
|
||||
_overlay = new AmbientSoundOverlay(EntityManager, this, EntityManager.System<EntityLookupSystem>());
|
||||
overlayManager.AddOverlay(_overlay);
|
||||
}
|
||||
else
|
||||
@@ -119,7 +120,8 @@ namespace Content.Client.Audio
|
||||
|
||||
foreach (var (_, (_, sound)) in _playingSounds)
|
||||
{
|
||||
if (sound.Equals(countSound)) count++;
|
||||
if (sound.Equals(countSound))
|
||||
count++;
|
||||
}
|
||||
|
||||
return count;
|
||||
@@ -180,7 +182,7 @@ namespace Content.Client.Audio
|
||||
continue;
|
||||
}
|
||||
|
||||
var key = ambientComp.Sound.GetSound();
|
||||
var key = _audio.GetSound(ambientComp.Sound);
|
||||
|
||||
if (!sourceDict.ContainsKey(key))
|
||||
sourceDict[key] = new List<AmbientSoundComponent>(MaxSingleSound);
|
||||
@@ -188,6 +190,7 @@ namespace Content.Client.Audio
|
||||
sourceDict[key].Add(ambientComp);
|
||||
}
|
||||
|
||||
// TODO: Just store the distance from above...
|
||||
foreach (var (key, val) in sourceDict)
|
||||
{
|
||||
sourceDict[key] = val.OrderByDescending(x =>
|
||||
@@ -236,7 +239,7 @@ namespace Content.Client.Audio
|
||||
if (_playingSounds.ContainsKey(comp))
|
||||
continue;
|
||||
|
||||
var sound = comp.Sound.GetSound();
|
||||
var sound = _audio.GetSound(comp.Sound);
|
||||
|
||||
if (PlayingCount(sound) >= MaxSingleSound)
|
||||
{
|
||||
@@ -250,7 +253,7 @@ namespace Content.Client.Audio
|
||||
continue;
|
||||
}
|
||||
|
||||
var audioParams = AudioHelpers
|
||||
var audioParams = AudioParams.Default
|
||||
.WithVariation(0.01f)
|
||||
.WithVolume(comp.Volume + _ambienceVolume)
|
||||
.WithLoop(true)
|
||||
@@ -259,9 +262,7 @@ namespace Content.Client.Audio
|
||||
.WithPlayOffset(_random.NextFloat(0.0f, 100.0f))
|
||||
.WithMaxDistance(comp.Range);
|
||||
|
||||
var stream = SoundSystem.Play(sound,
|
||||
Filter.Local(),
|
||||
comp.Owner, audioParams);
|
||||
var stream = _audio.PlayPvs(comp.Sound, comp.Owner, audioParams);
|
||||
|
||||
if (stream == null) continue;
|
||||
|
||||
|
||||
@@ -30,6 +30,7 @@ namespace Content.Client.Audio
|
||||
[Dependency] private readonly IRobustRandom _robustRandom = default!;
|
||||
[Dependency] private readonly IStateManager _stateManager = default!;
|
||||
[Dependency] private readonly ClientGameTicker _gameTicker = default!;
|
||||
[Dependency] private readonly SharedAudioSystem _audio = default!;
|
||||
|
||||
private readonly AudioParams _ambientParams = new(-10f, 1, "Master", 0, 0, 0, true, 0f);
|
||||
private readonly AudioParams _lobbyParams = new(-5f, 1, "Master", 0, 0, 0, true, 0f);
|
||||
@@ -211,7 +212,8 @@ namespace Content.Client.Audio
|
||||
return;
|
||||
_playingCollection = _currentCollection;
|
||||
var file = _robustRandom.Pick(_currentCollection.PickFiles).ToString();
|
||||
_ambientStream = SoundSystem.Play(file, Filter.Local(), _ambientParams.WithVolume(_ambientParams.Volume + _configManager.GetCVar(CCVars.AmbienceVolume)));
|
||||
_ambientStream = _audio.PlayGlobal(file, Filter.Local(),
|
||||
_ambientParams.WithVolume(_ambientParams.Volume + _configManager.GetCVar(CCVars.AmbienceVolume)));
|
||||
}
|
||||
|
||||
private void EndAmbience()
|
||||
@@ -304,7 +306,8 @@ namespace Content.Client.Audio
|
||||
{
|
||||
return;
|
||||
}
|
||||
_lobbyStream = SoundSystem.Play(file, Filter.Local(), _lobbyParams);
|
||||
|
||||
_lobbyStream = _audio.PlayGlobal(file, Filter.Local(), _lobbyParams);
|
||||
}
|
||||
|
||||
private void EndLobbyMusic()
|
||||
|
||||
@@ -10,6 +10,7 @@ namespace Content.Client.Audio;
|
||||
public sealed class ClientGlobalSoundSystem : SharedGlobalSoundSystem
|
||||
{
|
||||
[Dependency] private readonly IConfigurationManager _cfg = default!;
|
||||
[Dependency] private readonly SharedAudioSystem _audio = default!;
|
||||
|
||||
// Admin music
|
||||
private bool _adminAudioEnabled = true;
|
||||
@@ -64,7 +65,7 @@ public sealed class ClientGlobalSoundSystem : SharedGlobalSoundSystem
|
||||
{
|
||||
if(!_adminAudioEnabled) return;
|
||||
|
||||
var stream = SoundSystem.Play(soundEvent.Filename, Filter.Local(), soundEvent.AudioParams);
|
||||
var stream = _audio.PlayGlobal(soundEvent.Filename, Filter.Local(), soundEvent.AudioParams);
|
||||
_adminAudio.Add(stream);
|
||||
}
|
||||
|
||||
@@ -73,13 +74,13 @@ public sealed class ClientGlobalSoundSystem : SharedGlobalSoundSystem
|
||||
// Either the cvar is disabled or it's already playing
|
||||
if(!_eventAudioEnabled || _eventAudio.ContainsKey(soundEvent.Type)) return;
|
||||
|
||||
var stream = SoundSystem.Play(soundEvent.Filename, Filter.Local(), soundEvent.AudioParams);
|
||||
var stream = _audio.PlayGlobal(soundEvent.Filename, Filter.Local(), soundEvent.AudioParams);
|
||||
_eventAudio.Add(soundEvent.Type, stream);
|
||||
}
|
||||
|
||||
private void PlayGameSound(GameGlobalSoundEvent soundEvent)
|
||||
{
|
||||
SoundSystem.Play(soundEvent.Filename, Filter.Local(), soundEvent.AudioParams);
|
||||
_audio.PlayGlobal(soundEvent.Filename, Filter.Local(), soundEvent.AudioParams);
|
||||
}
|
||||
|
||||
private void StopStationEventMusic(StopStationEventMusic soundEvent)
|
||||
|
||||
@@ -16,8 +16,12 @@ public sealed class CargoShuttleConsoleBoundUserInterface : BoundUserInterface
|
||||
protected override void Open()
|
||||
{
|
||||
base.Open();
|
||||
_menu = new CargoShuttleMenu(IoCManager.Resolve<IGameTiming>(), IoCManager.Resolve<IPrototypeManager>(), EntitySystem.Get<SpriteSystem>());
|
||||
var collection = IoCManager.Instance;
|
||||
|
||||
if (collection == null)
|
||||
return;
|
||||
|
||||
_menu = new CargoShuttleMenu(collection.Resolve<IGameTiming>(), collection.Resolve<IPrototypeManager>(), collection.Resolve<IEntitySystemManager>().GetEntitySystem<SpriteSystem>());
|
||||
_menu.ShuttleCallRequested += OnShuttleCall;
|
||||
_menu.ShuttleRecallRequested += OnShuttleRecall;
|
||||
_menu.OnClose += Close;
|
||||
|
||||
@@ -16,7 +16,7 @@ namespace Content.Client.CharacterInfo.Components
|
||||
|
||||
public void Opened()
|
||||
{
|
||||
EntitySystem.Get<CharacterInfoSystem>().RequestCharacterInfo(Owner);
|
||||
IoCManager.Resolve<IEntitySystemManager>().GetEntitySystem<CharacterInfoSystem>().RequestCharacterInfo(Owner);
|
||||
}
|
||||
|
||||
public sealed class CharacterInfoControl : BoxContainer
|
||||
|
||||
@@ -10,6 +10,8 @@ namespace Content.Client.CharacterInfo.Components;
|
||||
|
||||
public sealed class CharacterInfoSystem : EntitySystem
|
||||
{
|
||||
[Dependency] private readonly SpriteSystem _sprite = default!;
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
base.Initialize();
|
||||
@@ -71,7 +73,7 @@ public sealed class CharacterInfoSystem : EntitySystem
|
||||
};
|
||||
hbox.AddChild(new ProgressTextureRect
|
||||
{
|
||||
Texture = objectiveCondition.SpriteSpecifier.Frame0(),
|
||||
Texture = _sprite.Frame0(objectiveCondition.SpriteSpecifier),
|
||||
Progress = objectiveCondition.Progress,
|
||||
VerticalAlignment = Control.VAlignment.Center
|
||||
});
|
||||
|
||||
@@ -478,7 +478,7 @@ namespace Content.Client.Chat.UI
|
||||
UpdateChannelSelectButton();
|
||||
|
||||
// Warn typing indicator about change
|
||||
EntitySystem.Get<TypingIndicatorSystem>().ClientChangedChatText();
|
||||
IoCManager.Resolve<IEntitySystemManager>().GetEntitySystem<TypingIndicatorSystem>().ClientChangedChatText();
|
||||
}
|
||||
|
||||
private static ChatSelectChannel GetChannelFromPrefix(char prefix)
|
||||
@@ -523,7 +523,7 @@ namespace Content.Client.Chat.UI
|
||||
private void Input_OnTextEntered(LineEdit.LineEditEventArgs args)
|
||||
{
|
||||
// Warn typing indicator about entered text
|
||||
EntitySystem.Get<TypingIndicatorSystem>().ClientSubmittedChatText();
|
||||
IoCManager.Resolve<IEntitySystemManager>().GetEntitySystem<TypingIndicatorSystem>().ClientSubmittedChatText();
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(args.Text))
|
||||
{
|
||||
|
||||
@@ -28,7 +28,7 @@ namespace Content.Client.Stack
|
||||
// TODO PREDICT ENTITY DELETION: This should really just be a normal entity deletion call.
|
||||
if (component.Count <= 0)
|
||||
{
|
||||
Transform(uid).DetachParentToNull();
|
||||
Xform.DetachParentToNull(Transform(uid));
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -20,6 +20,7 @@ namespace Content.Client.Suspicion
|
||||
[GenerateTypedNameReferences]
|
||||
public sealed partial class SuspicionGui : UIWidget
|
||||
{
|
||||
[Dependency] private readonly IEntityManager _entManager = default!;
|
||||
[Dependency] private readonly IPlayerManager _playerManager = default!;
|
||||
[Dependency] private readonly IGameTiming _timing = default!;
|
||||
|
||||
@@ -66,7 +67,7 @@ namespace Content.Client.Suspicion
|
||||
return false;
|
||||
}
|
||||
|
||||
return IoCManager.Resolve<IEntityManager>().TryGetComponent(_playerManager.LocalPlayer.ControlledEntity, out suspicion);
|
||||
return _entManager.TryGetComponent(_playerManager.LocalPlayer.ControlledEntity, out suspicion);
|
||||
}
|
||||
|
||||
public void UpdateLabel()
|
||||
@@ -83,7 +84,7 @@ namespace Content.Client.Suspicion
|
||||
return;
|
||||
}
|
||||
|
||||
var endTime = EntitySystem.Get<SuspicionEndTimerSystem>().EndTime;
|
||||
var endTime = _entManager.System<SuspicionEndTimerSystem>().EndTime;
|
||||
if (endTime == null)
|
||||
{
|
||||
TimerLabel.Visible = false;
|
||||
|
||||
@@ -27,6 +27,7 @@ namespace Content.Client.Tabletop
|
||||
[Dependency] private readonly IUserInterfaceManager _uiManger = default!;
|
||||
[Dependency] private readonly IPlayerManager _playerManager = default!;
|
||||
[Dependency] private readonly IGameTiming _gameTiming = default!;
|
||||
[Dependency] private readonly SharedAppearanceSystem _appearance = default!;
|
||||
|
||||
// Time in seconds to wait until sending the location of a dragged entity to the server again
|
||||
private const float Delay = 1f / 10; // 10 Hz
|
||||
@@ -219,8 +220,8 @@ namespace Content.Client.Tabletop
|
||||
|
||||
if (EntityManager.TryGetComponent<AppearanceComponent>(draggedEntity, out var appearance))
|
||||
{
|
||||
appearance.SetData(TabletopItemVisuals.Scale, new Vector2(1.25f, 1.25f));
|
||||
appearance.SetData(TabletopItemVisuals.DrawDepth, (int) DrawDepth.Items + 1);
|
||||
_appearance.SetData(draggedEntity, TabletopItemVisuals.Scale, new Vector2(1.25f, 1.25f), appearance);
|
||||
_appearance.SetData(draggedEntity, TabletopItemVisuals.DrawDepth, (int) DrawDepth.Items + 1, appearance);
|
||||
}
|
||||
|
||||
_draggedEntity = draggedEntity;
|
||||
|
||||
@@ -52,7 +52,8 @@ namespace Content.Client.VendingMachines.UI
|
||||
}
|
||||
|
||||
var longestEntry = string.Empty;
|
||||
var spriteSystem = EntitySystem.Get<SpriteSystem>();
|
||||
var spriteSystem = IoCManager.Resolve<IEntitySystemManager>().GetEntitySystem<SpriteSystem>();
|
||||
|
||||
for (var i = 0; i < inventory.Count; i++)
|
||||
{
|
||||
var entry = inventory[i];
|
||||
|
||||
@@ -22,7 +22,7 @@ namespace Content.Client.VendingMachines
|
||||
base.Open();
|
||||
|
||||
var entMan = IoCManager.Resolve<IEntityManager>();
|
||||
var vendingMachineSys = EntitySystem.Get<VendingMachineSystem>();
|
||||
var vendingMachineSys = entMan.System<VendingMachineSystem>();
|
||||
|
||||
_cachedInventory = vendingMachineSys.GetAllInventory(Owner.Owner);
|
||||
|
||||
@@ -50,7 +50,7 @@ namespace Content.Client.VendingMachines
|
||||
|
||||
private void OnItemSelected(ItemList.ItemListSelectedEventArgs args)
|
||||
{
|
||||
if (_cachedInventory == null || _cachedInventory.Count == 0)
|
||||
if (_cachedInventory.Count == 0)
|
||||
return;
|
||||
|
||||
var selectedItem = _cachedInventory.ElementAtOrDefault(args.ItemIndex);
|
||||
|
||||
@@ -24,7 +24,7 @@ namespace Content.Client.Verbs.UI
|
||||
public bool TextVisible { set => Label.Visible = value; }
|
||||
|
||||
// Top quality variable naming
|
||||
public Verb? Verb;
|
||||
public readonly Verb? Verb;
|
||||
|
||||
public VerbMenuElement(Verb verb) : base(verb.Text)
|
||||
{
|
||||
@@ -41,12 +41,14 @@ namespace Content.Client.Verbs.UI
|
||||
ExpansionIndicator.Visible = true;
|
||||
}
|
||||
|
||||
var entManager = IoCManager.Resolve<IEntityManager>();
|
||||
|
||||
if (verb.Icon == null && verb.IconEntity != null)
|
||||
{
|
||||
var spriteView = new SpriteView()
|
||||
{
|
||||
OverrideDirection = Direction.South,
|
||||
Sprite = IoCManager.Resolve<IEntityManager>().GetComponentOrNull<ISpriteComponent>(verb.IconEntity.Value)
|
||||
Sprite = entManager.GetComponentOrNull<ISpriteComponent>(verb.IconEntity.Value)
|
||||
};
|
||||
|
||||
Icon.AddChild(spriteView);
|
||||
@@ -55,7 +57,7 @@ namespace Content.Client.Verbs.UI
|
||||
|
||||
Icon.AddChild(new TextureRect()
|
||||
{
|
||||
Texture = verb.Icon?.Frame0(),
|
||||
Texture = verb.Icon != null ? entManager.System<SpriteSystem>().Frame0(verb.Icon) : null,
|
||||
Stretch = TextureRect.StretchMode.KeepAspectCentered
|
||||
});
|
||||
}
|
||||
@@ -66,7 +68,7 @@ namespace Content.Client.Verbs.UI
|
||||
|
||||
Icon.AddChild(new TextureRect()
|
||||
{
|
||||
Texture = category.Icon?.Frame0(),
|
||||
Texture = category.Icon != null ? IoCManager.Resolve<IEntitySystemManager>().GetEntitySystem<SpriteSystem>().Frame0(category.Icon) : null,
|
||||
Stretch = TextureRect.StretchMode.KeepAspectCentered
|
||||
});
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@ using System.Linq;
|
||||
using Content.Shared.Voting;
|
||||
using Robust.Client;
|
||||
using Robust.Client.Console;
|
||||
using Robust.Client.GameObjects;
|
||||
using Robust.Client.UserInterface;
|
||||
using Robust.Shared.IoC;
|
||||
using Robust.Shared.Network;
|
||||
@@ -117,7 +118,8 @@ namespace Content.Client.Voting
|
||||
}
|
||||
|
||||
@new = true;
|
||||
SoundSystem.Play("/Audio/Effects/voteding.ogg", Filter.Local());
|
||||
IoCManager.Resolve<IEntitySystemManager>().GetEntitySystem<AudioSystem>()
|
||||
.PlayGlobal("/Audio/Effects/voteding.ogg", Filter.Local());
|
||||
|
||||
// New vote from the server.
|
||||
var vote = new ActiveVote(voteId)
|
||||
|
||||
@@ -19,13 +19,14 @@ namespace Content.Shared.Actions;
|
||||
|
||||
public abstract class SharedActionsSystem : EntitySystem
|
||||
{
|
||||
[Dependency] protected readonly IGameTiming GameTiming = default!;
|
||||
[Dependency] private readonly ISharedAdminLogManager _adminLogger = default!;
|
||||
[Dependency] private readonly SharedInteractionSystem _interactionSystem = default!;
|
||||
[Dependency] private readonly ActionBlockerSystem _actionBlockerSystem = default!;
|
||||
[Dependency] private readonly SharedContainerSystem _containerSystem = default!;
|
||||
[Dependency] private readonly RotateToFaceSystem _rotateToFaceSystem = default!;
|
||||
[Dependency] private readonly SharedPopupSystem _popupSystem = default!;
|
||||
[Dependency] protected readonly IGameTiming GameTiming = default!;
|
||||
[Dependency] private readonly SharedAudioSystem _audio = default!;
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
@@ -325,8 +326,7 @@ public abstract class SharedActionsSystem : EntitySystem
|
||||
|
||||
var filter = Filter.Pvs(performer).RemoveWhereAttachedEntity(e => e == performer);
|
||||
|
||||
if (action.Sound != null)
|
||||
SoundSystem.Play(action.Sound.GetSound(), filter, performer, action.AudioParams);
|
||||
_audio.Play(action.Sound, filter, performer, action.AudioParams);
|
||||
|
||||
if (string.IsNullOrWhiteSpace(action.Popup))
|
||||
return true;
|
||||
|
||||
@@ -23,15 +23,16 @@ namespace Content.Shared.Blocking;
|
||||
|
||||
public sealed class BlockingSystem : EntitySystem
|
||||
{
|
||||
[Dependency] private readonly SharedActionsSystem _actionsSystem = default!;
|
||||
[Dependency] private readonly IMapManager _mapManager = default!;
|
||||
[Dependency] private readonly IPrototypeManager _proto = default!;
|
||||
[Dependency] private readonly SharedActionsSystem _actionsSystem = default!;
|
||||
[Dependency] private readonly SharedTransformSystem _transformSystem = default!;
|
||||
[Dependency] private readonly FixtureSystem _fixtureSystem = default!;
|
||||
[Dependency] private readonly SharedHandsSystem _handsSystem = default!;
|
||||
[Dependency] private readonly SharedPopupSystem _popupSystem = default!;
|
||||
[Dependency] private readonly IMapManager _mapManager = default!;
|
||||
[Dependency] private readonly SharedContainerSystem _containerSystem = default!;
|
||||
[Dependency] private readonly EntityLookupSystem _lookup = default!;
|
||||
[Dependency] private readonly SharedPhysicsSystem _physics = default!;
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
@@ -231,7 +232,7 @@ public sealed class BlockingSystem : EntitySystem
|
||||
|
||||
_actionsSystem.SetToggled(component.BlockingToggleAction, false);
|
||||
_fixtureSystem.DestroyFixture(physicsComponent, BlockingComponent.BlockFixtureID);
|
||||
physicsComponent.BodyType = blockingUserComponent.OriginalBodyType;
|
||||
_physics.SetBodyType(physicsComponent, blockingUserComponent.OriginalBodyType);
|
||||
_popupSystem.PopupEntity(msgUser, user, Filter.Entities(user));
|
||||
_popupSystem.PopupEntity(msgOther, user, Filter.Pvs(user).RemoveWhereAttachedEntity(e => e == user));
|
||||
}
|
||||
|
||||
@@ -13,6 +13,7 @@ public sealed class BlockingUserSystem : EntitySystem
|
||||
[Dependency] private readonly IPrototypeManager _proto = default!;
|
||||
[Dependency] private readonly BlockingSystem _blockingSystem = default!;
|
||||
[Dependency] private readonly DamageableSystem _damageable = default!;
|
||||
[Dependency] private readonly SharedAudioSystem _audio = default!;
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
@@ -71,7 +72,7 @@ public sealed class BlockingUserSystem : EntitySystem
|
||||
if (_proto.TryIndex(blockingComponent.ActiveBlockDamageModifier, out DamageModifierSetPrototype? activeBlockModifier) && blockingComponent.IsBlocking)
|
||||
{
|
||||
args.Damage = DamageSpecifier.ApplyModifierSet(args.Damage, activeBlockModifier);
|
||||
SoundSystem.Play(blockingComponent.BlockSound.GetSound(), Filter.Pvs(component.Owner, entityManager: EntityManager), component.Owner, AudioHelpers.WithVariation(0.2f));
|
||||
_audio.PlayPvs(blockingComponent.BlockSound, component.Owner, AudioParams.Default.WithVariation(0.2f));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -392,7 +392,7 @@ namespace Content.Shared.CCVar
|
||||
CVarDef.Create("database.pg_database", "ss14", CVar.SERVERONLY);
|
||||
|
||||
public static readonly CVarDef<string> DatabasePgUsername =
|
||||
CVarDef.Create("database.pg_username", "", CVar.SERVERONLY);
|
||||
CVarDef.Create("database.pg_username", "postgres", CVar.SERVERONLY);
|
||||
|
||||
public static readonly CVarDef<string> DatabasePgPassword =
|
||||
CVarDef.Create("database.pg_password", "", CVar.SERVERONLY | CVar.CONFIDENTIAL);
|
||||
|
||||
@@ -90,7 +90,7 @@ namespace Content.Shared.Chemistry.Components
|
||||
return "";
|
||||
}
|
||||
|
||||
var majorReagent = Contents.OrderByDescending(reagent => reagent.Quantity).First();
|
||||
var majorReagent = Contents.MaxBy(reagent => reagent.Quantity);
|
||||
return majorReagent.ReagentId;
|
||||
}
|
||||
|
||||
@@ -134,9 +134,11 @@ namespace Content.Shared.Chemistry.Components
|
||||
/// <param name="scale">The scalar to modify the solution by.</param>
|
||||
public void ScaleSolution(float scale)
|
||||
{
|
||||
if (scale == 1) return;
|
||||
if (scale.Equals(1f))
|
||||
return;
|
||||
|
||||
var tempContents = new List<ReagentQuantity>(Contents);
|
||||
foreach(ReagentQuantity current in tempContents)
|
||||
foreach(var current in tempContents)
|
||||
{
|
||||
if(scale > 1)
|
||||
{
|
||||
@@ -231,7 +233,7 @@ namespace Content.Shared.Chemistry.Components
|
||||
Contents[i] = new ReagentQuantity(reagent.ReagentId, newQuantity);
|
||||
}
|
||||
|
||||
TotalVolume = TotalVolume * ratio;
|
||||
TotalVolume *= ratio;
|
||||
}
|
||||
|
||||
public void RemoveAllSolution()
|
||||
@@ -381,14 +383,10 @@ namespace Content.Shared.Chemistry.Components
|
||||
return newSolution;
|
||||
}
|
||||
|
||||
[Obsolete("Use ReactiveSystem.DoEntityReaction")]
|
||||
public void DoEntityReaction(EntityUid uid, ReactionMethod method)
|
||||
{
|
||||
var chemistry = EntitySystem.Get<ReactiveSystem>();
|
||||
|
||||
foreach (var (reagentId, quantity) in Contents.ToArray())
|
||||
{
|
||||
chemistry.ReactionEntity(uid, method, reagentId, quantity, this);
|
||||
}
|
||||
IoCManager.Resolve<IEntitySystemManager>().GetEntitySystem<ReactiveSystem>().DoEntityReaction(uid, this, method);
|
||||
}
|
||||
|
||||
[Serializable, NetSerializable]
|
||||
|
||||
@@ -25,6 +25,14 @@ namespace Content.Shared.Chemistry
|
||||
}
|
||||
}
|
||||
|
||||
public void DoEntityReaction(EntityUid uid, Solution solution, ReactionMethod method)
|
||||
{
|
||||
foreach (var (reagentId, quantity) in solution.Contents.ToArray())
|
||||
{
|
||||
ReactionEntity(uid, method, reagentId, quantity, solution);
|
||||
}
|
||||
}
|
||||
|
||||
public void ReactionEntity(EntityUid uid, ReactionMethod method, string reagentId, FixedPoint2 reactVolume, Solution? source)
|
||||
{
|
||||
// We throw if the reagent specified doesn't exist.
|
||||
|
||||
@@ -11,12 +11,13 @@ namespace Content.Shared.Clothing;
|
||||
|
||||
public abstract class SharedMagbootsSystem : EntitySystem
|
||||
{
|
||||
[Dependency] private readonly SharedActionsSystem _sharedActions = default!;
|
||||
[Dependency] private readonly ClothingSpeedModifierSystem _clothingSpeedModifier = default!;
|
||||
[Dependency] private readonly InventorySystem _inventory = default!;
|
||||
[Dependency] private readonly SharedItemSystem _item = default!;
|
||||
[Dependency] private readonly ClothingSystem _clothing = default!;
|
||||
[Dependency] private readonly InventorySystem _inventory = default!;
|
||||
[Dependency] private readonly SharedActionsSystem _sharedActions = default!;
|
||||
[Dependency] private readonly SharedAppearanceSystem _appearance = default!;
|
||||
[Dependency] private readonly SharedContainerSystem _sharedContainer = default!;
|
||||
[Dependency] private readonly SharedItemSystem _item = default!;
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
@@ -46,9 +47,7 @@ public abstract class SharedMagbootsSystem : EntitySystem
|
||||
_clothing.SetEquippedPrefix(uid, component.On ? "on" : null);
|
||||
}
|
||||
|
||||
if (TryComp(uid, out AppearanceComponent? appearance))
|
||||
appearance.SetData(ToggleVisuals.Toggled, component.On);
|
||||
|
||||
_appearance.SetData(uid, ToggleVisuals.Toggled, component.Owner);
|
||||
OnChanged(component);
|
||||
Dirty(component);
|
||||
}
|
||||
|
||||
@@ -11,7 +11,8 @@ namespace Content.Shared.Construction.Conditions
|
||||
{
|
||||
public bool Condition(EntityUid user, EntityCoordinates location, Direction direction)
|
||||
{
|
||||
var tagSystem = EntitySystem.Get<TagSystem>();
|
||||
var tagSystem = IoCManager.Resolve<IEntitySystemManager>().GetEntitySystem<TagSystem>();
|
||||
|
||||
foreach (var entity in location.GetEntitiesInTile(LookupFlags.Approximate | LookupFlags.Anchored))
|
||||
{
|
||||
if (tagSystem.HasTag(entity, "Window"))
|
||||
|
||||
@@ -33,11 +33,11 @@ namespace Content.Shared.Construction.Conditions
|
||||
return false;
|
||||
|
||||
// now we need to check that user actually tries to build wallmount on a wall
|
||||
var physics = EntitySystem.Get<SharedPhysicsSystem>();
|
||||
var physics = entManager.System<SharedPhysicsSystem>();
|
||||
var rUserToObj = new CollisionRay(userWorldPosition, userToObject.Normalized, (int) CollisionGroup.Impassable);
|
||||
var length = userToObject.Length;
|
||||
|
||||
var tagSystem = EntitySystem.Get<TagSystem>();
|
||||
var tagSystem = entManager.System<TagSystem>();
|
||||
|
||||
var userToObjRaycastResults = physics.IntersectRayWithPredicate(entManager.GetComponent<TransformComponent>(user).MapID, rUserToObj, maxLength: length,
|
||||
predicate: (e) => !tagSystem.HasTag(e, "Wall"));
|
||||
|
||||
@@ -15,6 +15,7 @@ namespace Content.Shared.Damage
|
||||
public sealed class DamageableSystem : EntitySystem
|
||||
{
|
||||
[Dependency] private readonly IPrototypeManager _prototypeManager = default!;
|
||||
[Dependency] private readonly SharedAppearanceSystem _appearance = default!;
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
@@ -121,9 +122,9 @@ namespace Content.Shared.Damage
|
||||
if (EntityManager.TryGetComponent<AppearanceComponent>(component.Owner, out var appearance) && damageDelta != null)
|
||||
{
|
||||
var data = new DamageVisualizerGroupData(damageDelta.GetDamagePerGroup(_prototypeManager).Keys.ToList());
|
||||
appearance.SetData(DamageVisualizerKeys.DamageUpdateGroups, data);
|
||||
_appearance.SetData(component.Owner, DamageVisualizerKeys.DamageUpdateGroups, data, appearance);
|
||||
}
|
||||
RaiseLocalEvent(component.Owner, new DamageChangedEvent(component, damageDelta, interruptsDoAfters), false);
|
||||
RaiseLocalEvent(component.Owner, new DamageChangedEvent(component, damageDelta, interruptsDoAfters));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
using Robust.Shared.Prototypes;
|
||||
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype;
|
||||
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype.Array;
|
||||
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype.Array;
|
||||
|
||||
namespace Content.Shared.Disease
|
||||
|
||||
@@ -3,9 +3,11 @@ using Content.Shared.Disposal.Components;
|
||||
using Content.Shared.DragDrop;
|
||||
using Content.Shared.Item;
|
||||
using Content.Shared.MobState.Components;
|
||||
using Content.Shared.MobState.EntitySystems;
|
||||
using Content.Shared.Throwing;
|
||||
using JetBrains.Annotations;
|
||||
using Robust.Shared.Physics;
|
||||
using Robust.Shared.Physics.Components;
|
||||
using Robust.Shared.Physics.Dynamics;
|
||||
using Robust.Shared.Physics.Events;
|
||||
using Robust.Shared.Timing;
|
||||
@@ -16,6 +18,7 @@ namespace Content.Shared.Disposal
|
||||
public abstract class SharedDisposalUnitSystem : EntitySystem
|
||||
{
|
||||
[Dependency] protected readonly IGameTiming GameTiming = default!;
|
||||
[Dependency] private readonly SharedMobStateSystem _mobState = default!;
|
||||
|
||||
protected static TimeSpan ExitAttemptDelay = TimeSpan.FromSeconds(0.5);
|
||||
|
||||
@@ -68,20 +71,16 @@ namespace Content.Shared.Disposal
|
||||
}
|
||||
|
||||
//Check if the entity is a mob and if mobs can be inserted
|
||||
if (EntityManager.HasComponent<MobStateComponent>(entity) && !component.MobsCanEnter)
|
||||
if (TryComp<MobStateComponent>(entity, out var damageState) && !component.MobsCanEnter)
|
||||
return false;
|
||||
|
||||
if (!EntityManager.TryGetComponent(entity, out IPhysBody? physics) ||
|
||||
!physics.CanCollide && storable == null)
|
||||
if (EntityManager.TryGetComponent(entity, out PhysicsComponent? physics) &&
|
||||
(physics.CanCollide || storable != null))
|
||||
{
|
||||
if (!(EntityManager.TryGetComponent(entity, out MobStateComponent? damageState) &&
|
||||
(!component.MobsCanEnter || damageState.IsDead())))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
return true;
|
||||
return damageState != null && (!component.MobsCanEnter || _mobState.IsDead(entity, damageState));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@ namespace Content.Shared.Doors.Systems;
|
||||
|
||||
public abstract class SharedAirlockSystem : EntitySystem
|
||||
{
|
||||
[Dependency] protected readonly SharedAppearanceSystem Appearance = default!;
|
||||
[Dependency] protected readonly SharedDoorSystem DoorSystem = default!;
|
||||
|
||||
public override void Initialize()
|
||||
@@ -39,10 +40,7 @@ public abstract class SharedAirlockSystem : EntitySystem
|
||||
|
||||
public void UpdateEmergencyLightStatus(SharedAirlockComponent component)
|
||||
{
|
||||
if (TryComp<AppearanceComponent>(component.Owner, out var appearanceComponent))
|
||||
{
|
||||
appearanceComponent.SetData(DoorVisuals.EmergencyLights, component.EmergencyAccess);
|
||||
}
|
||||
Appearance.SetData(component.Owner, DoorVisuals.EmergencyLights, component.EmergencyAccess);
|
||||
}
|
||||
|
||||
public void ToggleEmergencyAccess(SharedAirlockComponent component)
|
||||
|
||||
@@ -21,11 +21,11 @@ namespace Content.Shared.Doors.Systems;
|
||||
|
||||
public abstract class SharedDoorSystem : EntitySystem
|
||||
{
|
||||
[Dependency] protected readonly IGameTiming GameTiming = default!;
|
||||
[Dependency] protected readonly SharedPhysicsSystem PhysicsSystem = default!;
|
||||
[Dependency] private readonly DamageableSystem _damageableSystem = default!;
|
||||
[Dependency] private readonly SharedStunSystem _stunSystem = default!;
|
||||
[Dependency] protected readonly TagSystem Tags = default!;
|
||||
[Dependency] protected readonly IGameTiming GameTiming = default!;
|
||||
[Dependency] protected readonly SharedAudioSystem Audio = default!;
|
||||
[Dependency] private readonly EntityLookupSystem _entityLookup = default!;
|
||||
[Dependency] private readonly SharedAppearanceSystem _appearance = default!;
|
||||
@@ -380,7 +380,7 @@ public abstract class SharedDoorSystem : EntitySystem
|
||||
return;
|
||||
|
||||
if (Resolve(uid, ref physics, false))
|
||||
physics.CanCollide = collidable;
|
||||
PhysicsSystem.SetCanCollide(physics, collidable);
|
||||
|
||||
if (!collidable)
|
||||
door.CurrentlyCrushing.Clear();
|
||||
|
||||
@@ -8,18 +8,13 @@ public abstract partial class SharedMobStateSystem
|
||||
public virtual void EnterCritState(EntityUid uid)
|
||||
{
|
||||
Alerts.ShowAlert(uid, AlertType.HumanCrit);
|
||||
|
||||
Standing.Down(uid);
|
||||
|
||||
if (TryComp<AppearanceComponent>(uid, out var appearance))
|
||||
{
|
||||
appearance.SetData(DamageStateVisuals.State, DamageState.Critical);
|
||||
}
|
||||
_standing.Down(uid);
|
||||
_appearance.SetData(uid, DamageStateVisuals.State, DamageState.Critical);
|
||||
}
|
||||
|
||||
public virtual void ExitCritState(EntityUid uid)
|
||||
{
|
||||
Standing.Stand(uid);
|
||||
_standing.Stand(uid);
|
||||
}
|
||||
|
||||
public virtual void UpdateCritState(EntityUid entity, FixedPoint2 threshold) {}
|
||||
|
||||
@@ -8,28 +8,25 @@ public abstract partial class SharedMobStateSystem
|
||||
public virtual void EnterDeadState(EntityUid uid)
|
||||
{
|
||||
EnsureComp<CollisionWakeComponent>(uid);
|
||||
Standing.Down(uid);
|
||||
_standing.Down(uid);
|
||||
|
||||
if (Standing.IsDown(uid) && TryComp<PhysicsComponent>(uid, out var physics))
|
||||
if (_standing.IsDown(uid) && TryComp<PhysicsComponent>(uid, out var physics))
|
||||
{
|
||||
physics.CanCollide = false;
|
||||
_physics.SetCanCollide(physics, false);
|
||||
}
|
||||
|
||||
if (TryComp<AppearanceComponent>(uid, out var appearance))
|
||||
{
|
||||
appearance.SetData(DamageStateVisuals.State, DamageState.Dead);
|
||||
}
|
||||
_appearance.SetData(uid, DamageStateVisuals.State, DamageState.Dead);
|
||||
}
|
||||
|
||||
public virtual void ExitDeadState(EntityUid uid)
|
||||
{
|
||||
RemComp<CollisionWakeComponent>(uid);
|
||||
|
||||
Standing.Stand(uid);
|
||||
_standing.Stand(uid);
|
||||
|
||||
if (!Standing.IsDown(uid) && TryComp<PhysicsComponent>(uid, out var physics))
|
||||
if (!_standing.IsDown(uid) && TryComp<PhysicsComponent>(uid, out var physics))
|
||||
{
|
||||
physics.CanCollide = true;
|
||||
_physics.SetCanCollide(physics, true);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -6,12 +6,8 @@ public abstract partial class SharedMobStateSystem
|
||||
{
|
||||
public virtual void EnterNormState(EntityUid uid)
|
||||
{
|
||||
Standing.Stand(uid);
|
||||
|
||||
if (TryComp<AppearanceComponent>(uid, out var appearance))
|
||||
{
|
||||
appearance.SetData(DamageStateVisuals.State, DamageState.Alive);
|
||||
}
|
||||
_standing.Stand(uid);
|
||||
_appearance.SetData(uid, DamageStateVisuals.State, DamageState.Alive);
|
||||
}
|
||||
|
||||
public virtual void UpdateNormState(EntityUid entity, FixedPoint2 threshold) {}
|
||||
|
||||
@@ -15,6 +15,7 @@ using Content.Shared.Speech;
|
||||
using Content.Shared.Standing;
|
||||
using Content.Shared.StatusEffect;
|
||||
using Content.Shared.Throwing;
|
||||
using Robust.Shared.Physics.Systems;
|
||||
using Robust.Shared.Serialization;
|
||||
|
||||
namespace Content.Shared.MobState.EntitySystems
|
||||
@@ -22,9 +23,11 @@ namespace Content.Shared.MobState.EntitySystems
|
||||
public abstract partial class SharedMobStateSystem : EntitySystem
|
||||
{
|
||||
[Dependency] protected readonly AlertsSystem Alerts = default!;
|
||||
[Dependency] private readonly ActionBlockerSystem _blocker = default!;
|
||||
[Dependency] protected readonly StandingStateSystem Standing = default!;
|
||||
[Dependency] private readonly ActionBlockerSystem _blocker = default!;
|
||||
[Dependency] private readonly SharedAppearanceSystem _appearance = default!;
|
||||
[Dependency] private readonly SharedPhysicsSystem _physics = default!;
|
||||
[Dependency] protected readonly StatusEffectsSystem Status = default!;
|
||||
[Dependency] private readonly StandingStateSystem _standing = default!;
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
|
||||
@@ -13,8 +13,10 @@ namespace Content.Shared.Stacks
|
||||
[UsedImplicitly]
|
||||
public abstract class SharedStackSystem : EntitySystem
|
||||
{
|
||||
[Dependency] protected readonly SharedAppearanceSystem Appearance = default!;
|
||||
[Dependency] protected readonly SharedPopupSystem PopupSystem = default!;
|
||||
[Dependency] protected readonly SharedHandsSystem HandsSystem = default!;
|
||||
[Dependency] protected readonly SharedTransformSystem Xform = default!;
|
||||
[Dependency] private readonly IGameTiming _gameTiming = default!;
|
||||
|
||||
public override void Initialize()
|
||||
@@ -153,10 +155,7 @@ namespace Content.Shared.Stacks
|
||||
component.Count = amount;
|
||||
Dirty(component);
|
||||
|
||||
// Change appearance data.
|
||||
if (TryComp(uid, out AppearanceComponent? appearance))
|
||||
appearance.SetData(StackVisuals.Actual, component.Count);
|
||||
|
||||
Appearance.SetData(uid, StackVisuals.Actual, component.Count);
|
||||
RaiseLocalEvent(uid, new StackCountChangedEvent(old, component.Count), false);
|
||||
}
|
||||
|
||||
@@ -189,9 +188,9 @@ namespace Content.Shared.Stacks
|
||||
if (!TryComp(uid, out AppearanceComponent? appearance))
|
||||
return;
|
||||
|
||||
appearance.SetData(StackVisuals.Actual, component.Count);
|
||||
appearance.SetData(StackVisuals.MaxCount, component.MaxCount);
|
||||
appearance.SetData(StackVisuals.Hide, false);
|
||||
Appearance.SetData(uid, StackVisuals.Actual, component.Count, appearance);
|
||||
Appearance.SetData(uid, StackVisuals.MaxCount, component.MaxCount, appearance);
|
||||
Appearance.SetData(uid, StackVisuals.Hide, false, appearance);
|
||||
}
|
||||
|
||||
private void OnStackGetState(EntityUid uid, SharedStackComponent component, ref ComponentGetState args)
|
||||
|
||||
@@ -16,6 +16,8 @@ namespace Content.Shared.Standing
|
||||
{
|
||||
[Dependency] private readonly IGameTiming _gameTiming = default!;
|
||||
[Dependency] private readonly INetManager _netMan = default!;
|
||||
[Dependency] private readonly SharedAppearanceSystem _appearance = default!;
|
||||
[Dependency] private readonly SharedAudioSystem _audio = default!;
|
||||
|
||||
// If StandingCollisionLayer value is ever changed to more than one layer, the logic needs to be edited.
|
||||
private const int StandingCollisionLayer = (int) CollisionGroup.MidImpassable;
|
||||
@@ -28,10 +30,11 @@ namespace Content.Shared.Standing
|
||||
|
||||
private void OnHandleState(EntityUid uid, StandingStateComponent component, ref ComponentHandleState args)
|
||||
{
|
||||
if (args.Current is not StandingComponentState state) return;
|
||||
if (args.Current is not StandingComponentState state)
|
||||
return;
|
||||
|
||||
component.Standing = state.Standing;
|
||||
component.ChangedFixtures = new(state.ChangedFixtures);
|
||||
component.ChangedFixtures = new List<string>(state.ChangedFixtures);
|
||||
}
|
||||
|
||||
private void OnGetState(EntityUid uid, StandingStateComponent component, ref ComponentGetState args)
|
||||
@@ -82,7 +85,7 @@ namespace Content.Shared.Standing
|
||||
RaiseLocalEvent(uid, new DownedEvent(), false);
|
||||
|
||||
// Seemed like the best place to put it
|
||||
appearance?.SetData(RotationVisuals.RotationState, RotationState.Horizontal);
|
||||
_appearance.SetData(uid, RotationVisuals.RotationState, RotationState.Horizontal, appearance);
|
||||
|
||||
// Change collision masks to allow going under certain entities like flaps and tables
|
||||
if (TryComp(uid, out FixturesComponent? fixtureComponent))
|
||||
@@ -100,10 +103,9 @@ namespace Content.Shared.Standing
|
||||
if (!_gameTiming.IsFirstTimePredicted)
|
||||
return true;
|
||||
|
||||
// TODO audio prediction
|
||||
if (playSound && _netMan.IsServer)
|
||||
if (playSound)
|
||||
{
|
||||
SoundSystem.Play(standingState.DownSound.GetSound(), Filter.Pvs(uid), uid, AudioHelpers.WithVariation(0.25f));
|
||||
_audio.PlayPredicted(standingState.DownSound, uid, uid, AudioParams.Default.WithVariation(0.25f));
|
||||
}
|
||||
|
||||
return true;
|
||||
@@ -133,7 +135,7 @@ namespace Content.Shared.Standing
|
||||
Dirty(standingState);
|
||||
RaiseLocalEvent(uid, new StoodEvent(), false);
|
||||
|
||||
appearance?.SetData(RotationVisuals.RotationState, RotationState.Vertical);
|
||||
_appearance.SetData(uid, RotationVisuals.RotationState, RotationState.Vertical, appearance);
|
||||
|
||||
if (TryComp(uid, out FixturesComponent? fixtureComponent))
|
||||
{
|
||||
|
||||
@@ -13,6 +13,7 @@ namespace Content.Shared.Storage.EntitySystems
|
||||
[UsedImplicitly]
|
||||
public abstract class SharedItemMapperSystem : EntitySystem
|
||||
{
|
||||
[Dependency] private readonly SharedAppearanceSystem _appearance = default!;
|
||||
[Dependency] private readonly SharedContainerSystem _container = default!;
|
||||
|
||||
/// <inheritdoc />
|
||||
@@ -34,27 +35,28 @@ namespace Content.Shared.Storage.EntitySystems
|
||||
if (EntityManager.TryGetComponent(component.Owner, out AppearanceComponent? appearanceComponent))
|
||||
{
|
||||
var list = new List<string>(component.MapLayers.Keys);
|
||||
appearanceComponent.SetData(StorageMapVisuals.InitLayers, new ShowLayerData(list));
|
||||
_appearance.SetData(component.Owner, StorageMapVisuals.InitLayers, new ShowLayerData(list), appearanceComponent);
|
||||
}
|
||||
}
|
||||
|
||||
private void MapperEntityRemoved(EntityUid uid, ItemMapperComponent itemMapper,
|
||||
EntRemovedFromContainerMessage args)
|
||||
{
|
||||
if (EntityManager.TryGetComponent(itemMapper.Owner, out AppearanceComponent? appearanceComponent)
|
||||
&& TryGetLayers(args, itemMapper, out var containedLayers))
|
||||
{
|
||||
appearanceComponent.SetData(StorageMapVisuals.LayerChanged, new ShowLayerData(containedLayers));
|
||||
}
|
||||
UpdateAppearance(uid, itemMapper, args);
|
||||
}
|
||||
|
||||
private void MapperEntityInserted(EntityUid uid, ItemMapperComponent itemMapper,
|
||||
EntInsertedIntoContainerMessage args)
|
||||
{
|
||||
UpdateAppearance(uid, itemMapper, args);
|
||||
}
|
||||
|
||||
private void UpdateAppearance(EntityUid uid, ItemMapperComponent itemMapper, ContainerModifiedMessage message)
|
||||
{
|
||||
if (EntityManager.TryGetComponent(itemMapper.Owner, out AppearanceComponent? appearanceComponent)
|
||||
&& TryGetLayers(args, itemMapper, out var containedLayers))
|
||||
&& TryGetLayers(message, itemMapper, out var containedLayers))
|
||||
{
|
||||
appearanceComponent.SetData(StorageMapVisuals.LayerChanged, new ShowLayerData(containedLayers));
|
||||
_appearance.SetData(itemMapper.Owner, StorageMapVisuals.LayerChanged, new ShowLayerData(containedLayers), appearanceComponent);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -44,7 +44,7 @@ public abstract partial class SharedGunSystem
|
||||
component.Entities.Add(args.Used);
|
||||
component.Container.Insert(args.Used);
|
||||
// Not predicted so
|
||||
PlaySound(uid, component.SoundInsert?.GetSound(Random, ProtoManager), args.User);
|
||||
Audio.PlayPredicted(component.SoundInsert, uid, args.User);
|
||||
args.Handled = true;
|
||||
UpdateBallisticAppearance(component);
|
||||
Dirty(component);
|
||||
@@ -80,10 +80,7 @@ public abstract partial class SharedGunSystem
|
||||
}
|
||||
|
||||
Dirty(component);
|
||||
var sound = component.SoundRack?.GetSound(Random, ProtoManager);
|
||||
|
||||
if (sound != null)
|
||||
PlaySound(component.Owner, sound, user);
|
||||
Audio.PlayPredicted(component.SoundRack, component.Owner, user);
|
||||
|
||||
var shots = GetBallisticShots(component);
|
||||
component.Cycled = true;
|
||||
@@ -208,9 +205,11 @@ public abstract partial class SharedGunSystem
|
||||
|
||||
private void UpdateBallisticAppearance(BallisticAmmoProviderComponent component)
|
||||
{
|
||||
if (!Timing.IsFirstTimePredicted || !TryComp<AppearanceComponent>(component.Owner, out var appearance)) return;
|
||||
appearance.SetData(AmmoVisuals.AmmoCount, GetBallisticShots(component));
|
||||
appearance.SetData(AmmoVisuals.AmmoMax, component.Capacity);
|
||||
if (!Timing.IsFirstTimePredicted || !TryComp<AppearanceComponent>(component.Owner, out var appearance))
|
||||
return;
|
||||
|
||||
Appearance.SetData(appearance.Owner, AmmoVisuals.AmmoCount, GetBallisticShots(component), appearance);
|
||||
Appearance.SetData(appearance.Owner, AmmoVisuals.AmmoMax, component.Capacity, appearance);
|
||||
}
|
||||
|
||||
[Serializable, NetSerializable]
|
||||
|
||||
@@ -70,9 +70,10 @@ public abstract partial class SharedGunSystem
|
||||
private void UpdateBasicEntityAppearance(BasicEntityAmmoProviderComponent component)
|
||||
{
|
||||
if (!Timing.IsFirstTimePredicted || !TryComp<AppearanceComponent>(component.Owner, out var appearance)) return;
|
||||
appearance.SetData(AmmoVisuals.HasAmmo, component.Count != 0);
|
||||
appearance.SetData(AmmoVisuals.AmmoCount, component.Count ?? int.MaxValue);
|
||||
appearance.SetData(AmmoVisuals.AmmoMax, component.Capacity ?? int.MaxValue);
|
||||
|
||||
Appearance.SetData(appearance.Owner, AmmoVisuals.HasAmmo, component.Count != 0, appearance);
|
||||
Appearance.SetData(appearance.Owner, AmmoVisuals.AmmoCount, component.Count ?? int.MaxValue, appearance);
|
||||
Appearance.SetData(appearance.Owner, AmmoVisuals.AmmoMax, component.Capacity ?? int.MaxValue, appearance);
|
||||
}
|
||||
|
||||
#region Public API
|
||||
|
||||
@@ -69,7 +69,7 @@ public abstract partial class SharedGunSystem
|
||||
else
|
||||
component.NextFire += cooldown;
|
||||
|
||||
PlaySound(component.Owner, component.SoundModeToggle?.GetSound(Random, ProtoManager), user);
|
||||
Audio.PlayPredicted(component.SoundModeToggle, component.Owner, user);
|
||||
Popup(Loc.GetString("gun-selected-mode", ("mode", GetLocSelector(fire))), component.Owner, user);
|
||||
Dirty(component);
|
||||
}
|
||||
|
||||
@@ -58,8 +58,10 @@ public abstract partial class SharedGunSystem
|
||||
private void OnMagazineSlotChange(EntityUid uid, MagazineAmmoProviderComponent component, ref ItemSlotChangedEvent args)
|
||||
{
|
||||
UpdateAmmoCount(uid);
|
||||
if (!TryComp<AppearanceComponent>(uid, out var appearance)) return;
|
||||
appearance.SetData(AmmoVisuals.MagLoaded, GetMagazineEntity(uid) != null);
|
||||
if (!TryComp<AppearanceComponent>(uid, out var appearance))
|
||||
return;
|
||||
|
||||
Appearance.SetData(uid, AmmoVisuals.MagLoaded, GetMagazineEntity(uid) != null, appearance);
|
||||
}
|
||||
|
||||
protected (int, int) GetMagazineCountCapacity(MagazineAmmoProviderComponent component)
|
||||
@@ -93,7 +95,7 @@ public abstract partial class SharedGunSystem
|
||||
|
||||
if (magEntity == null)
|
||||
{
|
||||
appearance?.SetData(AmmoVisuals.MagLoaded, false);
|
||||
Appearance.SetData(uid, AmmoVisuals.MagLoaded, false, appearance);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -112,7 +114,7 @@ public abstract partial class SharedGunSystem
|
||||
if (component.AutoEject && args.Ammo.Count == 0)
|
||||
{
|
||||
EjectMagazine(component);
|
||||
PlaySound(uid, component.SoundAutoEject?.GetSound(Random, ProtoManager), args.User);
|
||||
Audio.PlayPredicted(component.SoundAutoEject, uid, args.User);
|
||||
}
|
||||
|
||||
UpdateMagazineAppearance(appearance, true, count, capacity);
|
||||
@@ -144,11 +146,14 @@ public abstract partial class SharedGunSystem
|
||||
|
||||
private void UpdateMagazineAppearance(AppearanceComponent? appearance, bool magLoaded, int count, int capacity)
|
||||
{
|
||||
if (appearance == null)
|
||||
return;
|
||||
|
||||
// Copy the magazine's appearance data
|
||||
appearance?.SetData(AmmoVisuals.MagLoaded, magLoaded);
|
||||
appearance?.SetData(AmmoVisuals.HasAmmo, count != 0);
|
||||
appearance?.SetData(AmmoVisuals.AmmoCount, count);
|
||||
appearance?.SetData(AmmoVisuals.AmmoMax, capacity);
|
||||
Appearance.SetData(appearance.Owner, AmmoVisuals.MagLoaded, magLoaded, appearance);
|
||||
Appearance.SetData(appearance.Owner, AmmoVisuals.HasAmmo, count != 0, appearance);
|
||||
Appearance.SetData(appearance.Owner, AmmoVisuals.AmmoCount, count, appearance);
|
||||
Appearance.SetData(appearance.Owner, AmmoVisuals.AmmoMax, capacity, appearance);
|
||||
}
|
||||
|
||||
private void EjectMagazine(MagazineAmmoProviderComponent component)
|
||||
|
||||
@@ -84,7 +84,7 @@ public partial class SharedGunSystem
|
||||
|
||||
component.AmmoSlots[index] = uid;
|
||||
component.AmmoContainer.Insert(uid);
|
||||
PlaySound(component.Owner, component.SoundInsert?.GetSound(Random, ProtoManager), user);
|
||||
Audio.PlayPredicted(component.SoundInsert, component.Owner, user);
|
||||
Popup(Loc.GetString("gun-revolver-insert"), component.Owner, user);
|
||||
UpdateRevolverAppearance(component);
|
||||
UpdateAmmoCount(uid);
|
||||
@@ -210,7 +210,7 @@ public partial class SharedGunSystem
|
||||
|
||||
if (anyEmpty)
|
||||
{
|
||||
PlaySound(component.Owner, component.SoundEject?.GetSound(Random, ProtoManager), user);
|
||||
Audio.PlayPredicted(component.SoundEject, component.Owner, user);
|
||||
UpdateAmmoCount(component.Owner);
|
||||
UpdateRevolverAppearance(component);
|
||||
Dirty(component);
|
||||
@@ -219,16 +219,18 @@ public partial class SharedGunSystem
|
||||
|
||||
private void UpdateRevolverAppearance(RevolverAmmoProviderComponent component)
|
||||
{
|
||||
if (!TryComp<AppearanceComponent>(component.Owner, out var appearance)) return;
|
||||
if (!TryComp<AppearanceComponent>(component.Owner, out var appearance))
|
||||
return;
|
||||
|
||||
var count = GetRevolverCount(component);
|
||||
appearance.SetData(AmmoVisuals.HasAmmo, count != 0);
|
||||
appearance.SetData(AmmoVisuals.AmmoCount, count);
|
||||
appearance.SetData(AmmoVisuals.AmmoMax, component.Capacity);
|
||||
Appearance.SetData(component.Owner, AmmoVisuals.HasAmmo, count != 0, appearance);
|
||||
Appearance.SetData(component.Owner, AmmoVisuals.AmmoCount, count, appearance);
|
||||
Appearance.SetData(component.Owner, AmmoVisuals.AmmoMax, component.Capacity, appearance);
|
||||
}
|
||||
|
||||
protected virtual void SpinRevolver(RevolverAmmoProviderComponent component, EntityUid? user = null)
|
||||
{
|
||||
PlaySound(component.Owner, component.SoundSpin?.GetSound(Random, ProtoManager), user);
|
||||
Audio.PlayPredicted(component.SoundSpin, component.Owner, user);
|
||||
Popup(Loc.GetString("gun-revolver-spun"), component.Owner, user);
|
||||
}
|
||||
|
||||
|
||||
@@ -275,7 +275,7 @@ public abstract partial class SharedGunSystem : EntitySystem
|
||||
// Don't spam safety sounds at gun fire rate, play it at a reduced rate.
|
||||
// May cause prediction issues? Needs more tweaking
|
||||
gun.NextFire = TimeSpan.FromSeconds(Math.Max(lastFire.TotalSeconds + SafetyNextFire, gun.NextFire.TotalSeconds));
|
||||
PlaySound(gun.Owner, gun.SoundEmpty?.GetSound(Random, ProtoManager), user);
|
||||
Audio.PlayPredicted(gun.SoundEmpty, gun.Owner, user);
|
||||
Dirty(gun);
|
||||
return;
|
||||
}
|
||||
@@ -351,15 +351,10 @@ public abstract partial class SharedGunSystem : EntitySystem
|
||||
xform.LocalRotation = Random.NextAngle();
|
||||
xform.Coordinates = coordinates;
|
||||
|
||||
string? sound = null;
|
||||
|
||||
if (TryComp<CartridgeAmmoComponent>(entity, out var cartridge))
|
||||
if (playSound && TryComp<CartridgeAmmoComponent>(entity, out var cartridge))
|
||||
{
|
||||
sound = cartridge.EjectSound?.GetSound(Random, ProtoManager);
|
||||
Audio.PlayPvs(cartridge.EjectSound, entity, AudioParams.Default.WithVariation(0.05f).WithVolume(-1f));
|
||||
}
|
||||
|
||||
if (sound != null && playSound)
|
||||
SoundSystem.Play(sound, Filter.Pvs(entity, entityManager: EntityManager), coordinates, AudioHelpers.WithVariation(0.05f).WithVolume(-1f));
|
||||
}
|
||||
|
||||
protected void MuzzleFlash(EntityUid gun, AmmoComponent component, EntityUid? user = null)
|
||||
|
||||
@@ -72,7 +72,7 @@ namespace Content.Shared.Whitelist
|
||||
if (Components != null && _registrations == null)
|
||||
UpdateRegistrations();
|
||||
|
||||
entityManager ??= IoCManager.Resolve<IEntityManager>();
|
||||
IoCManager.Resolve(ref entityManager);
|
||||
if (_registrations != null)
|
||||
{
|
||||
foreach (var reg in _registrations)
|
||||
@@ -89,7 +89,7 @@ namespace Content.Shared.Whitelist
|
||||
|
||||
if (Tags != null && entityManager.TryGetComponent(uid, out TagComponent? tags))
|
||||
{
|
||||
var tagSystem = EntitySystem.Get<TagSystem>();
|
||||
var tagSystem = entityManager.System<TagSystem>();
|
||||
return RequireAll ? tagSystem.HasAllTags(tags, Tags) : tagSystem.HasAnyTag(tags, Tags);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user