The best advice I can give you for unusual stuff like this, is to look at how its done in GECK within the default game.
Using the search bar on the left, type in Moon, and then at the bottom click 'All' to pull up the various Moon references/scripts resources etc. From there you can determine how it is done and thus how to do it yourself.