Have you considered making two of those shelves, and when the function is called, it deactivates the closed shelf and activates the open shelf?
Something like
void RevealSecretPassage(string &in asParent, string &in asChild, int alState)
{
PlayMusic("Secret1.ogg", false, 1.0f, 0, 0, true);
FadeLightTo("SecretPointLight1", 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 3.0f);
SetEntityActive("SecretShelf1", false);
SetEntityActive("SecretShelf2", true);
CreateParticleSystemAtEntity("dust", "ps_dust_falling_door_quick", "SecretShelf1", false);
PlaySoundAtEntity("", "scrape_rock", "SecretShelf1", 0, false);
GiveSanityBoostSmall();
}
Unless you're supposed to see the shelf when it opens, for that I don't know the answer. Maybe it's supposed to be
SetMoveObjectState("SecretShelf1",
true); ?