Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
DRKV333 committed Apr 25, 2018
2 parents 326a964 + 0f4dd45 commit 4a25515
Show file tree
Hide file tree
Showing 81 changed files with 1,947 additions and 632 deletions.
37 changes: 37 additions & 0 deletions ButtonDelayWorld.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
using Terraria.DataStructures;
using Terraria.ModLoader;

namespace MechTransfer
{
internal class ButtonDelayWorld : ModWorld
{
private Point16? buttonPosition = null;
private int delay;

private const int StartDelay = 30;

public void setPoint(Point16 p)
{
buttonPosition = p;
delay = StartDelay;
}

public bool isPoint(Point16 p, int w, int h)
{
if (!buttonPosition.HasValue)
return false;

int xOffset = p.X - buttonPosition.Value.X;
int yOffset = p.Y - buttonPosition.Value.Y;

return xOffset >= 0 && yOffset >= 0 && xOffset < w && yOffset < h;
}

public override void PostDrawTiles()
{
delay--;
if (delay < 1)
buttonPosition = null;
}
}
}
34 changes: 34 additions & 0 deletions ChestPlacementFix.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Terraria.ModLoader;
using Terraria;
using Terraria.ID;

namespace MechTransfer
{
class ChestPlacementFix : GlobalTile
{
private List<int> noChestTiles = new List<int>();

public override bool CanPlace(int i, int j, int type)
{
if (TileID.Sets.BasicChest[type] || TileID.Sets.BasicChestFake[type] || TileLoader.IsDresser(type))
{
Tile bottom = Main.tile[i, j + 1];
if (bottom != null && bottom.active() && noChestTiles.Contains(bottom.type))
{
return false;
}
}
return true;
}

public void AddNoChestTile(int type)
{
noChestTiles.Add(type);
}
}
}
Loading

0 comments on commit 4a25515

Please sign in to comment.