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

◆ AimAbility()

bool Terraria.Mount.AimAbility ( Player mountedPlayer,
Vector2 mousePosition )
inline

Definition at line 5455 of file Mount.cs.

5456 {
5457 //IL_0009: Unknown result type (might be due to invalid IL or missing references)
5458 //IL_0443: Unknown result type (might be due to invalid IL or missing references)
5459 //IL_0444: Unknown result type (might be due to invalid IL or missing references)
5460 //IL_044a: Unknown result type (might be due to invalid IL or missing references)
5461 //IL_044f: Unknown result type (might be due to invalid IL or missing references)
5462 //IL_003f: Unknown result type (might be due to invalid IL or missing references)
5463 //IL_0040: Unknown result type (might be due to invalid IL or missing references)
5464 //IL_0046: Unknown result type (might be due to invalid IL or missing references)
5465 //IL_004b: Unknown result type (might be due to invalid IL or missing references)
5466 //IL_02cd: Unknown result type (might be due to invalid IL or missing references)
5467 //IL_02ce: Unknown result type (might be due to invalid IL or missing references)
5468 //IL_02d4: Unknown result type (might be due to invalid IL or missing references)
5469 //IL_02d9: Unknown result type (might be due to invalid IL or missing references)
5470 //IL_04e5: Unknown result type (might be due to invalid IL or missing references)
5471 //IL_04e6: Unknown result type (might be due to invalid IL or missing references)
5472 //IL_0381: Unknown result type (might be due to invalid IL or missing references)
5473 //IL_017c: Unknown result type (might be due to invalid IL or missing references)
5474 //IL_01c6: Unknown result type (might be due to invalid IL or missing references)
5475 //IL_03c4: Unknown result type (might be due to invalid IL or missing references)
5476 //IL_03da: Unknown result type (might be due to invalid IL or missing references)
5477 //IL_03ec: Unknown result type (might be due to invalid IL or missing references)
5478 //IL_03fa: Unknown result type (might be due to invalid IL or missing references)
5479 //IL_01d6: Unknown result type (might be due to invalid IL or missing references)
5480 //IL_0234: Unknown result type (might be due to invalid IL or missing references)
5481 //IL_0202: Unknown result type (might be due to invalid IL or missing references)
5482 //IL_0262: Unknown result type (might be due to invalid IL or missing references)
5483 //IL_0270: Unknown result type (might be due to invalid IL or missing references)
5484 _aiming = true;
5486 switch (_type)
5487 {
5488 case 9:
5489 {
5491 int direction2 = mountedPlayer.direction;
5492 float num4 = MathHelper.ToDegrees((ClampToDeadZone(mountedPlayer, mousePosition) - mountedPlayer.Center).ToRotation());
5493 if (num4 > 90f)
5494 {
5495 mountedPlayer.direction = -1;
5496 num4 = 180f - num4;
5497 }
5498 else if (num4 < -90f)
5499 {
5500 mountedPlayer.direction = -1;
5501 num4 = -180f - num4;
5502 }
5503 else
5504 {
5505 mountedPlayer.direction = 1;
5506 }
5507 if ((mountedPlayer.direction > 0 && mountedPlayer.velocity.X < 0f) || (mountedPlayer.direction < 0 && mountedPlayer.velocity.X > 0f))
5508 {
5509 _flipDraw = true;
5510 }
5511 else
5512 {
5513 _flipDraw = false;
5514 }
5515 if (num4 >= 0f)
5516 {
5517 if ((double)num4 < 22.5)
5518 {
5519 _frameExtra = 8;
5520 }
5521 else if ((double)num4 < 67.5)
5522 {
5523 _frameExtra = 9;
5524 }
5525 else if ((double)num4 < 112.5)
5526 {
5527 _frameExtra = 10;
5528 }
5529 }
5530 else if ((double)num4 > -22.5)
5531 {
5532 _frameExtra = 8;
5533 }
5534 else if ((double)num4 > -67.5)
5535 {
5536 _frameExtra = 7;
5537 }
5538 else if ((double)num4 > -112.5)
5539 {
5540 _frameExtra = 6;
5541 }
5543 if (abilityCharge > 0f)
5544 {
5545 Vector2 vector = default(Vector2);
5546 vector.X = mountedPlayer.position.X + (float)(mountedPlayer.width / 2);
5547 vector.Y = mountedPlayer.position.Y + (float)mountedPlayer.height;
5548 int num5 = (_frameExtra - 6) * 2;
5549 Vector2 vector2 = default(Vector2);
5550 for (int i = 0; i < 2; i++)
5551 {
5552 vector2.Y = vector.Y + scutlixEyePositions[num5 + i].Y;
5553 if (mountedPlayer.direction == -1)
5554 {
5555 vector2.X = vector.X - scutlixEyePositions[num5 + i].X - (float)_data.xOffset;
5556 }
5557 else
5558 {
5559 vector2.X = vector.X + scutlixEyePositions[num5 + i].X + (float)_data.xOffset;
5560 }
5561 Lighting.AddLight((int)(vector2.X / 16f), (int)(vector2.Y / 16f), 1f * abilityCharge, 0f, 0f);
5562 }
5563 }
5564 if (_frameExtra == frameExtra2)
5565 {
5566 return mountedPlayer.direction != direction2;
5567 }
5568 return true;
5569 }
5570 case 46:
5571 {
5572 int frameExtra = _frameExtra;
5573 int direction = mountedPlayer.direction;
5574 float num3 = MathHelper.ToDegrees((ClampToDeadZone(mountedPlayer, mousePosition) - mountedPlayer.Center).ToRotation());
5575 if (num3 > 90f)
5576 {
5577 mountedPlayer.direction = -1;
5578 num3 = 180f - num3;
5579 }
5580 else if (num3 < -90f)
5581 {
5582 mountedPlayer.direction = -1;
5583 num3 = -180f - num3;
5584 }
5585 else
5586 {
5587 mountedPlayer.direction = 1;
5588 }
5589 if ((mountedPlayer.direction > 0 && mountedPlayer.velocity.X < 0f) || (mountedPlayer.direction < 0 && mountedPlayer.velocity.X > 0f))
5590 {
5591 _flipDraw = true;
5592 }
5593 else
5594 {
5595 _flipDraw = false;
5596 }
5597 if (AbilityCharge > 0f)
5598 {
5599 Vector2 vector3 = default(Vector2);
5600 vector3.X = mountedPlayer.position.X + (float)(mountedPlayer.width / 2);
5601 vector3.Y = mountedPlayer.position.Y + (float)mountedPlayer.height;
5602 Vector2 vector4 = default(Vector2);
5603 for (int j = 0; j < 2; j++)
5604 {
5605 ((Vector2)(ref vector4))._002Ector(vector3.X + (float)(mountedPlayer.width * mountedPlayer.direction), vector3.Y - 12f);
5606 Lighting.AddLight((int)(vector4.X / 16f), (int)(vector4.Y / 16f), 0.7f, 0.4f, 0.4f);
5607 }
5608 }
5609 if (_frameExtra == frameExtra)
5610 {
5611 return mountedPlayer.direction != direction;
5612 }
5613 return true;
5614 }
5615 case 8:
5616 {
5618 DrillMountData drillMountData = (DrillMountData)_mountSpecificData;
5619 float num = v.ToRotation();
5620 if (num < 0f)
5621 {
5622 num += (float)Math.PI * 2f;
5623 }
5624 drillMountData.diodeRotationTarget = num;
5625 float num2 = drillMountData.diodeRotation % ((float)Math.PI * 2f);
5626 if (num2 < 0f)
5627 {
5628 num2 += (float)Math.PI * 2f;
5629 }
5630 if (num2 < num)
5631 {
5632 if (num - num2 > (float)Math.PI)
5633 {
5634 num2 += (float)Math.PI * 2f;
5635 }
5636 }
5637 else if (num2 - num > (float)Math.PI)
5638 {
5639 num2 -= (float)Math.PI * 2f;
5640 }
5641 drillMountData.diodeRotation = num2;
5642 drillMountData.crosshairPosition = mousePosition;
5643 return true;
5644 }
5645 default:
5646 return false;
5647 }
5648 }
static void AimAbility(Mount mount, Player player, Vector2 mousePosition)
Allows you to make things happen when the mount ability is aiming (while charging).
This serves as the central place from which mounts are stored and mount-related functions are carried...
static Vector2[] scutlixEyePositions
Definition Mount.cs:264
bool _flipDraw
Definition Mount.cs:294
MountData _data
Definition Mount.cs:290
bool _aiming
Definition Mount.cs:326
object _mountSpecificData
Definition Mount.cs:332
int _frameExtra
Definition Mount.cs:300
Vector2 ClampToDeadZone(Player mountedPlayer, Vector2 position)
Definition Mount.cs:5401
float AbilityCharge
Definition Mount.cs:527

References Terraria.Mount._aiming, Terraria.Mount._data, Terraria.Mount._flipDraw, Terraria.Mount._frameExtra, Terraria.Mount._mountSpecificData, Terraria.Mount._type, Terraria.Mount.AbilityCharge, Terraria.Lighting.AddLight(), Terraria.ModLoader.MountLoader.AimAbility(), Terraria.Mount.ClampToDeadZone(), Terraria.Mount.scutlixEyePositions, and Terraria.Mount.MountData.xOffset.

Referenced by Terraria.Mount.UpdateEffects().

+ Here is the call graph for this function:
+ Here is the caller graph for this function: