-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #25 from EamonnMR/cheats
Cheats
- Loading branch information
Showing
18 changed files
with
174 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,67 @@ | ||
extends Node | ||
|
||
var explore_all = true | ||
var explore_all = false | ||
var max_craft_level = false | ||
|
||
var CHEATS = [ | ||
{ | ||
"hash": "d10ba5f768ac9db04b8419a2590bce54", | ||
"callback": func explore_all_now(args): | ||
explore_all = true | ||
for i in Procgen.systems: | ||
Client.get_ui().get_node("Map").update_for_explore(i) | ||
return true}, | ||
{ | ||
"hash": "eba4a7a2f23a106e01e1380deac5190d", | ||
"callback": func free_resources(args): | ||
if not(len(args) == 2): | ||
Client.display_message("Please enter an item type and quantity") | ||
return false | ||
var type = args[0] | ||
var amount = int(args[1]) | ||
if not (type in Data.items): | ||
Client.display_message("Unknown item type: " + type) | ||
return | ||
Client.player.get_node("Inventory").add(type, amount) | ||
return true}, | ||
{ | ||
"hash": "8f1120f13067fb18ca2ee5bf7b57f9b8", | ||
"callback": func(_args): set_var("max_craft_level") | ||
}, | ||
{ | ||
"hash": "21a8297be0a2e4a39ec56a65015c0451", | ||
"callback": func make_player_invincible(args): | ||
var health = Client.player.get_node("Health") | ||
health.invulnerable = not health.invulnerable | ||
return health.invulnerable} | ||
] | ||
|
||
func set_var(variable_name): | ||
set(variable_name, not get(variable_name)) | ||
return get(variable_name) | ||
|
||
func hash_code(code): | ||
var ctx = HashingContext.new() | ||
ctx.start(HashingContext.HASH_MD5) | ||
ctx.update(code.to_utf8_buffer()) | ||
var res = ctx.finish() | ||
var encoded = res.hex_encode() | ||
return encoded | ||
|
||
func attempt_cheat(input): | ||
if input.is_empty(): | ||
return | ||
|
||
var split = input.split(":") | ||
var code = split[0].to_lower() | ||
var args = split[1].trim_prefix(" ").split(" ") if split.size() > 1 else [] | ||
var hash = hash_code(code) | ||
var valence: bool | ||
for cheat in CHEATS: | ||
if cheat.hash == hash: | ||
valence = cheat.callback.call(args) | ||
if valence: | ||
Client.display_message("Cheat Enabled") | ||
else: | ||
Client.display_message("Cheat Disabled") | ||
return |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
[gd_scene load_steps=2 format=2] | ||
[gd_scene load_steps=2 format=3 uid="uid://bdk4iculmnvrj"] | ||
|
||
[ext_resource path="res://Cheats.gd" type="Script" id=1] | ||
[ext_resource type="Script" path="res://Cheats.gd" id="1"] | ||
|
||
[node name="Node" type="Node"] | ||
script = ExtResource( 1 ) | ||
script = ExtResource("1") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
[b]Keybindings[/b] | ||
|
||
[b]W A D[/b] - thrust / turn | ||
[b]L Alt[/b] - brake | ||
[b]Space[/b] - Fire primary weapons | ||
[b]Left CTL[/b] - Fire secondary weapons | ||
[b]F[/b] - Toggle chain fire / syncro fire | ||
[b]Q[/b] - Target nearest hostile | ||
[b]E[/b] - Interact with target | ||
[b]O[/b] - Toggle Codex | ||
[b]Q[/b] - Target nearest hostile | ||
[b]J[/b] - Enter hyperspace (make sure to select an adjacent system first) | ||
[b]M[/b] - Toggle galaxy map | ||
[b]I[/b] - Toggle inventory & Crafting | ||
[b]P/Escape/capslock[/b] - Toggle Pause | ||
[b]Shift + Enter[/b] - Open cheat dialogue (it's a textbox so click into it) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
extends LineEdit | ||
|
||
func _on_text_submitted(new_text): | ||
text = "" | ||
hide() | ||
Client.typing = false | ||
Cheats.attempt_cheat(new_text) | ||
|
||
|
||
func _on_focus_entered(): | ||
Client.typing = true | ||
|
||
func _on_focus_exited(): | ||
Client.typing = false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
[gd_scene load_steps=2 format=3 uid="uid://bff3c2g6wfevf"] | ||
|
||
[ext_resource type="Script" path="res://ui/CheatInput.gd" id="1_vb7mo"] | ||
|
||
[node name="CheatInput" type="LineEdit"] | ||
anchors_preset = 15 | ||
anchor_right = 1.0 | ||
anchor_bottom = 1.0 | ||
offset_right = -858.0 | ||
offset_bottom = -617.0 | ||
grow_horizontal = 2 | ||
grow_vertical = 2 | ||
caret_blink = true | ||
caret_blink_interval = 0.5 | ||
script = ExtResource("1_vb7mo") | ||
|
||
[connection signal="focus_entered" from="." to="." method="_on_focus_entered"] | ||
[connection signal="focus_exited" from="." to="." method="_on_focus_exited"] | ||
[connection signal="text_submitted" from="." to="." method="_on_text_submitted"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters