Open tajmone opened 3 years ago
Yes, good point. We can tweak the 'wear' verb this way.
Although it's been a while since I've looked into this, and I'm not so fresh on the details, I'm throwing-in some extra considerations on the question of how the StdLib should support custom wearable items.
wear
and remove
verbs on object
class don't take into consideration non-clothing wearable items and simply emit a message stating that the object can't be worn/removed. But ...
DOES ONLY
— either on the specific instance or for an entire class of custom wearables — which would then make the current problem go away.wear
and remove
verbs should deal with the wearable
attribute (defined on EVERY THING
):
IS wearable
. So, even though they'll most likely provide some custom wear
and remove
verbs for these types of wearables, should the default wear
and remove
verbs check the wearable
attribute? or should we just assume that their body will never be executed due to a DOES ONLY
custom verb taking over?
IF
check for the wearable
attribute in the body of the default wear
and remove
makes sense? I.e. do nothing if the item IS wearable
? This would make sense if (and only if) the author did provide custom alternative verbs, but would lead to a responseless verb in all other cases!As you can see from the above considerations, it all depends on how authors implement their custom wearables and related verbs.
The real question here is whether the library should enforce some guidelines on how custom wearables should be implemented, or whether is should provide a default mechanism for handling non-clothing wearables (which end authors can still override via custom classes or DOES ONLY
verbs on the specific instances).
Is one approach better than the other?
We probably should address this by coming up with practical examples of non-clothing wearable items that and adventure might need — e.g. a watch, a gun holster, etc., all items which are wearable but don't belong to the clothing class (maybe the holster does though, since it has to be worn on top of shirt but under a coat?).
Other examples might be wearable gadgets that are instances of library classes:
device
class).lightsource
class).The whole idea is to extend the concept of werables from just clothing to anything that an author might need, whether it's a custom class or on an extension of a base Library class, or even just a single instance.
Before assuming that end authors will always use a DOES ONLY
we should be careful, for in reality they might need multiple verbs to execute on some classes or instances, so using DOES ONLY
might not be a viable solution — in this case, the problem would be that the default wear
and remove
verbs on object
class will end up emitting the "[That's/Those are] not something you can wear." message (along the proper responses of the custom verbs). Since ALAN doesn't provide a keyword to end the VERB execution chain, the only alternative left is to use an IF
statement within the VERB body, which in our case is only good if we knew what the end author is really up to.
Although this might look a trivial problem, it actually involves some hard decisions and requires documenting very well what authors can and can not do in terms of how custom wearables should be implemented.
@AnssiR66, while editing
lib_messages-runtime.i
, to ensure that ANY worn item will be listed as "(being worn)" — not just clothing, since authors should be free to implement other types of custom wearables (e.g. headphones, VR headset devices, etc.) — I noticed that the currentwear
andremove
verbs could be improved in that direction.Here's the current definition of
wear
:As you can clearly see, it doesn't even check if an object
is wearable
, and will always produce the "[That's/Those are] not something you can wear." message.I propose that we change the
DOES
body to check if the objectis wearable
or not, and if it is carry out and implicit taking and set it asIs worn
, otherwise print the "not something you can wear." message instead.And then do the same with the verb that handles removing worn items.
Suppose an author wants to implement a custom wearable that is not clothing and doesn't fit in the layered-clothing logic, e.g. a device of some type, like night vision goggles or a VR helmet. He/she would then only need to set it as
Is wearable
and the Hero could then wear it and remove it.Currently, an author would have to redefine the
wear
verb for any custom wearable item, or create a custom class, whereas tweaking the verbs as proposed would spear him/her a lot of work, and allow to easily create wearabledevice
instances (which is probably going to be one of the most common use cases).Of course, this would need extensive testing, and ensuring that there are no conflicts or pitfalls with other verbs, and that they interact without problems with all the library classes; but this should be rather straight forward, and the test-suite should catch any undesired side-effects.
Although the Library only uses the
wearable
attribute forclothing
items, with the recent re-vamping of the clothing system the new code is ready to allow custom wearables by simply setting thewearable
andworn
attributes.