tModLoader icon indicating copy to clipboard operation
tModLoader copied to clipboard

Fix several TileObjectData issues and document TileObjectData class

Open JavidPack opened this issue 1 month ago • 0 comments

Document TileObjectData class and much more. Modders have long been confused about how alternate placements work. The documentation strives to standardize terminology, specifically regarding tile style, alternate placements, and placement style. The Basic Tile wiki page has also been updated.

In an effort to document TileObjectData, the following fixes were applied to issues discovered:

Fix issue in TileLoader.CheckModTile checking incorrect alternate TileObjectData, causing tiles with alternate anchors to immediately be killed unless an additional alternate is registered. Update ExampleSign with fix.

Fix ExampleDoorOpen, it was using the vanilla open door TileObjectData which incorrectly uses StyleLineSkip and alternate placements. Consequently, it did not obey the correct anchors when opened to the left:

https://github.com/tModLoader/tModLoader/assets/4522492/79b8e5da-89bb-4d6a-8c6a-de496862f4ae

Added TileObjectDataShowcase.cs to showcase advanced usage of TileObjectData including left and right placements, random placements, animation, toggle states, custom anchors, and multiple styles. It shows how each of these affect the layout of the expected tile spritesheet.

Fix some bottom anchor checks incorrectly being applied to tiles that did not have the specific AnchorTypes being checked in their bottom anchor.

Fixed TileObjectData.GetTileStyle/GetTileInfo incorrectly ignoring StyleMultiplier when used with StyleLineSkip, which will allow tiles also using StyleWrapLimit to function correctly.

Fix random placement cache not working with alternates with different origins (mistakenly cycles new random placement style each update)

Also fix ExampleLamp flame flip regression.

JavidPack avatar Jun 28 '24 00:06 JavidPack