level bounds now don't error out on save/quit
This commit is contained in:
@@ -37,7 +37,7 @@ ssr_enabled = true
|
|||||||
ssao_enabled = true
|
ssao_enabled = true
|
||||||
ssil_enabled = true
|
ssil_enabled = true
|
||||||
sdfgi_enabled = true
|
sdfgi_enabled = true
|
||||||
sdfgi_energy = 3.0
|
sdfgi_energy = 2.0
|
||||||
glow_enabled = true
|
glow_enabled = true
|
||||||
glow_intensity = 2.0
|
glow_intensity = 2.0
|
||||||
fog_mode = 1
|
fog_mode = 1
|
||||||
|
|||||||
@@ -60,15 +60,7 @@ func _ready():
|
|||||||
else:
|
else:
|
||||||
refresh_scene()
|
refresh_scene()
|
||||||
|
|
||||||
#Spawn Crown
|
spawn_crown()
|
||||||
if GameGlobals.last_hit_path:
|
|
||||||
var crown_spawn = CROWN.instantiate()
|
|
||||||
var crown_target = get_node(GameGlobals.last_hit_path)
|
|
||||||
if crown_target:
|
|
||||||
crown_target.add_child(crown_spawn)
|
|
||||||
crown_spawn.position = Vector3(0,2,0)
|
|
||||||
if crown_target.is_in_group("enemy"):
|
|
||||||
crown_target.loot_amount = 10
|
|
||||||
#global randomize function
|
#global randomize function
|
||||||
randomize()
|
randomize()
|
||||||
|
|
||||||
@@ -105,6 +97,16 @@ func refresh_scene():
|
|||||||
GameGlobals.health = gamemode.start_health
|
GameGlobals.health = gamemode.start_health
|
||||||
|
|
||||||
|
|
||||||
|
func spawn_crown():
|
||||||
|
#Spawn Crown
|
||||||
|
if GameGlobals.last_hit_path:
|
||||||
|
var crown_spawn = CROWN.instantiate()
|
||||||
|
var crown_target = get_node(GameGlobals.last_hit_path)
|
||||||
|
if crown_target:
|
||||||
|
crown_target.add_child(crown_spawn)
|
||||||
|
crown_spawn.position = Vector3(0,2,0)
|
||||||
|
if crown_target.is_in_group("enemy"):
|
||||||
|
crown_target.loot_amount = 10
|
||||||
|
|
||||||
func gun_spawn(index):
|
func gun_spawn(index):
|
||||||
|
|
||||||
|
|||||||
@@ -5,6 +5,8 @@ var level_collision_shapes : Array[CollisionShape3D]
|
|||||||
var check_collision = true
|
var check_collision = true
|
||||||
|
|
||||||
func _ready() -> void:
|
func _ready() -> void:
|
||||||
|
SignalBus.player_exiting_tree.connect(player_exiting_tree)
|
||||||
|
|
||||||
for i in get_children():
|
for i in get_children():
|
||||||
if i is CollisionShape3D:
|
if i is CollisionShape3D:
|
||||||
level_collision_shapes.append(i)
|
level_collision_shapes.append(i)
|
||||||
@@ -18,8 +20,10 @@ func _on_body_exited(body: Node3D) -> void:
|
|||||||
body.global_position = body.last_ground_pos + Vector3(0,10,0)
|
body.global_position = body.last_ground_pos + Vector3(0,10,0)
|
||||||
|
|
||||||
func toggle_collision(collision_state):
|
func toggle_collision(collision_state):
|
||||||
print("COLLISION STATE: ",collision_state)
|
|
||||||
check_collision = collision_state
|
check_collision = collision_state
|
||||||
if level_collision_shapes != null and level_collision_shapes != []:
|
if level_collision_shapes != null and level_collision_shapes != []:
|
||||||
for i in level_collision_shapes:
|
for i in level_collision_shapes:
|
||||||
i.disabled = collision_state
|
i.disabled = collision_state
|
||||||
|
|
||||||
|
func player_exiting_tree():
|
||||||
|
toggle_collision(false)
|
||||||
|
|||||||
@@ -138,7 +138,6 @@ var controlled_elsewhere = false
|
|||||||
@onready var motion_lines: ColorRect = $Head/Recoil/Camera3D/MotionLines
|
@onready var motion_lines: ColorRect = $Head/Recoil/Camera3D/MotionLines
|
||||||
@onready var moveable_holder: Node3D = $Head/Recoil/Camera3D/MoveableHolder
|
@onready var moveable_holder: Node3D = $Head/Recoil/Camera3D/MoveableHolder
|
||||||
@onready var stand_check: RayCast3D = $StandCheck
|
@onready var stand_check: RayCast3D = $StandCheck
|
||||||
@onready var r_hand_test: MeshInstance3D = $Head/Recoil/Camera3D/WeaponHolder/RHandTest
|
|
||||||
@onready var enemy_killed_audio: AudioStreamPlayer = $Audio/EnemyKilled
|
@onready var enemy_killed_audio: AudioStreamPlayer = $Audio/EnemyKilled
|
||||||
@onready var footstep_sound: AudioStreamPlayer3D = $Audio/FootstepSound
|
@onready var footstep_sound: AudioStreamPlayer3D = $Audio/FootstepSound
|
||||||
@onready var standing_collision: CollisionShape3D = $StandingCollision
|
@onready var standing_collision: CollisionShape3D = $StandingCollision
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ func change_sun():
|
|||||||
sun.rotation.x = sun_details["angle"]
|
sun.rotation.x = sun_details["angle"]
|
||||||
sun.rotation.y = north_offset
|
sun.rotation.y = north_offset
|
||||||
sun.light_energy = sun_details["energy"]
|
sun.light_energy = sun_details["energy"]
|
||||||
moon.light_energy = (2 - sun_details["energy"]) * .5
|
moon.light_energy = (2 - sun_details["energy"]) * .25
|
||||||
|
|
||||||
func sun_angle_from_time():
|
func sun_angle_from_time():
|
||||||
var time_dict = Time.get_time_dict_from_system()
|
var time_dict = Time.get_time_dict_from_system()
|
||||||
|
|||||||
@@ -21,6 +21,9 @@ func _on_body_entered(body: Node3D) -> void:
|
|||||||
scene_holder.add_child(scene)
|
scene_holder.add_child(scene)
|
||||||
scene.global_position = global_position + SCENE_SPAWN_OFFSET
|
scene.global_position = global_position + SCENE_SPAWN_OFFSET
|
||||||
|
|
||||||
|
var level_control = get_tree().current_scene
|
||||||
|
level_control.spawn_crown()
|
||||||
|
|
||||||
entered = true
|
entered = true
|
||||||
if active and entered:
|
if active and entered:
|
||||||
var spawned_stuff = scene_holder.get_children()
|
var spawned_stuff = scene_holder.get_children()
|
||||||
|
|||||||
Reference in New Issue
Block a user