diff --git a/src/base-environments/youth_room/youth_room.tscn b/src/base-environments/youth_room/youth_room.tscn index 3c53269..bf33672 100644 --- a/src/base-environments/youth_room/youth_room.tscn +++ b/src/base-environments/youth_room/youth_room.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=117 format=4 uid="uid://b3b0gyvklqn50"] +[gd_scene load_steps=118 format=4 uid="uid://b3b0gyvklqn50"] [ext_resource type="Script" uid="uid://bsop46tqngddc" path="res://base-environments/youth_room/youth_room.gd" id="1_aitp0"] [ext_resource type="AudioStream" uid="uid://1h6k2d8q1kw3" path="res://base-environments/youth_room/import/sounds/rain_on_window.mp3" id="2_3haaq"] @@ -851,6 +851,10 @@ _surfaces = [{ blend_shape_mode = 0 shadow_mesh = SubResource("ArrayMesh_lag5h") +[sub_resource type="CapsuleShape3D" id="CapsuleShape3D_dqyng"] +radius = 0.5600586 +height = 1.2539063 + [sub_resource type="Animation" id="Animation_xum02"] length = 0.001 tracks/0/type = "value" @@ -1877,6 +1881,13 @@ interaction = ExtResource("12_viwxf") [node name="MindBoardInteractable" parent="logic" instance=ExtResource("22_ks23q")] transform = Transform3D(-4.371126e-08, 0, -0.9999984, 0, 1, 0, 0.9999984, 0, -4.371126e-08, -0.907206, 1.17661, 1.74337) interaction = ExtResource("4_gyjxx") +billboard = false + +[node name="Frame" parent="logic/MindBoardInteractable" index="0"] +transform = Transform3D(0.99999994, 0, 3.5527137e-15, 0, 1, 0, -3.5527137e-15, 0, 0.99999994, -0.08004689, -0.023632765, 0) + +[node name="View" parent="logic/MindBoardInteractable" index="1"] +transform = Transform3D(-0.9999999, 0, -8.742278e-08, 0, 1, 0, 8.742278e-08, 0, -0.9999999, -0.08611119, 0.040526867, -0.06492537) [node name="CeilingInteractable" parent="logic" instance=ExtResource("22_ks23q")] transform = Transform3D(0.78626597, 0, 0.6178859, 0, 1, 0, -0.6178859, 0, 0.78626597, -0.13478619, 2.0720484, -0.42032808) @@ -1900,7 +1911,18 @@ transform = Transform3D(1, 0, 2.9802322e-08, 0, 1, 0, -2.9802322e-08, 0, 1, -0.0 transform = Transform3D(0.99999976, 0, 0, 0, 1, 0, 0, 0, 0.99999976, 0.10009599, -0.040801764, -0.19775379) [node name="DoorInteractable" parent="logic" instance=ExtResource("22_ks23q")] -transform = Transform3D(-0.9999984, 0, 8.7422585e-08, 0, 1, 0, -8.7422585e-08, 0, -0.9999984, 0.067167796, 1.3931, -0.954428) +transform = Transform3D(-0.9999984, 0, 8.7422585e-08, 0, 1, 0, -8.7422585e-08, 0, -0.9999984, 0.42437345, 0.9173807, -0.95442796) +billboard = false + +[node name="View" parent="logic/DoorInteractable" index="1"] +transform = Transform3D(-0.99999964, 0, -8.7422755e-08, 0, 1, 0, 8.7422755e-08, 0, -0.99999964, 0.30241805, 0.49012983, -5.9604645e-08) + +[node name="Area3D" parent="logic/DoorInteractable" index="2"] +transform = Transform3D(0.9999998, 0, 2.1316282e-14, 0, 1, 0, -2.1316282e-14, 0, 0.9999998, 0.5580833, 0.16355383, 0) + +[node name="CollisionShape3D" parent="logic/DoorInteractable/Area3D" index="0"] +transform = Transform3D(-4.371139e-08, -1, 0, 1, -4.371139e-08, 0, 0, 0, 1, -0.2322388, 0, 0) +shape = SubResource("CapsuleShape3D_dqyng") [node name="AnimationPlayer" type="AnimationPlayer" parent="."] libraries = { @@ -2162,5 +2184,7 @@ data = ExtResource("40_ea6x8") [connection signal="pressed" from="logic/UI/ending_button" to="logic/UI/ending_button" method="hide"] [connection signal="pressed" from="logic/UI/ending_button" to="logic/UI/ending" method="show"] +[editable path="logic/MindBoardInteractable"] [editable path="logic/ComicInteractable"] [editable path="logic/ClothesInteractable"] +[editable path="logic/DoorInteractable"] diff --git a/src/logic-scenes/board/card-board.gd b/src/logic-scenes/board/card-board.gd index a08ef80..8236032 100644 --- a/src/logic-scenes/board/card-board.gd +++ b/src/logic-scenes/board/card-board.gd @@ -56,7 +56,7 @@ var mementos_collected: int = 0: 4: instructions.text = "Combine cards to order your thoughts." -@onready var currently_active_node: Area2D = null: +@onready var currently_active_node: Draggable = null: set(new_node): # this makes sure no accidental context switches can happen while a card is being dragged. if not (current_context == DRAG): diff --git a/src/logic-scenes/board/card.gd b/src/logic-scenes/board/card.gd index d63fbec..bcaf79c 100644 --- a/src/logic-scenes/board/card.gd +++ b/src/logic-scenes/board/card.gd @@ -45,49 +45,50 @@ var transfor_arr: Array[Transform2D] = [ @export_range(1, 2) var scale_bump: float = 1.05 @export_range(1.0, 10.0) var bounce_speed: float = 5 @export_range(1.0, 2.0) var highlight_brightness: float = 1.4 -@export var highlighted: bool = false: - set(highlight): - if highlight != highlighted: - highlighted = highlight - if is_inside_tree() and is_node_ready(): - if scale_tween: scale_tween.kill() - if wiggle_tween: wiggle_tween.kill() - if brightness_tween: brightness_tween.kill() - if highlighted: - scale_tween = get_tree().create_tween() - scale_tween.tween_property(self, "scale", Vector2(scale_bump, scale_bump), 0.1) - wiggle_tween = get_tree().create_tween() - wiggle_tween.tween_property(self, "wiggle_intensity", 1, 0.2) - brightness_tween = get_tree().create_tween() - brightness_tween.set_parallel(true) - brightness_tween.tween_property(background_sprite, "modulate", Color(highlight_brightness, highlight_brightness, highlight_brightness), 0.15) - brightness_tween.tween_property(label, "modulate", Color(highlight_brightness, highlight_brightness, highlight_brightness), 0.15) - else: - scale_tween = get_tree().create_tween() - scale_tween.tween_property(self, "scale", Vector2(1, 1), 0.3) - wiggle_tween = get_tree().create_tween() - wiggle_tween.tween_property(self, "wiggle_intensity", 0, 0.5) - brightness_tween = get_tree().create_tween() - brightness_tween.set_parallel(true) - brightness_tween.tween_property(background_sprite, "modulate", Color.WHITE, 0.2) - brightness_tween.tween_property(label, "modulate", Color.WHITE, 0.2) +## Override set_highlight to add visual feedback for cards +func set_highlight(value: bool) -> void: + if value != _highlighted: + _highlighted = value + + if is_inside_tree() and is_node_ready(): + if scale_tween: scale_tween.kill() + if wiggle_tween: wiggle_tween.kill() + if brightness_tween: brightness_tween.kill() + if _highlighted: + scale_tween = get_tree().create_tween() + scale_tween.tween_property(self, "scale", Vector2(scale_bump, scale_bump), 0.1) + wiggle_tween = get_tree().create_tween() + wiggle_tween.tween_property(self, "wiggle_intensity", 1, 0.2) + brightness_tween = get_tree().create_tween() + brightness_tween.set_parallel(true) + brightness_tween.tween_property(background_sprite, "modulate", Color(highlight_brightness, highlight_brightness, highlight_brightness), 0.15) + brightness_tween.tween_property(label, "modulate", Color(highlight_brightness, highlight_brightness, highlight_brightness), 0.15) else: - if highlighted: - scale = Vector2(scale_bump, scale_bump) - wiggle_intensity = 1 - if background_sprite: - background_sprite.modulate = Color(highlight_brightness, highlight_brightness, highlight_brightness) - if label: - label.modulate = Color(highlight_brightness, highlight_brightness, highlight_brightness) - else: - scale = Vector2(1,1) - wiggle_intensity = 0 - if background_sprite: - background_sprite.modulate = Color.WHITE - if label: - label.modulate = Color.WHITE - + scale_tween = get_tree().create_tween() + scale_tween.tween_property(self, "scale", Vector2(1, 1), 0.3) + wiggle_tween = get_tree().create_tween() + wiggle_tween.tween_property(self, "wiggle_intensity", 0, 0.5) + brightness_tween = get_tree().create_tween() + brightness_tween.set_parallel(true) + brightness_tween.tween_property(background_sprite, "modulate", Color.WHITE, 0.2) + brightness_tween.tween_property(label, "modulate", Color.WHITE, 0.2) + else: + if _highlighted: + scale = Vector2(scale_bump, scale_bump) + wiggle_intensity = 1 + if background_sprite: + background_sprite.modulate = Color(highlight_brightness, highlight_brightness, highlight_brightness) + if label: + label.modulate = Color(highlight_brightness, highlight_brightness, highlight_brightness) + else: + scale = Vector2(1,1) + wiggle_intensity = 0 + if background_sprite: + background_sprite.modulate = Color.WHITE + if label: + label.modulate = Color.WHITE + @export var voice_line: AudioStream = null @export var is_dragable: bool = false @export var diameter := 336.0 @@ -104,7 +105,7 @@ var transfor_arr: Array[Transform2D] = [ card_fire.material.set_shader_parameter("fire_progression", 0) background_sprite.material = null remove_child(card_fire) - + burn_progress = burn if background_sprite != null and card_fire != null and burn_progress > 0: background_sprite.material.set_shader_parameter("fire_progression", burn_progress) @@ -151,58 +152,58 @@ var mouse_offset: Vector2 func init(card_name: String = "card", own_id:StringName = "-1") -> void: if card_name != "c_void": text = card_name - if !card_name.begins_with("c"): + if !card_name.begins_with("c"): push_error("Illegal card.") card_id = own_id name = card_name - + func _ready(): input_event.connect(_on_input_event) - - _handle_wiggle(0) + + _handle_wiggle(0) _on_text_updated.call_deferred() func _on_text_updated(): if is_node_ready(): var curr_frame := text.hash() % background_sprite.sprite_frames.get_frame_count(background_sprite.animation) background_sprite.frame = curr_frame - + if text == "": if background_sprite.get_child_count() == 0: background_sprite.add_child(load("res://logic-scenes/board/void_stuff.tscn").instantiate(), false, Node.INTERNAL_MODE_DISABLED) else: if background_sprite.get_child_count() > 0: background_sprite.get_child(0).queue_free() - + label.text = text - + wiggle_pos = float(text.hash() % 100) - + label.rotation = deg_to_rad(transfor_arr[curr_frame].get_rotation()) #label.position = transfor_arr[curr_frame].origin - + burn_progress = burn_progress - + if not Engine.is_editor_hint(): _handle_wiggle(0) func _process(delta: float) -> void: if highlighted: _handle_wiggle(delta) - + if get_overlapping_areas().size() > 0 and is_dragable: for area in get_overlapping_areas(): if area is Card: - if not (area.highlighted or self.highlighted) and area.is_dragable: + if not (area.highlighted or self.highlighted) and area.is_dragable: var diff:Vector2 = position - area.position position -= diff.normalized() * ((diff.length()-diameter)/diameter) * bounce_speed * (delta/(1.0/60)) - + _move_card() func _handle_wiggle(delta): wiggle_pos += delta * wiggle_speed * wiggle_intensity - + rotation = noise.get_noise_1d(wiggle_pos)*wiggle_strength @@ -243,7 +244,7 @@ func get_attached_sticky_note() -> StickyNote: if child is StickyNote: return child return null - + func preview_sticky_note(sticky_note: StickyNote): if not is_instance_valid(sticky_note): @@ -260,7 +261,7 @@ func preview_sticky_note(sticky_note: StickyNote): func attach_sticky_note(sticky_note: StickyNote) -> bool: if has_sticky_note_attached(): return false - + sticky_note.reparent(self) sticky_note.position = sticky_note_position sticky_note.on_board = false @@ -268,15 +269,15 @@ func attach_sticky_note(sticky_note: StickyNote) -> bool: current_sticky_note = sticky_note #var former_parent = sticky_note.attached_to sticky_note.attached_to = self - + if name == "c_hit" and sticky_note.name == "c_effort" and Steamworks.has_initialized: Steam.setAchievement("FIGHT_FOR_GOOD") Steam.storeStats() - + return true func remove_sticky_note() -> StickyNote: - var former_child:StickyNote = get_attached_sticky_note() + var former_child:StickyNote = get_attached_sticky_note() current_sticky_note = null former_child.reparent(get_parent()) former_child.owner = self.owner @@ -316,7 +317,7 @@ func can_accept_drop(draggable: Draggable) -> bool: func handle_drop(draggable: StickyNote) -> int: if not can_accept_drop(draggable): return Draggable.DropResult.REJECTED - + if has_sticky_note_attached(): # Exchange: remove current, attach new, store old for retrieval _last_exchanged_sticky = exchange_sticky_note_with(draggable) diff --git a/src/logic-scenes/board/draggable.gd b/src/logic-scenes/board/draggable.gd index 8a9a13d..15df1fd 100644 --- a/src/logic-scenes/board/draggable.gd +++ b/src/logic-scenes/board/draggable.gd @@ -21,6 +21,19 @@ var is_dragged: bool = false: is_dragged = dragged z_index = int(dragged) +## Internal highlighted state - do not set directly, use set_highlight() +var _highlighted: bool = false + +## Public highlighted property - use for reading state +var highlighted: bool: + get: return _highlighted + set(value): set_highlight(value) + +## Sets the highlight state - override in subclasses for visual feedback +## Base implementation just updates the internal state +func set_highlight(value: bool) -> void: + _highlighted = value + ## Margin from screen edges when confining to screen bounds @export var screen_margin: float = 50.0 diff --git a/src/logic-scenes/board/sticky-note.gd b/src/logic-scenes/board/sticky-note.gd index 3aeca12..2ef05ab 100644 --- a/src/logic-scenes/board/sticky-note.gd +++ b/src/logic-scenes/board/sticky-note.gd @@ -31,29 +31,30 @@ var label: Label @export var shift_by: Vector2 = Vector2(-32, 0) @export_color_no_alpha var highlight_color: Color = Color(1.5, 1.5, 1.5) -@export var highlighted: bool = false: - set(highlight): - if highlight != highlighted: - highlighted = highlight - if is_inside_tree() and is_node_ready(): - if modulate_tween: modulate_tween.kill() - if shift_tween: shift_tween.kill() - if highlighted: - modulate_tween = get_tree().create_tween() - modulate_tween.tween_property(self, "modulate", highlight_color, 0.1) - shift_tween = get_tree().create_tween() - shift_tween.tween_property(content, "position", shift_by, 0.2) - else: - modulate_tween = get_tree().create_tween() - modulate_tween.tween_property(self, "modulate", Color(1, 1, 1), 0.3) - shift_tween = get_tree().create_tween() - shift_tween.tween_property(content, "position", Vector2.ZERO, 0.5) +## Override set_highlight to add visual feedback for sticky notes +func set_highlight(value: bool) -> void: + if value != _highlighted: + _highlighted = value + + if is_inside_tree() and is_node_ready(): + if modulate_tween: modulate_tween.kill() + if shift_tween: shift_tween.kill() + if _highlighted: + modulate_tween = get_tree().create_tween() + modulate_tween.tween_property(self, "modulate", highlight_color, 0.1) + shift_tween = get_tree().create_tween() + shift_tween.tween_property(content, "position", shift_by, 0.2) else: - if highlighted: - modulate = Color(1, 1, 1) - else: - modulate = Color(1, 1, 1) + modulate_tween = get_tree().create_tween() + modulate_tween.tween_property(self, "modulate", Color(1, 1, 1), 0.3) + shift_tween = get_tree().create_tween() + shift_tween.tween_property(content, "position", Vector2.ZERO, 0.5) + else: + if _highlighted: + modulate = Color(1, 1, 1) + else: + modulate = Color(1, 1, 1) @export var voice_line: AudioStream = null @export var is_dragable: bool = false diff --git a/src/logic-scenes/card_picker/card_picker.gd b/src/logic-scenes/card_picker/card_picker.gd index 86d7e1f..52edc90 100644 --- a/src/logic-scenes/card_picker/card_picker.gd +++ b/src/logic-scenes/card_picker/card_picker.gd @@ -51,7 +51,7 @@ signal cards_picked(cardnames: Array[String]) # Called when the node enters the scene tree for the first time. func _ready() -> void: if current_scene_id != Scenes.id.NONE: - pick_cards(current_scene_id, false) + pick_cards(current_scene_id) func reset(): @@ -176,7 +176,6 @@ func pick(id: int) -> void: print_debug("Randomly selected card %s" % HardCards.get_obscure_name(options[1].name)) if not (current_scene_id == Scenes.id.YOUTH_JUI_JUTSU and selection_state == CARDS_SELECTED): randomize() - # investigate if this fixes error on line 197 winning_id = randi() % options.size() - ( 1 if selection_state == POSTS_SELECTED else 0) else: winning_id = 1 if id == 0 else 0 @@ -237,22 +236,21 @@ func handle_mouse_button(button_event: InputEventMouseButton, new_selection: Nod pick(options.find(new_selection)) -func pick_cards(id: Scenes.id, repeat: bool): +func pick_cards(id: Scenes.id): current_scene_id = id - print_debug("Reached actor %s in sequence %s. Is%s repeating." % [name, Scenes.id.keys()[id], " not" if repeat else ""]) - if not repeat: - hide() - Input.mouse_mode = Input.MOUSE_MODE_VISIBLE - fill_card_slots(id) - reset() - show() - selection_state = CARDS - if id == Scenes.id.YOUTH_DRAVEN and not repeat: - $Meaning.play() - State.room.scene_player.play("intro") + hide() + Input.mouse_mode = Input.MOUSE_MODE_VISIBLE + fill_card_slots(id) + reset() + show() + selection_state = CARDS - await cards_picked - hide() - await get_tree().process_frame - State.room.save_room() + if id == Scenes.id.YOUTH_DRAVEN: + $Meaning.play() + State.room.scene_player.play("intro") + + await cards_picked + hide() + await get_tree().process_frame + State.room.save_room() diff --git a/src/logic-scenes/collectable/collectable_ui.gd b/src/logic-scenes/collectable/collectable_ui.gd index 970761f..2217772 100644 --- a/src/logic-scenes/collectable/collectable_ui.gd +++ b/src/logic-scenes/collectable/collectable_ui.gd @@ -187,7 +187,7 @@ func collect_memento() -> void: if interaction_ui is StoryPlayable: # Pick the cards var picker := State.room.get_node("%Picker") as CardPicker - await picker.pick_cards(interaction_ui.scene_id, false) + await picker.pick_cards(interaction_ui.scene_id) # Hide the CanvasLayer when done canvas_layer.hide() diff --git a/src/logic-scenes/interactable/interactable.gd b/src/logic-scenes/interactable/interactable.gd index 1f55207..d3e3c86 100644 --- a/src/logic-scenes/interactable/interactable.gd +++ b/src/logic-scenes/interactable/interactable.gd @@ -26,7 +26,7 @@ var collected : bool = false: var tween: Tween = null func _ready() -> void: - assert(note and frame and canvas_layer, "Interactable must have views and frame attached") + assert(note and frame and canvas_layer, "Interactable must have views and frame attached") view.scale = Vector3.ZERO frame.modulate.a = 0 if interaction: @@ -48,15 +48,15 @@ func _player_active(value: bool) -> void: func expand() -> void: shown = true _process_billboard() - - if tween and tween.is_valid(): + + if tween and tween.is_valid(): tween.kill() else: view.scale = Vector3.ZERO note.rotation.z = -PI*0.5 # Godot angle wrapping is ... something frame.modulate = Color.TRANSPARENT frame.scale = Vector3(1.5, 1.5, 1.5) - + tween = create_tween().set_ease(Tween.EASE_OUT).set_trans(Tween.TRANS_BACK) tween.parallel().tween_property(view, "scale", Vector3.ONE, 1.0).set_delay(0.5) tween.parallel().tween_property(note, "rotation:z", 0, 0.8).set_delay(0.5) @@ -92,7 +92,7 @@ func _process_hover() -> void: func _input(event: InputEvent) -> void: if not active or not hover or not shown: return - var clicked : bool = (event.is_action_pressed("ui_accept")) or (event is InputEventMouseButton and event.pressed) + var clicked : bool = (event.is_action_pressed("ui_accept")) or (event is InputEventMouseButton and event.is_pressed()) if hover and shown and clicked: collect_memento() @@ -101,14 +101,14 @@ func play_story() -> void: var repeat := collected collected = true canvas_layer.show() - + # Check if this is a repeat playthrough var is_repeating := Scenes.is_sequence_repeating(interaction_ui.scene_id) - + # Allow room to prepare for scene (e.g., play animations) if State.room and State.room.has_method("prepare_scene_start"): await State.room.prepare_scene_start(interaction_ui.scene_id, is_repeating) - + Scenes.begin_sequence(interaction_ui.scene_id) # Play the story @@ -117,12 +117,12 @@ func play_story() -> void: # Pick the cards if not already picked if not repeat: var picker := State.room.get_node("%Picker") as CardPicker - await picker.pick_cards(interaction_ui.scene_id, false) + await picker.pick_cards(interaction_ui.scene_id) # Hide the CanvasLayer when done canvas_layer.hide() - + Scenes.end_sequence(interaction_ui.scene_id) # todo: maybe later? Scenes.player_enable.emit(true)