SHOW:
|
|
- or go back to the newest paste.
1 | ||
2 | --[[ | |
3 | Demonstration of remove_item bug | |
4 | --]] | |
5 | - | minetest.register_node("testmod:test", { |
5 | + | |
6 | - | description = "test", |
6 | + | minetest.register_node("tricorder:test", { |
7 | - | groups = { snappy = 3 }, |
7 | + | description = "test", |
8 | - | on_use=function(itemstack, user, pointed_thing) |
8 | + | groups = { snappy = 3 }, |
9 | - | inv=minetest.get_inventory({type="player",name=user:get_player_name()}) |
9 | + | on_use=function(itemstack, user, pointed_thing) |
10 | - | inv:remove_item("main",ItemStack("testmod:test")) |
10 | + | -- READ THE DOCS!!! |
11 | - | end, |
11 | + | -- inv=minetest.get_inventory({type="player",name=user:get_player_name()}) |
12 | -- inv:remove_item("main",ItemStack("tricorder:test")) | |
13 | itemstack:take_item(); return itemstack | |
14 | end, | |
15 | }) | |
16 | ||
17 | --[[ | |
18 | To see the bug save this as the init.lua of a mod, then in game do /giveme testmod:test 20 | |
19 | It should be that upon left click a single "test" item is removed from player inv. | |
20 | But that does not happen unless there is a stack of the "test" item at some point AFTER the player's currently selected inventory slot. | |
21 | --]] |