Skip to content

Commit

Permalink
Merge pull request #7093 from MahtraDR/adjust_for_namespace_changes_i…
Browse files Browse the repository at this point in the history
…n_core_lich

[scripts][dependency][bootstrap][spellmonitor] Prep for inclusion in …
  • Loading branch information
MahtraDR authored Feb 6, 2025
2 parents c39a8da + 7d9417d commit 2f1f548
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 17 deletions.
10 changes: 4 additions & 6 deletions bootstrap.lic
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -55,16 +53,16 @@ $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

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

Expand Down
21 changes: 13 additions & 8 deletions dependency.lic
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,15 @@ 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_CORE_LICH_DEFINES = Array.new
end

no_pause_all
no_kill_all
Expand Down Expand Up @@ -1582,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
Expand Down Expand Up @@ -1749,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')
Expand Down Expand Up @@ -1799,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')
Expand Down
5 changes: 2 additions & 3 deletions spellmonitor.lic
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,9 @@
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
if $DRINFOMON_IN_CORE_LICH
DRC.message("DRInfomon in core lich includes spellmonitor. Exiting.")
exit
end
Expand Down

0 comments on commit 2f1f548

Please sign in to comment.