Pryaxis / TShock

☕️⚡️TShock provides Terraria servers with server-side characters, anti-cheat, and community management tools.
GNU General Public License v3.0
2.41k stars 377 forks source link

Allow more tile and wall conversion #2847

Closed sgkoishi closed 1 year ago

sgkoishi commented 1 year ago

Fixes unable to use Purification/Evil Powder in jungle, reported by toxic.

sgkoishi commented 1 year ago

This actually add more allowed conversion other than jungle: MergesWithDirtInASpecialWay set:

TileID.Grass
TileID.CorruptGrass
TileID.HallowedGrass
TileID.CrimsonGrass
TileID.GolfGrass
TileID.GolfGrassHallowed

JungleGrass set:

TileID.JungleGrass
TileID.CorruptJungleGrass
TileID.CrimsonJungleGrass

GolfGrass set:

TileID.GolfGrass
TileID.GolfGrassHallowed

and walls

Dirt set:

WallID.DirtUnsafe
WallID.Dirt

Snow set:

WallID.SnowWallUnsafe
WallID.SnowWallEcho

Ice set:

WallID.IceUnsafe
WallID.IceEcho
sgkoishi commented 1 year ago

According to the client-side projectile AI WorldGen.Convert(int i, int j, int conversionType, int size = 4), the TileID.Sets.Conversion.Moss and TileID.Sets.Conversion.MossBrick is never used by any vanilla code (perhaps we should remove them?) (Moss is actually used in some checks like gemtree and shimmer, but neither is used in conversion)

drunderscore commented 1 year ago

@sgkoishi Yeah, we should only allow the conversions that vanilla allows, being as strict and accurate as possible. A filter on the field name should suffice?

hakusaro commented 1 year ago

@drunderscore @sgkoishi hi! I didn't merge this because @drunderscore has a change request on this PR, fyi.

sgkoishi commented 1 year ago

Yes, it's still under consideration which impl is better. The proposed version fixed the problem and seems to be future-proof, but it actually allows certain impossible conversion (which those are harmless for now).

sgkoishi commented 1 year ago

The wall conversion is actually way more complicated - perhaps create dummy tiles and run WorldGen.Convert would be better to get an 'accurate' convertible table.