Add cheat menu
This commit is contained in:
parent
6ffd1dedbd
commit
e992772612
@ -122,6 +122,13 @@ common/drop_mouse_on_gui_input_disabled=true
|
||||
|
||||
[input]
|
||||
|
||||
ui_accept={
|
||||
"deadzone": 0.5,
|
||||
"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":16777221,"physical_scancode":0,"unicode":0,"echo":false,"script":null)
|
||||
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":16777222,"physical_scancode":0,"unicode":0,"echo":false,"script":null)
|
||||
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":0,"button_index":0,"pressure":0.0,"pressed":false,"script":null)
|
||||
]
|
||||
}
|
||||
up={
|
||||
"deadzone": 0.5,
|
||||
"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":0,"physical_scancode":87,"unicode":0,"echo":false,"script":null)
|
||||
@ -160,6 +167,11 @@ dialogic_default_action={
|
||||
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":0,"button_index":0,"pressure":0.0,"pressed":false,"script":null)
|
||||
]
|
||||
}
|
||||
open_debug={
|
||||
"deadzone": 0.5,
|
||||
"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":46,"physical_scancode":0,"unicode":0,"echo":false,"script":null)
|
||||
]
|
||||
}
|
||||
|
||||
[layer_names]
|
||||
|
||||
|
85
scenes/cheat_menu.tscn
Normal file
85
scenes/cheat_menu.tscn
Normal file
@ -0,0 +1,85 @@
|
||||
[gd_scene load_steps=2 format=2]
|
||||
|
||||
[ext_resource path="res://scripts/cheat_menu.gd" type="Script" id=1]
|
||||
|
||||
[node name="cheat_menu" type="WindowDialog"]
|
||||
margin_right = 429.0
|
||||
margin_bottom = 336.0
|
||||
script = ExtResource( 1 )
|
||||
|
||||
[node name="TabContainer" type="TabContainer" parent="."]
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
tab_align = 0
|
||||
|
||||
[node name="Player" type="VBoxContainer" parent="TabContainer"]
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
margin_left = 4.0
|
||||
margin_top = 32.0
|
||||
margin_right = -4.0
|
||||
margin_bottom = -4.0
|
||||
|
||||
[node name="charge" type="Button" parent="TabContainer/Player"]
|
||||
margin_right = 421.0
|
||||
margin_bottom = 20.0
|
||||
text = "+1 Charge"
|
||||
|
||||
[node name="charge_5" type="Button" parent="TabContainer/Player"]
|
||||
margin_top = 24.0
|
||||
margin_right = 421.0
|
||||
margin_bottom = 44.0
|
||||
text = "+5 Charge"
|
||||
|
||||
[node name="raw_yam" type="Button" parent="TabContainer/Player"]
|
||||
margin_top = 48.0
|
||||
margin_right = 421.0
|
||||
margin_bottom = 68.0
|
||||
text = "Raw Yam"
|
||||
|
||||
[node name="cooked_yam" type="Button" parent="TabContainer/Player"]
|
||||
margin_top = 72.0
|
||||
margin_right = 421.0
|
||||
margin_bottom = 92.0
|
||||
text = "Cooked Yam"
|
||||
|
||||
[node name="ore" type="Button" parent="TabContainer/Player"]
|
||||
margin_top = 96.0
|
||||
margin_right = 421.0
|
||||
margin_bottom = 116.0
|
||||
text = "Ore"
|
||||
|
||||
[node name="repair_kit" type="Button" parent="TabContainer/Player"]
|
||||
margin_top = 120.0
|
||||
margin_right = 421.0
|
||||
margin_bottom = 140.0
|
||||
text = "Repair Kit"
|
||||
|
||||
[node name="clear" type="Button" parent="TabContainer/Player"]
|
||||
margin_top = 120.0
|
||||
margin_right = 421.0
|
||||
margin_bottom = 140.0
|
||||
text = "Clear Held Item"
|
||||
|
||||
[node name="Events" type="VBoxContainer" parent="TabContainer"]
|
||||
visible = false
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
margin_left = 4.0
|
||||
margin_top = 32.0
|
||||
margin_right = -4.0
|
||||
margin_bottom = -4.0
|
||||
|
||||
[node name="random_damage" type="Button" parent="TabContainer/Events"]
|
||||
margin_right = 12.0
|
||||
margin_bottom = 20.0
|
||||
text = "Damage Random Object"
|
||||
|
||||
[connection signal="pressed" from="TabContainer/Player/charge" to="." method="_on_charge_pressed"]
|
||||
[connection signal="pressed" from="TabContainer/Player/charge_5" to="." method="_on_charge_5_pressed"]
|
||||
[connection signal="pressed" from="TabContainer/Player/raw_yam" to="." method="_on_raw_yam_pressed"]
|
||||
[connection signal="pressed" from="TabContainer/Player/cooked_yam" to="." method="_on_cooked_yam_pressed"]
|
||||
[connection signal="pressed" from="TabContainer/Player/ore" to="." method="_on_ore_pressed"]
|
||||
[connection signal="pressed" from="TabContainer/Player/repair_kit" to="." method="_on_repair_kit_pressed"]
|
||||
[connection signal="pressed" from="TabContainer/Player/clear" to="." method="_on_clear_pressed"]
|
||||
[connection signal="pressed" from="TabContainer/Events/random_damage" to="." method="_on_random_damage_pressed"]
|
39
scripts/cheat_menu.gd
Normal file
39
scripts/cheat_menu.gd
Normal file
@ -0,0 +1,39 @@
|
||||
extends WindowDialog
|
||||
|
||||
onready var player = get_tree().get_nodes_in_group("player")[0]
|
||||
|
||||
func _unhandled_key_input(event):
|
||||
if event.is_action_pressed("open_debug"):
|
||||
if visible:
|
||||
hide()
|
||||
else:
|
||||
popup()
|
||||
|
||||
func _on_charge_pressed():
|
||||
player.modify_inventory("coins", 1)
|
||||
|
||||
func _on_charge_5_pressed():
|
||||
player.modify_inventory("coins", 5)
|
||||
|
||||
func _on_raw_yam_pressed():
|
||||
player.pick_up_item(preload("res://item_types/raw_yam.tres").spawn_node())
|
||||
|
||||
func _on_cooked_yam_pressed():
|
||||
player.pick_up_item(preload("res://item_types/cooked_yam.tres").spawn_node())
|
||||
|
||||
func _on_ore_pressed():
|
||||
player.pick_up_item(preload("res://item_types/ore.tres").spawn_node())
|
||||
|
||||
func _on_repair_kit_pressed():
|
||||
player.pick_up_item(preload("res://item_types/repair_kit.tres").spawn_node())
|
||||
|
||||
func _on_clear_pressed():
|
||||
if player.has_item():
|
||||
player.drop_item_in_hand()
|
||||
|
||||
|
||||
func _on_random_damage_pressed():
|
||||
var damageable = get_tree().get_nodes_in_group("damageable")
|
||||
if damageable.empty():
|
||||
return
|
||||
damageable[randi() % damageable.size()].take_damage()
|
Loading…
x
Reference in New Issue
Block a user