added docs section and tweaks to chest spawning

This commit is contained in:
Derek
2025-04-09 22:54:18 -05:00
parent ce08df66e6
commit e39bd221b0
36 changed files with 83599 additions and 36 deletions

View File

@@ -9,6 +9,7 @@ class_name Chest
var serial_number
var open = false
var drop_weapon
var claimed = false
@onready var anim_player: AnimationPlayer = $AnimationPlayer
@onready var item_spawn: RayCast3D = $itemspawn

View File

@@ -7,6 +7,7 @@ signal game_loaded()
##PLAYER
signal money_deposited()
signal money_changed()
signal player_exiting_tree()
signal player_hit()
signal shot_fired(crosshair_jump_amount)

View File

@@ -18,7 +18,8 @@ func spawn_chests():
while number_chests > 0:
var chest_loc = chest_spawners.pick_random()
var instance_chest = CHEST_1.instantiate()
get_tree().current_scene.add_child(instance_chest)
add_child(instance_chest)
instance_chest.global_basis = chest_loc.global_basis
instance_chest.global_position = chest_loc.global_position + chest_loc.random_box_pos()
print("CHEST SPAWNED AT : ",instance_chest.global_position)
number_chests -= 1

View File

@@ -1,3 +0,0 @@
extends Node3D
@export_enum("Interior","Exterior") var sky_type = 1

View File

@@ -1 +0,0 @@
uid://b81yg4r8e5ecj

View File

@@ -13,6 +13,15 @@ func _on_player_detect_body_entered(body: Node3D) -> void:
if open and active:
anim_player.play("close")
open = false
if body is Chest:
if !body.claimed:
body.claimed = true
var old_pos = body.global_position
body.get_parent().remove_child(body)
get_tree().current_scene.add_child(body)
body.global_position = old_pos
func _on_switch_1_switch_changed() -> void:
if open: