Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches
TileDestroyedCondition.cs
Go to the documentation of this file.
3
5
7{
8 private const string Identifier = "TILE_DESTROYED";
9
11
12 private static bool _isListenerHooked;
13
14 private ushort[] _tileIds;
15
17 : base("TILE_DESTROYED_" + tileIds[0])
18 {
21 }
22
23 private static void ListenForDestruction(TileDestroyedCondition condition)
24 {
26 {
27 AchievementsHelper.OnTileDestroyed += TileDestroyedListener;
28 _isListenerHooked = true;
29 }
30 for (int i = 0; i < condition._tileIds.Length; i++)
31 {
32 if (!_listeners.ContainsKey(condition._tileIds[i]))
33 {
35 }
36 _listeners[condition._tileIds[i]].Add(condition);
37 }
38 }
39
40 private static void TileDestroyedListener(Player player, ushort tileId)
41 {
42 if (player.whoAmI != Main.myPlayer || !_listeners.ContainsKey(tileId))
43 {
44 return;
45 }
47 {
48 item.Complete();
49 }
50 }
51
52 public static AchievementCondition Create(params ushort[] tileIds)
53 {
55 }
56}
static void TileDestroyedListener(Player player, ushort tileId)
static Dictionary< ushort, List< TileDestroyedCondition > > _listeners
static AchievementCondition Create(params ushort[] tileIds)
static void ListenForDestruction(TileDestroyedCondition condition)
static int myPlayer
Definition Main.cs:1801