added renaming cheat
This commit is contained in:
@@ -46,6 +46,7 @@ public partial class console : CanvasLayer
|
|||||||
textblock.AddText("\n============ Help ============");
|
textblock.AddText("\n============ Help ============");
|
||||||
textblock.AddText("\n1. consoleclear - Clears the console");
|
textblock.AddText("\n1. consoleclear - Clears the console");
|
||||||
textblock.AddText("\n2. speed <value> - Multiplies the player speed by the given value");
|
textblock.AddText("\n2. speed <value> - Multiplies the player speed by the given value");
|
||||||
|
textblock.AddText("\n3. playername <new name> - Renames the player");
|
||||||
}
|
}
|
||||||
public void consoleclear() => textblock.Clear();
|
public void consoleclear() => textblock.Clear();
|
||||||
public void speed(float multiplier)
|
public void speed(float multiplier)
|
||||||
@@ -53,4 +54,14 @@ public partial class console : CanvasLayer
|
|||||||
if (GetParent().Name == "player") GetParent<player>().speedMultiplier = Mathf.Clamp(multiplier, 0.01f, 15f);
|
if (GetParent().Name == "player") GetParent<player>().speedMultiplier = Mathf.Clamp(multiplier, 0.01f, 15f);
|
||||||
textblock.AddText("\nSet speed to " + Mathf.Clamp(multiplier, 0.01f, 15f));
|
textblock.AddText("\nSet speed to " + Mathf.Clamp(multiplier, 0.01f, 15f));
|
||||||
}
|
}
|
||||||
|
public void playername(string name)
|
||||||
|
{
|
||||||
|
if (GetParent().Name == "player")
|
||||||
|
{
|
||||||
|
GetParent<player>().playerName = name;
|
||||||
|
GetParent<player>().ClearPlayerName();
|
||||||
|
textblock.AddText("\nYour new name is now: " + GetParent<player>().playerName);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@@ -15,15 +15,18 @@ public partial class player : CharacterBody2D
|
|||||||
public RayCast2D dialogRayCast;
|
public RayCast2D dialogRayCast;
|
||||||
|
|
||||||
public override void _Ready()
|
public override void _Ready()
|
||||||
|
{
|
||||||
|
ClearPlayerName();
|
||||||
|
animatedSprite = GetNode<AnimatedSprite2D>("animated_sprite_2d");
|
||||||
|
rotCenter = GetNode<Marker2D>("rotation_center");
|
||||||
|
dialogRayCast = GetNode<RayCast2D>("rotation_center/ray_cast_2d");
|
||||||
|
}
|
||||||
|
public void ClearPlayerName()
|
||||||
{
|
{
|
||||||
playerName = Regex.Replace(playerName, @"\[[^]]+\]", "");
|
playerName = Regex.Replace(playerName, @"\[[^]]+\]", "");
|
||||||
playerName = Regex.Replace(playerName, @"<[^>]*>", "");
|
playerName = Regex.Replace(playerName, @"<[^>]*>", "");
|
||||||
if (playerName.Length > 12)
|
if (playerName.Length > 12)
|
||||||
playerName = playerName.Substring(0, 12);
|
playerName = playerName.Substring(0, 12);
|
||||||
|
|
||||||
animatedSprite = GetNode<AnimatedSprite2D>("animated_sprite_2d");
|
|
||||||
rotCenter = GetNode<Marker2D>("rotation_center");
|
|
||||||
dialogRayCast = GetNode<RayCast2D>("rotation_center/ray_cast_2d");
|
|
||||||
}
|
}
|
||||||
public override void _PhysicsProcess(double delta)
|
public override void _PhysicsProcess(double delta)
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user