Skip to content

Commit

Permalink
v0.15.1, Non-windows bug fix, Basic World Snapshot implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
JavidPack committed Sep 26, 2020
1 parent 275149f commit 55557f8
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 5 deletions.
43 changes: 42 additions & 1 deletion Tools/Miscellaneous/MiscellaneousUI.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public override void OnInitialize()
mainPanel = new UIPanel();
mainPanel.SetPadding(0);
int width = 250;
int height = 180;
int height = 270;
mainPanel.Left.Set(-40f - width, 1f);
mainPanel.Top.Set(-110f - height, 1f);
mainPanel.Width.Set(width, 0f);
Expand Down Expand Up @@ -89,9 +89,50 @@ public override void OnInitialize()
mainPanel.Append(logSoundsCheckbox);
top += 20;

UITextPanel<string> takeWorldSnapshot = new UITextPanel<string>("Take World Snapshot (WIP)");
takeWorldSnapshot.SetPadding(4);
takeWorldSnapshot.Width.Set(-10, 0.5f);
takeWorldSnapshot.Top.Set(top, 0f);
takeWorldSnapshot.OnClick += TakeWorldSnapshot_OnClick; ;
mainPanel.Append(takeWorldSnapshot);
top += 30;

UITextPanel<string> restoreWorldSnapshot = new UITextPanel<string>("Restore World Snapshot (WIP)");
restoreWorldSnapshot.SetPadding(4);
restoreWorldSnapshot.Width.Set(-10, 0.5f);
restoreWorldSnapshot.Top.Set(top, 0f);
restoreWorldSnapshot.OnClick += RestoreWorldSnapshot_OnClick; ;
mainPanel.Append(restoreWorldSnapshot);
top += 30;

Append(mainPanel);
}

Tile[,] snapshot;
private void TakeWorldSnapshot_OnClick(UIMouseEvent evt, UIElement listeningElement) {
Main.NewText("Taking Snapshot");
snapshot = new Tile[Main.maxTilesX, Main.maxTilesY];
for (int i = 0; i < Main.maxTilesX; i++) {
for (int j = 0; j < Main.maxTilesY; j++) {
snapshot[i, j] = new Tile(Main.tile[i, j]);
}
}
Main.NewText("Taking Snapshot Complete");
}

private void RestoreWorldSnapshot_OnClick(UIMouseEvent evt, UIElement listeningElement) {
if (snapshot == null) {
Main.NewText("No snapshot available");
return;
}
Main.NewText("Restoring Snapshot");
for (int i = 0; i < Main.maxTilesX; i++) {
for (int j = 0; j < Main.maxTilesY; j++) {
Main.tile[i, j] = new Tile(snapshot[i, j]);
}
}
Main.NewText("Restoring Snapshot Complete");
}

static string folder = Path.Combine(Main.SavePath, "Mods", "Cache");
private void GenerateTownSprite_OnClick(UIMouseEvent evt, UIElement listeningElement)
Expand Down
9 changes: 6 additions & 3 deletions Tools/Shaders/ShaderPlayer.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System;
using ReLogic.OS;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
Expand All @@ -10,8 +11,10 @@ namespace ModdersToolkit.Tools.Shaders
class ShaderPlayer : ModPlayer
{
public override void UpdateBiomeVisuals() {
bool forcedShaderActive = ShaderTool.shaderUI.forceShaderCheckbox.Selected && ShaderTool.shaderUI.lastShaderIsScreenShader;
player.ManageSpecialBiomeVisuals("ModdersToolkit:TestScreenShader", forcedShaderActive);
if (Platform.IsWindows) {
bool forcedShaderActive = ShaderTool.shaderUI.forceShaderCheckbox.Selected && ShaderTool.shaderUI.lastShaderIsScreenShader;
player.ManageSpecialBiomeVisuals("ModdersToolkit:TestScreenShader", forcedShaderActive);
}
}
}
}
2 changes: 1 addition & 1 deletion build.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
author = jopojelly
version = 0.15.0.1
version = 0.15.1
versionScheme = major when done, minor when new tool, build when new item within tool, revision for bug fix quick release
displayName = Modders Toolkit
homepage = https://forums.terraria.org/index.php?threads/modders-toolkit-a-mod-for-modders-doing-modding.55738/
Expand Down

0 comments on commit 55557f8

Please sign in to comment.