diff --git a/assets/lang/en/warnings.json b/assets/lang/en/warnings.json new file mode 100644 index 0000000..84a4bb4 --- /dev/null +++ b/assets/lang/en/warnings.json @@ -0,0 +1,4 @@ +{ + "cheatalert_message": "This game closed any suspicious software automatically. If this causes problems, please exit the game and contact support for help immediately.", + "cheatalert_title": "Cheat process detected in your operating system! D:<" +} \ No newline at end of file diff --git a/project.godot b/project.godot index f46f287..e748f96 100644 --- a/project.godot +++ b/project.godot @@ -22,6 +22,7 @@ config/icon="res://assets/textures/debug/dummy-player-normal.png" Essential="res://src/essential.cs" PlayerVariables="*res://src/player_variables.cs" Console="*res://scenes/gui/console.tscn" +Anticheat="*res://src/anticheat.cs" [display] @@ -134,6 +135,7 @@ cheat_start={ [internationalization] locale/translation_remaps={} +locale/translations_pot_files=PackedStringArray() [layer_names] diff --git a/src/anticheat.cs b/src/anticheat.cs new file mode 100644 index 0000000..1f4e43c --- /dev/null +++ b/src/anticheat.cs @@ -0,0 +1,29 @@ +using System.Diagnostics; +using Godot; + +public partial class anticheat : Node +{ + string[] suspiciousProcesses = { "cheat", "wemod" }; + string alertMessage; + string alertTitle; + public override void _Ready() + { + var lang = Json.ParseString(FileAccess.Open("res://assets/lang/en/warnings.json", FileAccess.ModeFlags.Read).GetAsText()).AsGodotDictionary(); + alertMessage = lang["cheatalert_message"].ToString(); + alertTitle = lang["cheatalert_title"].ToString(); + } + public override void _Process(double delta) + { + foreach (Process p in Process.GetProcesses()) + foreach (string s in suspiciousProcesses) + { + if (p.ProcessName.Find(s) >= 0) //cheat gets detected + { + GetTree().Paused = true; + OS.Kill(p.Id); + OS.Alert(alertMessage, alertTitle); + GetTree().Paused = false; + } + } + } +}