Skip to content

Commit

Permalink
Merge pull request #10 from shlifedev/dev
Browse files Browse the repository at this point in the history
Tile Entity Filter
  • Loading branch information
IntelSDM authored Sep 5, 2023
2 parents 8dce4ed + 6abf600 commit c1edb77
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 5 deletions.
4 changes: 3 additions & 1 deletion 7DTD/Configs/Tiles.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,11 @@
namespace Cheat.Configs
{
class Tiles
{
{

public bool Name = true;
public bool Distance = true;
public int MaxDistance = 300;
public bool[] TypeFilter = new bool[(Enum.GetNames(typeof(TileEntityType)).Length)];
}
}
21 changes: 17 additions & 4 deletions 7DTD/Esp/Tiles.cs
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Remoting;
using System.Text;
using System.Threading.Tasks;
using UnityEngine;
namespace Cheat.Esp
{
class Tiles : MonoBehaviour
{

private const string Identifier = "Tile Item Colour";
private float CacheTime;
public static List<TileEntity> TileList = new List<TileEntity>();

void Update()
{
try
Expand Down Expand Up @@ -47,9 +49,9 @@ void OnGUI()

if (GameManager.Instance.World == null)
return; // check if world is active

foreach (TileEntity tile in TileList)
{
{
if (tile == null)
continue; // check for valid pointer
BlockEntityData blockentity = tile.GetChunk().GetBlockEntity(tile.ToWorldPos());
Expand All @@ -69,7 +71,18 @@ void OnGUI()
if (distance > Globals.Config.Tiles.MaxDistance)
continue;

Drawing.DrawString(new Vector2(screenposition.x, screenposition.y), $"{namestr}{distancestr}", Helpers.ColourHelper.GetColour("Tile Item Colour"), true, 12, FontStyle.Normal, 0);

// It's Just TileEntityType Length Check Only
var tileTypes = Enum.GetNames(typeof(TileEntityType));
for(int i = 0; i < tileTypes.Length; i++)
{
if (Globals.Config.Tiles.TypeFilter[i] && tileTypes[i] == tile.GetTileEntityType().ToStringCached())
{
Drawing.DrawString(new Vector2(screenposition.x, screenposition.y), $"{namestr}{distancestr}", Helpers.ColourHelper.GetColour(Identifier), true, 12, FontStyle.Normal, 0);
}
}


}
}
catch { }
Expand Down
17 changes: 17 additions & 0 deletions 7DTD/Menu/Main.cs
Original file line number Diff line number Diff line change
Expand Up @@ -141,9 +141,26 @@ void ESP()
Toggle tiledistance = new Toggle("Tile Distance", "Shows Your Distance From The Tile", ref Globals.Config.Tiles.Distance);
IntSlider tilemaxdistance = new IntSlider("Max Distance", "Max Distance Tiles Will Render", ref Globals.Config.Tiles.MaxDistance, 0, 2000, 50);




tiles.Items.Add(tilename);
tiles.Items.Add(tiledistance);
tiles.Items.Add(tilemaxdistance);



SubMenu tileTypeFilterMenu = new SubMenu("Filter", "Tile Filter");
tiles.Items.Add(tileTypeFilterMenu);

System.Collections.IList filterType = Enum.GetValues(typeof(TileEntityType));
for (int i = 0; i < filterType.Count; i++)
{
var type = (TileEntityType)filterType[i];
Toggle tileTypeFilterToggle = new Toggle($"Tile Type Filter {type.ToStringCached()}", $"Filter : {type.ToStringCached()}", ref Globals.Config.Tiles.TypeFilter[i]);
tileTypeFilterMenu.Items.Add(tileTypeFilterToggle);
}

#endregion
}
#endregion
Expand Down

0 comments on commit c1edb77

Please sign in to comment.