Add PlaceCentered bool to PlaceableSurfaceComponent (#2771)
* Added bool _placeCentered to check if an entity must be placed at mouse position or center of the PlaceableSurface (+ offset) when dropped. * private variables formatted to camel case * Use EqualsApprox in the setter for PositionOffset * -Changed client-side SurfaceComponent to camelCase -Added placeCentered and positionOffset to PlaceableSurfaceComponentState -Getter and setters for placeCentered and positionOffset client-side * Update Content.Client/GameObjects/Components/PlaceableSurfaceComponent.cs Co-authored-by: Vera Aguilera Puerto <6766154+Zumorica@users.noreply.github.com> * Add "_" to private vars name * Made YAML properties camelCase * Add "_" to private vars name * Call Dirty() when IsPlaceable,PlaceCentered and PositionOffset are changed. * Removed Dirty() from client. Co-authored-by: Vera Aguilera Puerto <6766154+Zumorica@users.noreply.github.com>
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
using System;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.Maths;
|
||||
using Robust.Shared.Serialization;
|
||||
|
||||
namespace Content.Shared.GameObjects.Components
|
||||
@@ -8,18 +9,23 @@ namespace Content.Shared.GameObjects.Components
|
||||
{
|
||||
public override string Name => "PlaceableSurface";
|
||||
public override uint? NetID => ContentNetIDs.PLACEABLE_SURFACE;
|
||||
|
||||
public virtual bool IsPlaceable { get; set; }
|
||||
public virtual bool PlaceCentered { get; set; }
|
||||
public virtual Vector2 PositionOffset { get; set; }
|
||||
}
|
||||
|
||||
[Serializable, NetSerializable]
|
||||
public class PlaceableSurfaceComponentState : ComponentState
|
||||
{
|
||||
public readonly bool IsPlaceable;
|
||||
public readonly bool PlaceCentered;
|
||||
public readonly Vector2 PositionOffset;
|
||||
|
||||
public PlaceableSurfaceComponentState(bool placeable) : base(ContentNetIDs.PLACEABLE_SURFACE)
|
||||
public PlaceableSurfaceComponentState(bool placeable, bool centered, Vector2 offset) : base(ContentNetIDs.PLACEABLE_SURFACE)
|
||||
{
|
||||
IsPlaceable = placeable;
|
||||
PlaceCentered = centered;
|
||||
PositionOffset = offset;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user