Skip to content

Commit

Permalink
reimplement debug menu
Browse files Browse the repository at this point in the history
  • Loading branch information
Lamby777 committed Aug 18, 2024
1 parent 08d8e05 commit 48f98eb
Show file tree
Hide file tree
Showing 11 changed files with 82 additions and 95 deletions.
58 changes: 58 additions & 0 deletions pets-gd/dialogue/debug.gd
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
extends DialogueScript

func _start() -> void:
print("Opening debug menu!")

var choice
choice = await dbox().say_as_with_choices(
"[CASCADE]", [
"Hey...?",
], [
"Battle",
"Item",
"Page 2",
"Nah",
]
)

match choice:
0:
World.singleton().start_battle("A_NONNY_MOUSE")
1:
choice = await dbox().say_as_with_choices(
"[CASCADE]", [
"What do you need?",
], [
"Rusty x1",
"Rusty x5",
]
)

match choice:
0:
DialogueScriptBase.debug_item("trusty_rusty_pistol", 1)
1:
DialogueScriptBase.debug_item("trusty_rusty_pistol", 5)

await dbox().say_as("[CASCADE]", [
"Here you go!"
])
2:
choice = await dbox().say_as_with_choices(
"[CASCADE]", [
"Okay, how about these?",
], [
"Pauses",
"Nah",
])

match choice:
0:
await dbox().say_as("Isaac", [
"""Flint...​​​​​​​​​​
Where did you last see Hinawa?"""
])
await dbox().say_as("[CASCADE]", [
"""This next part will print v​e​r​r​r​r​r​y
s​​​l​​​o​​​o​​​o​​​o​​​o​​​w​​​l​​​y."""
])
1 change: 1 addition & 0 deletions pets-gd/i18n/translations.csv
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@ SKILL_SHIELD_COMBINE_PARTS,{part1} {hits_str}
,
DG_SPK_UNKNOWN,???
DG_SPK_RODRICK,"Rodrick Sign Co."
DG_SPK_CASCADE,Agent Cascade
DG_SPK_MOM,Mom
DG_SPK_DAD,Dad
DG_SPK_JUNIPER,Juniper
Expand Down
1 change: 0 additions & 1 deletion pets-gd/quests/intro1.gd
Original file line number Diff line number Diff line change
Expand Up @@ -68,4 +68,3 @@ func on_outdoors_tp(target):
await dbox().say_as("[CLAY]", [ "DG_INTRO1_MR_T" ]);
await dbox().say_as("[MR_TULIVAE]", [ "DG_INTRO1_HITHERE" ]);
await dbox().say_as("[NARRATOR]", [ "DG_INTRO1_HE_SEEMS_NICE" ]);

2 changes: 1 addition & 1 deletion pets-gd/scenes/rooms/cv-outdoors.tscn
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ position = Vector2(0, 8)
scale = Vector2(1.02, 0.5)

[node name="LYEMBO" parent="." index="10" instance=ExtResource("13_2on2m")]
position = Vector2(-128, -320)
position = Vector2(-264, -536)

[node name="InteractionZone" parent="LYEMBO" index="4" instance=ExtResource("4_vwc65")]
interaction_script = ExtResource("15_ndq3e")
Expand Down
4 changes: 3 additions & 1 deletion pets-gd/scenes/world.tscn
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[gd_scene load_steps=17 format=3 uid="uid://p2uymvf88jt7"]
[gd_scene load_steps=18 format=3 uid="uid://p2uymvf88jt7"]

[ext_resource type="PackedScene" uid="uid://kgl5788x405y" path="res://scenes/battle.tscn" id="1_37bcu"]
[ext_resource type="PackedScene" uid="uid://c8hhg8v5ls70u" path="res://scenes/world_menu.tscn" id="2_6orff"]
Expand All @@ -9,6 +9,7 @@
[ext_resource type="Shader" path="res://themes/encounter.gdshader" id="3_a3d4r"]
[ext_resource type="PackedScene" uid="uid://clpj4pxq1ulin" path="res://scenes/inventory.tscn" id="3_jwkdy"]
[ext_resource type="Script" path="res://scenes/BattleIntroRect.gd" id="4_jple0"]
[ext_resource type="Script" path="res://dialogue/debug.gd" id="10_egidj"]
[ext_resource type="PackedScene" uid="uid://c7x12nyqelw1f" path="res://scenes/rooms/cv-outdoors.tscn" id="10_kug7e"]
[ext_resource type="Script" path="res://quests/intro1.gd" id="13_w40m0"]

Expand Down Expand Up @@ -134,6 +135,7 @@ visible = false
[node name="DialogBox" parent="UILayer" instance=ExtResource("2_lgtmm")]

[node name="WorldMenu" parent="UILayer" instance=ExtResource("2_6orff")]
debug_menu_script = ExtResource("10_egidj")

[node name="BeaconFade" type="ColorRect" parent="UILayer"]
unique_name_in_owner = true
Expand Down
2 changes: 0 additions & 2 deletions pets-lib/dg/.gitignore

This file was deleted.

81 changes: 0 additions & 81 deletions pets-lib/dg/src/debug-menu.dg

This file was deleted.

1 change: 1 addition & 0 deletions pets-lib/src/dialogue/dbox/placeholders.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ const PLACEHOLDERS: &[(&'static str, fn() -> String)] = &[
("[NARRATOR]", || "".to_owned()),
("[???]", || "DG_SPK_UNKNOWN".to_owned()),
// character names
("[CASCADE]", || "DG_SPK_CASCADE".to_owned()),
("[RODRICK]", || "DG_SPK_RODRICK".to_owned()),
("[ETHAN]", || pchar_display_name(&PChar::ETHAN)),
("[LYEMBO]", || pchar_display_name(&PChar::LYEMBO)),
Expand Down
5 changes: 0 additions & 5 deletions pets-lib/src/functions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,6 @@ impl DialogueScriptBase {
bed.callv("set_texture".into(), varray![texture]);
}

#[func]
fn debug_battle() {
World::start_battle(&EnemyID::A_NONNY_MOUSE);
}

#[func]
fn debug_item(item_id: String, quantity: u32) {
Inventory::get().borrow_mut().give_item(item_id, quantity);
Expand Down
18 changes: 15 additions & 3 deletions pets-lib/src/world/menu.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,12 @@
//!
use godot::classes::{
AnimationPlayer, Control, IPanel, InputEvent, Panel, RichTextLabel,
AnimationPlayer, Control, GDScript, IPanel, InputEvent, Panel,
RichTextLabel,
};
use godot::prelude::*;

use crate::functions::DialogueScriptBase;
use crate::prelude::*;

use super::inv_node::InventoryNode;
Expand All @@ -20,6 +22,9 @@ pub struct WorldMenu {

#[init(node = "Choices/ChoiceAgent")]
choices: OnReady<Gd<ChoiceAgent>>,

#[export]
debug_menu_script: Option<Gd<GDScript>>,
}

#[godot_api]
Expand Down Expand Up @@ -83,8 +88,15 @@ impl WorldMenu {
match choice.get_name().to_string().as_str() {
"Inventory" => self.open_inventory(),
"DebugQuit" => godot_tree().quit(),
// "DebugMenu" => start_ix("Debug Menu"),
"DebugMenu" => todo!("agent cascade's debug menu"),
"DebugMenu" => {
DialogueScriptBase::new(
self.debug_menu_script
.as_ref()
.expect("no debug script exported")
.clone(),
)
.call("_start".into(), &[]);
}

_ => unreachable!(),
}
Expand Down
4 changes: 3 additions & 1 deletion pets-lib/src/world/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@ use crate::consts::battle::*;
use crate::prelude::*;

use enemy_node::WalkingEnemy;
use godot::classes::{AnimationPlayer, AudioServer, AudioStream, CanvasLayer};
use godot::classes::{
AnimationPlayer, AudioServer, AudioStream, CanvasLayer, GDScript,
};
use godot::global::randf_range;
use godot::prelude::*;

Expand Down

0 comments on commit 48f98eb

Please sign in to comment.