From 5c402d6fd15eaf4438434a52ac7d4db70d88e53a Mon Sep 17 00:00:00 2001 From: JavidPack Date: Thu, 12 Oct 2023 14:08:30 -0600 Subject: [PATCH] Pully and direction related documentation --- ExampleMod/Content/Tiles/ExampleStatue.cs | 2 +- patches/tModLoader/Terraria/Entity.cs.patch | 17 +++++++++++++++-- patches/tModLoader/Terraria/Player.cs.patch | 18 ++++++++++++++++-- 3 files changed, 32 insertions(+), 5 deletions(-) diff --git a/ExampleMod/Content/Tiles/ExampleStatue.cs b/ExampleMod/Content/Tiles/ExampleStatue.cs index 6e5c945029b..42a953c14de 100644 --- a/ExampleMod/Content/Tiles/ExampleStatue.cs +++ b/ExampleMod/Content/Tiles/ExampleStatue.cs @@ -16,7 +16,7 @@ public class ExampleStatue : ModTile Main.tileFrameImportant[Type] = true; Main.tileObsidianKill[Type] = true; TileID.Sets.DisableSmartCursor[Type] = true; - TileID.Sets.IsAMechanism[Type] = true; // Ensures that this tile and connected pressure plate won't be removed during the "Remove Broken Traps" worlden step + TileID.Sets.IsAMechanism[Type] = true; // Ensures that this tile and connected pressure plate won't be removed during the "Remove Broken Traps" worldgen step TileObjectData.newTile.CopyFrom(TileObjectData.Style2xX); TileObjectData.addTile(Type); diff --git a/patches/tModLoader/Terraria/Entity.cs.patch b/patches/tModLoader/Terraria/Entity.cs.patch index 609bfdf144f..c76ea547714 100644 --- a/patches/tModLoader/Terraria/Entity.cs.patch +++ b/patches/tModLoader/Terraria/Entity.cs.patch @@ -1,6 +1,6 @@ --- src/TerrariaNetCore/Terraria/Entity.cs +++ src/tModLoader/Terraria/Entity.cs -@@ -3,19 +_,51 @@ +@@ -3,19 +_,54 @@ namespace Terraria; @@ -23,7 +23,7 @@ internal long entityId; + + /// -+ /// The position of this Entity in world coordinates. ++ /// The position of this Entity in world coordinates. Note that this corresponds to the top left corner of the entity. Use instead for logic that needs the position at the center of the entity. + /// public Vector2 position; + @@ -34,6 +34,9 @@ public Vector2 oldPosition; public Vector2 oldVelocity; public int oldDirection; ++ /// ++ /// The direction this entity is facing. A value of 1 means the entity is facing to the right. -1 means facing to the left. ++ /// public int direction = 1; + + /// @@ -53,3 +56,13 @@ public bool wet; public bool shimmerWet; public bool honeyWet; +@@ -24,6 +_,9 @@ + + public virtual Vector2 VisualPosition => position; + ++ /// ++ /// The center position of this entity in world coordinates. Calculated from , , and . ++ /// + public Vector2 Center { + get { + return new Vector2(position.X + (float)(width / 2), position.Y + (float)(height / 2)); diff --git a/patches/tModLoader/Terraria/Player.cs.patch b/patches/tModLoader/Terraria/Player.cs.patch index 49fffd091ff..44ac24aaae3 100644 --- a/patches/tModLoader/Terraria/Player.cs.patch +++ b/patches/tModLoader/Terraria/Player.cs.patch @@ -149,7 +149,7 @@ public int dashDelay; public int eocDash; public int eocHit; -@@ -601,6 +_,24 @@ +@@ -601,8 +_,32 @@ public int gem = -1; public int gemCount; public BitsByte ownedLargeGems; @@ -172,8 +172,16 @@ + // Concrete use cases exist. Just gotta find a way to make a system for them intuitive. + // - Thomas public byte meleeEnchant; ++ /// ++ /// While attached to a rope or similar tile (), this value represents the how close to the rope the player is. A value of 1 means the player is centered on the rope, while a value of 2 represents that the player has nudged away from the rope but is still attached. is used still for the players direction. ++ /// public byte pulleyDir; ++ /// ++ /// If true, the player is attached to a rope or similar tile. ++ /// public bool pulley; + public int pulleyFrame; + public float pulleyFrameCounter; @@ -612,6 +_,13 @@ public int snowBallLauncherInteractionCooldown; public bool iceSkate; @@ -5757,8 +5765,14 @@ if (num8 > 0) DropItemFromExtractinator(num8, num9); } -@@ -32784,6 +_,10 @@ +@@ -32782,8 +_,16 @@ + NetMessage.SendData(21, -1, -1, null, number, 1f); + } ++ /// ++ /// Changes the player's direction () while adjusting arm and item rotations to be consistent. Will also account for and . The player direction change will be prevented if the player is on a rope but there isn't space for the player to face the new direction. ++ /// ++ /// public void ChangeDir(int dir) { + // added by TML, forward port from 1.4.5