pandorabox-io / pandorabox.io

Pandorabox infrastructure code
https://pandorabox.io
31 stars 4 forks source link

Digging papyrus gives XP for whole stack #611

Closed S-S-X closed 3 years ago

S-S-X commented 3 years ago

Marked as bug because this allows very easily automating machine that can generate huge amounts of XP for player, even completely automated with default client and simple looping mouse macro without any user interaction.

Simplest fix would be to just blacklist papyrus and bamboo, note that bamboo allows exactly same thing.

Also would be good to check similar nodes that have "auto dig" feature.

S-S-X commented 3 years ago

So I built PoC machine to test this in practice and that granted bit over 20 XP / second, for this huge optimizations can be made + it will do a lot better job when server is lagging bit less.

OgelGames commented 3 years ago

I think they should not be blacklisted, papyrus is one of the only quicker ways to get XP that is left, besides digging sand, and if someone is smart enough to build a machine to make it a bit easier, then they probably deserve the XP.

Maybe the auto digging function could be overridden to prevent it working with big towers, so at least regular papyrus farms will still give XP.

that granted bit over 20 XP / second

Not much faster than digging sand I think (would need to do testing for the exact number).

S-S-X commented 3 years ago

Not much faster than digging sand I think (would need to do testing for the exact number).

About 16-18 XP / second, requires actively doing things (running and digging).

Thing is I can very easily script that with few click so that I can get 20 XP AFK long time with high server lag and probably (based on other machines) about 60-100 XP / second when server is running with max_lag below 1 second.

edit. Tested another thing and got about 79 XP / second edit2. Tested yet another and got about 174 XP / second

Maybe the auto digging function could be overridden to prevent it working with big towers

That would be best option. I do also think that normal XP granted for cutting normal grown papyrus and bamboo would be okay, blacklist was mostly just easy way if nobody wants to add special limiters.

S-S-X commented 3 years ago

Not much faster than digging sand I think (would need to do testing for the exact number).

Also for this if I would not have done automated machine where I can just stand I could easily get well over 1000 XP / second with some manual work.

OgelGames commented 3 years ago

Here is the auto digging function: https://github.com/minetest/minetest_game/blob/6a9cbcad827c9e04eee53321844b170dfa63e388/mods/default/functions.lua#L292-L299

And bamboo is the only other place this function is used: https://github.com/runsy/cool_trees/blob/96a426ce0e33c24839633f287e113afe3481b99b/bamboo/init.lua#L159

I think the simplest way to limit it would be to check the distance between the digger and the node, something like this (untested):

function default.dig_up(pos, node, digger)
    if digger == nil then return end
    local np = {x = pos.x, y = pos.y + 1, z = pos.z}
    local nn = minetest.get_node(np)
    if nn.name == node.name then
        local dp = digger.get_pos()
        if (np.y - dp.y) < 10 then
            minetest.node_dig(np, nn, digger)
        end
    end
end
S-S-X commented 3 years ago

Just checked xp_redo, another option would be to add limiter there. It would not only fix papyrus and bamboo but also client side cheats for instant digging.

Not sure how accurate this limiter actually is but it would add bit more than just fixing infinite XP from papyrus and bamboo. It seems small addition here https://github.com/mt-mods/xp_redo/blob/master/builtin.lua could do the trick.

  -- bonus on digging
+ local dig_limiter = create_limiter(0.07)
  minetest.register_on_dignode(function(_, oldnode, digger)
    if digger ~= nil and digger:is_player() and not digger.is_fake_player then
        if not oldnode.name then
            return
        end
+       if dig_limiter(digger) then return end
BuckarooBanzay commented 3 years ago

and if someone is smart enough to build a machine to make it a bit easier, then they probably deserve the XP.

Good point :+1: still: automating it would mean an xp-gain while afk-ing, that wasn't the idea behind it :yum:

It seems small addition here https://github.com/mt-mods/xp_redo/blob/master/builtin.lua could do the trick.

This would limit the xp-gain to 1 per 70 milliseconds, this would still amount to about 14 xp/second

I think the simplest way to limit it would be to check the distance between the digger and the node, something like this (untested):

There is also vector.distance(p1, p2) for that.

I see if i can whip up something later today, not sure though, if anyone wants to fix this before i get to it, feel free...

OgelGames commented 3 years ago

automating it would mean an xp-gain while afk-ing, that wasn't the idea behind it

True 👍

if anyone wants to fix this before i get to it, feel free...

Done, added the function override to pandorabox_custom. I still think the direct xp/second limiter would be a good idea though, so I won't close this just yet...

TechDudie commented 3 years ago

h1ghly un$upp0rt1ve 0f th1$ bug be1ng f1xx3d

TechDudie commented 3 years ago

People deserve the XP that they earn, it’s not exactly cheap to craft millions of deployers and millions of tp tubes to go along with it.

Also, you cannot place papayrus on thin air last time I checked, and since the tp tubes are random, it will take a long time if you try to make it automatic.

If you really have to, then maybe add a “special expensive” deployer that when the node deployed is broken, XP will be granted. Normally, if you break a node placed by a regular deployer, no XP granted.

OgelGames commented 3 years ago

it’s not exactly cheap to craft millions of deployers and millions of tp tubes to go along with it.

And if you actually crafted them you would have already gained more than enough XP 😄

Also, you cannot place papayrus on thin air last time I checked

Actually you can, or at least you can using machines.

it will take a long time if you try to make it automatic.

I think it took me about half an hour to make the digtron based machine I used to get the final chunk of XP I needed to pass 1M a while ago, which yielded me about 5000 XP every 5 minutes IIRC...

S-S-X commented 3 years ago

it’s not exactly cheap to craft millions of deployers and millions of tp tubes to go along with it.

1 digtron builder == effectively 25 deployers when automated with mesecons like deployer, that is because builder can place 25 nodes / cycle while deployer can place 1 node / cycle

TechDudie commented 3 years ago

If you really have to, then maybe add a “special expensive” deployer that when the node deployed is broken, XP will be granted. Normally, if you break a node placed by a regular deployer, no XP granted.

S-S-X commented 3 years ago

If you really have to, then maybe add a “special expensive” deployer that when the node deployed is broken, XP will be granted. Normally, if you break a node placed by a regular deployer, no XP granted.

This gets very complicated and requires adding unnecessary metadata and is really bad way to go, deployer itself would require special support just for xp mod which also is not good thing.

Also we would need to remove XP from nodes placed with digtron, deployer, constructor, replacer, what else...? All these would require special support just for XP mod, PRs for this would never get through.

OgelGames commented 3 years ago

@TechDudie The machines automate the placing of towers of papyrus, which then makes it easy to dig by hand to get XP.

TechDudie commented 3 years ago

ik that

S-S-X commented 3 years ago

Done, added the function override to pandorabox_custom. I still think the direct xp/second limiter would be a good idea though, so I won't close this just yet...

Added configurable (disabled by default) dig rate limiter to xp_redo, PR above.

OgelGames commented 3 years ago

I think this can be closed now...