TileID.Sets To Let Tiles Be Placed Next to Non-Solid tiles #3684
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What is the new feature?
Added a new tile ID set
TileID.Sets.CanPlaceNextToNonSolidTile[]
which allows players to place tiles next to non-solid tiles.Why should this be part of tModLoader?
By default, you cannot place tiles on non-solid tiles. In vanilla,
Player.PlaceThing_Tiles_BlockPlacementForAssortedThings()
has an exception for Cobwebs, Coin Piles, Living Fire Blocks, Smoke Blocks, and Bubble Blocks which lets you place them on other non-solid tiles. Since the values are hardcoded, it is extremely difficult to make a non-solid mod tile that behaves in the same way.Using
TileID.Sets.IsBeam[]
comes close, but there are still placement differences. Beams can be placed on each other, but they can't be placed on other non-solid tiles. Here is a gif example between Beams and Living Fire:Are there alternative designs?
TileObjectData.newTile.HookCheckIfCanPlace
,TileObjectData.newTile.UsesCustomCanPlace = true
, and making a CanPlace hook. I've tried it and gotten it to do the placement correctly, but it was causing an object reference not set to an instance of an object error on the player when denying the placement (which causes the player's vanity and animations to break). You could instead allow the player to place the tile anywhere (midair), but that is a compromise rather than a real solution.Old bullet points
Sample usage for the new feature
Added ExampleLivingFire and ExampleLivingFireTile. See below.
ExampleMod updates
Added ExampleLivingFire and ExampleLivingFireTile.
SetDrawPositions()
and animating the tiles withAnimateTile()
. (The only difference between ExampleLivingFireTile and the vanilla Living Fire tiles is that the vanilla Living File has a different color for the map and doesn't reuse the light color.)