Skip to content
This repository has been archived by the owner on Aug 20, 2020. It is now read-only.

Auto replacement of blocks into the hand #462

Closed
Cyberpangolin opened this issue May 29, 2016 · 16 comments
Closed

Auto replacement of blocks into the hand #462

Cyberpangolin opened this issue May 29, 2016 · 16 comments
Assignees
Labels

Comments

@Cyberpangolin
Copy link
Contributor

Take 1 stone brick alone into your hand, and keep a stack anywhere else into your inventory.
Place your single stone bricks block.
It is automagically replaced with the stack you had "anywhere else into your inventory".

Do the same with a with a default:tree
You have to choose by yourself the replacing stack.

I'm sure it's not the only affected block, but I don't have other examples. Could we make a rule to make sure it always happens as for bricks, for constancy?

@Lymkwi
Copy link
Member

Lymkwi commented May 29, 2016

It's some callback blocking the mod again.
Mg goes away and curses to the heavens

I'll investigate and fix that sh!t once more.

@ghost
Copy link

ghost commented May 29, 2016

@LeMagnesium we need to rewrite the funciton, i did this code snippet, but for the invtweak mod it doesn't work, we need to rewrite in minetest_game/default.

--minetest.rotate_node(itemstack, placer, pointed_thing)
local old_rotate_node = minetest.rotate_node
function minetest.rotate_node(itemstack, placer, pointed_thing)
    local stck_name = itemstack:get_name()
    local ret = old_rotate_node(itemstack, placer, pointed_thing)
    if not minetest.setting_getbool("creative_mode") and ret:get_count() == 0 then
        local index = placer:get_wield_index()
        local inv = placer:get_inventory()
        if inv:get_list("main") then
            for i,stack in ipairs(inv:get_list("main")) do
                if i ~= index and stack:get_name() == stck_name then
                    ret:add_item(stack)
                    stack:clear()
                    inv:set_stack("main", i, stack)
                    minetest.log("action", "Inventory Tweaks: refilled stack("..stck_name..") of "  .. placer:get_player_name()  )
                    break
                end
            end
        end
    end
    return ret
end

@Lymkwi
Copy link
Member

Lymkwi commented May 29, 2016

il faut rewrite dans default apparemment.

Just remove the rotate_node, we don't care about it.

@ghost
Copy link

ghost commented May 29, 2016

it's a lot of nodes which have this function instead of place_node(), it handle the sneak and other things.

on_place = minetest.rotate_node

@Lymkwi
Copy link
Member

Lymkwi commented May 29, 2016

ça gère le sneak et tout.

It doesn't handle sneak, just the static placment, and it's useless.

@ghost
Copy link

ghost commented May 29, 2016

No it didn't, the function call an another function,
http://dev.minetest.net/minetest.rotate_node

calls minetest.rotate_and_place() with infinitestacks set according to the state of the creative mode setting, and checks for "sneak" to set the invert_wall parameter.

EDIT
all of this mods need to be modified :
shoot

@Lymkwi
Copy link
Member

Lymkwi commented Jun 3, 2016

I personally think we should open an issue about that and let the devs properly fix their own sh*t. It's their fault, and their problem if logging and other callbacks do not work. Who here agrees?

@ghost
Copy link

ghost commented Jun 3, 2016

+1 invtweak mod is based on this callback on_place_node for check the inventory, i don't see anything to do with this, maybe a callback on_rotate_node.

@BetterToAutomateTheWorld
Copy link
Member

+1 @LeMagnesium
But we need to link the devs here :)

@BetterToAutomateTheWorld
Copy link
Member

BetterToAutomateTheWorld commented Jun 10, 2016

Linked devs (from listed mods)

maptools : https://github.com/minetest-mods/maptools @Calinou
moretrees : https://github.com/minetest-mods/moretrees @VanessaE
multitest : https://forum.minetest.net/viewtopic.php?f=11&t=9334&p=220537#p220537
quartz : https://github.com/minetest-mods/quartz @4Evergreen4 @VanessaE @9zeg
homedecor : https://github.com/minetest-mods/homedecor_modpack @emon @Amaz1 @VanessaE @tenplus1
moreblocks : https://github.com/minetest-mods/moreblocks @Calinou @pithydon @sofar
nether : https://github.com/HybridDog/nether-pack @HybridDog
default(minetest_game) : https://github.com/minetest/minetest_game For this repo, I think the word will be spread with all of this @ linked devs :)

Well, sorry everyone for the notification, but it's needed...

(EDIT ; I also tanslate all of this issue in english)

@VanessaE
Copy link

This isn't something routine mods should ever have to consider. Either you need to make a mod that wedges in before the rotate function to do what you're looking for, or make your changes at the subgame level.

@Lymkwi
Copy link
Member

Lymkwi commented Jun 13, 2016

make your changes at the subgame level.

I would rather do that. Minetest's dev will apparently never find a way to go around their sh*tty forceful callback blocking system, so we'll have to fix on our repo.

And next time they complain about node placement not logged (on Vanilla), I won't help.

@BetterToAutomateTheWorld
Copy link
Member

Well, finally do we want to fix that on our own way or I closed this issue (players will be sad...) ?

@ghost
Copy link

ghost commented Aug 13, 2016

fixed 3752bf2

@ghost ghost closed this as completed Aug 13, 2016
@ElementW
Copy link
Member

Moved to _misc: 947b301

@HybridDog
Copy link

HybridDog commented Aug 14, 2016

Can you simply make rotate_node call the registered on_placenode functions in lieu?

Coethium pushed a commit to Coethium/server-minetestforfun that referenced this issue Aug 14, 2016
This issue was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

6 participants