feat: Rewrote inventory handling basing on ESCItems (#417)

Co-authored-by: Dennis Ploeger <develop@dieploegers.de>
This commit is contained in:
Dennis Ploeger
2021-10-21 21:56:25 +02:00
committed by GitHub
parent 0271046421
commit af26521d3d
35 changed files with 245 additions and 336 deletions

View File

@@ -1,13 +0,0 @@
[gd_scene load_steps=3 format=2]
[ext_resource path="res://addons/escoria-core/game/core-scripts/esc_inventory_item.gd" type="Script" id=1]
[ext_resource path="res://game/items/textures/genericItem_color_127.png" type="Texture" id=2]
[node name="bottle" type="TextureButton"]
margin_right = 50.0
margin_bottom = 140.0
texture_normal = ExtResource( 2 )
script = ExtResource( 1 )
__meta__ = {
"_edit_use_anchors_": false
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

View File

@@ -1,14 +0,0 @@
[gd_scene load_steps=3 format=2]
[ext_resource path="res://addons/escoria-core/game/core-scripts/esc_inventory_item.gd" type="Script" id=1]
[ext_resource path="res://game/items/textures/genericItem_color_038.png" type="Texture" id=2]
[node name="empty_sheet" type="TextureButton"]
margin_right = 98.0
margin_bottom = 124.0
texture_normal = ExtResource( 2 )
script = ExtResource( 1 )
__meta__ = {
"_edit_use_anchors_": false
}
global_id = "r5_empty_sheet"

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

View File

@@ -1,14 +0,0 @@
[gd_scene load_steps=3 format=2]
[ext_resource path="res://addons/escoria-core/game/core-scripts/esc_inventory_item.gd" type="Script" id=1]
[ext_resource path="res://game/rooms/room05/items/filled_sheet.png" type="Texture" id=2]
[node name="filled_sheet" type="TextureButton"]
margin_right = 88.0
margin_bottom = 124.0
texture_normal = ExtResource( 2 )
script = ExtResource( 1 )
__meta__ = {
"_edit_use_anchors_": false
}
global_id = "r5_filled_sheet"

Binary file not shown.

After

Width:  |  Height:  |  Size: 918 B

View File

@@ -1,14 +0,0 @@
[gd_scene load_steps=3 format=2]
[ext_resource path="res://game/items/textures/genericItem_color_026.png" type="Texture" id=1]
[ext_resource path="res://addons/escoria-core/game/core-scripts/esc_inventory_item.gd" type="Script" id=2]
[node name="pen" type="TextureButton"]
margin_right = 42.0
margin_bottom = 74.0
texture_normal = ExtResource( 1 )
script = ExtResource( 2 )
__meta__ = {
"_edit_use_anchors_": false
}
global_id = "r5_pen"

View File

@@ -1,23 +1,24 @@
[gd_scene load_steps=5 format=2]
[gd_scene load_steps=4 format=2]
[ext_resource path="res://game/items/inventory/empty_sheet.tscn" type="PackedScene" id=1]
[ext_resource path="res://addons/escoria-core/game/core-scripts/esc_item.gd" type="Script" id=2]
[ext_resource path="res://game/rooms/room05/items/empty_sheet.png" type="Texture" id=3]
[ext_resource path="res://game/items/inventory/empty_sheet.png" type="Texture" id=3]
[sub_resource type="RectangleShape2D" id=1]
extents = Vector2( 86.9568, 115.211 )
[node name="empty_sheet" type="Area2D"]
pause_mode = 1
script = ExtResource( 2 )
global_id = "r5_empty_sheet"
esc_script = "res://game/items/escitems/empty_sheet.esc"
esc_script = "res://game/items/inventory/empty_sheet.esc"
tooltip_name = "Empty sheet"
default_action = "look"
default_action_inventory = "look"
combine_if_action_used_among = PoolStringArray( "use", "give" )
use_from_inventory_only = true
inventory_item_scene_file = ExtResource( 1 )
inventory_texture = ExtResource( 3 )
dialog_color = Color( 1, 1, 1, 1 )
animations = null
[node name="sprite" type="Sprite" parent="."]
texture = ExtResource( 3 )

View File

@@ -1,22 +1,25 @@
[gd_scene load_steps=4 format=2]
[ext_resource path="res://addons/escoria-core/game/core-scripts/esc_item.gd" type="Script" id=1]
[ext_resource path="res://game/items/inventory/filled_sheet.tscn" type="PackedScene" id=2]
[ext_resource path="res://game/items/inventory/filled_sheet.png" type="Texture" id=3]
[sub_resource type="RectangleShape2D" id=1]
[node name="filled_sheet" type="Area2D"]
pause_mode = 1
script = ExtResource( 1 )
global_id = "r5_filled_sheet"
esc_script = "res://game/items/escitems/filled_sheet.esc"
esc_script = "res://game/items/inventory/filled_sheet.esc"
tooltip_name = "Filled sheet"
combine_if_action_used_among = PoolStringArray( "use", "give" )
combine_is_one_way = true
use_from_inventory_only = true
inventory_item_scene_file = ExtResource( 2 )
inventory_texture = ExtResource( 3 )
dialog_color = Color( 1, 1, 1, 1 )
animations = null
[node name="sprite" type="Sprite" parent="."]
texture = ExtResource( 3 )
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
shape = SubResource( 1 )

View File

@@ -1,23 +1,24 @@
[gd_scene load_steps=5 format=2]
[gd_scene load_steps=4 format=2]
[ext_resource path="res://game/rooms/room05/items/pen.png" type="Texture" id=1]
[ext_resource path="res://game/items/inventory/pen.tscn" type="PackedScene" id=2]
[ext_resource path="res://game/items/inventory/pen.png" type="Texture" id=1]
[ext_resource path="res://addons/escoria-core/game/core-scripts/esc_item.gd" type="Script" id=3]
[sub_resource type="RectangleShape2D" id=1]
extents = Vector2( 51.8881, 43.8187 )
[node name="pen" type="Area2D"]
pause_mode = 1
script = ExtResource( 3 )
global_id = "r5_pen"
esc_script = "res://game/items/escitems/pen.esc"
esc_script = "res://game/items/inventory/pen.esc"
tooltip_name = "Pen"
default_action = "look"
default_action_inventory = "look"
combine_if_action_used_among = PoolStringArray( "use", "give" )
use_from_inventory_only = true
inventory_item_scene_file = ExtResource( 2 )
inventory_texture = ExtResource( 1 )
dialog_color = Color( 1, 1, 1, 1 )
animations = null
[node name="sprite" type="Sprite" parent="."]
texture = ExtResource( 1 )

View File

@@ -1,23 +1,24 @@
[gd_scene load_steps=5 format=2]
[gd_scene load_steps=4 format=2]
[ext_resource path="res://game/items/inventory/wrench.tscn" type="PackedScene" id=1]
[ext_resource path="res://addons/escoria-core/game/core-scripts/esc_item.gd" type="Script" id=2]
[ext_resource path="res://game/rooms/room05/items/wrench.png" type="Texture" id=3]
[ext_resource path="res://game/items/inventory/wrench.png" type="Texture" id=3]
[sub_resource type="RectangleShape2D" id=1]
extents = Vector2( 44.696, 49.0953 )
[node name="wrench" type="Area2D"]
pause_mode = 1
script = ExtResource( 2 )
global_id = "r5_wrench"
esc_script = "res://game/items/escitems/wrench.esc"
esc_script = "res://game/items/inventory/wrench.esc"
tooltip_name = "Wrench"
default_action = "look"
default_action_inventory = "look"
combine_if_action_used_among = PoolStringArray( "use" )
use_from_inventory_only = true
inventory_item_scene_file = ExtResource( 1 )
inventory_texture = ExtResource( 3 )
dialog_color = Color( 1, 1, 1, 1 )
animations = null
[node name="sprite" type="Sprite" parent="."]
texture = ExtResource( 3 )

View File

@@ -1,7 +1,6 @@
[gd_scene load_steps=5 format=2]
[gd_scene load_steps=4 format=2]
[ext_resource path="res://game/items/textures/genericItem_color_127.png" type="Texture" id=1]
[ext_resource path="res://game/items/inventory/bottle.tscn" type="PackedScene" id=2]
[ext_resource path="res://addons/escoria-core/game/core-scripts/esc_item.gd" type="Script" id=3]
[sub_resource type="RectangleShape2D" id=1]
@@ -12,13 +11,13 @@ pause_mode = 1
z_index = 1
script = ExtResource( 3 )
global_id = "r9_bottle"
esc_script = "res://game/items/escitems/bottle.esc"
esc_script = "res://game/items/inventory/bottle.esc"
tooltip_name = "Bottle"
default_action = "pickup"
default_action_inventory = "look"
combine_if_action_used_among = PoolStringArray( "use" )
use_from_inventory_only = true
inventory_item_scene_file = ExtResource( 2 )
inventory_texture = ExtResource( 1 )
dialog_color = Color( 1, 1, 1, 1 )
animations = null

View File

@@ -4,7 +4,7 @@ say player "It seems even more useful now that I picked it up." [i/r5_wrench]
stop
:pickup
set_global i/r5_wrench true
inventory_add r5_wrench
set_active r5_wrench false

Binary file not shown.

After

Width:  |  Height:  |  Size: 857 B

View File

@@ -1,14 +0,0 @@
[gd_scene load_steps=3 format=2]
[ext_resource path="res://game/items/textures/genericItem_color_004.png" type="Texture" id=1]
[ext_resource path="res://addons/escoria-core/game/core-scripts/esc_inventory_item.gd" type="Script" id=2]
[node name="wrench" type="TextureButton"]
margin_right = 70.0
margin_bottom = 88.0
texture_normal = ExtResource( 1 )
script = ExtResource( 2 )
__meta__ = {
"_edit_use_anchors_": false
}
global_id = "r5_wrench"