@@ -1,6 +1,5 @@
|
||||
using System;
|
||||
using Content.Shared.GameObjects.Components.Weapons;
|
||||
using Content.Shared.Physics;
|
||||
using Content.Shared.Utility;
|
||||
using Robust.Server.GameObjects;
|
||||
using Robust.Shared.GameObjects;
|
||||
@@ -32,17 +31,18 @@ namespace Content.Server.GameObjects.Components.Weapon
|
||||
|
||||
public static void FlashAreaHelper(IEntity source, float range, float duration, string sound = null)
|
||||
{
|
||||
foreach (var entity in source.EntityManager.GetEntitiesInRange(source.Transform.Coordinates, range))
|
||||
foreach (var entity in IoCManager.Resolve<IEntityManager>().GetEntitiesInRange(source.Transform.Coordinates, range))
|
||||
{
|
||||
if (!entity.TryGetComponent(out FlashableComponent flashable) ||
|
||||
!source.InRangeUnobstructed(entity, range, CollisionGroup.Opaque)) continue;
|
||||
if (!source.InRangeUnobstructed(entity, range, popup: true))
|
||||
continue;
|
||||
|
||||
flashable.Flash(duration);
|
||||
if(entity.TryGetComponent(out FlashableComponent flashable))
|
||||
flashable.Flash(duration);
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(sound))
|
||||
{
|
||||
EntitySystem.Get<AudioSystem>().PlayAtCoords(sound, source.Transform.Coordinates);
|
||||
IoCManager.Resolve<IEntitySystemManager>().GetEntitySystem<AudioSystem>().PlayAtCoords(sound, source.Transform.Coordinates);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,7 +12,6 @@ using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.IoC;
|
||||
using Robust.Shared.Maths;
|
||||
using Robust.Shared.Physics;
|
||||
using Robust.Shared.Physics.Broadphase;
|
||||
using Robust.Shared.Serialization;
|
||||
using Robust.Shared.Timing;
|
||||
using Robust.Shared.ViewVariables;
|
||||
@@ -197,13 +196,10 @@ namespace Content.Server.GameObjects.Components.Weapon.Melee
|
||||
for (var i = 0; i < increments; i++)
|
||||
{
|
||||
var castAngle = new Angle(baseAngle + increment * i);
|
||||
var res = EntitySystem.Get<SharedBroadPhaseSystem>().IntersectRay(mapId,
|
||||
new CollisionRay(position, castAngle.ToVec(),
|
||||
(int) (CollisionGroup.Impassable | CollisionGroup.MobImpassable)), Range, ignore).ToList();
|
||||
|
||||
if (res.Count != 0)
|
||||
var res = _physicsManager.IntersectRay(mapId, new CollisionRay(position, castAngle.ToWorldVec(), (int) (CollisionGroup.Impassable|CollisionGroup.MobImpassable)), Range, ignore).FirstOrDefault();
|
||||
if (res.HitEntity != null)
|
||||
{
|
||||
resSet.Add(res[0].HitEntity);
|
||||
resSet.Add(res.HitEntity);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -20,7 +20,6 @@ using Robust.Shared.Log;
|
||||
using Robust.Shared.Map;
|
||||
using Robust.Shared.Maths;
|
||||
using Robust.Shared.Physics;
|
||||
using Robust.Shared.Physics.Broadphase;
|
||||
using Robust.Shared.Prototypes;
|
||||
using Robust.Shared.Random;
|
||||
using Robust.Shared.Serialization;
|
||||
@@ -384,14 +383,15 @@ namespace Content.Server.GameObjects.Components.Weapon.Ranged.Barrels
|
||||
projectileAngle = angle;
|
||||
}
|
||||
|
||||
var physics = projectile.GetComponent<IPhysBody>();
|
||||
physics.BodyStatus = BodyStatus.InAir;
|
||||
var physics = projectile.GetComponent<IPhysicsComponent>();
|
||||
physics.Status = BodyStatus.InAir;
|
||||
|
||||
var projectileComponent = projectile.GetComponent<ProjectileComponent>();
|
||||
projectileComponent.IgnoreEntity(shooter);
|
||||
|
||||
projectile
|
||||
.GetComponent<IPhysBody>()
|
||||
.GetComponent<IPhysicsComponent>()
|
||||
.EnsureController<BulletController>()
|
||||
.LinearVelocity = projectileAngle.ToVec() * velocity;
|
||||
|
||||
projectile.Transform.LocalRotation = projectileAngle + MathHelper.PiOver2;
|
||||
@@ -421,7 +421,7 @@ namespace Content.Server.GameObjects.Components.Weapon.Ranged.Barrels
|
||||
private void FireHitscan(IEntity shooter, HitscanComponent hitscan, Angle angle)
|
||||
{
|
||||
var ray = new CollisionRay(Owner.Transform.Coordinates.ToMapPos(Owner.EntityManager), angle.ToVec(), (int) hitscan.CollisionMask);
|
||||
var physicsManager = EntitySystem.Get<SharedBroadPhaseSystem>();
|
||||
var physicsManager = IoCManager.Resolve<IPhysicsManager>();
|
||||
var rayCastResults = physicsManager.IntersectRay(Owner.Transform.MapID, ray, hitscan.MaxLength, shooter, false).ToList();
|
||||
|
||||
if (rayCastResults.Count >= 1)
|
||||
|
||||
Reference in New Issue
Block a user