Skip to content

Commit

Permalink
Don't give presents for dig_immediate nodes (or similar)
Browse files Browse the repository at this point in the history
  • Loading branch information
luk3yx committed Nov 6, 2023
1 parent 0bdedfa commit d277a9b
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions presents.lua
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,14 @@ if holidays.is_holiday_active("presents") then
holidays.log("action", "presents enabled")
minetest.register_on_dignode(function(pos, oldnode, digger)
if not digger or not digger:is_player() then return end

-- Don't give any presents if it takes less than 0.1 seconds to dig by
-- hand
local def = minetest.registered_nodes[oldnode.name] or {}
local dig_params = minetest.get_dig_params(def.groups or {},
minetest.registered_items[""].tool_capabilities)
if dig_params.diggable and dig_params.time < 0.1 then return end

local n = math.random(1, 1000)
if n <= 10 then
if n == 1 then
Expand Down

0 comments on commit d277a9b

Please sign in to comment.