Poikilos / EnlivenMinetest

Minetest engine server management tools and ENLIVEN game installer/updater
Other
3 stars 0 forks source link

Have individual mods use default_stack_max instead explicitly using 99 as the stack_max #500

Open Poikilos opened 3 years ago

Poikilos commented 3 years ago

Setting stack_max explicitly is necessary in some cases to avoid being overridden, as seen with bread.

Instead of 99, they would have to use tonumber(minetest.settings:get("default_stack_max") or 99)

Affected code is found via cd bucket_game && grep "[^0-9a-zA-Z_]99[^0-9a-zA-Z]" -n -r --include \*.lua | grep -v max_drop_level | grep -v maxlevel | grep -v max_objects_per_block:

Poikilos commented 3 years ago

In 211114a, the default:bread behaves as food, has the right recipe, and there is no duplicate, but the stack size is 3. Other stack sizes are 99 where listed in the issue. Only nodes not listed are 64 are ones that aren't listed on the issue.

As of bucket_game 211114a the he default_stack_max patch is not present (from 211111-bucket-game.pdf, tested successfully in 211111a, but not implemented in 211114a):

Add the lines below to "default/init.lua" right after the "dofile" line that loads "ocutil.lua":

local defstackmax = ocutil.numsetzero ("default_stack_max")
if defstackmax ~= 0 and
core.nodedef_default ~= nil then
core.nodedef_default.stack_max = defstackmax
end

-@OldCoder

Even if the patch above were added (it is not in 211114a), the changes in the checklist are still necessary because the existing code circumvents core.nodedef_default.stack_max by using 99 explicitly. However, instead of saying tonumber(minetest.settings:get("default_stack_max") or 99) you could probably just remove the stack_max from the node def as long as the "core.nodedef_default.stack_max patch" is done. It should work as long as done for all items in the checklist on the issue.

Poikilos commented 2 years ago

If basefoods or some other code redefines some sort of API function that any food mods call, and also sets the max where its version of the function, the issue will have to be addressed in the redefined function the same way it is addressed in the mods listed.