Oier knows how to count potatoes!
This commit is contained in:
@@ -23,9 +23,10 @@ func configure() -> ESCCommandArgumentDescriptor:
|
|||||||
# Validate wether the given arguments match the command descriptor
|
# Validate wether the given arguments match the command descriptor
|
||||||
func validate(arguments: Array):
|
func validate(arguments: Array):
|
||||||
if not escoria.object_manager.has(arguments[0]):
|
if not escoria.object_manager.has(arguments[0]):
|
||||||
escoria.logger.report_errors(
|
escoria.logger.error(
|
||||||
"item_count_add: invalid object",
|
self,
|
||||||
["Object %s not registered" % arguments[0]]
|
"Object %s not registered"
|
||||||
|
% [arguments[0]]
|
||||||
)
|
)
|
||||||
return false
|
return false
|
||||||
|
|
||||||
|
|||||||
@@ -5,20 +5,19 @@ class_name ESCItemCountManager
|
|||||||
|
|
||||||
func add(global_id: String, value:= 1) -> void:
|
func add(global_id: String, value:= 1) -> void:
|
||||||
var item = get_item(global_id)
|
var item = get_item(global_id)
|
||||||
item.count = item.count + value
|
set(global_id, item.count + value)
|
||||||
updateSprite(item)
|
|
||||||
|
|
||||||
|
|
||||||
func remove(global_id: String, value:= 1) -> void:
|
func remove(global_id: String, value:= 1) -> void:
|
||||||
var item = get_item(global_id)
|
var item = get_item(global_id)
|
||||||
item.count = item.count - value
|
set(global_id, item.count - value)
|
||||||
updateSprite(item)
|
|
||||||
|
|
||||||
|
|
||||||
func set(global_id: String, value: int) -> void:
|
func set(global_id: String, value: int) -> void:
|
||||||
var item = get_item(global_id)
|
var item = get_item(global_id)
|
||||||
item.count = value
|
item.count = value
|
||||||
updateSprite(item)
|
updateSprite(item)
|
||||||
|
escoria.globals_manager.set_global(global_id, value)
|
||||||
|
|
||||||
|
|
||||||
func removeFromInventoryIfCountLessThan(global_id: String, value:= 1) -> void:
|
func removeFromInventoryIfCountLessThan(global_id: String, value:= 1) -> void:
|
||||||
@@ -42,9 +41,9 @@ func get_item(global_id: String) -> ESCItem:
|
|||||||
func updateSprite(item: ESCItemWithTooltip) -> void:
|
func updateSprite(item: ESCItemWithTooltip) -> void:
|
||||||
var child_node = item.get_node("Sprite") as Sprite
|
var child_node = item.get_node("Sprite") as Sprite
|
||||||
if not child_node is Sprite:
|
if not child_node is Sprite:
|
||||||
escoria.logger.report_errors(
|
escoria.logger.error(
|
||||||
"item_count_add: invalid sprite",
|
self,
|
||||||
["No Sprite node found"]
|
"No Sprite node found"
|
||||||
)
|
)
|
||||||
|
|
||||||
var texture_path = getCountTexturePath(item)
|
var texture_path = getCountTexturePath(item)
|
||||||
|
|||||||
@@ -1,11 +1,3 @@
|
|||||||
:action1
|
|
||||||
say player "Que patata más bonita, cómo se nota que es de la huerta."
|
|
||||||
|
|
||||||
:action2
|
|
||||||
say player "Bieen! una patata!"
|
|
||||||
set_active turno_cocina_patata false
|
|
||||||
item_count_add turno_cocina_patata
|
|
||||||
inventory_add turno_cocina_patata
|
|
||||||
|
|
||||||
:action3
|
:action3
|
||||||
say player "Que patata más bonita, cómo se nota que es de la huerta."
|
say player "Tengo que conseguir tres patatas más." [eq turno_cocina_patata 1]
|
||||||
|
say player "Ya tengo {turno_cocina_patata} patatas!" [!eq turno_cocina_patata 1]
|
||||||
|
|||||||
@@ -15,9 +15,7 @@ esc_script = "res://gymkhana/items/inventory/turno_cocina_patata.esc"
|
|||||||
inventory_texture = ExtResource( 2 )
|
inventory_texture = ExtResource( 2 )
|
||||||
dialog_color = Color( 1, 1, 1, 1 )
|
dialog_color = Color( 1, 1, 1, 1 )
|
||||||
tooltips = {
|
tooltips = {
|
||||||
"action1": "Admirar la patata",
|
"action3": "Contar las patatas",
|
||||||
"action2": "Cogerla",
|
|
||||||
"action3": "Admirar la patata",
|
|
||||||
}
|
}
|
||||||
animations = null
|
animations = null
|
||||||
count_textures = [
|
count_textures = [
|
||||||
|
|||||||
@@ -11,7 +11,7 @@
|
|||||||
[ext_resource path="res://gymkhana/rooms/turno_cocina/cocina/assets/foreground-silla.png" type="Texture" id=9]
|
[ext_resource path="res://gymkhana/rooms/turno_cocina/cocina/assets/foreground-silla.png" type="Texture" id=9]
|
||||||
[ext_resource path="res://gymkhana/items/inventory/turno_cocina_peso.tscn" type="PackedScene" id=10]
|
[ext_resource path="res://gymkhana/items/inventory/turno_cocina_peso.tscn" type="PackedScene" id=10]
|
||||||
[ext_resource path="res://gymkhana/items/inventory/turno_cocina_bol.tscn" type="PackedScene" id=11]
|
[ext_resource path="res://gymkhana/items/inventory/turno_cocina_bol.tscn" type="PackedScene" id=11]
|
||||||
[ext_resource path="res://gymkhana/items/inventory/turno_cocina_patata.tscn" type="PackedScene" id=12]
|
[ext_resource path="res://gymkhana/items/inventory/assets/turno_cocina_patata.png" type="Texture" id=13]
|
||||||
|
|
||||||
[sub_resource type="NavigationPolygon" id=3]
|
[sub_resource type="NavigationPolygon" id=3]
|
||||||
vertices = PoolVector2Array( 2398, 485, 2442, 499, 2446, 617, 2409, 597, 2283, 493, 144, 568, 3, 570, -56, 524, 111, 445, 162, 471, 229, 445, 200, 465, 252, 478, 305, 524, 273, 570, 2287, 687, 2062, 635, 2113, 565, 696, 737, 512, 591, 703, 699, 1269, 739, 1241, 699, 1502, 646, 1409, 752, 1345, 667, 1489, 627, 1347, 563, 1480, 587, 1466, 514, 1345, 505, 1382, 439, 2109, 424, 2238, 386, 1788, 325, 2018, 419, 1787, 383, 1466, 412, 1493, 479, 1305.5, 467, 1337.5, 449, 1306.5, 498 )
|
vertices = PoolVector2Array( 2398, 485, 2442, 499, 2446, 617, 2409, 597, 2283, 493, 144, 568, 3, 570, -56, 524, 111, 445, 162, 471, 229, 445, 200, 465, 252, 478, 305, 524, 273, 570, 2287, 687, 2062, 635, 2113, 565, 696, 737, 512, 591, 703, 699, 1269, 739, 1241, 699, 1502, 646, 1409, 752, 1345, 667, 1489, 627, 1347, 563, 1480, 587, 1466, 514, 1345, 505, 1382, 439, 2109, 424, 2238, 386, 1788, 325, 2018, 419, 1787, 383, 1466, 412, 1493, 479, 1305.5, 467, 1337.5, 449, 1306.5, 498 )
|
||||||
@@ -218,18 +218,47 @@ polygon = PoolVector2Array( 484, 406, 485, 421, 556, 423, 551, 415, 550, 409, 55
|
|||||||
position = Vector2( 420, 494 )
|
position = Vector2( 420, 494 )
|
||||||
script = ExtResource( 5 )
|
script = ExtResource( 5 )
|
||||||
|
|
||||||
[node name="turno_cocina_patata" parent="." instance=ExtResource( 12 )]
|
[node name="cocina_patata" type="Area2D" parent="."]
|
||||||
|
pause_mode = 1
|
||||||
position = Vector2( 2202, 343 )
|
position = Vector2( 2202, 343 )
|
||||||
rotation = -0.270526
|
rotation = -0.270526
|
||||||
scale = Vector2( 0.35, 0.35 )
|
scale = Vector2( 0.35, 0.35 )
|
||||||
z_index = 1001
|
z_index = 1001
|
||||||
|
script = ExtResource( 6 )
|
||||||
|
global_id = "cocina_patata"
|
||||||
|
esc_script = "res://gymkhana/rooms/turno_cocina/cocina/esc/patata.esc"
|
||||||
combine_when_selected_action_is_in = [ ]
|
combine_when_selected_action_is_in = [ ]
|
||||||
|
inventory_texture = ExtResource( 13 )
|
||||||
|
dialog_color = Color( 1, 1, 1, 1 )
|
||||||
|
tooltips = {
|
||||||
|
"action1": "Admirar la patata",
|
||||||
|
"action2": "Cogerla",
|
||||||
|
}
|
||||||
|
count_textures = [ {
|
||||||
|
"start": 1,
|
||||||
|
"texture": "res://gymkhana/items/inventory/assets/turno_cocina_patata.png"
|
||||||
|
}, {
|
||||||
|
"start": 2,
|
||||||
|
"texture": "res://gymkhana/items/inventory/assets/turno_cocina_dos_patatas.png"
|
||||||
|
}, {
|
||||||
|
"start": 3,
|
||||||
|
"texture": "res://gymkhana/items/inventory/assets/turno_cocina_tres_patatas.png"
|
||||||
|
}, {
|
||||||
|
"start": 4,
|
||||||
|
"texture": "res://gymkhana/items/inventory/assets/turno_cocina_cuatro_patatas.png"
|
||||||
|
} ]
|
||||||
|
animations = null
|
||||||
|
|
||||||
[node name="turno_cocina_patata_collision" type="CollisionPolygon2D" parent="turno_cocina_patata"]
|
[node name="Sprite" type="Sprite" parent="cocina_patata"]
|
||||||
|
position = Vector2( -2, 0 )
|
||||||
|
scale = Vector2( 0.5, 0.5 )
|
||||||
|
texture = ExtResource( 13 )
|
||||||
|
|
||||||
|
[node name="turno_cocina_patata_collision" type="CollisionPolygon2D" parent="cocina_patata"]
|
||||||
position = Vector2( 9.0867, -13.5233 )
|
position = Vector2( 9.0867, -13.5233 )
|
||||||
z_index = 1001
|
z_index = 1001
|
||||||
polygon = PoolVector2Array( 6.50781, 0.0583801, 20.7368, 12.8992, 7.896, 27.1279, -19.937, 31.269, -42.4258, 16.1375, -26.0684, -0.0810547 )
|
polygon = PoolVector2Array( 6.50781, 0.0583801, 20.7368, 12.8992, 7.896, 27.1279, -19.937, 31.269, -42.4258, 16.1375, -26.0684, -0.0810547 )
|
||||||
|
|
||||||
[node name="turno_cocina_patata_location" type="Position2D" parent="turno_cocina_patata"]
|
[node name="turno_cocina_patata_location" type="Position2D" parent="cocina_patata"]
|
||||||
position = Vector2( 93.1357, 65.3632 )
|
position = Vector2( 93.1357, 65.3632 )
|
||||||
script = ExtResource( 5 )
|
script = ExtResource( 5 )
|
||||||
|
|||||||
@@ -7,9 +7,10 @@ say player "No la veo pero se que hay una patata." [turno_cocina_frontal_debajo_
|
|||||||
say player "No pienso meter la mano está muy oscuro."
|
say player "No pienso meter la mano está muy oscuro."
|
||||||
stop
|
stop
|
||||||
|
|
||||||
say player "Bieen! una patata!"
|
say player "Otra patata!" [i/turno_cocina_patata]
|
||||||
item_count_add turno_cocina_patata
|
say player "Bien! La primera patata!" [!i/turno_cocina_patata]
|
||||||
inventory_add turno_cocina_patata
|
inventory_add turno_cocina_patata
|
||||||
|
item_count_add turno_cocina_patata
|
||||||
set_active cocina_debajo_sofa false
|
set_active cocina_debajo_sofa false
|
||||||
|
|
||||||
:action3 turno_cocina_frontal
|
:action3 turno_cocina_frontal
|
||||||
|
|||||||
9
gymkhana/rooms/turno_cocina/cocina/esc/patata.esc
Normal file
9
gymkhana/rooms/turno_cocina/cocina/esc/patata.esc
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
:action1
|
||||||
|
say player "Que patata más bonita, cómo se nota que es de la huerta."
|
||||||
|
|
||||||
|
:action2
|
||||||
|
say player "Otra patata!" [i/turno_cocina_patata]
|
||||||
|
say player "Bien! La primera patata!" [!i/turno_cocina_patata]
|
||||||
|
set_active cocina_patata false
|
||||||
|
inventory_add turno_cocina_patata
|
||||||
|
item_count_add turno_cocina_patata
|
||||||
Reference in New Issue
Block a user