Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 27 additions & 1 deletion EXILED/Exiled.API/Features/Toys/AdminToy.cs
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,33 @@ public Quaternion Rotation
}

/// <summary>
/// Gets or sets the scale of the toy.
/// Gets or sets the local position of the toy relative to its parent.
/// </summary>
public Vector3 LocalPosition
{
get => Transform.localPosition;
set
{
Transform.localPosition = value;
AdminToyBase.NetworkPosition = value;
}
}

/// <summary>
/// Gets or sets the local rotation of the toy relative to its parent.
/// </summary>
public Quaternion LocalRotation
{
get => Transform.localRotation;
set
{
Transform.localRotation = value;
AdminToyBase.NetworkRotation = value;
}
}

/// <summary>
/// Gets or sets the local scale of the toy.
/// </summary>
public Vector3 Scale
{
Expand Down
7 changes: 3 additions & 4 deletions EXILED/Exiled.API/Features/Toys/CameraToy.cs
Original file line number Diff line number Diff line change
Expand Up @@ -156,12 +156,11 @@ public static CameraToy Create(Transform parent = null, CameraType type = Camera
CameraToy toy = new(Object.Instantiate(prefab, parent))
{
Name = name,
LocalPosition = position ?? Vector3.zero,
LocalRotation = rotation ?? Quaternion.identity,
Scale = scale ?? Vector3.one,
};

toy.Transform.localPosition = position ?? Vector3.zero;
toy.Transform.localRotation = rotation ?? Quaternion.identity;
toy.Transform.localScale = scale ?? Vector3.one;

if (verticalConstraint.HasValue)
toy.VerticalConstraint = verticalConstraint.Value;

Expand Down
7 changes: 3 additions & 4 deletions EXILED/Exiled.API/Features/Toys/Capybara.cs
Original file line number Diff line number Diff line change
Expand Up @@ -83,12 +83,11 @@ public static Capybara Create(Transform parent = null, Vector3? position = null,
Capybara toy = new(Object.Instantiate(Prefab, parent))
{
Collidable = collidable,
LocalPosition = position ?? Vector3.zero,
LocalRotation = rotation ?? Quaternion.identity,
Scale = scale ?? Vector3.one,
};

toy.Transform.localPosition = position ?? Vector3.zero;
toy.Transform.localRotation = rotation ?? Quaternion.identity;
toy.Transform.localScale = scale ?? Vector3.one;

if (spawn)
toy.Spawn();

Expand Down
7 changes: 3 additions & 4 deletions EXILED/Exiled.API/Features/Toys/InteractableToy.cs
Original file line number Diff line number Diff line change
Expand Up @@ -120,12 +120,11 @@ public static InteractableToy Create(Transform parent = null, Vector3? position
Shape = shape,
IsLocked = isLocked,
InteractionDuration = interactionDuration,
LocalPosition = position ?? Vector3.zero,
LocalRotation = rotation ?? Quaternion.identity,
Scale = scale ?? Vector3.one,
};

toy.Transform.localPosition = position ?? Vector3.zero;
toy.Transform.localRotation = rotation ?? Quaternion.identity;
toy.Transform.localScale = scale ?? Vector3.one;

if (spawn)
toy.Spawn();

Expand Down
7 changes: 3 additions & 4 deletions EXILED/Exiled.API/Features/Toys/Text.cs
Original file line number Diff line number Diff line change
Expand Up @@ -105,12 +105,11 @@ public static Text Create(Vector3? position = null, Quaternion? rotation = null,
{
TextFormat = text,
DisplaySize = displaySize ?? new Vector3(50, 50),
LocalPosition = position ?? Vector3.zero,
LocalRotation = rotation ?? Quaternion.identity,
Scale = scale ?? Vector3.one,
};

textToy.Transform.localPosition = position ?? Vector3.zero;
textToy.Transform.localRotation = rotation ?? Quaternion.identity;
textToy.Transform.localScale = scale ?? Vector3.one;

if (spawn)
textToy.Spawn();

Expand Down
5 changes: 2 additions & 3 deletions EXILED/Exiled.API/Features/Toys/Waypoint.cs
Original file line number Diff line number Diff line change
Expand Up @@ -111,11 +111,10 @@ public static Waypoint Create(Transform parent = null, Vector3? position = null,
Priority = priority,
BoundsSize = scale ?? Vector3.one * 255.9961f,
VisualizeBounds = visualizeBounds,
LocalPosition = position ?? Vector3.zero,
LocalRotation = rotation ?? Quaternion.identity,
};

toy.Transform.localPosition = position ?? Vector3.zero;
toy.Transform.localRotation = rotation ?? Quaternion.identity;

if (spawn)
toy.Spawn();

Expand Down
Loading