-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTileHelper.cs
More file actions
65 lines (59 loc) · 1.66 KB
/
TileHelper.cs
File metadata and controls
65 lines (59 loc) · 1.66 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
using TShockAPI;
using Terraria;
using Terraria.ID;
namespace CreateSpawn;
internal class TileHelper
{
public static void ClearEverything(int x, int y)
{
Main.tile[x, y].ClearEverything();
NetMessage.SendTileSquare(-1, x, y, TileChangeType.None);
}
public static bool NeedInGame(TSPlayer plr)
{
if (!plr.RealPlayer)
{
plr.SendErrorMessage("请进入游戏后再操作!");
}
return !plr.RealPlayer;
}
public static void GenAfter()
{
InformPlayers();
TShock.Utils.SaveWorld();
}
public static void InformPlayers()
{
TSPlayer[] players = TShock.Players;
foreach (TSPlayer tSPlayer in players)
{
if (tSPlayer == null || !tSPlayer.Active)
{
continue;
}
for (int j = 0; j < 255; j++)
{
for (int k = 0; k < Main.maxSectionsX; k++)
{
for (int l = 0; l < Main.maxSectionsY; l++)
{
Netplay.Clients[j].TileSections[k, l] = false;
}
}
}
}
}
#region 更新整个世界图格方法
public static void UpdateWorld()
{
foreach (RemoteClient sock in Netplay.Clients.Where(s => s.IsActive))
{
for (int i = Netplay.GetSectionX(0); i <= Netplay.GetSectionX(Main.maxTilesX); i++)
{
for (int j = Netplay.GetSectionY(0); j <= Netplay.GetSectionY(Main.maxTilesY); j++)
sock.TileSections[i, j] = false;
}
}
}
#endregion
}