Skip to content

Commit

Permalink
[scripts][common-moonmage] De-duplicating code
Browse files Browse the repository at this point in the history
Also adds case for when a telescope is closed, as on first-use.
  • Loading branch information
MahtraDR committed May 3, 2024
1 parent 90f39f9 commit 156f415
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions common-moonmage.lic
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ module DRCMM
end

def center_telescope(target)
DRC.bput("center telescope on #{target}",
case DRC.bput("center telescope on #{target}",
'Center what',
'You put your eye',
'open it to make any use of it',
Expand All @@ -93,7 +93,14 @@ module DRCMM
"You would probably need a periscope to do that",
'Your search for',
'Your vision is too fuzzy',
"You'll need to open it to make any use of it",
'You must have both hands free')
when 'The pain is too much', "That's a bit tough to do when you can't see the sky"
echo("Planet #{target} not visible. Are you indoors perhaps?")
when "You'll need to open it to make any use of it"
fput("open my telescope")
fput("center telescope on #{target}")
end
end

def align(skill)
Expand Down Expand Up @@ -300,10 +307,7 @@ module DRCMM
observed_planets = []

planets.each do |planet|
case DRC.bput("center telescope on #{planet}", 'You put your eye', 'The pain is too much', "That's a bit tough to do when you can't see the sky")
when 'The pain is too much', "That's a bit tough to do when you can't see the sky"
break
end
center_telescope(planet)
observed_planets << planet unless Flags['planet-not-visible']
Flags.reset('planet-not-visible')
end
Expand Down

0 comments on commit 156f415

Please sign in to comment.