Compare commits
No commits in common. "cfb8527a42687d3a9a65c8b35f80bc71e0b5e87a" and "b687b49e521b26b213d98d873f013df01ee14fc7" have entirely different histories.
cfb8527a42
...
b687b49e52
|
@ -11,11 +11,10 @@ public partial class Inventory : Node2D, IItemCollection<ItemMetadata>
|
|||
[Export]
|
||||
public Array<Item> Hotbar { get; private set; }
|
||||
|
||||
public Array<int> HotbarToItemIndexMap { get; set; } = new();
|
||||
[Export]
|
||||
public Array<ItemMetadata> Items { get; private set; }
|
||||
|
||||
[Export]
|
||||
public Array<ItemMetadata> Items { get; set; }
|
||||
|
||||
public Dictionary<string, int> InventoryMap { get; set; }
|
||||
|
||||
[Signal]
|
||||
|
@ -63,12 +62,6 @@ public partial class Inventory : Node2D, IItemCollection<ItemMetadata>
|
|||
|
||||
public bool IsUsingItem => SelectedItem?.IsUsing ?? false;
|
||||
|
||||
public Inventory()
|
||||
{
|
||||
HotbarToItemIndexMap.Resize(HotbarCapacity);
|
||||
HotbarToItemIndexMap.Fill(-1);
|
||||
}
|
||||
|
||||
public override void _Ready()
|
||||
{
|
||||
if (Hotbar is null)
|
||||
|
@ -162,19 +155,7 @@ public partial class Inventory : Node2D, IItemCollection<ItemMetadata>
|
|||
return item;
|
||||
}
|
||||
|
||||
public Item SetHotbarIndexToItemIndex(int hotbarIndex, int itemIndex)
|
||||
{
|
||||
HotbarToItemIndexMap[hotbarIndex] = itemIndex;
|
||||
|
||||
if (itemIndex >= 0)
|
||||
{
|
||||
return SetHotbarIndexToItem(hotbarIndex, Items[itemIndex]);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
private Item SetHotbarIndexToItem(int index, ItemMetadata metadata)
|
||||
public Item SetHotbarIndexToItem(int index, ItemMetadata metadata)
|
||||
{
|
||||
var oldItem = Hotbar[index];
|
||||
Item newItem = null;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
[gd_scene load_steps=29 format=3 uid="uid://5y1acxl4j4n7"]
|
||||
[gd_scene load_steps=30 format=3 uid="uid://5y1acxl4j4n7"]
|
||||
|
||||
[ext_resource type="Script" path="res://Items/Weapons/Sword.cs" id="1_mai31"]
|
||||
[ext_resource type="Script" path="res://State/Weapon/WeaponStateMachine.cs" id="2_5ramr"]
|
||||
|
@ -19,6 +19,11 @@
|
|||
[ext_resource type="AudioStream" uid="uid://qvthq6tppp63" path="res://Assets/Sounds/whoosh.wav" id="12_a8o3x"]
|
||||
[ext_resource type="AudioStream" uid="uid://c4n7ioxpukdwi" path="res://Assets/Sounds/parry.wav" id="13_t5wmj"]
|
||||
|
||||
[sub_resource type="Environment" id="Environment_72txp"]
|
||||
background_mode = 3
|
||||
glow_enabled = true
|
||||
glow_hdr_threshold = 1.42
|
||||
|
||||
[sub_resource type="Animation" id="Animation_b7327"]
|
||||
length = 0.001
|
||||
tracks/0/type = "value"
|
||||
|
@ -377,6 +382,9 @@ IdleState = NodePath("../Idle")
|
|||
UseState = NodePath("../Anticipate")
|
||||
BlockAnimKey = "block"
|
||||
|
||||
[node name="WorldEnvironment" type="WorldEnvironment" parent="."]
|
||||
environment = SubResource("Environment_72txp")
|
||||
|
||||
[node name="Anchor" type="Node2D" parent="."]
|
||||
y_sort_enabled = true
|
||||
rotation = 3.14159
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
[gd_scene load_steps=25 format=3 uid="uid://dvqap2uhcah63"]
|
||||
[gd_scene load_steps=26 format=3 uid="uid://dvqap2uhcah63"]
|
||||
|
||||
[ext_resource type="Script" path="res://Items/Weapons/Sword.cs" id="1_mlo73"]
|
||||
[ext_resource type="Resource" uid="uid://cl7jvdu2lnv2d" path="res://Items/Weapons/Sword.tres" id="2_atd4f"]
|
||||
|
@ -16,6 +16,11 @@
|
|||
[ext_resource type="Texture2D" uid="uid://cmvh6pc71ir1m" path="res://Assets/Sprites/sword-swing-large.png" id="10_672jv"]
|
||||
[ext_resource type="AudioStream" uid="uid://qvthq6tppp63" path="res://Assets/Sounds/whoosh.wav" id="10_mfnl7"]
|
||||
|
||||
[sub_resource type="Environment" id="Environment_72txp"]
|
||||
background_mode = 3
|
||||
glow_enabled = true
|
||||
glow_hdr_threshold = 1.42
|
||||
|
||||
[sub_resource type="Curve" id="Curve_4cxtp"]
|
||||
_data = [Vector2(0.00687286, 1), 0.0, 0.0, 0, 0, Vector2(0.879725, 0.190909), -2.93145, -2.93145, 0, 0, Vector2(1, 0.0454545), 0.0483926, 0.0, 0, 0]
|
||||
point_count = 3
|
||||
|
@ -375,6 +380,9 @@ script = ExtResource("5_hmisb")
|
|||
Sword = NodePath("../..")
|
||||
IdleState = NodePath("../Idle")
|
||||
|
||||
[node name="WorldEnvironment" type="WorldEnvironment" parent="."]
|
||||
environment = SubResource("Environment_72txp")
|
||||
|
||||
[node name="Anchor" type="Node2D" parent="."]
|
||||
y_sort_enabled = true
|
||||
rotation = -1.5708
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
[gd_scene load_steps=50 format=4 uid="uid://b2x17su05ou5w"]
|
||||
[gd_scene load_steps=49 format=4 uid="uid://b2x17su05ou5w"]
|
||||
|
||||
[ext_resource type="PackedScene" uid="uid://clwv2owvk6abe" path="res://Scenes/BaseMap.tscn" id="1_ifiic"]
|
||||
[ext_resource type="TileSet" uid="uid://l61kbx31ug4p" path="res://Scenes/Maps/ArenaTileset.tres" id="2_x0mh7"]
|
||||
|
@ -17,7 +17,6 @@
|
|||
[ext_resource type="Script" path="res://addons/phantom_camera/scripts/phantom_camera/phantom_camera_2d.gd" id="11_q01ik"]
|
||||
[ext_resource type="Texture2D" uid="uid://c1a7lvb4uuwfy" path="res://Assets/Sprites/Particles/circle-16.png" id="11_yjp7m"]
|
||||
[ext_resource type="Script" path="res://addons/phantom_camera/scripts/resources/tween_resource.gd" id="12_ca3oh"]
|
||||
[ext_resource type="Environment" uid="uid://bl15544uvuppq" path="res://Scenes/Maps/ArenaEnvironment.tres" id="18_m6btu"]
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_7aiot"]
|
||||
atlas = ExtResource("5_5ley7")
|
||||
|
@ -410,9 +409,6 @@ visible = false
|
|||
[node name="Entrance" type="Marker2D" parent="Markers" index="0"]
|
||||
position = Vector2(0, 352)
|
||||
|
||||
[node name="WorldEnvironment" parent="." index="7"]
|
||||
environment = ExtResource("18_m6btu")
|
||||
|
||||
[node name="CanvasLayer" type="CanvasLayer" parent="." index="8"]
|
||||
layer = -99
|
||||
|
||||
|
|
|
@ -1,16 +0,0 @@
|
|||
[gd_resource type="Environment" load_steps=3 format=3 uid="uid://bl15544uvuppq"]
|
||||
|
||||
[sub_resource type="Gradient" id="Gradient_u5tnr"]
|
||||
offsets = PackedFloat32Array(0, 0.933649, 1)
|
||||
colors = PackedColorArray(0, 0, 0, 1, 0.938186, 0.874428, 0.818076, 1, 1, 1, 1, 1)
|
||||
|
||||
[sub_resource type="GradientTexture1D" id="GradientTexture1D_ri0vy"]
|
||||
gradient = SubResource("Gradient_u5tnr")
|
||||
|
||||
[resource]
|
||||
background_mode = 3
|
||||
glow_enabled = true
|
||||
glow_intensity = 4.0
|
||||
adjustment_enabled = true
|
||||
adjustment_saturation = 0.75
|
||||
adjustment_color_correction = SubResource("GradientTexture1D_ri0vy")
|
|
@ -1,4 +1,4 @@
|
|||
[gd_scene load_steps=94 format=4 uid="uid://dr3bcvql7burk"]
|
||||
[gd_scene load_steps=96 format=4 uid="uid://dr3bcvql7burk"]
|
||||
|
||||
[ext_resource type="PackedScene" uid="uid://clwv2owvk6abe" path="res://Scenes/BaseMap.tscn" id="1_ci4ij"]
|
||||
[ext_resource type="TileSet" uid="uid://l61kbx31ug4p" path="res://Scenes/Maps/ArenaTileset.tres" id="2_m6h7j"]
|
||||
|
@ -42,7 +42,6 @@
|
|||
[ext_resource type="Script" path="res://addons/phantom_camera/scripts/phantom_camera/phantom_camera_2d.gd" id="39_48cwk"]
|
||||
[ext_resource type="Script" path="res://BoundingBoxes/CameraTrigger.cs" id="39_50gr5"]
|
||||
[ext_resource type="Script" path="res://addons/phantom_camera/scripts/resources/tween_resource.gd" id="40_h1ykh"]
|
||||
[ext_resource type="Environment" uid="uid://bl15544uvuppq" path="res://Scenes/Maps/ArenaEnvironment.tres" id="44_kuply"]
|
||||
[ext_resource type="Script" path="res://BoundingBoxes/OcclusionTrigger.cs" id="44_oj3d3"]
|
||||
|
||||
[sub_resource type="Gradient" id="Gradient_jupxw"]
|
||||
|
@ -364,6 +363,21 @@ agent_radius = 8.0
|
|||
[sub_resource type="RectangleShape2D" id="RectangleShape2D_te7jt"]
|
||||
size = Vector2(112, 64)
|
||||
|
||||
[sub_resource type="Gradient" id="Gradient_u5tnr"]
|
||||
offsets = PackedFloat32Array(0.455224, 1)
|
||||
|
||||
[sub_resource type="GradientTexture1D" id="GradientTexture1D_ri0vy"]
|
||||
gradient = SubResource("Gradient_u5tnr")
|
||||
|
||||
[sub_resource type="Environment" id="Environment_6j53s"]
|
||||
background_mode = 3
|
||||
tonemap_mode = 3
|
||||
glow_enabled = true
|
||||
glow_intensity = 4.0
|
||||
adjustment_enabled = true
|
||||
adjustment_saturation = 0.01
|
||||
adjustment_color_correction = SubResource("GradientTexture1D_ri0vy")
|
||||
|
||||
[sub_resource type="Gradient" id="Gradient_yn44d"]
|
||||
offsets = PackedFloat32Array(0)
|
||||
colors = PackedColorArray(0.105882, 0.0470588, 0.117647, 1)
|
||||
|
@ -1120,7 +1134,7 @@ shape = SubResource("RectangleShape2D_te7jt")
|
|||
position = Vector2(576, 431)
|
||||
|
||||
[node name="WorldEnvironment" parent="." index="7"]
|
||||
environment = ExtResource("44_kuply")
|
||||
environment = SubResource("Environment_6j53s")
|
||||
|
||||
[node name="CanvasLayer" type="CanvasLayer" parent="." index="8"]
|
||||
layer = -99
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
[gd_scene load_steps=20 format=4 uid="uid://cumi1cbg6xfdd"]
|
||||
[gd_scene load_steps=17 format=4 uid="uid://cumi1cbg6xfdd"]
|
||||
|
||||
[ext_resource type="PackedScene" uid="uid://clwv2owvk6abe" path="res://Scenes/BaseMap.tscn" id="1_oy3cp"]
|
||||
[ext_resource type="TileSet" uid="uid://dkis3rb4n62cu" path="res://Scenes/Maps/ForestTileset.tres" id="2_q0kvn"]
|
||||
|
@ -41,22 +41,11 @@ source_geometry_group_name = &"navigation"
|
|||
cell_size = 16.0
|
||||
agent_radius = 8.0
|
||||
|
||||
[sub_resource type="Gradient" id="Gradient_pc2cc"]
|
||||
offsets = PackedFloat32Array(0, 0.962085, 1)
|
||||
colors = PackedColorArray(0, 0, 0, 1, 1, 0.911833, 0.77, 1, 1, 1, 1, 1)
|
||||
|
||||
[sub_resource type="GradientTexture1D" id="GradientTexture1D_s5jwl"]
|
||||
gradient = SubResource("Gradient_pc2cc")
|
||||
|
||||
[sub_resource type="Environment" id="Environment_usobl"]
|
||||
background_mode = 3
|
||||
glow_enabled = true
|
||||
glow_hdr_threshold = 1.2
|
||||
adjustment_enabled = true
|
||||
adjustment_saturation = 0.7
|
||||
adjustment_color_correction = SubResource("GradientTexture1D_s5jwl")
|
||||
|
||||
[node name="TileMap" groups=["navigation"] instance=ExtResource("1_oy3cp")]
|
||||
[node name="TileMap" node_paths=PackedStringArray("Entities", "Areas", "Spawners", "Markers") groups=["navigation"] instance=ExtResource("1_oy3cp")]
|
||||
Entities = NodePath("Entities")
|
||||
Areas = NodePath("Areas")
|
||||
Spawners = NodePath("Spawners")
|
||||
Markers = NodePath("Markers")
|
||||
AreaName = "Forest"
|
||||
MapName = "Forest"
|
||||
|
||||
|
@ -452,8 +441,12 @@ position = Vector2(1272, 0)
|
|||
[node name="Campfire" parent="Entities" index="0" instance=ExtResource("3_ve4i2")]
|
||||
position = Vector2(-24, -8)
|
||||
|
||||
[node name="SnusDealer" parent="Entities" index="1" instance=ExtResource("12_eyny2")]
|
||||
[node name="SnusDealer" parent="Entities" index="1" node_paths=PackedStringArray("ThinkerStateMachine", "Sprite", "Inventory", "StateMachine") instance=ExtResource("12_eyny2")]
|
||||
position = Vector2(79, -6)
|
||||
ThinkerStateMachine = NodePath("Thinker")
|
||||
Sprite = NodePath("Sprites/Sprite")
|
||||
Inventory = NodePath("Inventory")
|
||||
StateMachine = NodePath("StateMachine")
|
||||
|
||||
[node name="Areas" parent="." index="4"]
|
||||
visible = false
|
||||
|
@ -463,6 +456,3 @@ navigation_polygon = SubResource("NavigationPolygon_al0u7")
|
|||
|
||||
[node name="House" type="NavigationRegion2D" parent="Areas" index="1"]
|
||||
navigation_polygon = SubResource("NavigationPolygon_8xwo5")
|
||||
|
||||
[node name="WorldEnvironment" parent="." index="7"]
|
||||
environment = SubResource("Environment_usobl")
|
||||
|
|
|
@ -76,19 +76,6 @@ public partial class GlobalState : Node
|
|||
Progression = save.Progression;
|
||||
MapState = save.MapState;
|
||||
Stats = save.Stats;
|
||||
|
||||
var inventory = World.Instance.CurrentPlayer.Inventory;
|
||||
inventory.Items = Stats.Items;
|
||||
|
||||
for (int i = 0; i < Stats.HotbarToItemIndexMap.Count; i++)
|
||||
{
|
||||
int itemIndex = Stats.HotbarToItemIndexMap[i];
|
||||
|
||||
if (itemIndex >= 0)
|
||||
{
|
||||
inventory.SetHotbarIndexToItemIndex(i, itemIndex);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void ExportToSave(Save save)
|
||||
|
@ -96,9 +83,5 @@ public partial class GlobalState : Node
|
|||
save.Progression = Progression;
|
||||
save.MapState = MapState;
|
||||
save.Stats = Stats;
|
||||
|
||||
var inventory = World.Instance.CurrentPlayer.Inventory;
|
||||
Stats.Items = inventory.Items;
|
||||
Stats.HotbarToItemIndexMap = inventory.HotbarToItemIndexMap;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
using Godot;
|
||||
using Godot.Collections;
|
||||
|
||||
namespace SupaLidlGame.State.Global;
|
||||
|
||||
|
@ -14,10 +13,4 @@ public partial class Stats : Resource
|
|||
|
||||
[Export]
|
||||
public int DeathCount { get; set; } = 0;
|
||||
|
||||
[Export]
|
||||
public Array<Items.ItemMetadata> Items { get; set; } = new();
|
||||
|
||||
[Export]
|
||||
public Array<int> HotbarToItemIndexMap { get; set; } = new();
|
||||
}
|
||||
|
|
|
@ -72,7 +72,6 @@ public partial class InventoryGrid : GridContainer
|
|||
|
||||
ItemMetadata item = items.Current;
|
||||
slot.Item = item;
|
||||
slot.Index = i;
|
||||
}
|
||||
|
||||
// make remaining slots display empty
|
||||
|
@ -81,7 +80,6 @@ public partial class InventoryGrid : GridContainer
|
|||
InventorySlot slot = children[i] as InventorySlot;
|
||||
|
||||
slot.Item = null;
|
||||
slot.Index = i;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -76,6 +76,6 @@ public partial class InventoryMenu : BaseMenu, IModal
|
|||
{
|
||||
int slot = button.GetMeta("slot").AsInt32();
|
||||
GD.Print("Equipping item at slot " + slot);
|
||||
Source.SetHotbarIndexToItemIndex(slot, _selected.Index);
|
||||
Source.SetHotbarIndexToItem(slot, _selected.Item);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -33,8 +33,6 @@ public partial class InventorySlot : Button
|
|||
|
||||
private static Texture2D _placeholderTexture;
|
||||
|
||||
public int Index { get; set; }
|
||||
|
||||
private Items.ItemMetadata _item;
|
||||
|
||||
public Items.ItemMetadata Item
|
||||
|
|
|
@ -21,12 +21,7 @@ public partial class ScenePath : ResourcePath
|
|||
|
||||
// add scene to loaded to not have to reload scene when called again
|
||||
var scene = base.Load<PackedScene>();
|
||||
|
||||
if (useCached)
|
||||
{
|
||||
_loaded.Add(Path, scene);
|
||||
}
|
||||
|
||||
return scene;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue