diff --git a/scenes/game_elements/props/filling_barrel/components/filling_barrel.gd b/scenes/game_elements/props/filling_barrel/components/filling_barrel.gd index 90ef7c972..f6ee155e8 100644 --- a/scenes/game_elements/props/filling_barrel/components/filling_barrel.gd +++ b/scenes/game_elements/props/filling_barrel/components/filling_barrel.gd @@ -37,8 +37,11 @@ const FILLING_NAME_ANIMATION: StringName = &"filling" @export var color: Color: set = _set_color +var is_locked: bool = false + var _amount: int = 0 +@onready var barrel_glow: AnimatedSprite2D = $BarrelGlow @onready var animated_sprite_2d: AnimatedSprite2D = %AnimatedSprite2D @onready var animation_player: AnimationPlayer = %AnimationPlayer @onready var collision_shape_2d: CollisionShape2D = %CollisionShape2D @@ -70,10 +73,29 @@ func _ready() -> void: animated_sprite_2d.animation = FILLING_NAME_ANIMATION animated_sprite_2d.frame = 0 + if barrel_glow: + barrel_glow.visible = false + + +func set_locked_state(locked: bool) -> void: + is_locked = locked + + if is_locked: + modulate = Color(0.5, 0.5, 0.5, 1) + if barrel_glow: + barrel_glow.visible = false + else: + modulate = Color(1, 1, 1, 1) + if barrel_glow: + barrel_glow.visible = true + barrel_glow.play("glowing") + ## Increment the amount and play an animation. If completed, also play the completed ## animation and remove this barrel from the current scene. func increment(by: int = 1) -> void: + if is_locked: + return if _amount >= needed_amount: return animation_player.play(&"increment") diff --git a/scenes/game_elements/props/filling_barrel/filling_barrel.tscn b/scenes/game_elements/props/filling_barrel/filling_barrel.tscn index 1bc0eea56..7f44c0bc5 100644 --- a/scenes/game_elements/props/filling_barrel/filling_barrel.tscn +++ b/scenes/game_elements/props/filling_barrel/filling_barrel.tscn @@ -1,10 +1,82 @@ [gd_scene format=3 uid="uid://y8ha8abfyap2"] [ext_resource type="Script" uid="uid://be17wk85qlu28" path="res://scenes/game_elements/props/filling_barrel/components/filling_barrel.gd" id="1_md0e3"] +[ext_resource type="Texture2D" uid="uid://brranfy51i56n" path="res://scenes/quests/lore_quests/quest_003/2_ink_drinker_levels/components/barrel_glow/barrel_glow.png" id="3_8hqam"] [ext_resource type="SpriteFrames" uid="uid://dlsq0ke41s1yh" path="res://scenes/game_elements/props/filling_barrel/components/filling_barrel_sprite_frames.tres" id="3_o1oxn"] [ext_resource type="AudioStream" uid="uid://6tgopt072bfq" path="res://scenes/game_elements/props/filling_barrel/components/fill.wav" id="4_6inx0"] [ext_resource type="AudioStream" uid="uid://s7ne07cx0j72" path="res://scenes/game_elements/props/filling_barrel/components/complete.wav" id="5_3gtj0"] +[sub_resource type="AtlasTexture" id="AtlasTexture_ho6qg"] +atlas = ExtResource("3_8hqam") +region = Rect2(0, 0, 128, 128) + +[sub_resource type="AtlasTexture" id="AtlasTexture_ig56r"] +atlas = ExtResource("3_8hqam") +region = Rect2(128, 0, 128, 128) + +[sub_resource type="AtlasTexture" id="AtlasTexture_ompl8"] +atlas = ExtResource("3_8hqam") +region = Rect2(256, 0, 128, 128) + +[sub_resource type="AtlasTexture" id="AtlasTexture_0a20k"] +atlas = ExtResource("3_8hqam") +region = Rect2(384, 0, 128, 128) + +[sub_resource type="AtlasTexture" id="AtlasTexture_2evyj"] +atlas = ExtResource("3_8hqam") +region = Rect2(512, 0, 128, 128) + +[sub_resource type="AtlasTexture" id="AtlasTexture_i2u8c"] +atlas = ExtResource("3_8hqam") +region = Rect2(640, 0, 128, 128) + +[sub_resource type="AtlasTexture" id="AtlasTexture_fc6b6"] +atlas = ExtResource("3_8hqam") +region = Rect2(768, 0, 128, 128) + +[sub_resource type="AtlasTexture" id="AtlasTexture_haw5m"] +atlas = ExtResource("3_8hqam") +region = Rect2(896, 0, 128, 128) + +[sub_resource type="AtlasTexture" id="AtlasTexture_j04m1"] +atlas = ExtResource("3_8hqam") +region = Rect2(1024, 0, 128, 128) + +[sub_resource type="SpriteFrames" id="SpriteFrames_ftrfy"] +animations = [{ +"frames": [{ +"duration": 1.0, +"texture": SubResource("AtlasTexture_ho6qg") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_ig56r") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_ompl8") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_0a20k") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_2evyj") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_i2u8c") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_fc6b6") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_haw5m") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_j04m1") +}], +"loop": true, +"name": &"glowing", +"speed": 10.0 +}] + [sub_resource type="RectangleShape2D" id="RectangleShape2D_8tegq"] size = Vector2(52, 52) @@ -166,6 +238,13 @@ position = Vector2(0, -21) sprite_frames = ExtResource("3_o1oxn") animation = &"filling" +[node name="BarrelGlow" type="AnimatedSprite2D" parent="."] +visible = false +sprite_frames = SubResource("SpriteFrames_ftrfy") +animation = &"glowing" +frame_progress = 0.55175865 +offset = Vector2(0, -21) + [node name="HitBox" type="StaticBody2D" parent="." unique_id=1847617565] unique_name_in_owner = true position = Vector2(2, -18) diff --git a/scenes/quests/lore_quests/quest_003/2_ink_drinker_levels/components/barrel_glow/barrel_glow.png b/scenes/quests/lore_quests/quest_003/2_ink_drinker_levels/components/barrel_glow/barrel_glow.png new file mode 100644 index 000000000..72a5085ca --- /dev/null +++ b/scenes/quests/lore_quests/quest_003/2_ink_drinker_levels/components/barrel_glow/barrel_glow.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:fc7196d40c17d46a59f9edf859b75b9ebb8e9a67f8e06818e1007ce5353fb54f +size 1563 diff --git a/scenes/quests/lore_quests/quest_003/2_ink_drinker_levels/components/barrel_glow/barrel_glow.png.import b/scenes/quests/lore_quests/quest_003/2_ink_drinker_levels/components/barrel_glow/barrel_glow.png.import new file mode 100644 index 000000000..769174a68 --- /dev/null +++ b/scenes/quests/lore_quests/quest_003/2_ink_drinker_levels/components/barrel_glow/barrel_glow.png.import @@ -0,0 +1,40 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://brranfy51i56n" +path="res://.godot/imported/barrel_glow.png-05ec822d59b536030b7c5094e7b8b456.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://scenes/quests/lore_quests/quest_003/2_ink_drinker_levels/components/barrel_glow/barrel_glow.png" +dest_files=["res://.godot/imported/barrel_glow.png-05ec822d59b536030b7c5094e7b8b456.ctex"] + +[params] + +compress/mode=0 +compress/high_quality=false +compress/lossy_quality=0.7 +compress/uastc_level=0 +compress/rdo_quality_loss=0.0 +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/channel_remap/red=0 +process/channel_remap/green=1 +process/channel_remap/blue=2 +process/channel_remap/alpha=3 +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 diff --git a/scenes/quests/lore_quests/quest_003/2_ink_drinker_levels/components/barrel_unlock_sequence.gd b/scenes/quests/lore_quests/quest_003/2_ink_drinker_levels/components/barrel_unlock_sequence.gd new file mode 100644 index 000000000..5716cb04f --- /dev/null +++ b/scenes/quests/lore_quests/quest_003/2_ink_drinker_levels/components/barrel_unlock_sequence.gd @@ -0,0 +1,46 @@ +# SPDX-FileCopyrightText: The Threadbare Authors +# SPDX-License-Identifier: MPL-2.0 +class_name BarrelUnlockSequence +extends Node + +@export var barrels: Array[FillingBarrel] +@export var auto_start: bool = true + +var current_target_index: int = 0 + + +func _ready() -> void: + if auto_start: + call_deferred("start_sequence") + + +func start_sequence() -> void: + randomize() + + if barrels.is_empty(): + push_warning("BarrelUnlockSequence: No barrels assigned.") + return + + barrels.shuffle() + + for barrel in barrels: + if not barrel.completed.is_connected(_on_barrel_completed): + barrel.completed.connect(_on_barrel_completed) + + # Initial state: all locked + barrel.set_locked_state(true) + + unlock_next_barrel() + + +func unlock_next_barrel() -> void: + if current_target_index < barrels.size(): + var target: FillingBarrel = barrels[current_target_index] + + if is_instance_valid(target): + target.set_locked_state(false) + + +func _on_barrel_completed() -> void: + current_target_index += 1 + unlock_next_barrel() diff --git a/scenes/quests/lore_quests/quest_003/2_ink_drinker_levels/components/barrel_unlock_sequence.gd.uid b/scenes/quests/lore_quests/quest_003/2_ink_drinker_levels/components/barrel_unlock_sequence.gd.uid new file mode 100644 index 000000000..e91e94ca3 --- /dev/null +++ b/scenes/quests/lore_quests/quest_003/2_ink_drinker_levels/components/barrel_unlock_sequence.gd.uid @@ -0,0 +1 @@ +uid://en37d2lad0px diff --git a/scenes/quests/lore_quests/quest_003/2_ink_drinker_levels/ink_combat_round_6.tscn b/scenes/quests/lore_quests/quest_003/2_ink_drinker_levels/ink_combat_round_6.tscn index 2ddd943ac..77ac03002 100644 --- a/scenes/quests/lore_quests/quest_003/2_ink_drinker_levels/ink_combat_round_6.tscn +++ b/scenes/quests/lore_quests/quest_003/2_ink_drinker_levels/ink_combat_round_6.tscn @@ -6,6 +6,7 @@ [ext_resource type="TileSet" uid="uid://b8qnr0owsbhhn" path="res://tiles/exterior_floors.tres" id="2_g1en3"] [ext_resource type="TileSet" uid="uid://dfp36ffpanjq2" path="res://tiles/elevation.tres" id="2_s2t2y"] [ext_resource type="Script" uid="uid://cp54mgi54nywo" path="res://scenes/game_logic/fill_game_logic.gd" id="3_1a5yo"] +[ext_resource type="Script" uid="uid://en37d2lad0px" path="res://scenes/quests/lore_quests/quest_003/2_ink_drinker_levels/components/barrel_unlock_sequence.gd" id="3_ihx08"] [ext_resource type="TileSet" uid="uid://bjx3gvah0ycl1" path="res://tiles/foam_2.tres" id="5_4co4a"] [ext_resource type="TileSet" uid="uid://do0ffypatd77h" path="res://tiles/bridges.tres" id="5_bl3l0"] [ext_resource type="PackedScene" uid="uid://iu2q66clupc6" path="res://scenes/game_elements/characters/player/player.tscn" id="5_pbtyo"] @@ -63,6 +64,10 @@ metadata/_custom_type_script = "uid://bgmwplmj3bfls" [node name="BackgroundMusic" parent="." unique_id=1117240436 instance=ExtResource("1_7y6db")] stream = ExtResource("2_1a5yo") +[node name="BarrelUnlockSequence" type="Node" parent="." node_paths=PackedStringArray("barrels")] +script = ExtResource("3_ihx08") +barrels = [NodePath("../OnTheGround/FillingBarrel"), NodePath("../OnTheGround/FillingBarrel2"), NodePath("../OnTheGround/FillingBarrel3")] + [node name="FillGameLogic" type="Node" parent="." unique_id=14736843] script = ExtResource("3_1a5yo") barrels_to_win = 3