Merge branch 'master' into 2020-08-19-firelocks

# Conflicts:
#	Content.Server/GameObjects/Components/Atmos/AirtightComponent.cs
This commit is contained in:
Víctor Aguilera Puerto
2020-09-06 16:56:43 +02:00
197 changed files with 846 additions and 670 deletions

View File

@@ -49,7 +49,7 @@ namespace Content.Client
private void DoNotifyCoordinates(MsgDoNotifyCoordinates message)
{
PopupMessage(_eyeManager.WorldToScreen(message.Coordinates), message.Message);
PopupMessage(_eyeManager.CoordinatesToScreen(message.Coordinates), message.Message);
}
private void DoNotifyEntity(MsgDoNotifyEntity message)
@@ -59,27 +59,27 @@ namespace Content.Client
return;
}
PopupMessage(_eyeManager.WorldToScreen(entity.Transform.GridPosition), message.Message);
PopupMessage(_eyeManager.CoordinatesToScreen(entity.Transform.Coordinates), message.Message);
}
public override void PopupMessage(IEntity source, IEntity viewer, string message)
{
if (viewer != _playerManager.LocalPlayer.ControlledEntity)
if (viewer != _playerManager.LocalPlayer?.ControlledEntity)
{
return;
}
PopupMessage(_eyeManager.WorldToScreen(source.Transform.GridPosition), message);
PopupMessage(_eyeManager.CoordinatesToScreen(source.Transform.Coordinates), message);
}
public override void PopupMessage(GridCoordinates coordinates, IEntity viewer, string message)
public override void PopupMessage(EntityCoordinates coordinates, IEntity viewer, string message)
{
if (viewer != _playerManager.LocalPlayer.ControlledEntity)
{
return;
}
PopupMessage(_eyeManager.WorldToScreen(coordinates), message);
PopupMessage(_eyeManager.CoordinatesToScreen(coordinates), message);
}
public override void PopupMessageCursor(IEntity viewer, string message)

View File

@@ -20,7 +20,7 @@ namespace Content.Client.Construction
}
/// <inheritdoc />
public override bool HijackPlacementRequest(GridCoordinates coordinates)
public override bool HijackPlacementRequest(EntityCoordinates coordinates)
{
if (_prototype != null)
{

View File

@@ -37,7 +37,7 @@ namespace Content.Client.GameObjects.Components
{
base.Startup();
_overlayEntity = Owner.EntityManager.SpawnEntity("LowWallOverlay", Owner.Transform.GridPosition);
_overlayEntity = Owner.EntityManager.SpawnEntity("LowWallOverlay", Owner.Transform.Coordinates);
_overlayEntity.Transform.AttachParent(Owner);
_overlaySprite = _overlayEntity.GetComponent<ISpriteComponent>();

View File

@@ -9,7 +9,7 @@ namespace Content.Client.GameObjects.Components.Movement
[ComponentReference(typeof(IMoverComponent))]
public class PlayerInputMoverComponent : SharedPlayerInputMoverComponent
{
public override GridCoordinates LastPosition { get; set; }
public override EntityCoordinates LastPosition { get; set; }
public override float StepSoundDistance { get; set; }
}
}

View File

@@ -52,7 +52,7 @@ namespace Content.Client.GameObjects.EntitySystems.AI
continue;
}
var (x, y) = _eyeManager.WorldToScreen(entity.Transform.GridPosition).Position;
var (x, y) = _eyeManager.CoordinatesToScreen(entity.Transform.Coordinates).Position;
var offsetPosition = new Vector2(x - panel.Width / 2, y - panel.Height - 50f);
panel.Visible = true;

View File

@@ -150,7 +150,7 @@ namespace Content.Client.GameObjects.EntitySystems
/// <summary>
/// Creates a construction ghost at the given location.
/// </summary>
public void SpawnGhost(ConstructionPrototype prototype, GridCoordinates loc, Direction dir)
public void SpawnGhost(ConstructionPrototype prototype, EntityCoordinates loc, Direction dir)
{
if (GhostPresent(loc))
{
@@ -174,11 +174,11 @@ namespace Content.Client.GameObjects.EntitySystems
/// <summary>
/// Checks if any construction ghosts are present at the given position
/// </summary>
private bool GhostPresent(GridCoordinates loc)
private bool GhostPresent(EntityCoordinates loc)
{
foreach (KeyValuePair<int, ConstructionGhostComponent> ghost in _ghosts)
foreach (var ghost in _ghosts)
{
if (ghost.Value.Owner.Transform.GridPosition.Equals(loc))
if (ghost.Value.Owner.Transform.Coordinates.Equals(loc))
{
return true;
}
@@ -191,7 +191,7 @@ namespace Content.Client.GameObjects.EntitySystems
{
var ghost = _ghosts[ghostId];
var transform = ghost.Owner.Transform;
var msg = new TryStartStructureConstructionMessage(transform.GridPosition, ghost.Prototype.ID, transform.LocalRotation, ghostId);
var msg = new TryStartStructureConstructionMessage(transform.Coordinates, ghost.Prototype.ID, transform.LocalRotation, ghostId);
RaiseNetworkEvent(msg);
}

View File

@@ -159,7 +159,7 @@ namespace Content.Client.GameObjects.EntitySystems.DoAfter
}
// Set position ready for 2nd+ frames.
_playerPosition = _eyeManager.WorldToScreen(AttachedEntity.Transform.GridPosition);
_playerPosition = _eyeManager.CoordinatesToScreen(AttachedEntity.Transform.Coordinates);
LayoutContainer.SetPosition(this, new Vector2(_playerPosition.X - Width / 2, _playerPosition.Y - Height - 30.0f));
if (_firstDraw)

View File

@@ -98,7 +98,7 @@ namespace Content.Client.GameObjects.EntitySystems.DoAfter
return;
}
var userGrid = _player.Transform.GridPosition;
var userGrid = _player.Transform.Coordinates;
// Check cancellations / finishes
foreach (var (id, doAfter) in doAfters)
@@ -133,7 +133,7 @@ namespace Content.Client.GameObjects.EntitySystems.DoAfter
{
var targetEntity = _entityManager.GetEntity(doAfter.TargetUid);
if (targetEntity.Transform.GridPosition != doAfter.TargetGrid)
if (targetEntity.Transform.Coordinates != doAfter.TargetGrid)
{
doAfterComponent.Cancel(id, currentTime);
continue;

View File

@@ -50,7 +50,7 @@ namespace Content.Client.GameObjects.EntitySystems
base.Shutdown();
}
private bool HandleExamine(ICommonSession session, GridCoordinates coords, EntityUid uid)
private bool HandleExamine(ICommonSession session, EntityCoordinates coords, EntityUid uid)
{
if (!uid.IsValid() || !_entityManager.TryGetEntity(uid, out var examined))
{

View File

@@ -52,7 +52,7 @@ namespace Content.Client.GameObjects.EntitySystems
var lunge = attacker.EnsureComponent<MeleeLungeComponent>();
lunge.SetData(msg.Angle);
var entity = EntityManager.SpawnEntity(weaponArc.Prototype, attacker.Transform.GridPosition);
var entity = EntityManager.SpawnEntity(weaponArc.Prototype, attacker.Transform.Coordinates);
entity.Transform.LocalRotation = msg.Angle;
var weaponArcAnimation = entity.GetComponent<MeleeWeaponArcAnimationComponent>();
@@ -68,7 +68,7 @@ namespace Content.Client.GameObjects.EntitySystems
{
EffectSprite = sourceSprite.BaseRSI.Path.ToString(),
RsiState = sourceSprite.LayerGetState(0).Name,
Coordinates = attacker.Transform.GridPosition,
Coordinates = attacker.Transform.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.ToVec(),

View File

@@ -1,22 +1,18 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Threading;
using Content.Client.State;
using Content.Client.UserInterface;
using Content.Client.Utility;
using Content.Shared.GameObjects.EntitySystemMessages;
using Content.Shared.GameObjects.EntitySystems;
using Content.Shared.GameObjects.Verbs;
using Content.Shared.Input;
using Content.Shared.Physics;
using JetBrains.Annotations;
using Robust.Client.GameObjects.EntitySystems;
using Robust.Client.Graphics;
using Robust.Client.Graphics.Drawing;
using Robust.Client.Interfaces.GameObjects.Components;
using Robust.Client.Interfaces.Graphics.ClientEye;
using Robust.Client.Interfaces.Input;
using Robust.Client.Interfaces.ResourceManagement;
using Robust.Client.Interfaces.State;
@@ -27,12 +23,9 @@ using Robust.Client.UserInterface.Controls;
using Robust.Client.Utility;
using Robust.Shared.Containers;
using Robust.Shared.GameObjects;
using Robust.Shared.GameObjects.Systems;
using Robust.Shared.Input;
using Robust.Shared.Input.Binding;
using Robust.Shared.Interfaces.GameObjects;
using Robust.Shared.Interfaces.Map;
using Robust.Shared.Interfaces.Physics;
using Robust.Shared.Interfaces.Timing;
using Robust.Shared.IoC;
using Robust.Shared.Log;
@@ -53,7 +46,6 @@ namespace Content.Client.GameObjects.EntitySystems
[Dependency] private readonly IItemSlotManager _itemSlotManager = default!;
[Dependency] private readonly IGameTiming _gameTiming = default!;
[Dependency] private readonly IUserInterfaceManager _userInterfaceManager = default!;
[Dependency] private readonly IMapManager _mapManager = default!;
private EntityList _currentEntityList;
private VerbPopup _currentVerbListRoot;
@@ -67,7 +59,7 @@ namespace Content.Client.GameObjects.EntitySystems
public override void Initialize()
{
base.Initialize();
SubscribeNetworkEvent<VerbSystemMessages.VerbsResponseMessage>(FillEntityPopup);
IoCManager.InjectDependencies(this);
@@ -118,10 +110,10 @@ namespace Content.Client.GameObjects.EntitySystems
{
return false;
}
var mapCoordinates = args.Coordinates.ToMap(_mapManager);
var mapCoordinates = args.Coordinates.ToMap(_entityManager);
var playerEntity = _playerManager.LocalPlayer?.ControlledEntity;
if (playerEntity == null || !TryGetContextEntities(playerEntity, mapCoordinates, out var entities))
{
return false;
@@ -469,7 +461,7 @@ namespace Content.Client.GameObjects.EntitySystems
var funcId = _master._inputManager.NetworkBindMap.KeyFunctionID(args.Function);
var message = new FullInputCmdMessage(_master._gameTiming.CurTick, _master._gameTiming.TickFraction, funcId, BoundKeyState.Down,
_entity.Transform.GridPosition,
_entity.Transform.Coordinates,
args.PointerLocation, _entity.Uid);
// client side command handlers will always be sent the local player session.

View File

@@ -3,7 +3,6 @@ using System.Collections.Immutable;
using System.Linq;
using Content.Client.GameObjects.Components;
using Content.Client.Utility;
using Content.Shared.Utility;
using Robust.Client.GameObjects.EntitySystems;
using Robust.Client.Interfaces.GameObjects;
using Robust.Client.Interfaces.Graphics.ClientEye;
@@ -111,9 +110,9 @@ namespace Content.Client.State
return entitiesUnderPosition.Count > 0 ? entitiesUnderPosition[0] : null;
}
public IList<IEntity> GetEntitiesUnderPosition(GridCoordinates coordinates)
public IList<IEntity> GetEntitiesUnderPosition(EntityCoordinates coordinates)
{
return GetEntitiesUnderPosition(coordinates.ToMap(MapManager));
return GetEntitiesUnderPosition(coordinates.ToMap(EntityManager));
}
public IList<IEntity> GetEntitiesUnderPosition(MapCoordinates coordinates)
@@ -152,7 +151,7 @@ namespace Content.Client.State
/// <param name="stateManager">state manager to use to get the current game screen</param>
/// <param name="coordinates">coordinates to check</param>
/// <returns>the entities under the position, empty list if none found</returns>
public static IList<IEntity> GetEntitiesUnderPosition(IStateManager stateManager, GridCoordinates coordinates)
public static IList<IEntity> GetEntitiesUnderPosition(IStateManager stateManager, EntityCoordinates coordinates)
{
if (stateManager.CurrentState is GameScreenBase gameScreenBase)
{
@@ -184,7 +183,7 @@ namespace Content.Client.State
var transx = x.clicked.Transform;
var transy = y.clicked.Transform;
val = transx.GridPosition.Y.CompareTo(transy.GridPosition.Y);
val = transx.Coordinates.Y.CompareTo(transy.Coordinates.Y);
if (val != 0)
{
return val;

View File

@@ -56,15 +56,15 @@ namespace Content.Client.Utility
public static bool InRangeUnobstructed(
this LocalPlayer origin,
GridCoordinates other,
EntityCoordinates other,
float range = InteractionRange,
CollisionGroup collisionMask = CollisionGroup.Impassable,
Ignored predicate = null,
bool ignoreInsideBlocker = false,
bool popup = false)
{
var mapManager = IoCManager.Resolve<IMapManager>();
var otherPosition = other.ToMap(mapManager);
var entityManager = IoCManager.Resolve<IEntityManager>();
var otherPosition = other.ToMap(entityManager);
return origin.InRangeUnobstructed(otherPosition, range, collisionMask, predicate, ignoreInsideBlocker,
popup);