#13 suite du developpement d'inventaire avec le rajout des ItemObjects, description sur le GUI, items d'exemple et corrections mineures
This commit was merged in pull request #35.
This commit is contained in:
1
common/inventory/assets/icons/scuba-diving-tank.svg
Normal file
1
common/inventory/assets/icons/scuba-diving-tank.svg
Normal file
@@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="#ffffff" class="icon icon-tabler icons-tabler-filled icon-tabler-scuba-diving-tank"><path stroke="none" d="M0 0h24v24H0z" fill="none"/><path d="M17 17v2a3 3 0 0 1 -3 3h-4a3 3 0 0 1 -3 -3v-2z" /><path d="M8 2a2 2 0 0 1 1.732 1h1.15a1.496 1.496 0 0 1 2.236 0h1.882a1 1 0 0 1 0 2l-1.883 .001a2 2 0 0 1 -.115 .116v.983a5 5 0 0 1 3.998 4.9v4h-10v-4a5 5 0 0 1 4 -4.9v-.983a2 2 0 0 1 -.117 -.116h-1.151a2 2 0 1 1 -1.732 -3.001" /></svg>
|
||||
|
After Width: | Height: | Size: 524 B |
37
common/inventory/assets/icons/scuba-diving-tank.svg.import
Normal file
37
common/inventory/assets/icons/scuba-diving-tank.svg.import
Normal file
@@ -0,0 +1,37 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://bo3o2qf3i20ke"
|
||||
path="res://.godot/imported/scuba-diving-tank.svg-d6c94087bb8fe7a9f788baf1911a56a2.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://common/inventory/assets/icons/scuba-diving-tank.svg"
|
||||
dest_files=["res://.godot/imported/scuba-diving-tank.svg-d6c94087bb8fe7a9f788baf1911a56a2.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/high_quality=false
|
||||
compress/lossy_quality=0.7
|
||||
compress/hdr_compression=1
|
||||
compress/normal_map=0
|
||||
compress/channel_pack=0
|
||||
mipmaps/generate=false
|
||||
mipmaps/limit=-1
|
||||
roughness/mode=0
|
||||
roughness/src_normal=""
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/normal_map_invert_y=false
|
||||
process/hdr_as_srgb=false
|
||||
process/hdr_clamp_exposure=false
|
||||
process/size_limit=0
|
||||
detect_3d/compress_to=1
|
||||
svg/scale=2.0
|
||||
editor/scale_with_editor_scale=false
|
||||
editor/convert_colors_with_editor_theme=false
|
||||
1
common/inventory/assets/icons/shovel.svg
Normal file
1
common/inventory/assets/icons/shovel.svg
Normal file
@@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="#ffffff" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="icon icon-tabler icons-tabler-outline icon-tabler-shovel"><path stroke="none" d="M0 0h24v24H0z" fill="none"/><path d="M17 4l3 3" /><path d="M18.5 5.5l-8 8" /><path d="M8.276 11.284l4.44 4.44a.968 .968 0 0 1 0 1.369l-2.704 2.704a4.108 4.108 0 0 1 -5.809 -5.81l2.704 -2.703a.968 .968 0 0 1 1.37 0z" /></svg>
|
||||
|
After Width: | Height: | Size: 498 B |
37
common/inventory/assets/icons/shovel.svg.import
Normal file
37
common/inventory/assets/icons/shovel.svg.import
Normal file
@@ -0,0 +1,37 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://bf6nw4onkhavr"
|
||||
path="res://.godot/imported/shovel.svg-f17d484b3a88170abdf08077458176fb.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://common/inventory/assets/icons/shovel.svg"
|
||||
dest_files=["res://.godot/imported/shovel.svg-f17d484b3a88170abdf08077458176fb.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/high_quality=false
|
||||
compress/lossy_quality=0.7
|
||||
compress/hdr_compression=1
|
||||
compress/normal_map=0
|
||||
compress/channel_pack=0
|
||||
mipmaps/generate=false
|
||||
mipmaps/limit=-1
|
||||
roughness/mode=0
|
||||
roughness/src_normal=""
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/normal_map_invert_y=false
|
||||
process/hdr_as_srgb=false
|
||||
process/hdr_clamp_exposure=false
|
||||
process/size_limit=0
|
||||
detect_3d/compress_to=1
|
||||
svg/scale=2.0
|
||||
editor/scale_with_editor_scale=false
|
||||
editor/convert_colors_with_editor_theme=false
|
||||
11
common/inventory/resources/items/shovel.tres
Normal file
11
common/inventory/resources/items/shovel.tres
Normal file
@@ -0,0 +1,11 @@
|
||||
[gd_resource type="Resource" script_class="Item" load_steps=3 format=3 uid="uid://bb8etgye1qtfx"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://bq7admu4ahs5r" path="res://common/inventory/scripts/item.gd" id="1_0wi27"]
|
||||
[ext_resource type="Texture2D" uid="uid://bf6nw4onkhavr" path="res://common/inventory/assets/icons/shovel.svg" id="1_cxwlc"]
|
||||
|
||||
[resource]
|
||||
script = ExtResource("1_0wi27")
|
||||
name = "Shovel"
|
||||
description = "Transform plants to seeds"
|
||||
icon = ExtResource("1_cxwlc")
|
||||
metadata/_custom_type_script = "uid://bq7admu4ahs5r"
|
||||
11
common/inventory/resources/items/water_can.tres
Normal file
11
common/inventory/resources/items/water_can.tres
Normal file
@@ -0,0 +1,11 @@
|
||||
[gd_resource type="Resource" script_class="Item" load_steps=3 format=3 uid="uid://dbja8xm7ehw1v"]
|
||||
|
||||
[ext_resource type="Texture2D" uid="uid://bo3o2qf3i20ke" path="res://common/inventory/assets/icons/scuba-diving-tank.svg" id="1_sy4rh"]
|
||||
[ext_resource type="Script" uid="uid://bq7admu4ahs5r" path="res://common/inventory/scripts/item.gd" id="2_aikyk"]
|
||||
|
||||
[resource]
|
||||
script = ExtResource("2_aikyk")
|
||||
name = "Water Can"
|
||||
description = "Water all plants"
|
||||
icon = ExtResource("1_sy4rh")
|
||||
metadata/_custom_type_script = "uid://bq7admu4ahs5r"
|
||||
@@ -28,11 +28,13 @@ func add_items(items_to_add: Array[Item], fillup: bool = false):
|
||||
emit_signal("inventory_changed", self)
|
||||
return true
|
||||
|
||||
func lenght() -> int:
|
||||
return len(items)
|
||||
|
||||
func get_item(ind: int = 0):
|
||||
return items[ind]
|
||||
|
||||
func get_and_remove_item(ind: int = 0):
|
||||
func pop_item(ind: int = 0):
|
||||
var item_removed: Item = items.pop_at(ind)
|
||||
emit_signal("inventory_changed", self)
|
||||
return item_removed
|
||||
|
||||
@@ -2,4 +2,11 @@ extends Resource
|
||||
class_name Item
|
||||
|
||||
@export var name: String
|
||||
@export var description: String
|
||||
@export var icon: Texture2D
|
||||
|
||||
func can_use() -> bool:
|
||||
return false
|
||||
|
||||
func use() -> bool:
|
||||
return false
|
||||
@@ -1,4 +1,11 @@
|
||||
extends Item
|
||||
class_name SeedItem
|
||||
|
||||
@export var plant_type: String
|
||||
@export var plant_type: PlantType
|
||||
|
||||
func _init():
|
||||
if plant_type:
|
||||
if plant_type.name:
|
||||
name = plant_type.name
|
||||
if plant_type.seed_texture:
|
||||
icon = plant_type.seed_texture
|
||||
Reference in New Issue
Block a user