Merge branch 'master' into 2020-04-28-tool-component
This commit is contained in:
@@ -0,0 +1,57 @@
|
||||
using System;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.GameObjects.Components.UserInterface;
|
||||
using Robust.Shared.Serialization;
|
||||
|
||||
namespace Content.Shared.GameObjects.Components.Gravity
|
||||
{
|
||||
public class SharedGravityGeneratorComponent: Component
|
||||
{
|
||||
public override string Name => "GravityGenerator";
|
||||
|
||||
public override uint? NetID => ContentNetIDs.GRAVITY_GENERATOR;
|
||||
|
||||
/// <summary>
|
||||
/// Sent to the server to set whether the generator should be on or off
|
||||
/// </summary>
|
||||
[Serializable, NetSerializable]
|
||||
public class SwitchGeneratorMessage : BoundUserInterfaceMessage
|
||||
{
|
||||
public bool On;
|
||||
|
||||
public SwitchGeneratorMessage(bool on)
|
||||
{
|
||||
On = on;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sent to the server when requesting the status of the generator
|
||||
/// </summary>
|
||||
[Serializable, NetSerializable]
|
||||
public class GeneratorStatusRequestMessage : BoundUserInterfaceMessage
|
||||
{
|
||||
public GeneratorStatusRequestMessage()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
[Serializable, NetSerializable]
|
||||
public class GeneratorState : BoundUserInterfaceState
|
||||
{
|
||||
public bool On;
|
||||
|
||||
public GeneratorState(bool on)
|
||||
{
|
||||
On = on;
|
||||
}
|
||||
}
|
||||
|
||||
[Serializable, NetSerializable]
|
||||
public enum GravityGeneratorUiKey
|
||||
{
|
||||
Key
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -42,5 +42,7 @@
|
||||
public const uint PAPER = 1037;
|
||||
public const uint REAGENT_INJECTOR = 1038;
|
||||
public const uint GHOST = 1039;
|
||||
public const uint MICROWAVE = 1040;
|
||||
public const uint GRAVITY_GENERATOR = 1041;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -51,13 +51,17 @@ namespace Content.Server.GameObjects.EntitySystems
|
||||
var rayResults = _physicsManager.IntersectRayWithPredicate(coords.MapId, ray, dir.Length, predicate, true);
|
||||
if(!rayResults.DidHitObject || (insideBlockerValid && rayResults.DidHitObject && (rayResults.HitPos - otherCoords).Length < 1f))
|
||||
{
|
||||
_mapManager.TryFindGridAt(coords, out var mapGrid);
|
||||
var srcPos = mapGrid.MapToGrid(coords);
|
||||
var destPos = new GridCoordinates(otherCoords, mapGrid);
|
||||
if (srcPos.InRange(_mapManager, destPos, range))
|
||||
|
||||
if (_mapManager.TryFindGridAt(coords, out var mapGrid) && mapGrid != null)
|
||||
{
|
||||
return true;
|
||||
var srcPos = mapGrid.MapToGrid(coords);
|
||||
var destPos = new GridCoordinates(otherCoords, mapGrid);
|
||||
if (srcPos.InRange(_mapManager, destPos, range))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user