Fixes for grid rotation (#4562)

* Fixes gas overlays
* Fixes verbs
*Set noRot on a bunch of stuff
This commit is contained in:
metalgearsloth
2021-09-16 13:02:10 +10:00
committed by GitHub
parent cc52ebb9b5
commit 820069ba9c
8 changed files with 56 additions and 48 deletions

View File

@@ -14,7 +14,6 @@ namespace Content.Client.Atmos.Overlays
[Dependency] private readonly IMapManager _mapManager = default!; [Dependency] private readonly IMapManager _mapManager = default!;
[Dependency] private readonly IEyeManager _eyeManager = default!; [Dependency] private readonly IEyeManager _eyeManager = default!;
[Dependency] private readonly IClyde _clyde = default!;
public override OverlaySpace Space => OverlaySpace.WorldSpaceBelowFOV; public override OverlaySpace Space => OverlaySpace.WorldSpaceBelowFOV;
@@ -30,24 +29,25 @@ namespace Content.Client.Atmos.Overlays
var drawHandle = args.WorldHandle; var drawHandle = args.WorldHandle;
var mapId = _eyeManager.CurrentMap; var mapId = _eyeManager.CurrentMap;
var eye = _eyeManager.CurrentEye; var worldBounds = _eyeManager.GetWorldViewbounds();
var worldBounds = Box2.CenteredAround(eye.Position.Position,
_clyde.ScreenSize / (float) EyeManager.PixelsPerMeter * eye.Zoom);
foreach (var mapGrid in _mapManager.FindGridsIntersecting(mapId, worldBounds)) foreach (var mapGrid in _mapManager.FindGridsIntersecting(mapId, worldBounds))
{ {
if (!_gasTileOverlaySystem.HasData(mapGrid.Index)) if (!_gasTileOverlaySystem.HasData(mapGrid.Index))
continue; continue;
drawHandle.SetTransform(mapGrid.WorldMatrix);
foreach (var tile in mapGrid.GetTilesIntersecting(worldBounds)) foreach (var tile in mapGrid.GetTilesIntersecting(worldBounds))
{ {
foreach (var (texture, color) in _gasTileOverlaySystem.GetOverlays(mapGrid.Index, tile.GridIndices)) foreach (var (texture, color) in _gasTileOverlaySystem.GetOverlays(mapGrid.Index, tile.GridIndices))
{ {
drawHandle.DrawTexture(texture, mapGrid.LocalToWorld(new Vector2(tile.X, tile.Y)), color); drawHandle.DrawTexture(texture, new Vector2(tile.X, tile.Y), color);
} }
} }
} }
drawHandle.SetTransform(Matrix3.Identity);
} }
} }
} }

View File

@@ -0,0 +1,9 @@
using Content.Shared.Interaction;
namespace Content.Client.Interactable
{
public sealed class InteractionSystem : SharedInteractionSystem
{
}
}

View File

@@ -18,7 +18,7 @@ namespace Content.Shared.Interaction
/// Governs interactions during clicking on entities /// Governs interactions during clicking on entities
/// </summary> /// </summary>
[UsedImplicitly] [UsedImplicitly]
public class SharedInteractionSystem : EntitySystem public abstract class SharedInteractionSystem : EntitySystem
{ {
[Dependency] private readonly SharedBroadphaseSystem _sharedBroadphaseSystem = default!; [Dependency] private readonly SharedBroadphaseSystem _sharedBroadphaseSystem = default!;
@@ -131,6 +131,7 @@ namespace Content.Shared.Interaction
if (rayResults.Count == 0) return true; if (rayResults.Count == 0) return true;
// TODO: Wot? This should just be in the predicate.
if (!ignoreInsideBlocker) return false; if (!ignoreInsideBlocker) return false;
foreach (var result in rayResults) foreach (var result in rayResults)

View File

@@ -1,7 +1,7 @@
using System.Collections.Generic; using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis; using System.Diagnostics.CodeAnalysis;
using System.Linq; using System.Linq;
using Content.Shared.Interaction.Helpers; using Content.Shared.Interaction;
using Content.Shared.Physics; using Content.Shared.Physics;
using Robust.Shared.GameObjects; using Robust.Shared.GameObjects;
using Robust.Shared.IoC; using Robust.Shared.IoC;
@@ -12,6 +12,8 @@ namespace Content.Shared.Verbs
{ {
public class SharedVerbSystem : EntitySystem public class SharedVerbSystem : EntitySystem
{ {
[Dependency] private readonly IEntityLookup _lookup = default!;
/// <summary> /// <summary>
/// Get all of the entities relevant for the contextmenu /// Get all of the entities relevant for the contextmenu
/// </summary> /// </summary>
@@ -25,17 +27,20 @@ namespace Content.Shared.Verbs
contextEntities = null; contextEntities = null;
var length = buffer ? 1.0f: 0.5f; var length = buffer ? 1.0f: 0.5f;
var entities = IoCManager.Resolve<IEntityLookup>(). var entities = _lookup.GetEntitiesIntersecting(
GetEntitiesIntersecting(targetPos.MapId, Box2.CenteredAround(targetPos.Position, (length, length))).ToList(); targetPos.MapId,
Box2.CenteredAround(targetPos.Position, (length, length)))
.ToList();
if (entities.Count == 0) if (entities.Count == 0) return false;
{
return false; // TODO: Can probably do a faster distance check with EntityCoordinates given we don't need to get map stuff.
}
// Check if we have LOS to the clicked-location, otherwise no popup. // Check if we have LOS to the clicked-location, otherwise no popup.
var vectorDiff = player.Transform.MapPosition.Position - targetPos.Position; var playerPos = player.Transform.MapPosition;
var vectorDiff = playerPos.Position - targetPos.Position;
var distance = vectorDiff.Length + 0.01f; var distance = vectorDiff.Length + 0.01f;
bool Ignored(IEntity entity) bool Ignored(IEntity entity)
{ {
return entities.Contains(entity) || return entities.Contains(entity) ||
@@ -48,7 +53,7 @@ namespace Content.Shared.Verbs
? CollisionGroup.Opaque ? CollisionGroup.Opaque
: CollisionGroup.None; : CollisionGroup.None;
var result = player.InRangeUnobstructed(targetPos, distance, mask, Ignored); var result = Get<SharedInteractionSystem>().InRangeUnobstructed(playerPos, targetPos, distance, mask, Ignored);
if (!result) if (!result)
{ {

View File

@@ -6984,8 +6984,7 @@ entities:
- uid: 760 - uid: 760
type: ClosetEmergencyFilledRandom type: ClosetEmergencyFilledRandom
components: components:
- rot: 4.371139006309477E-08 rad - pos: 5.5,-21.5
pos: 5.5,-21.5
parent: 853 parent: 853
type: Transform type: Transform
- isPlaceable: False - isPlaceable: False
@@ -7006,8 +7005,7 @@ entities:
- uid: 762 - uid: 762
type: ClosetEmergencyFilledRandom type: ClosetEmergencyFilledRandom
components: components:
- rot: 4.371139006309477E-08 rad - pos: -23.5,11.5
pos: -23.5,11.5
parent: 853 parent: 853
type: Transform type: Transform
- isPlaceable: False - isPlaceable: False
@@ -7019,8 +7017,7 @@ entities:
- uid: 763 - uid: 763
type: ClosetEmergencyFilledRandom type: ClosetEmergencyFilledRandom
components: components:
- rot: 4.371139006309477E-08 rad - pos: 24.5,13.5
pos: 24.5,13.5
parent: 853 parent: 853
type: Transform type: Transform
- isPlaceable: False - isPlaceable: False
@@ -7052,8 +7049,7 @@ entities:
- uid: 766 - uid: 766
type: ClosetEmergencyFilledRandom type: ClosetEmergencyFilledRandom
components: components:
- rot: 4.371139006309477E-08 rad - pos: -2.5,30.5
pos: -2.5,30.5
parent: 853 parent: 853
type: Transform type: Transform
- isPlaceable: False - isPlaceable: False
@@ -7065,8 +7061,7 @@ entities:
- uid: 767 - uid: 767
type: ClosetEmergencyFilledRandom type: ClosetEmergencyFilledRandom
components: components:
- rot: 4.371139006309477E-08 rad - pos: 9.5,30.5
pos: 9.5,30.5
parent: 853 parent: 853
type: Transform type: Transform
- isPlaceable: False - isPlaceable: False
@@ -7188,8 +7183,7 @@ entities:
- uid: 778 - uid: 778
type: ClosetEmergencyFilledRandom type: ClosetEmergencyFilledRandom
components: components:
- rot: 4.371139006309477E-08 rad - pos: 12.5,21.5
pos: 12.5,21.5
parent: 853 parent: 853
type: Transform type: Transform
- isPlaceable: False - isPlaceable: False
@@ -7214,8 +7208,7 @@ entities:
- uid: 780 - uid: 780
type: ClosetEmergencyFilledRandom type: ClosetEmergencyFilledRandom
components: components:
- rot: 4.371139006309477E-08 rad - pos: 43.5,9.5
pos: 43.5,9.5
parent: 853 parent: 853
type: Transform type: Transform
- isPlaceable: False - isPlaceable: False
@@ -7253,8 +7246,7 @@ entities:
- uid: 783 - uid: 783
type: ClosetEmergencyFilledRandom type: ClosetEmergencyFilledRandom
components: components:
- rot: 4.371139006309477E-08 rad - pos: 8.5,-18.5
pos: 8.5,-18.5
parent: 853 parent: 853
type: Transform type: Transform
- isPlaceable: False - isPlaceable: False
@@ -7279,8 +7271,7 @@ entities:
- uid: 785 - uid: 785
type: ClosetEmergencyFilledRandom type: ClosetEmergencyFilledRandom
components: components:
- rot: 4.371139006309477E-08 rad - pos: -15.5,-17.5
pos: -15.5,-17.5
parent: 853 parent: 853
type: Transform type: Transform
- isPlaceable: False - isPlaceable: False
@@ -7292,8 +7283,7 @@ entities:
- uid: 786 - uid: 786
type: ClosetEmergencyFilledRandom type: ClosetEmergencyFilledRandom
components: components:
- rot: 4.371139006309477E-08 rad - pos: -7.5,-25.5
pos: -7.5,-25.5
parent: 853 parent: 853
type: Transform type: Transform
- isPlaceable: False - isPlaceable: False
@@ -7305,8 +7295,7 @@ entities:
- uid: 787 - uid: 787
type: ClosetEmergencyFilledRandom type: ClosetEmergencyFilledRandom
components: components:
- rot: 4.371139006309477E-08 rad - pos: 26.5,12.5
pos: 26.5,12.5
parent: 853 parent: 853
type: Transform type: Transform
- isPlaceable: False - isPlaceable: False
@@ -7318,8 +7307,7 @@ entities:
- uid: 788 - uid: 788
type: ClosetEmergencyFilledRandom type: ClosetEmergencyFilledRandom
components: components:
- rot: 4.371139006309477E-08 rad - pos: 23.5,1.5
pos: 23.5,1.5
parent: 853 parent: 853
type: Transform type: Transform
- isPlaceable: False - isPlaceable: False
@@ -7344,8 +7332,7 @@ entities:
- uid: 790 - uid: 790
type: ClosetEmergencyFilledRandom type: ClosetEmergencyFilledRandom
components: components:
- rot: 4.371139006309477E-08 rad - pos: -11.5,-10.5
pos: -11.5,-10.5
parent: 853 parent: 853
type: Transform type: Transform
- isPlaceable: False - isPlaceable: False
@@ -7357,8 +7344,7 @@ entities:
- uid: 791 - uid: 791
type: ClosetEmergencyFilledRandom type: ClosetEmergencyFilledRandom
components: components:
- rot: 4.371139006309477E-08 rad - pos: -37.5,-7.5
pos: -37.5,-7.5
parent: 853 parent: 853
type: Transform type: Transform
- isPlaceable: False - isPlaceable: False
@@ -7370,8 +7356,7 @@ entities:
- uid: 792 - uid: 792
type: ClosetEmergencyFilledRandom type: ClosetEmergencyFilledRandom
components: components:
- rot: 4.371139006309477E-08 rad - pos: -39.5,2.5
pos: -39.5,2.5
parent: 853 parent: 853
type: Transform type: Transform
- isPlaceable: False - isPlaceable: False
@@ -7383,8 +7368,7 @@ entities:
- uid: 793 - uid: 793
type: ClosetEmergencyFilledRandom type: ClosetEmergencyFilledRandom
components: components:
- rot: 4.371139006309477E-08 rad - pos: -34.5,10.5
pos: -34.5,10.5
parent: 853 parent: 853
type: Transform type: Transform
- isPlaceable: False - isPlaceable: False

View File

@@ -3,6 +3,8 @@
parent: BaseStructureDynamic parent: BaseStructureDynamic
abstract: true abstract: true
components: components:
- type: Transform
noRot: true
- type: InteractionOutline - type: InteractionOutline
- type: Physics - type: Physics
bodyType: Dynamic bodyType: Dynamic
@@ -19,6 +21,7 @@
- SmallImpassable - SmallImpassable
- VaultImpassable - VaultImpassable
- type: Sprite - type: Sprite
noRot: true
sprite: Structures/Furniture/potted_plants.rsi sprite: Structures/Furniture/potted_plants.rsi
- type: PottedPlantHide - type: PottedPlantHide
- type: SecretStash - type: SecretStash

View File

@@ -4,7 +4,10 @@
name: closet name: closet
description: A standard-issue Nanotrasen storage unit. description: A standard-issue Nanotrasen storage unit.
components: components:
- type: Transform
noRot: true
- type: Sprite - type: Sprite
noRot: true
netsync: false netsync: false
sprite: Structures/Storage/closet.rsi sprite: Structures/Storage/closet.rsi
layers: layers:

View File

@@ -5,7 +5,10 @@
name: crate name: crate
description: A large container for items. description: A large container for items.
components: components:
- type: Transform
noRot: true
- type: Sprite - type: Sprite
noRot: true
netsync: false netsync: false
sprite: Structures/Storage/Crates/generic.rsi sprite: Structures/Storage/Crates/generic.rsi
layers: layers: