Skip to content

Commit

Permalink
Merge pull request #9 from Imaginos16/large-stone-brick
Browse files Browse the repository at this point in the history
Fixes Out Of Bounds Bug and Adds a Large Stone Brick Block
  • Loading branch information
MarkSuckerberg authored Aug 28, 2023
2 parents 3f90002 + c67ed54 commit 24a507b
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 2 deletions.
13 changes: 13 additions & 0 deletions Blocktest/Code/Blocks/LargeStoneBrick.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
namespace Blocktest.Blocks
{
public class LargeStoneBrick : Block
{
public override void Initialize()
{
blockName = "Large Stone Brick";
blockID = 15;
blockSmoothing = true;
base.Initialize();
}
}
}
3 changes: 2 additions & 1 deletion Blocktest/Code/BuildSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ public static void BreakBlockCell(bool foreground, Vector2Int tilePosition)
}

foreach (Vector2Int loc in new List<Vector2Int>() { Vector2Int.Up, Vector2Int.Down, Vector2Int.Left, Vector2Int.Right }) { // Refreshes all blocks in cardinal dirs
if(tilemap.HasTile(tilePosition + loc)){
if ((tilePosition + loc).X >= 0 && (tilePosition + loc).X < tilemap.tilemapSize.X && (tilePosition + loc).Y >= 0 && (tilePosition + loc).Y < tilemap.tilemapSize.Y && (tilemap.HasTile(tilePosition + loc)))
{
tilemap.GetTile(tilePosition + loc).UpdateAdjacencies(tilePosition + loc, tilemap);

Check warning on line 41 in Blocktest/Code/BuildSystem.cs

View workflow job for this annotation

GitHub Actions / build

Dereference of a possibly null reference.
}
}
Expand Down
2 changes: 1 addition & 1 deletion Blocktest/Code/Math.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace Blocktest
namespace Blocktest
{
/// <summary>
/// Represents a vector with two integer values rather than two floating-point values.
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 24a507b

Please sign in to comment.