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

◆ PickTile()

void Terraria.Player.PickTile ( int x,
int y,
int pickPower )
inline

Definition at line 50232 of file Player.cs.

50233 {
50234 int num = hitTile.HitObject(x, y, 1);
50235 Tile tile = Main.tile[x, y];
50236 if (tile.type == 504)
50237 {
50238 return;
50239 }
50240 int num2 = GetPickaxeDamage(x, y, pickPower, num, tile);
50241 if (!WorldGen.CanKillTile(x, y))
50242 {
50243 num2 = 0;
50244 }
50245 if (Main.getGoodWorld)
50246 {
50247 num2 *= 2;
50248 }
50249 if (DoesPickTargetTransformOnKill(hitTile, num2, x, y, pickPower, num, tile))
50250 {
50251 num2 = 0;
50252 }
50253 if (hitTile.AddDamage(num, num2) >= 100)
50254 {
50255 AchievementsHelper.CurrentlyMining = true;
50256 ClearMiningCacheAt(x, y, 1);
50257 if (Main.netMode == 1 && Main.tileContainer[Main.tile[x, y].type])
50258 {
50259 if (Main.tile[x, y].type == 470 || Main.tile[x, y].type == 475)
50260 {
50261 NetMessage.SendData(17, -1, -1, null, 20, x, y);
50262 }
50263 else
50264 {
50265 WorldGen.KillTile(x, y, fail: true);
50266 NetMessage.SendData(17, -1, -1, null, 0, x, y, 1f);
50267 }
50268 if (Main.tile[x, y].type == 21)
50269 {
50270 NetMessage.SendData(34, -1, -1, null, 1, x, y);
50271 }
50272 if (Main.tile[x, y].type == 467)
50273 {
50274 NetMessage.SendData(34, -1, -1, null, 5, x, y);
50275 }
50276 if (Main.tile[x, y].type == 88)
50277 {
50278 NetMessage.SendData(34, -1, -1, null, 3, x, y);
50279 }
50280 }
50281 else
50282 {
50283 bool flag = Main.tile[x, y].active();
50284 WorldGen.KillTile(x, y);
50285 if (!Main.dedServ && flag && !Main.tile[x, y].active())
50286 {
50288 }
50289 if (Main.netMode == 1)
50290 {
50291 NetMessage.SendData(17, -1, -1, null, 0, x, y);
50292 }
50293 }
50294 AchievementsHelper.CurrentlyMining = false;
50295 }
50296 else
50297 {
50298 WorldGen.KillTile(x, y, fail: true);
50299 if (Main.netMode == 1)
50300 {
50301 NetMessage.SendData(17, -1, -1, null, 0, x, y, 1f);
50302 NetMessage.SendData(125, -1, -1, null, Main.myPlayer, x, y, num2);
50303 }
50304 }
50305 if (num2 != 0)
50306 {
50307 hitTile.Prune();
50308 }
50309 }
int AddDamage(int tileId, int damageAmount, bool updateAmount=true)
Definition HitTile.cs:177
int HitObject(int x, int y, int hitType)
Definition HitTile.cs:141
HitTile hitTile
Definition Player.cs:1323
void ClearMiningCacheAt(int x, int y, int hitTileCacheType)
Definition Player.cs:50311
bool DoesPickTargetTransformOnKill(HitTile hitCounter, int damage, int x, int y, int pickPower, int bufferIndex, Tile tileTarget)
Definition Player.cs:50528
int GetPickaxeDamage(int x, int y, int pickPower, int hitBufferIndex, Tile tileTarget)
Definition Player.cs:50368

References Terraria.WorldGen.CanKillTile(), Terraria.Main.dedServ, Terraria.Main.getGoodWorld, Terraria.GameContent.Achievements.AchievementsHelper.HandleMining(), Terraria.WorldGen.KillTile(), Terraria.Main.myPlayer, Terraria.Main.netMode, Terraria.NetMessage.SendData(), Terraria.Main.tile, Terraria.Main.tileContainer, and Terraria.Tile.type.