Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"Document" item use callbacks' "user" parameter #4668

Merged
merged 1 commit into from Oct 27, 2016

Conversation

Projects
None yet
6 participants
@raymoo
Copy link
Contributor

commented Oct 25, 2016

The "user", "placer" etc. parameters in item callbacks were never documented. Nobody said anything in #4488 about what those parameters really should be, so I took the opportunity to make a decision in the direction that I prefer.

This PR clarifies that those parameters may be either nil, or any valid (not dangling) ObjectRef.

What this means for modding:

  • Mods defining items need to check if the user is the right kind of thing, if the item's operation depends on something specific to players or requiring a non-nil object. I am guessing that in many cases items will only act on the pointed_thing so won't need these checks.
  • Mods can have entities, nodes, etc. use items without hacky "fake player" tables.

@raymoo raymoo changed the title Document item use callbacks' "user" parameter "Document" item use callbacks' "user" parameter Oct 25, 2016

@nerzhul

This comment has been minimized.

Copy link
Member

commented Oct 25, 2016

@sofar @paramat @sfan5 did you agree with these changes ?

@sfan5

This comment has been minimized.

Copy link
Member

commented Oct 25, 2016

Seems okay I guess.

@paramat

This comment has been minimized.

Copy link
Member

commented Oct 25, 2016

👍

@Zeno- Zeno- merged commit 1fd9a07 into minetest:master Oct 27, 2016

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details
@Zeno-

This comment has been minimized.

Copy link
Contributor

commented Oct 27, 2016

Thanks @raymoo

@HybridDog

This comment has been minimized.

Copy link
Contributor

commented May 25, 2017

The player argument musn't be nil because of that builtin function. (Test without fakeplayer failed)

@raymoo

This comment has been minimized.

Copy link
Contributor Author

commented May 25, 2017

@HybridDog Ok, I'll work on a PR to handle nil values.

@raymoo

This comment has been minimized.

Copy link
Contributor Author

commented May 25, 2017

@raymoo raymoo deleted the raymoo:userparam branch May 26, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.