Tweak Paxel some more
This commit is contained in:
parent
8a104460d8
commit
7cfb2e6921
1 changed files with 16 additions and 16 deletions
|
@ -129,20 +129,19 @@ minetest.override_item("ctf_bandages:bandage", {
|
||||||
})
|
})
|
||||||
|
|
||||||
local diggers = {}
|
local diggers = {}
|
||||||
local DIG_COOLDOWN = 60
|
local DIG_COOLDOWN = 45
|
||||||
local DIG_DIST_LIMIT = 30
|
local DIG_DIST_LIMIT = 30
|
||||||
local DIG_SPEED = 0.5
|
local DIG_SPEED = 0.5
|
||||||
|
|
||||||
local function isdiggable(name)
|
local function isdiggable(name)
|
||||||
return (
|
return name:find("default:") and (
|
||||||
name:find("default:") and (
|
name:find("cobble") or name:find("wood" ) or
|
||||||
name:find("cobble") or name:find("wood" ) or
|
name:find("leaves") or name:find("dirt" ) or
|
||||||
name:find("leaves") or name:find("dirt" ) or
|
name:find("gravel") or name:find("sand" ) or
|
||||||
name:find("gravel") or name:find("sand" ) or
|
name:find("tree" ) or name:find("brick") or
|
||||||
name:find("tree" ) or name:find("brick") or
|
name:find("glass" ) or name:find("ice" ) or
|
||||||
name:find("glass" )
|
name:find("snow" )
|
||||||
)
|
)
|
||||||
) or name:find("wool:")
|
|
||||||
end
|
end
|
||||||
|
|
||||||
local function remove_pillar(pos, pname)
|
local function remove_pillar(pos, pname)
|
||||||
|
@ -157,12 +156,12 @@ local function remove_pillar(pos, pname)
|
||||||
pos.y = pos.y + 1
|
pos.y = pos.y + 1
|
||||||
minetest.after(DIG_SPEED, remove_pillar, pos, pname)
|
minetest.after(DIG_SPEED, remove_pillar, pos, pname)
|
||||||
else
|
else
|
||||||
minetest.chat_send_player(pname, "Pillar digging stopped, too far away from digging pos. Can activate again in 1 minute")
|
minetest.chat_send_player(pname, "Pillar digging stopped, too far away from digging pos. Can activate again in "..DIG_COOLDOWN.." seconds")
|
||||||
diggers[pname] = minetest.after(DIG_COOLDOWN, function() diggers[pname] = nil end)
|
diggers[pname] = minetest.after(DIG_COOLDOWN, function() diggers[pname] = nil end)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
minetest.chat_send_player(pname, "Pillar digging stopped at undiggable node. Can activate again in 1 minute")
|
minetest.chat_send_player(pname, "Pillar digging stopped at undiggable node. Can activate again in "..DIG_COOLDOWN.." seconds")
|
||||||
diggers[pname] = minetest.after(DIG_COOLDOWN, function() diggers[pname] = nil end)
|
diggers[pname] = minetest.after(DIG_COOLDOWN, function() diggers[pname] = nil end)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -197,7 +196,7 @@ minetest.register_tool("ctf_classes:paxel_steel", {
|
||||||
diggers[pname] = true
|
diggers[pname] = true
|
||||||
remove_pillar(pointed_thing.under, pname)
|
remove_pillar(pointed_thing.under, pname)
|
||||||
elseif type(diggers[pname]) ~= "table" then
|
elseif type(diggers[pname]) ~= "table" then
|
||||||
minetest.chat_send_player(pname, "Pillar digging stopped. Can activate again in 1 minute")
|
minetest.chat_send_player(pname, "Pillar digging stopped. Can activate again in "..DIG_COOLDOWN.." seconds")
|
||||||
diggers[pname] = minetest.after(DIG_COOLDOWN, function() diggers[pname] = nil end)
|
diggers[pname] = minetest.after(DIG_COOLDOWN, function() diggers[pname] = nil end)
|
||||||
else
|
else
|
||||||
minetest.chat_send_player(pname, "You can't activate yet")
|
minetest.chat_send_player(pname, "You can't activate yet")
|
||||||
|
@ -207,11 +206,12 @@ minetest.register_tool("ctf_classes:paxel_steel", {
|
||||||
on_secondary_use = function(itemstack, user, pointed_thing)
|
on_secondary_use = function(itemstack, user, pointed_thing)
|
||||||
local pname = user:get_player_name()
|
local pname = user:get_player_name()
|
||||||
|
|
||||||
if diggers[pname] and type(diggers[pname]) ~= "table" then
|
if diggers[pname] and diggers[pname] == true and type(diggers[pname]) ~= "table" then
|
||||||
minetest.after(1, function()
|
diggers[pname] = 1
|
||||||
|
minetest.after(2, function()
|
||||||
if user and user:get_player_control().RMB then
|
if user and user:get_player_control().RMB then
|
||||||
if diggers[pname] and type(diggers[pname]) ~= "table" then
|
if diggers[pname] and type(diggers[pname]) ~= "table" then
|
||||||
minetest.chat_send_player(pname, "Pillar digging stopped. Can activate again in 1 minute")
|
minetest.chat_send_player(pname, "Pillar digging stopped. Can activate again in "..DIG_COOLDOWN.." seconds")
|
||||||
diggers[pname] = minetest.after(DIG_COOLDOWN, function() diggers[pname] = nil end)
|
diggers[pname] = minetest.after(DIG_COOLDOWN, function() diggers[pname] = nil end)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue