Skip to content

Commit 4a25515

Browse files
committed
Merge branch 'develop'
2 parents 326a964 + 0f4dd45 commit 4a25515

File tree

81 files changed

+1947
-632
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

81 files changed

+1947
-632
lines changed

ButtonDelayWorld.cs

+37
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
using Terraria.DataStructures;
2+
using Terraria.ModLoader;
3+
4+
namespace MechTransfer
5+
{
6+
internal class ButtonDelayWorld : ModWorld
7+
{
8+
private Point16? buttonPosition = null;
9+
private int delay;
10+
11+
private const int StartDelay = 30;
12+
13+
public void setPoint(Point16 p)
14+
{
15+
buttonPosition = p;
16+
delay = StartDelay;
17+
}
18+
19+
public bool isPoint(Point16 p, int w, int h)
20+
{
21+
if (!buttonPosition.HasValue)
22+
return false;
23+
24+
int xOffset = p.X - buttonPosition.Value.X;
25+
int yOffset = p.Y - buttonPosition.Value.Y;
26+
27+
return xOffset >= 0 && yOffset >= 0 && xOffset < w && yOffset < h;
28+
}
29+
30+
public override void PostDrawTiles()
31+
{
32+
delay--;
33+
if (delay < 1)
34+
buttonPosition = null;
35+
}
36+
}
37+
}

ChestPlacementFix.cs

+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Linq;
4+
using System.Text;
5+
using System.Threading.Tasks;
6+
using Terraria.ModLoader;
7+
using Terraria;
8+
using Terraria.ID;
9+
10+
namespace MechTransfer
11+
{
12+
class ChestPlacementFix : GlobalTile
13+
{
14+
private List<int> noChestTiles = new List<int>();
15+
16+
public override bool CanPlace(int i, int j, int type)
17+
{
18+
if (TileID.Sets.BasicChest[type] || TileID.Sets.BasicChestFake[type] || TileLoader.IsDresser(type))
19+
{
20+
Tile bottom = Main.tile[i, j + 1];
21+
if (bottom != null && bottom.active() && noChestTiles.Contains(bottom.type))
22+
{
23+
return false;
24+
}
25+
}
26+
return true;
27+
}
28+
29+
public void AddNoChestTile(int type)
30+
{
31+
noChestTiles.Add(type);
32+
}
33+
}
34+
}

0 commit comments

Comments
 (0)