Add portable RV homes and decor prototype

This commit is contained in:
Alexander Sellite 2026-08-30 21:37:26 -04:00
parent 81decf2b71
commit fe099f47dd
56 changed files with 5459 additions and 112 deletions

View file

@ -427,6 +427,9 @@ class ShowcaseCameraSnapshot:
@export_range(0.0, 1.0, 0.01) var controller_camera_deadzone: float = 0.2
@export var invert_camera_y: bool = false
var _swap_hotbar_camera_scroll: bool = false
var _rv_interior_camera_mode: bool = false
var _rv_interior_environment: Environment
var _rv_previous_camera_environment: Environment
@export_range(-89.0, 0.0, 0.5) var minimum_pitch_degrees: float = -65.0
@export_range(0.0, 89.0, 0.5) var maximum_pitch_degrees: float = 45.0
@export var minimum_zoom: float = 2.0
@ -471,6 +474,8 @@ var _held_fish_attachment_offset: Vector3 = Vector3(0.0, 0.08, 0.04)
var _held_fish_sprite: Sprite3D
var _held_art_kit_display: Node3D
var _held_art_kit_sprite: Sprite3D
var _held_decor_package_display: Node3D
var _held_decor_package_visible: bool = false
var _catch_attachment_offset: Vector3 = Vector3(0.0, 0.08, 0.04)
var _gravity: float = float(ProjectSettings.get_setting("physics/3d/default_gravity"))
@ -992,6 +997,7 @@ func _initialize_held_item_attachment() -> void:
_held_art_kit_sprite = attachment.get_node(
"HeldArtKitDisplay/HeldArtKitSprite"
) as Sprite3D
_held_decor_package_display = _build_decor_package_display(attachment)
_catch_display = attachment.get_node("CatchDisplay") as Node3D
_catch_attachment_offset = _catch_display.position
_catch_sprite = attachment.get_node("CatchDisplay/CatchSprite") as Sprite3D
@ -1322,9 +1328,7 @@ func _update_character_animation() -> void:
and supports_network_animation_action(animation_action_id)
and _character_animation_player.has_animation(animation_action_id)
)
var held_show_item_visible: bool = (
_held_fish_visible or _held_art_kit_visible
)
var held_show_item_visible: bool = _has_held_show_item()
var requested_animation: Array[StringName] = []
if _pocket_visual_active:
requested_animation = [_pocket_visual_animation]
@ -1766,7 +1770,11 @@ func _unhandled_input(event: InputEvent) -> void:
var mouse_zoom_in: bool = (
event is InputEventMouseButton
and event.shift_pressed != _swap_hotbar_camera_scroll
and (
(not event.shift_pressed)
if _rv_interior_camera_mode
else event.shift_pressed != _swap_hotbar_camera_scroll
)
and event.is_action_pressed("camera_zoom_in")
)
var controller_zoom_in: bool = (
@ -1775,7 +1783,11 @@ func _unhandled_input(event: InputEvent) -> void:
)
var mouse_zoom_out: bool = (
event is InputEventMouseButton
and event.shift_pressed != _swap_hotbar_camera_scroll
and (
(not event.shift_pressed)
if _rv_interior_camera_mode
else event.shift_pressed != _swap_hotbar_camera_scroll
)
and event.is_action_pressed("camera_zoom_out")
)
var controller_zoom_out: bool = (
@ -1963,7 +1975,11 @@ func get_active_gameplay_camera() -> Camera3D:
func _set_target_zoom(value: float) -> void:
_target_zoom = clampf(value, minimum_zoom, maximum_zoom)
_target_zoom = clampf(
value,
1.25 if _rv_interior_camera_mode else minimum_zoom,
16.0 if _rv_interior_camera_mode else maximum_zoom,
)
func _apply_axis_deadzone(value: float) -> float:
@ -3021,6 +3037,49 @@ func apply_camera_settings(
_swap_hotbar_camera_scroll = swap_hotbar_camera_scroll
func set_rv_interior_camera_mode(
enabled: bool,
excluded_wall_rids: Array[RID] = [],
) -> void:
if enabled != _rv_interior_camera_mode:
if enabled:
_rv_previous_camera_environment = _camera.environment
_camera.environment = _get_rv_interior_environment()
if _free_camera != null:
_free_camera.environment = _camera.environment
else:
_camera.environment = _rv_previous_camera_environment
if _free_camera != null:
_free_camera.environment = _camera.environment
_rv_previous_camera_environment = null
_rv_interior_camera_mode = enabled
if _spring_arm == null:
return
_spring_arm.clear_excluded_objects()
if enabled:
for collider_rid: RID in excluded_wall_rids:
if collider_rid.is_valid():
_spring_arm.add_excluded_object(collider_rid)
_set_target_zoom(_target_zoom)
func _get_rv_interior_environment() -> Environment:
if _rv_interior_environment != null:
return _rv_interior_environment
_rv_interior_environment = Environment.new()
_rv_interior_environment.background_mode = Environment.BG_COLOR
_rv_interior_environment.background_color = Color("020506")
_rv_interior_environment.ambient_light_source = (
Environment.AMBIENT_SOURCE_COLOR
)
_rv_interior_environment.ambient_light_color = Color("d6caaa")
_rv_interior_environment.ambient_light_energy = 1.0
_rv_interior_environment.reflected_light_source = (
Environment.REFLECTION_SOURCE_DISABLED
)
return _rv_interior_environment
func is_camera_input_enabled() -> bool:
return _camera_input_enabled
@ -3147,6 +3206,23 @@ func set_active_shovel(should_show: bool) -> void:
)
func set_active_decor_package(should_show: bool) -> void:
var changed: bool = _held_decor_package_visible != should_show
_held_decor_package_visible = should_show
if _held_decor_package_display != null:
_held_decor_package_display.visible = should_show
if should_show:
_fishing_rod.visible = false
if _catching_net != null:
_catching_net.visible = false
if _shovel != null:
_shovel.visible = false
elif changed:
_apply_active_rod_visibility()
if changed:
_update_character_animation()
func _apply_fishing_rod_model(rod: FishingRodDataType) -> void:
var next_id: StringName = rod.item_id if rod != null else StringName()
if next_id == _active_fishing_rod_id:
@ -3319,7 +3395,52 @@ func set_held_fish(
func _has_held_show_item() -> bool:
return _held_fish_visible or _held_art_kit_visible
return (
_held_fish_visible
or _held_art_kit_visible
or _held_decor_package_visible
)
func _build_decor_package_display(parent: Node3D) -> Node3D:
var display := Node3D.new()
display.name = "HeldDecorPackageDisplay"
display.position = Vector3(0.0, 0.1, 0.04)
display.rotation = Vector3(0.15, 0.0, -0.55)
display.visible = false
parent.add_child(display)
var sack := MeshInstance3D.new()
sack.name = "Sack"
var sack_mesh := SphereMesh.new()
sack_mesh.radius = 0.22
sack_mesh.height = 0.48
sack_mesh.radial_segments = 8
sack_mesh.rings = 4
sack_mesh.material = _decor_package_material(Color("a87843"))
sack.mesh = sack_mesh
display.add_child(sack)
var tie := MeshInstance3D.new()
tie.name = "Tie"
var tie_mesh := CylinderMesh.new()
tie_mesh.top_radius = 0.1
tie_mesh.bottom_radius = 0.12
tie_mesh.height = 0.08
tie_mesh.radial_segments = 8
tie_mesh.material = _decor_package_material(Color("513829"))
tie.mesh = tie_mesh
tie.position = Vector3(0.0, 0.22, 0.0)
display.add_child(tie)
return display
func _decor_package_material(color: Color) -> StandardMaterial3D:
var material := StandardMaterial3D.new()
material.albedo_color = color
material.roughness = 1.0
material.shading_mode = BaseMaterial3D.SHADING_MODE_PER_VERTEX
return material
func _clear_held_fish() -> void: