From ae5767e1fd9942db61f32b8e695726bb2411c39c Mon Sep 17 00:00:00 2001 From: HumanoidSandvichDispenser Date: Sun, 26 Mar 2023 13:03:45 -0700 Subject: [PATCH] reorganizing code --- Items/Item.cs | 4 ++-- Utils/World.cs | 17 +++++++++-------- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/Items/Item.cs b/Items/Item.cs index db7078e..c2e64d1 100644 --- a/Items/Item.cs +++ b/Items/Item.cs @@ -16,10 +16,10 @@ namespace SupaLidlGame.Items public int Count { get; set; } = 1; - public Character CharacterOwner { get; set; } - public bool IsOneHanded { get; set; } = false; + public Character CharacterOwner { get; set; } + /// /// Determines if this item can directly stack with other items /// diff --git a/Utils/World.cs b/Utils/World.cs index b1794aa..09f7cbc 100644 --- a/Utils/World.cs +++ b/Utils/World.cs @@ -48,12 +48,7 @@ namespace SupaLidlGame.Utils public void LoadScene(PackedScene scene) { - if (CurrentMap is not null) - { - CurrentMap.Entities.RemoveChild(CurrentPlayer); - RemoveChild(CurrentMap); - CurrentMap.Active = false; - } + GD.Print("Loading map " + scene.ResourcePath); Map map; if (_maps.ContainsKey(scene.ResourcePath)) @@ -66,11 +61,17 @@ namespace SupaLidlGame.Utils _maps.Add(scene.ResourcePath, map); } - GD.Print("Loading " + scene.ResourcePath); + if (CurrentMap is not null) + { + CurrentMap.Entities.RemoveChild(CurrentPlayer); + RemoveChild(CurrentMap); + CurrentMap.Active = false; + } - CurrentMap = map; AddChild(map); InitTilemap(map); + + CurrentMap = map; CurrentMap.Active = true; if (CurrentPlayer is not null)