Implements modifier system for weapons

Adds a modifier system allowing dynamic modification of weapon
stats and behavior. This includes:

- Creating ModifierLibrary to manage available modifiers.
- Adds ModifierManager to handle equipping and unequipping modifiers
- Adds a new RangedWeaponComponent to handle firing projectiles and
  managing modifiers.
- Introduces a DebugUI for in-game modifier management.
- Introduces an "Unlimited Power" modifier that changes the projectile scene.
- Modifies stats components to work with the new modifier system.

This system allows for more flexible and customizable weapon
functionality.
This commit is contained in:
Dan Baker 2025-05-08 18:31:19 +01:00
parent 9f66ab0a73
commit 70839387ca
22 changed files with 432 additions and 40 deletions

View file

@ -29,7 +29,7 @@ func initialize_cache(folder_path: String, preload_scenes: bool = false):
scene_files.append(folder_path + "/" + file_name)
file_name = dir.get_next()
Log.pr("Found %d scene files in %s" % [scene_files.size(), folder_path])
#Log.pr("Found %d scene files in %s" % [scene_files.size(), folder_path])
# Store in cache
_scene_paths_cache[folder_path] = scene_files
@ -37,7 +37,7 @@ func initialize_cache(folder_path: String, preload_scenes: bool = false):
if preload_scenes and scene_files.size() > 0:
_loaded_scenes_cache[folder_path] = []
for scene_path in scene_files:
Log.pr("Preloading scene: " + scene_path)
#Log.pr("Preloading scene: " + scene_path)
# Load the scene and store it in the cache
#var loaded_scene = preload(scene_path)
_loaded_scenes_cache[folder_path].append(load(scene_path))
@ -47,7 +47,7 @@ func initialize_cache(folder_path: String, preload_scenes: bool = false):
func get_random_scene(folder_path: String):
# Make sure the cache is initialized
if not _scene_paths_cache.has(folder_path):
Log.pr("Initializing cache for folder: " + folder_path)
#Log.pr("Initializing cache for folder: " + folder_path)
initialize_cache(folder_path, true)
var scene_paths = _scene_paths_cache[folder_path]
@ -60,10 +60,10 @@ func get_random_scene(folder_path: String):
# Return from loaded scenes cache if available
if _loaded_scenes_cache.has(folder_path):
Log.pr("Returning preloaded scene from cache")
#Log.pr("Returning preloaded scene from cache")
return _loaded_scenes_cache[folder_path][random_index]
# Otherwise load the scene
var scene = load(scene_paths[random_index])
Log.pr(scene)
#Log.pr(scene)
return scene