cleanup melee (#32486)
* it removes warns ig * Quick fix --------- Co-authored-by: metalgearsloth <comedian_vs_clown@hotmail.com>
This commit is contained in:
committed by
GitHub
parent
97f6097dad
commit
9b71757c07
@@ -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<TransformComponent> _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.
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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<EntityUid>(), 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<EntityUid>(), 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;
|
||||
|
||||
Reference in New Issue
Block a user