Releases: HeavenDCS/DCS-DynamicLoaderHeaven
Releases Β· HeavenDCS/DCS-DynamicLoaderHeaven
Release V2.0
HeavenLoader Changelog
All notable changes to HeavenLoader will be documented in this file.
[2.0.0] - 2025-11-27
π Major Release - Feature Complete Edition
This release transforms HeavenLoader from a simple script loader into a comprehensive script management system for DCS World. All new features are optional and configurable - the loader remains fully backwards compatible with v1.x configurations.
β¨ New Features
π Script Dependencies System
- Scripts can now declare dependencies on other scripts
- Dependencies are automatically resolved before loading
- Pending scripts queue until dependencies are satisfied
- Enable:
enableDependencies = true - Usage:
scriptFiles = { "Utilities.lua", {file = "CombatSystem.lua", depends = {"Utilities.lua"}}, }
π Smart Hot-Reload
- Only reloads scripts that have actually changed (based on file modification time)
- Significantly reduces reload overhead when using auto-update
- Enable:
enableSmartReload = true
π Script Sandboxing / Isolation
- Each script gets its own isolated environment
- Prevents one script from accidentally breaking another
- Tracks global variables created by each script
- Enable:
enableSandboxing = true
π Lifecycle Hooks
- Scripts can now define
onLoad()andonUnload()functions - Called automatically when scripts are loaded or unloaded
- Perfect for cleanup and initialization logic
- Enable:
enableLifecycleHooks = true - Usage in your scripts:
function onLoad() env.info("My script initialized!") end function onUnload() env.info("My script cleaning up!") end
π οΈ Built-in Utility Functions
- Comprehensive helper functions for common DCS operations
- Accessible via
HeavenLoader.utils - Enable:
enableUtilities = true(enabled by default) - Available utilities:
- Messages:
msgAll(),msgCoalition(),msgGroup() - Timers:
delay(),cancelDelay(),getMissionTime() - Events:
onEvent(),removeEventHandler() - Spawning:
spawnGroup(),spawnStatic() - Units:
getGroupByName(),getUnitByName(),getPlayerUnits() - Zones:
getZone(),isUnitInZone() - Markers:
addMarker(),removeMarker() - Flags:
setFlag(),getFlag() - Coordinates:
vec3ToVec2(),vec2ToVec3(),getDistance(),getDistance2D()
- Messages:
β Configuration Validation
- Validates all configuration options on startup
- Warns about potentially problematic settings
- Prevents common configuration mistakes
- Enable:
enableConfigValidation = true(enabled by default)
π¦ Script Profiles / Groups
- Define different script sets for different scenarios
- Switch between profiles easily
- Great for PvP vs PvE missions
- Enable:
enableProfiles = true - Usage:
profiles = { ["PvP"] = {"Moose.lua", "ScoringSystem.lua"}, ["PvE"] = {"Moose.lua", "SARSystem.lua", "EnemyAI.lua"}, }, activeProfile = "PvE",
π Error Recovery & Retry
- Automatically retries failed scripts after a delay
- Configurable retry count and delay
- Useful for scripts with timing dependencies
- Enable:
enableErrorRecovery = true - Configure:
retryDelay = 30, -- seconds between retries maxRetries = 3, -- max retry attempts
β±οΈ Performance Tracking
- Tracks how long each script takes to load
- Visible in admin menu and logs
- Helps identify slow-loading scripts
- Enable:
enablePerformanceTracking = true
π» F10 Admin Menu
- In-game control panel for HeavenLoader
- Reload scripts, view status, toggle settings
- Coalition-restricted or available to all
- Enable:
enableAdminMenu = true - Menu Options:
- Reload All Scripts
- List Loaded Scripts (with load times if tracking enabled)
- Show Failed Scripts
- Toggle Verbose Mode
- Show Loader Status
πΎ State Persistence
- Save and restore script state across mission restarts
- Integrates with DCS persistence system when available
- Enable:
enablePersistence = true - Usage in your scripts:
-- Save state HeavenLoader.saveState("myKey", {score = 100, level = 5}) -- Load state local data = HeavenLoader.loadState("myKey", {score = 0, level = 1})
π DCS Version Check
- Warns if running on untested DCS version
- Non-blocking - scripts still load
- Enable:
enableVersionCheck = true(enabled by default)
π Silent Error Detection
- Periodically checks for common silent errors
- Detects corrupted globals (MOOSE, MIST, etc.)
- Logs warnings when issues are detected
- Enable:
enableSilentErrorDetection = true(enabled by default) - Configure:
silentErrorCheckInterval = 5(seconds)
π§ Improvements
- Better Logging: More detailed and structured log messages
- Version Bump: Now v2.0 to reflect major feature additions
- Global Access:
HeavenLoaderis now globally accessible for other scripts - Cleaner Code Structure: Modular internal organization
π Full Configuration Reference
local CONFIG = {
-- CORE SETTINGS
scriptDirectory = lfs.writedir() .. "Scripts\\ServerSide\\",
enabled = true,
alphabeticOrder = false,
scriptFiles = {
"Moose.lua",
"SARSystem.lua",
},
filePattern = "%.lua$",
verbose = true,
autoUpdate = false,
updateInterval = 300,
-- OPTIONAL FEATURES
enableDependencies = false, -- Script dependency resolution
enableSmartReload = false, -- Only reload changed files
enableSandboxing = false, -- Isolate scripts
enableLifecycleHooks = false, -- onLoad/onUnload support
enableUtilities = true, -- HeavenLoader.utils helpers
enableConfigValidation = true, -- Validate config on startup
enableProfiles = false, -- Script profile switching
activeProfile = "default",
profiles = {},
enableErrorRecovery = false, -- Retry failed scripts
retryDelay = 30,
maxRetries = 3,
enablePerformanceTracking = false, -- Track load times
enableAdminMenu = false, -- F10 admin controls
adminMenuCoalition = nil, -- nil = all, or coalition.side.BLUE/RED
enablePersistence = false, -- State save/restore
enableVersionCheck = true, -- DCS version warnings
testedDCSVersion = "2.9",
enableSilentErrorDetection = true, -- Detect silent errors
silentErrorCheckInterval = 5,
}π Migration from v1.x
No changes required! HeavenLoader v2.0 is fully backwards compatible. Your existing configuration will work without modification. New features are disabled by default and can be enabled as needed.
π Credits
- Original Concept: asherao
- Heavy Modifications & v2.0: Tobias00723 / TGFB
- Website: https://tgfb-dcs.com/
- Discord: https://tgfb-dcs.com/discord
[1.1.0] - Previous Release
Features
- Basic script loading from external directory
- Delayed script loading support
- Alphabetic and priority-based loading modes
- Auto-update/hot-reload capability
- Verbose logging option
[1.0.0] - Initial Release
Features
- External script directory loading
- Hide code from mission files
- Basic error handling
Made with β€οΈ by the TGFB community
Release 1.1 Interval Feature
HeavenLoader - Delayed Loading Examples
Feature: Optional Delays Between Script Loading
You can now add optional delays between loading .lua files!
Example 1: Mixed Format (Backward Compatible)
scriptFiles = {
"Moose.lua", -- loads immediately (0 seconds)
{file = "Mist.lua", delay = 10}, -- loads after 10 seconds
{file = "MyScript.lua", delay = 20}, -- loads after 20 seconds
}Example 2: All With Delays
scriptFiles = {
{file = "Moose.lua", delay = 0}, -- loads immediately
{file = "Mist.lua", delay = 10}, -- loads after 10 seconds
{file = "SARSystem.lua", delay = 15},-- loads after 15 seconds
{file = "Custom.lua", delay = 30}, -- loads after 30 seconds
}Example 3: No Delays (Classic Format)
scriptFiles = {
"Moose.lua",
"Mist.lua",
"SARSystem.lua",
}
-- All scripts load immediatelyExample 4: Alphabetic Order Mode
alphabeticOrder = true,
-- When alphabeticOrder is true, all scripts load immediately
-- The delay feature only works with scriptFiles list modeHow It Works
-
Immediate Loading (delay = 0 or no delay specified)
- Script loads right away when HeavenLoader initializes
- Uses the traditional loading method
-
Delayed Loading (delay > 0)
- Script is scheduled to load after X seconds
- Uses DCS timer.scheduleFunction API
- You'll see "Scheduled: filename (in Xs)" in logs
-
Logging
- Shows immediate loads, failures, and scheduled loads separately
- Verbose mode shows when delayed scripts execute
- Summary:
Loaded: X | Failed: X | Scheduled: X
Use Cases
- Load Order Dependencies: Load MOOSE first, then scripts that depend on it
- Performance: Stagger heavy scripts to avoid initial lag
- Debugging: Space out loads to see which script causes issues
- Mission Flow: Load scripts at specific times after mission start