added docs section and tweaks to chest spawning
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -1,3 +0,0 @@
|
||||
extends Node3D
|
||||
|
||||
@export_enum("Interior","Exterior") var sky_type = 1
|
||||
@@ -1 +0,0 @@
|
||||
uid://b81yg4r8e5ecj
|
||||
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user