forked from woofmeow/straywild
Add gathering, unified inventory, and real-time world
This commit is contained in:
parent
173371e6fc
commit
fa57edca83
113 changed files with 6700 additions and 1307 deletions
|
|
@ -4,6 +4,9 @@ extends Node3D
|
|||
const FishingShopInteractionType = preload(
|
||||
"res://world/fishing_shop_interaction.gd"
|
||||
)
|
||||
const PlayerStorageInteractionType = preload(
|
||||
"res://world/player_storage_interaction.gd"
|
||||
)
|
||||
|
||||
@onready var _regions_root: Node3D = $Regions
|
||||
@onready var _starter_island: StarterIslandRegion = (
|
||||
|
|
@ -15,6 +18,9 @@ const FishingShopInteractionType = preload(
|
|||
@onready var _fishing_shop: FishingShopInteractionType = (
|
||||
_starter_island.get_fishing_shop()
|
||||
)
|
||||
@onready var _player_storage: PlayerStorageInteractionType = (
|
||||
_starter_island.get_player_storage()
|
||||
)
|
||||
@onready var _world_environment: WorldEnvironment = $Environment/WorldEnvironment
|
||||
@onready var _sun: DirectionalLight3D = $Environment/Sun
|
||||
|
||||
|
|
@ -38,6 +44,10 @@ func get_fishing_shop() -> FishingShopInteractionType:
|
|||
return _fishing_shop
|
||||
|
||||
|
||||
func get_player_storage() -> PlayerStorageInteractionType:
|
||||
return _player_storage
|
||||
|
||||
|
||||
func get_player_spawn_transform() -> Transform3D:
|
||||
return _starter_island.get_player_spawn_transform()
|
||||
|
||||
|
|
@ -75,6 +85,28 @@ func get_spawn_surface_triangles(
|
|||
)
|
||||
|
||||
|
||||
func get_diggable_area_triangles(
|
||||
area_id: StringName,
|
||||
) -> Array[PackedVector3Array]:
|
||||
for region: WorldRegion in _get_regions():
|
||||
var area: DiggableArea3D = region.get_diggable_area(area_id)
|
||||
if area != null:
|
||||
return area.get_surface_triangles()
|
||||
return []
|
||||
|
||||
|
||||
func get_gatherable_spawn_positions(
|
||||
anchor_set_id: StringName,
|
||||
) -> PackedVector3Array:
|
||||
for region: WorldRegion in _get_regions():
|
||||
var anchor_set: GatherableAnchorSet3D = (
|
||||
region.get_gatherable_anchor_set(anchor_set_id)
|
||||
)
|
||||
if anchor_set != null:
|
||||
return anchor_set.get_spawn_positions()
|
||||
return PackedVector3Array()
|
||||
|
||||
|
||||
func _get_regions() -> Array[WorldRegion]:
|
||||
var regions: Array[WorldRegion] = []
|
||||
for child: Node in _regions_root.get_children():
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue