Anonymous Login
2017-04-23 13:50 CEST

View Issue Details Jump to Notes ]
IDProjectCategoryView StatusLast Update
0001896OpenClonkObjectspublic2017-03-06 05:39
ReporterMarky 
Assigned ToMarky 
PrioritynormalSeverityfeatureReproducibilityhave not tried
StatusresolvedResolutionfixed 
Product Version 
Target VersionFixed in Version 
Summary0001896: ObjectInterationMenu: Callback target for entries_callback
DescriptionIn 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.
TagsNo tags attached.
Attached Files

-Relationships
+Relationships

-Notes

~0005621

Marky (developer)

I think I'll be going for the extra parameter option "entries_callback_parameter", because it seems to be the most flexible variant.

~0005622

occ (reporter)

Hi! There's been a check-in that references this bug. For more information you can visit the repository browser at this address:
https://git.openclonk.org/openclonk.git/commitdiff/c37bc586e9161f71d7920e14bbe87c3888b8d2e7

Changeset c37bc58 by Mark <markh4b@hotmail.com>
ObjectInteractionMenu: Add parameter for entry callback 0001896

+Notes

-Issue History
Date Modified Username Field Change
2017-03-03 23:57 Marky New Issue
2017-03-03 23:59 Marky Description Updated View Revisions
2017-03-04 11:42 Marky Note Added: 0005621
2017-03-06 05:36 occ Note Added: 0005622
2017-03-06 05:39 Marky Assigned To => Marky
2017-03-06 05:39 Marky Status new => resolved
2017-03-06 05:39 Marky Resolution open => fixed
+Issue History