Anonymous Login
2020-02-24 05:20 UTC

View Revisions: Issue #1896

Summary 0001896: ObjectInterationMenu: Callback target for entries_callback
Revision 2017-03-03 22:59 by Marky
Description In the object interaction menu I want to be able to set the object context for the entry callback.

The current situation is this: In Hazard the firemode selection is a part of the interaction menu for the clonk. The clonk asks all contents whether they have some sort of interaction menu entries via GetInteractionMenus() and displays these in his inventory page.
Now, the items generate entries in their category. During GetInteractionMenus() the function context is in the item, here everything is fine. When the object interaction menu calls the "entries_callback", however, I can use a function of the item, but it will be executed in the Clonk's context.

I intended for the item to go through its firemodes and create menu items accordingly. However, since the function is called from the clonk's context, it will go through the clonk's firemodes (he doesn't have any) and consequently no entries are created.

The "feature" could be resolved the following ways, imo:
- find a better solution than asking the items for their entries
- execute the callback in the context of "callback_target", or add another property "entries_callback_target", so that it does not cause problems with the existing objects that use "callback_target"
- add an optional "entries_callback_parameters" (or similar implementation) that allows passing additional parameters to the "entries_callback" function (this way I could pass the item from GetInteractionMenus())
- find yet another solution that works similarly and/or better

I can do the changes myself, nonetheless I want to agree with you on the best option before I extend such an integral part of the game.
Revision 2017-03-03 22:57 by Marky
Description In the object interaction menu I want to be able to set the object context for the entry callback.

The current situation is this: In Hazard the firemode selection is a part of the interaction menu for the clonk. The clonk asks all contents whether they have some sort of interaction menu entries via GetInteractionMenus() and displays these in his inventory page.
Now, the items generate entries in their category. During GetInteractionMenus() the function context is in the item, here everything is fine. When the object interaction menu calls the "entries_callback", however, I can use a function of the item, but it will be executed in the Clonk's context.

I intended for the item to go through its firemodes and create menu items accordingly. However, since the function is called from the clonk's context, it will go through the clonk's firemodes (he doesn't have any) and consequently no entries are created.

The "feature" could be resolved the following ways, imo:
- find a better solution than asking the items for their entries
- execute the callback in the context of "callback_target", or add another property "entries_callback_target", so that it does not cause problems with the existing objects that use "callback_target"
- find yet another solution that works similarly and/or better

I can do the changes myself, nonetheless I want to agree with you on the best option before I extend such an integral part of the game.