From: Джексон Миссиссиппи Date: Mon, 14 Oct 2024 05:40:59 +0000 (-0500) Subject: cleanup melee (#32486) X-Git-Url: https://git.smokeofanarchy.ru/gitweb.cgi?a=commitdiff_plain;h=9b71757c0765eee1dc56bd108d1413e107c86eac;p=space-station-14.git cleanup melee (#32486) * it removes warns ig * Quick fix --------- Co-authored-by: metalgearsloth --- diff --git a/Content.Client/Weapons/Melee/MeleeWeaponSystem.cs b/Content.Client/Weapons/Melee/MeleeWeaponSystem.cs index 7604d5f880..26ec75f995 100644 --- a/Content.Client/Weapons/Melee/MeleeWeaponSystem.cs +++ b/Content.Client/Weapons/Melee/MeleeWeaponSystem.cs @@ -28,6 +28,7 @@ public sealed partial class MeleeWeaponSystem : SharedMeleeWeaponSystem [Dependency] private readonly AnimationPlayerSystem _animation = default!; [Dependency] private readonly InputSystem _inputSystem = default!; [Dependency] private readonly SharedColorFlashEffectSystem _color = default!; + [Dependency] private readonly MapSystem _map = default!; private EntityQuery _xformQuery; @@ -109,11 +110,11 @@ public sealed partial class MeleeWeaponSystem : SharedMeleeWeaponSystem if (MapManager.TryFindGridAt(mousePos, out var gridUid, out _)) { - coordinates = EntityCoordinates.FromMap(gridUid, mousePos, TransformSystem, EntityManager); + coordinates = TransformSystem.ToCoordinates(gridUid, mousePos); } else { - coordinates = EntityCoordinates.FromMap(MapManager.GetMapEntityId(mousePos.MapId), mousePos, TransformSystem, EntityManager); + coordinates = TransformSystem.ToCoordinates(_map.GetMap(mousePos.MapId), mousePos); } // Heavy attack. diff --git a/Content.Server/Weapons/Melee/MeleeWeaponSystem.cs b/Content.Server/Weapons/Melee/MeleeWeaponSystem.cs index 190a2d0263..ec462ae23e 100644 --- a/Content.Server/Weapons/Melee/MeleeWeaponSystem.cs +++ b/Content.Server/Weapons/Melee/MeleeWeaponSystem.cs @@ -56,8 +56,14 @@ public sealed class MeleeWeaponSystem : SharedMeleeWeaponSystem _damageExamine.AddDamageExamine(args.Message, damageSpec, Loc.GetString("damage-melee")); } - protected override bool ArcRaySuccessful(EntityUid targetUid, Vector2 position, Angle angle, Angle arcWidth, float range, MapId mapId, - EntityUid ignore, ICommonSession? session) + protected override bool ArcRaySuccessful(EntityUid targetUid, + Vector2 position, + Angle angle, + Angle arcWidth, + float range, + MapId mapId, + EntityUid ignore, + ICommonSession? session) { // Originally the client didn't predict damage effects so you'd intuit some level of how far // in the future you'd need to predict, but then there was a lot of complaining like "why would you add artifical delay" as if ping is a choice. diff --git a/Content.Shared/Weapons/Melee/SharedMeleeWeaponSystem.cs b/Content.Shared/Weapons/Melee/SharedMeleeWeaponSystem.cs index bc19235cd3..9b15e5f8a0 100644 --- a/Content.Shared/Weapons/Melee/SharedMeleeWeaponSystem.cs +++ b/Content.Shared/Weapons/Melee/SharedMeleeWeaponSystem.cs @@ -435,7 +435,7 @@ public abstract class SharedMeleeWeaponSystem : EntitySystem throw new NotImplementedException(); } - DoLungeAnimation(user, weaponUid, weapon.Angle, GetCoordinates(attack.Coordinates).ToMap(EntityManager, TransformSystem), weapon.Range, animation); + DoLungeAnimation(user, weaponUid, weapon.Angle, TransformSystem.ToMapCoordinates(GetCoordinates(attack.Coordinates)), weapon.Range, animation); } var attackEv = new MeleeAttackEvent(weaponUid); @@ -467,12 +467,14 @@ public abstract class SharedMeleeWeaponSystem : EntitySystem // TODO: This needs fixing if (meleeUid == user) { - AdminLogger.Add(LogType.MeleeHit, LogImpact.Low, + AdminLogger.Add(LogType.MeleeHit, + LogImpact.Low, $"{ToPrettyString(user):actor} melee attacked (light) using their hands and missed"); } else { - AdminLogger.Add(LogType.MeleeHit, LogImpact.Low, + AdminLogger.Add(LogType.MeleeHit, + LogImpact.Low, $"{ToPrettyString(user):actor} melee attacked (light) using {ToPrettyString(meleeUid):tool} and missed"); } var missEvent = new MeleeHitEvent(new List(), user, meleeUid, damage, null); @@ -521,12 +523,14 @@ public abstract class SharedMeleeWeaponSystem : EntitySystem if (meleeUid == user) { - AdminLogger.Add(LogType.MeleeHit, LogImpact.Medium, + AdminLogger.Add(LogType.MeleeHit, + LogImpact.Medium, $"{ToPrettyString(user):actor} melee attacked (light) {ToPrettyString(target.Value):subject} using their hands and dealt {damageResult.GetTotal():damage} damage"); } else { - AdminLogger.Add(LogType.MeleeHit, LogImpact.Medium, + AdminLogger.Add(LogType.MeleeHit, + LogImpact.Medium, $"{ToPrettyString(user):actor} melee attacked (light) {ToPrettyString(target.Value):subject} using {ToPrettyString(meleeUid):tool} and dealt {damageResult.GetTotal():damage} damage"); } @@ -548,7 +552,7 @@ public abstract class SharedMeleeWeaponSystem : EntitySystem if (!TryComp(user, out TransformComponent? userXform)) return false; - var targetMap = GetCoordinates(ev.Coordinates).ToMap(EntityManager, TransformSystem); + var targetMap = TransformSystem.ToMapCoordinates(GetCoordinates(ev.Coordinates)); if (targetMap.MapId != userXform.MapID) return false; @@ -564,12 +568,14 @@ public abstract class SharedMeleeWeaponSystem : EntitySystem { if (meleeUid == user) { - AdminLogger.Add(LogType.MeleeHit, LogImpact.Low, + AdminLogger.Add(LogType.MeleeHit, + LogImpact.Low, $"{ToPrettyString(user):actor} melee attacked (heavy) using their hands and missed"); } else { - AdminLogger.Add(LogType.MeleeHit, LogImpact.Low, + AdminLogger.Add(LogType.MeleeHit, + LogImpact.Low, $"{ToPrettyString(user):actor} melee attacked (heavy) using {ToPrettyString(meleeUid):tool} and missed"); } var missEvent = new MeleeHitEvent(new List(), user, meleeUid, damage, direction); @@ -590,8 +596,14 @@ public abstract class SharedMeleeWeaponSystem : EntitySystem // Validate client for (var i = entities.Count - 1; i >= 0; i--) { - if (ArcRaySuccessful(entities[i], userPos, direction.ToWorldAngle(), component.Angle, distance, - userXform.MapID, user, session)) + if (ArcRaySuccessful(entities[i], + userPos, + direction.ToWorldAngle(), + component.Angle, + distance, + userXform.MapID, + user, + session)) { continue; } @@ -662,12 +674,14 @@ public abstract class SharedMeleeWeaponSystem : EntitySystem if (meleeUid == user) { - AdminLogger.Add(LogType.MeleeHit, LogImpact.Medium, + AdminLogger.Add(LogType.MeleeHit, + LogImpact.Medium, $"{ToPrettyString(user):actor} melee attacked (heavy) {ToPrettyString(entity):subject} using their hands and dealt {damageResult.GetTotal():damage} damage"); } else { - AdminLogger.Add(LogType.MeleeHit, LogImpact.Medium, + AdminLogger.Add(LogType.MeleeHit, + LogImpact.Medium, $"{ToPrettyString(user):actor} melee attacked (heavy) {ToPrettyString(entity):subject} using {ToPrettyString(meleeUid):tool} and dealt {damageResult.GetTotal():damage} damage"); } } @@ -701,8 +715,13 @@ public abstract class SharedMeleeWeaponSystem : EntitySystem { var castAngle = new Angle(baseAngle + increment * i); var res = _physics.IntersectRay(mapId, - new CollisionRay(position, castAngle.ToWorldVec(), - AttackMask), range, ignore, false).ToList(); + new CollisionRay(position, + castAngle.ToWorldVec(), + AttackMask), + range, + ignore, + false) + .ToList(); if (res.Count != 0) { @@ -713,8 +732,14 @@ public abstract class SharedMeleeWeaponSystem : EntitySystem return resSet; } - protected virtual bool ArcRaySuccessful(EntityUid targetUid, Vector2 position, Angle angle, Angle arcWidth, float range, - MapId mapId, EntityUid ignore, ICommonSession? session) + protected virtual bool ArcRaySuccessful(EntityUid targetUid, + Vector2 position, + Angle angle, + Angle arcWidth, + float range, + MapId mapId, + EntityUid ignore, + ICommonSession? session) { // Only matters for server. return true;