Skip to content

Commit

Permalink
ExampleMod cleanup for recent WallFrame changes
Browse files Browse the repository at this point in the history
  • Loading branch information
JavidPack committed Sep 22, 2022
1 parent bd501f3 commit 8fcb840
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
7 changes: 4 additions & 3 deletions ExampleMod/Common/GlobalWalls/ExampleGlobalWall.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,15 @@ namespace ExampleMod.Content.Walls
{
public class ExampleGlobalWall : GlobalWall
{
public override bool WallFrame(int i, int j, int type, bool resetFrame, ref int style, ref int frameNumber) {
public override bool WallFrame(int i, int j, int type, bool randomizeFrame, ref int style, ref int frameNumber) {
// This example shows adding additional visual effects to wall framing.
if(Main.rand.NextBool(20))
if(Main.rand.NextBool(20)) {
Dust.NewDustPerfect(new Vector2(i * 16 + 8, j * 16 + 8), ModContent.DustType<Sparkle>(), Vector2.Zero);
}

// A more typical usage of this hook would be to implement a custom wall framing pattern.

return base.WallFrame(i, j, type, resetFrame, ref style, ref frameNumber);
return base.WallFrame(i, j, type, randomizeFrame, ref style, ref frameNumber);
}
}
}
6 changes: 3 additions & 3 deletions ExampleMod/Content/Walls/ExampleWallAdvanced.cs
Original file line number Diff line number Diff line change
Expand Up @@ -46,14 +46,14 @@ public override void ModifyLight(int i, int j, ref float r, ref float g, ref flo
}
}

public override bool WallFrame(int i, int j, bool resetFrame, ref int style, ref int frameNumber) {
if (resetFrame) {
public override bool WallFrame(int i, int j, bool randomizeFrame, ref int style, ref int frameNumber) {
if (randomizeFrame) {
// Here we make the chance of WallFrameNumber 0 very rare, just for visual variety: https://i.imgur.com/9Irak3p.png
if (frameNumber == 0 && WorldGen.genRand.NextBool(3, 4)) {
frameNumber = WorldGen.genRand.Next(1, 3);
}
}
return base.WallFrame(i, j, resetFrame, ref style, ref frameNumber);
return base.WallFrame(i, j, randomizeFrame, ref style, ref frameNumber);
}
}
}

0 comments on commit 8fcb840

Please sign in to comment.