View Issue Details
|ID||Project||Category||View Status||Date Submitted||Last Update|
|0006096||The Dark Mod||Feature proposal||public||07.09.2022 20:36||15.09.2022 19:58|
|Priority||normal||Severity||normal||Reproducibility||have not tried|
|Product Version||TDM 2.10|
|Summary||0006096: Improve support for Custom HUD Inventory GUIs|
|Description||Additional support is needed for 2 ways of doing HUD GUI customization for inventory items.|
1) When using an item entityDef with custom "inv_hud", "inv_hud_layer", and "scriptobject" spawnargs:
Add script function for player1 : getCurInvItemCount(). This would add support for stackable items.
2) When customization is done by over-riding the default tdm_inv.gui
Within Player.cpp's UpdateInventoryHUD(), have it read the current item's inv_item_id, and push that value (or empty string if no inv_item_id) to a new gui::parameter "Inventory_ItemId". So that the over-riding GUI can apply customization to specifically-tagged entities if desired.
1) The proposed function, if the current entity is stackable, return the inventory count. The script author can pass this on to the GUI with existing gui::parameters thusly:
setGuiInt(overlayHandle, "Inventory_ItemStackable", 1 );
setGuiInt(overlayHandle, "Inventory_ItemCount", count );
If the current entity is non-stackable, the proposed function returns -1, in which case the script author can pass this on the GUI like this:
setGuiInt(overlayHandle, "Inventory_ItemStackable", 0 );
setGuiInt(overlayHandle, "Inventory_ItemCount", 1 ); // optional
2) The override of the default GUI may need some way to identify specific custom entityDefs. Doing string check of Inventory_ItemName or Inventory_ItemGroup (within a GUI if statement) is unreliable due to possible language translations by the SDK. Tagging the custom entityDef with inv_item_id and passing it to the GUI (without bypassing the SDK by having a custom script object) would do the trick.
[While completeness might suggest also providing a player1 script function getCurInvItemId, there's probably no use case for this, and it ever needed it that value can be retrieved via getCurInvItemEntity (unlike the case with count)]
For more info:
|Tags||No tags attached.|
The proposed changes were commited with revision 10108.
I've tested the script function and it appears to be working. Note, though, that all default items (as far as I can tell) are stackable, which includes the spyglass, lockpicks and even the loot inventory object.
I don't have the time to test the gui variable. Maybe you can do that?!
|Thanks! The coming week is bolluxed for me IRL, but after that, will test.|
|I don't think all items are meant to be stackable (what would be the purpose of inv_stackable?), or at least not to have an item count shown over the icon. I remember when that item count started showing up around TDM 2.05.|
I can't remember how it was earlier one. I normally don't pay much attention to the number if I expect to have only one piece of an item anyways and was pretty surprised myself.
The question is whether there is a need to distinguish between stackable and non-stackable anyways? It would only make sense if you don't want the player to have more then one item of which there are several in a mission. However, the number restriction could be any number theoretically. So maybe it is worthwhile considering to scratch the non-stackable items alltogether and instead allow mappers to set a limit if the feel the need (has this ever been the case thus far).
Independent from that the gui could be adjusted to only show the item count if the player posesses more then one.
The current state is...
SetGuiFloat(m_InventoryOverlay, "Inventory_ItemStackable", curItem->IsStackable() ? 1 : 0);
SetGuiInt(m_InventoryOverlay, "Inventory_ItemCount", curItem->GetCount());
rect 25*S1, 35*S1, 20*S1, 16*S1
So what Obsttorte is suggesting in the second case is maybe:
visible "gui::Inventory_ItemVisible"*"gui::Inventory_ItemStackable"*("gui::inventory_itemCount > 1)
rect 25*S1, 35*S1, 20*S1, 16*S1
|The wiki article https://wiki.thedarkmod.com/index.php?title=GUI_Scripting:_Inventory_Icon_Example has been updated to include provisional 2.11 improvements|
|Latest version installer knows about is 10107. I need 10108+ to test|
|07.09.2022 20:36||Geep||New Issue|
|07.09.2022 20:47||Geep||Additional Information Updated|
|08.09.2022 09:48||Obsttorte||Assigned To||=> Obsttorte|
|08.09.2022 09:48||Obsttorte||Status||new => assigned|
|08.09.2022 09:49||Obsttorte||Status||assigned => feedback|
|08.09.2022 09:49||Obsttorte||Note Added: 0015242|
|08.09.2022 15:08||Geep||Note Added: 0015243|
|08.09.2022 15:08||Geep||Status||feedback => assigned|
|08.09.2022 16:42||Dragofer||Note Added: 0015244|
|08.09.2022 18:49||Obsttorte||Note Added: 0015245|
|09.09.2022 14:43||Geep||Note Added: 0015247|
|09.09.2022 17:25||Geep||Note Added: 0015248|
|15.09.2022 19:58||Geep||Note Added: 0015249|