From ad849ec8409868b370e015a1bc53314a03b33486 Mon Sep 17 00:00:00 2001 From: Mahtra <93822896+MahtraDR@users.noreply.github.com> Date: Fri, 7 Feb 2025 11:28:43 +1300 Subject: [PATCH 1/2] [scripts][dependency][bootstrap][spellmonitor] Prep for inclusion in core lich As per title. Adjusting for namespace changes in core lich. --- bootstrap.lic | 4 +--- dependency.lic | 12 +++++++++--- spellmonitor.lic | 3 +-- 3 files changed, 11 insertions(+), 8 deletions(-) diff --git a/bootstrap.lic b/bootstrap.lic index 8d8be595ec..7bc5710371 100644 --- a/bootstrap.lic +++ b/bootstrap.lic @@ -3,9 +3,7 @@ Documentation: https://elanthipedia.play.net/Lich_script_development#bootstrap =end -$BOOTSTRAP_VERSION = '1.0.3' -DRINFOMON_IN_CORE_LICH ||= false -DRINFOMON_CORE_LICH_DEFINES ||= [] +$BOOTSTRAP_VERSION = '1.0.4' class_defs = { 'drinfomon' => :DRINFOMON, diff --git a/dependency.lic b/dependency.lic index b96c4cdf81..c752b5cd2f 100644 --- a/dependency.lic +++ b/dependency.lic @@ -10,10 +10,16 @@ require 'ostruct' require 'digest/sha1' require 'monitor' -$DEPENDENCY_VERSION = '2.0.5' +$DEPENDENCY_VERSION = '2.0.6' $MIN_RUBY_VERSION = '3.2.2' -DRINFOMON_IN_CORE_LICH ||= false -DRINFOMON_CORE_LICH_DEFINES ||= Array.new + +if defined?(Lich::Common) && defined?(DRInfomon) # testing for minimum 5.11.0 + DRINFOMON_IN_CORE_LICH = true # this should never be true pre 5.11 + DRINFOMON_CORE_LICH_DEFINES = DRInfomon::DRINFOMON_CORE_LICH_DEFINES # always defined in 5.11 +else + DRINFOMON_IN_CORE_LICH = false # this should always be false pre 5.11 + RINFOMON_CORE_LICH_DEFINES = Array.new # this should always be an empty array pre 5.11 +end no_pause_all no_kill_all diff --git a/spellmonitor.lic b/spellmonitor.lic index 7c8eb6f733..7089990002 100644 --- a/spellmonitor.lic +++ b/spellmonitor.lic @@ -2,8 +2,7 @@ Documentation: https://elanthipedia.play.net/Lich_script_development#spellmonitor =end -$SPELLMONITOR_VERSION = '2.0.1' -DRINFOMON_IN_CORE_LICH ||= false +$SPELLMONITOR_VERSION = '2.0.2' if DRINFOMON_IN_CORE_LICH DRC.message("DRInfomon in core lich includes spellmonitor. Exiting.") From 7d9417d4d87ba082086dcd1ceb96e50a822293ff Mon Sep 17 00:00:00 2001 From: Mahtra <93822896+MahtraDR@users.noreply.github.com> Date: Fri, 7 Feb 2025 12:12:20 +1300 Subject: [PATCH 2/2] Change to global variables --- bootstrap.lic | 6 +++--- dependency.lic | 17 ++++++++--------- spellmonitor.lic | 2 +- 3 files changed, 12 insertions(+), 13 deletions(-) diff --git a/bootstrap.lic b/bootstrap.lic index 7bc5710371..5fbc028ead 100644 --- a/bootstrap.lic +++ b/bootstrap.lic @@ -53,7 +53,7 @@ $MODERN_LICH = lich_version >= if Regexp.last_match(1) Gem::Version.new('4.6.49') end -if args.wipe_constants && !DRINFOMON_IN_CORE_LICH +if args.wipe_constants && !$DRINFOMON_IN_CORE_LICH class_defs.each_value { |symb| remove_constant(symb) if constant_defined?(symb) } exit end @@ -61,8 +61,8 @@ end scripts_to_run = args.flex || [] echo scripts_to_run.to_s if UserVars.bootstrap_debug -if (scripts_to_run & DRINFOMON_CORE_LICH_DEFINES).any? - scripts_to_run -= DRINFOMON_CORE_LICH_DEFINES +if (scripts_to_run & $DRINFOMON_CORE_LICH_DEFINES).any? + scripts_to_run -= $DRINFOMON_CORE_LICH_DEFINES echo("Removing core lich defines from scripts_to_run") if UserVars.bootstrap_debug end diff --git a/dependency.lic b/dependency.lic index c752b5cd2f..f44879d07f 100644 --- a/dependency.lic +++ b/dependency.lic @@ -14,11 +14,10 @@ $DEPENDENCY_VERSION = '2.0.6' $MIN_RUBY_VERSION = '3.2.2' if defined?(Lich::Common) && defined?(DRInfomon) # testing for minimum 5.11.0 - DRINFOMON_IN_CORE_LICH = true # this should never be true pre 5.11 - DRINFOMON_CORE_LICH_DEFINES = DRInfomon::DRINFOMON_CORE_LICH_DEFINES # always defined in 5.11 + $DRINFOMON_IN_CORE_LICH = true # this should never be true pre 5.11 + $DRINFOMON_CORE_LICH_DEFINES = DRInfomon::DRINFOMON_CORE_LICH_DEFINES # always defined in 5.11 else - DRINFOMON_IN_CORE_LICH = false # this should always be false pre 5.11 - RINFOMON_CORE_LICH_DEFINES = Array.new # this should always be an empty array pre 5.11 + $DRINFOMON_CORE_LICH_DEFINES = Array.new end no_pause_all @@ -1588,9 +1587,9 @@ def custom_require lambda do |script_names| script_names = [script_names] unless script_names.is_a?(Array) respond("CR:starting:#{script_names}") if UserVars.bootstrap_debug - if DRINFOMON_IN_CORE_LICH + if $DRINFOMON_IN_CORE_LICH echo("DRInfomon in core lich detected. Skipping loading drinfomon and commons") if UserVars.bootstrap_debug - script_names -= DRINFOMON_CORE_LICH_DEFINES + script_names -= $DRINFOMON_CORE_LICH_DEFINES end bootstrapper = force_start_script('bootstrap', script_names) pause 0.05 @@ -1755,7 +1754,7 @@ end def update_d echo('Restarting Dependency in 2 seconds...') - force_start_script('bootstrap', ['wipe_constants']) unless DRINFOMON_IN_CORE_LICH + force_start_script('bootstrap', ['wipe_constants']) unless $DRINFOMON_IN_CORE_LICH before_dying do sleep 2 force_start_script('dependency') @@ -1805,12 +1804,12 @@ end full_install if install -force_start_script('bootstrap', ['wipe_constants']) unless DRINFOMON_IN_CORE_LICH +force_start_script('bootstrap', ['wipe_constants']) unless $DRINFOMON_IN_CORE_LICH # Proactively starting DRinfomon as script zero to prevent # race conditions involving this script which so many other # scripts depend on, and which is slow to start on its own -unless DRINFOMON_IN_CORE_LICH +unless $DRINFOMON_IN_CORE_LICH echo("Starting DRinfomon, this will take a few seconds.") custom_require.call('drinfomon') diff --git a/spellmonitor.lic b/spellmonitor.lic index 7089990002..8724600ef2 100644 --- a/spellmonitor.lic +++ b/spellmonitor.lic @@ -4,7 +4,7 @@ $SPELLMONITOR_VERSION = '2.0.2' -if DRINFOMON_IN_CORE_LICH +if $DRINFOMON_IN_CORE_LICH DRC.message("DRInfomon in core lich includes spellmonitor. Exiting.") exit end