Compare commits
No commits in common. "5e87a02a760bae0942eb688513a424060ef35c30" and "c0424444b9f3d864d039220134ae302a26c62154" have entirely different histories.
5e87a02a76
...
c0424444b9
|
@ -1,5 +1,4 @@
|
||||||
using Godot;
|
using Godot;
|
||||||
using IEnumerableNode = System.Collections.Generic.IEnumerable<Godot.Node>;
|
|
||||||
|
|
||||||
namespace SupaLidlGame.Extensions;
|
namespace SupaLidlGame.Extensions;
|
||||||
|
|
||||||
|
@ -56,13 +55,4 @@ public static class NodeExtensions
|
||||||
return node.GetNode<UI.UIController>("/root/BaseUI/" +
|
return node.GetNode<UI.UIController>("/root/BaseUI/" +
|
||||||
"SubViewportContainer/UIViewport/CanvasLayer/MainUILayer/Main");
|
"SubViewportContainer/UIViewport/CanvasLayer/MainUILayer/Main");
|
||||||
}
|
}
|
||||||
|
|
||||||
public static IEnumerableNode GetChildrenEnumerable(this Node node)
|
|
||||||
{
|
|
||||||
int childCount = node.GetChildCount();
|
|
||||||
for (int i = 0; i < childCount; i++)
|
|
||||||
{
|
|
||||||
yield return node.GetChild(i);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -239,21 +239,6 @@ public partial class Inventory : Node2D, IItemCollection<ItemMetadata>
|
||||||
|
|
||||||
public bool Remove(ItemMetadata item)
|
public bool Remove(ItemMetadata item)
|
||||||
{
|
{
|
||||||
int indexInInventory = Items.IndexOf(item);
|
|
||||||
if (indexInInventory < 0)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// remove instances of item from hotbar
|
|
||||||
int indexInHotbar = HotbarToItemIndexMap.IndexOf(indexInInventory);
|
|
||||||
if (indexInHotbar >= 0)
|
|
||||||
{
|
|
||||||
HotbarToItemIndexMap[indexInHotbar] = -1;
|
|
||||||
Hotbar[indexInHotbar].QueueFree();
|
|
||||||
}
|
|
||||||
|
|
||||||
Items[indexInInventory] = null;
|
|
||||||
return Items.Remove(item);
|
return Items.Remove(item);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -65,15 +65,4 @@ public abstract partial class Item : Node2D
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public virtual void Remove()
|
|
||||||
{
|
|
||||||
if (IsUsing)
|
|
||||||
{
|
|
||||||
Deuse();
|
|
||||||
}
|
|
||||||
|
|
||||||
Unequip(CharacterOwner);
|
|
||||||
QueueFree();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -412,6 +412,7 @@ libraries = {
|
||||||
}
|
}
|
||||||
|
|
||||||
[node name="Hitbox" parent="." instance=ExtResource("9_qimey")]
|
[node name="Hitbox" parent="." instance=ExtResource("9_qimey")]
|
||||||
|
priority = 5
|
||||||
IsDisabled = true
|
IsDisabled = true
|
||||||
|
|
||||||
[node name="CollisionShape2D" parent="Hitbox" index="0"]
|
[node name="CollisionShape2D" parent="Hitbox" index="0"]
|
||||||
|
|
|
@ -65,9 +65,9 @@ tracks/0/path = NodePath("Anchor:position")
|
||||||
tracks/0/interp = 1
|
tracks/0/interp = 1
|
||||||
tracks/0/loop_wrap = true
|
tracks/0/loop_wrap = true
|
||||||
tracks/0/keys = {
|
tracks/0/keys = {
|
||||||
"times": PackedFloat32Array(0, 0.2),
|
"times": PackedFloat32Array(0, 0.5),
|
||||||
"transitions": PackedFloat32Array(1, 1),
|
"transitions": PackedFloat32Array(1, 1),
|
||||||
"update": 0,
|
"update": 1,
|
||||||
"values": [Vector2(-4, 0), Vector2(0, 0)]
|
"values": [Vector2(-4, 0), Vector2(0, 0)]
|
||||||
}
|
}
|
||||||
tracks/1/type = "audio"
|
tracks/1/type = "audio"
|
||||||
|
@ -92,10 +92,10 @@ tracks/2/path = NodePath("Anchor:rotation")
|
||||||
tracks/2/interp = 1
|
tracks/2/interp = 1
|
||||||
tracks/2/loop_wrap = true
|
tracks/2/loop_wrap = true
|
||||||
tracks/2/keys = {
|
tracks/2/keys = {
|
||||||
"times": PackedFloat32Array(0, 0.1, 1, 1.5),
|
"times": PackedFloat32Array(0, 1, 1.5),
|
||||||
"transitions": PackedFloat32Array(1, 1, 1, 1),
|
"transitions": PackedFloat32Array(1, 1, 1),
|
||||||
"update": 0,
|
"update": 0,
|
||||||
"values": [6.19592, 6.28319, 6.28319, 0.0]
|
"values": [6.28319, 6.28319, 0.0]
|
||||||
}
|
}
|
||||||
tracks/3/type = "audio"
|
tracks/3/type = "audio"
|
||||||
tracks/3/imported = false
|
tracks/3/imported = false
|
||||||
|
|
|
@ -417,6 +417,7 @@ libraries = {
|
||||||
}
|
}
|
||||||
|
|
||||||
[node name="Hitbox" parent="." instance=ExtResource("3_up3ob")]
|
[node name="Hitbox" parent="." instance=ExtResource("3_up3ob")]
|
||||||
|
priority = 5
|
||||||
IsDisabled = true
|
IsDisabled = true
|
||||||
|
|
||||||
[node name="CollisionShape2D" parent="Hitbox" index="0"]
|
[node name="CollisionShape2D" parent="Hitbox" index="0"]
|
||||||
|
|
|
@ -3,7 +3,7 @@ using SupaLidlGame.Utils;
|
||||||
|
|
||||||
namespace SupaLidlGame.State.Global;
|
namespace SupaLidlGame.State.Global;
|
||||||
|
|
||||||
public partial class GlobalState : Node, ISave
|
public partial class GlobalState : Node
|
||||||
{
|
{
|
||||||
[Export]
|
[Export]
|
||||||
public Progression Progression { get; set; }
|
public Progression Progression { get; set; }
|
||||||
|
@ -14,10 +14,6 @@ public partial class GlobalState : Node, ISave
|
||||||
[Export]
|
[Export]
|
||||||
public Stats Stats { get; set; }
|
public Stats Stats { get; set; }
|
||||||
|
|
||||||
private ulong _saveTimeElapsed = 0;
|
|
||||||
|
|
||||||
public ulong TimeElapsed => _saveTimeElapsed + Godot.Time.GetTicksMsec();
|
|
||||||
|
|
||||||
public static GlobalState Instance { get; private set; }
|
public static GlobalState Instance { get; private set; }
|
||||||
|
|
||||||
[Export]
|
[Export]
|
||||||
|
@ -80,7 +76,6 @@ public partial class GlobalState : Node, ISave
|
||||||
Progression = save.Progression;
|
Progression = save.Progression;
|
||||||
MapState = save.MapState;
|
MapState = save.MapState;
|
||||||
Stats = save.Stats;
|
Stats = save.Stats;
|
||||||
_saveTimeElapsed = save.TimeElapsed; // use as offset
|
|
||||||
|
|
||||||
var inventory = World.Instance.CurrentPlayer.Inventory;
|
var inventory = World.Instance.CurrentPlayer.Inventory;
|
||||||
inventory.Items = Stats.Items;
|
inventory.Items = Stats.Items;
|
||||||
|
@ -101,7 +96,6 @@ public partial class GlobalState : Node, ISave
|
||||||
save.Progression = Progression;
|
save.Progression = Progression;
|
||||||
save.MapState = MapState;
|
save.MapState = MapState;
|
||||||
save.Stats = Stats;
|
save.Stats = Stats;
|
||||||
save.TimeElapsed = TimeElapsed; // update time elapsed when saving
|
|
||||||
|
|
||||||
var inventory = World.Instance.CurrentPlayer.Inventory;
|
var inventory = World.Instance.CurrentPlayer.Inventory;
|
||||||
Stats.Items = inventory.Items;
|
Stats.Items = inventory.Items;
|
||||||
|
|
|
@ -56,8 +56,7 @@ public partial class RangedChargeState : WeaponState
|
||||||
return IdleState;
|
return IdleState;
|
||||||
}
|
}
|
||||||
|
|
||||||
FireState.VelocityModifier = (float)(1 - progress) *
|
FireState.VelocityModifier = (float)(1 - progress);
|
||||||
FireState.InitialVelocityModifier;
|
|
||||||
return FireState;
|
return FireState;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,18 +17,10 @@ public partial class RangedFireState : WeaponState
|
||||||
[Export]
|
[Export]
|
||||||
public string AnimationKey { get; set; }
|
public string AnimationKey { get; set; }
|
||||||
|
|
||||||
public float VelocityModifier { get; set; } = 1;
|
public float VelocityModifier { get; set; }
|
||||||
|
|
||||||
[Export]
|
|
||||||
public float InitialVelocityModifier { get; set; } = 1;
|
|
||||||
|
|
||||||
private double _timeLeft = 0;
|
private double _timeLeft = 0;
|
||||||
|
|
||||||
public override void _Ready()
|
|
||||||
{
|
|
||||||
VelocityModifier = InitialVelocityModifier;
|
|
||||||
}
|
|
||||||
|
|
||||||
public override IState<WeaponState> Enter(IState<WeaponState> prev)
|
public override IState<WeaponState> Enter(IState<WeaponState> prev)
|
||||||
{
|
{
|
||||||
//_timeLeft
|
//_timeLeft
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
<Project Sdk="Godot.NET.Sdk/4.3.0">
|
<Project Sdk="Godot.NET.Sdk/4.3.0-beta.1">
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFramework>net7.0</TargetFramework>
|
<TargetFramework>net7.0</TargetFramework>
|
||||||
<EnableDynamicLoading>true</EnableDynamicLoading>
|
<EnableDynamicLoading>true</EnableDynamicLoading>
|
||||||
|
@ -12,4 +12,4 @@
|
||||||
<None Remove="UnitTests/**/*" />
|
<None Remove="UnitTests/**/*" />
|
||||||
<PackageReference Include="Firebelley.GodotUtilities" Version="4.0.4" />
|
<PackageReference Include="Firebelley.GodotUtilities" Version="4.0.4" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
</Project>
|
</Project>
|
||||||
|
|
|
@ -1,14 +0,0 @@
|
||||||
using Godot;
|
|
||||||
|
|
||||||
namespace SupaLidlGame.Utils;
|
|
||||||
|
|
||||||
public interface ISave
|
|
||||||
{
|
|
||||||
public State.Global.Progression Progression { get; set; }
|
|
||||||
|
|
||||||
public State.Global.MapState MapState { get; set; }
|
|
||||||
|
|
||||||
public State.Global.Stats Stats { get; set; }
|
|
||||||
|
|
||||||
public ulong TimeElapsed { get; }
|
|
||||||
}
|
|
|
@ -40,7 +40,6 @@ public partial class PlayerStats : CharacterStats
|
||||||
|
|
||||||
_xpDecayTimer = new Timer();
|
_xpDecayTimer = new Timer();
|
||||||
_xpDecayTimer.Timeout += () => _shouldDecayXP = true;
|
_xpDecayTimer.Timeout += () => _shouldDecayXP = true;
|
||||||
_xpDecayTimer.OneShot = true;
|
|
||||||
_xpDecayTimer.Stop();
|
_xpDecayTimer.Stop();
|
||||||
AddChild(_xpDecayTimer);
|
AddChild(_xpDecayTimer);
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@ using Godot;
|
||||||
|
|
||||||
namespace SupaLidlGame.Utils;
|
namespace SupaLidlGame.Utils;
|
||||||
|
|
||||||
public partial class Save : Resource, ISave
|
public partial class Save : Resource
|
||||||
{
|
{
|
||||||
[Export]
|
[Export]
|
||||||
public State.Global.Progression Progression { get; set; }
|
public State.Global.Progression Progression { get; set; }
|
||||||
|
@ -13,14 +13,10 @@ public partial class Save : Resource, ISave
|
||||||
[Export]
|
[Export]
|
||||||
public State.Global.Stats Stats { get; set; }
|
public State.Global.Stats Stats { get; set; }
|
||||||
|
|
||||||
[Export]
|
|
||||||
public ulong TimeElapsed { get; set; }
|
|
||||||
|
|
||||||
public Save()
|
public Save()
|
||||||
{
|
{
|
||||||
Progression = new();
|
Progression = new();
|
||||||
MapState = new();
|
MapState = new();
|
||||||
Stats = new();
|
Stats = new();
|
||||||
TimeElapsed = 0;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -68,8 +68,6 @@ public partial class World : Node
|
||||||
|
|
||||||
private string _currentMapResourcePath;
|
private string _currentMapResourcePath;
|
||||||
|
|
||||||
internal DebugCommands Debug { get; }
|
|
||||||
|
|
||||||
//private Entities.Campfire _lastCampfire = null;
|
//private Entities.Campfire _lastCampfire = null;
|
||||||
|
|
||||||
private const string PLAYER_PATH = "res://Characters/Player.tscn";
|
private const string PLAYER_PATH = "res://Characters/Player.tscn";
|
||||||
|
@ -86,13 +84,6 @@ public partial class World : Node
|
||||||
{
|
{
|
||||||
throw new System.Exception("Another World instance is running.");
|
throw new System.Exception("Another World instance is running.");
|
||||||
}
|
}
|
||||||
|
|
||||||
Debug = new(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
~World()
|
|
||||||
{
|
|
||||||
Debug.Free();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void _Ready()
|
public override void _Ready()
|
||||||
|
@ -345,21 +336,3 @@ public partial class World : Node
|
||||||
|
|
||||||
public Node FindEntity(string name) => CurrentMap.Entities.GetNode(name);
|
public Node FindEntity(string name) => CurrentMap.Entities.GetNode(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
internal partial class DebugCommands : Godot.GodotObject
|
|
||||||
{
|
|
||||||
private World _world;
|
|
||||||
|
|
||||||
internal DebugCommands(World world)
|
|
||||||
{
|
|
||||||
_world = world;
|
|
||||||
}
|
|
||||||
|
|
||||||
internal Items.ItemMetadata GiveItem(string item)
|
|
||||||
{
|
|
||||||
var itemMetadata = ResourceLoader
|
|
||||||
.Load<Items.ItemMetadata>($"res://Items/{item}.tres");
|
|
||||||
_world.CurrentPlayer.Inventory.Add(itemMetadata);
|
|
||||||
return itemMetadata;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
|
@ -228,8 +228,6 @@ locale/translations_pot_files=PackedStringArray("res://Assets/Dialogue/doc.dialo
|
||||||
2d_physics/layer_5="World Clip"
|
2d_physics/layer_5="World Clip"
|
||||||
2d_physics/layer_6="Interaction Receiver"
|
2d_physics/layer_6="Interaction Receiver"
|
||||||
2d_physics/layer_7="Interaction Trigger"
|
2d_physics/layer_7="Interaction Trigger"
|
||||||
2d_physics/layer_9="Hitbox"
|
|
||||||
2d_physics/layer_10="Hurtbox"
|
|
||||||
|
|
||||||
[navigation]
|
[navigation]
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue