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

Increase punch distance #304

Open
Ygarr opened this issue Sep 14, 2023 · 10 comments
Open

Increase punch distance #304

Ygarr opened this issue Sep 14, 2023 · 10 comments

Comments

@Ygarr
Copy link

Ygarr commented Sep 14, 2023

Please add optionally ability or tell:
how to change max range to break(or dig, or place) blocks further than ≈4 block.

screenshot_20230914_212238

@wsor4035
Copy link
Collaborator

not opposed to changing the distance, however this is something that could be easily done by a mod

@SwissalpS
Copy link
Contributor

Ygarr take a look at mods that add tools. That should give you a hint how to override the 'reach' parameter.

@wsor4035
Copy link
Collaborator

@Ygarr you didnt suggest a specific amount you think it should be changed to. personally if i was going to bump it, would do something like 6/7

dont quote me on this, but i believe mtg default is 4 in survival, and 10 in creative? in which case, would bump to 6/7 just for survival. 10 seems ok for creative, but could push it to 12 just to be double 6 in survival. at any rate, there are people who are better at gameplay balancing then I, so please speak up

@SwissalpS
Copy link
Contributor

IMO 4 for empty hand is great. Bumping to 6 takes the advantages of adding tools away. Consider adding a mod that gives players a tool or permission that 'extends arms'.
In a way that players can decide when they want far reach and when not sounds like a better game dynamic to me than just bumping the default.

@Ygarr
Copy link
Author

Ygarr commented Sep 15, 2023

@wsor4035 I think length=12 is maximum(UPD: I was wrong :0) ), based on previously read information on the Internet. As far as i remember mods like Asuna and Repixture had convenient punch length...
I'll test them in closest time to be sure

(Also please take note I suggested this ontopic for creative, building mode,
so bare hands but with doing its best... And survive mode and other modes - would/could be at authors discretion..)

@Ygarr
Copy link
Author

Ygarr commented Sep 15, 2023

I have got such
lengthes
10 blocks length - in Asuna
11 blocks length - in Survivaltest
21 blocks length - in Repixture
I think any of this cases are approbriable. (For me personally - "21" also is ok)

screenshot_20230915_192936

screenshot_20230915_193248

screenshot_20230915_193423

@wsor4035
Copy link
Collaborator

11 sounds good to me (for creative). feel free to open a pr

@Ygarr
Copy link
Author

Ygarr commented Jun 18, 2024

tried to make mod, but no effect:
init.lua:

minetest.register_on_punchnode(function(pos, node, puncher, pointed_thing)
    if puncher:is_player() then
        local player_pos = puncher:get_pos()
        local pointed_pos = pointed_thing.under
        local distance = vector.distance(player_pos, pointed_pos)

        -- 
        local max_distance = 18

        if distance <= max_distance then
            return false  
        else
            return true 
        end
    end
end)

@wsor4035
Copy link
Collaborator

you should override the hand item, probably need to optional depend on creative so you get loaded afterwords

@Ygarr
Copy link
Author

Ygarr commented Jun 21, 2024

Thanks every one, this works(Maybe needs optimization):
modfolder/ init.lua

minetest.register_item(":", {
    type = "none",
    wield_image = "wieldhand.png",
    wield_scale = {x = 1, y = 1, z = 2.5},
    tool_capabilities = {
        full_punch_interval = 0.9,
        max_drop_level = 0,
        groupcaps = {
            crumbly = {times = {[2]=3.00, [3]=0.70}, uses=0, maxlevel=1},
            snappy = {times = {[3]=0.40}, uses=0, maxlevel=1},
            oddly_breakable_by_hand = {times = {[1]=3.50, [2]=0.40, [3]=0.20}, uses=0}
        },
        damage_groups = {fleshy=1},
    },
    range = 18,  -- Set the punch distance here
    on_place = function(itemstack, user, pointed_thing)
        -- Make sure it's not interfering with placement actions
        if pointed_thing.type == "node" then
            return minetest.item_place(itemstack, user, pointed_thing)
        end
    end,
    on_use = function(itemstack, user, pointed_thing)
        if pointed_thing.type == "node" then
            local pos = pointed_thing.under
            local player_pos = user:get_pos()
            local distance = vector.distance(player_pos, pos)

            if distance <= 18 then
                minetest.node_punch(pos, minetest.get_node(pos), user, itemstack)
            end
        end
    end
})

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants