Fix seeds not being subtracted on_place #2

Closed
cora wants to merge 1 commits from (deleted):fix_seed_dupe into master
First-time contributor

The overwritten on_place's of this mod neglect to return the itemstack (or anything for that matter) hence nothing is removed on_place in the overwritten functions.

Testing

  • rightclick tilled soil with a seed, notice no item is taken from the stack
  • observe it is fixed in this branch
The overwritten on_place's of this mod neglect to return the itemstack (or anything for that matter) hence nothing is removed on_place in the overwritten functions. ### Testing * rightclick tilled soil with a seed, notice no item is taken from the stack * observe it is fixed in this branch
cora added 1 commit 2022-10-09 00:59:51 +02:00
Owner

I have tested this and confirmed that:

  • Without this patch no seeds are reduced when right-clicking tilled soil or (fully grown) red beets or wheat.
  • With this patch seeds are reduced by one when right-clicking tilled soil or (fully grown) red beets or wheat.
I have tested this and confirmed that: * Without this patch no seeds are reduced when right-clicking tilled soil or (fully grown) red beets or wheat. * With this patch seeds are reduced by one when right-clicking tilled soil or (fully grown) red beets or wheat.
Owner

@cora looking at the code after all this time, I am confused why your solution works.

Can you explain what is happening to itemstack here? If so, please do so.

Should the code maybe return what old_on_place() returns?

@cora looking at the code after all this time, I am confused why your solution works. Can you explain what is happening to `itemstack` here? If so, please do so. Should the code maybe return what `old_on_place()` returns?
Author
First-time contributor

on_place = function(itemstack, placer, pointed_thing),
[...]
-- Shall place item and return the leftover itemstack

https://github.com/minetest/minetest/blob/master/doc/lua_api.md?plain=1#L8815

return old on place would probably work too but since that will also juts modify itemstack returning itemstack should result in the same if i am not mistaken

> on_place = function(itemstack, placer, pointed_thing), > [...] > -- Shall place item and return the leftover itemstack > https://github.com/minetest/minetest/blob/master/doc/lua_api.md?plain=1#L8815 return old on place would probably work too but since that will also juts modify itemstack returning itemstack should result in the same if i am not mistaken
Author
First-time contributor

appears to have been fixed by 92d1671079

appears to have been fixed by https://git.minetest.land/erlehmann/mcl_quick_harvest_replant/commit/92d16710799a6508977f14df1f241a7d84fdf265
cora closed this pull request 2023-09-11 03:10:17 +02:00
Owner

Yes. Sorry, I forgot to close this PR. Thank you for your help!

Yes. Sorry, I forgot to close this PR. Thank you for your help!

Pull request closed

Sign in to join this conversation.
No reviewers
No Label
No Milestone
No project
No Assignees
2 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: erle/mcl_quick_harvest_replant#2
No description provided.