Added speed hack for vesna

This commit is contained in:
Jonathan
2025-08-06 21:25:28 +02:00
parent d7ac1c6c22
commit 6aa7530502
5 changed files with 84 additions and 48 deletions
+22
View File
@@ -0,0 +1,22 @@
@tool
extends EditorPlugin
func _enter_tree() -> void:
if !ProjectSettings.has_setting("babushka/hacks/speed_hack"):
ProjectSettings.set_setting("babushka/hacks/speed_hack",-1)
var property_info = {
"name": "babushka/hacks/speed_hack",
"type": TYPE_FLOAT,
"hint": PROPERTY_HINT_RANGE,
"hint_string": "-1,20,0.5"
}
ProjectSettings.add_property_info(property_info)
ProjectSettings.set_initial_value("babushka/hacks/speed_hack",-1)
func _exit_tree() -> void:
# Clean-up of the plugin goes here.
pass
@@ -0,0 +1 @@
uid://buwfplh0xji8q
+7
View File
@@ -0,0 +1,7 @@
[plugin]
name="BabushkaHelpers"
description=""
author="Cozy Raven"
version=""
script="babushkahelpers.gd"
+1 -1
View File
@@ -181,7 +181,7 @@ movie_writer/movie_file="/home/kaddi/Documents/Repos/Godot/Babushka/_clips/clip.
[editor_plugins] [editor_plugins]
enabled=PackedStringArray("res://addons/SignalVisualizer/plugin.cfg", "res://addons/anthonyec.camera_preview/plugin.cfg", "res://addons/dialogic/plugin.cfg") enabled=PackedStringArray("res://addons/SignalVisualizer/plugin.cfg", "res://addons/anthonyec.camera_preview/plugin.cfg", "res://addons/babushkahelpers/plugin.cfg", "res://addons/dialogic/plugin.cfg")
[file_customization] [file_customization]
@@ -1,4 +1,3 @@
using System.Threading.Tasks; using System.Threading.Tasks;
using Babushka.scripts.CSharp.Common.Inventory; using Babushka.scripts.CSharp.Common.Inventory;
using Babushka.scripts.CSharp.Common.Services; using Babushka.scripts.CSharp.Common.Services;
@@ -8,58 +7,65 @@ namespace Babushka.scripts.CSharp.Common.CharacterControls;
public partial class PlayerMovement : CharacterBody2D public partial class PlayerMovement : CharacterBody2D
{ {
[Export] private float _speed = 1000f; [Export] private float _speed = 1000f;
private InventoryManager _inventoryManager; private InventoryManager _inventoryManager;
public override void _Process(double delta) public override void _Process(double delta)
{ {
bool anyActionPressed = false; bool anyActionPressed = false;
Vector2 currentVelocity = Vector2.Zero; Vector2 currentVelocity = Vector2.Zero;
if (!InputService.Instance.InputEnabled) if (!InputService.Instance.InputEnabled)
return; return;
bool right = Input.IsActionPressed("move_right"); bool right = Input.IsActionPressed("move_right");
bool left = Input.IsActionPressed("move_left"); bool left = Input.IsActionPressed("move_left");
bool up = Input.IsActionPressed("move_up"); bool up = Input.IsActionPressed("move_up");
bool down = Input.IsActionPressed("move_down"); bool down = Input.IsActionPressed("move_down");
if (up) if (up)
{ {
currentVelocity += new Vector2(0, -_speed); currentVelocity += new Vector2(0, -_speed);
anyActionPressed = true; anyActionPressed = true;
} }
if (down) if (down)
{ {
currentVelocity += new Vector2(0, _speed); currentVelocity += new Vector2(0, _speed);
anyActionPressed = true; anyActionPressed = true;
} }
if (right) if (right)
{ {
currentVelocity += new Vector2(_speed, 0); currentVelocity += new Vector2(_speed, 0);
anyActionPressed = true; anyActionPressed = true;
} }
if (left) if (left)
{ {
currentVelocity += new Vector2(-_speed, 0); currentVelocity += new Vector2(-_speed, 0);
anyActionPressed = true; anyActionPressed = true;
} }
if (anyActionPressed) if (anyActionPressed)
{ {
if (currentVelocity.X != 0 && currentVelocity.Y != 0) if (currentVelocity.X != 0 && currentVelocity.Y != 0)
{ {
currentVelocity *= 0.7f; currentVelocity *= 0.7f;
} }
Velocity = currentVelocity; // speed hack
MoveAndSlide(); var setting = ProjectSettings.GetSetting("babushka/hacks/speed_hack",-1).AsSingle();
} if (setting > 0)
} {
currentVelocity *= setting;
}
Velocity = currentVelocity;
MoveAndSlide();
}
}
} }