This update introduces several enhancements to the loot system, allowing for more flexible loot management across different monsters without the need to modify each monster's individual script. A global loot option has been added, which is disabled by default, to assign items that any monster can drop. This feature simplifies the addition of common loot across multiple monsters, enhancing the modularity of loot management.
The registerLoot function has been improved to eliminate code duplication and enhance efficiency. The closeContainer function has been updated to remove problematic code that could cause crashes when "container" used before "erase". Additionally, a new Lua function, getMonsterTypeByName, has been introduced to facilitate getting monster types.
Behaviour
Actual
Previously, adding or modifying loot required changes to each monster's script individually, which was cumbersome and error-prone.
Expected
With the new system, it's now possible to assign specific loot to monsters or set global loot defaults without direct script modifications. This update also ensures more stability and performance in managing loot containers.
Type of change
[x] New feature (non-breaking change which adds functionality)
How Has This Been Tested
Testing focused on ensuring that the new global loot system functions correctly without impacting the specific loot settings for individual monsters. Tests were also conducted to ensure that the modifications to the closeContainer function did not lead to crashes under various scenarios.
[x] Tested global loot functionality across multiple monster types.
[x] Verified stability improvements in the closeContainer function.
Checklist
[x] My code follows the style guidelines of this project
[x] I have performed a self-review of my own code
[x] I checked the PR checks reports
[x] I have commented my code, particularly in hard-to-understand areas
[x] I have made corresponding changes to the documentation
[x] My changes generate no new warnings
[x] I have added tests that prove my fix is effective or that my feature works
Description
This update introduces several enhancements to the loot system, allowing for more flexible loot management across different monsters without the need to modify each monster's individual script. A global loot option has been added, which is disabled by default, to assign items that any monster can drop. This feature simplifies the addition of common loot across multiple monsters, enhancing the modularity of loot management.
The
registerLoot
function has been improved to eliminate code duplication and enhance efficiency. ThecloseContainer
function has been updated to remove problematic code that could cause crashes when "container" used before "erase". Additionally, a new Lua function,getMonsterTypeByName
, has been introduced to facilitate getting monster types.Behaviour
Actual
Previously, adding or modifying loot required changes to each monster's script individually, which was cumbersome and error-prone.
Expected
With the new system, it's now possible to assign specific loot to monsters or set global loot defaults without direct script modifications. This update also ensures more stability and performance in managing loot containers.
Type of change
How Has This Been Tested
Testing focused on ensuring that the new global loot system functions correctly without impacting the specific loot settings for individual monsters. Tests were also conducted to ensure that the modifications to the
closeContainer
function did not lead to crashes under various scenarios.closeContainer
function.Checklist