Add weather presentation and gameplay UI improvements

This commit is contained in:
Alexander Sellite 2026-08-13 01:31:05 -04:00
parent db6074ddfa
commit 51fa6535b6
28 changed files with 1067 additions and 61 deletions

View file

@ -99,6 +99,7 @@ var _opacity_tween: Tween
var _height_tween: Tween
var _opened: bool = false
var _available: bool = false
var _hud_hidden: bool = false
var _presentation_state := PresentationState.COMPACT
var _visible_state_before_collapse := PresentationState.COMPACT
var _panel_hovered: bool = false
@ -435,7 +436,10 @@ func _build_ui() -> void:
_history.add_theme_stylebox_override("normal", _borderless_style(Color.TRANSPARENT))
box.add_child(_history)
_status = Label.new()
_status.name = "ChatStatus"
_status.custom_minimum_size = Vector2(0, 20)
_status.size_flags_horizontal = Control.SIZE_EXPAND_FILL
_status.autowrap_mode = TextServer.AUTOWRAP_WORD_SMART
_status.hide()
_status.mouse_filter = Control.MOUSE_FILTER_IGNORE
_status.add_theme_font_override("font", UtilityPageStyle.TuffyFont)
@ -770,6 +774,8 @@ func _handle_chat_command(body: String) -> bool:
match command:
"time":
_handle_time_command(parts)
"weather":
_handle_weather_command(parts)
"":
_set_status("Enter a command after /.")
_:
@ -814,6 +820,41 @@ func _handle_time_command(parts: PackedStringArray) -> void:
close_chat()
func _handle_weather_command(parts: PackedStringArray) -> void:
if parts.size() != 2:
_set_status("Usage: /weather [clear, cloudy, rainy, foggy]")
return
if _session == null or not _session.is_host():
_set_status("Only the host can change world weather.")
return
if _world_weather == null:
_set_status("World weather is unavailable.")
return
var weather_name := String(parts[1]).to_lower()
var target_weather: WorldWeatherServiceType.Weather
match weather_name:
"clear", "sunny":
target_weather = WorldWeatherServiceType.Weather.SUNNY
weather_name = "clear"
"cloudy":
target_weather = WorldWeatherServiceType.Weather.CLOUDY
"rainy":
target_weather = WorldWeatherServiceType.Weather.RAINY
"foggy":
target_weather = WorldWeatherServiceType.Weather.FOGGY
_:
_set_status("Usage: /weather [clear, cloudy, rainy, foggy]")
return
if not _world_weather.set_authoritative_weather(target_weather):
_set_status("World weather could not be changed.")
return
_set_status("")
_service.broadcast_system_message(
"World weather set to %s." % weather_name
)
close_chat()
func _on_local_message_confirmed(message: Dictionary) -> void:
if (
not _send_pending
@ -956,6 +997,16 @@ func _refresh_visibility() -> void:
_unread_indicator.hide()
_hint.hide()
return
if _hud_hidden and not _opened:
_panel.hide()
_clock_panel.hide()
_weather_icon.hide()
_fish_finder_effect_icon.hide()
_collapse_button.hide()
_height_button.hide()
_unread_indicator.hide()
_hint.hide()
return
_clock_panel.show()
_weather_icon.show()
_fish_finder_effect_icon.visible = (
@ -1044,6 +1095,15 @@ func is_mobile_mode() -> bool:
return _mobile_mode
func set_hud_hidden(hidden: bool) -> void:
_hud_hidden = hidden
_refresh_visibility()
func is_hud_hidden() -> bool:
return _hud_hidden
func _refresh_handle_labels(state: PresentationState) -> void:
var collapsed := state == PresentationState.COLLAPSED
var height_state := _visible_state_before_collapse if collapsed else state

View file

@ -2,7 +2,7 @@
[ext_resource type="Script" path="res://ui/fishing_shop.gd" id="1_script"]
[ext_resource type="Theme" path="res://ui/game_theme.tres" id="2_theme"]
[ext_resource type="Texture2D" path="res://items/icons/placeholder/reel_speed_upgrade.svg" id="3_reel"]
[ext_resource type="Texture2D" path="res://items/icons/shop/64_speed_plus.png" id="3_reel"]
[ext_resource type="Texture2D" path="res://items/icons/shop/64_power_plus.png" id="4_barrier"]
[ext_resource type="Texture2D" path="res://items/icons/placeholder/fish_coin.svg" id="5_coin"]
[ext_resource type="Texture2D" path="res://items/icons/equipment/64_cooler_plus.png" id="6_cooler"]

View file

@ -167,6 +167,7 @@ var _bag: PlayerBagType
var _item_catalog: ItemCatalogType
var _player_menu_open: bool = false
var _gameplay_ui_enabled: bool = false
var _gameplay_hud_hidden: bool = false
var _fishing_spot: FishingSpotType
var _system_menu_open: bool = false
var _shop_open: bool = false
@ -428,6 +429,14 @@ func _input(event: InputEvent) -> void:
if _handle_controller_chat_controls(event):
get_viewport().set_input_as_handled()
return
if (
event.is_action_pressed("toggle_hud")
and not (event is InputEventKey and event.echo)
and _can_toggle_gameplay_hud()
):
set_gameplay_hud_hidden(not _gameplay_hud_hidden)
get_viewport().set_input_as_handled()
return
if (
_surface_drawing_toolbar != null
and _surface_drawing_toolbar.owns_pointer_event(event)
@ -624,6 +633,11 @@ func _on_quick_action_selected(action_id: StringName) -> void:
_toggle_surface_drawing()
&"chat":
_chat_ui.open_chat()
&"freecam":
if _player != null:
_player.toggle_free_camera()
&"hud":
set_gameplay_hud_hidden(not _gameplay_hud_hidden)
func _handle_virtual_mouse_input(event: InputEvent) -> bool:
@ -1401,6 +1415,7 @@ func _on_hud_active_bait_changed(_item_id: StringName) -> void:
func _refresh_active_bait_indicator_visibility() -> void:
_active_bait_indicator.visible = (
_gameplay_ui_enabled
and not _gameplay_hud_hidden
and not _system_menu_open
and not _player_menu_open
and not _shop_open
@ -1413,11 +1428,12 @@ func _on_hud_bait_inventory_changed() -> void:
func set_gameplay_ui_enabled(enabled: bool) -> void:
_gameplay_ui_enabled = enabled
if not enabled:
_gameplay_hud_hidden = false
_refresh_active_bait_indicator_visibility()
if enabled:
_try_start_shop_npc_speech()
_gameplay_transient_hud.visible = enabled and not _player_menu_open
_experience_presentation.visible = enabled
_refresh_gameplay_hud_visibility()
_refresh_chat_availability()
if not enabled:
_end_virtual_mouse()
@ -1448,10 +1464,50 @@ func set_gameplay_ui_enabled(enabled: bool) -> void:
call_deferred("_start_next_experience_animation")
func set_gameplay_hud_hidden(hidden: bool) -> void:
_gameplay_hud_hidden = hidden
if _quick_radial_menu != null:
_quick_radial_menu.set_hud_hidden(hidden)
_refresh_gameplay_hud_visibility()
_refresh_active_bait_indicator_visibility()
_refresh_hotbar_visibility()
_refresh_chat_availability()
func is_gameplay_hud_hidden() -> bool:
return _gameplay_hud_hidden
func _can_toggle_gameplay_hud() -> bool:
return (
_gameplay_ui_enabled
and not _system_menu_open
and not _player_menu_open
and not _shop_open
and not _chat_input_open
and not _showcase_active
and not _emote_radial_menu.is_open()
and not _quick_radial_menu.is_open()
)
func _refresh_gameplay_hud_visibility() -> void:
var show_world_hud: bool = (
_gameplay_ui_enabled
and not _gameplay_hud_hidden
and not _system_menu_open
and not _player_menu_open
and not _shop_open
)
_gameplay_transient_hud.visible = show_world_hud
_experience_presentation.visible = show_world_hud
func set_system_menu_open(is_open: bool) -> void:
_system_menu_open = is_open
if is_open and _surface_drawing != null:
_surface_drawing.deactivate()
_refresh_gameplay_hud_visibility()
_refresh_chat_availability()
_refresh_hotbar_visibility()
_hotbar_ui.set_gameplay_input_enabled(
@ -2049,7 +2105,7 @@ func _on_player_menu_visibility_changed(is_open: bool) -> void:
_end_virtual_mouse()
if is_open and _surface_drawing != null:
_surface_drawing.deactivate()
_gameplay_transient_hud.visible = _gameplay_ui_enabled and not is_open
_refresh_gameplay_hud_visibility()
if is_open:
_hotbar_ui.set_drag_enabled(false)
_hotbar_ui.set_presentation_visible(false, false)
@ -2106,6 +2162,7 @@ func _on_shop_visibility_changed(is_open: bool) -> void:
shop_backdrop_visibility_changed.emit(true)
if not is_open and _player_menu.is_shop_cooler_mounted():
_player_menu.unmount_shop_cooler()
_refresh_gameplay_hud_visibility()
_refresh_chat_availability()
_refresh_hotbar_visibility()
_hotbar_ui.set_gameplay_input_enabled(
@ -2229,6 +2286,10 @@ func _on_hotbar_presentation_transition_finished(
func _refresh_hotbar_visibility() -> void:
_hotbar_ui.set_presentation_visible(
_gameplay_ui_enabled
and (
not _gameplay_hud_hidden
or (_player_menu_open and _player_menu_hotbar_visible)
)
and not _system_menu_open
and not _shop_open
and (
@ -2250,6 +2311,7 @@ func _on_chat_text_entry_ownership_changed(active: bool) -> void:
_chat_input_open = active
if active and _surface_drawing != null:
_surface_drawing.deactivate()
_refresh_chat_availability()
_emit_interactive_pointer_ui_changed()
@ -2263,4 +2325,5 @@ func _refresh_chat_availability() -> void:
and not _shop_open
)
_chat_ui.set_available(chat_available)
_chat_ui.set_hud_hidden(_gameplay_hud_hidden and not _chat_input_open)
passive_pointer_ui_changed.emit(chat_available)

View file

@ -9,7 +9,6 @@ const BubbleButtonScene: PackedScene = preload(
const BubbleProfile: BubbleMenuProfile = preload(
"res://ui/components/bubble_menu/bubble_menu_profile.tres"
)
const SECTOR_COUNT: int = 8
const RING_RADIUS: float = 172.0
const BUBBLE_SIZE: Vector2 = Vector2(92.0, 88.0)
const CONTROLLER_SELECTION_DEADZONE: float = 0.35
@ -25,6 +24,8 @@ const ACTIONS: Array[StringName] = [
&"online",
&"paint",
&"chat",
&"freecam",
&"hud",
]
const LABELS: Array[String] = [
"stuff",
@ -35,13 +36,17 @@ const LABELS: Array[String] = [
"online",
"paint",
"chat",
"freecam",
"hide hud",
]
const SECTOR_COUNT: int = 10
var _buttons: Array[BubbleButton] = []
var _is_open: bool = false
var _selected_sector: int = 0
var _controller_selection_mode: bool = false
var _controller_mapping_manager: ControllerMappingManagerType
var _hud_hidden: bool = false
func setup_controller_mapping(
@ -58,7 +63,7 @@ func _ready() -> void:
bubble.profile = BubbleProfile
bubble.focus_mode = Control.FOCUS_NONE
bubble.mouse_filter = Control.MOUSE_FILTER_IGNORE
bubble.text = LABELS[sector]
bubble.text = _label_for_sector(sector)
add_child(bubble)
_buttons.append(bubble)
_apply_selection_styles()
@ -88,6 +93,7 @@ func open_menu(controller_selection: bool = false) -> void:
_selected_sector = 0
_controller_selection_mode = controller_selection
visible = true
_refresh_labels()
_layout_bubbles()
_apply_selection_styles()
@ -101,6 +107,22 @@ func is_open() -> bool:
return _is_open
func set_hud_hidden(hidden: bool) -> void:
_hud_hidden = hidden
_refresh_labels()
func _refresh_labels() -> void:
for sector: int in _buttons.size():
_buttons[sector].text = _label_for_sector(sector)
func _label_for_sector(sector: int) -> String:
if ACTIONS[sector] == &"hud":
return "show hud" if _hud_hidden else "hide hud"
return LABELS[sector]
func _emit_selected_action(action_id: StringName) -> void:
action_selected.emit(action_id)
@ -157,7 +179,8 @@ func _update_mouse_selection() -> void:
func _select_sector_from_offset(offset: Vector2) -> void:
var angle: float = fposmod(offset.angle() + PI * 0.5 + PI / 8.0, TAU)
var half_sector: float = TAU / (float(SECTOR_COUNT) * 2.0)
var angle: float = fposmod(offset.angle() + PI * 0.5 + half_sector, TAU)
var sector: int = int(floor(angle / (TAU / float(SECTOR_COUNT))))
if sector == _selected_sector:
return

View file

@ -124,7 +124,7 @@ text = "Tekgator"
layout_mode = 2
theme_override_colors/font_color = Color(0.624, 0.812, 0.824, 1)
theme_override_font_sizes/font_size = 15
text = "cooler-capacity and barrier-power shop icon artwork"
text = "cooler-capacity, reel-speed, and barrier-power shop icon artwork"
autowrap_mode = 2
[node name="AdditionalCredits" type="VBoxContainer" parent="Paper/Margin/Layout/Columns"]