Skip to content

Commit

Permalink
MASSIVE IMPROVEMENT
Browse files Browse the repository at this point in the history
  • Loading branch information
dootythefrooty committed Aug 6, 2024
1 parent 311adba commit f444872
Showing 1 changed file with 3 additions and 14 deletions.
17 changes: 3 additions & 14 deletions Content.Server/Botany/Systems/TeleportingTraitSystem.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
using System.Numerics;
using Robust.Shared.Random;
using Content.Shared.Slippery;
using Content.Server.Fluids.EntitySystems;
Expand Down Expand Up @@ -31,20 +30,10 @@ public static void SetPotencyRadius(float seedPotency, TeleportingTraitComponent
// teleports both the produce and the foolish fool who slipped on it to a random postion limited by the radius
private void Teleport(EntityUid uid, TeleportingTraitComponent comp, ref SlipEvent args)
{
var xform = Transform(uid);
var mapPos = _xform.GetWorldPosition(xform);
var radius = comp.ProduceTeleportRadius;
var gridBounds = new Box2(mapPos - new Vector2(radius, radius), mapPos + new Vector2(radius, radius));
var randomX = _random.NextFloat(gridBounds.Left, gridBounds.Right);
var randomY = _random.NextFloat(gridBounds.Bottom, gridBounds.Top);
//probably a better way to do this, but i have no clue at all
var otherRandomX = _random.NextFloat(gridBounds.Left, gridBounds.Right);
var otherRandomY = _random.NextFloat(gridBounds.Bottom, gridBounds.Top);
var producePos = new Vector2(randomX, randomY);
var otherPos = new Vector2(otherRandomX, otherRandomY);
_xform.SetWorldPosition(uid, producePos);
var coordinates = Transform(uid).Coordinates;
_xform.SetCoordinates(uid, coordinates.Offset(_random.NextVector2(comp.ProduceTeleportRadius)));
_popup.PopupEntity(Loc.GetString("teleporting-trait-component-slipped"), args.Slipped, args.Slipped, PopupType.SmallCaution);
_xform.SetWorldPosition(args.Slipped, otherPos);
_xform.SetCoordinates(args.Slipped, coordinates.Offset(_random.NextVector2(comp.ProduceTeleportRadius)));
VanishProbablity(uid, comp);
}

Expand Down

0 comments on commit f444872

Please sign in to comment.