forked from tModLoader/tModLoader
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added CanBeSloped to mod/global tiles (tModLoader#2444)
* Added CanBeSloped to mod/global tiles * Summary changes * Changed CanBeSloped to ModifySloping with ref parameter, added ExampleSlopedTile * Changed back to CanBeSloped * Implement via TileID.Sets instead of hook * Missed file Co-authored-by: Chicken-Bones <[email protected]>
- Loading branch information
1 parent
0a47a19
commit 41ab2b7
Showing
6 changed files
with
89 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
using Terraria.ID; | ||
using Terraria.ModLoader; | ||
|
||
namespace ExampleMod.Content.Items.Placeable | ||
{ | ||
public class ExampleSlopedTile : ModItem | ||
{ | ||
public override void SetStaticDefaults() { | ||
Tooltip.SetDefault("Example tile that can be sloped but is not solid"); | ||
} | ||
|
||
public override void SetDefaults() { | ||
Item.width = 12; | ||
Item.height = 12; | ||
Item.maxStack = 999; | ||
Item.useTurn = true; | ||
Item.autoReuse = true; | ||
Item.useAnimation = 15; | ||
Item.useTime = 10; | ||
Item.useStyle = ItemUseStyleID.Swing; | ||
Item.consumable = true; | ||
Item.createTile = ModContent.TileType<Tiles.ExampleSlopeTile>(); | ||
} | ||
|
||
public override void AddRecipes() { | ||
CreateRecipe(1) | ||
.AddIngredient(ModContent.ItemType<ExampleBlock>(), 1) | ||
.Register(); | ||
} | ||
} | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
using Terraria; | ||
using Terraria.Audio; | ||
using Terraria.ID; | ||
using Terraria.ModLoader; | ||
|
||
namespace ExampleMod.Content.Tiles | ||
{ | ||
public class ExampleSlopeTile : ModTile | ||
{ | ||
public override void SetStaticDefaults() { | ||
Main.tileFrameImportant[Type] = true; | ||
TileID.Sets.CanBeSloped[Type] = true; // allow this tile to be sloped, because it isn't solid | ||
|
||
ItemDrop = ModContent.ItemType<Items.Placeable.ExampleSlopedTile>(); | ||
} | ||
|
||
public override bool Slope(int i, int j) { | ||
Tile tile = Framing.GetTileSafely(i, j); | ||
tile.TileFrameX = (short)((tile.TileFrameX + 18) % 72); | ||
SoundEngine.PlaySound(SoundID.MenuTick); | ||
return false; | ||
} | ||
|
||
public override bool TileFrame(int i, int j, ref bool resetFrame, ref bool noBreak) { | ||
return false; | ||
} | ||
} | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters