reorganizing code

item-info
HumanoidSandvichDispenser 2023-03-26 13:03:45 -07:00
parent fe11421fc1
commit ae5767e1fd
Signed by: sandvich
GPG Key ID: 9A39BE37E602B22D
2 changed files with 11 additions and 10 deletions

View File

@ -16,10 +16,10 @@ namespace SupaLidlGame.Items
public int Count { get; set; } = 1; public int Count { get; set; } = 1;
public Character CharacterOwner { get; set; }
public bool IsOneHanded { get; set; } = false; public bool IsOneHanded { get; set; } = false;
public Character CharacterOwner { get; set; }
/// <summary> /// <summary>
/// Determines if this item can directly stack with other items /// Determines if this item can directly stack with other items
/// </summary> /// </summary>

View File

@ -48,12 +48,7 @@ namespace SupaLidlGame.Utils
public void LoadScene(PackedScene scene) public void LoadScene(PackedScene scene)
{ {
if (CurrentMap is not null) GD.Print("Loading map " + scene.ResourcePath);
{
CurrentMap.Entities.RemoveChild(CurrentPlayer);
RemoveChild(CurrentMap);
CurrentMap.Active = false;
}
Map map; Map map;
if (_maps.ContainsKey(scene.ResourcePath)) if (_maps.ContainsKey(scene.ResourcePath))
@ -66,11 +61,17 @@ namespace SupaLidlGame.Utils
_maps.Add(scene.ResourcePath, map); _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); AddChild(map);
InitTilemap(map); InitTilemap(map);
CurrentMap = map;
CurrentMap.Active = true; CurrentMap.Active = true;
if (CurrentPlayer is not null) if (CurrentPlayer is not null)