Add fishing shop and persistent upgrades
This commit is contained in:
parent
49e7faaf84
commit
6386c5e3e3
27 changed files with 1662 additions and 38 deletions
|
|
@ -13,6 +13,9 @@ const ItemCatalogType = preload("res://items/item_catalog.gd")
|
|||
const ItemDataType = preload("res://items/item_data.gd")
|
||||
const PlayerBagType = preload("res://inventory/player_bag.gd")
|
||||
const PlayerHotbarType = preload("res://inventory/player_hotbar.gd")
|
||||
const PlayerFishingUpgradesType = preload(
|
||||
"res://progression/player_fishing_upgrades.gd"
|
||||
)
|
||||
const PlayerType = preload("res://player/player.gd")
|
||||
const FishableWaterRegionType = preload(
|
||||
"res://world/fishable_water_region.gd"
|
||||
|
|
@ -92,6 +95,7 @@ var _local_collection_log: CollectionLogType
|
|||
var _local_bag: PlayerBagType
|
||||
var _local_hotbar: PlayerHotbarType
|
||||
var _item_catalog: ItemCatalogType
|
||||
var _fishing_upgrades: PlayerFishingUpgradesType
|
||||
var _active_player: PlayerType
|
||||
var _state_time_remaining: float = 0.0
|
||||
var _cast_charge: float = 0.0
|
||||
|
|
@ -132,6 +136,7 @@ func setup(
|
|||
local_bag: PlayerBagType,
|
||||
local_hotbar: PlayerHotbarType,
|
||||
item_catalog: ItemCatalogType,
|
||||
fishing_upgrades: PlayerFishingUpgradesType,
|
||||
) -> void:
|
||||
_local_player = local_player
|
||||
_local_inventory = local_inventory
|
||||
|
|
@ -139,6 +144,7 @@ func setup(
|
|||
_local_bag = local_bag
|
||||
_local_hotbar = local_hotbar
|
||||
_item_catalog = item_catalog
|
||||
_fishing_upgrades = fishing_upgrades
|
||||
|
||||
|
||||
func can_open_player_menu() -> bool:
|
||||
|
|
@ -165,6 +171,23 @@ func can_open_system_menu() -> bool:
|
|||
)
|
||||
|
||||
|
||||
func can_open_fishing_shop() -> bool:
|
||||
return (
|
||||
_gameplay_input_enabled
|
||||
and not _external_input_blocked
|
||||
and _local_menu_input_owners.is_empty()
|
||||
and state == FishingState.READY
|
||||
)
|
||||
|
||||
|
||||
func is_ready_for_shop_transaction() -> bool:
|
||||
return (
|
||||
_gameplay_input_enabled
|
||||
and not _external_input_blocked
|
||||
and state == FishingState.READY
|
||||
)
|
||||
|
||||
|
||||
func can_change_hotbar_selection() -> bool:
|
||||
return (
|
||||
_gameplay_input_enabled
|
||||
|
|
@ -595,8 +618,16 @@ func _activate_bite() -> void:
|
|||
_presentation.begin_reeling()
|
||||
_catch_controller.start_encounter(
|
||||
_selected_fish.catch_profile,
|
||||
_active_player.reel_speed,
|
||||
_active_player.click_power
|
||||
_active_player.reel_speed * (
|
||||
_fishing_upgrades.get_reel_speed_multiplier()
|
||||
if _fishing_upgrades != null
|
||||
else 1.0
|
||||
),
|
||||
(
|
||||
_fishing_upgrades.get_barrier_damage()
|
||||
if _fishing_upgrades != null
|
||||
else _active_player.click_power
|
||||
)
|
||||
)
|
||||
_catch_controller.set_reel_input(
|
||||
Input.is_action_pressed("fish_primary")
|
||||
|
|
|
|||
|
|
@ -1,16 +1,7 @@
|
|||
[gd_resource type="Resource" script_class="ItemData" load_steps=4 format=3]
|
||||
[gd_resource type="Resource" script_class="ItemData" load_steps=3 format=3]
|
||||
|
||||
[ext_resource type="Script" path="res://items/item_data.gd" id="1_script"]
|
||||
|
||||
[sub_resource type="Gradient" id="Gradient_rod"]
|
||||
colors = PackedColorArray(0.302, 0.184, 0.11, 1, 0.957, 0.827, 0.369, 1, 0.439, 0.839, 0.82, 1)
|
||||
|
||||
[sub_resource type="GradientTexture2D" id="GradientTexture_rod"]
|
||||
gradient = SubResource("Gradient_rod")
|
||||
width = 128
|
||||
height = 128
|
||||
fill_from = Vector2(0.15, 0.85)
|
||||
fill_to = Vector2(0.85, 0.15)
|
||||
[ext_resource type="Texture2D" path="res://items/icons/placeholder/basic_fishing_rod.svg" id="2_icon"]
|
||||
|
||||
[resource]
|
||||
script = ExtResource("1_script")
|
||||
|
|
@ -18,7 +9,7 @@ item_id = &"basic_fishing_rod"
|
|||
display_name = "Basic Fishing Rod"
|
||||
description = "A dependable starter rod. Select it to cast."
|
||||
category = 0
|
||||
icon = SubResource("GradientTexture_rod")
|
||||
icon = ExtResource("2_icon")
|
||||
stackable = false
|
||||
max_stack = 1
|
||||
usable = true
|
||||
|
|
|
|||
6
items/icons/placeholder/barrier_power_upgrade.svg
Normal file
6
items/icons/placeholder/barrier_power_upgrade.svg
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64">
|
||||
<rect x="34" y="10" width="20" height="44" rx="3" fill="#f06b70" stroke="#17243a" stroke-width="5"/>
|
||||
<path d="M44 12 l-4 12 8 6 -7 10 4 12" fill="none" stroke="#fff3d4" stroke-width="4" stroke-linejoin="round"/>
|
||||
<path d="M9 10 C26 16 26 35 17 44 q-7 8 3 11" fill="none" stroke="#17243a" stroke-width="5" stroke-linecap="round"/>
|
||||
<path d="M18 55 q9-2 8-10" fill="none" stroke="#17243a" stroke-width="5" stroke-linecap="round"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 503 B |
43
items/icons/placeholder/barrier_power_upgrade.svg.import
Normal file
43
items/icons/placeholder/barrier_power_upgrade.svg.import
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://cgi121cdibqih"
|
||||
path="res://.godot/imported/barrier_power_upgrade.svg-d2005297b890ea371f8e38453bbffc4c.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://items/icons/placeholder/barrier_power_upgrade.svg"
|
||||
dest_files=["res://.godot/imported/barrier_power_upgrade.svg-d2005297b890ea371f8e38453bbffc4c.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
|
||||
svg/scale=1.0
|
||||
editor/scale_with_editor_scale=false
|
||||
editor/convert_colors_with_editor_theme=false
|
||||
9
items/icons/placeholder/basic_fishing_rod.svg
Normal file
9
items/icons/placeholder/basic_fishing_rod.svg
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64">
|
||||
<g fill="none" stroke="#17243a" stroke-width="5" stroke-linecap="round" stroke-linejoin="round">
|
||||
<path d="M13 53 L48 12"/>
|
||||
<path d="M48 12 C57 21 56 35 50 43"/>
|
||||
<path d="M50 43 q-5 7 2 9"/>
|
||||
</g>
|
||||
<rect x="8" y="47" width="14" height="8" rx="2" fill="#8b5a2b" stroke="#17243a" stroke-width="4" transform="rotate(-49 15 51)"/>
|
||||
<circle cx="29" cy="35" r="7" fill="#54c7c0" stroke="#17243a" stroke-width="4"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 493 B |
43
items/icons/placeholder/basic_fishing_rod.svg.import
Normal file
43
items/icons/placeholder/basic_fishing_rod.svg.import
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://c6krnuo5lp861"
|
||||
path="res://.godot/imported/basic_fishing_rod.svg-bc9101c1a69623deb55f1b3189ae4567.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://items/icons/placeholder/basic_fishing_rod.svg"
|
||||
dest_files=["res://.godot/imported/basic_fishing_rod.svg-bc9101c1a69623deb55f1b3189ae4567.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
|
||||
svg/scale=1.0
|
||||
editor/scale_with_editor_scale=false
|
||||
editor/convert_colors_with_editor_theme=false
|
||||
6
items/icons/placeholder/fish_coin.svg
Normal file
6
items/icons/placeholder/fish_coin.svg
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64">
|
||||
<circle cx="32" cy="32" r="26" fill="#ffd25a" stroke="#17243a" stroke-width="5"/>
|
||||
<ellipse cx="31" cy="32" rx="14" ry="9" fill="#54c7c0" stroke="#17243a" stroke-width="4"/>
|
||||
<path d="M44 32 l10-9 v18 z" fill="#54c7c0" stroke="#17243a" stroke-width="4" stroke-linejoin="round"/>
|
||||
<circle cx="25" cy="29" r="2.5" fill="#17243a"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 402 B |
43
items/icons/placeholder/fish_coin.svg.import
Normal file
43
items/icons/placeholder/fish_coin.svg.import
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://trqvs4dgd4rt"
|
||||
path="res://.godot/imported/fish_coin.svg-9d00b5918d94a555938a84ee65e06386.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://items/icons/placeholder/fish_coin.svg"
|
||||
dest_files=["res://.godot/imported/fish_coin.svg-9d00b5918d94a555938a84ee65e06386.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
|
||||
svg/scale=1.0
|
||||
editor/scale_with_editor_scale=false
|
||||
editor/convert_colors_with_editor_theme=false
|
||||
12
items/icons/placeholder/reel_speed_upgrade.svg
Normal file
12
items/icons/placeholder/reel_speed_upgrade.svg
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64">
|
||||
<g fill="none" stroke="#17243a" stroke-width="5" stroke-linecap="round" stroke-linejoin="round">
|
||||
<circle cx="25" cy="34" r="14" fill="#54c7c0"/>
|
||||
<circle cx="25" cy="34" r="4"/>
|
||||
<path d="M36 24 l8-8"/>
|
||||
<path d="M43 16 l7 7"/>
|
||||
<path d="M40 38 h16"/>
|
||||
<path d="M50 31 l7 7 -7 7"/>
|
||||
<path d="M9 14 h13"/>
|
||||
<path d="M6 23 h11"/>
|
||||
</g>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 430 B |
43
items/icons/placeholder/reel_speed_upgrade.svg.import
Normal file
43
items/icons/placeholder/reel_speed_upgrade.svg.import
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://c2hal1gkmnuqa"
|
||||
path="res://.godot/imported/reel_speed_upgrade.svg-6bce0cfdbf18895938d0bcb4850467c8.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://items/icons/placeholder/reel_speed_upgrade.svg"
|
||||
dest_files=["res://.godot/imported/reel_speed_upgrade.svg-6bce0cfdbf18895938d0bcb4850467c8.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
|
||||
svg/scale=1.0
|
||||
editor/scale_with_editor_scale=false
|
||||
editor/convert_colors_with_editor_theme=false
|
||||
65
main/main.gd
65
main/main.gd
|
|
@ -20,9 +20,14 @@ const TitleScreenType = preload("res://ui/title_screen.gd")
|
|||
const PauseMenuType = preload("res://ui/pause_menu.gd")
|
||||
const ItemCatalogType = preload("res://items/item_catalog.gd")
|
||||
const ItemDataType = preload("res://items/item_data.gd")
|
||||
const FishingShopType = preload("res://ui/fishing_shop.gd")
|
||||
const FishingShopInteractionType = preload(
|
||||
"res://world/fishing_shop_interaction.gd"
|
||||
)
|
||||
|
||||
@export var fish_catalog: FishPoolType
|
||||
@export var pelican_buyer_profile: FishBuyerProfileType
|
||||
@export var main_shop_buyer_profile: FishBuyerProfileType
|
||||
@export var item_catalog: ItemCatalogType
|
||||
|
||||
@onready var _test_world: TestWorldType = $TestWorld
|
||||
|
|
@ -34,6 +39,7 @@ const ItemDataType = preload("res://items/item_data.gd")
|
|||
@onready var _settings_manager: PlayerSettingsManagerType = %PlayerSettingsManager
|
||||
|
||||
var _gameplay_started: bool = false
|
||||
var _shop_interaction: FishingShopInteractionType
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
|
|
@ -43,6 +49,11 @@ func _ready() -> void:
|
|||
)
|
||||
_player.bag.setup(item_catalog)
|
||||
_player.hotbar.setup(_player.bag, item_catalog)
|
||||
_shop_interaction = _test_world.get_fishing_shop()
|
||||
_shop_interaction.setup_local_player(_player)
|
||||
_shop_interaction.local_player_range_changed.connect(
|
||||
_on_shop_range_changed
|
||||
)
|
||||
_save_manager.setup(
|
||||
_player.inventory,
|
||||
_player.collection_log,
|
||||
|
|
@ -50,7 +61,8 @@ func _ready() -> void:
|
|||
fish_catalog,
|
||||
_player.bag,
|
||||
_player.hotbar,
|
||||
item_catalog
|
||||
item_catalog,
|
||||
_player.fishing_upgrades
|
||||
)
|
||||
_save_manager.set_autosave_enabled(false)
|
||||
_fishing_spot.setup(
|
||||
|
|
@ -59,7 +71,8 @@ func _ready() -> void:
|
|||
_player.collection_log,
|
||||
_player.bag,
|
||||
_player.hotbar,
|
||||
item_catalog
|
||||
item_catalog,
|
||||
_player.fishing_upgrades
|
||||
)
|
||||
_game_ui.setup(
|
||||
_player,
|
||||
|
|
@ -72,7 +85,10 @@ func _ready() -> void:
|
|||
_fishing_spot,
|
||||
_player.bag,
|
||||
_player.hotbar,
|
||||
item_catalog
|
||||
item_catalog,
|
||||
main_shop_buyer_profile,
|
||||
_player.fishing_upgrades,
|
||||
_shop_interaction
|
||||
)
|
||||
_water_recovery.setup(
|
||||
_player,
|
||||
|
|
@ -135,6 +151,10 @@ func _input(event: InputEvent) -> void:
|
|||
if title_screen.visible or not _gameplay_started:
|
||||
return
|
||||
var pause_menu: PauseMenuType = _game_ui.get_pause_menu()
|
||||
var fishing_shop: FishingShopType = _game_ui.get_fishing_shop()
|
||||
if fishing_shop.consume_escape():
|
||||
get_viewport().set_input_as_handled()
|
||||
return
|
||||
if pause_menu.handle_escape():
|
||||
get_viewport().set_input_as_handled()
|
||||
return
|
||||
|
|
@ -153,6 +173,27 @@ func _input(event: InputEvent) -> void:
|
|||
get_viewport().set_input_as_handled()
|
||||
|
||||
|
||||
func _unhandled_input(event: InputEvent) -> void:
|
||||
if (
|
||||
not _gameplay_started
|
||||
or not event.is_action_pressed("interact")
|
||||
or (event is InputEventKey and event.echo)
|
||||
):
|
||||
return
|
||||
if (
|
||||
_shop_interaction != null
|
||||
and _shop_interaction.is_local_player_in_range()
|
||||
and _fishing_spot.can_open_fishing_shop()
|
||||
and _game_ui.get_fishing_shop().open_shop()
|
||||
):
|
||||
_game_ui.set_shop_prompt_visible(false)
|
||||
get_viewport().set_input_as_handled()
|
||||
|
||||
|
||||
func _process(_delta: float) -> void:
|
||||
_game_ui.set_shop_prompt_visible(_can_show_shop_prompt())
|
||||
|
||||
|
||||
func _apply_runtime_settings(settings: PlayerSettingsType) -> void:
|
||||
if settings == null:
|
||||
return
|
||||
|
|
@ -207,6 +248,7 @@ func _on_reset_progress_requested() -> void:
|
|||
func _on_water_recovery_starting() -> void:
|
||||
_game_ui.close_player_menu_for_water_recovery()
|
||||
_game_ui.get_pause_menu().close_for_water_recovery()
|
||||
_game_ui.get_fishing_shop().close_for_water_recovery()
|
||||
|
||||
|
||||
func _on_active_hotbar_item_changed(
|
||||
|
|
@ -237,3 +279,20 @@ func _on_quit_requested() -> void:
|
|||
if _gameplay_started:
|
||||
_save_manager.save_if_dirty()
|
||||
get_tree().quit()
|
||||
|
||||
|
||||
func _on_shop_range_changed(in_range: bool) -> void:
|
||||
if not in_range:
|
||||
_game_ui.get_fishing_shop().close_for_range_exit()
|
||||
_game_ui.set_shop_prompt_visible(_can_show_shop_prompt())
|
||||
|
||||
|
||||
func _can_show_shop_prompt() -> bool:
|
||||
return (
|
||||
_gameplay_started
|
||||
and _shop_interaction != null
|
||||
and _shop_interaction.is_local_player_in_range()
|
||||
and not _game_ui.get_fishing_shop().visible
|
||||
and not _water_recovery.is_recovery_active()
|
||||
and _fishing_spot.can_open_fishing_shop()
|
||||
)
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
[gd_scene load_steps=12 format=3]
|
||||
[gd_scene load_steps=13 format=3]
|
||||
|
||||
[ext_resource type="PackedScene" path="res://world/test_world.tscn" id="1_world"]
|
||||
[ext_resource type="PackedScene" path="res://player/player.tscn" id="2_player"]
|
||||
|
|
@ -11,11 +11,13 @@
|
|||
[ext_resource type="Script" path="res://save/player_save_manager.gd" id="9_save"]
|
||||
[ext_resource type="Script" path="res://settings/player_settings_manager.gd" id="10_settings"]
|
||||
[ext_resource type="Resource" path="res://items/catalog/item_catalog.tres" id="11_items"]
|
||||
[ext_resource type="Resource" path="res://economy/buyers/main_fishing_shop.tres" id="12_main_shop"]
|
||||
|
||||
[node name="Main" type="Node3D"]
|
||||
script = ExtResource("3_main")
|
||||
fish_catalog = ExtResource("6_pool")
|
||||
pelican_buyer_profile = ExtResource("7_pelicans")
|
||||
main_shop_buyer_profile = ExtResource("12_main_shop")
|
||||
item_catalog = ExtResource("11_items")
|
||||
|
||||
[node name="TestWorld" parent="." instance=ExtResource("1_world")]
|
||||
|
|
|
|||
|
|
@ -8,6 +8,9 @@ const FishSaleServiceType = preload("res://economy/fish_sale_service.gd")
|
|||
const PlayerWalletType = preload("res://economy/player_wallet.gd")
|
||||
const PlayerBagType = preload("res://inventory/player_bag.gd")
|
||||
const PlayerHotbarType = preload("res://inventory/player_hotbar.gd")
|
||||
const PlayerFishingUpgradesType = preload(
|
||||
"res://progression/player_fishing_upgrades.gd"
|
||||
)
|
||||
|
||||
class ShowcaseCameraSnapshot:
|
||||
extends RefCounted
|
||||
|
|
@ -71,6 +74,7 @@ class ShowcaseCameraSnapshot:
|
|||
@onready var fish_sale_service: FishSaleServiceType = %FishSaleService
|
||||
@onready var bag: PlayerBagType = %Bag
|
||||
@onready var hotbar: PlayerHotbarType = %Hotbar
|
||||
@onready var fishing_upgrades: PlayerFishingUpgradesType = %FishingUpgrades
|
||||
@onready var _cast_origin: Marker3D = %CastOrigin
|
||||
@onready var _fishing_rod: Node3D = %FishingRod
|
||||
@onready var _fishing_rod_tip: Marker3D = %FishingRodTip
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
[gd_scene load_steps=15 format=3]
|
||||
[gd_scene load_steps=16 format=3]
|
||||
|
||||
[ext_resource type="Script" path="res://player/player.gd" id="1_script"]
|
||||
[ext_resource type="Script" path="res://inventory/fish_inventory.gd" id="2_inventory"]
|
||||
|
|
@ -7,6 +7,7 @@
|
|||
[ext_resource type="Script" path="res://economy/fish_sale_service.gd" id="5_sale_service"]
|
||||
[ext_resource type="Script" path="res://inventory/player_bag.gd" id="6_bag"]
|
||||
[ext_resource type="Script" path="res://inventory/player_hotbar.gd" id="7_hotbar"]
|
||||
[ext_resource type="Script" path="res://progression/player_fishing_upgrades.gd" id="8_upgrades"]
|
||||
|
||||
[sub_resource type="CapsuleShape3D" id="PlayerShape"]
|
||||
radius = 0.45
|
||||
|
|
@ -98,6 +99,10 @@ script = ExtResource("6_bag")
|
|||
unique_name_in_owner = true
|
||||
script = ExtResource("7_hotbar")
|
||||
|
||||
[node name="FishingUpgrades" type="Node" parent="."]
|
||||
unique_name_in_owner = true
|
||||
script = ExtResource("8_upgrades")
|
||||
|
||||
[node name="CatchDisplayAnchor" type="Marker3D" parent="Visuals"]
|
||||
unique_name_in_owner = true
|
||||
position = Vector3(0, 1.45, -1.15)
|
||||
|
|
|
|||
|
|
@ -35,6 +35,7 @@ Zoom camera Shift + mouse wheel
|
|||
Cast / withdraw / reel Left mouse
|
||||
Cooler, Bag, and Logbook Tab
|
||||
Game Menu / back Escape
|
||||
Open Fishing Shop E while near the shop
|
||||
|
||||
FISHING
|
||||
|
||||
|
|
@ -46,6 +47,12 @@ FISHING
|
|||
- At barriers, use distinct left-click presses to damage the barrier.
|
||||
- Do not let the red chase meter catch the green meter.
|
||||
- Accessibility auto-click can be enabled in Settings.
|
||||
- Approach the bright Fishing Shop booth and press E to open it.
|
||||
- The Fishing Shop buys one Cooler fish at a time for full base value.
|
||||
- Reel Speed upgrades increase authoritative green reeling progress.
|
||||
- Barrier Power upgrades increase damage per valid barrier action.
|
||||
- Shop upgrades persist in the local progression save.
|
||||
- Escape closes shop confirmations before closing the shop itself.
|
||||
|
||||
FEATURES TO TRY
|
||||
|
||||
|
|
@ -59,6 +66,7 @@ FEATURES TO TRY
|
|||
- Cooler, Bag, Logbook, favorites, and sorting
|
||||
- Basic Fishing Rod equipment and the 1–9 hotbar
|
||||
- Pelican selling and wallet updates
|
||||
- Physical Fishing Shop sales and persistent fishing upgrades
|
||||
- Save, Continue, New Game, and Delete Save
|
||||
- Game Menu and persistent camera settings
|
||||
- Water-entry recovery from several shores
|
||||
|
|
|
|||
145
progression/player_fishing_upgrades.gd
Normal file
145
progression/player_fishing_upgrades.gd
Normal file
|
|
@ -0,0 +1,145 @@
|
|||
class_name PlayerFishingUpgrades
|
||||
extends Node
|
||||
|
||||
const PlayerWalletType = preload("res://economy/player_wallet.gd")
|
||||
|
||||
signal upgrades_changed(reel_speed_level: int, barrier_power_level: int)
|
||||
|
||||
const MAX_REEL_SPEED_LEVEL: int = 5
|
||||
const MAX_BARRIER_POWER_LEVEL: int = 3
|
||||
const REEL_SPEED_COSTS: Array[int] = [50, 125, 300, 650, 1250]
|
||||
const BARRIER_POWER_COSTS: Array[int] = [100, 275, 700]
|
||||
|
||||
var _reel_speed_level: int = 0
|
||||
var _barrier_power_level: int = 0
|
||||
|
||||
|
||||
func get_reel_speed_level() -> int:
|
||||
return _reel_speed_level
|
||||
|
||||
|
||||
func get_barrier_power_level() -> int:
|
||||
return _barrier_power_level
|
||||
|
||||
|
||||
func get_reel_speed_multiplier() -> float:
|
||||
return 1.0 + float(_reel_speed_level) * 0.10
|
||||
|
||||
|
||||
func get_barrier_damage() -> int:
|
||||
return _barrier_power_level + 1
|
||||
|
||||
|
||||
func get_next_reel_speed_cost() -> int:
|
||||
if _reel_speed_level >= MAX_REEL_SPEED_LEVEL:
|
||||
return -1
|
||||
return REEL_SPEED_COSTS[_reel_speed_level]
|
||||
|
||||
|
||||
func get_next_barrier_power_cost() -> int:
|
||||
if _barrier_power_level >= MAX_BARRIER_POWER_LEVEL:
|
||||
return -1
|
||||
return BARRIER_POWER_COSTS[_barrier_power_level]
|
||||
|
||||
|
||||
func can_purchase_reel_speed(wallet: PlayerWalletType) -> bool:
|
||||
var cost: int = get_next_reel_speed_cost()
|
||||
return wallet != null and cost >= 0 and wallet.can_afford(cost)
|
||||
|
||||
|
||||
func can_purchase_barrier_power(wallet: PlayerWalletType) -> bool:
|
||||
var cost: int = get_next_barrier_power_cost()
|
||||
return wallet != null and cost >= 0 and wallet.can_afford(cost)
|
||||
|
||||
|
||||
func purchase_reel_speed(wallet: PlayerWalletType) -> bool:
|
||||
return _purchase_level(true, wallet)
|
||||
|
||||
|
||||
func purchase_barrier_power(wallet: PlayerWalletType) -> bool:
|
||||
return _purchase_level(false, wallet)
|
||||
|
||||
|
||||
func reset_to_defaults() -> void:
|
||||
restore_levels(0, 0)
|
||||
|
||||
|
||||
func restore_levels(
|
||||
reel_speed_level: int,
|
||||
barrier_power_level: int,
|
||||
) -> bool:
|
||||
var validated_reel: int = clampi(
|
||||
reel_speed_level,
|
||||
0,
|
||||
MAX_REEL_SPEED_LEVEL
|
||||
)
|
||||
var validated_barrier: int = clampi(
|
||||
barrier_power_level,
|
||||
0,
|
||||
MAX_BARRIER_POWER_LEVEL
|
||||
)
|
||||
var changed: bool = (
|
||||
_reel_speed_level != validated_reel
|
||||
or _barrier_power_level != validated_barrier
|
||||
)
|
||||
_reel_speed_level = validated_reel
|
||||
_barrier_power_level = validated_barrier
|
||||
if changed:
|
||||
upgrades_changed.emit(
|
||||
_reel_speed_level,
|
||||
_barrier_power_level
|
||||
)
|
||||
return true
|
||||
|
||||
|
||||
func restore_from_save(data: Dictionary) -> void:
|
||||
var reel_value: Variant = data.get("reel_speed_level", 0)
|
||||
var barrier_value: Variant = data.get("barrier_power_level", 0)
|
||||
restore_levels(
|
||||
int(reel_value) if reel_value is int or reel_value is float else 0,
|
||||
int(barrier_value)
|
||||
if barrier_value is int or barrier_value is float
|
||||
else 0
|
||||
)
|
||||
|
||||
|
||||
func to_save_data() -> Dictionary:
|
||||
return {
|
||||
"reel_speed_level": _reel_speed_level,
|
||||
"barrier_power_level": _barrier_power_level,
|
||||
}
|
||||
|
||||
|
||||
func _purchase_level(
|
||||
is_reel_speed: bool,
|
||||
wallet: PlayerWalletType,
|
||||
) -> bool:
|
||||
if wallet == null:
|
||||
return false
|
||||
var current_level: int = (
|
||||
_reel_speed_level if is_reel_speed else _barrier_power_level
|
||||
)
|
||||
var maximum_level: int = (
|
||||
MAX_REEL_SPEED_LEVEL
|
||||
if is_reel_speed
|
||||
else MAX_BARRIER_POWER_LEVEL
|
||||
)
|
||||
if current_level < 0 or current_level >= maximum_level:
|
||||
return false
|
||||
var costs: Array[int] = (
|
||||
REEL_SPEED_COSTS if is_reel_speed else BARRIER_POWER_COSTS
|
||||
)
|
||||
var cost: int = costs[current_level]
|
||||
if cost < 0 or not wallet.can_afford(cost):
|
||||
return false
|
||||
if not wallet.debit(cost):
|
||||
return false
|
||||
if is_reel_speed:
|
||||
_reel_speed_level = current_level + 1
|
||||
else:
|
||||
_barrier_power_level = current_level + 1
|
||||
upgrades_changed.emit(
|
||||
_reel_speed_level,
|
||||
_barrier_power_level
|
||||
)
|
||||
return true
|
||||
1
progression/player_fishing_upgrades.gd.uid
Normal file
1
progression/player_fishing_upgrades.gd.uid
Normal file
|
|
@ -0,0 +1 @@
|
|||
uid://c6xd5laffvicg
|
||||
|
|
@ -11,8 +11,11 @@ const ItemCatalogType = preload("res://items/item_catalog.gd")
|
|||
const OwnedItemType = preload("res://items/owned_item.gd")
|
||||
const PlayerBagType = preload("res://inventory/player_bag.gd")
|
||||
const PlayerHotbarType = preload("res://inventory/player_hotbar.gd")
|
||||
const PlayerFishingUpgradesType = preload(
|
||||
"res://progression/player_fishing_upgrades.gd"
|
||||
)
|
||||
|
||||
const SAVE_VERSION: int = 2
|
||||
const SAVE_VERSION: int = 3
|
||||
const BASIC_ROD_ID: StringName = &"basic_fishing_rod"
|
||||
const SAVE_PATH: String = "user://player_save.json"
|
||||
const TEMP_PATH: String = "user://player_save.json.tmp"
|
||||
|
|
@ -29,6 +32,8 @@ class LoadSnapshot:
|
|||
var bag_items: Array[OwnedItemType] = []
|
||||
var hotbar_slots: Array[StringName] = []
|
||||
var selected_hotbar_slot: int = 0
|
||||
var reel_speed_level: int = 0
|
||||
var barrier_power_level: int = 0
|
||||
|
||||
|
||||
@export_range(0.05, 5.0, 0.05) var autosave_delay: float = 0.5
|
||||
|
|
@ -40,6 +45,7 @@ var _catalog: FishPoolType
|
|||
var _bag: PlayerBagType
|
||||
var _hotbar: PlayerHotbarType
|
||||
var _item_catalog: ItemCatalogType
|
||||
var _fishing_upgrades: PlayerFishingUpgradesType
|
||||
var _autosave_timer: Timer
|
||||
var _is_configured: bool = false
|
||||
var _is_restoring: bool = false
|
||||
|
|
@ -63,6 +69,7 @@ func setup(
|
|||
bag: PlayerBagType,
|
||||
hotbar: PlayerHotbarType,
|
||||
item_catalog: ItemCatalogType,
|
||||
fishing_upgrades: PlayerFishingUpgradesType,
|
||||
) -> void:
|
||||
_inventory = inventory
|
||||
_collection_log = collection_log
|
||||
|
|
@ -71,6 +78,7 @@ func setup(
|
|||
_bag = bag
|
||||
_hotbar = hotbar
|
||||
_item_catalog = item_catalog
|
||||
_fishing_upgrades = fishing_upgrades
|
||||
_is_configured = (
|
||||
_inventory != null
|
||||
and _collection_log != null
|
||||
|
|
@ -79,6 +87,7 @@ func setup(
|
|||
and _bag != null
|
||||
and _hotbar != null
|
||||
and _item_catalog != null
|
||||
and _fishing_upgrades != null
|
||||
)
|
||||
if not _is_configured:
|
||||
push_error("PlayerSaveManager setup is missing required references.")
|
||||
|
|
@ -101,6 +110,10 @@ func setup(
|
|||
_hotbar.selected_slot_changed.connect(
|
||||
_on_selected_hotbar_slot_changed
|
||||
)
|
||||
if not _fishing_upgrades.upgrades_changed.is_connected(
|
||||
_on_upgrades_changed
|
||||
):
|
||||
_fishing_upgrades.upgrades_changed.connect(_on_upgrades_changed)
|
||||
|
||||
|
||||
func load_player_data() -> bool:
|
||||
|
|
@ -166,6 +179,10 @@ func load_player_data() -> bool:
|
|||
snapshot.hotbar_slots,
|
||||
snapshot.selected_hotbar_slot
|
||||
)
|
||||
var upgrades_restored: bool = _fishing_upgrades.restore_levels(
|
||||
snapshot.reel_speed_level,
|
||||
snapshot.barrier_power_level
|
||||
)
|
||||
_is_restoring = false
|
||||
if (
|
||||
not inventory_restored
|
||||
|
|
@ -173,6 +190,7 @@ func load_player_data() -> bool:
|
|||
or not wallet_restored
|
||||
or not bag_restored
|
||||
or not hotbar_restored
|
||||
or not upgrades_restored
|
||||
):
|
||||
push_error("Validated player save could not be restored.")
|
||||
return false
|
||||
|
|
@ -381,6 +399,7 @@ func _build_save_dictionary() -> Dictionary:
|
|||
"selected_slot": _hotbar.get_selected_slot(),
|
||||
"slots": serialized_slots,
|
||||
},
|
||||
"upgrades": _fishing_upgrades.to_save_data(),
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -398,6 +417,13 @@ func _build_load_snapshot(save_data: Dictionary) -> LoadSnapshot:
|
|||
var inventory_data: Dictionary = save_data["inventory"]
|
||||
var bag_data: Dictionary = save_data["bag"]
|
||||
var hotbar_data: Dictionary = save_data["hotbar"]
|
||||
var upgrades_data: Dictionary = {}
|
||||
if typeof(save_data.get("upgrades")) == TYPE_DICTIONARY:
|
||||
upgrades_data = save_data["upgrades"]
|
||||
else:
|
||||
push_warning(
|
||||
"Saved fishing upgrades were missing or invalid; using defaults."
|
||||
)
|
||||
if (
|
||||
not wallet_data.has("balance")
|
||||
or typeof(collection_data.get("discovered_fish_ids")) != TYPE_ARRAY
|
||||
|
|
@ -564,6 +590,16 @@ func _build_load_snapshot(save_data: Dictionary) -> LoadSnapshot:
|
|||
0,
|
||||
PlayerHotbarType.SLOT_COUNT - 1
|
||||
)
|
||||
snapshot.reel_speed_level = _read_upgrade_level(
|
||||
upgrades_data.get("reel_speed_level"),
|
||||
PlayerFishingUpgradesType.MAX_REEL_SPEED_LEVEL,
|
||||
"reel_speed_level"
|
||||
)
|
||||
snapshot.barrier_power_level = _read_upgrade_level(
|
||||
upgrades_data.get("barrier_power_level"),
|
||||
PlayerFishingUpgradesType.MAX_BARRIER_POWER_LEVEL,
|
||||
"barrier_power_level"
|
||||
)
|
||||
return snapshot
|
||||
|
||||
|
||||
|
|
@ -573,10 +609,28 @@ func _migrate_save(
|
|||
) -> Dictionary:
|
||||
if from_version == SAVE_VERSION:
|
||||
return data
|
||||
if from_version == 1:
|
||||
var migrated: Dictionary = data.duplicate(true)
|
||||
migrated["save_version"] = SAVE_VERSION
|
||||
migrated["bag"] = {
|
||||
if from_version < 1 or from_version > SAVE_VERSION:
|
||||
return {}
|
||||
var migrated: Dictionary = data.duplicate(true)
|
||||
var current_version: int = from_version
|
||||
while current_version < SAVE_VERSION:
|
||||
match current_version:
|
||||
1:
|
||||
migrated = _migrate_version_1_to_2(migrated)
|
||||
2:
|
||||
migrated = _migrate_version_2_to_3(migrated)
|
||||
_:
|
||||
return {}
|
||||
if migrated.is_empty():
|
||||
return {}
|
||||
current_version += 1
|
||||
return migrated
|
||||
|
||||
|
||||
func _migrate_version_1_to_2(data: Dictionary) -> Dictionary:
|
||||
var migrated: Dictionary = data.duplicate(true)
|
||||
migrated["save_version"] = 2
|
||||
migrated["bag"] = {
|
||||
"items": [
|
||||
{
|
||||
"item_id": String(BASIC_ROD_ID),
|
||||
|
|
@ -584,16 +638,25 @@ func _migrate_save(
|
|||
},
|
||||
],
|
||||
}
|
||||
var slots: Array[String] = []
|
||||
slots.resize(PlayerHotbarType.SLOT_COUNT)
|
||||
slots.fill("")
|
||||
slots[0] = String(BASIC_ROD_ID)
|
||||
migrated["hotbar"] = {
|
||||
"selected_slot": 0,
|
||||
"slots": slots,
|
||||
}
|
||||
return migrated
|
||||
return {}
|
||||
var slots: Array[String] = []
|
||||
slots.resize(PlayerHotbarType.SLOT_COUNT)
|
||||
slots.fill("")
|
||||
slots[0] = String(BASIC_ROD_ID)
|
||||
migrated["hotbar"] = {
|
||||
"selected_slot": 0,
|
||||
"slots": slots,
|
||||
}
|
||||
return migrated
|
||||
|
||||
|
||||
func _migrate_version_2_to_3(data: Dictionary) -> Dictionary:
|
||||
var migrated: Dictionary = data.duplicate(true)
|
||||
migrated["save_version"] = 3
|
||||
migrated["upgrades"] = {
|
||||
"reel_speed_level": 0,
|
||||
"barrier_power_level": 0,
|
||||
}
|
||||
return migrated
|
||||
|
||||
|
||||
func _mark_dirty() -> void:
|
||||
|
|
@ -623,6 +686,13 @@ func _on_selected_hotbar_slot_changed(
|
|||
_mark_dirty()
|
||||
|
||||
|
||||
func _on_upgrades_changed(
|
||||
_reel_speed_level: int,
|
||||
_barrier_power_level: int,
|
||||
) -> void:
|
||||
_mark_dirty()
|
||||
|
||||
|
||||
func _on_autosave_timeout() -> void:
|
||||
if _is_dirty:
|
||||
save_now()
|
||||
|
|
@ -677,6 +747,7 @@ func _restore_defaults() -> void:
|
|||
_wallet.restore_balance(0)
|
||||
_bag.replace_all_items(default_items)
|
||||
_hotbar.replace_state(default_slots, 0)
|
||||
_fishing_upgrades.reset_to_defaults()
|
||||
_is_restoring = false
|
||||
_is_dirty = false
|
||||
|
||||
|
|
@ -702,6 +773,46 @@ func _read_integer(
|
|||
return invalid_value
|
||||
|
||||
|
||||
func _read_upgrade_level(
|
||||
value: Variant,
|
||||
maximum_level: int,
|
||||
field_name: String,
|
||||
) -> int:
|
||||
var parsed_value: int = 0
|
||||
var value_is_integer_like: bool = false
|
||||
if typeof(value) == TYPE_INT:
|
||||
parsed_value = int(value)
|
||||
value_is_integer_like = true
|
||||
elif typeof(value) == TYPE_FLOAT:
|
||||
var float_value: float = float(value)
|
||||
if is_finite(float_value) and is_equal_approx(
|
||||
float_value,
|
||||
round(float_value)
|
||||
):
|
||||
parsed_value = int(round(float_value))
|
||||
value_is_integer_like = true
|
||||
if not value_is_integer_like:
|
||||
push_warning(
|
||||
"Saved upgrade '%s' was invalid; using level 0." % field_name
|
||||
)
|
||||
return 0
|
||||
if parsed_value < 0:
|
||||
push_warning(
|
||||
"Saved upgrade '%s' was below 0; clamped to 0." % field_name
|
||||
)
|
||||
return 0
|
||||
if parsed_value > maximum_level:
|
||||
push_warning(
|
||||
(
|
||||
"Saved upgrade '%s' exceeded the supported maximum; "
|
||||
+ "clamped to %d."
|
||||
)
|
||||
% [field_name, maximum_level]
|
||||
)
|
||||
return maximum_level
|
||||
return parsed_value
|
||||
|
||||
|
||||
func _rename_file(from_path: String, to_path: String) -> bool:
|
||||
return DirAccess.rename_absolute(
|
||||
ProjectSettings.globalize_path(from_path),
|
||||
|
|
|
|||
496
ui/fishing_shop.gd
Normal file
496
ui/fishing_shop.gd
Normal file
|
|
@ -0,0 +1,496 @@
|
|||
class_name FishingShop
|
||||
extends Control
|
||||
|
||||
const INPUT_OWNER: StringName = &"fishing_shop"
|
||||
const MAIN_SHOP_BUYER_ID: StringName = &"main_fishing_shop"
|
||||
const FishBuyerProfileType = preload("res://economy/fish_buyer_profile.gd")
|
||||
const FishCatchType = preload("res://fish/fish_catch.gd")
|
||||
const FishInventoryType = preload("res://inventory/fish_inventory.gd")
|
||||
const FishSaleResultType = preload("res://economy/fish_sale_result.gd")
|
||||
const FishSaleServiceType = preload("res://economy/fish_sale_service.gd")
|
||||
const PlayerWalletType = preload("res://economy/player_wallet.gd")
|
||||
const FishingSpotType = preload("res://fishing/fishing_spot.gd")
|
||||
const PlayerFishingUpgradesType = preload(
|
||||
"res://progression/player_fishing_upgrades.gd"
|
||||
)
|
||||
const PlayerType = preload("res://player/player.gd")
|
||||
const ShopInteractionType = preload(
|
||||
"res://world/fishing_shop_interaction.gd"
|
||||
)
|
||||
|
||||
signal menu_visibility_changed(is_open: bool)
|
||||
|
||||
enum CloseReason {
|
||||
USER,
|
||||
RANGE_EXIT,
|
||||
WATER_RECOVERY,
|
||||
SESSION_END,
|
||||
TEARDOWN,
|
||||
}
|
||||
|
||||
@onready var _wallet_label: Label = %WalletLabel
|
||||
@onready var _fish_list: ItemList = %FishList
|
||||
@onready var _fish_empty: Label = %FishEmpty
|
||||
@onready var _fish_texture: TextureRect = %FishTexture
|
||||
@onready var _fish_name: Label = %FishName
|
||||
@onready var _fish_details: Label = %FishDetails
|
||||
@onready var _sell_button: Button = %SellButton
|
||||
@onready var _feedback: Label = %Feedback
|
||||
@onready var _reel_level: Label = %ReelLevel
|
||||
@onready var _reel_effect: Label = %ReelEffect
|
||||
@onready var _reel_cost: Label = %ReelCost
|
||||
@onready var _reel_purchase: Button = %ReelPurchase
|
||||
@onready var _barrier_level: Label = %BarrierLevel
|
||||
@onready var _barrier_effect: Label = %BarrierEffect
|
||||
@onready var _barrier_cost: Label = %BarrierCost
|
||||
@onready var _barrier_purchase: Button = %BarrierPurchase
|
||||
@onready var _confirmation: PanelContainer = %SaleConfirmation
|
||||
@onready var _confirmation_text: Label = %ConfirmationText
|
||||
@onready var _confirm_sale: Button = %ConfirmSale
|
||||
@onready var _cancel_sale: Button = %CancelSale
|
||||
|
||||
var _player: PlayerType
|
||||
var _inventory: FishInventoryType
|
||||
var _wallet: PlayerWalletType
|
||||
var _sale_service: FishSaleServiceType
|
||||
var _buyer: FishBuyerProfileType
|
||||
var _upgrades: PlayerFishingUpgradesType
|
||||
var _fishing_spot: FishingSpotType
|
||||
var _interaction: ShopInteractionType
|
||||
var _selected_catch_id: StringName
|
||||
var _confirmation_catch_id: StringName
|
||||
var _prior_movement_enabled: bool = true
|
||||
var _prior_camera_enabled: bool = true
|
||||
var _prior_mouse_mode: Input.MouseMode = Input.MOUSE_MODE_VISIBLE
|
||||
var _snapshot_stored: bool = false
|
||||
var _mouse_snapshot_stored: bool = false
|
||||
var _generation: int = 0
|
||||
var _transaction_in_progress: bool = false
|
||||
var _closing: bool = false
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
%CloseButton.pressed.connect(close_shop)
|
||||
_fish_list.item_selected.connect(_on_fish_selected)
|
||||
_sell_button.pressed.connect(_open_sale_confirmation)
|
||||
_confirm_sale.pressed.connect(_on_confirm_sale)
|
||||
_cancel_sale.pressed.connect(_close_sale_confirmation)
|
||||
_reel_purchase.pressed.connect(_purchase_reel_speed)
|
||||
_barrier_purchase.pressed.connect(_purchase_barrier_power)
|
||||
|
||||
|
||||
func setup(
|
||||
player: PlayerType,
|
||||
inventory: FishInventoryType,
|
||||
wallet: PlayerWalletType,
|
||||
sale_service: FishSaleServiceType,
|
||||
buyer: FishBuyerProfileType,
|
||||
upgrades: PlayerFishingUpgradesType,
|
||||
fishing_spot: FishingSpotType,
|
||||
interaction: ShopInteractionType,
|
||||
) -> void:
|
||||
_player = player
|
||||
_inventory = inventory
|
||||
_wallet = wallet
|
||||
_sale_service = sale_service
|
||||
_buyer = buyer
|
||||
_upgrades = upgrades
|
||||
_fishing_spot = fishing_spot
|
||||
_interaction = interaction
|
||||
if not _inventory.catches_changed.is_connected(_on_inventory_changed):
|
||||
_inventory.catches_changed.connect(_on_inventory_changed)
|
||||
if not _wallet.balance_changed.is_connected(_on_wallet_changed):
|
||||
_wallet.balance_changed.connect(_on_wallet_changed)
|
||||
if not _upgrades.upgrades_changed.is_connected(_on_upgrades_changed):
|
||||
_upgrades.upgrades_changed.connect(_on_upgrades_changed)
|
||||
_refresh_all()
|
||||
|
||||
|
||||
func open_shop() -> bool:
|
||||
if (
|
||||
visible
|
||||
or _player == null
|
||||
or _interaction == null
|
||||
or not _interaction.is_local_player_in_range()
|
||||
or _fishing_spot == null
|
||||
or not _fishing_spot.can_open_fishing_shop()
|
||||
or _buyer == null
|
||||
or not _buyer.is_valid()
|
||||
or _buyer.id != MAIN_SHOP_BUYER_ID
|
||||
):
|
||||
return false
|
||||
_generation += 1
|
||||
_closing = false
|
||||
_transaction_in_progress = false
|
||||
_prior_movement_enabled = _player.is_movement_enabled()
|
||||
_prior_camera_enabled = _player.is_camera_input_enabled()
|
||||
_prior_mouse_mode = Input.mouse_mode
|
||||
_snapshot_stored = true
|
||||
_mouse_snapshot_stored = true
|
||||
_player.set_movement_enabled(false)
|
||||
_player.set_camera_input_enabled(false)
|
||||
_fishing_spot.set_local_menu_input_suppressed(INPUT_OWNER, true)
|
||||
Input.mouse_mode = Input.MOUSE_MODE_VISIBLE
|
||||
_feedback.text = ""
|
||||
_close_sale_confirmation()
|
||||
show()
|
||||
_refresh_all()
|
||||
%CloseButton.grab_focus()
|
||||
menu_visibility_changed.emit(true)
|
||||
return true
|
||||
|
||||
|
||||
func consume_escape() -> bool:
|
||||
if not visible:
|
||||
return false
|
||||
if _confirmation.visible:
|
||||
_close_sale_confirmation()
|
||||
else:
|
||||
close_shop()
|
||||
return true
|
||||
|
||||
|
||||
func close_shop(
|
||||
reason: CloseReason = CloseReason.USER,
|
||||
restore_controls: bool = true,
|
||||
) -> void:
|
||||
if not visible:
|
||||
return
|
||||
_closing = true
|
||||
_generation += 1
|
||||
_transaction_in_progress = false
|
||||
_close_sale_confirmation()
|
||||
_selected_catch_id = StringName()
|
||||
hide()
|
||||
get_viewport().gui_release_focus()
|
||||
if _fishing_spot != null and is_instance_valid(_fishing_spot):
|
||||
_fishing_spot.set_local_menu_input_suppressed(INPUT_OWNER, false)
|
||||
if (
|
||||
restore_controls
|
||||
and _snapshot_stored
|
||||
and _fishing_spot != null
|
||||
and _fishing_spot.is_ready_for_shop_transaction()
|
||||
):
|
||||
_player.set_movement_enabled(_prior_movement_enabled)
|
||||
_player.set_camera_input_enabled(_prior_camera_enabled)
|
||||
_snapshot_stored = false
|
||||
_apply_mouse_close_policy(reason)
|
||||
_closing = false
|
||||
menu_visibility_changed.emit(false)
|
||||
|
||||
|
||||
func close_for_range_exit() -> void:
|
||||
close_shop(CloseReason.RANGE_EXIT)
|
||||
|
||||
|
||||
func close_for_water_recovery() -> void:
|
||||
# Recovery emits its starting signal immediately before it captures the
|
||||
# player's current control state. Restore our local snapshot synchronously
|
||||
# so recovery captures the pre-shop state, then becomes the new authority
|
||||
# before another frame can process gameplay input.
|
||||
close_shop(CloseReason.WATER_RECOVERY, true)
|
||||
|
||||
|
||||
func close_for_session_end() -> void:
|
||||
close_shop(CloseReason.SESSION_END, false)
|
||||
|
||||
|
||||
func _exit_tree() -> void:
|
||||
if visible:
|
||||
close_shop(CloseReason.TEARDOWN, false)
|
||||
|
||||
|
||||
func _refresh_all() -> void:
|
||||
if not is_node_ready():
|
||||
return
|
||||
_refresh_wallet()
|
||||
_refresh_fish_list()
|
||||
_refresh_selected_fish()
|
||||
_refresh_upgrades()
|
||||
|
||||
|
||||
func _refresh_wallet() -> void:
|
||||
_wallet_label.text = (
|
||||
"Wallet: $%d" % _wallet.get_balance()
|
||||
if _wallet != null
|
||||
else "Wallet: $0"
|
||||
)
|
||||
|
||||
|
||||
func _refresh_fish_list() -> void:
|
||||
_fish_list.clear()
|
||||
var catches: Array[FishCatchType] = (
|
||||
_inventory.get_all_catches() if _inventory != null else []
|
||||
)
|
||||
catches.sort_custom(
|
||||
func(a: FishCatchType, b: FishCatchType) -> bool:
|
||||
return a.catch_sequence > b.catch_sequence
|
||||
)
|
||||
var selected_index: int = -1
|
||||
for fish_catch: FishCatchType in catches:
|
||||
if fish_catch == null or not fish_catch.is_valid():
|
||||
continue
|
||||
var marker: String = "★ " if fish_catch.is_favorited else ""
|
||||
var index: int = _fish_list.add_item(
|
||||
"%s%s — %.2f lb"
|
||||
% [marker, fish_catch.fish.display_name, fish_catch.weight_lb],
|
||||
fish_catch.fish.display_texture
|
||||
)
|
||||
_fish_list.set_item_metadata(index, String(fish_catch.catch_id))
|
||||
_fish_list.set_item_tooltip(
|
||||
index,
|
||||
"%s • %s"
|
||||
% [
|
||||
fish_catch.fish.get_rarity_name(),
|
||||
"Favorited" if fish_catch.is_favorited else "Available",
|
||||
]
|
||||
)
|
||||
if fish_catch.catch_id == _selected_catch_id:
|
||||
selected_index = index
|
||||
_fish_empty.visible = _fish_list.item_count == 0
|
||||
if selected_index >= 0:
|
||||
_fish_list.select(selected_index)
|
||||
elif not _selected_catch_id.is_empty():
|
||||
_selected_catch_id = StringName()
|
||||
|
||||
|
||||
func _refresh_selected_fish() -> void:
|
||||
var fish_catch: FishCatchType = _get_selected_catch()
|
||||
_fish_texture.texture = (
|
||||
fish_catch.fish.display_texture if fish_catch != null else null
|
||||
)
|
||||
_fish_name.text = (
|
||||
fish_catch.fish.display_name if fish_catch != null else "Select a fish"
|
||||
)
|
||||
if fish_catch == null:
|
||||
_fish_details.text = "Choose one individual fish from your Cooler."
|
||||
_sell_button.disabled = true
|
||||
return
|
||||
var offer: int = _buyer.get_offer(fish_catch.sale_value)
|
||||
_fish_details.text = (
|
||||
"%.2f lb • %s\nBase value: $%d\nMain-shop offer: $%d%s"
|
||||
% [
|
||||
fish_catch.weight_lb,
|
||||
fish_catch.fish.get_rarity_name(),
|
||||
fish_catch.sale_value,
|
||||
offer,
|
||||
"\nFavorited fish cannot be sold."
|
||||
if fish_catch.is_favorited
|
||||
else "",
|
||||
]
|
||||
)
|
||||
_sell_button.disabled = (
|
||||
fish_catch.is_favorited
|
||||
or _transaction_in_progress
|
||||
or _closing
|
||||
)
|
||||
|
||||
|
||||
func _refresh_upgrades() -> void:
|
||||
if _upgrades == null:
|
||||
return
|
||||
var reel_level: int = _upgrades.get_reel_speed_level()
|
||||
var reel_cost: int = _upgrades.get_next_reel_speed_cost()
|
||||
_reel_level.text = "Level %d" % reel_level
|
||||
_reel_purchase.disabled = (
|
||||
reel_cost < 0
|
||||
or _transaction_in_progress
|
||||
or _closing
|
||||
or not _upgrades.can_purchase_reel_speed(_wallet)
|
||||
)
|
||||
if reel_cost < 0:
|
||||
_reel_effect.text = "%.2f×" % _upgrades.get_reel_speed_multiplier()
|
||||
_reel_cost.text = "MAX"
|
||||
else:
|
||||
_reel_effect.text = (
|
||||
"%.2f× → %.2f×"
|
||||
% [
|
||||
_upgrades.get_reel_speed_multiplier(),
|
||||
1.0 + float(reel_level + 1) * 0.10,
|
||||
]
|
||||
)
|
||||
_reel_cost.text = "$%d" % reel_cost
|
||||
_reel_purchase.text = "MAX" if reel_cost < 0 else "Purchase"
|
||||
var barrier_level: int = _upgrades.get_barrier_power_level()
|
||||
var barrier_cost: int = _upgrades.get_next_barrier_power_cost()
|
||||
_barrier_level.text = "Level %d" % barrier_level
|
||||
_barrier_purchase.disabled = (
|
||||
barrier_cost < 0
|
||||
or _transaction_in_progress
|
||||
or _closing
|
||||
or not _upgrades.can_purchase_barrier_power(_wallet)
|
||||
)
|
||||
if barrier_cost < 0:
|
||||
_barrier_effect.text = "%d damage" % _upgrades.get_barrier_damage()
|
||||
_barrier_cost.text = "MAX"
|
||||
else:
|
||||
_barrier_effect.text = (
|
||||
"%d damage → %d damage"
|
||||
% [
|
||||
_upgrades.get_barrier_damage(),
|
||||
barrier_level + 2,
|
||||
]
|
||||
)
|
||||
_barrier_cost.text = "$%d" % barrier_cost
|
||||
_barrier_purchase.text = "MAX" if barrier_cost < 0 else "Purchase"
|
||||
|
||||
|
||||
func _on_fish_selected(index: int) -> void:
|
||||
if index < 0 or index >= _fish_list.item_count:
|
||||
return
|
||||
_selected_catch_id = StringName(str(_fish_list.get_item_metadata(index)))
|
||||
_feedback.text = ""
|
||||
_refresh_selected_fish()
|
||||
|
||||
|
||||
func _open_sale_confirmation() -> void:
|
||||
var fish_catch: FishCatchType = _get_selected_catch()
|
||||
if not _is_transaction_context_valid() or fish_catch == null:
|
||||
_feedback.text = "This fish is no longer available."
|
||||
_refresh_all()
|
||||
return
|
||||
if fish_catch.is_favorited:
|
||||
_feedback.text = "Favorited fish cannot be sold."
|
||||
return
|
||||
_confirmation_catch_id = fish_catch.catch_id
|
||||
var offer: int = _buyer.get_offer(fish_catch.sale_value)
|
||||
_confirmation_text.text = (
|
||||
"Sell this %.2f lb %s to the Fishing Shop for $%d?"
|
||||
% [fish_catch.weight_lb, fish_catch.fish.display_name, offer]
|
||||
)
|
||||
_confirmation.show()
|
||||
_cancel_sale.grab_focus()
|
||||
|
||||
|
||||
func _close_sale_confirmation() -> void:
|
||||
_confirmation_catch_id = StringName()
|
||||
_confirmation.hide()
|
||||
|
||||
|
||||
func _on_confirm_sale() -> void:
|
||||
if _transaction_in_progress:
|
||||
return
|
||||
var transaction_generation: int = _generation
|
||||
var catch_id: StringName = _confirmation_catch_id
|
||||
_close_sale_confirmation()
|
||||
if (
|
||||
catch_id.is_empty()
|
||||
or not _is_transaction_context_valid()
|
||||
or transaction_generation != _generation
|
||||
or _buyer.id != MAIN_SHOP_BUYER_ID
|
||||
):
|
||||
_feedback.text = "Unable to complete sale."
|
||||
return
|
||||
_transaction_in_progress = true
|
||||
var result: FishSaleResultType = _sale_service.sell(catch_id, _buyer)
|
||||
_transaction_in_progress = false
|
||||
if (
|
||||
transaction_generation != _generation
|
||||
or not visible
|
||||
):
|
||||
return
|
||||
if result.is_success():
|
||||
_feedback.text = "Fish sold for $%d." % result.payout
|
||||
_selected_catch_id = StringName()
|
||||
else:
|
||||
_feedback.text = result.get_message()
|
||||
_refresh_all()
|
||||
|
||||
|
||||
func _purchase_reel_speed() -> void:
|
||||
_purchase_upgrade(true)
|
||||
|
||||
|
||||
func _purchase_barrier_power() -> void:
|
||||
_purchase_upgrade(false)
|
||||
|
||||
|
||||
func _purchase_upgrade(is_reel_speed: bool) -> void:
|
||||
if _transaction_in_progress or not _is_transaction_context_valid():
|
||||
_feedback.text = "Unable to complete purchase."
|
||||
return
|
||||
var cost: int = (
|
||||
_upgrades.get_next_reel_speed_cost()
|
||||
if is_reel_speed
|
||||
else _upgrades.get_next_barrier_power_cost()
|
||||
)
|
||||
if cost < 0:
|
||||
_feedback.text = "Maximum level reached."
|
||||
return
|
||||
if not _wallet.can_afford(cost):
|
||||
_feedback.text = "Not enough money."
|
||||
return
|
||||
var transaction_generation: int = _generation
|
||||
_transaction_in_progress = true
|
||||
var purchased: bool = (
|
||||
_upgrades.purchase_reel_speed(_wallet)
|
||||
if is_reel_speed
|
||||
else _upgrades.purchase_barrier_power(_wallet)
|
||||
)
|
||||
_transaction_in_progress = false
|
||||
if transaction_generation != _generation or not visible:
|
||||
return
|
||||
_feedback.text = (
|
||||
"Upgrade purchased."
|
||||
if purchased
|
||||
else "Unable to complete purchase."
|
||||
)
|
||||
_refresh_all()
|
||||
|
||||
|
||||
func _get_selected_catch() -> FishCatchType:
|
||||
if _inventory == null or _selected_catch_id.is_empty():
|
||||
return null
|
||||
return _inventory.get_catch_by_id(_selected_catch_id)
|
||||
|
||||
|
||||
func _is_transaction_context_valid() -> bool:
|
||||
return (
|
||||
visible
|
||||
and not _closing
|
||||
and _interaction != null
|
||||
and _interaction.is_local_player_in_range()
|
||||
and _fishing_spot != null
|
||||
and _fishing_spot.is_ready_for_shop_transaction()
|
||||
and _buyer != null
|
||||
and _buyer.is_valid()
|
||||
and _buyer.id == MAIN_SHOP_BUYER_ID
|
||||
)
|
||||
|
||||
|
||||
func _on_inventory_changed() -> void:
|
||||
_refresh_fish_list()
|
||||
if (
|
||||
not _confirmation_catch_id.is_empty()
|
||||
and _inventory.get_catch_by_id(_confirmation_catch_id) == null
|
||||
):
|
||||
_close_sale_confirmation()
|
||||
_feedback.text = "This fish is no longer available."
|
||||
_refresh_selected_fish()
|
||||
|
||||
|
||||
func _on_wallet_changed(_balance: int, _delta: int) -> void:
|
||||
_refresh_wallet()
|
||||
_refresh_upgrades()
|
||||
|
||||
|
||||
func _on_upgrades_changed(
|
||||
_reel_speed_level: int,
|
||||
_barrier_power_level: int,
|
||||
) -> void:
|
||||
_refresh_upgrades()
|
||||
|
||||
|
||||
func _apply_mouse_close_policy(reason: CloseReason) -> void:
|
||||
if not _mouse_snapshot_stored:
|
||||
return
|
||||
match reason:
|
||||
CloseReason.USER, CloseReason.RANGE_EXIT:
|
||||
Input.mouse_mode = _prior_mouse_mode
|
||||
CloseReason.WATER_RECOVERY:
|
||||
Input.mouse_mode = _prior_mouse_mode
|
||||
CloseReason.SESSION_END:
|
||||
Input.mouse_mode = Input.MOUSE_MODE_VISIBLE
|
||||
CloseReason.TEARDOWN:
|
||||
pass
|
||||
_mouse_snapshot_stored = false
|
||||
1
ui/fishing_shop.gd.uid
Normal file
1
ui/fishing_shop.gd.uid
Normal file
|
|
@ -0,0 +1 @@
|
|||
uid://6yu6krq6yk8f
|
||||
348
ui/fishing_shop.tscn
Normal file
348
ui/fishing_shop.tscn
Normal file
|
|
@ -0,0 +1,348 @@
|
|||
[gd_scene load_steps=6 format=3]
|
||||
|
||||
[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/placeholder/barrier_power_upgrade.svg" id="4_barrier"]
|
||||
[ext_resource type="Texture2D" path="res://items/icons/placeholder/fish_coin.svg" id="5_coin"]
|
||||
|
||||
[node name="FishingShop" type="Control"]
|
||||
unique_name_in_owner = true
|
||||
visible = false
|
||||
z_index = 80
|
||||
layout_mode = 3
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
mouse_filter = 2
|
||||
theme = ExtResource("2_theme")
|
||||
script = ExtResource("1_script")
|
||||
|
||||
[node name="Dimmer" type="ColorRect" parent="."]
|
||||
layout_mode = 1
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
mouse_filter = 0
|
||||
color = Color(0.015, 0.02, 0.03, 0.64)
|
||||
|
||||
[node name="ShopPanel" type="PanelContainer" parent="."]
|
||||
layout_mode = 1
|
||||
anchors_preset = 8
|
||||
anchor_left = 0.5
|
||||
anchor_top = 0.5
|
||||
anchor_right = 0.5
|
||||
anchor_bottom = 0.5
|
||||
offset_left = -450.0
|
||||
offset_top = -260.0
|
||||
offset_right = 450.0
|
||||
offset_bottom = 260.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
|
||||
[node name="Margin" type="MarginContainer" parent="ShopPanel"]
|
||||
layout_mode = 2
|
||||
theme_override_constants/margin_left = 16
|
||||
theme_override_constants/margin_top = 14
|
||||
theme_override_constants/margin_right = 16
|
||||
theme_override_constants/margin_bottom = 14
|
||||
|
||||
[node name="Layout" type="VBoxContainer" parent="ShopPanel/Margin"]
|
||||
layout_mode = 2
|
||||
theme_override_constants/separation = 10
|
||||
|
||||
[node name="Header" type="HBoxContainer" parent="ShopPanel/Margin/Layout"]
|
||||
layout_mode = 2
|
||||
theme_override_constants/separation = 8
|
||||
|
||||
[node name="Title" type="Label" parent="ShopPanel/Margin/Layout/Header"]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
text = "Fishing Shop"
|
||||
theme_override_font_sizes/font_size = 24
|
||||
theme_override_colors/font_color = Color(0.208, 0.725, 0.78, 1)
|
||||
|
||||
[node name="CoinIcon" type="TextureRect" parent="ShopPanel/Margin/Layout/Header"]
|
||||
custom_minimum_size = Vector2(24, 24)
|
||||
layout_mode = 2
|
||||
texture = ExtResource("5_coin")
|
||||
expand_mode = 1
|
||||
stretch_mode = 5
|
||||
texture_filter = 1
|
||||
|
||||
[node name="WalletLabel" type="Label" parent="ShopPanel/Margin/Layout/Header"]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
text = "Wallet: $0"
|
||||
|
||||
[node name="CloseButton" type="Button" parent="ShopPanel/Margin/Layout/Header"]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
text = "Close"
|
||||
custom_minimum_size = Vector2(72, 30)
|
||||
|
||||
[node name="Feedback" type="Label" parent="ShopPanel/Margin/Layout"]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
text = ""
|
||||
horizontal_alignment = 1
|
||||
theme_override_colors/font_color = Color(1, 0.82, 0.4, 1)
|
||||
|
||||
[node name="Body" type="HBoxContainer" parent="ShopPanel/Margin/Layout"]
|
||||
layout_mode = 2
|
||||
size_flags_vertical = 3
|
||||
theme_override_constants/separation = 12
|
||||
|
||||
[node name="FishSales" type="VBoxContainer" parent="ShopPanel/Margin/Layout/Body"]
|
||||
custom_minimum_size = Vector2(500, 0)
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
theme_override_constants/separation = 6
|
||||
|
||||
[node name="SalesTitle" type="Label" parent="ShopPanel/Margin/Layout/Body/FishSales"]
|
||||
layout_mode = 2
|
||||
text = "Sell individual Cooler fish • Full base value"
|
||||
theme_override_font_sizes/font_size = 17
|
||||
|
||||
[node name="SalesBody" type="HSplitContainer" parent="ShopPanel/Margin/Layout/Body/FishSales"]
|
||||
layout_mode = 2
|
||||
size_flags_vertical = 3
|
||||
split_offset = 265
|
||||
theme_override_constants/separation = 8
|
||||
|
||||
[node name="ListPanel" type="PanelContainer" parent="ShopPanel/Margin/Layout/Body/FishSales/SalesBody"]
|
||||
custom_minimum_size = Vector2(250, 0)
|
||||
layout_mode = 2
|
||||
|
||||
[node name="ListMargin" type="MarginContainer" parent="ShopPanel/Margin/Layout/Body/FishSales/SalesBody/ListPanel"]
|
||||
layout_mode = 2
|
||||
theme_override_constants/margin_left = 7
|
||||
theme_override_constants/margin_top = 7
|
||||
theme_override_constants/margin_right = 7
|
||||
theme_override_constants/margin_bottom = 7
|
||||
|
||||
[node name="ListStack" type="VBoxContainer" parent="ShopPanel/Margin/Layout/Body/FishSales/SalesBody/ListPanel/ListMargin"]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="FishEmpty" type="Label" parent="ShopPanel/Margin/Layout/Body/FishSales/SalesBody/ListPanel/ListMargin/ListStack"]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
text = "Your Cooler is empty."
|
||||
horizontal_alignment = 1
|
||||
|
||||
[node name="FishList" type="ItemList" parent="ShopPanel/Margin/Layout/Body/FishSales/SalesBody/ListPanel/ListMargin/ListStack"]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
size_flags_vertical = 3
|
||||
fixed_icon_size = Vector2i(48, 36)
|
||||
icon_mode = 1
|
||||
same_column_width = true
|
||||
|
||||
[node name="FishDetail" type="PanelContainer" parent="ShopPanel/Margin/Layout/Body/FishSales/SalesBody"]
|
||||
custom_minimum_size = Vector2(220, 0)
|
||||
layout_mode = 2
|
||||
|
||||
[node name="DetailMargin" type="MarginContainer" parent="ShopPanel/Margin/Layout/Body/FishSales/SalesBody/FishDetail"]
|
||||
layout_mode = 2
|
||||
theme_override_constants/margin_left = 9
|
||||
theme_override_constants/margin_top = 9
|
||||
theme_override_constants/margin_right = 9
|
||||
theme_override_constants/margin_bottom = 9
|
||||
|
||||
[node name="DetailStack" type="VBoxContainer" parent="ShopPanel/Margin/Layout/Body/FishSales/SalesBody/FishDetail/DetailMargin"]
|
||||
layout_mode = 2
|
||||
theme_override_constants/separation = 6
|
||||
|
||||
[node name="FishTexture" type="TextureRect" parent="ShopPanel/Margin/Layout/Body/FishSales/SalesBody/FishDetail/DetailMargin/DetailStack"]
|
||||
unique_name_in_owner = true
|
||||
custom_minimum_size = Vector2(190, 100)
|
||||
layout_mode = 2
|
||||
expand_mode = 1
|
||||
stretch_mode = 5
|
||||
texture_filter = 1
|
||||
|
||||
[node name="FishName" type="Label" parent="ShopPanel/Margin/Layout/Body/FishSales/SalesBody/FishDetail/DetailMargin/DetailStack"]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
text = "Select a fish"
|
||||
horizontal_alignment = 1
|
||||
theme_override_font_sizes/font_size = 19
|
||||
|
||||
[node name="FishDetails" type="Label" parent="ShopPanel/Margin/Layout/Body/FishSales/SalesBody/FishDetail/DetailMargin/DetailStack"]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
text = "Choose one individual fish from your Cooler."
|
||||
horizontal_alignment = 1
|
||||
autowrap_mode = 2
|
||||
|
||||
[node name="SellButton" type="Button" parent="ShopPanel/Margin/Layout/Body/FishSales/SalesBody/FishDetail/DetailMargin/DetailStack"]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
disabled = true
|
||||
text = "Sell Selected"
|
||||
|
||||
[node name="Upgrades" type="VBoxContainer" parent="ShopPanel/Margin/Layout/Body"]
|
||||
custom_minimum_size = Vector2(310, 0)
|
||||
layout_mode = 2
|
||||
theme_override_constants/separation = 8
|
||||
|
||||
[node name="UpgradeTitle" type="Label" parent="ShopPanel/Margin/Layout/Body/Upgrades"]
|
||||
layout_mode = 2
|
||||
text = "Fishing Upgrades"
|
||||
theme_override_font_sizes/font_size = 17
|
||||
|
||||
[node name="ReelCard" type="PanelContainer" parent="ShopPanel/Margin/Layout/Body/Upgrades"]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="Margin" type="MarginContainer" parent="ShopPanel/Margin/Layout/Body/Upgrades/ReelCard"]
|
||||
layout_mode = 2
|
||||
theme_override_constants/margin_left = 9
|
||||
theme_override_constants/margin_top = 9
|
||||
theme_override_constants/margin_right = 9
|
||||
theme_override_constants/margin_bottom = 9
|
||||
|
||||
[node name="Row" type="HBoxContainer" parent="ShopPanel/Margin/Layout/Body/Upgrades/ReelCard/Margin"]
|
||||
layout_mode = 2
|
||||
theme_override_constants/separation = 9
|
||||
|
||||
[node name="Icon" type="TextureRect" parent="ShopPanel/Margin/Layout/Body/Upgrades/ReelCard/Margin/Row"]
|
||||
custom_minimum_size = Vector2(60, 60)
|
||||
layout_mode = 2
|
||||
texture = ExtResource("3_reel")
|
||||
expand_mode = 1
|
||||
stretch_mode = 5
|
||||
texture_filter = 1
|
||||
|
||||
[node name="Data" type="VBoxContainer" parent="ShopPanel/Margin/Layout/Body/Upgrades/ReelCard/Margin/Row"]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
|
||||
[node name="Name" type="Label" parent="ShopPanel/Margin/Layout/Body/Upgrades/ReelCard/Margin/Row/Data"]
|
||||
layout_mode = 2
|
||||
text = "Reel Speed"
|
||||
theme_override_font_sizes/font_size = 17
|
||||
|
||||
[node name="ReelLevel" type="Label" parent="ShopPanel/Margin/Layout/Body/Upgrades/ReelCard/Margin/Row/Data"]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
text = "Level 0"
|
||||
|
||||
[node name="ReelEffect" type="Label" parent="ShopPanel/Margin/Layout/Body/Upgrades/ReelCard/Margin/Row/Data"]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
text = "1.00× → 1.10×"
|
||||
|
||||
[node name="ReelCost" type="Label" parent="ShopPanel/Margin/Layout/Body/Upgrades/ReelCard/Margin/Row/Data"]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
text = "$50"
|
||||
|
||||
[node name="ReelPurchase" type="Button" parent="ShopPanel/Margin/Layout/Body/Upgrades/ReelCard/Margin/Row"]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
text = "Purchase"
|
||||
|
||||
[node name="BarrierCard" type="PanelContainer" parent="ShopPanel/Margin/Layout/Body/Upgrades"]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="Margin" type="MarginContainer" parent="ShopPanel/Margin/Layout/Body/Upgrades/BarrierCard"]
|
||||
layout_mode = 2
|
||||
theme_override_constants/margin_left = 9
|
||||
theme_override_constants/margin_top = 9
|
||||
theme_override_constants/margin_right = 9
|
||||
theme_override_constants/margin_bottom = 9
|
||||
|
||||
[node name="Row" type="HBoxContainer" parent="ShopPanel/Margin/Layout/Body/Upgrades/BarrierCard/Margin"]
|
||||
layout_mode = 2
|
||||
theme_override_constants/separation = 9
|
||||
|
||||
[node name="Icon" type="TextureRect" parent="ShopPanel/Margin/Layout/Body/Upgrades/BarrierCard/Margin/Row"]
|
||||
custom_minimum_size = Vector2(60, 60)
|
||||
layout_mode = 2
|
||||
texture = ExtResource("4_barrier")
|
||||
expand_mode = 1
|
||||
stretch_mode = 5
|
||||
texture_filter = 1
|
||||
|
||||
[node name="Data" type="VBoxContainer" parent="ShopPanel/Margin/Layout/Body/Upgrades/BarrierCard/Margin/Row"]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
|
||||
[node name="Name" type="Label" parent="ShopPanel/Margin/Layout/Body/Upgrades/BarrierCard/Margin/Row/Data"]
|
||||
layout_mode = 2
|
||||
text = "Barrier Power"
|
||||
theme_override_font_sizes/font_size = 17
|
||||
|
||||
[node name="BarrierLevel" type="Label" parent="ShopPanel/Margin/Layout/Body/Upgrades/BarrierCard/Margin/Row/Data"]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
text = "Level 0"
|
||||
|
||||
[node name="BarrierEffect" type="Label" parent="ShopPanel/Margin/Layout/Body/Upgrades/BarrierCard/Margin/Row/Data"]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
text = "1 damage → 2 damage"
|
||||
|
||||
[node name="BarrierCost" type="Label" parent="ShopPanel/Margin/Layout/Body/Upgrades/BarrierCard/Margin/Row/Data"]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
text = "$100"
|
||||
|
||||
[node name="BarrierPurchase" type="Button" parent="ShopPanel/Margin/Layout/Body/Upgrades/BarrierCard/Margin/Row"]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
text = "Purchase"
|
||||
|
||||
[node name="SaleConfirmation" type="PanelContainer" parent="."]
|
||||
unique_name_in_owner = true
|
||||
visible = false
|
||||
z_index = 10
|
||||
layout_mode = 1
|
||||
anchors_preset = 8
|
||||
anchor_left = 0.5
|
||||
anchor_top = 0.5
|
||||
anchor_right = 0.5
|
||||
anchor_bottom = 0.5
|
||||
offset_left = -220.0
|
||||
offset_top = -90.0
|
||||
offset_right = 220.0
|
||||
offset_bottom = 90.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
|
||||
[node name="Margin" type="MarginContainer" parent="SaleConfirmation"]
|
||||
layout_mode = 2
|
||||
theme_override_constants/margin_left = 18
|
||||
theme_override_constants/margin_top = 16
|
||||
theme_override_constants/margin_right = 18
|
||||
theme_override_constants/margin_bottom = 16
|
||||
|
||||
[node name="Stack" type="VBoxContainer" parent="SaleConfirmation/Margin"]
|
||||
layout_mode = 2
|
||||
theme_override_constants/separation = 12
|
||||
|
||||
[node name="ConfirmationText" type="Label" parent="SaleConfirmation/Margin/Stack"]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
autowrap_mode = 2
|
||||
horizontal_alignment = 1
|
||||
|
||||
[node name="Buttons" type="HBoxContainer" parent="SaleConfirmation/Margin/Stack"]
|
||||
layout_mode = 2
|
||||
alignment = 1
|
||||
theme_override_constants/separation = 8
|
||||
|
||||
[node name="ConfirmSale" type="Button" parent="SaleConfirmation/Margin/Stack/Buttons"]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
text = "Sell Fish"
|
||||
theme_type_variation = &"DangerButton"
|
||||
|
||||
[node name="CancelSale" type="Button" parent="SaleConfirmation/Margin/Stack/Buttons"]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
text = "Cancel"
|
||||
|
|
@ -16,6 +16,13 @@ const PlayerHotbarType = preload("res://inventory/player_hotbar.gd")
|
|||
const HotbarUIType = preload("res://ui/hotbar.gd")
|
||||
const TitleScreenType = preload("res://ui/title_screen.gd")
|
||||
const PauseMenuType = preload("res://ui/pause_menu.gd")
|
||||
const FishingShopType = preload("res://ui/fishing_shop.gd")
|
||||
const PlayerFishingUpgradesType = preload(
|
||||
"res://progression/player_fishing_upgrades.gd"
|
||||
)
|
||||
const ShopInteractionType = preload(
|
||||
"res://world/fishing_shop_interaction.gd"
|
||||
)
|
||||
|
||||
@onready var _status_label: Label = %StatusLabel
|
||||
@onready var _catch_track: Control = %CatchTrack
|
||||
|
|
@ -31,11 +38,15 @@ const PauseMenuType = preload("res://ui/pause_menu.gd")
|
|||
@onready var _title_screen: TitleScreenType = %TitleScreen
|
||||
@onready var _pause_menu: PauseMenuType = %PauseMenu
|
||||
@onready var _hotbar_ui: HotbarUIType = %Hotbar
|
||||
@onready var _fishing_shop: FishingShopType = %FishingShop
|
||||
@onready var _shop_prompt: PanelContainer = %ShopPrompt
|
||||
|
||||
var _showcase_active: bool = false
|
||||
var _player_menu_open: bool = false
|
||||
var _gameplay_ui_enabled: bool = false
|
||||
var _fishing_spot: FishingSpotType
|
||||
var _system_menu_open: bool = false
|
||||
var _shop_open: bool = false
|
||||
|
||||
|
||||
func setup(
|
||||
|
|
@ -50,6 +61,9 @@ func setup(
|
|||
bag: PlayerBagType,
|
||||
hotbar: PlayerHotbarType,
|
||||
item_catalog: ItemCatalogType,
|
||||
main_shop_buyer: FishBuyerProfileType,
|
||||
fishing_upgrades: PlayerFishingUpgradesType,
|
||||
shop_interaction: ShopInteractionType,
|
||||
) -> void:
|
||||
_fishing_spot = fishing_spot
|
||||
fishing_spot.status_changed.connect(_on_fishing_status_changed)
|
||||
|
|
@ -72,6 +86,17 @@ func setup(
|
|||
item_catalog
|
||||
)
|
||||
_hotbar_ui.setup(hotbar, bag, item_catalog, fishing_spot)
|
||||
_fishing_shop.setup(
|
||||
player,
|
||||
inventory,
|
||||
wallet,
|
||||
sale_service,
|
||||
main_shop_buyer,
|
||||
fishing_upgrades,
|
||||
fishing_spot,
|
||||
shop_interaction
|
||||
)
|
||||
_fishing_shop.menu_visibility_changed.connect(_on_shop_visibility_changed)
|
||||
|
||||
|
||||
func close_player_menu() -> void:
|
||||
|
|
@ -102,7 +127,9 @@ func set_gameplay_ui_enabled(enabled: bool) -> void:
|
|||
_gameplay_ui_enabled = enabled
|
||||
if not enabled:
|
||||
close_player_menu_for_session_end()
|
||||
_fishing_shop.close_for_session_end()
|
||||
_fishing_panel.visible = false
|
||||
_shop_prompt.hide()
|
||||
_hotbar_ui.hide()
|
||||
_hotbar_ui.set_gameplay_input_enabled(false)
|
||||
else:
|
||||
|
|
@ -112,11 +139,33 @@ func set_gameplay_ui_enabled(enabled: bool) -> void:
|
|||
|
||||
|
||||
func set_system_menu_open(is_open: bool) -> void:
|
||||
_hotbar_ui.visible = _gameplay_ui_enabled and not is_open
|
||||
_system_menu_open = is_open
|
||||
_hotbar_ui.visible = (
|
||||
_gameplay_ui_enabled and not is_open and not _shop_open
|
||||
)
|
||||
_hotbar_ui.set_gameplay_input_enabled(
|
||||
_gameplay_ui_enabled and not is_open and not _player_menu_open
|
||||
_gameplay_ui_enabled
|
||||
and not is_open
|
||||
and not _player_menu_open
|
||||
and not _shop_open
|
||||
)
|
||||
_hotbar_ui.set_drag_enabled(_player_menu_open and not is_open)
|
||||
if is_open:
|
||||
_shop_prompt.hide()
|
||||
|
||||
|
||||
func get_fishing_shop() -> FishingShopType:
|
||||
return _fishing_shop
|
||||
|
||||
|
||||
func set_shop_prompt_visible(is_visible: bool) -> void:
|
||||
_shop_prompt.visible = (
|
||||
is_visible
|
||||
and _gameplay_ui_enabled
|
||||
and not _system_menu_open
|
||||
and not _player_menu_open
|
||||
and not _shop_open
|
||||
)
|
||||
|
||||
|
||||
func get_screen_fade() -> ScreenFade:
|
||||
|
|
@ -299,3 +348,20 @@ func _on_player_menu_visibility_changed(is_open: bool) -> void:
|
|||
)
|
||||
_hotbar_ui.set_drag_enabled(is_open)
|
||||
_refresh_fishing_panel_visibility()
|
||||
if is_open:
|
||||
_shop_prompt.hide()
|
||||
|
||||
|
||||
func _on_shop_visibility_changed(is_open: bool) -> void:
|
||||
_shop_open = is_open
|
||||
_hotbar_ui.visible = (
|
||||
_gameplay_ui_enabled and not is_open and not _system_menu_open
|
||||
)
|
||||
_hotbar_ui.set_gameplay_input_enabled(
|
||||
_gameplay_ui_enabled
|
||||
and not is_open
|
||||
and not _system_menu_open
|
||||
and not _player_menu_open
|
||||
)
|
||||
if is_open:
|
||||
_shop_prompt.hide()
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
[gd_scene load_steps=12 format=3]
|
||||
[gd_scene load_steps=13 format=3]
|
||||
|
||||
[ext_resource type="Script" path="res://ui/game_ui.gd" id="1_ui"]
|
||||
[ext_resource type="PackedScene" path="res://ui/player_menu.tscn" id="2_menu"]
|
||||
|
|
@ -7,6 +7,7 @@
|
|||
[ext_resource type="PackedScene" path="res://ui/title_screen.tscn" id="5_title"]
|
||||
[ext_resource type="PackedScene" path="res://ui/pause_menu.tscn" id="6_pause"]
|
||||
[ext_resource type="PackedScene" path="res://ui/hotbar.tscn" id="7_hotbar"]
|
||||
[ext_resource type="PackedScene" path="res://ui/fishing_shop.tscn" id="8_shop"]
|
||||
|
||||
[sub_resource type="StyleBoxFlat" id="StyleBox_chase_background"]
|
||||
bg_color = Color(0.055, 0.105, 0.125, 1)
|
||||
|
|
@ -133,6 +134,39 @@ unique_name_in_owner = true
|
|||
[node name="Hotbar" parent="." instance=ExtResource("7_hotbar")]
|
||||
unique_name_in_owner = true
|
||||
|
||||
[node name="ShopPrompt" type="PanelContainer" parent="."]
|
||||
unique_name_in_owner = true
|
||||
visible = false
|
||||
z_index = 55
|
||||
anchors_preset = 7
|
||||
anchor_left = 0.5
|
||||
anchor_top = 1.0
|
||||
anchor_right = 0.5
|
||||
anchor_bottom = 1.0
|
||||
offset_left = -150.0
|
||||
offset_top = -284.0
|
||||
offset_right = 150.0
|
||||
offset_bottom = -246.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 0
|
||||
mouse_filter = 2
|
||||
theme = ExtResource("3_theme")
|
||||
|
||||
[node name="Margin" type="MarginContainer" parent="ShopPrompt"]
|
||||
layout_mode = 2
|
||||
theme_override_constants/margin_left = 12
|
||||
theme_override_constants/margin_top = 7
|
||||
theme_override_constants/margin_right = 12
|
||||
theme_override_constants/margin_bottom = 7
|
||||
|
||||
[node name="Label" type="Label" parent="ShopPrompt/Margin"]
|
||||
layout_mode = 2
|
||||
text = "Press E to open Fishing Shop"
|
||||
horizontal_alignment = 1
|
||||
|
||||
[node name="FishingShop" parent="." instance=ExtResource("8_shop")]
|
||||
unique_name_in_owner = true
|
||||
|
||||
[node name="ScreenFade" type="ColorRect" parent="."]
|
||||
unique_name_in_owner = true
|
||||
visible = false
|
||||
|
|
|
|||
47
world/fishing_shop_interaction.gd
Normal file
47
world/fishing_shop_interaction.gd
Normal file
|
|
@ -0,0 +1,47 @@
|
|||
class_name FishingShopInteraction
|
||||
extends Area3D
|
||||
|
||||
signal local_player_range_changed(in_range: bool)
|
||||
|
||||
var _local_player: Player
|
||||
var _local_player_in_range: bool = false
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
body_entered.connect(_on_body_entered)
|
||||
body_exited.connect(_on_body_exited)
|
||||
|
||||
|
||||
func setup_local_player(player: Player) -> void:
|
||||
_local_player = player
|
||||
_refresh_overlaps()
|
||||
|
||||
|
||||
func is_local_player_in_range() -> bool:
|
||||
return _local_player_in_range
|
||||
|
||||
|
||||
func _refresh_overlaps() -> void:
|
||||
var is_overlapping: bool = (
|
||||
_local_player != null
|
||||
and is_instance_valid(_local_player)
|
||||
and _local_player in get_overlapping_bodies()
|
||||
)
|
||||
_set_local_player_in_range(is_overlapping)
|
||||
|
||||
|
||||
func _on_body_entered(body: Node3D) -> void:
|
||||
if body == _local_player:
|
||||
_set_local_player_in_range(true)
|
||||
|
||||
|
||||
func _on_body_exited(body: Node3D) -> void:
|
||||
if body == _local_player:
|
||||
_set_local_player_in_range(false)
|
||||
|
||||
|
||||
func _set_local_player_in_range(in_range: bool) -> void:
|
||||
if _local_player_in_range == in_range:
|
||||
return
|
||||
_local_player_in_range = in_range
|
||||
local_player_range_changed.emit(in_range)
|
||||
1
world/fishing_shop_interaction.gd.uid
Normal file
1
world/fishing_shop_interaction.gd.uid
Normal file
|
|
@ -0,0 +1 @@
|
|||
uid://c06cr0abctued
|
||||
|
|
@ -1,8 +1,13 @@
|
|||
class_name TestWorld
|
||||
extends Node3D
|
||||
|
||||
const FishingShopInteractionType = preload(
|
||||
"res://world/fishing_shop_interaction.gd"
|
||||
)
|
||||
|
||||
@onready var _water_trigger: PlayerWaterTrigger = %PlayerWaterTrigger
|
||||
@onready var _safe_respawn_points: Node3D = %SafeRespawnPoints
|
||||
@onready var _fishing_shop: FishingShopInteractionType = %FishingShopInteraction
|
||||
|
||||
|
||||
func get_player_water_trigger() -> PlayerWaterTrigger:
|
||||
|
|
@ -16,3 +21,7 @@ func get_safe_respawn_points() -> Array[SafeRespawnPoint]:
|
|||
if point != null:
|
||||
points.append(point)
|
||||
return points
|
||||
|
||||
|
||||
func get_fishing_shop() -> FishingShopInteractionType:
|
||||
return _fishing_shop
|
||||
|
|
|
|||
|
|
@ -1,10 +1,11 @@
|
|||
[gd_scene load_steps=18 format=3]
|
||||
[gd_scene load_steps=25 format=3]
|
||||
|
||||
[ext_resource type="Script" path="res://world/fishable_water_region.gd" id="1_water_region"]
|
||||
[ext_resource type="Resource" path="res://fish/pools/test_water_pool.tres" id="2_fish_pool"]
|
||||
[ext_resource type="Script" path="res://world/test_world.gd" id="3_world"]
|
||||
[ext_resource type="Script" path="res://world/player_water_trigger.gd" id="4_water_trigger"]
|
||||
[ext_resource type="Script" path="res://world/safe_respawn_point.gd" id="5_safe_point"]
|
||||
[ext_resource type="Script" path="res://world/fishing_shop_interaction.gd" id="6_shop"]
|
||||
|
||||
[sub_resource type="BoxShape3D" id="GroundShape"]
|
||||
size = Vector3(30, 1, 30)
|
||||
|
|
@ -51,6 +52,24 @@ ambient_light_source = 3
|
|||
ambient_light_color = Color(0.65, 0.72, 0.8, 1)
|
||||
ambient_light_energy = 0.65
|
||||
|
||||
[sub_resource type="BoxMesh" id="ShopCounterMesh"]
|
||||
size = Vector3(3.4, 1.25, 1.5)
|
||||
|
||||
[sub_resource type="BoxMesh" id="ShopRoofMesh"]
|
||||
size = Vector3(4.2, 0.35, 2.2)
|
||||
|
||||
[sub_resource type="BoxMesh" id="ShopPostMesh"]
|
||||
size = Vector3(0.25, 2.8, 0.25)
|
||||
|
||||
[sub_resource type="StandardMaterial3D" id="ShopPrimaryMaterial"]
|
||||
albedo_color = Color(0.18, 0.72, 0.68, 1)
|
||||
|
||||
[sub_resource type="StandardMaterial3D" id="ShopAccentMaterial"]
|
||||
albedo_color = Color(1, 0.72, 0.22, 1)
|
||||
|
||||
[sub_resource type="SphereShape3D" id="ShopInteractionShape"]
|
||||
radius = 3.0
|
||||
|
||||
[node name="TestWorld" type="Node3D"]
|
||||
script = ExtResource("3_world")
|
||||
|
||||
|
|
@ -142,3 +161,44 @@ script = ExtResource("5_safe_point")
|
|||
[node name="DockEnd" type="Marker3D" parent="SafeRespawnPoints"]
|
||||
position = Vector3(0, 1.08, -17)
|
||||
script = ExtResource("5_safe_point")
|
||||
|
||||
[node name="FishingShop" type="Node3D" parent="."]
|
||||
position = Vector3(8, 0, 5)
|
||||
|
||||
[node name="Counter" type="MeshInstance3D" parent="FishingShop"]
|
||||
position = Vector3(0, 0.625, 0)
|
||||
mesh = SubResource("ShopCounterMesh")
|
||||
material_override = SubResource("ShopPrimaryMaterial")
|
||||
|
||||
[node name="Roof" type="MeshInstance3D" parent="FishingShop"]
|
||||
position = Vector3(0, 2.25, 0)
|
||||
mesh = SubResource("ShopRoofMesh")
|
||||
material_override = SubResource("ShopAccentMaterial")
|
||||
|
||||
[node name="WestPost" type="MeshInstance3D" parent="FishingShop"]
|
||||
position = Vector3(-1.55, 1.4, 0.55)
|
||||
mesh = SubResource("ShopPostMesh")
|
||||
material_override = SubResource("ShopPrimaryMaterial")
|
||||
|
||||
[node name="EastPost" type="MeshInstance3D" parent="FishingShop"]
|
||||
position = Vector3(1.55, 1.4, 0.55)
|
||||
mesh = SubResource("ShopPostMesh")
|
||||
material_override = SubResource("ShopPrimaryMaterial")
|
||||
|
||||
[node name="ShopName" type="Label3D" parent="FishingShop"]
|
||||
position = Vector3(0, 2.7, 0)
|
||||
text = "Fishing Shop"
|
||||
font_size = 36
|
||||
outline_size = 8
|
||||
billboard = 1
|
||||
no_depth_test = true
|
||||
|
||||
[node name="FishingShopInteraction" type="Area3D" parent="FishingShop"]
|
||||
unique_name_in_owner = true
|
||||
position = Vector3(0, 1, 0)
|
||||
collision_layer = 0
|
||||
collision_mask = 2
|
||||
script = ExtResource("6_shop")
|
||||
|
||||
[node name="CollisionShape3D" type="CollisionShape3D" parent="FishingShop/FishingShopInteraction"]
|
||||
shape = SubResource("ShopInteractionShape")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue