Skip to content

Commit 94df965

Browse files
committed
Merge branch 'develop'
2 parents b37e67d + ab2c8ad commit 94df965

10 files changed

+61
-10
lines changed

MechTransfer.csproj

+2-1
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,10 @@
99
<AppDesignerFolder>Properties</AppDesignerFolder>
1010
<RootNamespace>MechTransfer</RootNamespace>
1111
<AssemblyName>MechTransfer</AssemblyName>
12-
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
12+
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
1313
<FileAlignment>512</FileAlignment>
1414
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
15+
<TargetFrameworkProfile />
1516
</PropertyGroup>
1617
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
1718
<PlatformTarget>x86</PlatformTarget>

MechTransferAssemblerWorld.cs

+47-7
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
using MechTransfer.Tiles;
22
using Microsoft.Xna.Framework;
33
using Microsoft.Xna.Framework.Graphics;
4+
using System;
45
using Terraria;
56
using Terraria.GameContent.UI;
67
using Terraria.ModLoader;
@@ -9,11 +10,19 @@ namespace MechTransfer
910
{
1011
internal class MechTransferAssemblerWorld : ModWorld
1112
{
12-
public override void PostDrawTiles()
13+
private Texture2D pixel;
14+
15+
public override void Initialize()
1316
{
14-
if (!WiresUI.Settings.DrawWires)
15-
return;
17+
if (!Main.dedServ)
18+
{
19+
pixel = new Texture2D(Main.graphics.GraphicsDevice, 1, 1);
20+
pixel.SetData(new Color[] { Color.White });
21+
}
22+
}
1623

24+
public override void PostDrawTiles()
25+
{
1726
Main.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend);
1827

1928
int screenLeft = (int)((Main.screenPosition.X) / 16f - 1f);
@@ -33,16 +42,47 @@ public override void PostDrawTiles()
3342
{
3443
for (int y = screenTop; y < screenBottom; y++)
3544
{
36-
if (Main.tile[x, y] != null && Main.tile[x, y].active() && Main.tile[x, y].type == mod.TileType<TransferAssemblerTile>())
45+
if (Main.tile[x, y] != null && Main.tile[x, y].active())
3746
{
38-
Vector2 start = new Vector2(x * 16 - 81, y * 16 - 81);
39-
Vector2 end = new Vector2(x * 16 + 97, y * 16 + 97);
40-
Utils.DrawRectangle(Main.spriteBatch, start, end, Color.LightSeaGreen, Color.LightSeaGreen, 2f);
47+
if (Main.tile[x, y].type == mod.TileType<TransferInjectorTile>() || Main.tile[x, y].type == mod.TileType<TransferExtractorTile>() || Main.tile[x, y].type == mod.TileType<StackExtractorTile>() || Main.tile[x, y].type == mod.TileType<TransferAssemblerTile>())
48+
{
49+
DrawTransition(x, y - 1, mod.GetTexture("Tiles/Transitions/Top"));
50+
DrawTransition(x, y + 1, mod.GetTexture("Tiles/Transitions/Bottom"));
51+
DrawTransition(x - 1, y, mod.GetTexture("Tiles/Transitions/Left"));
52+
DrawTransition(x + 1, y, mod.GetTexture("Tiles/Transitions/Right"));
53+
}
54+
55+
if (WiresUI.Settings.DrawWires && Main.tile[x, y].type == mod.TileType<TransferAssemblerTile>())
56+
{
57+
DrawRectFast(x * 16 - 80 - (int)Main.screenPosition.X, y * 16 - 80 - (int)Main.screenPosition.Y, 176, 176);
58+
}
4159
}
4260
}
4361
}
4462

4563
Main.spriteBatch.End();
4664
}
65+
66+
private void DrawRectFast(int left, int top, int height, int width)
67+
{
68+
if (Main.LocalPlayer.gravDir == -1)
69+
top = Main.screenHeight - top - height;
70+
71+
Main.spriteBatch.Draw(pixel, new Rectangle(left, top, width, 2), null, Color.LightSeaGreen);
72+
Main.spriteBatch.Draw(pixel, new Rectangle(left, top + height, width, 2), null, Color.LightSeaGreen);
73+
Main.spriteBatch.Draw(pixel, new Rectangle(left, top, 2, height), null, Color.LightSeaGreen);
74+
Main.spriteBatch.Draw(pixel, new Rectangle(left + width, top, 2, height), null, Color.LightSeaGreen);
75+
}
76+
77+
private void DrawTransition(int x, int y, Texture2D texture)
78+
{
79+
if(mod.GetModWorld<TransferAgent>().IsContainer(x, y))
80+
{
81+
if(Main.LocalPlayer.gravDir == 1)
82+
Main.spriteBatch.Draw(texture, new Vector2(x * 16 - Main.screenPosition.X, y * 16 - Main.screenPosition.Y), Lighting.GetColor(x,y));
83+
else
84+
Main.spriteBatch.Draw(texture, new Vector2(x * 16 - Main.screenPosition.X, Main.screenHeight - y * 16 + Main.screenPosition.Y - 16), null, Lighting.GetColor(x, y), 0, Vector2.Zero, 1, SpriteEffects.FlipVertically, 0);
85+
}
86+
}
4787
}
4888
}

Tiles/Transitions/Bottom.png

274 Bytes
Loading

Tiles/Transitions/Left.png

279 Bytes
Loading

Tiles/Transitions/Right.png

281 Bytes
Loading

Tiles/Transitions/Top.png

264 Bytes
Loading

Tiles/Transitions/Transitions.xcf

3.65 KB
Binary file not shown.

TransferAgent.cs

+6
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,12 @@ public ContainerAdapter FindContainer(int x, int y)
157157
return null;
158158
}
159159

160+
public bool IsContainer(int x, int y)
161+
{
162+
Tile tile = Main.tile[x, y];
163+
return (tile != null && tile.active() && ContainerAdapters.ContainsKey(tile.type));
164+
}
165+
160166
//trigger wire on the new update, to stop infinite wire loops
161167
public void TripWireDelayed(int x, int y, int width, int height)
162168
{

build.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
author = DRKV
2-
version = 1.6.1
2+
version = 1.6.2
33
displayName = MechTransfer
44
includePDB = false
55
weakReferences = [email protected]

description.txt

+5-1
Original file line numberDiff line numberDiff line change
@@ -76,4 +76,8 @@ v1.6.1
7676
- Fixed filterable tile save/load with modded items
7777
- Fixed buttons in multiplayer
7878
- New net packet handling system
79-
- Added player interface
79+
- Added player interface
80+
81+
v1.6.2
82+
- Improved assembler area drawing
83+
- Added transition markers

0 commit comments

Comments
 (0)