When re-entering the RockyHill map and climbing to the top, the container that was created after you destroy the furniture has duplicated
Steps to reproduce:
Start a new game
Travel to RockyHill using the overmap
Climb to the top and destroy the chair from a distance
Observe there is one container
Travel back to 0,0 using the overmap
Travel back to the same rockyhill as you were before and climb to the top
Observe there are now two containers
This is probably cause by the container being close to the edge of the chunks and two of them consider the container to be part of it. So when the chunks are re-loaded, they both spawn the same container, duplicating them.
The ContainerItem class is used in several scripts within the repository. Here are the relevant matches:
Definition of ContainerItem Class
File:Scripts/container.gd
Snippet:
class_name ContainerItem
extends Node3D
Usage in FurniturePhysics.gd
File:Scripts/FurniturePhysics.gd
Snippet:
# When the furniture is destroyed, it leaves a wreck behind
func add_corpse(pos: Vector3):
if can_be_destroyed():
var newItem: ContainerItem = ContainerItem.new()
var itemgroup = furnitureJSONData.get("destruction", {}).get("group", "")
if itemgroup:
Usage in FurnitureStatic.gd
File:Scripts/FurnitureStatic.gd
Snippet:
var door_state: String = "Closed" # Default state
var container: ContainerItem = null # Reference to the container, if this furniture acts as one
if "Function" in furnitureJSONData and "container" in furnitureJSONData["Function"]:
container = ContainerItem.new()
container.construct_self(pos)
Usage in Chunk.gd
File:Scripts/Chunk.gd
Snippet:
# Called by generate_items function when a save is loaded
func add_item_to_map(item: Dictionary):
var newItem: ContainerItem = ContainerItem.new()
newItem.add_to_group("mapitems")
var pos: Vector3 = Vector3(item.global_position_x,item.global_position_y,item.global_position_z)
newItem.construct_self(pos)
Usage in Mob.gd
File:Scripts/Mob.gd
Snippet:
func add_corpse(pos: Vector3):
var newItem: ContainerItem = ContainerItem.new()
# Retrieve mob data from Gamedata
var mob_data = Gamedata.get_data_by_id(Gamedata.data.mobs, mobJSON.id)
These usages indicate that the ContainerItem class is primarily used in functions that handle the creation and management of container items in different contexts, such as furniture, chunks, and mobs.
The functions add_to_group("mapitems") and get_nodes_in_group("mapitems") are used in the following context within the repository:
Usage in Chunk.gd
File:Scripts/Chunk.gd
Snippet for add_to_group("mapitems"):
var newItem: ContainerItem = ContainerItem.new()
newItem.add_to_group("mapitems")
var pos: Vector3 = Vector3(item.global_position_x,item.global_position_y,item.global_position_z)
newItem.construct_self(pos)
Snippet for get_nodes_in_group("mapitems"):
}
var mapitems = get_tree().get_nodes_in_group("mapitems")
var newitemData: Dictionary
These functions are used in the Chunk.gd script to manage items within a specific group, mapitems. The add_to_group("mapitems") function is used to add a new ContainerItem instance to the mapitems group. The get_nodes_in_group("mapitems") function is used to retrieve all nodes that belong to the mapitems group from the scene tree.
The functions add_to_group("Containers") and get_nodes_in_group("Containers") are used in the following files:
Usage in ItemDetector.gd
File:Scripts/ItemDetector.gd
Snippet for get_nodes_in_group("Containers"):
func _on_area_entered(area):
if area.get_owner().is_in_group("Containers"):
# Add area to the dictionary and check initial proximity status
areas_in_proximity[area] = is_clear_path_to_area(area)
if areas_in_proximity[area]:
Helper.signal_broker.container_entered_proximity.emit(area.get_owner())
func update_visibility(player_y: float):
# Update container visibility
for container in get_tree().get_nodes_in_group("Containers"):
var is_above_player = container.global_position.y > player_y
container.visible = not is_above_player
These usages indicate that the Containers group is utilized to manage container items within the game, checking their proximity, visibility, and adding them to the scene tree.
When re-entering the RockyHill map and climbing to the top, the container that was created after you destroy the furniture has duplicated
Steps to reproduce:
This is probably cause by the container being close to the edge of the chunks and two of them consider the container to be part of it. So when the chunks are re-loaded, they both spawn the same container, duplicating them.
The
ContainerItem
class is used in several scripts within the repository. Here are the relevant matches:Definition of
ContainerItem
ClassScripts/container.gd
Usage in
FurniturePhysics.gd
Scripts/FurniturePhysics.gd
Snippet:
Usage in
FurnitureStatic.gd
Scripts/FurnitureStatic.gd
Snippet:
Usage in
Chunk.gd
Scripts/Chunk.gd
Usage in
Mob.gd
Scripts/Mob.gd
Snippet:
These usages indicate that the
ContainerItem
class is primarily used in functions that handle the creation and management of container items in different contexts, such as furniture, chunks, and mobs.The functions
add_to_group("mapitems")
andget_nodes_in_group("mapitems")
are used in the following context within the repository:Chunk.gd
Scripts/Chunk.gd
add_to_group("mapitems")
:get_nodes_in_group("mapitems")
:These functions are used in the
Chunk.gd
script to manage items within a specific group,mapitems
. Theadd_to_group("mapitems")
function is used to add a newContainerItem
instance to themapitems
group. Theget_nodes_in_group("mapitems")
function is used to retrieve all nodes that belong to themapitems
group from the scene tree.The functions
add_to_group("Containers")
andget_nodes_in_group("Containers")
are used in the following files:Usage in
ItemDetector.gd
Scripts/ItemDetector.gd
get_nodes_in_group("Containers")
:Usage in
container.gd
Scripts/container.gd
add_to_group("Containers")
:Usage in
LevelManager.gd
LevelManager.gd
get_nodes_in_group("Containers")
:These usages indicate that the
Containers
group is utilized to manage container items within the game, checking their proximity, visibility, and adding them to the scene tree.