Undersides and Oversides?

I’m trying to code a class that works as a covering that gets place over objects. So far, doing a bare-bones basic version of this has been easy enough:

class Covering : NestedRoom, Underside; 
    putOver(obj)
    {
        moveInto(obj.location);       
        if(obj.ofKind(Actor))
        {
            obj.moveIntoForTravel(self);
        }
        else
        {
            obj.moveInto(self); 
        } 
    }
   dobjFor(PutOn)
    {
        verify(){}
        check(){}
        }
        action()
        {
             putOver(gIobj);
         }
    }
;

Of course, this effectively moves the target under the covering, rather than moving the covering onto the target, and it only handles one item at a time; it doesn’t cover situations where I have more than one cover and stack them over the target. In other words, how can I put a tarp over a blanket over a handkerchief over an NPC? Is there a better way to model this?

Do you want the covering to hide what’s underneath it? That would be the case with a tarp, but not with a handkerchief. With a handkerchief, I’d be tempted to use the FastenTo action and/or the Attachable class. That wouldn’t work at all well with a tarp, however.

The question of how one item of clothing can cover up another (such as a coat covering and hiding a shirt, or a pair of gloves covering a ring) has come up several times over on the Inform 7 forum, but I don’t recall ever seeing it discussed with reference to T3. There’s nothing in “Learning T3” that would apply directly. Possibly something involving ThingState and Hidden, with a check() rule in dobjFor(Doff) that would say, “You’ll have to take off the gloves first.” That type of thing.

Jim: I don’t necessarily need to hide things like in the Hidden class, etc., but I would like to model containment the way we can have “A box in a crate in a closet” or “a plate on a table on a dais”. It’s just that in this case, I guess it’s meant to be the container that moves, rather than the thing: you place the box over the snake, and a sheet over the box. If you want the actual in-game issue, it started when I had an NPC sleeping in a bed, under a blanket, and I just sort of went “Hey, wait a minute…what if my PC decided to take the covers? Or put them back? Or got more blankets for extra warmth? Or decided to substitute…” etc.

As for clothing, I actually do have a way to model layered clothing (I’m even using it in this project, no less!) I can share it if you like; it’s a system I swiped and refined from an IF program called Quest (or something like that; it’s been years). Mind you, it doesn’t actually hide things, but it does prohibit you from removing one item that’s supposed to be underneath another by assigning values to classes of clothing. (Hm, maybe that’ll give me a clue how to tackle this; I hadn’t actually thought in that direction…)