poikilos
8 years ago
committed by
Jacob Gustafson
10 changed files with 4632 additions and 2 deletions
@ -0,0 +1,3 @@ |
|||||
|
Minetest Game mod: homedecor_censorship |
||||
|
======================================= |
||||
|
This mod provides a transition from adult beverages to non-adult beverages |
@ -0,0 +1 @@ |
|||||
|
homedecor |
@ -0,0 +1,2 @@ |
|||||
|
minetest.register_alias("homedecor:beer_tap", "homedecor:coffee_maker") |
||||
|
minetest.register_alias("homedecor:wine_rack", "homedecor:coffee_maker") |
File diff suppressed because it is too large
@ -0,0 +1,210 @@ |
|||||
|
|
||||
|
local cutlery_cbox = { |
||||
|
type = "fixed", |
||||
|
fixed = { |
||||
|
{ -5/16, -8/16, -6/16, 5/16, -7/16, 2/16 }, |
||||
|
{ -2/16, -8/16, 2/16, 2/16, -4/16, 6/16 } |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
homedecor.register("cutlery_set", { |
||||
|
drawtype = "mesh", |
||||
|
mesh = "homedecor_cutlery_set.obj", |
||||
|
tiles = { "homedecor_cutlery_set.png" }, |
||||
|
inventory_image = "homedecor_cutlery_set_inv.png", |
||||
|
description = "Cutlery set", |
||||
|
groups = {snappy=3}, |
||||
|
selection_box = cutlery_cbox, |
||||
|
walkable = false, |
||||
|
sounds = default.node_sound_glass_defaults(), |
||||
|
}) |
||||
|
|
||||
|
local bottle_cbox = { |
||||
|
type = "fixed", |
||||
|
fixed = { |
||||
|
{ -0.125, -0.5, -0.125, 0.125, 0, 0.125} |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
local fbottle_cbox = { |
||||
|
type = "fixed", |
||||
|
fixed = { |
||||
|
{ -0.375, -0.5, -0.3125, 0.375, 0, 0.3125 } |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
local bottle_colors = {"brown", "green"} |
||||
|
|
||||
|
for _, b in ipairs(bottle_colors) do |
||||
|
|
||||
|
homedecor.register("bottle_"..b, { |
||||
|
tiles = { "homedecor_bottle_"..b..".png" }, |
||||
|
inventory_image = "homedecor_bottle_"..b.."_inv.png", |
||||
|
description = "Bottle ("..b..")", |
||||
|
mesh = "homedecor_bottle.obj", |
||||
|
walkable = false, |
||||
|
groups = {snappy=3}, |
||||
|
sounds = default.node_sound_glass_defaults(), |
||||
|
selection_box = bottle_cbox |
||||
|
}) |
||||
|
|
||||
|
-- 4-bottle sets |
||||
|
|
||||
|
homedecor.register("4_bottles_"..b, { |
||||
|
tiles = { |
||||
|
"homedecor_bottle_"..b..".png", |
||||
|
"homedecor_bottle_"..b..".png" |
||||
|
}, |
||||
|
inventory_image = "homedecor_4_bottles_"..b.."_inv.png", |
||||
|
description = "Four "..b.." bottles", |
||||
|
mesh = "homedecor_4_bottles.obj", |
||||
|
walkable = false, |
||||
|
groups = {snappy=3}, |
||||
|
sounds = default.node_sound_glass_defaults(), |
||||
|
selection_box = fbottle_cbox |
||||
|
}) |
||||
|
end |
||||
|
|
||||
|
homedecor.register("4_bottles_multi", { |
||||
|
tiles = { |
||||
|
"homedecor_bottle_brown.png", |
||||
|
"homedecor_bottle_green.png" |
||||
|
}, |
||||
|
inventory_image = "homedecor_4_bottles_multi_inv.png", |
||||
|
description = "Four misc brown/green bottles", |
||||
|
mesh = "homedecor_4_bottles.obj", |
||||
|
groups = {snappy=3}, |
||||
|
walkable = false, |
||||
|
sounds = default.node_sound_glass_defaults(), |
||||
|
selection_box = fbottle_cbox |
||||
|
}) |
||||
|
|
||||
|
local wine_cbox = homedecor.nodebox.slab_z(-0.75) |
||||
|
homedecor.register("drink_rack", { |
||||
|
description = "Drink rack", |
||||
|
mesh = "homedecor_wine_rack.obj", |
||||
|
tiles = { |
||||
|
"homedecor_generic_wood_red.png", |
||||
|
"homedecor_bottle_brown.png", |
||||
|
"homedecor_bottle_brown2.png", |
||||
|
"homedecor_bottle_brown3.png", |
||||
|
"homedecor_bottle_brown4.png" |
||||
|
}, |
||||
|
inventory_image = "homedecor_wine_rack_inv.png", |
||||
|
groups = {choppy=2}, |
||||
|
selection_box = wine_cbox, |
||||
|
collision_box = wine_cbox, |
||||
|
sounds = default.node_sound_defaults(), |
||||
|
}) |
||||
|
|
||||
|
homedecor.register("dartboard", { |
||||
|
description = "Dartboard", |
||||
|
mesh = "homedecor_dartboard.obj", |
||||
|
tiles = { "homedecor_dartboard.png" }, |
||||
|
inventory_image = "homedecor_dartboard_inv.png", |
||||
|
wield_image = "homedecor_dartboard_inv.png", |
||||
|
paramtype2 = "wallmounted", |
||||
|
walkable = false, |
||||
|
selection_box = { |
||||
|
type = "wallmounted", |
||||
|
}, |
||||
|
groups = {choppy=2,dig_immediate=2,attached_node=1}, |
||||
|
legacy_wallmounted = true, |
||||
|
sounds = default.node_sound_wood_defaults(), |
||||
|
}) |
||||
|
|
||||
|
homedecor.register("drink_tap", { |
||||
|
description = "Drink tap", |
||||
|
mesh = "homedecor_beer_taps.obj", |
||||
|
tiles = { |
||||
|
"homedecor_generic_metal_bright.png", |
||||
|
{ name = "homedecor_generic_metal.png", color = homedecor.color_black } |
||||
|
}, |
||||
|
inventory_image = "homedecor_beertap_inv.png", |
||||
|
groups = { snappy=3 }, |
||||
|
walkable = false, |
||||
|
selection_box = { |
||||
|
type = "fixed", |
||||
|
fixed = { -0.25, -0.5, -0.4375, 0.25, 0.235, 0 } |
||||
|
}, |
||||
|
on_punch = function(pos, node, puncher, pointed_thing) |
||||
|
local wielditem = puncher:get_wielded_item() |
||||
|
local inv = puncher:get_inventory() |
||||
|
|
||||
|
local wieldname = wielditem:get_name() |
||||
|
if wieldname == "vessels:drinking_glass" then |
||||
|
if inv:room_for_item("main", "homedecor:drink_mug 1") then |
||||
|
wielditem:take_item() |
||||
|
puncher:set_wielded_item(wielditem) |
||||
|
inv:add_item("main", "homedecor:drink_mug 1") |
||||
|
minetest.chat_send_player(puncher:get_player_name(), "Ahh, a nice cold drink - look in your inventory for it!") |
||||
|
else |
||||
|
minetest.chat_send_player(puncher:get_player_name(), "No room in your inventory to add a drink mug!") |
||||
|
end |
||||
|
end |
||||
|
end |
||||
|
}) |
||||
|
minetest.register_alias("homedecor:beer_tap", "homedecor:drink_tap") |
||||
|
|
||||
|
|
||||
|
minetest.register_craft({ |
||||
|
output = "homedecor:drink_tap", |
||||
|
recipe = { |
||||
|
{ "group:stick","default:steel_ingot","group:stick" }, |
||||
|
{ "homedecor:kitchen_faucet","default:steel_ingot","homedecor:kitchen_faucet" }, |
||||
|
{ "default:steel_ingot","default:steel_ingot","default:steel_ingot" } |
||||
|
}, |
||||
|
}) |
||||
|
|
||||
|
local beer_cbox = { |
||||
|
type = "fixed", |
||||
|
fixed = { -5/32, -8/16, -9/32 , 7/32, -2/16, 1/32 } |
||||
|
} |
||||
|
|
||||
|
homedecor.register("drink_mug", { |
||||
|
description = "Drink mug", |
||||
|
drawtype = "mesh", |
||||
|
mesh = "homedecor_beer_mug.obj", |
||||
|
tiles = { "homedecor_beer_mug.png" }, |
||||
|
inventory_image = "homedecor_beer_mug_inv.png", |
||||
|
groups = { snappy=3, oddly_breakable_by_hand=3 }, |
||||
|
walkable = false, |
||||
|
sounds = default.node_sound_glass_defaults(), |
||||
|
selection_box = beer_cbox, |
||||
|
on_use = minetest.item_eat(2) |
||||
|
}) |
||||
|
minetest.register_alias("homedecor:beer_mug", "homedecor:drink_mug") |
||||
|
|
||||
|
local svm_cbox = { |
||||
|
type = "fixed", |
||||
|
fixed = {-0.5, -0.5, -0.5, 0.5, 1.5, 0.5} |
||||
|
} |
||||
|
|
||||
|
homedecor.register("soda_machine", { |
||||
|
description = "Soda Vending Machine", |
||||
|
mesh = "homedecor_soda_machine.obj", |
||||
|
tiles = {"homedecor_soda_machine.png"}, |
||||
|
groups = {snappy=3}, |
||||
|
selection_box = svm_cbox, |
||||
|
collision_box = svm_cbox, |
||||
|
expand = { top="placeholder" }, |
||||
|
sounds = default.node_sound_wood_defaults(), |
||||
|
on_rotate = screwdriver.rotate_simple, |
||||
|
on_punch = function(pos, node, puncher, pointed_thing) |
||||
|
local wielditem = puncher:get_wielded_item() |
||||
|
local wieldname = wielditem:get_name() |
||||
|
local fdir_to_fwd = { {0, -1}, {-1, 0}, {0, 1}, {1, 0} } |
||||
|
local fdir = node.param2 |
||||
|
local pos_drop = { x=pos.x+fdir_to_fwd[fdir+1][1], y=pos.y, z=pos.z+fdir_to_fwd[fdir+1][2] } |
||||
|
if wieldname == "homedecor:coin" then |
||||
|
wielditem:take_item() |
||||
|
puncher:set_wielded_item(wielditem) |
||||
|
minetest.spawn_item(pos_drop, "homedecor:soda_can") |
||||
|
minetest.sound_play("insert_coin", { |
||||
|
pos=pos, max_hear_distance = 5 |
||||
|
}) |
||||
|
else |
||||
|
minetest.chat_send_player(puncher:get_player_name(), "Please insert a coin in the machine.") |
||||
|
end |
||||
|
end |
||||
|
}) |
@ -0,0 +1,421 @@ |
|||||
|
# Blender v2.73 (sub 0) OBJ File: 'beer_mug.blend' |
||||
|
# www.blender.org |
||||
|
o Torus.001 |
||||
|
v -0.200872 -0.271336 -0.101373 |
||||
|
v 0.027435 -0.500000 0.013804 |
||||
|
v 0.078127 -0.500000 -0.007193 |
||||
|
v -0.213731 -0.262707 -0.113186 |
||||
|
v 0.116925 -0.500000 -0.045991 |
||||
|
v 0.137922 -0.500000 -0.096683 |
||||
|
v -0.201779 -0.214262 -0.136814 |
||||
|
v 0.137922 -0.500000 -0.151551 |
||||
|
v 0.116925 -0.500000 -0.202243 |
||||
|
v -0.190840 -0.230675 -0.148627 |
||||
|
v 0.078127 -0.500000 -0.241041 |
||||
|
v 0.027435 -0.500000 -0.262038 |
||||
|
v -0.179901 -0.247087 -0.136814 |
||||
|
v -0.027433 -0.500000 -0.262038 |
||||
|
v -0.078125 -0.500000 -0.241041 |
||||
|
v -0.179901 -0.247087 -0.113186 |
||||
|
v -0.116923 -0.500000 -0.202243 |
||||
|
v -0.137920 -0.500000 -0.151551 |
||||
|
v -0.190840 -0.230675 -0.101373 |
||||
|
v -0.137920 -0.500000 -0.096682 |
||||
|
v -0.116923 -0.500000 -0.045991 |
||||
|
v -0.201779 -0.214262 -0.113186 |
||||
|
v -0.078125 -0.500000 -0.007193 |
||||
|
v -0.027433 -0.500000 0.013804 |
||||
|
v -0.183162 -0.175815 -0.136814 |
||||
|
v 0.024062 -0.166667 -0.003152 |
||||
|
v 0.068522 -0.166667 -0.021568 |
||||
|
v -0.175215 -0.198406 -0.148627 |
||||
|
v 0.102550 -0.166667 -0.055596 |
||||
|
v 0.120966 -0.166667 -0.100055 |
||||
|
v -0.167267 -0.220996 -0.136814 |
||||
|
v 0.120966 -0.166667 -0.148178 |
||||
|
v 0.102550 -0.166667 -0.192638 |
||||
|
v -0.167267 -0.220996 -0.113186 |
||||
|
v 0.068522 -0.166667 -0.226666 |
||||
|
v 0.024062 -0.166667 -0.245082 |
||||
|
v -0.175215 -0.198406 -0.101373 |
||||
|
v -0.024061 -0.166667 -0.245082 |
||||
|
v -0.068520 -0.166667 -0.226666 |
||||
|
v -0.183162 -0.175815 -0.113186 |
||||
|
v -0.102548 -0.166667 -0.192638 |
||||
|
v -0.120964 -0.166667 -0.148178 |
||||
|
v -0.159704 -0.151131 -0.136814 |
||||
|
v -0.120964 -0.166667 -0.100055 |
||||
|
v -0.102548 -0.166667 -0.055596 |
||||
|
v -0.155526 -0.177688 -0.148627 |
||||
|
v -0.068520 -0.166667 -0.021568 |
||||
|
v -0.024060 -0.166667 -0.003152 |
||||
|
v -0.151348 -0.204244 -0.136814 |
||||
|
v 0.027435 -0.125001 0.013804 |
||||
|
v 0.078127 -0.125001 -0.007193 |
||||
|
v -0.151348 -0.204244 -0.113186 |
||||
|
v 0.116925 -0.125001 -0.045991 |
||||
|
v 0.137922 -0.125001 -0.096683 |
||||
|
v -0.155526 -0.177688 -0.101373 |
||||
|
v 0.137922 -0.125001 -0.151551 |
||||
|
v 0.116925 -0.125001 -0.202243 |
||||
|
v -0.159704 -0.151131 -0.113186 |
||||
|
v 0.078127 -0.125001 -0.241041 |
||||
|
v 0.027435 -0.125001 -0.262038 |
||||
|
v -0.133701 -0.142626 -0.136814 |
||||
|
v -0.027433 -0.125001 -0.262038 |
||||
|
v -0.078125 -0.125001 -0.241041 |
||||
|
v -0.133701 -0.170549 -0.148627 |
||||
|
v -0.116923 -0.125001 -0.202243 |
||||
|
v -0.137921 -0.125001 -0.151551 |
||||
|
v -0.133701 -0.198472 -0.136814 |
||||
|
v -0.137921 -0.125001 -0.096682 |
||||
|
v -0.116923 -0.125001 -0.045991 |
||||
|
v -0.133701 -0.198472 -0.113186 |
||||
|
v -0.078125 -0.125001 -0.007193 |
||||
|
v -0.027433 -0.125001 0.013804 |
||||
|
v -0.133701 -0.170549 -0.101373 |
||||
|
v 0.024062 -0.125001 -0.003152 |
||||
|
v 0.068522 -0.125001 -0.021568 |
||||
|
v -0.133701 -0.142626 -0.113186 |
||||
|
v 0.102550 -0.125001 -0.055596 |
||||
|
v 0.120966 -0.125001 -0.100055 |
||||
|
v -0.133701 -0.490192 -0.136814 |
||||
|
v 0.120966 -0.125001 -0.148178 |
||||
|
v 0.102550 -0.125001 -0.192638 |
||||
|
v -0.133701 -0.462269 -0.148627 |
||||
|
v 0.068522 -0.125001 -0.226666 |
||||
|
v 0.024062 -0.125001 -0.245082 |
||||
|
v -0.133701 -0.434346 -0.136814 |
||||
|
v -0.024061 -0.125001 -0.245082 |
||||
|
v -0.068520 -0.125001 -0.226666 |
||||
|
v -0.133701 -0.434346 -0.113186 |
||||
|
v -0.102548 -0.125001 -0.192638 |
||||
|
v -0.120964 -0.125001 -0.148178 |
||||
|
v -0.133701 -0.462269 -0.101373 |
||||
|
v -0.120964 -0.125001 -0.100055 |
||||
|
v -0.102548 -0.125001 -0.055596 |
||||
|
v -0.133701 -0.490192 -0.113186 |
||||
|
v -0.068520 -0.125001 -0.021568 |
||||
|
v -0.024061 -0.125001 -0.003152 |
||||
|
v -0.188013 -0.279964 -0.113186 |
||||
|
v -0.188013 -0.279964 -0.136814 |
||||
|
v -0.200872 -0.271336 -0.148627 |
||||
|
v -0.213731 -0.262707 -0.136814 |
||||
|
v -0.217850 -0.316409 -0.113186 |
||||
|
v -0.204329 -0.316409 -0.101373 |
||||
|
v -0.190808 -0.316409 -0.113186 |
||||
|
v -0.190808 -0.316409 -0.136814 |
||||
|
v -0.204329 -0.316409 -0.148627 |
||||
|
v -0.217850 -0.316409 -0.136814 |
||||
|
v -0.213731 -0.370111 -0.113186 |
||||
|
v -0.200872 -0.361482 -0.101373 |
||||
|
v -0.188013 -0.352853 -0.113186 |
||||
|
v -0.188013 -0.352853 -0.136814 |
||||
|
v -0.200872 -0.361482 -0.148627 |
||||
|
v -0.213731 -0.370111 -0.136814 |
||||
|
v -0.201779 -0.418556 -0.113186 |
||||
|
v -0.190840 -0.402143 -0.101373 |
||||
|
v -0.179901 -0.385730 -0.113186 |
||||
|
v -0.179901 -0.385730 -0.136814 |
||||
|
v -0.190840 -0.402143 -0.148627 |
||||
|
v -0.201779 -0.418556 -0.136814 |
||||
|
v -0.183162 -0.457002 -0.113186 |
||||
|
v -0.175215 -0.434412 -0.101373 |
||||
|
v -0.167268 -0.411822 -0.113186 |
||||
|
v -0.167268 -0.411822 -0.136814 |
||||
|
v -0.175215 -0.434412 -0.148627 |
||||
|
v -0.183162 -0.457002 -0.136814 |
||||
|
v -0.159704 -0.481686 -0.113186 |
||||
|
v -0.155526 -0.455130 -0.101373 |
||||
|
v -0.151348 -0.428574 -0.113186 |
||||
|
v -0.151348 -0.428574 -0.136814 |
||||
|
v -0.155526 -0.455130 -0.148627 |
||||
|
v -0.159704 -0.481686 -0.136814 |
||||
|
vt 0.156250 0.218750 |
||||
|
vt 0.156250 0.187500 |
||||
|
vt 0.218750 0.187500 |
||||
|
vt 0.218750 0.218750 |
||||
|
vt 0.465889 0.405864 |
||||
|
vt 0.537350 0.405864 |
||||
|
vt 0.603372 0.433211 |
||||
|
vt 0.653903 0.483742 |
||||
|
vt 0.681251 0.549764 |
||||
|
vt 0.681251 0.621226 |
||||
|
vt 0.653904 0.687248 |
||||
|
vt 0.603372 0.737779 |
||||
|
vt 0.537350 0.765126 |
||||
|
vt 0.465889 0.765126 |
||||
|
vt 0.399867 0.737779 |
||||
|
vt 0.349335 0.687248 |
||||
|
vt 0.321988 0.621226 |
||||
|
vt 0.321988 0.549764 |
||||
|
vt 0.349335 0.483742 |
||||
|
vt 0.399867 0.433211 |
||||
|
vt 0.625000 0.906250 |
||||
|
vt 0.687500 0.906250 |
||||
|
vt 0.687500 0.937500 |
||||
|
vt 0.625000 0.937500 |
||||
|
vt 0.937500 0.906250 |
||||
|
vt 1.000000 0.906250 |
||||
|
vt 1.000000 0.937500 |
||||
|
vt 0.937500 0.937500 |
||||
|
vt 0.250000 0.906250 |
||||
|
vt 0.312500 0.906250 |
||||
|
vt 0.312500 0.937500 |
||||
|
vt 0.250000 0.937500 |
||||
|
vt 0.562500 0.906250 |
||||
|
vt 0.562500 0.937500 |
||||
|
vt 0.875000 0.906250 |
||||
|
vt 0.875000 0.937500 |
||||
|
vt 0.187500 0.906250 |
||||
|
vt 0.187500 0.937500 |
||||
|
vt 0.812500 0.906250 |
||||
|
vt 0.812500 0.937500 |
||||
|
vt 0.437500 0.906250 |
||||
|
vt 0.500000 0.906250 |
||||
|
vt 0.500000 0.937500 |
||||
|
vt 0.437500 0.937500 |
||||
|
vt 0.125000 0.906250 |
||||
|
vt 0.125000 0.937500 |
||||
|
vt 0.750000 0.906250 |
||||
|
vt 0.750000 0.937500 |
||||
|
vt 0.375000 0.906250 |
||||
|
vt 0.375000 0.937500 |
||||
|
vt 0.062500 0.906250 |
||||
|
vt 0.062500 0.937500 |
||||
|
vt -0.000000 0.906250 |
||||
|
vt -0.000000 0.937500 |
||||
|
vt 0.281250 0.312500 |
||||
|
vt 0.281250 0.281250 |
||||
|
vt 0.343750 0.281250 |
||||
|
vt 0.343750 0.312500 |
||||
|
vt 0.093750 0.218750 |
||||
|
vt 0.156250 0.250000 |
||||
|
vt 0.093750 0.250000 |
||||
|
vt 0.375000 1.000000 |
||||
|
vt 0.312500 1.000000 |
||||
|
vt 0.281250 0.250000 |
||||
|
vt 0.343750 0.250000 |
||||
|
vt 0.156250 0.312500 |
||||
|
vt 0.156250 0.281250 |
||||
|
vt 0.218750 0.281250 |
||||
|
vt 0.218750 0.312500 |
||||
|
vt 0.531250 0.187500 |
||||
|
vt 0.593750 0.187500 |
||||
|
vt 0.593750 0.218750 |
||||
|
vt 0.531250 0.218750 |
||||
|
vt 0.656250 0.187500 |
||||
|
vt 0.656250 0.218750 |
||||
|
vt 0.093750 0.187500 |
||||
|
vt 0.218750 0.250000 |
||||
|
vt 0.125000 0.406250 |
||||
|
vt 0.187500 0.406250 |
||||
|
vt 0.687500 1.000000 |
||||
|
vt 0.625000 1.000000 |
||||
|
vt 0.937500 0.406250 |
||||
|
vt 1.000000 0.406250 |
||||
|
vt 0.062500 1.000000 |
||||
|
vt 0.125000 1.000000 |
||||
|
vt 0.375000 0.406250 |
||||
|
vt 0.437500 0.406250 |
||||
|
vt 0.687500 0.406250 |
||||
|
vt 0.750000 0.406250 |
||||
|
vt 0.937500 1.000000 |
||||
|
vt 0.875000 1.000000 |
||||
|
vt 0.250000 0.406250 |
||||
|
vt 0.187500 1.000000 |
||||
|
vt 0.093750 0.343750 |
||||
|
vt 0.093750 0.312500 |
||||
|
vt 0.156250 0.343750 |
||||
|
vt 0.500000 0.406250 |
||||
|
vt 0.812500 0.406250 |
||||
|
vt 0.437500 1.000000 |
||||
|
vt 0.218750 0.156250 |
||||
|
vt 0.281250 0.156250 |
||||
|
vt 0.281250 0.187500 |
||||
|
vt 0.750000 1.000000 |
||||
|
vt 0.031250 0.250000 |
||||
|
vt 0.031250 0.218750 |
||||
|
vt 0.562500 0.406250 |
||||
|
vt -0.000000 0.406250 |
||||
|
vt 0.062500 0.406250 |
||||
|
vt 1.000000 1.000000 |
||||
|
vt 0.343750 0.187500 |
||||
|
vt 0.343750 0.156250 |
||||
|
vt 0.406250 0.156250 |
||||
|
vt 0.406250 0.187500 |
||||
|
vt 0.312500 0.406250 |
||||
|
vt 0.625000 0.406250 |
||||
|
vt 0.250000 1.000000 |
||||
|
vt 0.406250 0.343750 |
||||
|
vt 0.406250 0.312500 |
||||
|
vt 0.468750 0.312500 |
||||
|
vt 0.468750 0.343750 |
||||
|
vt 0.875000 0.406250 |
||||
|
vt 0.468750 0.156250 |
||||
|
vt 0.468750 0.187500 |
||||
|
vt 0.500000 1.000000 |
||||
|
vt 0.812500 1.000000 |
||||
|
vt 0.406250 0.281250 |
||||
|
vt 0.406250 0.250000 |
||||
|
vt 0.562500 1.000000 |
||||
|
vt -0.000000 1.000000 |
||||
|
vt 0.218750 0.343750 |
||||
|
vt 0.531250 0.312500 |
||||
|
vt 0.531250 0.281250 |
||||
|
vt 0.593750 0.281250 |
||||
|
vt 0.593750 0.312500 |
||||
|
vt 0.468750 0.281250 |
||||
|
vt 0.468750 0.250000 |
||||
|
vt 0.531250 0.250000 |
||||
|
vt 0.281250 0.343750 |
||||
|
vt 0.593750 0.250000 |
||||
|
vt 0.281250 0.218750 |
||||
|
vt 0.343750 0.218750 |
||||
|
vt 0.031250 0.156250 |
||||
|
vt 0.093750 0.156250 |
||||
|
vt 0.031250 0.187500 |
||||
|
vt 0.813063 0.373140 |
||||
|
vt 0.756333 0.349641 |
||||
|
vt 0.712914 0.306222 |
||||
|
vt 0.689415 0.249492 |
||||
|
vt 0.689415 0.188087 |
||||
|
vt 0.712914 0.131357 |
||||
|
vt 0.756333 0.087938 |
||||
|
vt 0.813063 0.064439 |
||||
|
vt 0.874467 0.064439 |
||||
|
vt 0.931197 0.087938 |
||||
|
vt 0.974617 0.131357 |
||||
|
vt 0.998115 0.188088 |
||||
|
vt 0.998115 0.249492 |
||||
|
vt 0.974617 0.306222 |
||||
|
vt 0.931197 0.349641 |
||||
|
vt 0.874467 0.373140 |
||||
|
vt 0.156250 0.156250 |
||||
|
vt 0.656250 0.250000 |
||||
|
vt 0.031250 0.312500 |
||||
|
vt 0.031250 0.281250 |
||||
|
vt 0.093750 0.281250 |
||||
|
vt 0.656250 0.281250 |
||||
|
vt 0.656250 0.312500 |
||||
|
vt 0.406250 0.218750 |
||||
|
vt 0.468750 0.218750 |
||||
|
vt 0.031250 0.343750 |
||||
|
vt 0.656250 0.343750 |
||||
|
vt 0.593750 0.343750 |
||||
|
vt 0.531250 0.343750 |
||||
|
vt 0.531250 0.156250 |
||||
|
vt 0.593750 0.156250 |
||||
|
vt 0.343750 0.343750 |
||||
|
vt 0.656250 0.156250 |
||||
|
s 1 |
||||
|
f 120/1 121/2 115/3 114/4 |
||||
|
f 2/5 24/6 23/7 21/8 20/9 18/10 17/11 15/12 14/13 12/14 11/15 9/16 8/17 6/18 5/19 3/20 |
||||
|
f 51/21 53/22 77/23 75/24 |
||||
|
f 59/25 60/26 84/27 83/28 |
||||
|
f 66/29 68/30 92/31 90/32 |
||||
|
f 50/33 51/21 75/24 74/34 |
||||
|
f 57/35 59/25 83/28 81/36 |
||||
|
f 65/37 66/29 90/32 89/38 |
||||
|
f 56/39 57/35 81/36 80/40 |
||||
|
f 71/41 72/42 96/43 95/44 |
||||
|
f 63/45 65/37 89/38 87/46 |
||||
|
f 54/47 56/39 80/40 78/48 |
||||
|
f 69/49 71/41 95/44 93/50 |
||||
|
f 62/51 63/45 87/46 86/52 |
||||
|
f 53/22 54/47 78/48 77/23 |
||||
|
f 60/53 62/51 86/52 84/54 |
||||
|
f 111/55 112/56 106/57 105/58 |
||||
|
f 72/42 50/33 74/34 96/43 |
||||
|
f 126/59 120/1 119/60 125/61 |
||||
|
f 45/62 44/63 92/31 93/50 |
||||
|
f 106/57 112/56 107/64 101/65 |
||||
|
f 123/66 124/67 118/68 117/69 |
||||
|
f 34/70 52/71 55/72 37/73 |
||||
|
f 55/72 52/71 70/74 73/75 |
||||
|
f 126/59 127/76 121/2 120/1 |
||||
|
f 112/56 118/68 113/77 107/64 |
||||
|
f 15/78 17/79 65/37 63/45 |
||||
|
f 29/80 27/81 75/24 77/23 |
||||
|
f 11/82 12/83 60/26 59/25 |
||||
|
f 38/84 86/52 87/46 39/85 |
||||
|
f 21/86 23/87 71/41 69/49 |
||||
|
f 5/88 6/89 54/47 53/22 |
||||
|
f 35/90 33/91 81/36 83/28 |
||||
|
f 17/79 18/92 66/29 65/37 |
||||
|
f 41/93 39/85 87/46 89/38 |
||||
|
f 128/94 129/95 123/66 122/96 |
||||
|
f 23/87 24/97 72/42 71/41 |
||||
|
f 6/89 8/98 56/39 54/47 |
||||
|
f 47/99 45/62 93/50 95/44 |
||||
|
f 115/3 116/100 110/101 109/102 |
||||
|
f 30/103 29/80 77/23 78/48 |
||||
|
f 94/104 91/105 126/59 125/61 |
||||
|
f 24/97 2/106 50/33 72/42 |
||||
|
f 12/107 14/108 62/51 60/53 |
||||
|
f 36/109 35/90 83/28 84/27 |
||||
|
f 103/110 104/111 98/112 97/113 |
||||
|
f 18/92 20/114 68/30 66/29 |
||||
|
f 2/106 3/115 51/21 50/33 |
||||
|
f 42/116 41/93 89/38 90/32 |
||||
|
f 98/117 99/118 10/119 13/120 |
||||
|
f 8/98 9/121 57/35 56/39 |
||||
|
f 97/113 98/112 13/122 16/123 |
||||
|
f 48/124 47/99 95/44 96/43 |
||||
|
f 32/125 30/103 78/48 80/40 |
||||
|
f 100/126 106/57 101/65 4/127 |
||||
|
f 14/108 15/78 63/45 62/51 |
||||
|
f 118/68 112/56 111/55 117/69 |
||||
|
f 26/128 48/124 96/43 74/34 |
||||
|
f 38/84 36/129 84/54 86/52 |
||||
|
f 20/114 21/86 69/49 68/30 |
||||
|
f 122/96 123/66 117/69 116/130 |
||||
|
f 3/115 5/88 53/22 51/21 |
||||
|
f 44/63 42/116 90/32 92/31 |
||||
|
f 27/81 26/128 74/34 75/24 |
||||
|
f 28/131 25/132 43/133 46/134 |
||||
|
f 9/121 11/82 59/25 57/35 |
||||
|
f 33/91 32/125 80/40 81/36 |
||||
|
f 25/132 7/135 22/136 40/137 |
||||
|
f 116/130 117/69 111/55 110/138 |
||||
|
f 40/137 37/73 55/72 58/139 |
||||
|
f 107/64 108/140 102/141 101/65 |
||||
|
f 105/58 106/57 100/126 99/118 |
||||
|
f 43/133 25/132 40/137 58/139 |
||||
|
f 85/142 128/143 127/76 88/144 |
||||
|
f 26/145 27/146 29/147 30/148 32/149 33/150 35/151 36/152 38/153 39/154 41/155 42/156 44/157 45/158 47/159 48/160 |
||||
|
f 68/30 69/49 93/50 92/31 |
||||
|
f 127/76 128/143 122/161 121/2 |
||||
|
f 55/72 73/75 76/162 58/139 |
||||
|
f 99/118 100/126 7/135 10/119 |
||||
|
f 82/163 79/164 130/165 129/95 |
||||
|
f 119/60 120/1 114/4 113/77 |
||||
|
f 118/68 124/67 119/60 113/77 |
||||
|
f 43/133 61/166 64/167 46/134 |
||||
|
f 10/119 7/135 25/132 28/131 |
||||
|
f 130/165 124/67 123/66 129/95 |
||||
|
f 4/127 1/168 19/169 22/136 |
||||
|
f 124/67 130/165 125/61 119/60 |
||||
|
f 61/166 43/133 58/139 76/162 |
||||
|
f 110/101 104/111 103/110 109/102 |
||||
|
f 108/140 109/102 103/110 102/141 |
||||
|
f 88/144 127/76 126/59 91/105 |
||||
|
f 97/113 16/123 19/169 1/168 |
||||
|
f 82/163 129/95 128/94 85/170 |
||||
|
f 19/169 16/123 34/70 37/73 |
||||
|
f 19/169 37/73 40/137 22/136 |
||||
|
f 46/134 64/167 67/171 49/172 |
||||
|
f 114/4 108/140 107/64 113/77 |
||||
|
f 115/3 109/102 108/140 114/4 |
||||
|
f 101/65 102/141 1/168 4/127 |
||||
|
f 10/119 28/131 31/173 13/120 |
||||
|
f 16/123 13/122 31/174 34/70 |
||||
|
f 102/141 103/110 97/113 1/168 |
||||
|
f 31/174 49/175 52/71 34/70 |
||||
|
f 111/55 105/58 104/176 110/138 |
||||
|
f 7/135 100/126 4/127 22/136 |
||||
|
f 122/161 116/100 115/3 121/2 |
||||
|
f 105/58 99/118 98/117 104/176 |
||||
|
f 31/173 28/131 46/134 49/172 |
||||
|
f 130/165 79/164 94/104 125/61 |
||||
|
f 52/71 49/175 67/177 70/74 |
After Width: | Height: | Size: 1.5 KiB |
After Width: | Height: | Size: 5.5 KiB |
@ -0,0 +1,643 @@ |
|||||
|
|
||||
|
-- older privelage for admins to rbypass protected nodes, do not use anymore |
||||
|
-- instead grant admin 'protection_bypass' privelage. |
||||
|
|
||||
|
-- 'delprotect' priv removed, use 'protection_bypass' instead |
||||
|
--minetest.register_privilege("delprotect","Ignore player protection") |
||||
|
|
||||
|
-- get minetest.conf settings |
||||
|
protector = {} |
||||
|
protector.mod = "redo" |
||||
|
protector.radius = tonumber(minetest.setting_get("protector_radius")) or 5 |
||||
|
protector.drop = minetest.setting_getbool("protector_drop") or false |
||||
|
protector.flip = minetest.setting_getbool("protector_flip") or false |
||||
|
protector.hurt = tonumber(minetest.setting_get("protector_hurt")) or 0 |
||||
|
protector.spawn = tonumber(minetest.setting_get("protector_spawn") |
||||
|
or minetest.setting_get("protector_pvp_spawn")) or 0 |
||||
|
|
||||
|
-- get static spawn position |
||||
|
local statspawn = minetest.setting_get_pos("static_spawnpoint") or {x = 0, y = 2, z = 0} |
||||
|
|
||||
|
-- Intllib |
||||
|
local S |
||||
|
if minetest.get_modpath("intllib") then |
||||
|
S = intllib.Getter() |
||||
|
else |
||||
|
S = function(s, a, ...) |
||||
|
if a == nil then |
||||
|
return s |
||||
|
end |
||||
|
a = {a, ...} |
||||
|
return s:gsub("(@?)@(%(?)(%d+)(%)?)", |
||||
|
function(e, o, n, c) |
||||
|
if e == ""then |
||||
|
return a[tonumber(n)] .. (o == "" and c or "") |
||||
|
else |
||||
|
return "@" .. o .. n .. c |
||||
|
end |
||||
|
end) |
||||
|
end |
||||
|
end |
||||
|
protector.intllib = S |
||||
|
|
||||
|
-- return list of members as a table |
||||
|
protector.get_member_list = function(meta) |
||||
|
|
||||
|
return meta:get_string("members"):split(" ") |
||||
|
end |
||||
|
|
||||
|
-- write member list table in protector meta as string |
||||
|
protector.set_member_list = function(meta, list) |
||||
|
|
||||
|
meta:set_string("members", table.concat(list, " ")) |
||||
|
end |
||||
|
|
||||
|
-- check if player name is a member |
||||
|
protector.is_member = function (meta, name) |
||||
|
|
||||
|
for _, n in pairs(protector.get_member_list(meta)) do |
||||
|
|
||||
|
if n == name then |
||||
|
return true |
||||
|
end |
||||
|
end |
||||
|
|
||||
|
return false |
||||
|
end |
||||
|
|
||||
|
-- add player name to table as member |
||||
|
protector.add_member = function(meta, name) |
||||
|
|
||||
|
if protector.is_member(meta, name) then |
||||
|
return |
||||
|
end |
||||
|
|
||||
|
local list = protector.get_member_list(meta) |
||||
|
|
||||
|
table.insert(list, name) |
||||
|
|
||||
|
protector.set_member_list(meta, list) |
||||
|
end |
||||
|
|
||||
|
-- remove player name from table |
||||
|
protector.del_member = function(meta, name) |
||||
|
|
||||
|
local list = protector.get_member_list(meta) |
||||
|
|
||||
|
for i, n in pairs(list) do |
||||
|
|
||||
|
if n == name then |
||||
|
table.remove(list, i) |
||||
|
break |
||||
|
end |
||||
|
end |
||||
|
|
||||
|
protector.set_member_list(meta, list) |
||||
|
end |
||||
|
|
||||
|
-- protector interface |
||||
|
protector.generate_formspec = function(meta) |
||||
|
|
||||
|
local formspec = "size[8,7]" |
||||
|
.. default.gui_bg |
||||
|
.. default.gui_bg_img |
||||
|
.. default.gui_slots |
||||
|
.. "label[2.5,0;" .. S("-- Protector interface --") .. "]" |
||||
|
.. "label[0,1;" .. S("PUNCH node to show protected area or USE for area check") .. "]" |
||||
|
.. "label[0,2;" .. S("Members:") .. "]" |
||||
|
.. "button_exit[2.5,6.2;3,0.5;close_me;" .. S("Close") .. "]" |
||||
|
|
||||
|
local members = protector.get_member_list(meta) |
||||
|
local npp = 12 -- max users added to protector list |
||||
|
local i = 0 |
||||
|
|
||||
|
for n = 1, #members do |
||||
|
|
||||
|
if i < npp then |
||||
|
|
||||
|
-- show username |
||||
|
formspec = formspec .. "button[" .. (i % 4 * 2) |
||||
|
.. "," .. math.floor(i / 4 + 3) |
||||
|
.. ";1.5,.5;protector_member;" .. members[n] .. "]" |
||||
|
|
||||
|
-- username remove button |
||||
|
.. "button[" .. (i % 4 * 2 + 1.25) .. "," |
||||
|
.. math.floor(i / 4 + 3) |
||||
|
.. ";.75,.5;protector_del_member_" .. members[n] .. ";X]" |
||||
|
end |
||||
|
|
||||
|
i = i + 1 |
||||
|
end |
||||
|
|
||||
|
if i < npp then |
||||
|
|
||||
|
-- user name entry field |
||||
|
formspec = formspec .. "field[" .. (i % 4 * 2 + 1 / 3) .. "," |
||||
|
.. (math.floor(i / 4 + 3) + 1 / 3) |
||||
|
.. ";1.433,.5;protector_add_member;;]" |
||||
|
|
||||
|
-- username add button |
||||
|
.."button[" .. (i % 4 * 2 + 1.25) .. "," |
||||
|
.. math.floor(i / 4 + 3) .. ";.75,.5;protector_submit;+]" |
||||
|
|
||||
|
end |
||||
|
|
||||
|
return formspec |
||||
|
end |
||||
|
|
||||
|
-- check if pos is inside a protected spawn area |
||||
|
local function inside_spawn(pos, radius) |
||||
|
|
||||
|
if protector.spawn <= 0 then |
||||
|
return false |
||||
|
end |
||||
|
|
||||
|
if pos.x < statspawn.x + radius |
||||
|
and pos.x > statspawn.x - radius |
||||
|
and pos.y < statspawn.y + radius |
||||
|
and pos.y > statspawn.y - radius |
||||
|
and pos.z < statspawn.z + radius |
||||
|
and pos.z > statspawn.z - radius then |
||||
|
|
||||
|
return true |
||||
|
end |
||||
|
|
||||
|
return false |
||||
|
end |
||||
|
|
||||
|
-- Infolevel: |
||||
|
-- 0 for no info |
||||
|
-- 1 for "This area is owned by <owner> !" if you can't dig |
||||
|
-- 2 for "This area is owned by <owner>. |
||||
|
-- 3 for checking protector overlaps |
||||
|
|
||||
|
protector.can_dig = function(r, pos, digger, onlyowner, infolevel) |
||||
|
|
||||
|
if not digger |
||||
|
or not pos then |
||||
|
return false |
||||
|
end |
||||
|
|
||||
|
-- delprotect and protector_bypass privileged users can override protection |
||||
|
if ( minetest.check_player_privs(digger, {delprotect = true}) |
||||
|
or minetest.check_player_privs(digger, {protection_bypass = true}) ) |
||||
|
and infolevel == 1 then |
||||
|
return true |
||||
|
end |
||||
|
|
||||
|
-- infolevel 3 is only used to bypass priv check, change to 1 now |
||||
|
if infolevel == 3 then infolevel = 1 end |
||||
|
|
||||
|
-- is spawn area protected ? |
||||
|
if inside_spawn(pos, protector.spawn) then |
||||
|
|
||||
|
minetest.chat_send_player(digger, |
||||
|
S("Spawn @1 has been protected up to a @2 block radius.", |
||||
|
minetest.pos_to_string(statspawn), protector.spawn)) |
||||
|
|
||||
|
return false |
||||
|
end |
||||
|
|
||||
|
-- find the protector nodes |
||||
|
local pos = minetest.find_nodes_in_area( |
||||
|
{x = pos.x - r, y = pos.y - r, z = pos.z - r}, |
||||
|
{x = pos.x + r, y = pos.y + r, z = pos.z + r}, |
||||
|
{"protector:protect", "protector:protect2"}) |
||||
|
|
||||
|
local meta, owner, members |
||||
|
|
||||
|
for n = 1, #pos do |
||||
|
|
||||
|
meta = minetest.get_meta(pos[n]) |
||||
|
owner = meta:get_string("owner") or "" |
||||
|
members = meta:get_string("members") or "" |
||||
|
|
||||
|
-- node change and digger isn't owner |
||||
|
if owner ~= digger |
||||
|
and infolevel == 1 then |
||||
|
|
||||
|
-- and you aren't on the member list |
||||
|
if onlyowner |
||||
|
or not protector.is_member(meta, digger) then |
||||
|
|
||||
|
minetest.chat_send_player(digger, |
||||
|
S("This area is owned by @1!", owner)) |
||||
|
|
||||
|
return false |
||||
|
end |
||||
|
end |
||||
|
|
||||
|
-- when using protector as tool, show protector information |
||||
|
if infolevel == 2 then |
||||
|
|
||||
|
minetest.chat_send_player(digger, |
||||
|
S("This area is owned by @1.", owner)) |
||||
|
|
||||
|
minetest.chat_send_player(digger, |
||||
|
S("Protection located at: @1", minetest.pos_to_string(pos[n]))) |
||||
|
|
||||
|
if members ~= "" then |
||||
|
|
||||
|
minetest.chat_send_player(digger, |
||||
|
S("Members: @1.", members)) |
||||
|
end |
||||
|
|
||||
|
return false |
||||
|
end |
||||
|
|
||||
|
end |
||||
|
|
||||
|
-- show when you can build on unprotected area |
||||
|
if infolevel == 2 then |
||||
|
|
||||
|
if #pos < 1 then |
||||
|
|
||||
|
minetest.chat_send_player(digger, |
||||
|
S("This area is not protected.")) |
||||
|
end |
||||
|
|
||||
|
minetest.chat_send_player(digger, S("You can build here.")) |
||||
|
end |
||||
|
|
||||
|
return true |
||||
|
end |
||||
|
|
||||
|
|
||||
|
protector.old_is_protected = minetest.is_protected |
||||
|
|
||||
|
-- check for protected area, return true if protected and digger isn't on list |
||||
|
function minetest.is_protected(pos, digger) |
||||
|
|
||||
|
-- is area protected against digger? |
||||
|
if not protector.can_dig(protector.radius, pos, digger, false, 1) then |
||||
|
|
||||
|
local player = minetest.get_player_by_name(digger) |
||||
|
|
||||
|
-- hurt player if protection violated |
||||
|
if protector.hurt > 0 |
||||
|
and player then |
||||
|
player:set_hp(player:get_hp() - protector.hurt) |
||||
|
end |
||||
|
|
||||
|
-- flip player when protection violated |
||||
|
if protector.flip |
||||
|
and player then |
||||
|
|
||||
|
-- yaw + 180° |
||||
|
--local yaw = player:get_look_horizontal() + math.pi |
||||
|
local yaw = player:get_look_yaw() + math.pi |
||||
|
|
||||
|
if yaw > 2 * math.pi then |
||||
|
yaw = yaw - 2 * math.pi |
||||
|
end |
||||
|
|
||||
|
--player:set_look_horizontal(yaw) |
||||
|
player:set_look_yaw(yaw) |
||||
|
|
||||
|
-- invert pitch |
||||
|
--player:set_look_vertical(-player:get_look_vertical()) |
||||
|
player:set_look_pitch(-player:get_look_pitch()) |
||||
|
|
||||
|
-- if digging below player, move up to avoid falling through hole |
||||
|
local pla_pos = player:getpos() |
||||
|
|
||||
|
if pos.y < pla_pos.y then |
||||
|
|
||||
|
player:setpos({ |
||||
|
x = pla_pos.x, |
||||
|
y = pla_pos.y + 0.8, |
||||
|
z = pla_pos.z |
||||
|
}) |
||||
|
end |
||||
|
end |
||||
|
|
||||
|
-- drop tool/item if protection violated |
||||
|
if protector.drop == true |
||||
|
and player then |
||||
|
|
||||
|
local holding = player:get_wielded_item() |
||||
|
|
||||
|
if holding:to_string() ~= "" then |
||||
|
|
||||
|
-- take stack |
||||
|
local sta = holding:take_item(holding:get_count()) |
||||
|
player:set_wielded_item(holding) |
||||
|
|
||||
|
-- incase of lag, reset stack |
||||
|
minetest.after(0.1, function() |
||||
|
player:set_wielded_item(holding) |
||||
|
|
||||
|
-- drop stack |
||||
|
local obj = minetest.add_item(player:getpos(), sta) |
||||
|
if obj then |
||||
|
obj:setvelocity({x = 0, y = 5, z = 0}) |
||||
|
end |
||||
|
end) |
||||
|
|
||||
|
end |
||||
|
end |
||||
|
|
||||
|
return true |
||||
|
end |
||||
|
|
||||
|
-- otherwise can dig or place |
||||
|
return protector.old_is_protected(pos, digger) |
||||
|
|
||||
|
end |
||||
|
|
||||
|
-- make sure protection block doesn't overlap another protector's area |
||||
|
function protector.check_overlap(itemstack, placer, pointed_thing) |
||||
|
|
||||
|
if pointed_thing.type ~= "node" then |
||||
|
return itemstack |
||||
|
end |
||||
|
|
||||
|
local pos = pointed_thing.above |
||||
|
|
||||
|
-- make sure protector doesn't overlap onto protected spawn area |
||||
|
if inside_spawn(pos, protector.spawn + protector.radius) then |
||||
|
|
||||
|
minetest.chat_send_player(placer:get_player_name(), |
||||
|
S("Spawn @1 has been protected up to a @2 block radius.", |
||||
|
minetest.pos_to_string(statspawn), protector.spawn)) |
||||
|
|
||||
|
return itemstack |
||||
|
end |
||||
|
|
||||
|
-- make sure protector doesn't overlap any other player's area |
||||
|
if not protector.can_dig(protector.radius * 2, pos, |
||||
|
placer:get_player_name(), true, 3) then |
||||
|
|
||||
|
minetest.chat_send_player(placer:get_player_name(), |
||||
|
S("Overlaps into above players protected area")) |
||||
|
|
||||
|
return itemstack |
||||
|
end |
||||
|
|
||||
|
return minetest.item_place(itemstack, placer, pointed_thing) |
||||
|
|
||||
|
end |
||||
|
|
||||
|
-- protection node |
||||
|
minetest.register_node("protector:protect", { |
||||
|
description = S("Protection Block"), |
||||
|
drawtype = "nodebox", |
||||
|
tiles = { |
||||
|
"moreblocks_circle_stone_bricks.png", |
||||
|
"moreblocks_circle_stone_bricks.png", |
||||
|
"moreblocks_circle_stone_bricks.png^protector_logo.png" |
||||
|
}, |
||||
|
sounds = default.node_sound_stone_defaults(), |
||||
|
groups = {dig_immediate = 2, unbreakable = 1}, |
||||
|
is_ground_content = false, |
||||
|
paramtype = "light", |
||||
|
light_source = 4, |
||||
|
|
||||
|
node_box = { |
||||
|
type = "fixed", |
||||
|
fixed = { |
||||
|
{-0.5 ,-0.5, -0.5, 0.5, 0.5, 0.5}, |
||||
|
} |
||||
|
}, |
||||
|
|
||||
|
on_place = protector.check_overlap, |
||||
|
|
||||
|
after_place_node = function(pos, placer) |
||||
|
|
||||
|
local meta = minetest.get_meta(pos) |
||||
|
|
||||
|
meta:set_string("owner", placer:get_player_name() or "") |
||||
|
meta:set_string("infotext", S("Protection (owned by @1)", meta:get_string("owner"))) |
||||
|
meta:set_string("members", "") |
||||
|
end, |
||||
|
|
||||
|
on_use = function(itemstack, user, pointed_thing) |
||||
|
|
||||
|
if pointed_thing.type ~= "node" then |
||||
|
return |
||||
|
end |
||||
|
|
||||
|
protector.can_dig(protector.radius, pointed_thing.under, user:get_player_name(), false, 2) |
||||
|
end, |
||||
|
|
||||
|
on_rightclick = function(pos, node, clicker, itemstack) |
||||
|
|
||||
|
local meta = minetest.get_meta(pos) |
||||
|
|
||||
|
if meta |
||||
|
and protector.can_dig(1, pos,clicker:get_player_name(), true, 1) then |
||||
|
minetest.show_formspec(clicker:get_player_name(), |
||||
|
"protector:node_" .. minetest.pos_to_string(pos), protector.generate_formspec(meta)) |
||||
|
end |
||||
|
end, |
||||
|
|
||||
|
on_punch = function(pos, node, puncher) |
||||
|
|
||||
|
if minetest.is_protected(pos, puncher:get_player_name()) then |
||||
|
return |
||||
|
end |
||||
|
|
||||
|
minetest.add_entity(pos, "protector:display") |
||||
|
end, |
||||
|
|
||||
|
can_dig = function(pos, player) |
||||
|
|
||||
|
return player and protector.can_dig(1, pos, player:get_player_name(), true, 1) or false |
||||
|
end, |
||||
|
|
||||
|
on_blast = function() end, |
||||
|
}) |
||||
|
|
||||
|
minetest.register_craft({ |
||||
|
output = "protector:protect", |
||||
|
recipe = { |
||||
|
{"default:stone", "default:stone", "default:stone"}, |
||||
|
{"default:stone", "default:steel_ingot", "default:stone"}, |
||||
|
{"default:stone", "default:stone", "default:stone"}, |
||||
|
} |
||||
|
}) |
||||
|
|
||||
|
-- protection logo |
||||
|
minetest.register_node("protector:protect2", { |
||||
|
description = S("Protection Logo"), |
||||
|
tiles = {"protector_logo.png"}, |
||||
|
wield_image = "protector_logo.png", |
||||
|
inventory_image = "protector_logo.png", |
||||
|
sounds = default.node_sound_stone_defaults(), |
||||
|
groups = {dig_immediate = 2, unbreakable = 1}, |
||||
|
paramtype = 'light', |
||||
|
paramtype2 = "wallmounted", |
||||
|
legacy_wallmounted = true, |
||||
|
light_source = 4, |
||||
|
drawtype = "nodebox", |
||||
|
sunlight_propagates = true, |
||||
|
walkable = true, |
||||
|
node_box = { |
||||
|
type = "wallmounted", |
||||
|
wall_top = {-0.375, 0.4375, -0.5, 0.375, 0.5, 0.5}, |
||||
|
wall_bottom = {-0.375, -0.5, -0.5, 0.375, -0.4375, 0.5}, |
||||
|
wall_side = {-0.5, -0.5, -0.375, -0.4375, 0.5, 0.375}, |
||||
|
}, |
||||
|
selection_box = {type = "wallmounted"}, |
||||
|
|
||||
|
on_place = protector.check_overlap, |
||||
|
|
||||
|
after_place_node = function(pos, placer) |
||||
|
|
||||
|
local meta = minetest.get_meta(pos) |
||||
|
|
||||
|
meta:set_string("owner", placer:get_player_name() or "") |
||||
|
meta:set_string("infotext", S("Protection (owned by @1)", meta:get_string("owner"))) |
||||
|
meta:set_string("members", "") |
||||
|
end, |
||||
|
|
||||
|
on_use = function(itemstack, user, pointed_thing) |
||||
|
|
||||
|
if pointed_thing.type ~= "node" then |
||||
|
return |
||||
|
end |
||||
|
|
||||
|
protector.can_dig(protector.radius, pointed_thing.under, user:get_player_name(), false, 2) |
||||
|
end, |
||||
|
|
||||
|
on_rightclick = function(pos, node, clicker, itemstack) |
||||
|
|
||||
|
local meta = minetest.get_meta(pos) |
||||
|
|
||||
|
if protector.can_dig(1, pos, clicker:get_player_name(), true, 1) then |
||||
|
|
||||
|
minetest.show_formspec(clicker:get_player_name(), |
||||
|
"protector:node_" .. minetest.pos_to_string(pos), protector.generate_formspec(meta)) |
||||
|
end |
||||
|
end, |
||||
|
|
||||
|
on_punch = function(pos, node, puncher) |
||||
|
|
||||
|
if minetest.is_protected(pos, puncher:get_player_name()) then |
||||
|
return |
||||
|
end |
||||
|
|
||||
|
minetest.add_entity(pos, "protector:display") |
||||
|
end, |
||||
|
|
||||
|
can_dig = function(pos, player) |
||||
|
|
||||
|
return protector.can_dig(1, pos, player:get_player_name(), true, 1) |
||||
|
end, |
||||
|
|
||||
|
on_blast = function() end, |
||||
|
}) |
||||
|
|
||||
|
minetest.register_craft({ |
||||
|
output = "protector:protect2", |
||||
|
recipe = { |
||||
|
{"default:stone", "default:stone", "default:stone"}, |
||||
|
{"default:stone", "default:copper_ingot", "default:stone"}, |
||||
|
{"default:stone", "default:stone", "default:stone"}, |
||||
|
} |
||||
|
}) |
||||
|
|
||||
|
-- check formspec buttons or when name entered |
||||
|
minetest.register_on_player_receive_fields(function(player, formname, fields) |
||||
|
|
||||
|
-- protector formspec found |
||||
|
if string.sub(formname, 0, string.len("protector:node_")) == "protector:node_" then |
||||
|
|
||||
|
local pos_s = string.sub(formname, string.len("protector:node_") + 1) |
||||
|
local pos = minetest.string_to_pos(pos_s) |
||||
|
local meta = minetest.get_meta(pos) |
||||
|
|
||||
|
-- only owner can add names |
||||
|
if not protector.can_dig(1, pos, player:get_player_name(), true, 1) then |
||||
|
return |
||||
|
end |
||||
|
|
||||
|
-- add member [+] |
||||
|
if fields.protector_add_member then |
||||
|
|
||||
|
for _, i in pairs(fields.protector_add_member:split(" ")) do |
||||
|
protector.add_member(meta, i) |
||||
|
end |
||||
|
end |
||||
|
|
||||
|
-- remove member [x] |
||||
|
for field, value in pairs(fields) do |
||||
|
|
||||
|
if string.sub(field, 0, |
||||
|
string.len("protector_del_member_")) == "protector_del_member_" then |
||||
|
|
||||
|
protector.del_member(meta, |
||||
|
string.sub(field,string.len("protector_del_member_") + 1)) |
||||
|
end |
||||
|
end |
||||
|
|
||||
|
-- reset formspec until close button pressed |
||||
|
if not fields.close_me then |
||||
|
minetest.show_formspec(player:get_player_name(), formname, protector.generate_formspec(meta)) |
||||
|
end |
||||
|
end |
||||
|
end) |
||||
|
|
||||
|
-- display entity shown when protector node is punched |
||||
|
minetest.register_entity("protector:display", { |
||||
|
physical = false, |
||||
|
collisionbox = {0, 0, 0, 0, 0, 0}, |
||||
|
visual = "wielditem", |
||||
|
-- wielditem seems to be scaled to 1.5 times original node size |
||||
|
visual_size = {x = 1.0 / 1.5, y = 1.0 / 1.5}, |
||||
|
textures = {"protector:display_node"}, |
||||
|
timer = 0, |
||||
|
|
||||
|
on_step = function(self, dtime) |
||||
|
|
||||
|
self.timer = self.timer + dtime |
||||
|
|
||||
|
-- remove after 5 seconds |
||||
|
if self.timer > 5 then |
||||
|
self.object:remove() |
||||
|
end |
||||
|
end, |
||||
|
}) |
||||
|
|
||||
|
-- Display-zone node, Do NOT place the display as a node, |
||||
|
-- it is made to be used as an entity (see above) |
||||
|
|
||||
|
local x = protector.radius |
||||
|
minetest.register_node("protector:display_node", { |
||||
|
tiles = {"protector_display.png"}, |
||||
|
use_texture_alpha = true, |
||||
|
walkable = false, |
||||
|
drawtype = "nodebox", |
||||
|
node_box = { |
||||
|
type = "fixed", |
||||
|
fixed = { |
||||
|
-- sides |
||||
|
{-(x+.55), -(x+.55), -(x+.55), -(x+.45), (x+.55), (x+.55)}, |
||||
|
{-(x+.55), -(x+.55), (x+.45), (x+.55), (x+.55), (x+.55)}, |
||||
|
{(x+.45), -(x+.55), -(x+.55), (x+.55), (x+.55), (x+.55)}, |
||||
|
{-(x+.55), -(x+.55), -(x+.55), (x+.55), (x+.55), -(x+.45)}, |
||||
|
-- top |
||||
|
{-(x+.55), (x+.45), -(x+.55), (x+.55), (x+.55), (x+.55)}, |
||||
|
-- bottom |
||||
|
{-(x+.55), -(x+.55), -(x+.55), (x+.55), -(x+.45), (x+.55)}, |
||||
|
-- middle (surround protector) |
||||
|
{-.55,-.55,-.55, .55,.55,.55}, |
||||
|
}, |
||||
|
}, |
||||
|
selection_box = { |
||||
|
type = "regular", |
||||
|
}, |
||||
|
paramtype = "light", |
||||
|
groups = {dig_immediate = 3, not_in_creative_inventory = 1}, |
||||
|
drop = "", |
||||
|
}) |
||||
|
|
||||
|
local path = minetest.get_modpath("protector") |
||||
|
|
||||
|
dofile(path .. "/doors_chest.lua") |
||||
|
dofile(path .. "/pvp.lua") |
||||
|
dofile(path .. "/admin.lua") |
||||
|
dofile(path .. "/tool.lua") |
||||
|
dofile(path .. "/lucky_block.lua") |
||||
|
|
||||
|
print (S("[MOD] Protector Redo loaded")) |
Loading…
Reference in new issue