Shadows defining texture changes

I’ve made a model of Earth for Garry’s Mod (really simple), and I’ve scripted an entity using it’s model, cause having an Earth entity seems pretty cool.

One day I thought about the Earth at night, and how when it gets dark, people turn on their lights, causing it to not just be black when there’s a shadow over some part of Earth.

Then I thought about making the entity so that if any part of it has a shadow on it, instead of just a shadow being there, the actual texture of the Earth possibly could get swapped (partially, only on the parts with shadow on them) into one with night lights on it. I have a texture for the night lights and also the regular texture, both mapped and working with the model.

My question is, would this be possible whatsoever, and if so, how? Any hidden QC commands for this kind of thing, like $shadowtexture or something?

What you could do is create a $selfillum texture, basically thwe parts you define in this texture will act like lights (only on itself, it will not affect anything else).

The problem is that these areas will glow regardless of if the Earth has a shadow cast on it, but the glowing parts will be more noticeable in unlit areas.

Okay, that might work, but (sorry if this is a dumb question) how should a selfillummask look? What part of it is meant to be the most bright, and what part is meant to be the darkest?

The texture would be greyscale, with white being as bright as possible and black not glowing at all.
For more information, look to this page.

Alright, thanks a lot!