* Replace the teleportation logic on the SCRAM implant! Now instead of just trying to pick a random tile in range 20 times, the scram teleportation logic now: - Gets a list of grids in range - Until a suitable tile is picked it picks a random grid - From that grid it picks a random tile. - If the tile is suitable, then it is set as the target and the user will be teleported there. - Grids and tiles are randomly picked as outlined above until a valid tile is found, or all valid grids and tiles are exhausted. - Should no suitable tile be found then they get teleported to the same position they are at. Effectively not teleporting them. * Actually make the defaults sane which I forgor in the last commit * Extract tile section to its own function. Bias selection for current grid. Use proper coords for box. * Address reviews as much as possible * Address reviews
21 lines
595 B
C#
21 lines
595 B
C#
using Content.Server.Implants;
|
|
using Robust.Shared.Audio;
|
|
|
|
namespace Content.Server.Implants.Components;
|
|
|
|
/// <summary>
|
|
/// Randomly teleports entity when triggered.
|
|
/// </summary>
|
|
[RegisterComponent]
|
|
public sealed partial class ScramImplantComponent : Component
|
|
{
|
|
/// <summary>
|
|
/// Up to how far to teleport the user
|
|
/// </summary>
|
|
[DataField, ViewVariables(VVAccess.ReadWrite)]
|
|
public float TeleportRadius = 100f;
|
|
|
|
[DataField, ViewVariables(VVAccess.ReadWrite)]
|
|
public SoundSpecifier TeleportSound = new SoundPathSpecifier("/Audio/Effects/teleport_arrival.ogg");
|
|
}
|