Skip to content

Commit

Permalink
reviewe
Browse files Browse the repository at this point in the history
  • Loading branch information
CaptainSqrBeard committed Dec 21, 2024
1 parent dca1c92 commit 8e5e756
Showing 1 changed file with 3 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ public sealed class FromTileCrafterSystem : EntitySystem

public override void Initialize()
{
base.Initialize();
SubscribeLocalEvent<FromTileCrafterComponent, FromTileCraftDoAfterEvent>(OnFromTileCraftComplete);
SubscribeLocalEvent<FromTileCrafterComponent, AfterInteractEvent>(OnAfterInteract);
}
Expand All @@ -40,14 +39,13 @@ private void OnFromTileCraftComplete(Entity<FromTileCrafterComponent> ent, ref F
if (!TryComp<MapGridComponent>(gridUid, out var grid))
return;

var mapGrid = Comp<MapGridComponent>(gridUid);
var tileRef = _maps.GetTileRef(gridUid, grid, args.GridTile);
var coords = _maps.ToCoordinates(tileRef, grid);

var spread = mapGrid.TileSize * 0.1f;
var spread = grid.TileSize * 0.1f;
var offset = new Vector2(
_robustRandom.NextFloat() - 0.5f * spread,
_robustRandom.NextFloat() - 0.5f * spread);
_robustRandom.NextFloat() * spread - 0.5f,
_robustRandom.NextFloat() * spread - 0.5f);

if (!_netManager.IsServer)
Spawn(ent.Comp.EntityToSpawn, coords.Offset(offset));
Expand Down

0 comments on commit 8e5e756

Please sign in to comment.