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
}

View File

Before

Width:  |  Height:  |  Size: 1.5 KiB

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"

View File

Before

Width:  |  Height:  |  Size: 1.4 KiB

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"

View File

Before

Width:  |  Height:  |  Size: 918 B

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

View File

Before

Width:  |  Height:  |  Size: 857 B

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"

View File

@@ -7,9 +7,9 @@
[ext_resource path="res://game/rooms/room05/item_wall/item_wall.tscn" type="PackedScene" id=5]
[ext_resource path="res://addons/escoria-core/game/core-scripts/esc_room.gd" type="Script" id=6]
[ext_resource path="res://addons/escoria-core/game/core-scripts/esc_item.gd" type="Script" id=7]
[ext_resource path="res://game/items/escitems/r5_wrench.tscn" type="PackedScene" id=8]
[ext_resource path="res://game/items/escitems/r5_empty_sheet.tscn" type="PackedScene" id=9]
[ext_resource path="res://game/items/escitems/r5_pen.tscn" type="PackedScene" id=10]
[ext_resource path="res://game/items/inventory/r5_wrench.tscn" type="PackedScene" id=8]
[ext_resource path="res://game/items/inventory/r5_empty_sheet.tscn" type="PackedScene" id=9]
[ext_resource path="res://game/items/inventory/r5_pen.tscn" type="PackedScene" id=10]
[ext_resource path="res://addons/escoria-core/game/core-scripts/esc_location.gd" type="Script" id=11]
[sub_resource type="NavigationPolygon" id=1]
@@ -140,24 +140,18 @@ __meta__ = {
}
[node name="wrench" parent="Hotspots" instance=ExtResource( 8 )]
pause_mode = 1
position = Vector2( 257.269, 435.892 )
interaction_direction = 2
animations = null
[node name="Position2D" type="Position2D" parent="Hotspots/wrench"]
position = Vector2( -77.4207, 0 )
script = ExtResource( 11 )
[node name="pen" parent="Hotspots" instance=ExtResource( 10 )]
pause_mode = 1
position = Vector2( 909.908, 443.451 )
animations = null
[node name="empty_sheet" parent="Hotspots" instance=ExtResource( 9 )]
pause_mode = 1
position = Vector2( 1059.84, 440.932 )
animations = null
[node name="player_start" type="Position2D" parent="."]
position = Vector2( 76.7617, 437.649 )

View File

@@ -85,9 +85,11 @@ tracks/2/keys = {
}
[node name="closet" type="Area2D"]
pause_mode = 1
script = ExtResource( 1 )
default_action = "use"
dialog_color = Color( 1, 1, 1, 1 )
animations = null
[node name="base" type="Line2D" parent="."]
position = Vector2( 1.12247, 0 )

View File

@@ -10,7 +10,7 @@
[ext_resource path="res://game/rooms/room02/button/button.tscn" type="PackedScene" id=8]
[ext_resource path="res://game/rooms/room09/r_door.tscn" type="PackedScene" id=9]
[ext_resource path="res://game/items/textures/genericItem_color_127.png" type="Texture" id=10]
[ext_resource path="res://game/items/escitems/r9_bottle.tscn" type="PackedScene" id=11]
[ext_resource path="res://game/items/inventory/r9_bottle.tscn" type="PackedScene" id=11]
[ext_resource path="res://addons/escoria-core/game/core-scripts/esc_location.gd" type="Script" id=12]
[sub_resource type="NavigationPolygon" id=1]
@@ -95,12 +95,10 @@ position = Vector2( 1198.65, 391.058 )
script = ExtResource( 12 )
[node name="r9_closet_left" parent="Hotspots" instance=ExtResource( 5 )]
pause_mode = 1
position = Vector2( 435.233, 64.1518 )
global_id = "r9_closet_left"
esc_script = "res://game/rooms/room09/esc/closet_left.esc"
tooltip_name = "Left closet"
animations = null
[node name="Position2D" type="Position2D" parent="Hotspots/r9_closet_left"]
position = Vector2( 69.9246, 318.898 )
@@ -118,12 +116,10 @@ position = Vector2( -26.727, 543.448 )
script = ExtResource( 12 )
[node name="r9_closet_middle" parent="Hotspots" instance=ExtResource( 5 )]
pause_mode = 1
position = Vector2( 572.963, 65.2113 )
global_id = "r9_closet_middle"
esc_script = "res://game/rooms/room09/esc/closet_middle.esc"
tooltip_name = "Middle closet"
animations = null
[node name="Position2D" type="Position2D" parent="Hotspots/r9_closet_middle"]
position = Vector2( 65.6867, 317.839 )
@@ -141,12 +137,10 @@ position = Vector2( -26.727, 543.448 )
script = ExtResource( 12 )
[node name="r9_closet_right" parent="Hotspots" instance=ExtResource( 5 )]
pause_mode = 1
position = Vector2( 710.693, 66.2707 )
global_id = "r9_closet_right"
esc_script = "res://game/rooms/room09/esc/closet_right.esc"
tooltip_name = "Right closet"
animations = null
[node name="Position2D" type="Position2D" parent="Hotspots/r9_closet_right"]
position = Vector2( 64.6273, 316.779 )
@@ -194,6 +188,7 @@ esc_script = "res://game/rooms/room09/esc/stand.esc"
interaction_direction = 2
tooltip_name = "Stand"
default_action = "look"
inventory_texture = ExtResource( 10 )
dialog_color = Color( 1, 1, 1, 1 )
animations = null