Fix 3000 errors
This commit is contained in:
@@ -25,7 +25,7 @@ namespace Content.Client.Weapons.Melee.Components
|
||||
_sprite = IoCManager.Resolve<IEntityManager>().GetComponent<SpriteComponent>(Owner);
|
||||
}
|
||||
|
||||
public void SetData(MeleeWeaponAnimationPrototype prototype, Angle baseAngle, IEntity attacker, bool followAttacker = true)
|
||||
public void SetData(MeleeWeaponAnimationPrototype prototype, Angle baseAngle, EntityUid attacker, bool followAttacker = true)
|
||||
{
|
||||
_meleeWeaponAnimation = prototype;
|
||||
_sprite?.AddLayer(new RSI.StateId(prototype.State));
|
||||
@@ -72,7 +72,7 @@ namespace Content.Client.Weapons.Melee.Components
|
||||
|
||||
if (_meleeWeaponAnimation.Length.TotalSeconds <= _timer)
|
||||
{
|
||||
IoCManager.Resolve<IEntityManager>().DeleteEntity((EntityUid) Owner);
|
||||
IoCManager.Resolve<IEntityManager>().DeleteEntity(Owner);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -44,28 +44,29 @@ namespace Content.Client.Weapons.Melee
|
||||
return;
|
||||
}
|
||||
|
||||
if (!EntityManager.TryGetEntity(msg.Attacker, out var attacker))
|
||||
var attacker = msg.Attacker;
|
||||
if (!EntityManager.EntityExists(msg.Attacker))
|
||||
{
|
||||
// FIXME: This should never happen.
|
||||
Logger.Error($"Tried to play a weapon arc {msg.ArcPrototype}, but the attacker does not exist. attacker={msg.Attacker}, source={msg.Source}");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!((!IoCManager.Resolve<IEntityManager>().EntityExists(attacker) ? EntityLifeStage.Deleted : IoCManager.Resolve<IEntityManager>().GetComponent<MetaDataComponent>(attacker).EntityLifeStage) >= EntityLifeStage.Deleted))
|
||||
if (!((!EntityManager.EntityExists(attacker) ? EntityLifeStage.Deleted : EntityManager.GetComponent<MetaDataComponent>(attacker).EntityLifeStage) >= EntityLifeStage.Deleted))
|
||||
{
|
||||
var lunge = attacker.EnsureComponent<MeleeLungeComponent>();
|
||||
lunge.SetData(msg.Angle);
|
||||
|
||||
var entity = EntityManager.SpawnEntity(weaponArc.Prototype, IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(attacker).Coordinates);
|
||||
IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(entity).LocalRotation = msg.Angle;
|
||||
var entity = EntityManager.SpawnEntity(weaponArc.Prototype, EntityManager.GetComponent<TransformComponent>(attacker).Coordinates);
|
||||
EntityManager.GetComponent<TransformComponent>(entity).LocalRotation = msg.Angle;
|
||||
|
||||
var weaponArcAnimation = IoCManager.Resolve<IEntityManager>().GetComponent<MeleeWeaponArcAnimationComponent>(entity);
|
||||
var weaponArcAnimation = EntityManager.GetComponent<MeleeWeaponArcAnimationComponent>(entity);
|
||||
weaponArcAnimation.SetData(weaponArc, msg.Angle, attacker, msg.ArcFollowAttacker);
|
||||
|
||||
// Due to ISpriteComponent limitations, weapons that don't use an RSI won't have this effect.
|
||||
if (EntityManager.TryGetEntity(msg.Source, out var source) &&
|
||||
if (EntityManager.EntityExists(msg.Source) &&
|
||||
msg.TextureEffect &&
|
||||
IoCManager.Resolve<IEntityManager>().TryGetComponent(source, out ISpriteComponent? sourceSprite) &&
|
||||
EntityManager.TryGetComponent(msg.Source, out ISpriteComponent? sourceSprite) &&
|
||||
sourceSprite.BaseRSI?.Path != null)
|
||||
{
|
||||
var curTime = _gameTiming.CurTime;
|
||||
@@ -73,7 +74,7 @@ namespace Content.Client.Weapons.Melee
|
||||
{
|
||||
EffectSprite = sourceSprite.BaseRSI.Path.ToString(),
|
||||
RsiState = sourceSprite.LayerGetState(0).Name,
|
||||
Coordinates = IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(attacker).Coordinates,
|
||||
Coordinates = EntityManager.GetComponent<TransformComponent>(attacker).Coordinates,
|
||||
Color = Vector4.Multiply(new Vector4(255, 255, 255, 125), 1.0f),
|
||||
ColorDelta = Vector4.Multiply(new Vector4(0, 0, 0, -10), 1.0f),
|
||||
Velocity = msg.Angle.ToWorldVec(),
|
||||
@@ -86,14 +87,14 @@ namespace Content.Client.Weapons.Melee
|
||||
}
|
||||
}
|
||||
|
||||
foreach (var uid in msg.Hits)
|
||||
foreach (var hit in msg.Hits)
|
||||
{
|
||||
if (!EntityManager.TryGetEntity(uid, out var hitEntity) || (!IoCManager.Resolve<IEntityManager>().EntityExists(hitEntity) ? EntityLifeStage.Deleted : IoCManager.Resolve<IEntityManager>().GetComponent<MetaDataComponent>(hitEntity).EntityLifeStage) >= EntityLifeStage.Deleted)
|
||||
if (!EntityManager.EntityExists(hit))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!IoCManager.Resolve<IEntityManager>().TryGetComponent(hitEntity, out ISpriteComponent? sprite))
|
||||
if (!EntityManager.TryGetComponent(hit, out ISpriteComponent? sprite))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
@@ -102,7 +103,7 @@ namespace Content.Client.Weapons.Melee
|
||||
var newColor = Color.Red * originalColor;
|
||||
sprite.Color = newColor;
|
||||
|
||||
hitEntity.SpawnTimer(100, () =>
|
||||
hit.SpawnTimer(100, () =>
|
||||
{
|
||||
// Only reset back to the original color if something else didn't change the color in the mean time.
|
||||
if (sprite.Color == newColor)
|
||||
@@ -115,9 +116,9 @@ namespace Content.Client.Weapons.Melee
|
||||
|
||||
private void PlayLunge(PlayLungeAnimationMessage msg)
|
||||
{
|
||||
if (EntityManager.TryGetEntity(msg.Source, out var entity))
|
||||
if (EntityManager.EntityExists(msg.Source))
|
||||
{
|
||||
entity.EnsureComponent<MeleeLungeComponent>().SetData(msg.Angle);
|
||||
msg.Source.EnsureComponent<MeleeLungeComponent>().SetData(msg.Angle);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -9,7 +9,7 @@ namespace Content.Client.Weapons.Ranged.Barrels.Visualizers
|
||||
[UsedImplicitly]
|
||||
public sealed class BarrelBoltVisualizer : AppearanceVisualizer
|
||||
{
|
||||
public override void InitializeEntity(IEntity entity)
|
||||
public override void InitializeEntity(EntityUid entity)
|
||||
{
|
||||
base.InitializeEntity(entity);
|
||||
var sprite = IoCManager.Resolve<IEntityManager>().GetComponent<ISpriteComponent>(entity);
|
||||
|
||||
@@ -19,7 +19,7 @@ namespace Content.Client.Weapons.Ranged.Barrels.Visualizers
|
||||
[DataField("zeroVisible")]
|
||||
private bool _zeroVisible;
|
||||
|
||||
public override void InitializeEntity(IEntity entity)
|
||||
public override void InitializeEntity(EntityUid entity)
|
||||
{
|
||||
base.InitializeEntity(entity);
|
||||
var sprite = IoCManager.Resolve<IEntityManager>().GetComponent<ISpriteComponent>(entity);
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
using System;
|
||||
using Content.Client.CombatMode;
|
||||
using Content.Client.Hands;
|
||||
using Content.Shared.Hands.Components;
|
||||
using Content.Shared.Weapons.Ranged.Components;
|
||||
using JetBrains.Annotations;
|
||||
@@ -48,12 +47,12 @@ namespace Content.Client.Weapons.Ranged
|
||||
}
|
||||
|
||||
var entity = _playerManager.LocalPlayer?.ControlledEntity;
|
||||
if (entity == null || !IoCManager.Resolve<IEntityManager>().TryGetComponent(entity, out SharedHandsComponent? hands))
|
||||
if (entity == default || !EntityManager.TryGetComponent(entity.Value, out SharedHandsComponent? hands))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (!hands.TryGetActiveHeldEntity(out var held) || !IoCManager.Resolve<IEntityManager>().TryGetComponent(held, out ClientRangedWeaponComponent? weapon))
|
||||
if (!hands.TryGetActiveHeldEntity(out var held) || !EntityManager.TryGetComponent(held, out ClientRangedWeaponComponent? weapon))
|
||||
{
|
||||
_blocked = true;
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user