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

@@ -5,11 +5,7 @@ class_name level
@export var gamemode : gamemode
@export var player : Node
@export var MAX_PARTICLES = 100
@export_group("Drops")
@export var drop_chance_minimum = .1
@export var expected_ammo = {"light" : 200, "medium" : 50, "heavy" : 25,"shotgun" : 20, "rocket" : 3} #light, medium,heavy,shotgun,rocket
@export var stamina_drop_enabled = true
@export var money_drop_enabled = true
@export var time_based_sun : DirectionalLight3D
const ITEM_PICKUP = preload("res://assets/item_pickup.tscn")
const CROWN = preload("res://assets/crown.tscn")
@@ -208,22 +204,22 @@ func pickup_spawn(randomized):
else:
var health_weight
if gamemode.health_drop_enabled:
health_weight = (1.0 - (GameGlobals.health / gamemode.start_health)) + drop_chance_minimum
health_weight = (1.0 - (GameGlobals.health / gamemode.start_health)) + gamemode.drop_chance_minimum
else:
health_weight = 0
var stamina_weight
if stamina_drop_enabled:
stamina_weight = (1.0 - (player.remaining_stamina / gamemode.max_stamina)) + drop_chance_minimum
if gamemode.stamina_drop_enabled:
stamina_weight = (1.0 - (player.remaining_stamina / gamemode.max_stamina)) + gamemode.drop_chance_minimum
else:
stamina_weight = 0
var money_weight
if money_drop_enabled:
money_weight = 1 + drop_chance_minimum #fix this logic later once the economy makes sense
if gamemode.money_drop_enabled:
money_weight = 1 + gamemode.drop_chance_minimum #fix this logic later once the economy makes sense
else:
money_weight = 0
var ammo_weight
if gamemode.ammo_drop_enabled:
ammo_weight = drop_chance_minimum
ammo_weight = gamemode.drop_chance_minimum
else: ammo_weight = 0
var ammo_type_weight = {}
@@ -247,7 +243,7 @@ func pickup_spawn(randomized):
if i_weight > ammo_weight:
ammo_weight = i_weight
ammo_type_weight.erase(5)
ammo_type_weight[i] = i_weight + drop_chance_minimum
ammo_type_weight[i] = i_weight + gamemode.drop_chance_minimum
pickup_type = HelperFuncs.weighted_random({"0" : ammo_weight, "1" : stamina_weight,"2" : health_weight,"3" : money_weight})