update .conf, add cozy and protector mods

master
elite 2017-07-02 21:08:16 -04:00
parent 3c9951ba9c
commit 50a7ac004a
41 changed files with 2008 additions and 1 deletions

View File

@ -28,7 +28,9 @@ mysql_auth.cfgfile = /home/minetestservers/.minetest/worlds/UGXmr/mysql_auth.cfg
#
#################Game##################
#
share_bones_time = 900
share_bones_time = 1200
#If player dies in protected area... (0=disabled)
share_bones_time_early = 0
default_privs = interact, home, shout, spawn, fast
enable_floating_dungeons = false
give_initial_stuff = true
@ -36,6 +38,7 @@ disable_fire = true
playereffects_autosave = 60
enable_sprinting = true
static_spawnpoint = -2770,25,2327
enable_tnt = false
#
#################IRC################
#

3
worldmods/cozy/README Normal file
View File

@ -0,0 +1,3 @@
Description: Adds commands to /lay or /sit.
License: WTFPL
Depends: default

View File

@ -0,0 +1 @@
default

View File

@ -0,0 +1 @@
Sit and lay using chat commands

53
worldmods/cozy/init.lua Normal file
View File

@ -0,0 +1,53 @@
minetest.register_globalstep(function(dtime)
local players = minetest.get_connected_players()
for i=1, #players do
local name = players[i]:get_player_name()
if default.player_attached[name] and not players[i]:get_attach() and
(players[i]:get_player_control().up == true or
players[i]:get_player_control().down == true or
players[i]:get_player_control().left == true or
players[i]:get_player_control().right == true or
players[i]:get_player_control().jump == true) then
players[i]:set_eye_offset({x=0, y=0, z=0}, {x=0, y=0, z=0})
players[i]:set_physics_override(1, 1, 1)
default.player_attached[name] = false
default.player_set_animation(players[i], "stand", 30)
end
end
end)
minetest.register_chatcommand("sit", {
description = "Sit down",
func = function(name)
local player = minetest.get_player_by_name(name)
if default.player_attached[name] then
player:set_eye_offset({x=0, y=0, z=0}, {x=0, y=0, z=0})
player:set_physics_override(1, 1, 1)
default.player_attached[name] = false
default.player_set_animation(player, "stand", 30)
else
player:set_eye_offset({x=0, y=-7, z=2}, {x=0, y=0, z=0})
player:set_physics_override(0, 0, 0)
default.player_attached[name] = true
default.player_set_animation(player, "sit", 30)
end
end
})
minetest.register_chatcommand("lay", {
description = "Lay down",
func = function(name)
local player = minetest.get_player_by_name(name)
if default.player_attached[name] then
player:set_eye_offset({x=0, y=0, z=0}, {x=0, y=0, z=0})
player:set_physics_override(1, 1, 1)
default.player_attached[name] = false
default.player_set_animation(player, "stand", 30)
else
player:set_eye_offset({x=0, y=-13, z=0}, {x=0, y=0, z=0})
player:set_physics_override(0, 0, 0)
default.player_attached[name] = true
default.player_set_animation(player, "lay", 0)
end
end
})

View File

@ -0,0 +1,108 @@
Protector Redo mod [protect]
Protector redo for minetest is a mod that protects a players builds by placing
a block that stops other players from digging or placing blocks in that area.
based on glomie's mod, remade by Zeg9 and rewritten by TenPlus1.
https://forum.minetest.net/viewtopic.php?f=11&t=9376
Change log:
0.1 - Initial release
0.2 - Texture update
0.3 - Added Protection Logo to blend in with player builds
0.4 - Code tweak for 0.4.10+
0.5 - Added protector.radius variable in init.lua (default: 5)
0.6 - Added Protected Doors (wood and steel) and Protected Chest
0.7 - Protected Chests now have "To Chest" and "To Inventory" buttons to copy
contents across, also chests can be named
0.8 - Updated to work with Minetest 0.4.12, simplified textures
0.9 - Tweaked code
1.0 - Only owner can remove protector
1.1 - Set 'protector_pvp = true' in minetest.conf to disable pvp in protected
areas except your own, also setting protector_pvp_spawn higher than 0 will
disable pvp around spawn area with the radius you entered
1.2 - Shift and click support added with Minetest 0.4.13 to quickly copy stacks
to and from protected chest
1.3 - Moved protector on_place into node itself, protector zone display changed
from 10 to 5 seconds, general code tidy
1.4 - Changed protector recipes to give single item instead of 4, added + button
to interface, tweaked and tidied code, added admin command /delprot to remove
protectors in bulk from banned/old players
1.5 - Added much requested protected trapdoor
1.6 - Added protector_drop (true or false) and protector_hurt (hurt by this num)
variables to minetest.conf settings to stop players breaking protected
areas by dropping tools and hurting player.
1.7 - Included an edited version of WTFPL doors mod since protected doors didn't
work with the doors mod in the latest daily build... Now it's fine :)
added support for "protection_bypass" privelage.
1.8 - Added 'protector_flip' setting to stop players using lag to grief into
another players house, it flips them around to stop them digging.
1.9 - Renamed 'protector_pvp_spawn' setting to 'protector_spawn' which protects
an area around static spawnpoint and disables pvp if active.
(note: previous name can still be used)
2.0 - Added protector placement tool (thanks to Shara) so that players can easily
stand on a protector, face in a direction and it places a new one at a set
distance to cover protection radius. Added /protector_show command (thanks agaran)
Protectors and chest cannot be moved by mesecon pistons or machines.
2.1 - Added 'protector_night_pvp' setting so night-time becomes a free for all and
players can hurt one another even inside protected areas (not spawn protected)
Lucky Blocks: 6
Usage: (requires server privelage)
list names to remove
/protector_remove
remove specific user names
/protector_remove name1 name2
remove all names from list
/protector_remove -
Whenever a player is near any protectors with name1 or name2 then it will be
replaced by an air block.
show owner name to replace
/protector_replace
replace owner with new name
/protector_replace owner new_owner
reset name list
/protector_replace -
show protected areas of your nearby protectors (max of 5)
/protector_show
The following lines can be added to your minetest.conf file to configure specific features of the mod:
protector_radius = 5
- Sets the area around each protection node so that other players cannot dig, place or enter through protected doors or chests.
protector_pvp = true
- true or false this setting disabled pvp inside of protected areas for all players apart from those listed on the protector node.
protector_night_pvp = false
- when true this setting enables pvp at night time only, even inside protected areas, requires protector_pvp to be active to work.
protector_spawn = 10
- Sets an area 10 nodes around static spawnpoint that is protected.
protector_hurt = 2
- When set to above 0, players digging in protected areas will be hurt by 2 health points (or whichever number it's set to)
protector_flip = true
- When true players who dig inside a protected area will flipped around to stop them using lag to grief into someone else's build

View File

@ -0,0 +1,146 @@
local S = protector.intllib
protector.removal_names = ""
protector.replace_names = ""
minetest.register_chatcommand("protector_remove", {
params = "<names list>",
description = S("Remove Protectors around players (separate names with spaces)"),
privs = {server = true},
func = function(name, param)
if not param or param == "" then
minetest.chat_send_player(name,
"Protector Names to remove: "
.. protector.removal_names)
return
end
if param == "-" then
minetest.chat_send_player(name,
S("Name List Reset"))
protector.removal_names = ""
return
end
protector.removal_names = param
end,
})
minetest.register_chatcommand("protector_replace", {
params = "<owner name> <name to replace with>",
description = S("Replace Protector Owner with name provided"),
privs = {server = true},
func = function(name, param)
-- reset list to empty
if param == "-" then
minetest.chat_send_player(name, S("Name List Reset"))
protector.replace_names = ""
return
end
-- show name info
if param == ""
and protector.replace_names ~= "" then
local names = protector.replace_names:split(" ")
minetest.chat_send_player(name,
"Replacing Protector name '" .. (names[1] or "")
.. "' with '" .. (names[2] or "").. "'")
return
end
protector.replace_names = param
end,
})
minetest.register_abm({
nodenames = {"protector:protect", "protector:protect2"},
interval = 8,
chance = 1,
catch_up = false,
action = function(pos, node)
if protector.removal_names == ""
and protector.replace_names == "" then
return
end
local meta = minetest.get_meta(pos) ; if not meta then return end
local owner = meta:get_string("owner")
--local members = meta:get_string("members")
if protector.removal_names ~= "" then
local names = protector.removal_names:split(" ")
for _, n in pairs(names) do
if n == owner then
minetest.set_node(pos, {name = "air"})
end
end
end
if protector.replace_names ~= "" then
local names = protector.replace_names:split(" ")
if names[1] and names[2] and owner == names[1] then
meta:set_string("owner", names[2])
meta:set_string("infotext", "Protection (owned by " .. names[2] .. ")")
end
end
end
})
-- show protection areas of nearby protectors owned by you (thanks agaran)
minetest.register_chatcommand("protector_show", {
params = "",
description = "Show protected areas of your nearby protectors",
privs = {},
func = function(name, param)
local player = minetest.get_player_by_name(name)
local pos = player:getpos()
local r = protector.radius -- max protector range.
-- 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
-- show a maximum of 5 protected areas only
for n = 1, math.min(#pos, 5) do
meta = minetest.get_meta(pos[n])
owner = meta:get_string("owner") or ""
if owner == name then
minetest.add_entity(pos[n], "protector:display")
end
end
end
})

View File

@ -0,0 +1,4 @@
default
intllib?
lucky_block?
mesecons_mvps?

View File

@ -0,0 +1 @@
Lets players craft special blocks to protect their builds or disable PVP in areas.

View File

@ -0,0 +1,688 @@
-- Since the doors mod has changed in the latest daily builds I have taken the
-- WTFPL licenced code from the old doors mod and included an edited version
-- within this mod for local use.
local S = protector.intllib
-- Registers a door
function register_door(name, def)
def.groups.not_in_creative_inventory = 1
local box = {{-0.5, -0.5, -0.5, 0.5, 0.5, -0.5+1.5/16}}
def.node_box_bottom = box
def.node_box_top = box
def.selection_box_bottom = box
def.selection_box_top = box
def.sound_close_door = "doors_door_close"
def.sound_open_door = "doors_door_open"
minetest.register_craftitem(name, {
description = def.description,
inventory_image = def.inventory_image,
on_place = function(itemstack, placer, pointed_thing)
if not pointed_thing.type == "node" then
return itemstack
end
local ptu = pointed_thing.under
local nu = minetest.get_node(ptu)
if minetest.registered_nodes[nu.name]
and minetest.registered_nodes[nu.name].on_rightclick then
return minetest.registered_nodes[nu.name].on_rightclick(ptu, nu, placer, itemstack)
end
local pt = pointed_thing.above
local pt2 = {x=pt.x, y=pt.y, z=pt.z}
pt2.y = pt2.y+1
if
not minetest.registered_nodes[minetest.get_node(pt).name].buildable_to or
not minetest.registered_nodes[minetest.get_node(pt2).name].buildable_to or
not placer or
not placer:is_player()
then
return itemstack
end
if minetest.is_protected(pt, placer:get_player_name()) or
minetest.is_protected(pt2, placer:get_player_name()) then
minetest.record_protection_violation(pt, placer:get_player_name())
return itemstack
end
local p2 = minetest.dir_to_facedir(placer:get_look_dir())
local pt3 = {x=pt.x, y=pt.y, z=pt.z}
if p2 == 0 then
pt3.x = pt3.x-1
elseif p2 == 1 then
pt3.z = pt3.z+1
elseif p2 == 2 then
pt3.x = pt3.x+1
elseif p2 == 3 then
pt3.z = pt3.z-1
end
if minetest.get_item_group(minetest.get_node(pt3).name, "door") == 0 then
minetest.set_node(pt, {name=name.."_b_1", param2=p2})
minetest.set_node(pt2, {name=name.."_t_1", param2=p2})
else
minetest.set_node(pt, {name=name.."_b_2", param2=p2})
minetest.set_node(pt2, {name=name.."_t_2", param2=p2})
minetest.get_meta(pt):set_int("right", 1)
minetest.get_meta(pt2):set_int("right", 1)
end
if not minetest.setting_getbool("creative_mode") then
itemstack:take_item()
end
return itemstack
end,
})
local tt = def.tiles_top
local tb = def.tiles_bottom
local function after_dig_node(pos, name, digger)
local node = minetest.get_node(pos)
if node.name == name then
minetest.node_dig(pos, node, digger)
end
end
local function on_rightclick(pos, dir, check_name, replace, replace_dir, params)
pos.y = pos.y+dir
if minetest.get_node(pos).name ~= check_name then
return
end
local p2 = minetest.get_node(pos).param2
p2 = params[p2+1]
minetest.swap_node(pos, {name=replace_dir, param2=p2})
pos.y = pos.y-dir
minetest.swap_node(pos, {name=replace, param2=p2})
local snd_1 = def.sound_close_door
local snd_2 = def.sound_open_door
if params[1] == 3 then
snd_1 = def.sound_open_door
snd_2 = def.sound_close_door
end
if minetest.get_meta(pos):get_int("right") ~= 0 then
minetest.sound_play(snd_1, {pos = pos, gain = 0.3, max_hear_distance = 10})
else
minetest.sound_play(snd_2, {pos = pos, gain = 0.3, max_hear_distance = 10})
end
end
local function on_rotate(pos, node, dir, user, check_name, mode, new_param2)
if mode ~= screwdriver.ROTATE_FACE then
return false
end
pos.y = pos.y + dir
if not minetest.get_node(pos).name == check_name then
return false
end
if minetest.is_protected(pos, user:get_player_name()) then
minetest.record_protection_violation(pos, user:get_player_name())
return false
end
local node2 = minetest.get_node(pos)
node2.param2 = (node2.param2 + 1) % 4
minetest.swap_node(pos, node2)
pos.y = pos.y - dir
node.param2 = (node.param2 + 1) % 4
minetest.swap_node(pos, node)
return true
end
minetest.register_node(name.."_b_1", {
tiles = {tb[2], tb[2], tb[2], tb[2], tb[1], tb[1].."^[transformfx"},
paramtype = "light",
paramtype2 = "facedir",
is_ground_content = false,
drop = name,
drawtype = "nodebox",
node_box = {
type = "fixed",
fixed = def.node_box_bottom
},
selection_box = {
type = "fixed",
fixed = def.selection_box_bottom
},
groups = def.groups,
after_dig_node = function(pos, oldnode, oldmetadata, digger)
pos.y = pos.y+1
after_dig_node(pos, name.."_t_1", digger)
end,
on_rightclick = function(pos, node, clicker)
if not minetest.is_protected(pos, clicker:get_player_name()) then
on_rightclick(pos, 1, name.."_t_1", name.."_b_2", name.."_t_2", {1,2,3,0})
end
end,
on_rotate = function(pos, node, user, mode, new_param2)
return on_rotate(pos, node, 1, user, name.."_t_1", mode)
end,
sounds = def.sounds,
sunlight_propagates = def.sunlight,
on_blast = function() end,
})
minetest.register_node(name.."_t_1", {
tiles = {tt[2], tt[2], tt[2], tt[2], tt[1], tt[1].."^[transformfx"},
paramtype = "light",
paramtype2 = "facedir",
is_ground_content = false,
drop = "",
drawtype = "nodebox",
node_box = {
type = "fixed",
fixed = def.node_box_top
},
selection_box = {
type = "fixed",
fixed = def.selection_box_top
},
groups = def.groups,
after_dig_node = function(pos, oldnode, oldmetadata, digger)
pos.y = pos.y-1
after_dig_node(pos, name.."_b_1", digger)
end,
on_rightclick = function(pos, node, clicker)
if not minetest.is_protected(pos, clicker:get_player_name()) then
on_rightclick(pos, -1, name.."_b_1", name.."_t_2", name.."_b_2", {1,2,3,0})
end
end,
on_rotate = function(pos, node, user, mode, new_param2)
return on_rotate(pos, node, -1, user, name.."_b_1", mode)
end,
sounds = def.sounds,
sunlight_propagates = def.sunlight,
on_blast = function() end,
})
minetest.register_node(name.."_b_2", {
tiles = {tb[2], tb[2], tb[2], tb[2], tb[1].."^[transformfx", tb[1]},
paramtype = "light",
paramtype2 = "facedir",
is_ground_content = false,
drop = name,
drawtype = "nodebox",
node_box = {
type = "fixed",
fixed = def.node_box_bottom
},
selection_box = {
type = "fixed",
fixed = def.selection_box_bottom
},
groups = def.groups,
after_dig_node = function(pos, oldnode, oldmetadata, digger)
pos.y = pos.y+1
after_dig_node(pos, name.."_t_2", digger)
end,
on_rightclick = function(pos, node, clicker)
if not minetest.is_protected(pos, clicker:get_player_name()) then
on_rightclick(pos, 1, name.."_t_2", name.."_b_1", name.."_t_1", {3,0,1,2})
end
end,
on_rotate = function(pos, node, user, mode, new_param2)
return on_rotate(pos, node, 1, user, name.."_t_2", mode)
end,
sounds = def.sounds,
sunlight_propagates = def.sunlight,
on_blast = function() end,
})
minetest.register_node(name.."_t_2", {
tiles = {tt[2], tt[2], tt[2], tt[2], tt[1].."^[transformfx", tt[1]},
paramtype = "light",
paramtype2 = "facedir",
is_ground_content = false,
drop = "",
drawtype = "nodebox",
node_box = {
type = "fixed",
fixed = def.node_box_top
},
selection_box = {
type = "fixed",
fixed = def.selection_box_top
},
groups = def.groups,
after_dig_node = function(pos, oldnode, oldmetadata, digger)
pos.y = pos.y-1
after_dig_node(pos, name.."_b_2", digger)
end,
on_rightclick = function(pos, node, clicker)
if not minetest.is_protected(pos, clicker:get_player_name()) then
on_rightclick(pos, -1, name.."_b_2", name.."_t_1", name.."_b_1", {3,0,1,2})
end
end,
on_rotate = function(pos, node, user, mode, new_param2)
return on_rotate(pos, node, -1, user, name.."_b_2", mode)
end,
sounds = def.sounds,
sunlight_propagates = def.sunlight,
on_blast = function() end,
})
end
-- Protected Wooden Door
local name = "protector:door_wood"
register_door(name, {
description = S("Protected Wooden Door"),
inventory_image = "doors_wood.png^protector_logo.png",
groups = {
snappy = 1, choppy = 2, oddly_breakable_by_hand = 2,
unbreakable = 1, --door = 1
},
tiles_bottom = {"doors_wood_b.png^protector_logo.png", "doors_brown.png"},
tiles_top = {"doors_wood_a.png", "doors_brown.png"},
sounds = default.node_sound_wood_defaults(),
sunlight = false,
})
minetest.register_craft({
output = name,
recipe = {
{"group:wood", "group:wood"},
{"group:wood", "default:copper_ingot"},
{"group:wood", "group:wood"}
}
})
minetest.register_craft({
output = name,
recipe = {
{"doors:door_wood", "default:copper_ingot"}
}
})
-- Protected Steel Door
local name = "protector:door_steel"
register_door(name, {
description = S("Protected Steel Door"),
inventory_image = "doors_steel.png^protector_logo.png",
groups = {
snappy = 1, bendy = 2, cracky = 1,
level = 2, unbreakable = 1, -- door = 1
},
tiles_bottom = {"doors_steel_b.png^protector_logo.png", "doors_grey.png"},
tiles_top = {"doors_steel_a.png", "doors_grey.png"},
sounds = default.node_sound_wood_defaults(),
sunlight = false,
})
minetest.register_craft({
output = name,
recipe = {
{"default:steel_ingot", "default:steel_ingot"},
{"default:steel_ingot", "default:copper_ingot"},
{"default:steel_ingot", "default:steel_ingot"}
}
})
minetest.register_craft({
output = name,
recipe = {
{"doors:door_steel", "default:copper_ingot"}
}
})
----trapdoor----
function register_trapdoor(name, def)
local name_closed = name
local name_opened = name.."_open"
def.on_rightclick = function (pos, node, clicker, itemstack, pointed_thing)
if minetest.is_protected(pos, clicker:get_player_name()) then
return
end
local newname = node.name == name_closed and name_opened or name_closed
local sound = false
if node.name == name_closed then sound = "doors_door_open" end
if node.name == name_opened then sound = "doors_door_close" end
if sound then
minetest.sound_play(sound, {pos = pos, gain = 0.3, max_hear_distance = 10})
end
minetest.swap_node(pos, {name = newname, param1 = node.param1, param2 = node.param2})
end
-- Common trapdoor configuration
def.drawtype = "nodebox"
def.paramtype = "light"
def.paramtype2 = "facedir"
def.is_ground_content = false
local def_opened = table.copy(def)
local def_closed = table.copy(def)
def_closed.node_box = {
type = "fixed",
fixed = {-0.5, -0.5, -0.5, 0.5, -6/16, 0.5}
}
def_closed.selection_box = {
type = "fixed",
fixed = {-0.5, -0.5, -0.5, 0.5, -6/16, 0.5}
}
def_closed.tiles = { def.tile_front, def.tile_front, def.tile_side, def.tile_side,
def.tile_side, def.tile_side }
def_opened.node_box = {
type = "fixed",
fixed = {-0.5, -0.5, 6/16, 0.5, 0.5, 0.5}
}
def_opened.selection_box = {
type = "fixed",
fixed = {-0.5, -0.5, 6/16, 0.5, 0.5, 0.5}
}
def_opened.tiles = { def.tile_side, def.tile_side,
def.tile_side .. '^[transform3',
def.tile_side .. '^[transform1',
def.tile_front, def.tile_front }
def_opened.drop = name_closed
def_opened.groups.not_in_creative_inventory = 1
minetest.register_node(name_opened, def_opened)
minetest.register_node(name_closed, def_closed)
end
-- Protected Wooden Trapdoor
register_trapdoor("protector:trapdoor", {
description = S("Protected Trapdoor"),
inventory_image = "doors_trapdoor.png^protector_logo.png",
wield_image = "doors_trapdoor.png^protector_logo.png",
tile_front = "doors_trapdoor.png^protector_logo.png",
tile_side = "doors_trapdoor_side.png",
groups = {
snappy = 1, choppy = 2, oddly_breakable_by_hand = 2,
unbreakable = 1, --door = 1
},
sounds = default.node_sound_wood_defaults(),
})
minetest.register_craft({
output = 'protector:trapdoor 2',
recipe = {
{'group:wood', 'default:copper_ingot', 'group:wood'},
{'group:wood', 'group:wood', 'group:wood'},
{'', '', ''},
}
})
minetest.register_craft({
output = "protector:trapdoor",
recipe = {
{"doors:trapdoor", "default:copper_ingot"}
}
})
-- Protected Steel Trapdoor
register_trapdoor("protector:trapdoor_steel", {
description = S("Protected Steel Trapdoor"),
inventory_image = "doors_trapdoor_steel.png^protector_logo.png",
wield_image = "doors_trapdoor_steel.png^protector_logo.png",
tile_front = "doors_trapdoor_steel.png^protector_logo.png",
tile_side = "doors_trapdoor_steel_side.png",
groups = {
snappy = 1, bendy = 2, cracky = 1, melty = 2, level = 2,
unbreakable = 1, --door = 1
},
sounds = default.node_sound_wood_defaults(),
})
minetest.register_craft({
output = 'protector:trapdoor_steel',
recipe = {
{'default:copper_ingot', 'default:steel_ingot'},
{'default:steel_ingot', 'default:steel_ingot'},
}
})
minetest.register_craft({
output = "protector:trapdoor_steel",
recipe = {
{"doors:trapdoor_steel", "default:copper_ingot"}
}
})
-- Protected Chest
minetest.register_node("protector:chest", {
description = S("Protected Chest"),
tiles = {
"default_chest_top.png", "default_chest_top.png",
"default_chest_side.png", "default_chest_side.png",
"default_chest_side.png", "default_chest_front.png^protector_logo.png"
},
paramtype2 = "facedir",
groups = {choppy = 2, oddly_breakable_by_hand = 2, unbreakable = 1},
legacy_facedir_simple = true,
is_ground_content = false,
sounds = default.node_sound_wood_defaults(),
on_construct = function(pos)
local meta = minetest.get_meta(pos)
local inv = meta:get_inventory()
meta:set_string("infotext", S("Protected Chest"))
meta:set_string("name", "")
inv:set_size("main", 8 * 4)
end,
can_dig = function(pos,player)
local meta = minetest.get_meta(pos)
local inv = meta:get_inventory()
if inv:is_empty("main") then
if not minetest.is_protected(pos, player:get_player_name()) then
return true
end
end
end,
on_metadata_inventory_put = function(pos, listname, index, stack, player)
minetest.log("action", S("@1 moves stuff to protected chest at @2",
player:get_player_name(), minetest.pos_to_string(pos)))
end,
on_metadata_inventory_take = function(pos, listname, index, stack, player)
minetest.log("action", S("@1 takes stuff from protected chest at @2",
player:get_player_name(), minetest.pos_to_string(pos)))
end,
on_metadata_inventory_move = function(pos, from_list, from_index, to_list, to_index, count, player)
minetest.log("action", S("@1 moves stuff inside protected chest at @2",
player:get_player_name(), minetest.pos_to_string(pos)))
end,
allow_metadata_inventory_put = function(pos, listname, index, stack, player)
if minetest.is_protected(pos, player:get_player_name()) then
return 0
end
return stack:get_count()
end,
allow_metadata_inventory_take = function(pos, listname, index, stack, player)
if minetest.is_protected(pos, player:get_player_name()) then
return 0
end
return stack:get_count()
end,
allow_metadata_inventory_move = function(pos, from_list, from_index, to_list, to_index, count, player)
if minetest.is_protected(pos, player:get_player_name()) then
return 0
end
return count
end,
on_rightclick = function(pos, node, clicker)
if minetest.is_protected(pos, clicker:get_player_name()) then
return
end
local meta = minetest.get_meta(pos)
if not meta then
return
end
local spos = pos.x .. "," .. pos.y .. "," ..pos.z
local formspec = "size[8,9]"
.. default.gui_bg
.. default.gui_bg_img
.. default.gui_slots
.. "list[nodemeta:".. spos .. ";main;0,0.3;8,4;]"
.. "button[0,4.5;2,0.25;toup;" .. S("To Chest") .. "]"
.. "field[2.3,4.8;4,0.25;chestname;;"
.. meta:get_string("name") .. "]"
.. "button[6,4.5;2,0.25;todn;" .. S("To Inventory") .. "]"
.. "list[current_player;main;0,5;8,1;]"
.. "list[current_player;main;0,6.08;8,3;8]"
.. "listring[nodemeta:" .. spos .. ";main]"
.. "listring[current_player;main]"
minetest.show_formspec(
clicker:get_player_name(),
"protector:chest_" .. minetest.pos_to_string(pos),
formspec)
end,
on_blast = function() end,
})
-- Protected Chest formspec buttons
minetest.register_on_player_receive_fields(function(player, formname, fields)
if string.sub(formname, 0, string.len("protector:chest_")) ~= "protector:chest_" then
return
end
local pos_s = string.sub(formname,string.len("protector:chest_") + 1)
local pos = minetest.string_to_pos(pos_s)
if minetest.is_protected(pos, player:get_player_name()) then
return
end
local meta = minetest.get_meta(pos) ; if not meta then return end
local chest_inv = meta:get_inventory() ; if not chest_inv then return end
local player_inv = player:get_inventory()
local leftover
if fields.toup then
-- copy contents of players inventory to chest
for i, v in ipairs(player_inv:get_list("main") or {}) do
if chest_inv:room_for_item("main", v) then
leftover = chest_inv:add_item("main", v)
player_inv:remove_item("main", v)
if leftover
and not leftover:is_empty() then
player_inv:add_item("main", v)
end
end
end
elseif fields.todn then
-- copy contents of chest to players inventory
for i, v in ipairs(chest_inv:get_list("main") or {}) do
if player_inv:room_for_item("main", v) then
leftover = player_inv:add_item("main", v)
chest_inv:remove_item("main", v)
if leftover
and not leftover:is_empty() then
chest_inv:add_item("main", v)
end
end
end
elseif fields.chestname then
-- change chest infotext to display name
if fields.chestname ~= "" then
meta:set_string("name", fields.chestname)
meta:set_string("infotext",
S("Protected Chest (@1)", fields.chestname))
else
meta:set_string("infotext", S("Protected Chest"))
end
end
end)
-- Protected Chest recipes
minetest.register_craft({
output = 'protector:chest',
recipe = {
{'group:wood', 'group:wood', 'group:wood'},
{'group:wood', 'default:copper_ingot', 'group:wood'},
{'group:wood', 'group:wood', 'group:wood'},
}
})
minetest.register_craft({
output = 'protector:chest',
recipe = {
{'default:chest', 'default:copper_ingot', ''},
}
})

View File

@ -0,0 +1,629 @@
-- '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.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, ...) a = {a, ...}
return s:gsub("@(%d+)", function(n)
return a[tonumber(n)]
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
-- protector_bypass privileged users can override protection
if infolevel == 1
and minetest.check_player_privs(digger, {protection_bypass = true}) 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 infolevel == 1 and owner ~= digger 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)
digger = digger or "" -- nil check
-- 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)
if player and player:is_player() then
-- hurt player if protection violated
if protector.hurt > 0 and player:get_hp() > 0 then
player:set_hp(player:get_hp() - protector.hurt)
end
-- flip player when protection violated
if protector.flip 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
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)
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 player and 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")
-- stop mesecon pistons from pushing protectors
if minetest.get_modpath("mesecons_mvps") then
mesecon.register_mvps_stopper("protector:protect")
mesecon.register_mvps_stopper("protector:protect2")
mesecon.register_mvps_stopper("protector:chest")
end
print (S("[MOD] Protector Redo loaded"))

View File

@ -0,0 +1,21 @@
The MIT License (MIT)
Copyright (c) 2016 TenPlus1
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

View File

@ -0,0 +1,43 @@
# German Translation for protector mod
# Deutsche Übersetzung der protector Mod
# last update: 2016/June/5
# Author: Xanthin
#admin.lua
Remove Protectors near players with names provided (separate names with spaces) = Entferne Stoerschuetzer von bestimmten Namen in der Naehe von Spielern (trenne Namen durch Leerzeichen)
Protector Names to remove: @1 = Stoerschutznamen zum Entfernen: @1
Name List Reset = Namensliste zurueckgesetzt
#doors_chest.lua
Protected Wooden Door = Geschützte Holztür
Protected Steel Door = Geschützte Stahltür
Protected Trapdoor = Geschützte Falltür
Protected Steel Trapdoor = Geschützte Stahlfalltür
Protected Chest = Geschützte Truhe
@1 moves stuff to protected chest at @2 = @1 verlagert Dinge in geschützte Truhe bei @2
@1 takes stuff from protected chest at @2 = @1 nimmt Dinge aus geschützter Truhe bei @2
To Chest = Zur Truhe
To Inventory = Zum Inventar
Protected Chest (@1) = Geschützte Truhe (@1)
#init.lua
-- Protector interface -- = -- Störschutz-Interface --
PUNCH node to show protected area or USE for area check = SCHLAGE Node, um geschützten Bereich anzuzeigen oder\nBENUTZE für Bereichsprüfung
Members: = Mitglieder:
Close = Schließen
This area is owned by @1! = Dieses Gebiet gehoert @1!
This area is owned by @1. = Dieses Gebiet gehoert @1.
Protection located at: @1 = Stoerschutz befindet sich bei: @1
Members: @1. = Mitglieder: @1.
This area is not protected. = Dieses Gebiet ist nicht geschuetzt.
You can build here. = Du kannst hier bauen.
Overlaps into above players protected area = Ueberlappt in geschuetzen Bereich eines Spielers
Protection Block = Störschutzblock
Protection (owned by @1) = Störschutz (gehört @1)
Protection Logo = Störschutzlogo
[MOD] Protector Redo loaded = [MOD] Protector Redo geladen
#pvp.lua
[Protector] on_punchplayer called with nil objects = on_punchplayer wurde durch "nil objects" aufgerufen
[Protector] pvp_protect not active, update your version of Minetest = pvp_protect ist nicht aktiv, aktualisiere deine Minetestversion
[Protector] pvp_protect is disabled = pvp_protect ist ausgeschaltet

View File

@ -0,0 +1,41 @@
# Template for translations of protector mod
# last update: 2016/June/5
#admin.lua
Remove Protectors near players with names provided (separate names with spaces) =
Protector Names to remove: @1 =
Name List Reset =
#doors_chest.lua
Protected Wooden Door =
Protected Steel Door =
Protected Trapdoor =
Protected Steel Trapdoor =
Protected Chest =
@1 moves stuff to protected chest at @2 =
@1 takes stuff from protected chest at @2 =
To Chest =
To Inventory =
Protected Chest (@1) =
#init.lua
-- Protector interface -- =
PUNCH node to show protected area or USE for area check =
Members: =
Close =
This area is owned by @1! =
This area is owned by @1. =
Protection located at: @1 =
Members: @1. =
This area is not protected. =
You can build here. =
Overlaps into above players protected area =
Protection Block =
Protection (owned by @1) =
Protection Logo =
[MOD] Protector Redo loaded =
#pvp.lua
[Protector] on_punchplayer called with nil objects =
[Protector] pvp_protect not active, update your version of Minetest =
[Protector] pvp_protect is disabled =

View File

@ -0,0 +1,41 @@
# Turkish translation by mahmutelmas06
# last update: 2016/June/5
#admin.lua
Remove Protectors near players with names provided (separate names with spaces) = Ismi verilen oyuncuların yanındaki korumaları kaldır. ( İsimleri boşlukla ayır)
Protector Names to remove: @1 = Silinecek korumaların isimleri: @1
Name List Reset = İsim listesini sıfırla
#doors_chest.lua
Protected Wooden Door = Korumalı ahşap kapı
Protected Steel Door = Korumalı çelik kapı
Protected Trapdoor = Korumalı tuzak kapısı
Protected Steel Trapdoor = Korumalı çelik tuzak kapısı
Protected Chest = Korumalı sandık
@1 moves stuff to protected chest at @2 = @1 korumalı sandığa birşeyler koydu @2
@1 takes stuff from protected chest at @2 = @1 korumalı sandıktan birşeyler aldı @2
To Chest = Sandığa
To Inventory = Envantere
Protected Chest (@1) = Korumalı sandık (@1)
#init.lua
-- Protector interface -- =
PUNCH node to show protected area or USE for area check = Korumalı alanı görmek için kutucuğa vurun yada alanı kontrol etmek için kullanın
Members: = Üyeler
Close = Kapat
This area is owned by @1! = Burasının sahibi @1!
This area is owned by @1. = Burasının sahibi @1.
Protection located at: @1 = Korumanın bulunduğu yer @1
Members: @1. = Üyeler @1.
This area is not protected. = Bu alan korumalı değildir.
You can build here. = Buraya inşaa edebilirsiniz.
Overlaps into above players protected area =
Protection Block = Koruma kutusu
Protection (owned by @1) = Koruma (@1 sahibidir)
Protection Logo = Koruma arması
[MOD] Protector Redo loaded = [MOD] Protector Redo yüklendi
#pvp.lua
[Protector] on_punchplayer called with nil objects = [Protector] on_punchplayer boş objelerle çağrıldı
[Protector] pvp_protect not active, update your version of Minetest = [Protector] pvp_protect aktif değil, Minetest sürümünüzü güncelleyin.
[Protector] pvp_protect is disabled = [Protector] pvp_protect kapatıldı.

View File

@ -0,0 +1,14 @@
-- add lucky blocks
if minetest.get_modpath("lucky_block") then
lucky_block:add_blocks({
{"dro", {"protector:protect"}, 3},
{"dro", {"protector:protect2"}, 3},
{"dro", {"protector:door_wood"}, 1},
{"dro", {"protector:door_steel"}, 1},
{"dro", {"protector:chest"}, 1},
{"exp"},
})
end

View File

@ -0,0 +1 @@
name = protector

View File

@ -0,0 +1,69 @@
local S = protector.intllib
-- get static spawn position
local statspawn = minetest.setting_get_pos("static_spawnpoint") or {x = 0, y = 2, z = 0}
-- is pvp protection enabled
protector.pvp = minetest.setting_getbool("protector_pvp")
-- is night-only pvp enabled
protector.night_pvp = minetest.setting_getbool("protector_night_pvp")
-- disables PVP in your own protected areas
if minetest.setting_getbool("enable_pvp") and protector.pvp then
if minetest.register_on_punchplayer then
minetest.register_on_punchplayer(function(player, hitter,
time_from_last_punch, tool_capabilities, dir, damage)
if not player
or not hitter then
print(S("[Protector] on_punchplayer called with nil objects"))
end
if not hitter:is_player() then
return false
end
-- no pvp at spawn area
local pos = player:getpos()
if pos.x < statspawn.x + protector.spawn
and pos.x > statspawn.x - protector.spawn
and pos.y < statspawn.y + protector.spawn
and pos.y > statspawn.y - protector.spawn
and pos.z < statspawn.z + protector.spawn
and pos.z > statspawn.z - protector.spawn then
return true
end
-- do we enable pvp at night time only ?
if protector.night_pvp then
-- get time of day
local tod = minetest.get_timeofday() or 0
if tod > 0.2 and tod < 0.8 then
--
else
return false
end
end
-- is player being punched inside a protected area ?
if minetest.is_protected(pos, hitter:get_player_name()) then
return true
end
return false
end)
else
print(S("[Protector] pvp_protect not active, update your version of Minetest"))
end
else
print(S("[Protector] pvp_protect is disabled"))
end

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 421 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 375 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 418 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 109 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 105 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 132 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 273 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 260 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 257 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 233 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 153 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 101 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 130 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 294 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 291 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 672 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 862 B

View File

@ -0,0 +1,15 @@
following Textures created by Fernando Zapata (CC BY-SA 3.0):
door_wood.png
door_wood_a.png
door_wood_a_r.png
door_wood_b.png
door_wood_b_r.png
following Textures created by BlockMen (WTFPL):
door_trapdoor.png
following textures created by sofar (CC-BY-SA-3.0)
doors_trapdoor_steel.png
doors_trapdoor_steel_side.png
door_trapdoor_side.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 267 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 96 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 138 B

View File

@ -0,0 +1,125 @@
-- protector placement tool (thanks to Shara for code and idea)
minetest.register_craftitem("protector:tool", {
description = "Protector Placer Tool (stand on protector, face direction and use)",
inventory_image = "protector_display.png",
stack_max = 1,
on_use = function(itemstack, user, pointed_thing)
local name = user:get_player_name()
-- check node player occupies
local pos = user:getpos()
local nod = minetest.get_node(pos).name
if nod ~= "protector:protect2" then
-- check node under player
pos.y = pos.y - 1
nod = minetest.get_node(pos).name
if nod ~= "protector:protect"
and nod ~= "protector:protect2" then
return
end
end
-- get members on protector
local meta = minetest.get_meta(pos)
local members = meta:get_string("members") or ""
-- get direction player is facing
local dir = minetest.dir_to_facedir( user:get_look_dir() )
local vec = {x = 0, y = 0, z = 0}
local gap = (protector.radius * 2) + 1
-- set placement coords
if dir == 0 then
vec.z = gap -- north
elseif dir == 1 then
vec.x = gap -- east
elseif dir == 2 then
vec.z = -gap -- south
elseif dir == 3 then
vec.x = -gap -- west
end
-- new position
pos.x = pos.x + vec.x
pos.y = pos.y + vec.y
pos.z = pos.z + vec.z
-- does placing a protector overlap existing area
if not protector.can_dig(protector.radius * 2, pos,
user:get_player_name(), true, 3) then
minetest.chat_send_player(name,
"Overlaps into above players protected area")
return
end
-- does a protector already exist ?
if #minetest.find_nodes_in_area(
vector.subtract(pos, 1), vector.add(pos, 1),
{"protector:protect", "protector:protect2"}) > 0 then
minetest.chat_send_player(name, "Protector already in place!")
return
end
-- do we have protectors to use ?
local inv = user:get_inventory()
if not inv:contains_item("main", "protector:protect")
and not inv:contains_item("main", "protector:protect2") then
minetest.chat_send_player(name, "No protectors available to place!")
return
end
-- take protector
if inv:contains_item("main", "protector:protect") then
inv:remove_item("main", "protector:protect")
elseif inv:contains_item("main", "protector:protect2") then
inv:remove_item("main", "protector:protect2")
end
-- place protector
minetest.set_node(pos, {name = nod, param2 = 1})
-- set protector metadata
local meta = minetest.get_meta(pos)
meta:set_string("owner", name)
meta:set_string("infotext", "Protection (owned by " .. name .. ")")
-- copy members across if holding sneak when using tool
if user:get_player_control().sneak then
meta:set_string("members", members)
else
meta:set_string("members", "")
end
end,
})
-- tool recipe
minetest.register_craft({
output = "protector:tool",
recipe = {
{"default:steel_ingot", "default:steel_ingot", "default:steel_ingot"},
{"default:steel_ingot", "protector:protect", "default:steel_ingot"},
{"default:steel_ingot", "default:steel_ingot", "default:steel_ingot"},
}
})
-- recipes to switch between protectors
minetest.register_craft({
type = "shapeless",
output = "protector:protect",
recipe = {"protector:protect2"}
})
minetest.register_craft({
type = "shapeless",
output = "protector:protect2",
recipe = {"protector:protect"}
})