TModLoader v1.4.4.9
TModLoader source code documentation
Loading...
Searching...
No Matches

◆ HandleTeleportRequest()

void Terraria.GameContent.TeleportPylonsSystem.HandleTeleportRequest ( TeleportPylonInfo info,
int playerIndex )
inline

Definition at line 114 of file TeleportPylonsSystem.cs.

115 {
116 //IL_0112: Unknown result type (might be due to invalid IL or missing references)
117 //IL_035f: Unknown result type (might be due to invalid IL or missing references)
118 //IL_02ad: Unknown result type (might be due to invalid IL or missing references)
119 //IL_02be: Unknown result type (might be due to invalid IL or missing references)
120 //IL_02c3: Unknown result type (might be due to invalid IL or missing references)
121 //IL_02c8: Unknown result type (might be due to invalid IL or missing references)
122 //IL_0200: Unknown result type (might be due to invalid IL or missing references)
123 //IL_02f1: Unknown result type (might be due to invalid IL or missing references)
124 //IL_02fd: Unknown result type (might be due to invalid IL or missing references)
125 //IL_0302: Unknown result type (might be due to invalid IL or missing references)
126 //IL_0316: Unknown result type (might be due to invalid IL or missing references)
127 //IL_032e: Unknown result type (might be due to invalid IL or missing references)
128 //IL_0335: Unknown result type (might be due to invalid IL or missing references)
129 Player player = Main.player[playerIndex];
130 string key = null;
131 bool flag = true;
132 if (flag)
133 {
134 flag &= IsPlayerNearAPylon(player);
135 if (!flag)
136 {
137 key = "Net.CannotTeleportToPylonBecausePlayerIsNotNearAPylon";
138 }
139 }
140 if (flag)
141 {
144 if (!flag)
145 {
146 key = "Net.CannotTeleportToPylonBecauseNotEnoughNPCs";
147 }
148 }
149 if (flag)
150 {
153 int num3;
154 if (!flag3.HasValue)
155 {
156 num3 = ((info.ModPylon?.ValidTeleportCheck_AnyDanger(info) ?? flag) ? 1 : 0);
157 }
158 else
159 {
160 bool value = flag3.GetValueOrDefault();
161 num3 = (value ? 1 : 0);
162 }
163 flag = (byte)num3 != 0;
164 if (!flag)
165 {
166 key = "Net.CannotTeleportToPylonBecauseThereIsDanger";
167 }
168 }
169 if (flag)
170 {
171 if (!NPC.downedPlantBoss && (double)info.PositionInTiles.Y > Main.worldSurface && Framing.GetTileSafely(info.PositionInTiles.X, info.PositionInTiles.Y).wall == 87)
172 {
173 flag = false;
174 }
175 if (!flag)
176 {
177 key = "Net.CannotTeleportToPylonBecauseAccessingLihzahrdTempleEarly";
178 }
179 }
180 if (flag)
181 {
182 _sceneMetrics.ScanAndExportToMain(new SceneMetricsScanSettings
183 {
184 VisualScanArea = null,
185 BiomeScanCenterPositionInWorld = info.PositionInTiles.ToWorldCoordinates(),
186 ScanOreFinderData = false
187 });
189 if (!flag)
190 {
191 key = "Net.CannotTeleportToPylonBecauseNotMeetingBiomeRequirements";
192 }
193 }
194 info.ModPylon?.ValidTeleportCheck_DestinationPostCheck(info, ref flag, ref key);
195 TeleportPylonInfo nearbyInfo = default(TeleportPylonInfo);
196 bool flag2 = false;
197 int num = 0;
198 for (int i = 0; i < _pylons.Count; i++)
199 {
200 TeleportPylonInfo info2 = _pylons[i];
201 if (!player.InInteractionRange(info2.PositionInTiles.X, info2.PositionInTiles.Y, TileReachCheckSettings.Pylons))
202 {
203 continue;
204 }
206 if (num < 1)
207 {
208 num = 1;
209 }
212 {
213 if (num < 2)
214 {
215 num = 2;
216 }
217 _sceneMetrics.ScanAndExportToMain(new SceneMetricsScanSettings
218 {
219 VisualScanArea = null,
220 BiomeScanCenterPositionInWorld = info2.PositionInTiles.ToWorldCoordinates(),
221 ScanOreFinderData = false
222 });
224 {
225 flag2 = true;
226 break;
227 }
228 }
229 }
230 if (!flag2)
231 {
232 key = num switch
233 {
234 1 => "Net.CannotTeleportToPylonBecauseNotEnoughNPCsAtCurrentPylon",
235 2 => "Net.CannotTeleportToPylonBecauseNotMeetingBiomeRequirements",
236 _ => "Net.CannotTeleportToPylonBecausePlayerIsNotNearAPylon",
237 };
238 }
239 nearbyInfo.ModPylon?.ValidTeleportCheck_NearbyPostCheck(nearbyInfo, ref flag, ref flag2, ref key);
241 if (flag && flag2)
242 {
243 Vector2 newPos = info.PositionInTiles.ToWorldCoordinates() - new Vector2(0f, (float)player.HeightOffsetBoost);
244 info.ModPylon?.ModifyTeleportationPosition(info, ref newPos);
245 int num2 = 9;
246 int typeOfPylon = (int)info.TypeOfPylon;
247 int number = 0;
248 player.Teleport(newPos, num2, typeOfPylon);
249 player.velocity = Vector2.Zero;
250 if (Main.netMode == 2)
251 {
252 RemoteClient.CheckSection(player.whoAmI, player.position);
253 NetMessage.SendData(65, -1, -1, null, 0, player.whoAmI, newPos.X, newPos.Y, num2, number, typeOfPylon);
254 }
255 }
256 else
257 {
258 ChatHelper.SendChatMessageToClient(NetworkText.FromKey(key), new Color(255, 240, 20), playerIndex);
259 }
260 }
static void SendChatMessageToClient(NetworkText text, Color color, int playerId)
Definition ChatHelper.cs:30
int HowManyNPCsDoesPylonNeed(TeleportPylonInfo info, Player player)
bool DoesPylonAcceptTeleportation(TeleportPylonInfo info, Player player)
bool DoesPylonHaveEnoughNPCsAroundIt(TeleportPylonInfo info, int necessaryNPCCount)
static NetworkText FromKey(string key, params object[] substitutions)
Creates a NetworkText object from a localization key and optional substitutions. The receiving client...
Represents text that will be sent over the network in multiplayer and displayed to the receiving user...
static ? bool ValidTeleportCheck_PreAnyDanger(TeleportPylonInfo pylonInfo)
static void PostValidTeleportCheck(TeleportPylonInfo destinationPylonInfo, TeleportPylonInfo nearbyPylonInfo, ref bool destinationPylonValid, ref bool validNearbyPylonFound, ref string errorKey)
void ScanAndExportToMain(SceneMetricsScanSettings settings)

References Terraria.GameContent.TeleportPylonsSystem._pylons, Terraria.GameContent.TeleportPylonsSystem._sceneMetrics, Terraria.NPC.AnyDanger(), Terraria.RemoteClient.CheckSection(), Terraria.GameContent.TeleportPylonsSystem.DoesPylonAcceptTeleportation(), Terraria.GameContent.TeleportPylonsSystem.DoesPylonHaveEnoughNPCsAroundIt(), Terraria.NPC.downedPlantBoss, Terraria.Localization.NetworkText.FromKey(), Terraria.Framing.GetTileSafely(), Terraria.Player.HeightOffsetBoost, Terraria.GameContent.TeleportPylonsSystem.HowManyNPCsDoesPylonNeed(), Terraria.Player.InInteractionRange(), Terraria.GameContent.TeleportPylonsSystem.IsPlayerNearAPylon(), Terraria.Main.netMode, Terraria.Main.player, Terraria.Entity.position, Terraria.ModLoader.PylonLoader.PostValidTeleportCheck(), Terraria.DataStructures.TileReachCheckSettings.Pylons, Terraria.SceneMetrics.ScanAndExportToMain(), Terraria.Chat.ChatHelper.SendChatMessageToClient(), Terraria.NetMessage.SendData(), Terraria.Player.Teleport(), Terraria.ModLoader.PylonLoader.ValidTeleportCheck_PreAnyDanger(), and Terraria.Entity.whoAmI.

+ Here is the call graph for this function: