Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#88 Inventory system #94

Merged
merged 49 commits into from
Apr 25, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
49 commits
Select commit Hold shift + click to select a range
96e3bed
Added inventory manager
JonaLam Apr 10, 2024
dd5c276
Gold component
JonaLam Apr 10, 2024
6db1280
Hud
JonaLam Apr 10, 2024
b3077ce
InventoryManger and components updated
JonaLam Apr 15, 2024
74fe574
Inventory tester and HUD
JonaLam Apr 15, 2024
8256cb6
Added reset function
JonaLam Apr 15, 2024
cee1d82
Moved files for clenlyness
JonaLam Apr 15, 2024
a258c98
Added TODO comments to unfinished functions in Consumable and Relic s…
JonaLam Apr 15, 2024
6c2c496
Fixed problems relating to moving files
JonaLam Apr 15, 2024
20bbb0f
Delete InventoryTester.gd
JonaLam Apr 16, 2024
b541e2b
Updated naming around consumable components
JonaLam Apr 16, 2024
b269250
Update TestingScene.tscn
JonaLam Apr 16, 2024
02554d4
Update InventoryRelicComponent.gd
JonaLam Apr 16, 2024
c53e022
Update InventoryConsumablesComponent.gd
JonaLam Apr 16, 2024
ecfcdda
Renamed functions in consumable component for clarity
JonaLam Apr 16, 2024
eee6d6f
Fixed typo in InventoryHUDConsumableSlotComponent
JonaLam Apr 16, 2024
4ba9fa1
Made function private to make less clutter
JonaLam Apr 16, 2024
07ff07b
Update ConsumableSlot.gd
JonaLam Apr 16, 2024
cb7daae
Update InventoryHUDConsumableSlotComponent.gd
JonaLam Apr 16, 2024
07520a7
Renamed Consumable_slot to make it clear what system it's for
JonaLam Apr 16, 2024
e69cbe3
Renamed various variable to fit naming conventions
JonaLam Apr 16, 2024
2f88050
Update InventoryHUD.gd
JonaLam Apr 16, 2024
753adbb
Made Debug buttons toggle able
JonaLam Apr 16, 2024
877e0f2
Renamed relic display to make it clear what system it's appart of
JonaLam Apr 16, 2024
ee0ba31
Changed how the update relic signal works
JonaLam Apr 16, 2024
f9953ee
Renamed variable in torch component
JonaLam Apr 16, 2024
2421825
Renamed functions in the various components
JonaLam Apr 16, 2024
c9a15bf
Changes to the inventory components
JonaLam Apr 16, 2024
e1ff3f8
Comented confusing code as well as made functions which aren't used i…
JonaLam Apr 16, 2024
f2a3de2
Comented confusing code
JonaLam Apr 16, 2024
9dcad69
Resolving Merge Conflicts
JonaLam Apr 18, 2024
6c33a60
Merge branch 'main' into 88#
JonaLam Apr 18, 2024
568c4af
Prevent the game from crashing
JonaLam Apr 18, 2024
5c43bae
Renamed art assets to fit naming convention
JonaLam Apr 18, 2024
59c9afe
DEBUG_VAR
JonaLam Apr 20, 2024
c88740e
Update InventoryHudRelicComponent.gd
JonaLam Apr 20, 2024
57caee6
Fixed typos and misformating in comments
JonaLam Apr 20, 2024
9eb5443
Update InventoryConsumablesComponent.gd
JonaLam Apr 20, 2024
69debc4
Turn debug_var to false
JonaLam Apr 20, 2024
6812d41
Changed names of signals
JonaLam Apr 20, 2024
d50dd34
Create test_inventory.gd
JonaLam Apr 20, 2024
f6ff277
Merge branch 'main' into 88#
JonaLam Apr 23, 2024
d83954a
Added limit to prevent negative numbers
JonaLam Apr 23, 2024
18881c7
Added more relics for testing
JonaLam Apr 23, 2024
c57652b
Small fixes
JonaLam Apr 23, 2024
fc5c657
Add warnings if gold or torches go bellow 0
JonaLam Apr 23, 2024
3d02edc
Fixed some comments
JonaLam Apr 23, 2024
4cbd492
fixed typos
JonaLam Apr 23, 2024
13eb07f
typo
JonaLam Apr 23, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions DOCUMENTATION.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@

- [Disclaimer](#disclaimer)
- [Cards](#cards)
- [Effects](#effects)
- [Status](#status)
- [Effects](#effects)
- [Status](#status)
- [Entity](#entity)
- [Map](#map)
- [Rooms](#rooms)
- [Events](#events)
- [Light mechanic](#light-mechanic)
- [Rooms](#rooms)
- [Events](#events)
- [Light mechanic](#light-mechanic)
Turtyo marked this conversation as resolved.
Show resolved Hide resolved
- [Animation](#animation)

# Disclaimer
Expand Down
13 changes: 11 additions & 2 deletions InventoryComponents/InventoryConsumablesComponent.gd
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
class_name InventoryConsumablesComponent
Turtyo marked this conversation as resolved.
Show resolved Hide resolved

##The held_consumables array has slots with the value null so that we can [br]
## have item in for exsample slot 1 and 3 but nothing in slot 2
## Inventory Component resposible for Consumables [br]
Turtyo marked this conversation as resolved.
Show resolved Hide resolved
## There is a set amount of slots the player has and each of them can have one item, if any items are given to the player when all slots are full then they dissapear
Turtyo marked this conversation as resolved.
Show resolved Hide resolved

## The held_consumables array has slots with the value null so that we can have item in for example slot 1 and 3 but nothing in slot 2
var _held_consumables : Array[Consumable]
var _max_consumable_number : int = 4

Expand Down Expand Up @@ -85,3 +87,10 @@ func get_max_consumable_amount() -> int:

func get_held_consumables() -> Array[Consumable]:
return _held_consumables

func has_open_slots() -> bool:
for consumable_slot in _held_consumables:
if(consumable_slot == null):
return true

return false
Turtyo marked this conversation as resolved.
Show resolved Hide resolved
2 changes: 2 additions & 0 deletions InventoryComponents/InventoryGoldCompoent.gd
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
class_name InventoryGoldComponent
Turtyo marked this conversation as resolved.
Show resolved Hide resolved
Turtyo marked this conversation as resolved.
Show resolved Hide resolved

##Inventory component respisible for gold
Turtyo marked this conversation as resolved.
Show resolved Hide resolved

var _current_gold : int = 0
signal gold_changed(new_amount : int)

Expand Down
5 changes: 3 additions & 2 deletions InventoryComponents/InventoryHUD/InventoryHUD.gd
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
extends Control

## Simple script to deal with the temporary InventoryHUD

@onready var _gold_text : Label = $CanvasLayer/ColorRect/GoldText
@onready var _torch_text : Label = $CanvasLayer/ColorRect/TorchText
@onready var _relic_component : InventoryHUDRelicComponent = $CanvasLayer/ColorRect/Relics
@onready var _debug_buttons : Control = $CanvasLayer/Buttons

## sets the inventory values to display the items in the player inventory [br]
## as well as conects to signals so that they update as the inventory does
## sets the inventory values to display the items in the player inventory as well as conects to signals so that they update as the inventory does
Turtyo marked this conversation as resolved.
Show resolved Hide resolved
func _ready() -> void:
update_gold_text(InventoryManager.gold_component.get_gold_amount())
update_torch_text(InventoryManager.torch_component.get_torch_amount())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ var consumable_slot : PackedScene = preload("res://InventoryComponents/Inventory
func _ready() -> void:
_prepare_consumable_slots()

## simple function called in _ready which connects the necessary signals
func _prepare_consumable_slots()-> void:
InventoryManager.consumable_component.consumable_max_number_changed.connect(_set_consumable_slots)
InventoryManager.consumable_component.held_consumable_changed.connect(set_consumable_in_consumable_slot)
Expand Down
2 changes: 2 additions & 0 deletions InventoryComponents/InventoryHUD/InventoryHUDRelicDisplay.gd
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
extends Control
class_name InventoryHUDRelicDisplay
Turtyo marked this conversation as resolved.
Show resolved Hide resolved

## an item instanced for the iventoryHUD
Turtyo marked this conversation as resolved.
Show resolved Hide resolved

@export var textureRect : TextureRect

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
extends Control
class_name InventoryHUDRelicComponent

## HUD component which deals with the relics

var relic_display : PackedScene = preload("res://InventoryComponents/InventoryHUD/relic_display.tscn")
var relic_display_array : Array[InventoryHUDRelicDisplay]
@onready var relic_start_pos : Node = $StartPos
Expand All @@ -19,6 +21,8 @@ func add_relic_to_display(relic : Relic, is_added : bool) -> void:
_relic_array.erase(relic)
update_relic_display()


## updateds the shown relics
Turtyo marked this conversation as resolved.
Show resolved Hide resolved
func update_relic_display() -> void:
for relic_display_instance in relic_display_array:
relic_display_instance.queue_free()
Expand Down
2 changes: 2 additions & 0 deletions InventoryComponents/InventoryRelicComponent.gd
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
class_name InventoryRelicComponent

## Inventory component responisble fro relics
Turtyo marked this conversation as resolved.
Show resolved Hide resolved

var _held_relics : Array[Relic]

#is_added bool will be true if you're adding the relic and false if you're removing it
Expand Down
2 changes: 2 additions & 0 deletions InventoryComponents/InventoryTorchComponent.gd
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
class_name InventoryTorchComponent

## Inventory component responsible for torches

var _torch_amount : int = 0
signal torches_changed(new_amount : int)

Expand Down
Loading