* 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>
32 lines
1.0 KiB
C#
32 lines
1.0 KiB
C#
using System;
|
|
using Robust.Shared.GameObjects;
|
|
using Robust.Shared.Maths;
|
|
using Robust.Shared.Serialization;
|
|
|
|
namespace Content.Shared.GameObjects.Components
|
|
{
|
|
public abstract class SharedPlaceableSurfaceComponent : Component
|
|
{
|
|
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, bool centered, Vector2 offset) : base(ContentNetIDs.PLACEABLE_SURFACE)
|
|
{
|
|
IsPlaceable = placeable;
|
|
PlaceCentered = centered;
|
|
PositionOffset = offset;
|
|
}
|
|
}
|
|
}
|