Skip to content

Commit

Permalink
add fov stuff and sona into game
Browse files Browse the repository at this point in the history
  • Loading branch information
neomoth committed Nov 6, 2024
1 parent 81459d9 commit 621164e
Show file tree
Hide file tree
Showing 53 changed files with 3,401 additions and 392 deletions.
3 changes: 2 additions & 1 deletion NeoQOLPack/Mod.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,11 @@ public Mod(IModInterface modInterface) {
modInterface.RegisterScriptMod(new PlayerHudPatcher(this));
modInterface.RegisterScriptMod(new ShopButtonPatcher(this));
modInterface.RegisterScriptMod(new MenuPatcher(this, versionTag));
modInterface.RegisterScriptMod(new OptionsMenuPatcher());
modInterface.RegisterScriptMod(new OptionsMenuPatcher(this));
modInterface.RegisterScriptMod(new EscMenuPatcher());
modInterface.RegisterScriptMod(new ButtonSellPatcher());
modInterface.RegisterScriptMod(new ShopCategoryPatcher());
modInterface.RegisterScriptMod(new CosmeticMenuPatcher());
if (injectUpdateNotice) ;
}

Expand Down
38 changes: 38 additions & 0 deletions NeoQOLPack/Mods/CosmeticMenuPatcher.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
using GDWeave.Godot;
using GDWeave.Modding;

namespace NeoQOLPack.Mods;

public class CosmeticMenuPatcher : IScriptMod
{
public bool ShouldRun(string path) => path == "res://Scenes/HUD/CosmeticMenu/cosmetic_menu.gdc";

public IEnumerable<Token> Modify(string path, IEnumerable<Token> tokens)
{
MultiTokenWaiter readyWaiter = new MultiTokenWaiter([
t=>t is IdentifierToken {Name: "_ready"},
t=>t is IdentifierToken {Name: "add_child"},
t=>t.Type is TokenType.Newline
], allowPartialMatch: true);

foreach (Token token in tokens)
{
if (readyWaiter.Check(token))
{
yield return token;

yield return new Token(TokenType.Newline, 1);
yield return new IdentifierToken("model");
yield return new Token(TokenType.Period);
yield return new IdentifierToken("owner_id");
yield return new Token(TokenType.OpAssign);
yield return new IdentifierToken("Network");
yield return new Token(TokenType.Period);
yield return new IdentifierToken("STEAM_ID");

yield return new Token(TokenType.Newline, 1);
}
else yield return token;
}
}
}
264 changes: 263 additions & 1 deletion NeoQOLPack/Mods/OptionsMenuPatcher.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

namespace NeoQOLPack.Mods;

public class OptionsMenuPatcher : IScriptMod
public class OptionsMenuPatcher(Mod mod) : IScriptMod
{
public bool ShouldRun(string path) => path == "res://Scenes/Singletons/OptionsMenu/options_menu.gdc";

Expand Down Expand Up @@ -45,6 +45,43 @@ public IEnumerable<Token> Modify(string path, IEnumerable<Token> tokens)
yield return new IdentifierToken("lock_mouse_node");

yield return new Token(TokenType.Newline);

// yield return new Token(TokenType.PrVar);
// yield return new IdentifierToken("fov_slider");
//
// yield return new Token(TokenType.Newline);
//
// yield return new Token(TokenType.PrFunction);
// yield return new IdentifierToken("_on_fov_value_changed");
// yield return new Token(TokenType.ParenthesisOpen);
// yield return new IdentifierToken("value");
// yield return new Token(TokenType.ParenthesisClose);
// yield return new Token(TokenType.Colon);
// yield return new Token(TokenType.Newline, 1);
//
// yield return new IdentifierToken("fov_slider");
// yield return new Token(TokenType.Period);
// yield return new IdentifierToken("get_parent");
// yield return new Token(TokenType.ParenthesisOpen);
// yield return new Token(TokenType.ParenthesisClose);
// yield return new Token(TokenType.Period);
// yield return new IdentifierToken("get_child");
// yield return new Token(TokenType.ParenthesisOpen);
// yield return new ConstantToken(new IntVariant(0));
// yield return new Token(TokenType.ParenthesisClose);
// yield return new Token(TokenType.Period);
// yield return new IdentifierToken("text");
// yield return new Token(TokenType.OpAssign);
// yield return new Token(TokenType.BuiltInFunc, (uint?)BuiltinFunction.TextStr);
// yield return new Token(TokenType.ParenthesisOpen);
// yield return new IdentifierToken("value");
// yield return new Token(TokenType.OpMul);
// yield return new ConstantToken(new RealVariant(100.0));
// yield return new Token(TokenType.ParenthesisClose);
// yield return new Token(TokenType.OpAdd);
// yield return new ConstantToken(new StringVariant("%"));

yield return new Token(TokenType.Newline);
}
else if (readyWaiter.Check(token))
{
Expand Down Expand Up @@ -171,7 +208,200 @@ public IEnumerable<Token> Modify(string path, IEnumerable<Token> tokens)
yield return new ConstantToken(new StringVariant("When set to Locked, the mouse will be locked within the game window unless the game is paused."));
yield return new Token(TokenType.Newline, 1);

// yield return new Token(TokenType.PrVar);
// yield return new IdentifierToken("fov_option_node");
// yield return new Token(TokenType.OpAssign);
// yield return new IdentifierToken("get_node");
// yield return new Token(TokenType.ParenthesisOpen);
// yield return new ConstantToken(new StringVariant("Control/Panel/tabs_main/main/ScrollContainer/HBoxContainer/VBoxContainer/main_vol"));
// yield return new Token(TokenType.ParenthesisClose);
// yield return new Token(TokenType.Period);
// yield return new IdentifierToken("duplicate");
// yield return new Token(TokenType.ParenthesisOpen);
// yield return new Token(TokenType.ParenthesisClose);
//
// yield return new Token(TokenType.Newline, 1);
//
// yield return new Token(TokenType.PrVar);
// yield return new IdentifierToken("label");
// yield return new Token(TokenType.OpAssign);
// yield return new IdentifierToken("fov_option_node");
// yield return new Token(TokenType.Period);
// yield return new IdentifierToken("get_child");
// yield return new Token(TokenType.ParenthesisOpen);
// yield return new ConstantToken(new IntVariant(0));
// yield return new Token(TokenType.ParenthesisClose);
//
// yield return new Token(TokenType.Newline, 1);
//
// yield return new Token(TokenType.PrVar);
// yield return new IdentifierToken("label2");
// yield return new Token(TokenType.OpAssign);
// yield return new IdentifierToken("fov_option_node");
// yield return new Token(TokenType.Period);
// yield return new IdentifierToken("get_child");
// yield return new Token(TokenType.ParenthesisOpen);
// yield return new ConstantToken(new IntVariant(1));
// yield return new Token(TokenType.ParenthesisClose);
// yield return new Token(TokenType.Period);
// yield return new IdentifierToken("get_child");
// yield return new Token(TokenType.ParenthesisOpen);
// yield return new ConstantToken(new IntVariant(0));
// yield return new Token(TokenType.ParenthesisClose);
//
// yield return new Token(TokenType.Newline, 1);
//
// yield return new IdentifierToken("fov_slider");
// yield return new Token(TokenType.OpAssign);
// yield return new IdentifierToken("fov_option_node");
// yield return new Token(TokenType.Period);
// yield return new IdentifierToken("get_child");
// yield return new Token(TokenType.ParenthesisOpen);
// yield return new ConstantToken(new IntVariant(1));
// yield return new Token(TokenType.ParenthesisClose);
// yield return new Token(TokenType.Period);
// yield return new IdentifierToken("get_child");
// yield return new Token(TokenType.ParenthesisOpen);
// yield return new ConstantToken(new IntVariant(1));
// yield return new Token(TokenType.ParenthesisClose);
//
// yield return new Token(TokenType.Newline, 1);
//
// mod.Logger.Information("MADE IT HERE");
//
// yield return new IdentifierToken("fov_option_node");
// yield return new Token(TokenType.Period);
// yield return new IdentifierToken("name");
// yield return new Token(TokenType.OpAssign);
// yield return new ConstantToken(new StringVariant("fov"));
// yield return new Token(TokenType.Newline, 1);
//
// yield return new IdentifierToken("label");
// yield return new Token(TokenType.Period);
// yield return new IdentifierToken("text");
// yield return new Token(TokenType.OpAssign);
// yield return new ConstantToken(new StringVariant("Field of View"));
// yield return new Token(TokenType.Newline, 1);
//
// yield return new IdentifierToken("label2");
// yield return new Token(TokenType.Period);
// yield return new IdentifierToken("name");
// yield return new Token(TokenType.OpAssign);
// yield return new ConstantToken(new StringVariant("fov_scale"));
// yield return new Token(TokenType.Newline, 1);
//
// yield return new IdentifierToken("get_node");
// yield return new Token(TokenType.ParenthesisOpen);
// yield return new ConstantToken(new StringVariant("Control/Panel/tabs_main/main/ScrollContainer/HBoxContainer/VBoxContainer"));
// yield return new Token(TokenType.ParenthesisClose);
// yield return new Token(TokenType.Period);
// yield return new IdentifierToken("add_child");
// yield return new Token(TokenType.ParenthesisOpen);
// yield return new IdentifierToken("fov_option_node");
// yield return new Token(TokenType.ParenthesisClose);
// yield return new Token(TokenType.Newline, 1);
//
// yield return new Token(TokenType.PrVar);
// yield return new IdentifierToken("separator");
// yield return new Token(TokenType.OpAssign);
// yield return new IdentifierToken("get_node");
// yield return new Token(TokenType.ParenthesisOpen);
// yield return new ConstantToken(new StringVariant("Control/Panel/tabs_main/main/ScrollContainer/HBoxContainer/VBoxContainer"));
// yield return new Token(TokenType.ParenthesisClose);
// yield return new Token(TokenType.Period);
// yield return new IdentifierToken("add_child");
// yield return new Token(TokenType.ParenthesisOpen);
// yield return new IdentifierToken("HSeparator");
// yield return new Token(TokenType.Period);
// yield return new IdentifierToken("new");
// yield return new Token(TokenType.ParenthesisOpen);
// yield return new Token(TokenType.ParenthesisClose);
// yield return new Token(TokenType.ParenthesisClose);
//
// yield return new Token(TokenType.Newline, 1);
//
// yield return new IdentifierToken("separator");
// yield return new Token(TokenType.Period);
// yield return new IdentifierToken("self_modulate");
// yield return new Token(TokenType.OpAssign);
// yield return new IdentifierToken("Color");
// yield return new Token(TokenType.ParenthesisOpen);
// yield return new ConstantToken(new RealVariant(0));
// yield return new Token(TokenType.Comma);
// yield return new ConstantToken(new RealVariant(0));
// yield return new Token(TokenType.Comma);
// yield return new ConstantToken(new RealVariant(0));
// yield return new Token(TokenType.Comma);
// yield return new ConstantToken(new RealVariant(0));
// yield return new Token(TokenType.ParenthesisClose);
//
// yield return new Token(TokenType.Newline, 1);
//
// yield return new IdentifierToken("separator");
// yield return new Token(TokenType.Period);
// yield return new IdentifierToken("rect_min_size");
// yield return new Token(TokenType.OpAssign);
// yield return new IdentifierToken("Vector2");
// yield return new Token(TokenType.ParenthesisOpen);
// yield return new ConstantToken(new RealVariant(0));
// yield return new Token(TokenType.Comma);
// yield return new ConstantToken(new RealVariant(80));
// yield return new Token(TokenType.ParenthesisClose);
//
// yield return new Token(TokenType.Newline, 1);
//
// yield return new IdentifierToken("fov_slider");
// yield return new Token(TokenType.Period);
// yield return new IdentifierToken("disconnect");
// yield return new Token(TokenType.ParenthesisOpen);
// yield return new ConstantToken(new StringVariant("value_changed"));
// yield return new Token(TokenType.Comma);
// yield return new Token(TokenType.Self);
// yield return new Token(TokenType.Comma);
// yield return new ConstantToken(new StringVariant("_on_main_vol_value_changed"));
// yield return new Token(TokenType.ParenthesisClose);
//
// yield return new Token(TokenType.Newline, 1);
//
// yield return new IdentifierToken("fov_slider");
// yield return new Token(TokenType.Period);
// yield return new IdentifierToken("connect");
// yield return new Token(TokenType.ParenthesisOpen);
// yield return new ConstantToken(new StringVariant("value_changed"));
// yield return new Token(TokenType.Comma);
// yield return new Token(TokenType.Self);
// yield return new Token(TokenType.Comma);
// yield return new ConstantToken(new StringVariant("_on_fov_value_changed"));
// yield return new Token(TokenType.ParenthesisClose);
//
// yield return new Token(TokenType.Newline, 1);
//
// yield return new IdentifierToken("fov_slider");
// yield return new Token(TokenType.Period);
// yield return new IdentifierToken("connect");
// yield return new Token(TokenType.OpAssign);
// yield return new ConstantToken(new IntVariant(50));

yield return new Token(TokenType.Newline, 1);

//func _append_fov_slider(parent):
// var target = parent.get_node("Control/Panel/tabs_main/main/ScrollContainer/HBoxContainer/VBoxContainer/main_vol")
// var fov_node = target.duplicate()
// var label = fov_node.get_child(0)
// var label2 = fov_node.get_child(1).get_child(0)
// var slider = fov_node.get_child(1).get_child(1)
// fov_node.name = "fov"
// label.text = "Field of View"
// label2.name = "fov_scale"
// (target as Node).get_parent().add_child(fov_node)
// var separator = target.get_parent().add_child(HSeparator.new())
// separator.self_modulate = Color(1,1,1,0)
// separator.rect_min_size = Vector2(0,50)
//
// slider.disconnect("value_changed", parent, "_on_main_vol_value_changed")
// slider.connect("value_changed", self, "_on_fov_slider_changed")
// fov_slider = fov_node
// return slider
}
else if (setSelectionWaiter.Check(token))
{
Expand All @@ -188,6 +418,18 @@ public IEnumerable<Token> Modify(string path, IEnumerable<Token> tokens)
yield return new IdentifierToken("lockmouse");

yield return new Token(TokenType.Newline, 1);

// yield return new IdentifierToken("fov_slider");
// yield return new Token(TokenType.Period);
// yield return new IdentifierToken("value");
// yield return new Token(TokenType.OpAssign);
// yield return new IdentifierToken("PlayerData");
// yield return new Token(TokenType.Period);
// yield return new IdentifierToken("player_options");
// yield return new Token(TokenType.Period);
// yield return new IdentifierToken("fovscale");
//
// yield return new Token(TokenType.Newline, 1);
}
else if (resetWaiter.Check(token))
{
Expand All @@ -200,6 +442,14 @@ public IEnumerable<Token> Modify(string path, IEnumerable<Token> tokens)
yield return new ConstantToken(new IntVariant(0));

yield return new Token(TokenType.Newline, 1);

// yield return new IdentifierToken("fov_slider");
// yield return new Token(TokenType.Period);
// yield return new IdentifierToken("value");
// yield return new Token(TokenType.OpAssign);
// yield return new ConstantToken(new IntVariant(50));
//
// yield return new Token(TokenType.Newline, 1);
}
else if (applySelectionsWaiter.Check(token))
{
Expand All @@ -216,6 +466,18 @@ public IEnumerable<Token> Modify(string path, IEnumerable<Token> tokens)
yield return new IdentifierToken("selected");

yield return new Token(TokenType.Newline, 1);

// yield return new IdentifierToken("PlayerData");
// yield return new Token(TokenType.Period);
// yield return new IdentifierToken("player_options");
// yield return new Token(TokenType.Period);
// yield return new IdentifierToken("fovscale");
// yield return new Token(TokenType.OpAssign);
// yield return new IdentifierToken("fov_slider");
// yield return new Token(TokenType.Period);
// yield return new IdentifierToken("value");
//
// yield return new Token(TokenType.Newline, 1);
}
else yield return token;
}
Expand Down
35 changes: 35 additions & 0 deletions NeoQOLPack/Mods/PlayerCameraPatcher.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
using GDWeave.Godot;
using GDWeave.Godot.Variants;
using GDWeave.Modding;

namespace NeoQOLPack.Mods;

public class PlayerCameraPatcher : IScriptMod
{
public bool ShouldRun(string path) => path == "";

public IEnumerable<Token> Modify(string path, IEnumerable<Token> tokens)
{
MultiTokenWaiter extendsWaiter = new MultiTokenWaiter([
t=>t.Type is TokenType.PrExtends,
t=>t.Type is TokenType.Newline
], allowPartialMatch: true);

foreach (Token token in tokens)
{
yield return token;

yield return new Token(TokenType.PrFunction);
yield return new IdentifierToken("_process");
yield return new Token(TokenType.ParenthesisOpen);
yield return new IdentifierToken("delta");
yield return new Token(TokenType.ParenthesisClose);
yield return new Token(TokenType.Colon);
yield return new Token(TokenType.Newline, 1);

yield return new IdentifierToken("fov");
yield return new Token(TokenType.OpAssign);

}
}
}
Loading

0 comments on commit 621164e

Please sign in to comment.