added realtime day night cycle based on system time

This commit is contained in:
Derek
2025-03-16 13:05:28 -05:00
parent efb3fee189
commit e3b887d66c
21 changed files with 2613 additions and 2298 deletions

View File

@@ -6,7 +6,6 @@ extends RigidBody3D
@onready var level_control = get_tree().current_scene
var pickupable = true
var gun_already_held = false
# Called when the node enters the scene tree for the first time.
func _ready():
@@ -18,14 +17,17 @@ func _process(delta):
pass
func picked_up():
var spawn_gun = gun_resource.instantiate()
var gun_held = false
#check if gun is owned
for i in GameGlobals.held_guns:
if i == gun_resource:
gun_already_held = true
gun_held = true
if !gun_already_held:
var spawn_gun = gun_resource.instantiate()
if spawn_gun.weapon_info.weapon_type == 0:
level_control.player.add_ammo(true,spawn_gun.weapon_info.gun_name,spawn_gun.weapon_info.bullet.ammo_type,spawn_gun.weapon_info.max_ammo,spawn_gun.weapon_info.start_mags)
if spawn_gun.weapon_info.weapon_type == 0:
add_ammo(gun_held,spawn_gun.weapon_info.gun_name,spawn_gun.weapon_info.bullet.ammo_type,spawn_gun.weapon_info.bullet.special_bullet_name,spawn_gun.weapon_info.max_ammo,spawn_gun.weapon_info.start_mags)
if !gun_held:
GameGlobals.held_guns.append(gun_resource)
var instance_gun = gun_resource.instantiate()
var weapon_id = GameGlobals.held_guns.size() - 1
@@ -35,6 +37,17 @@ func picked_up():
SignalBus.emit_signal("weapon_list_changed")
queue_free()
func add_ammo(new_gun,gun_name,ammo_type,special_bullet_name,max_ammo,start_mags):
if new_gun:
GameGlobals.gun_ammo[gun_name] = max_ammo
if GameGlobals.ammo_reserve.has(str(ammo_type)):
GameGlobals.ammo_reserve[str(ammo_type)] += start_mags * max_ammo
else:
GameGlobals.ammo_reserve[str(ammo_type)] = start_mags * max_ammo
print("GUN AMMO ",GameGlobals.gun_ammo)
print("RESERVE AMMO ", GameGlobals.ammo_reserve)
func save():
var save_dict = {
"filename" : get_scene_file_path(),