Rework island water and shop character
This commit is contained in:
parent
0d50c324e9
commit
352350157b
65 changed files with 1144 additions and 1120 deletions
|
|
@ -5,9 +5,6 @@ extends WorldRegion
|
|||
const FishingShopInteractionType = preload(
|
||||
"res://world/fishing_shop_interaction.gd"
|
||||
)
|
||||
const GRASS_SURFACE_NAME: String = "grass_lite"
|
||||
const SAND_SURFACE_NAME: String = "sand"
|
||||
const SANDSTONE_SURFACE_NAME: String = "sandstone_heavy"
|
||||
|
||||
@export_group("Owned Nodes")
|
||||
@export_node_path("MeshInstance3D")
|
||||
|
|
@ -26,31 +23,12 @@ var player_spawn_path: NodePath = ^"PlayerSpawn"
|
|||
var fishing_shop_path: NodePath = (
|
||||
^"Interactables/FishingShopWorld/InteractionArea"
|
||||
)
|
||||
@export_node_path("Node3D")
|
||||
var pelican_landmark_path: NodePath = (
|
||||
^"Interactables/PelicanCoolerPerch"
|
||||
)
|
||||
|
||||
@export_group("Grass Surface")
|
||||
@export var apply_surface_overrides: bool = true
|
||||
@export var grass_material: Material
|
||||
@export_range(0, 16, 1) var grass_surface_index: int = 0
|
||||
|
||||
@export_group("Sand Surface")
|
||||
@export var sand_material: Material
|
||||
@export_range(0, 16, 1) var sand_surface_index: int = 4
|
||||
|
||||
@export_group("Sandstone Surface")
|
||||
@export var sandstone_material: Material
|
||||
@export_range(0, 16, 1) var sandstone_surface_index: int = 5
|
||||
|
||||
@export_group("Terrain Collision")
|
||||
@export var rebuild_terrain_collision_on_ready: bool = false
|
||||
|
||||
func _ready() -> void:
|
||||
if apply_surface_overrides:
|
||||
_apply_grass_material()
|
||||
_apply_sand_material()
|
||||
_apply_sandstone_material()
|
||||
_build_terrain_collision()
|
||||
if rebuild_terrain_collision_on_ready or not has_terrain_collision():
|
||||
_build_terrain_collision()
|
||||
if Engine.is_editor_hint():
|
||||
update_configuration_warnings()
|
||||
|
||||
|
|
@ -64,10 +42,6 @@ func get_fishing_shop() -> FishingShopInteractionType:
|
|||
return get_node_or_null(fishing_shop_path) as FishingShopInteractionType
|
||||
|
||||
|
||||
func get_pelican_landmark() -> Node3D:
|
||||
return get_node_or_null(pelican_landmark_path) as Node3D
|
||||
|
||||
|
||||
func get_saltwater_shoreline_mesh() -> MeshInstance3D:
|
||||
return get_node_or_null(^"ShorelineRibbons/Ocean") as MeshInstance3D
|
||||
|
||||
|
|
@ -79,81 +53,6 @@ func has_terrain_collision() -> bool:
|
|||
return collision_shape != null and collision_shape.shape != null
|
||||
|
||||
|
||||
func _apply_grass_material() -> void:
|
||||
var visual_mesh: MeshInstance3D = (
|
||||
get_node_or_null(visual_mesh_path) as MeshInstance3D
|
||||
)
|
||||
if visual_mesh == null or visual_mesh.mesh == null:
|
||||
push_error("Starter island visual mesh is unavailable.")
|
||||
return
|
||||
if grass_material == null:
|
||||
push_error("Starter island grass material is unavailable.")
|
||||
return
|
||||
if grass_surface_index >= visual_mesh.mesh.get_surface_count():
|
||||
push_error("Starter island grass surface index is invalid.")
|
||||
return
|
||||
if (
|
||||
visual_mesh.mesh.surface_get_name(grass_surface_index)
|
||||
!= GRASS_SURFACE_NAME
|
||||
):
|
||||
push_error("Starter island grass surface name does not match.")
|
||||
return
|
||||
visual_mesh.set_surface_override_material(
|
||||
grass_surface_index,
|
||||
grass_material
|
||||
)
|
||||
|
||||
|
||||
func _apply_sand_material() -> void:
|
||||
var visual_mesh: MeshInstance3D = (
|
||||
get_node_or_null(visual_mesh_path) as MeshInstance3D
|
||||
)
|
||||
if visual_mesh == null or visual_mesh.mesh == null:
|
||||
push_error("Starter island visual mesh is unavailable.")
|
||||
return
|
||||
if sand_material == null:
|
||||
push_error("Starter island sand material is unavailable.")
|
||||
return
|
||||
if sand_surface_index >= visual_mesh.mesh.get_surface_count():
|
||||
push_error("Starter island sand surface index is invalid.")
|
||||
return
|
||||
if (
|
||||
visual_mesh.mesh.surface_get_name(sand_surface_index)
|
||||
!= SAND_SURFACE_NAME
|
||||
):
|
||||
push_error("Starter island sand surface name does not match.")
|
||||
return
|
||||
visual_mesh.set_surface_override_material(
|
||||
sand_surface_index,
|
||||
sand_material
|
||||
)
|
||||
|
||||
|
||||
func _apply_sandstone_material() -> void:
|
||||
var visual_mesh: MeshInstance3D = (
|
||||
get_node_or_null(visual_mesh_path) as MeshInstance3D
|
||||
)
|
||||
if visual_mesh == null or visual_mesh.mesh == null:
|
||||
push_error("Starter island visual mesh is unavailable.")
|
||||
return
|
||||
if sandstone_material == null:
|
||||
push_error("Starter island sandstone material is unavailable.")
|
||||
return
|
||||
if sandstone_surface_index >= visual_mesh.mesh.get_surface_count():
|
||||
push_error("Starter island sandstone surface index is invalid.")
|
||||
return
|
||||
if (
|
||||
visual_mesh.mesh.surface_get_name(sandstone_surface_index)
|
||||
!= SANDSTONE_SURFACE_NAME
|
||||
):
|
||||
push_error("Starter island sandstone surface name does not match.")
|
||||
return
|
||||
visual_mesh.set_surface_override_material(
|
||||
sandstone_surface_index,
|
||||
sandstone_material
|
||||
)
|
||||
|
||||
|
||||
func _build_terrain_collision() -> void:
|
||||
var terrain_root: Node = get_node_or_null(terrain_visual_root_path)
|
||||
if terrain_root == null:
|
||||
|
|
@ -218,39 +117,6 @@ func _get_configuration_warnings() -> PackedStringArray:
|
|||
warnings.append("Terrain/Visual must provide the island mesh.")
|
||||
return warnings
|
||||
|
||||
if apply_surface_overrides:
|
||||
if grass_surface_index >= visual_mesh.mesh.get_surface_count():
|
||||
warnings.append("Grass surface index is outside the terrain mesh.")
|
||||
elif (
|
||||
visual_mesh.mesh.surface_get_name(grass_surface_index)
|
||||
!= GRASS_SURFACE_NAME
|
||||
):
|
||||
warnings.append("Grass surface index must identify the grass surface.")
|
||||
if grass_material == null:
|
||||
warnings.append("Assign the starter-island grass material.")
|
||||
|
||||
if sand_surface_index >= visual_mesh.mesh.get_surface_count():
|
||||
warnings.append("Sand surface index is outside the terrain mesh.")
|
||||
elif (
|
||||
visual_mesh.mesh.surface_get_name(sand_surface_index)
|
||||
!= SAND_SURFACE_NAME
|
||||
):
|
||||
warnings.append("Sand surface index must identify the sand surface.")
|
||||
if sand_material == null:
|
||||
warnings.append("Assign the starter-island sand material.")
|
||||
if sandstone_surface_index >= visual_mesh.mesh.get_surface_count():
|
||||
warnings.append(
|
||||
"Sandstone surface index is outside the terrain mesh."
|
||||
)
|
||||
elif (
|
||||
visual_mesh.mesh.surface_get_name(sandstone_surface_index)
|
||||
!= SANDSTONE_SURFACE_NAME
|
||||
):
|
||||
warnings.append(
|
||||
"Sandstone surface index must identify the sandstone surface."
|
||||
)
|
||||
if sandstone_material == null:
|
||||
warnings.append("Assign the starter-island sandstone material.")
|
||||
if get_node_or_null(terrain_collision_shape_path) == null:
|
||||
warnings.append("Terrain/Collision must provide a collision shape.")
|
||||
if get_node_or_null(terrain_visual_root_path) == null:
|
||||
|
|
@ -259,6 +125,4 @@ func _get_configuration_warnings() -> PackedStringArray:
|
|||
warnings.append("PlayerSpawn marker is missing.")
|
||||
if get_node_or_null(fishing_shop_path) == null:
|
||||
warnings.append("Fishing Shop placement is missing.")
|
||||
if get_node_or_null(pelican_landmark_path) == null:
|
||||
warnings.append("Pelican placement is missing.")
|
||||
return warnings
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue