mirror of
https://github.com/FaceDeer/dfcaverns.git
synced 2025-01-24 17:20:19 +01:00
add light sensitivity, set up blood thorn for mapgen
This commit is contained in:
parent
fb85ee2ea6
commit
570e934d29
@ -59,7 +59,7 @@ minetest.register_node("dfcaverns:black_cap_sapling", {
|
||||
fixed = {-4 / 16, -0.5, -4 / 16, 4 / 16, 7 / 16, 4 / 16}
|
||||
},
|
||||
groups = {snappy = 2, dig_immediate = 3, flammable = 2,
|
||||
attached_node = 1, sapling = 1},
|
||||
attached_node = 1, sapling = 1, light_sensitive_fungus = 11},
|
||||
sounds = default.node_sound_leaves_defaults(),
|
||||
|
||||
on_construct = function(pos)
|
||||
|
107
blood_thorn.lua
107
blood_thorn.lua
@ -16,12 +16,12 @@ minetest.register_node("dfcaverns:blood_thorn", {
|
||||
"dfcaverns_blood_thorn_side.png", "dfcaverns_blood_thorn_side.png", "dfcaverns_blood_thorn_side.png", "dfcaverns_blood_thorn_side.png"},
|
||||
paramtype2 = "facedir",
|
||||
paramtype = "light",
|
||||
groups = {choppy = 3, flammable = 2},
|
||||
groups = {choppy = 3, flammable = 2, light_sensitive_fungus = 11},
|
||||
_dfcaverns_dead_node = "dfcaverns:blood_thorn_dead",
|
||||
sounds = default.node_sound_wood_defaults(),
|
||||
on_place = minetest.rotate_node,
|
||||
})
|
||||
|
||||
|
||||
minetest.register_node("dfcaverns:blood_thorn_dead", {
|
||||
description = S("Dead Blood Thorn Trunk"),
|
||||
tiles = {"dfcaverns_blood_thorn_top.png^[multiply:#804000", "dfcaverns_blood_thorn_top.png^[multiply:#804000",
|
||||
@ -32,7 +32,6 @@ minetest.register_node("dfcaverns:blood_thorn_dead", {
|
||||
on_place = minetest.rotate_node,
|
||||
})
|
||||
|
||||
|
||||
minetest.register_node("dfcaverns:blood_thorn_spike", {
|
||||
description = S("Blood Thorn Spike"),
|
||||
tiles = {
|
||||
@ -43,7 +42,8 @@ minetest.register_node("dfcaverns:blood_thorn_spike", {
|
||||
"dfcaverns_blood_thorn_spike_front.png",
|
||||
"dfcaverns_blood_thorn_spike_front.png"
|
||||
},
|
||||
groups = {choppy = 3, flammable = 2, fall_damage_add_percent=100},
|
||||
groups = {choppy = 3, flammable = 2, fall_damage_add_percent=100, light_sensitive_fungus = 11},
|
||||
_dfcaverns_dead_node = "dfcaverns:blood_thorn_spike_dead",
|
||||
sounds = default.node_sound_wood_defaults(),
|
||||
drawtype = "nodebox",
|
||||
climbable = true,
|
||||
@ -93,6 +93,15 @@ local spike_directions = {
|
||||
{dir={x=-1,y=0,z=0}, facedir=1}
|
||||
}
|
||||
|
||||
-- This ensures consistent random maximum to bloodthorn growth
|
||||
local max_bloodthorn_height = function(pos)
|
||||
local next_seed = math.random(1, 1000000000)
|
||||
math.randomseed(pos.x + pos.z * 2 ^ 8)
|
||||
local output = math.random(3,6)
|
||||
math.randomseed(next_seed)
|
||||
return output
|
||||
end
|
||||
|
||||
function dfcaverns.grow_blood_thorn(pos, node)
|
||||
if node.param2 >= 4 then
|
||||
return
|
||||
@ -103,12 +112,13 @@ function dfcaverns.grow_blood_thorn(pos, node)
|
||||
end
|
||||
pos.y = pos.y + 1
|
||||
local height = 0
|
||||
while node.name == "dfcaverns:blood_thorn" and height < 4 do
|
||||
local max_height = max_bloodthorn_height(pos)
|
||||
while node.name == "dfcaverns:blood_thorn" and height < max_height do
|
||||
height = height + 1
|
||||
pos.y = pos.y + 1
|
||||
node = minetest.get_node(pos)
|
||||
end
|
||||
if height == 6 or node.name ~= "air" then
|
||||
if height == 7 or node.name ~= "air" then
|
||||
return
|
||||
end
|
||||
|
||||
@ -134,48 +144,73 @@ minetest.register_abm({
|
||||
interval = dfcaverns.config.blood_thorn_growth_interval,
|
||||
chance = dfcaverns.config.blood_thorn_growth_chance,
|
||||
action = function(pos, node)
|
||||
if minetest.get_node_light(pos) > 11 then --11 and an adjacent torch will kill bloodthorn
|
||||
minetest.swap_node(pos, {name="dfcaverns:blood_thorn_dead", param2 = node.param2})
|
||||
else
|
||||
dfcaverns.grow_blood_thorn(pos, node)
|
||||
end
|
||||
end
|
||||
})
|
||||
|
||||
minetest.register_abm({
|
||||
label = "dfcaverns:kill_blood_thorn_spikes",
|
||||
nodenames = {"dfcaverns:blood_thorn_spike"},
|
||||
catch_up = true,
|
||||
interval = dfcaverns.config.blood_thorn_growth_interval,
|
||||
chance = dfcaverns.config.blood_thorn_growth_chance,
|
||||
action = function(pos, node)
|
||||
if minetest.get_node_light(pos) > 11 then --11 and an adjacent torch will kill bloodthorn
|
||||
minetest.swap_node(pos, {name="dfcaverns:blood_thorn_spike_dead", param2 = node.param2})
|
||||
end
|
||||
end
|
||||
})
|
||||
|
||||
function dfcaverns.spawn_blood_thorn(pos)
|
||||
local height = math.random(3,5)
|
||||
for i = 0, height do
|
||||
if minetest.get_node(pos).name == "air" then
|
||||
minetest.set_node(pos, {name="dfcaverns:blood_thorn"})
|
||||
local height = max_bloodthorn_height(pos)
|
||||
local x, y, z = pos.x, pos.y, pos.z
|
||||
local maxy = y + height -- Trunk top
|
||||
|
||||
local vm = minetest.get_voxel_manip()
|
||||
local minp, maxp = vm:read_from_map(
|
||||
{x = x - 1, y = y, z = z - 1},
|
||||
{x = x + 1, y = maxy, z = z + 1}
|
||||
)
|
||||
local area = VoxelArea:new({MinEdge = minp, MaxEdge = maxp})
|
||||
local data = vm:get_data()
|
||||
local data_param2 = vm:get_param2_data()
|
||||
|
||||
dfcaverns.spawn_blood_thorn_vm(area:indexp(pos), area, data, data_param2, height)
|
||||
|
||||
vm:set_data(data)
|
||||
vm:set_param2_data(data_param2)
|
||||
vm:write_to_map()
|
||||
vm:update_map()
|
||||
end
|
||||
|
||||
local c_air = minetest.get_content_id("air")
|
||||
local c_ignore = minetest.get_content_id("ignore")
|
||||
local c_blood_thorn = minetest.get_content_id("dfcaverns:blood_thorn")
|
||||
local c_blood_thorn_spike = minetest.get_content_id("dfcaverns:blood_thorn_spike")
|
||||
|
||||
dfcaverns.spawn_blood_thorn_vm = function(vi, area, data, data_param2, height)
|
||||
local pos = area:position(vi)
|
||||
if height == nil then height = max_bloodthorn_height(pos) end
|
||||
local x = pos.x
|
||||
local y = pos.y
|
||||
local z = pos.z
|
||||
local maxy = y + height -- Trunk top
|
||||
|
||||
for yy = y, maxy do
|
||||
local vi = area:index(x, yy, z)
|
||||
local node_id = data[vi]
|
||||
if node_id == c_air or node_id == c_ignore then
|
||||
data[vi] = c_blood_thorn
|
||||
|
||||
local dir = spike_directions[math.random(1,4)]
|
||||
local spike_pos = vector.add(pos, dir)
|
||||
if minetest.get_node(spike_pos).name == "air" then
|
||||
local facedir = minetest.dir_to_facedir(vector.multiply(dir, -1))
|
||||
minetest.set_node(spike_pos, {name="dfcaverns:blood_thorn_spike", param2=facedir})
|
||||
local spike_pos = {x = pos.x + dir.dir.x, y = yy, z = pos.z + dir.dir.z}
|
||||
vi = area:indexp(spike_pos)
|
||||
if data[vi] == c_air or data[vi] == c_c_ignore then
|
||||
data[vi] = c_blood_thorn_spike
|
||||
data_param2[vi] = dir.facedir
|
||||
end
|
||||
|
||||
dir = spike_directions[math.random(1,4)]
|
||||
spike_pos = vector.add(pos, dir)
|
||||
if minetest.get_node(spike_pos).name == "air" then
|
||||
local facedir = minetest.dir_to_facedir(vector.multiply(dir, -1))
|
||||
minetest.set_node(spike_pos, {name="dfcaverns:blood_thorn_spike", param2=facedir})
|
||||
spike_pos = {x = pos.x + dir.dir.x, y = yy, z = pos.z + dir.dir.z}
|
||||
vi = area:indexp(spike_pos)
|
||||
if data[vi] == c_air or data[vi] == c_c_ignore then
|
||||
data[vi] = c_blood_thorn_spike
|
||||
data_param2[vi] = dir.facedir
|
||||
end
|
||||
else
|
||||
break
|
||||
end
|
||||
pos.y = pos.y + 1
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -64,7 +64,7 @@ minetest.register_node("dfcaverns:fungiwood_sapling", {
|
||||
fixed = {-4 / 16, -0.5, -4 / 16, 4 / 16, 7 / 16, 4 / 16}
|
||||
},
|
||||
groups = {snappy = 2, dig_immediate = 3, flammable = 2,
|
||||
attached_node = 1, sapling = 1},
|
||||
attached_node = 1, sapling = 1, light_sensitive_fungus = 11},
|
||||
sounds = default.node_sound_leaves_defaults(),
|
||||
|
||||
on_construct = function(pos)
|
||||
@ -90,7 +90,7 @@ function dfcaverns.spawn_fungiwood(pos)
|
||||
local vm = minetest.get_voxel_manip()
|
||||
local minp, maxp = vm:read_from_map(
|
||||
{x = x - 3, y = y, z = z - 3},
|
||||
{x = x + 3, y = maxy + 3, z = z + 3}
|
||||
{x = x + 3, y = maxy, z = z + 3}
|
||||
)
|
||||
local area = VoxelArea:new({MinEdge = minp, MaxEdge = maxp})
|
||||
local data = vm:get_data()
|
||||
|
@ -59,7 +59,7 @@ minetest.register_node("dfcaverns:goblin_cap_sapling", {
|
||||
fixed = {-4 / 16, -0.5, -4 / 16, 4 / 16, 7 / 16, 4 / 16}
|
||||
},
|
||||
groups = {snappy = 2, dig_immediate = 3, flammable = 2,
|
||||
attached_node = 1, sapling = 1},
|
||||
attached_node = 1, sapling = 1, light_sensitive_fungus = 11},
|
||||
sounds = default.node_sound_leaves_defaults(),
|
||||
|
||||
on_construct = function(pos)
|
||||
|
@ -12,7 +12,8 @@ minetest.register_node("dfcaverns:cobble_cave_moss", {
|
||||
tiles = {"default_cobble.png^dfcaverns_cave_moss.png", "default_cobble.png", "default_cobble.png^dfcaverns_cave_moss_side.png"},
|
||||
drop = "default:cobble",
|
||||
is_ground_content = false,
|
||||
groups = {cracky = 3, stone = 2},
|
||||
groups = {cracky = 3, stone = 2, light_sensitive_fungus = 11},
|
||||
_dfcaverns_dead_node = "default:cobble",
|
||||
sounds = default.node_sound_stone_defaults(),
|
||||
})
|
||||
|
||||
@ -36,9 +37,10 @@ minetest.register_abm{
|
||||
minetest.register_node("dfcaverns:cobble_floor_fungus", {
|
||||
description = S("Cobblestone With Floor Fungus"),
|
||||
tiles = {"default_cobble.png^dfcaverns_floor_fungus.png", "default_cobble.png", "default_cobble.png^dfcaverns_floor_fungus_side.png"},
|
||||
drops= "default:cobble",
|
||||
drops = "default:cobble",
|
||||
is_ground_content = false,
|
||||
groups = {cracky = 3, stone = 2},
|
||||
groups = {cracky = 3, stone = 2, light_sensitive_fungus = 11},
|
||||
_dfcaverns_dead_node = "default:cobble",
|
||||
sounds = default.node_sound_stone_defaults(),
|
||||
})
|
||||
|
||||
|
19
init.lua
19
init.lua
@ -1,5 +1,7 @@
|
||||
dfcaverns = {}
|
||||
|
||||
subterrane.get_param2_data = true
|
||||
|
||||
--grab a shorthand for the filepath of the mod
|
||||
local modpath = minetest.get_modpath(minetest.get_current_modname())
|
||||
|
||||
@ -18,3 +20,20 @@ dofile(modpath.."/black_cap.lua")
|
||||
dofile(modpath.."/nether_cap.lua")
|
||||
dofile(modpath.."/goblin_cap.lua")
|
||||
dofile(modpath.."/tower_cap.lua")
|
||||
|
||||
|
||||
minetest.register_abm({
|
||||
label = "dfcaverns:kill_light_sensitive_fungus",
|
||||
nodenames = {"group:light_sensitive_fungus"},
|
||||
catch_up = true,
|
||||
interval = 30,
|
||||
chance = 5,
|
||||
action = function(pos, node)
|
||||
local node_def = minetest.registered_nodes[node.name]
|
||||
local dead_node = node_def._dfcaverns_dead_node or "dfcaverns:dead_fungus"
|
||||
-- 11 is the value adjacent to a torch
|
||||
if minetest.get_node_light(pos) > node_def.groups.light_sensitive_fungus then
|
||||
minetest.set_node(pos, {name=dead_node, param2 = node.param2})
|
||||
end
|
||||
end
|
||||
})
|
@ -59,7 +59,7 @@ minetest.register_node("dfcaverns:nether_cap_sapling", {
|
||||
fixed = {-4 / 16, -0.5, -4 / 16, 4 / 16, 7 / 16, 4 / 16}
|
||||
},
|
||||
groups = {snappy = 2, dig_immediate = 3,
|
||||
attached_node = 1, sapling = 1},
|
||||
attached_node = 1, sapling = 1, light_sensitive_fungus = 11},
|
||||
sounds = default.node_sound_leaves_defaults(),
|
||||
|
||||
on_construct = function(pos)
|
||||
|
20
plants.lua
20
plants.lua
@ -70,7 +70,7 @@ local register_cave_wheat = function(number)
|
||||
inventory_image = "dfcaverns_cave_wheat_"..tostring(number)..".png",
|
||||
paramtype = "light",
|
||||
walkable = false,
|
||||
groups = {flammable=4, oddly_breakable_by_hand=1},
|
||||
groups = {flammable=4, oddly_breakable_by_hand=1, light_sensitive_fungus = 11},
|
||||
sounds = default.node_sound_leaves_defaults(),
|
||||
})
|
||||
end
|
||||
@ -100,7 +100,7 @@ local register_dimple_cup = function(number)
|
||||
inventory_image = "dfcaverns_dimple_cups_"..tostring(number)..".png",
|
||||
paramtype = "light",
|
||||
walkable = false,
|
||||
groups = {flammable=4, oddly_breakable_by_hand=1},
|
||||
groups = {flammable=4, oddly_breakable_by_hand=1, light_sensitive_fungus = 11},
|
||||
sounds = default.node_sound_leaves_defaults(),
|
||||
})
|
||||
end
|
||||
@ -127,7 +127,7 @@ local register_pig_tail = function(number)
|
||||
inventory_image = "dfcaverns_pigtails_"..tostring(number)..".png",
|
||||
paramtype = "light",
|
||||
walkable = false,
|
||||
groups = {flammable=4, oddly_breakable_by_hand=1},
|
||||
groups = {flammable=4, oddly_breakable_by_hand=1, light_sensitive_fungus = 11},
|
||||
sounds = default.node_sound_leaves_defaults(),
|
||||
})
|
||||
end
|
||||
@ -152,7 +152,7 @@ minetest.register_node("dfcaverns:plump_helmet_spawn", {
|
||||
tiles = {
|
||||
"dfcaverns_plump_helmet_cap.png",
|
||||
},
|
||||
groups = {flammable=4, oddly_breakable_by_hand=1},
|
||||
groups = {flammable=4, oddly_breakable_by_hand=1, light_sensitive_fungus = 11},
|
||||
drawtype = "nodebox",
|
||||
paramtype = "light",
|
||||
paramtype2 = "facedir",
|
||||
@ -172,7 +172,7 @@ minetest.register_node("dfcaverns:plump_helmet_1", {
|
||||
"dfcaverns_plump_helmet_cap.png",
|
||||
"dfcaverns_plump_helmet_cap.png^[lowpart:5:dfcaverns_plump_helmet_stem.png",
|
||||
},
|
||||
groups = {flammable=4, oddly_breakable_by_hand=1},
|
||||
groups = {flammable=4, oddly_breakable_by_hand=1, light_sensitive_fungus = 11},
|
||||
drawtype = "nodebox",
|
||||
paramtype = "light",
|
||||
paramtype2 = "facedir",
|
||||
@ -193,7 +193,7 @@ minetest.register_node("dfcaverns:plump_helmet_2", {
|
||||
"dfcaverns_plump_helmet_cap.png",
|
||||
"dfcaverns_plump_helmet_cap.png^[lowpart:15:dfcaverns_plump_helmet_stem.png",
|
||||
},
|
||||
groups = {flammable=4, oddly_breakable_by_hand=1},
|
||||
groups = {flammable=4, oddly_breakable_by_hand=1, light_sensitive_fungus = 11},
|
||||
drawtype = "nodebox",
|
||||
paramtype = "light",
|
||||
paramtype2 = "facedir",
|
||||
@ -213,7 +213,7 @@ minetest.register_node("dfcaverns:plump_helmet_3", {
|
||||
"dfcaverns_plump_helmet_cap.png",
|
||||
"dfcaverns_plump_helmet_cap.png^[lowpart:35:dfcaverns_plump_helmet_stem.png",
|
||||
},
|
||||
groups = {flammable=4, oddly_breakable_by_hand=1},
|
||||
groups = {flammable=4, oddly_breakable_by_hand=1, light_sensitive_fungus = 11},
|
||||
drawtype = "nodebox",
|
||||
paramtype = "light",
|
||||
paramtype2 = "facedir",
|
||||
@ -233,7 +233,7 @@ minetest.register_node("dfcaverns:plump_helmet_4", {
|
||||
"dfcaverns_plump_helmet_cap.png",
|
||||
"dfcaverns_plump_helmet_cap.png^[lowpart:40:dfcaverns_plump_helmet_stem.png",
|
||||
},
|
||||
groups = {flammable=4, oddly_breakable_by_hand=1},
|
||||
groups = {flammable=4, oddly_breakable_by_hand=1, light_sensitive_fungus = 11},
|
||||
drawtype = "nodebox",
|
||||
paramtype = "light",
|
||||
paramtype2 = "facedir",
|
||||
@ -264,7 +264,7 @@ local register_quarry_bush = function(number)
|
||||
inventory_image = "dfcaverns_quarry_bush_"..tostring(number)..".png",
|
||||
paramtype = "light",
|
||||
walkable = false,
|
||||
groups = {flammable=4, oddly_breakable_by_hand=1},
|
||||
groups = {flammable=4, oddly_breakable_by_hand=1, light_sensitive_fungus = 11},
|
||||
sounds = default.node_sound_leaves_defaults(),
|
||||
})
|
||||
end
|
||||
@ -295,7 +295,7 @@ local register_sweet_pod = function(number)
|
||||
inventory_image = "dfcaverns_sweet_pods_"..tostring(number)..".png",
|
||||
paramtype = "light",
|
||||
walkable = false,
|
||||
groups = {flammable=4, oddly_breakable_by_hand=1},
|
||||
groups = {flammable=4, oddly_breakable_by_hand=1, light_sensitive_fungus = 11},
|
||||
sounds = default.node_sound_leaves_defaults(),
|
||||
})
|
||||
end
|
||||
|
@ -105,7 +105,7 @@ minetest.register_node("dfcaverns:spore_tree_sapling", {
|
||||
fixed = {-4 / 16, -0.5, -4 / 16, 4 / 16, 7 / 16, 4 / 16}
|
||||
},
|
||||
groups = {snappy = 2, dig_immediate = 3, flammable = 2,
|
||||
attached_node = 1, sapling = 1},
|
||||
attached_node = 1, sapling = 1, light_sensitive_fungus = 11},
|
||||
sounds = default.node_sound_leaves_defaults(),
|
||||
|
||||
on_construct = function(pos)
|
||||
@ -133,6 +133,12 @@ minetest.register_node("dfcaverns:spore_tree_sapling", {
|
||||
-- thin_branches=true,
|
||||
--}
|
||||
|
||||
local c_air = minetest.get_content_id("air")
|
||||
local c_ignore = minetest.get_content_id("ignore")
|
||||
local c_spore_pod = minetest.get_content_id("dfcaverns:spore_tree_pod")
|
||||
local c_tree = minetest.get_content_id("dfcaverns:spore_tree")
|
||||
local c_spore_frond = minetest.get_content_id("dfcaverns:spore_tree_frond")
|
||||
|
||||
dfcaverns.spawn_spore_tree_vm = function(vi, data, area, height, size, iters, has_fruiting_bodies)
|
||||
if height == nil then height = math.random(3,6) end
|
||||
if size == nil then size = 2 end
|
||||
@ -141,11 +147,6 @@ dfcaverns.spawn_spore_tree_vm = function(vi, data, area, height, size, iters, ha
|
||||
|
||||
local pos = area:position(vi)
|
||||
local x, y, z = pos.x, pos.y, pos.z
|
||||
local c_air = minetest.get_content_id("air")
|
||||
local c_ignore = minetest.get_content_id("ignore")
|
||||
local c_spore_pod = minetest.get_content_id("dfcaverns:spore_tree_pod")
|
||||
local c_tree = minetest.get_content_id("dfcaverns:spore_tree")
|
||||
local c_spore_frond = minetest.get_content_id("dfcaverns:spore_tree_frond")
|
||||
|
||||
local has_fruiting_bodies = true
|
||||
|
||||
|
@ -59,7 +59,7 @@ minetest.register_node("dfcaverns:tower_cap_sapling", {
|
||||
fixed = {-4 / 16, -0.5, -4 / 16, 4 / 16, 7 / 16, 4 / 16}
|
||||
},
|
||||
groups = {snappy = 2, dig_immediate = 3, flammable = 2,
|
||||
attached_node = 1, sapling = 1},
|
||||
attached_node = 1, sapling = 1, light_sensitive_fungus = 11},
|
||||
sounds = default.node_sound_leaves_defaults(),
|
||||
|
||||
on_construct = function(pos)
|
||||
|
@ -31,7 +31,7 @@ minetest.register_node("dfcaverns:tunnel_tube", {
|
||||
},
|
||||
})
|
||||
|
||||
minetest.register_node("dfcaverns:tunnel_tube_nodule", {
|
||||
minetest.register_node("dfcaverns:tunnel_tube_fruiting_body", {
|
||||
description = S("Tunnel Tube Fruiting Body"),
|
||||
tiles = {"dfcaverns_tunnel_tube.png^[brighten"},
|
||||
paramtype2 = "facedir",
|
||||
@ -68,7 +68,7 @@ dfcaverns.tunnel_tube_def = {
|
||||
random_level=0,
|
||||
trunk_type="single",
|
||||
thin_branches=true,
|
||||
fruit="dfcaverns:tunnel_tube_nodule",
|
||||
fruit="dfcaverns:tunnel_tube_fruiting_body",
|
||||
fruit_chance=0
|
||||
}
|
||||
|
||||
@ -87,7 +87,7 @@ minetest.register_node("dfcaverns:tunnel_tube_sapling", {
|
||||
fixed = {-4 / 16, -0.5, -4 / 16, 4 / 16, 7 / 16, 4 / 16}
|
||||
},
|
||||
groups = {snappy = 2, dig_immediate = 3, flammable = 2,
|
||||
attached_node = 1, sapling = 1},
|
||||
attached_node = 1, sapling = 1, light_sensitive_fungus = 11},
|
||||
sounds = default.node_sound_leaves_defaults(),
|
||||
|
||||
on_construct = function(pos)
|
||||
|
Loading…
Reference in New Issue
Block a user