[ ObjectIsUntouchable item flag1 flag2 ancestor i; ! Determine if there's any barrier preventing the player from moving ! things to "item". Return false if no barrier; otherwise print a ! suitable message and return true. ! If flag1 is set, do not print any message. ! If flag2 is set, also apply Take/Remove restrictions. ! If the item has been added to scope by something, it's first necessary ! for that something to be touchable. i = ObjectScopedBySomething(item); if (i ~= 0) { if (ObjectIsUntouchable(i)) return; ! An item immediately added to scope } ancestor = CommonAncestor(player, item); ! First, a barrier between the player and the ancestor. The player ! can only be in a sequence of enterable objects, and only closed ! containers form a barrier. if (player ~= ancestor) { i = parent(player); while (i~=ancestor) { if (i has container && i hasnt open) { if (flag1) rtrue; return L__M(##Take,9,i); } i = parent(i); } } ! Second, a barrier between the item and the ancestor. The item can ! be carried by someone, part of a piece of machinery, in or on top ! of something and so on. if (item ~= ancestor) { i = parent(item); while (i~=ancestor) { if (flag2 && i hasnt container && i hasnt supporter) { if (i has animate) { if (flag1) rtrue; return L__M(##Take,6,i); } if (i has transparent) { if (flag1) rtrue; return L__M(##Take,7,i); } if (flag1) rtrue; return L__M(##Take,8,item); } if (i has container && i hasnt open) { if (flag1) rtrue; return L__M(##Take,9,i); } i = parent(i); } } rfalse; ];