feat: Rewrote inventory handling basing on ESCItems (#417)
Co-authored-by: Dennis Ploeger <develop@dieploegers.de>
This commit is contained in:
10
game/items/inventory/bottle.esc
Executable file
10
game/items/inventory/bottle.esc
Executable file
@@ -0,0 +1,10 @@
|
||||
:look
|
||||
say player "It's a bottle."
|
||||
stop
|
||||
|
||||
:pickup
|
||||
inventory_add r9_bottle
|
||||
set_active r9_bottle_left false
|
||||
set_active r9_bottle_middle false
|
||||
set_active r9_bottle_right false
|
||||
|
||||
@@ -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
|
||||
}
|
||||
19
game/items/inventory/empty_sheet.esc
Executable file
19
game/items/inventory/empty_sheet.esc
Executable file
@@ -0,0 +1,19 @@
|
||||
:look
|
||||
say player "It's a sheet of blank paper."
|
||||
stop
|
||||
|
||||
:pickup
|
||||
set_global i/r5_empty_sheet true
|
||||
set_active r5_empty_sheet false
|
||||
|
||||
|
||||
# The following action is deactivated because r5_pen ESXC script holds a similar action that is configured as one-way
|
||||
# You can try to uncomment this action here and test that action will work in both ways but with slightly different execution
|
||||
#:use r5_pen
|
||||
#say player "Ok, let's write down something on this paper."
|
||||
#set_angle player 0
|
||||
#wait 2
|
||||
#set_angle player 180
|
||||
#say player "Alright! I wrote something on it."
|
||||
#set_global i/r5_empty_sheet false
|
||||
#set_global i/r5_filled_sheet true
|
||||
BIN
game/items/inventory/empty_sheet.png
Normal file
BIN
game/items/inventory/empty_sheet.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.5 KiB |
@@ -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"
|
||||
5
game/items/inventory/filled_sheet.esc
Executable file
5
game/items/inventory/filled_sheet.esc
Executable file
@@ -0,0 +1,5 @@
|
||||
:look
|
||||
say player "'Dear Escoria developer: I hope you're having fun right now!'"
|
||||
stop
|
||||
|
||||
|
||||
BIN
game/items/inventory/filled_sheet.png
Normal file
BIN
game/items/inventory/filled_sheet.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.4 KiB |
@@ -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"
|
||||
16
game/items/inventory/pen.esc
Executable file
16
game/items/inventory/pen.esc
Executable file
@@ -0,0 +1,16 @@
|
||||
:look
|
||||
say player "It's a pen."
|
||||
stop
|
||||
|
||||
:pickup
|
||||
set_global i/r5_pen true
|
||||
set_active r5_pen false
|
||||
|
||||
:use r5_empty_sheet
|
||||
say player "So, let's see..."
|
||||
#set_global i/r5_pen false
|
||||
inventory_remove r5_pen
|
||||
#set_global i/r5_empty_sheet false
|
||||
inventory_remove r5_empty_sheet
|
||||
#set_global i/r5_filled_sheet true
|
||||
inventory_add r5_filled_sheet
|
||||
BIN
game/items/inventory/pen.png
Normal file
BIN
game/items/inventory/pen.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 918 B |
@@ -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"
|
||||
29
game/items/inventory/r5_empty_sheet.tscn
Normal file
29
game/items/inventory/r5_empty_sheet.tscn
Normal file
@@ -0,0 +1,29 @@
|
||||
[gd_scene load_steps=4 format=2]
|
||||
|
||||
[ext_resource path="res://addons/escoria-core/game/core-scripts/esc_item.gd" type="Script" id=2]
|
||||
[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/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_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="."]
|
||||
rotation = 0.0218604
|
||||
scale = Vector2( 0.683022, 0.519355 )
|
||||
shape = SubResource( 1 )
|
||||
25
game/items/inventory/r5_filled_sheet.tscn
Normal file
25
game/items/inventory/r5_filled_sheet.tscn
Normal file
@@ -0,0 +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.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/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_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 )
|
||||
27
game/items/inventory/r5_pen.tscn
Normal file
27
game/items/inventory/r5_pen.tscn
Normal file
@@ -0,0 +1,27 @@
|
||||
[gd_scene load_steps=4 format=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/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_texture = ExtResource( 1 )
|
||||
dialog_color = Color( 1, 1, 1, 1 )
|
||||
animations = null
|
||||
|
||||
[node name="sprite" type="Sprite" parent="."]
|
||||
texture = ExtResource( 1 )
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
|
||||
shape = SubResource( 1 )
|
||||
27
game/items/inventory/r5_wrench.tscn
Normal file
27
game/items/inventory/r5_wrench.tscn
Normal file
@@ -0,0 +1,27 @@
|
||||
[gd_scene load_steps=4 format=2]
|
||||
|
||||
[ext_resource path="res://addons/escoria-core/game/core-scripts/esc_item.gd" type="Script" id=2]
|
||||
[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/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_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 )
|
||||
28
game/items/inventory/r9_bottle.tscn
Normal file
28
game/items/inventory/r9_bottle.tscn
Normal file
@@ -0,0 +1,28 @@
|
||||
[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://addons/escoria-core/game/core-scripts/esc_item.gd" type="Script" id=3]
|
||||
|
||||
[sub_resource type="RectangleShape2D" id=1]
|
||||
extents = Vector2( 28.3873, 74.7806 )
|
||||
|
||||
[node name="bottle" type="Area2D"]
|
||||
pause_mode = 1
|
||||
z_index = 1
|
||||
script = ExtResource( 3 )
|
||||
global_id = "r9_bottle"
|
||||
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_texture = ExtResource( 1 )
|
||||
dialog_color = Color( 1, 1, 1, 1 )
|
||||
animations = null
|
||||
|
||||
[node name="sprite" type="Sprite" parent="."]
|
||||
texture = ExtResource( 1 )
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
|
||||
shape = SubResource( 1 )
|
||||
10
game/items/inventory/wrench.esc
Executable file
10
game/items/inventory/wrench.esc
Executable file
@@ -0,0 +1,10 @@
|
||||
:look
|
||||
say player "That's a wrench on the floor." [!i/r5_wrench]
|
||||
say player "It seems even more useful now that I picked it up." [i/r5_wrench]
|
||||
stop
|
||||
|
||||
:pickup
|
||||
inventory_add r5_wrench
|
||||
set_active r5_wrench false
|
||||
|
||||
|
||||
BIN
game/items/inventory/wrench.png
Normal file
BIN
game/items/inventory/wrench.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 857 B |
@@ -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"
|
||||
Reference in New Issue
Block a user