Added speed hack for vesna

feature/languagetool-addon
Jonathan 5 months ago
parent d7ac1c6c22
commit 6aa7530502

@ -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,7 @@
[plugin]
name="BabushkaHelpers"
description=""
author="Cozy Raven"
version=""
script="babushkahelpers.gd"

@ -181,7 +181,7 @@ movie_writer/movie_file="/home/kaddi/Documents/Repos/Godot/Babushka/_clips/clip.
[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]

@ -1,4 +1,3 @@
using System.Threading.Tasks;
using Babushka.scripts.CSharp.Common.Inventory;
using Babushka.scripts.CSharp.Common.Services;
@ -8,58 +7,65 @@ namespace Babushka.scripts.CSharp.Common.CharacterControls;
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)
{
bool anyActionPressed = false;
Vector2 currentVelocity = Vector2.Zero;
public override void _Process(double delta)
{
bool anyActionPressed = false;
Vector2 currentVelocity = Vector2.Zero;
if (!InputService.Instance.InputEnabled)
return;
if (!InputService.Instance.InputEnabled)
return;
bool right = Input.IsActionPressed("move_right");
bool left = Input.IsActionPressed("move_left");
bool up = Input.IsActionPressed("move_up");
bool down = Input.IsActionPressed("move_down");
bool right = Input.IsActionPressed("move_right");
bool left = Input.IsActionPressed("move_left");
bool up = Input.IsActionPressed("move_up");
bool down = Input.IsActionPressed("move_down");
if (up)
{
currentVelocity += new Vector2(0, -_speed);
anyActionPressed = true;
}
if (up)
{
currentVelocity += new Vector2(0, -_speed);
anyActionPressed = true;
}
if (down)
{
currentVelocity += new Vector2(0, _speed);
anyActionPressed = true;
}
if (down)
{
currentVelocity += new Vector2(0, _speed);
anyActionPressed = true;
}
if (right)
{
currentVelocity += new Vector2(_speed, 0);
if (right)
{
currentVelocity += new Vector2(_speed, 0);
anyActionPressed = true;
}
anyActionPressed = true;
}
if (left)
{
currentVelocity += new Vector2(-_speed, 0);
if (left)
{
currentVelocity += new Vector2(-_speed, 0);
anyActionPressed = true;
}
anyActionPressed = true;
}
if (anyActionPressed)
{
if (currentVelocity.X != 0 && currentVelocity.Y != 0)
{
currentVelocity *= 0.7f;
}
if (anyActionPressed)
{
if (currentVelocity.X != 0 && currentVelocity.Y != 0)
{
currentVelocity *= 0.7f;
}
// speed hack
var setting = ProjectSettings.GetSetting("babushka/hacks/speed_hack",-1).AsSingle();
if (setting > 0)
{
currentVelocity *= setting;
}
Velocity = currentVelocity;
MoveAndSlide();
}
}
Velocity = currentVelocity;
MoveAndSlide();
}
}
}

Loading…
Cancel
Save