Add portable RV homes and decor prototype
This commit is contained in:
parent
81decf2b71
commit
fe099f47dd
56 changed files with 5459 additions and 112 deletions
|
|
@ -41,8 +41,6 @@ const FishingSurfaceSampleType = preload(
|
|||
const FishingSurfaceResolverType = preload(
|
||||
"res://fishing/fishing_surface_resolver.gd"
|
||||
)
|
||||
const ArtShopStockType = preload("res://economy/art_shop_stock.gd")
|
||||
const FishingShopStockType = preload("res://economy/fishing_shop_stock.gd")
|
||||
const WorldTimeServiceType = preload("res://world/world_time_service.gd")
|
||||
const WorldWeatherServiceType = preload(
|
||||
"res://world/world_weather_service.gd"
|
||||
|
|
@ -134,6 +132,7 @@ const ALTERNATE_REEL_ACTION: StringName = &"reel_alternate"
|
|||
var state: FishingState = FishingState.READY
|
||||
var _external_input_blocked: bool = false
|
||||
var _gameplay_input_enabled: bool = false
|
||||
var _fishing_environment_enabled: bool = true
|
||||
var _local_menu_input_owners: Dictionary[StringName, bool] = {}
|
||||
var _local_player: PlayerType
|
||||
var _local_inventory: FishInventoryType
|
||||
|
|
@ -399,6 +398,22 @@ func set_gameplay_input_enabled(enabled: bool) -> void:
|
|||
reset_transient_state()
|
||||
|
||||
|
||||
func set_fishing_environment_enabled(enabled: bool) -> void:
|
||||
if _fishing_environment_enabled == enabled:
|
||||
return
|
||||
_fishing_environment_enabled = enabled
|
||||
if enabled:
|
||||
_new_cast_press_armed = not Input.is_action_pressed("fish_primary")
|
||||
return
|
||||
if _network_fishing != null and _network_fishing.has_local_attempt():
|
||||
_network_fishing.cancel_local_attempt("")
|
||||
reset_transient_state()
|
||||
|
||||
|
||||
func is_fishing_environment_enabled() -> bool:
|
||||
return _fishing_environment_enabled
|
||||
|
||||
|
||||
func reset_transient_state(restore_movement: bool = true) -> void:
|
||||
var local_state_was_active: bool = (
|
||||
state != FishingState.READY or _active_player != null
|
||||
|
|
@ -533,6 +548,7 @@ func _process(delta: float) -> void:
|
|||
func _unhandled_input(event: InputEvent) -> void:
|
||||
if (
|
||||
not _gameplay_input_enabled
|
||||
or not _fishing_environment_enabled
|
||||
or _external_input_blocked
|
||||
or not _local_menu_input_owners.is_empty()
|
||||
):
|
||||
|
|
@ -545,51 +561,23 @@ func _unhandled_input(event: InputEvent) -> void:
|
|||
alternate_reel and state == FishingState.FIGHTING
|
||||
):
|
||||
return
|
||||
# Fishing owns the primary action only after a rod starts a cast, or while
|
||||
# completing an already-active fishing sequence. An empty hand, decor,
|
||||
# gathering tools, and other items must remain available to their own world
|
||||
# interaction controllers.
|
||||
if state == FishingState.READY and not has_active_fishing_rod():
|
||||
return
|
||||
# A held keyboard key emits echo events. Treat the alternate reel exactly
|
||||
# like a mouse button: one barrier hit per physical press, while the normal
|
||||
# held-input path continues driving free reeling between barriers.
|
||||
if event is InputEventKey and event.echo:
|
||||
get_viewport().set_input_as_handled()
|
||||
return
|
||||
var selected_item: ItemDataType = _get_active_item()
|
||||
if (
|
||||
state == FishingState.READY
|
||||
and selected_item != null
|
||||
and FishingShopStockType.is_gathering_tool(selected_item.item_id)
|
||||
):
|
||||
return
|
||||
if event.is_pressed():
|
||||
match state:
|
||||
FishingState.READY:
|
||||
if not _new_cast_press_armed:
|
||||
return
|
||||
var active_item: ItemDataType = _get_active_item()
|
||||
if (
|
||||
active_item != null
|
||||
and (
|
||||
active_item.category == ItemDataType.Category.CONSUMABLE
|
||||
or (
|
||||
active_item.item_id == PlayerItemEffectsType.FISH_FINDER_ID
|
||||
)
|
||||
)
|
||||
):
|
||||
if _network_item_use != null:
|
||||
_network_item_use.request_use(active_item.item_id)
|
||||
elif _item_effects.use_item(active_item, _local_bag):
|
||||
status_changed.emit(_item_effects.get_feedback(
|
||||
active_item.item_id
|
||||
))
|
||||
elif (
|
||||
active_item.item_id == PlayerItemEffectsType.FISH_FINDER_ID
|
||||
):
|
||||
local_speech_requested.emit(
|
||||
PlayerItemEffectsType.FISH_FINDER_DEAD_MESSAGE
|
||||
)
|
||||
get_viewport().set_input_as_handled()
|
||||
return
|
||||
if not has_active_fishing_rod():
|
||||
get_viewport().set_input_as_handled()
|
||||
return
|
||||
if (
|
||||
_is_inventory_full()
|
||||
):
|
||||
|
|
@ -661,6 +649,34 @@ func _unhandled_input(event: InputEvent) -> void:
|
|||
get_viewport().set_input_as_handled()
|
||||
|
||||
|
||||
func try_use_active_non_fishing_item() -> bool:
|
||||
if (
|
||||
not _gameplay_input_enabled
|
||||
or _external_input_blocked
|
||||
or not _local_menu_input_owners.is_empty()
|
||||
or state != FishingState.READY
|
||||
):
|
||||
return false
|
||||
var active_item: ItemDataType = _get_active_item()
|
||||
if (
|
||||
active_item == null
|
||||
or (
|
||||
active_item.category != ItemDataType.Category.CONSUMABLE
|
||||
and active_item.item_id != PlayerItemEffectsType.FISH_FINDER_ID
|
||||
)
|
||||
):
|
||||
return false
|
||||
if _network_item_use != null:
|
||||
_network_item_use.request_use(active_item.item_id)
|
||||
elif _item_effects.use_item(active_item, _local_bag):
|
||||
status_changed.emit(_item_effects.get_feedback(active_item.item_id))
|
||||
elif active_item.item_id == PlayerItemEffectsType.FISH_FINDER_ID:
|
||||
local_speech_requested.emit(
|
||||
PlayerItemEffectsType.FISH_FINDER_DEAD_MESSAGE
|
||||
)
|
||||
return true
|
||||
|
||||
|
||||
func _is_reel_input_pressed() -> bool:
|
||||
return (
|
||||
Input.is_action_pressed("fish_primary")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue