refactor file scoped namespace

pull/3/head
John Montagu, the 4th Earl of Sandvich 2023-06-03 18:21:46 -07:00
parent 96fd6f5c26
commit 706354e813
Signed by: sandvich
GPG Key ID: 9A39BE37E602B22D
48 changed files with 2118 additions and 2166 deletions

View File

@ -1,11 +1,10 @@
using Godot; using Godot;
using SupaLidlGame.Utils; using SupaLidlGame.Utils;
namespace SupaLidlGame.BoundingBoxes namespace SupaLidlGame.BoundingBoxes;
{
public abstract partial class BoundingBox : Area2D, IFaction public abstract partial class BoundingBox : Area2D, IFaction
{ {
[Export] [Export]
public ushort Faction { get; set; } public ushort Faction { get; set; }
} }
}

View File

@ -2,8 +2,8 @@ using Godot;
using System; using System;
using SupaLidlGame.Characters; using SupaLidlGame.Characters;
namespace SupaLidlGame.BoundingBoxes namespace SupaLidlGame.BoundingBoxes;
{
public partial class ConnectorBox : Area2D public partial class ConnectorBox : Area2D
{ {
[Signal] [Signal]
@ -69,4 +69,3 @@ namespace SupaLidlGame.BoundingBoxes
base._Process(delta); base._Process(delta);
} }
} }
}

View File

@ -3,8 +3,8 @@ using Godot;
using SupaLidlGame.Characters; using SupaLidlGame.Characters;
using SupaLidlGame.Items; using SupaLidlGame.Items;
namespace SupaLidlGame.BoundingBoxes namespace SupaLidlGame.BoundingBoxes;
{
public partial class Hitbox : BoundingBox public partial class Hitbox : BoundingBox
{ {
private HashSet<BoundingBox> _ignoreList = new HashSet<BoundingBox>(); private HashSet<BoundingBox> _ignoreList = new HashSet<BoundingBox>();
@ -102,4 +102,3 @@ namespace SupaLidlGame.BoundingBoxes
get => _ignoreList; get => _ignoreList;
} }
} }
}

View File

@ -2,8 +2,8 @@ using Godot;
using SupaLidlGame.Characters; using SupaLidlGame.Characters;
using SupaLidlGame.Utils; using SupaLidlGame.Utils;
namespace SupaLidlGame.BoundingBoxes namespace SupaLidlGame.BoundingBoxes;
{
public partial class Hurtbox : BoundingBox, IFaction public partial class Hurtbox : BoundingBox, IFaction
{ {
[Signal] [Signal]
@ -37,4 +37,3 @@ namespace SupaLidlGame.BoundingBoxes
knockbackOrigin, knockbackVector); knockbackOrigin, knockbackVector);
} }
} }
}

View File

@ -4,8 +4,8 @@ using SupaLidlGame.Items;
using SupaLidlGame.Utils; using SupaLidlGame.Utils;
using SupaLidlGame.State.Character; using SupaLidlGame.State.Character;
namespace SupaLidlGame.Characters namespace SupaLidlGame.Characters;
{
public partial class Character : CharacterBody2D, IFaction public partial class Character : CharacterBody2D, IFaction
{ {
[Export] [Export]
@ -221,4 +221,3 @@ namespace SupaLidlGame.Characters
} }
} }
} }
}

View File

@ -1,8 +1,8 @@
using Godot; using Godot;
using System; using System;
namespace SupaLidlGame.Characters namespace SupaLidlGame.Characters;
{
public partial class Enemy : NPC public partial class Enemy : NPC
{ {
public override void _Ready() public override void _Ready()
@ -16,4 +16,3 @@ namespace SupaLidlGame.Characters
base.Die(); base.Die();
} }
} }
}

View File

@ -3,8 +3,8 @@ using SupaLidlGame.Extensions;
using SupaLidlGame.Items; using SupaLidlGame.Items;
using System; using System;
namespace SupaLidlGame.Characters namespace SupaLidlGame.Characters;
{
public partial class NPC : Character public partial class NPC : Character
{ {
/// <summary> /// <summary>
@ -226,4 +226,3 @@ namespace SupaLidlGame.Characters
} }
} }
} }
}

View File

@ -1,8 +1,8 @@
using Godot; using Godot;
using SupaLidlGame.Utils; using SupaLidlGame.Utils;
namespace SupaLidlGame.Characters namespace SupaLidlGame.Characters;
{
public partial class Player : Character public partial class Player : Character
{ {
private AnimatedSprite2D _sprite; private AnimatedSprite2D _sprite;
@ -18,8 +18,8 @@ namespace SupaLidlGame.Characters
{ {
// the Player.Animation property might be set before this node is // the Player.Animation property might be set before this node is
// even ready, so if _sprite is null, then we just hold the new // even ready, so if _sprite is null, then we just hold the new
// animation in a temp value, which will be assigned once this // animation in a temp value, which will be assigned once this node
// node is ready // is ready
if (_sprite is null) if (_sprite is null)
{ {
_spriteAnim = value; _spriteAnim = value;
@ -62,4 +62,3 @@ namespace SupaLidlGame.Characters
//base.Die(); //base.Die();
} }
} }
}

View File

@ -1,5 +1,5 @@
namespace SupaLidlGame.Characters.Thinkers namespace SupaLidlGame.Characters.Thinkers;
{
public class Thinker public class Thinker
{ {
public virtual void Think() public virtual void Think()
@ -7,4 +7,3 @@ namespace SupaLidlGame.Characters.Thinkers
} }
} }
}

View File

@ -1,8 +1,8 @@
using Godot; using Godot;
using System; using System;
namespace SupaLidlGame.Entities namespace SupaLidlGame.Entities;
{
public partial class Campfire : StaticBody2D public partial class Campfire : StaticBody2D
{ {
private PointLight2D _light; private PointLight2D _light;
@ -21,4 +21,3 @@ namespace SupaLidlGame.Entities
_light.Energy = Math.Clamp(_light.Energy, 1.2f, 2.0f); _light.Energy = Math.Clamp(_light.Energy, 1.2f, 2.0f);
} }
} }
}

View File

@ -2,8 +2,8 @@ using Godot;
using SupaLidlGame.Characters; using SupaLidlGame.Characters;
using SupaLidlGame.BoundingBoxes; using SupaLidlGame.BoundingBoxes;
namespace SupaLidlGame.Entities namespace SupaLidlGame.Entities;
{
public partial class Projectile : RigidBody2D public partial class Projectile : RigidBody2D
{ {
public Vector2 Velocity => Direction * Speed; public Vector2 Velocity => Direction * Speed;
@ -49,4 +49,3 @@ namespace SupaLidlGame.Entities
} }
} }
} }
}

View File

@ -2,8 +2,8 @@ using Godot;
using System; using System;
using SupaLidlGame.Utils; using SupaLidlGame.Utils;
namespace SupaLidlGame.Extensions namespace SupaLidlGame.Extensions;
{
public static class AudioStreamPlayer2DExtensions public static class AudioStreamPlayer2DExtensions
{ {
public static AudioStreamPlayer2D Clone( public static AudioStreamPlayer2D Clone(
@ -70,4 +70,3 @@ namespace SupaLidlGame.Extensions
return audio; return audio;
} }
} }
}

View File

@ -1,7 +1,7 @@
using Godot; using Godot;
namespace SupaLidlGame.Extensions namespace SupaLidlGame.Extensions;
{
public static class NodeExtensions public static class NodeExtensions
{ {
/// <summary> /// <summary>
@ -38,4 +38,3 @@ namespace SupaLidlGame.Extensions
return node.GetNode(name) as T; return node.GetNode(name) as T;
} }
} }
}

View File

@ -1,7 +1,7 @@
using Godot; using Godot;
namespace SupaLidlGame.Extensions namespace SupaLidlGame.Extensions;
{
public static class Node2DExtensions public static class Node2DExtensions
{ {
public static void RayCast(this Node2D node, Vector2 ray) public static void RayCast(this Node2D node, Vector2 ray)
@ -10,4 +10,3 @@ namespace SupaLidlGame.Extensions
//var result = spaceState.IntersectRay(); //var result = spaceState.IntersectRay();
} }
} }
}

View File

@ -1,7 +1,7 @@
using Godot; using Godot;
namespace SupaLidlGame.Extensions namespace SupaLidlGame.Extensions;
{
public static class Vector2Extensions public static class Vector2Extensions
{ {
public static Vector2 Midpoint(this Vector2 vector, Vector2 other) public static Vector2 Midpoint(this Vector2 vector, Vector2 other)
@ -38,4 +38,3 @@ namespace SupaLidlGame.Extensions
return new Vector2(vector.Y, -vector.X); return new Vector2(vector.Y, -vector.X);
} }
} }
}

View File

@ -2,8 +2,8 @@ using Godot;
using SupaLidlGame.Characters; using SupaLidlGame.Characters;
using Godot.Collections; using Godot.Collections;
namespace SupaLidlGame.Items namespace SupaLidlGame.Items;
{
public partial class Inventory : Node2D public partial class Inventory : Node2D
{ {
public Character Character { get; private set; } public Character Character { get; private set; }
@ -143,4 +143,3 @@ namespace SupaLidlGame.Items
throw new System.NotImplementedException(); throw new System.NotImplementedException();
} }
} }
}

View File

@ -1,8 +1,8 @@
using Godot; using Godot;
using SupaLidlGame.Characters; using SupaLidlGame.Characters;
namespace SupaLidlGame.Items namespace SupaLidlGame.Items;
{
public abstract partial class Item : Node2D public abstract partial class Item : Node2D
{ {
[Export] [Export]
@ -50,4 +50,3 @@ namespace SupaLidlGame.Items
public abstract void Deuse(); public abstract void Deuse();
} }
}

View File

@ -2,8 +2,8 @@ using Godot;
using SupaLidlGame.BoundingBoxes; using SupaLidlGame.BoundingBoxes;
using SupaLidlGame.Characters; using SupaLidlGame.Characters;
namespace SupaLidlGame.Items namespace SupaLidlGame.Items;
{
public abstract partial class Weapon : Item public abstract partial class Weapon : Item
{ {
public double RemainingUseTime { get; protected set; } = 0; public double RemainingUseTime { get; protected set; } = 0;
@ -107,4 +107,3 @@ namespace SupaLidlGame.Items
} }
} }
} }
}

View File

@ -1,5 +1,5 @@
namespace SupaLidlGame.Items.Weapons namespace SupaLidlGame.Items.Weapons;
{
public interface IParryable public interface IParryable
{ {
public bool IsParryable { get; } public bool IsParryable { get; }
@ -7,4 +7,3 @@ namespace SupaLidlGame.Items.Weapons
public ulong ParryTimeOrigin { get; } public ulong ParryTimeOrigin { get; }
public void Stun(); public void Stun();
} }
}

View File

@ -1,8 +1,8 @@
using Godot; using Godot;
using SupaLidlGame.Extensions; using SupaLidlGame.Extensions;
namespace SupaLidlGame.Items.Weapons namespace SupaLidlGame.Items.Weapons;
{
public partial class Railgun : Ranged public partial class Railgun : Ranged
{ {
public override void Attack() public override void Attack()
@ -19,4 +19,3 @@ namespace SupaLidlGame.Items.Weapons
.Entities.AddChild(projectile); .Entities.AddChild(projectile);
} }
} }
}

View File

@ -1,7 +1,7 @@
using Godot; using Godot;
namespace SupaLidlGame.Items.Weapons namespace SupaLidlGame.Items.Weapons;
{
public abstract partial class Ranged : Weapon public abstract partial class Ranged : Weapon
{ {
[Export] [Export]
@ -40,4 +40,3 @@ namespace SupaLidlGame.Items.Weapons
public abstract void Attack(); public abstract void Attack();
} }
}

View File

@ -4,8 +4,8 @@ using SupaLidlGame.Characters;
using SupaLidlGame.Extensions; using SupaLidlGame.Extensions;
using SupaLidlGame.State.Weapon; using SupaLidlGame.State.Weapon;
namespace SupaLidlGame.Items.Weapons namespace SupaLidlGame.Items.Weapons;
{
public partial class Sword : Weapon, IParryable public partial class Sword : Weapon, IParryable
{ {
public bool IsAttacking { get; protected set; } public bool IsAttacking { get; protected set; }
@ -234,4 +234,3 @@ namespace SupaLidlGame.Items.Weapons
AnimationTree.Set("parameters/conditions/" + condition, value); AnimationTree.Set("parameters/conditions/" + condition, value);
} }
} }
}

View File

@ -3,7 +3,6 @@
[ext_resource type="Script" path="res://Utils/World.cs" id="1_1k6ew"] [ext_resource type="Script" path="res://Utils/World.cs" id="1_1k6ew"]
[ext_resource type="PackedScene" uid="uid://bxtpv6jqodj4v" path="res://Scenes/Maps/Hills.tscn" id="2_juio7"] [ext_resource type="PackedScene" uid="uid://bxtpv6jqodj4v" path="res://Scenes/Maps/Hills.tscn" id="2_juio7"]
[node name="World" type="Node2D" node_paths=PackedStringArray("CurrentPlayer")] [node name="World" type="Node2D"]
script = ExtResource("1_1k6ew") script = ExtResource("1_1k6ew")
StartingArea = ExtResource("2_juio7") StartingArea = ExtResource("2_juio7")
CurrentPlayer = NodePath("")

View File

@ -1,8 +1,8 @@
using Godot; using Godot;
using System; using System;
namespace SupaLidlGame.Scenes namespace SupaLidlGame.Scenes;
{
public partial class Map : TileMap public partial class Map : TileMap
{ {
[Export] [Export]
@ -45,4 +45,3 @@ namespace SupaLidlGame.Scenes
base._Process(delta); base._Process(delta);
} }
} }
}

View File

@ -1,7 +1,7 @@
using Godot; using Godot;
namespace SupaLidlGame.State.Character namespace SupaLidlGame.State.Character;
{
public abstract partial class CharacterState : Node, IState<CharacterState> public abstract partial class CharacterState : Node, IState<CharacterState>
{ {
[Export] [Export]
@ -67,4 +67,3 @@ namespace SupaLidlGame.State.Character
public virtual CharacterState Input(InputEvent @event) => null; public virtual CharacterState Input(InputEvent @event) => null;
} }
}

View File

@ -1,7 +1,7 @@
using Godot; using Godot;
namespace SupaLidlGame.State.Character namespace SupaLidlGame.State.Character;
{
public partial class CharacterStateMachine : StateMachine<CharacterState> public partial class CharacterStateMachine : StateMachine<CharacterState>
{ {
[Export] [Export]
@ -37,4 +37,3 @@ namespace SupaLidlGame.State.Character
} }
} }
} }
}

View File

@ -1,7 +1,7 @@
using Godot; using Godot;
namespace SupaLidlGame.State.Character namespace SupaLidlGame.State.Character;
{
public partial class NPCIdleState : NPCState public partial class NPCIdleState : NPCState
{ {
[Export] [Export]
@ -23,4 +23,3 @@ namespace SupaLidlGame.State.Character
return base.Enter(previousState); return base.Enter(previousState);
} }
} }
}

View File

@ -1,7 +1,7 @@
using Godot; using Godot;
namespace SupaLidlGame.State.Character namespace SupaLidlGame.State.Character;
{
public partial class NPCMoveState : NPCState public partial class NPCMoveState : NPCState
{ {
[Export] [Export]
@ -23,4 +23,3 @@ namespace SupaLidlGame.State.Character
return base.Enter(prev); return base.Enter(prev);
} }
} }
}

View File

@ -1,5 +1,5 @@
namespace SupaLidlGame.State.Character namespace SupaLidlGame.State.Character;
{
public abstract partial class NPCState : CharacterState public abstract partial class NPCState : CharacterState
{ {
protected Characters.NPC _npc => Character as Characters.NPC; protected Characters.NPC _npc => Character as Characters.NPC;
@ -10,4 +10,3 @@ namespace SupaLidlGame.State.Character
return base.Process(delta); return base.Process(delta);
} }
} }
}

View File

@ -1,7 +1,7 @@
using Godot; using Godot;
namespace SupaLidlGame.State.Character namespace SupaLidlGame.State.Character;
{
public partial class PlayerIdleState : PlayerState public partial class PlayerIdleState : PlayerState
{ {
[Export] [Export]
@ -35,4 +35,3 @@ namespace SupaLidlGame.State.Character
return null; return null;
} }
} }
}

View File

@ -1,7 +1,7 @@
using Godot; using Godot;
namespace SupaLidlGame.State.Character namespace SupaLidlGame.State.Character;
{
public partial class PlayerMoveState : PlayerState public partial class PlayerMoveState : PlayerState
{ {
[Export] [Export]
@ -43,4 +43,3 @@ namespace SupaLidlGame.State.Character
return base.Input(@event); return base.Input(@event);
} }
} }
}

View File

@ -1,7 +1,7 @@
using Godot; using Godot;
namespace SupaLidlGame.State.Character namespace SupaLidlGame.State.Character;
{
public partial class PlayerRollState : PlayerState public partial class PlayerRollState : PlayerState
{ {
private double _timeLeftToRoll = 0; private double _timeLeftToRoll = 0;
@ -36,4 +36,3 @@ namespace SupaLidlGame.State.Character
return null; return null;
} }
} }
}

View File

@ -1,8 +1,8 @@
using Godot; using Godot;
using SupaLidlGame.Characters; using SupaLidlGame.Characters;
namespace SupaLidlGame.State.Character namespace SupaLidlGame.State.Character;
{
public abstract partial class PlayerState : CharacterState public abstract partial class PlayerState : CharacterState
{ {
protected Player _player => Character as Player; protected Player _player => Character as Player;
@ -69,4 +69,3 @@ namespace SupaLidlGame.State.Character
return base.Process(delta); return base.Process(delta);
} }
} }
}

View File

@ -1,5 +1,5 @@
namespace SupaLidlGame.State namespace SupaLidlGame.State;
{
public interface IState<T> where T : IState<T> public interface IState<T> where T : IState<T>
{ {
/// <summary> /// <summary>
@ -20,4 +20,3 @@ namespace SupaLidlGame.State
public IState<T> Process(double delta) => null; public IState<T> Process(double delta) => null;
} }
}

View File

@ -1,7 +1,7 @@
using Godot; using Godot;
namespace SupaLidlGame.State namespace SupaLidlGame.State;
{
public abstract partial class StateMachine<T> : Node where T : IState<T> public abstract partial class StateMachine<T> : Node where T : IState<T>
{ {
public T CurrentState { get; protected set; } public T CurrentState { get; protected set; }
@ -38,4 +38,3 @@ namespace SupaLidlGame.State
return true; return true;
} }
} }
}

View File

@ -1,7 +1,7 @@
using Godot; using Godot;
namespace SupaLidlGame.State.Weapon namespace SupaLidlGame.State.Weapon;
{
public partial class RangedFireState : WeaponState public partial class RangedFireState : WeaponState
{ {
[Export] [Export]
@ -35,4 +35,3 @@ namespace SupaLidlGame.State.Weapon
} }
} }
}

View File

@ -1,7 +1,7 @@
using Godot; using Godot;
namespace SupaLidlGame.State.Weapon namespace SupaLidlGame.State.Weapon;
{
public partial class RangedIdleState : WeaponState public partial class RangedIdleState : WeaponState
{ {
[Export] [Export]
@ -26,4 +26,3 @@ namespace SupaLidlGame.State.Weapon
Weapon.Visible = true; Weapon.Visible = true;
} }
} }
}

View File

@ -1,7 +1,7 @@
using Godot; using Godot;
namespace SupaLidlGame.State.Weapon namespace SupaLidlGame.State.Weapon;
{
public partial class SwordAnticipateState : WeaponState public partial class SwordAnticipateState : WeaponState
{ {
[Export] [Export]
@ -43,4 +43,3 @@ namespace SupaLidlGame.State.Weapon
return null; return null;
} }
} }
}

View File

@ -1,7 +1,7 @@
using Godot; using Godot;
namespace SupaLidlGame.State.Weapon namespace SupaLidlGame.State.Weapon;
{
public partial class SwordAttackState : WeaponState public partial class SwordAttackState : WeaponState
{ {
[Export] [Export]
@ -86,4 +86,3 @@ namespace SupaLidlGame.State.Weapon
return null; return null;
} }
} }
}

View File

@ -1,7 +1,7 @@
using Godot; using Godot;
namespace SupaLidlGame.State.Weapon namespace SupaLidlGame.State.Weapon;
{
public partial class SwordIdleState : WeaponState public partial class SwordIdleState : WeaponState
{ {
[Export] [Export]
@ -49,4 +49,3 @@ namespace SupaLidlGame.State.Weapon
return null; return null;
} }
} }
}

View File

@ -1,7 +1,7 @@
using Godot; using Godot;
namespace SupaLidlGame.State.Weapon namespace SupaLidlGame.State.Weapon;
{
public abstract partial class WeaponState : Node, IState<WeaponState> public abstract partial class WeaponState : Node, IState<WeaponState>
{ {
public virtual WeaponState Use() => null; public virtual WeaponState Use() => null;
@ -17,4 +17,3 @@ namespace SupaLidlGame.State.Weapon
public virtual IState<WeaponState> Process(double delta) => null; public virtual IState<WeaponState> Process(double delta) => null;
} }
}

View File

@ -1,7 +1,7 @@
using Godot; using Godot;
namespace SupaLidlGame.State.Weapon namespace SupaLidlGame.State.Weapon;
{
public partial class WeaponStateMachine : StateMachine<WeaponState> public partial class WeaponStateMachine : StateMachine<WeaponState>
{ {
[Export] [Export]
@ -34,4 +34,3 @@ namespace SupaLidlGame.State.Weapon
} }
} }
} }
}

View File

@ -2,8 +2,8 @@ using Godot;
using SupaLidlGame.Extensions; using SupaLidlGame.Extensions;
using System; using System;
namespace SupaLidlGame.Prototyping namespace SupaLidlGame.Prototyping;
{
public partial class ContextBasedSteering : Node2D public partial class ContextBasedSteering : Node2D
{ {
public float PreferredDistance { get; set; } = 256.0f; public float PreferredDistance { get; set; } = 256.0f;
@ -55,4 +55,3 @@ namespace SupaLidlGame.Prototyping
DrawLine(Vector2.Zero, _direction * 256, Colors.Green); DrawLine(Vector2.Zero, _direction * 256, Colors.Green);
} }
} }
}

View File

@ -1,8 +1,8 @@
using Godot; using Godot;
using System; using System;
namespace SupaLidlGame.UI namespace SupaLidlGame.UI;
{
public partial class FloatingText : Node2D public partial class FloatingText : Node2D
{ {
private Label _label; private Label _label;
@ -48,4 +48,3 @@ namespace SupaLidlGame.UI
QueueFree(); QueueFree();
} }
} }
}

View File

@ -1,7 +1,7 @@
using Godot; using Godot;
namespace SupaLidlGame.Utils namespace SupaLidlGame.Utils;
{
public interface IFaction public interface IFaction
{ {
/// <summary> /// <summary>
@ -10,4 +10,3 @@ namespace SupaLidlGame.Utils
[Export] [Export]
public ushort Faction { get; set; } public ushort Faction { get; set; }
} }
}

View File

@ -1,8 +1,8 @@
using Godot; using Godot;
using System; using System;
namespace SupaLidlGame.Utils namespace SupaLidlGame.Utils;
{
public partial class PlayerCamera : Camera2D public partial class PlayerCamera : Camera2D
{ {
protected float _intensity; protected float _intensity;
@ -47,4 +47,3 @@ namespace SupaLidlGame.Utils
return ret; return ret;
} }
} }
}

View File

@ -2,8 +2,8 @@ using Godot;
using Godot.Collections; using Godot.Collections;
using SupaLidlGame.Extensions; using SupaLidlGame.Extensions;
namespace SupaLidlGame.Utils namespace SupaLidlGame.Utils;
{
public partial class Spawner : Node2D public partial class Spawner : Node2D
{ {
[Export] [Export]
@ -56,4 +56,3 @@ namespace SupaLidlGame.Utils
} }
} }
} }
}

View File

@ -5,8 +5,8 @@ using SupaLidlGame.Extensions;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
namespace SupaLidlGame.Utils namespace SupaLidlGame.Utils;
{
public partial class World : Node2D public partial class World : Node2D
{ {
[Export] [Export]
@ -147,4 +147,3 @@ namespace SupaLidlGame.Utils
throw new System.NotImplementedException(); throw new System.NotImplementedException();
} }
} }
}