Map System Code Refactor (#204)
* Removes static `IoCManager` service locator calls from `Robust.Shared.Map` namespace. * Misc code cleanup and filling out doc comments for Map classes. * Added Union and Intersect methods to Box2. * Any touched component was converted from static IoC calls to field injection. Sibling PR to https://github.com/space-wizards/RobustToolbox/pull/796.
This commit is contained in:
committed by
Pieter-Jan Briers
parent
50f42d71a2
commit
d3daa83b82
@@ -1,22 +1,21 @@
|
||||
using System;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Content.Server.GameObjects.EntitySystems;
|
||||
using Robust.Shared.Interfaces.GameObjects;
|
||||
using Robust.Shared.Map;
|
||||
using Robust.Shared.IoC;
|
||||
using Robust.Server.GameObjects;
|
||||
using Robust.Shared.Maths;
|
||||
using Robust.Server.Interfaces.GameObjects;
|
||||
using Robust.Shared.Interfaces.Timing;
|
||||
using Robust.Shared.GameObjects.EntitySystemMessages;
|
||||
using Robust.Shared.Serialization;
|
||||
using Robust.Shared.Interfaces.GameObjects.Components;
|
||||
using Content.Shared.GameObjects;
|
||||
using Robust.Shared.Interfaces.Map;
|
||||
|
||||
namespace Content.Server.GameObjects.Components.Weapon.Melee
|
||||
{
|
||||
public class MeleeWeaponComponent : Component, IAfterAttack
|
||||
{
|
||||
#pragma warning disable 649
|
||||
[Dependency] private readonly IMapManager _mapManager;
|
||||
[Dependency] private readonly IServerEntityManager _serverEntityManager;
|
||||
#pragma warning restore 649
|
||||
|
||||
public override string Name => "MeleeWeapon";
|
||||
|
||||
public int Damage = 1;
|
||||
@@ -34,13 +33,13 @@ namespace Content.Server.GameObjects.Components.Weapon.Melee
|
||||
|
||||
void IAfterAttack.AfterAttack(AfterAttackEventArgs eventArgs)
|
||||
{
|
||||
var location = eventArgs.User.GetComponent<ITransformComponent>().GridPosition;
|
||||
var angle = new Angle(eventArgs.ClickLocation.ToWorld().Position - location.ToWorld().Position);
|
||||
var entities = IoCManager.Resolve<IServerEntityManager>().GetEntitiesInArc(eventArgs.User.GetComponent<ITransformComponent>().GridPosition, Range, angle, ArcWidth);
|
||||
var location = eventArgs.User.Transform.GridPosition;
|
||||
var angle = new Angle(eventArgs.ClickLocation.ToWorld(_mapManager).Position - location.ToWorld(_mapManager).Position);
|
||||
var entities = _serverEntityManager.GetEntitiesInArc(eventArgs.User.Transform.GridPosition, Range, angle, ArcWidth);
|
||||
|
||||
foreach (var entity in entities)
|
||||
{
|
||||
if (!entity.GetComponent<ITransformComponent>().IsMapTransform || entity == eventArgs.User)
|
||||
if (!entity.Transform.IsMapTransform || entity == eventArgs.User)
|
||||
continue;
|
||||
|
||||
if (entity.TryGetComponent(out DamageableComponent damagecomponent))
|
||||
|
||||
Reference in New Issue
Block a user