forked from ThomasMonroe314/ugxrealms
[protector] update
This commit is contained in:
parent
50a7ac004a
commit
655c9036ec
@ -39,6 +39,10 @@ playereffects_autosave = 60
|
||||
enable_sprinting = true
|
||||
static_spawnpoint = -2770,25,2327
|
||||
enable_tnt = false
|
||||
protector_hurt = 0
|
||||
protector_flip = true
|
||||
protector_spawn = 10
|
||||
protector_pvp = true
|
||||
#
|
||||
#################IRC################
|
||||
#
|
||||
|
@ -48,8 +48,10 @@ Change log:
|
||||
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)
|
||||
2.2 - Updated protector tool so that player only needs to stand nearby (2 block radius)
|
||||
It can also place vertically (up and down) as well. New protector recipe added.
|
||||
|
||||
Lucky Blocks: 6
|
||||
Lucky Blocks: 10
|
||||
|
||||
|
||||
Usage: (requires server privelage)
|
||||
|
@ -424,7 +424,7 @@ minetest.register_craft({
|
||||
output = "protector:protect",
|
||||
recipe = {
|
||||
{"default:stone", "default:stone", "default:stone"},
|
||||
{"default:stone", "default:steel_ingot", "default:stone"},
|
||||
{"default:stone", "default:gold_ingot", "default:stone"},
|
||||
{"default:stone", "default:stone", "default:stone"},
|
||||
}
|
||||
})
|
||||
@ -500,7 +500,7 @@ minetest.register_node("protector:protect2", {
|
||||
|
||||
on_blast = function() end,
|
||||
})
|
||||
|
||||
--[[
|
||||
minetest.register_craft({
|
||||
output = "protector:protect2",
|
||||
recipe = {
|
||||
@ -509,7 +509,7 @@ minetest.register_craft({
|
||||
{"default:stone", "default:stone", "default:stone"},
|
||||
}
|
||||
})
|
||||
|
||||
]]
|
||||
|
||||
-- check formspec buttons or when name entered
|
||||
minetest.register_on_player_receive_fields(function(player, formname, fields)
|
||||
|
@ -8,6 +8,10 @@ if minetest.get_modpath("lucky_block") then
|
||||
{"dro", {"protector:protect2"}, 3},
|
||||
{"dro", {"protector:door_wood"}, 1},
|
||||
{"dro", {"protector:door_steel"}, 1},
|
||||
{"exp", 5, true},
|
||||
{"dro", {"protector:trapdoor"}, 1},
|
||||
{"dro", {"protector:trapdoor_steel"}, 1},
|
||||
{"dro", {"protector:tool"}, 1},
|
||||
{"dro", {"protector:chest"}, 1},
|
||||
{"exp"},
|
||||
})
|
||||
|
@ -2,26 +2,23 @@
|
||||
-- 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",
|
||||
description = "Protector Placer Tool (stand near protector, face direction and use)",
|
||||
inventory_image = "protector_display.png^protector_logo.png",
|
||||
stack_max = 1,
|
||||
|
||||
on_use = function(itemstack, user, pointed_thing)
|
||||
|
||||
local name = user:get_player_name()
|
||||
|
||||
-- check node player occupies
|
||||
-- check for protector near player (2 block radius)
|
||||
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
|
||||
local pp = minetest.find_nodes_in_area(
|
||||
vector.subtract(pos, 2), vector.add(pos, 2),
|
||||
{"protector:protect", "protector:protect2"})
|
||||
|
||||
if #pp == 0 then return end -- none found
|
||||
|
||||
pos = pp[1] -- take position of first protector found
|
||||
|
||||
-- get members on protector
|
||||
local meta = minetest.get_meta(pos)
|
||||
@ -31,9 +28,14 @@ minetest.register_craftitem("protector:tool", {
|
||||
local dir = minetest.dir_to_facedir( user:get_look_dir() )
|
||||
local vec = {x = 0, y = 0, z = 0}
|
||||
local gap = (protector.radius * 2) + 1
|
||||
local pit = user:get_look_pitch()
|
||||
|
||||
-- set placement coords
|
||||
if dir == 0 then
|
||||
if pit > 1.2 then
|
||||
vec.y = gap -- up
|
||||
elseif pit < -1.2 then
|
||||
vec.y = -gap -- down
|
||||
elseif dir == 0 then
|
||||
vec.z = gap -- north
|
||||
elseif dir == 1 then
|
||||
vec.x = gap -- east
|
||||
@ -68,6 +70,7 @@ minetest.register_craftitem("protector:tool", {
|
||||
end
|
||||
|
||||
-- do we have protectors to use ?
|
||||
local nod
|
||||
local inv = user:get_inventory()
|
||||
|
||||
if not inv:contains_item("main", "protector:protect")
|
||||
@ -76,11 +79,16 @@ minetest.register_craftitem("protector:tool", {
|
||||
return
|
||||
end
|
||||
|
||||
-- take protector
|
||||
-- take protector (block first then logo)
|
||||
if inv:contains_item("main", "protector:protect") then
|
||||
|
||||
inv:remove_item("main", "protector:protect")
|
||||
nod = "protector:protect"
|
||||
|
||||
elseif inv:contains_item("main", "protector:protect2") then
|
||||
|
||||
inv:remove_item("main", "protector:protect2")
|
||||
nod = "protector:protect2"
|
||||
end
|
||||
|
||||
-- place protector
|
||||
@ -88,6 +96,7 @@ minetest.register_craftitem("protector:tool", {
|
||||
|
||||
-- set protector metadata
|
||||
local meta = minetest.get_meta(pos)
|
||||
|
||||
meta:set_string("owner", name)
|
||||
meta:set_string("infotext", "Protection (owned by " .. name .. ")")
|
||||
|
||||
@ -98,6 +107,9 @@ minetest.register_craftitem("protector:tool", {
|
||||
meta:set_string("members", "")
|
||||
end
|
||||
|
||||
minetest.chat_send_player(name,
|
||||
"Protector placed at " .. minetest.pos_to_string(pos))
|
||||
|
||||
end,
|
||||
})
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user