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
|
enable_sprinting = true
|
||||||
static_spawnpoint = -2770,25,2327
|
static_spawnpoint = -2770,25,2327
|
||||||
enable_tnt = false
|
enable_tnt = false
|
||||||
|
protector_hurt = 0
|
||||||
|
protector_flip = true
|
||||||
|
protector_spawn = 10
|
||||||
|
protector_pvp = true
|
||||||
#
|
#
|
||||||
#################IRC################
|
#################IRC################
|
||||||
#
|
#
|
||||||
|
@ -48,8 +48,10 @@ Change log:
|
|||||||
Protectors and chest cannot be moved by mesecon pistons or machines.
|
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
|
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)
|
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)
|
Usage: (requires server privelage)
|
||||||
|
@ -424,7 +424,7 @@ minetest.register_craft({
|
|||||||
output = "protector:protect",
|
output = "protector:protect",
|
||||||
recipe = {
|
recipe = {
|
||||||
{"default:stone", "default:stone", "default:stone"},
|
{"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"},
|
{"default:stone", "default:stone", "default:stone"},
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
@ -500,7 +500,7 @@ minetest.register_node("protector:protect2", {
|
|||||||
|
|
||||||
on_blast = function() end,
|
on_blast = function() end,
|
||||||
})
|
})
|
||||||
|
--[[
|
||||||
minetest.register_craft({
|
minetest.register_craft({
|
||||||
output = "protector:protect2",
|
output = "protector:protect2",
|
||||||
recipe = {
|
recipe = {
|
||||||
@ -509,7 +509,7 @@ minetest.register_craft({
|
|||||||
{"default:stone", "default:stone", "default:stone"},
|
{"default:stone", "default:stone", "default:stone"},
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
]]
|
||||||
|
|
||||||
-- check formspec buttons or when name entered
|
-- check formspec buttons or when name entered
|
||||||
minetest.register_on_player_receive_fields(function(player, formname, fields)
|
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:protect2"}, 3},
|
||||||
{"dro", {"protector:door_wood"}, 1},
|
{"dro", {"protector:door_wood"}, 1},
|
||||||
{"dro", {"protector:door_steel"}, 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},
|
{"dro", {"protector:chest"}, 1},
|
||||||
{"exp"},
|
{"exp"},
|
||||||
})
|
})
|
||||||
|
@ -2,26 +2,23 @@
|
|||||||
-- protector placement tool (thanks to Shara for code and idea)
|
-- protector placement tool (thanks to Shara for code and idea)
|
||||||
|
|
||||||
minetest.register_craftitem("protector:tool", {
|
minetest.register_craftitem("protector:tool", {
|
||||||
description = "Protector Placer Tool (stand on protector, face direction and use)",
|
description = "Protector Placer Tool (stand near protector, face direction and use)",
|
||||||
inventory_image = "protector_display.png",
|
inventory_image = "protector_display.png^protector_logo.png",
|
||||||
stack_max = 1,
|
stack_max = 1,
|
||||||
|
|
||||||
on_use = function(itemstack, user, pointed_thing)
|
on_use = function(itemstack, user, pointed_thing)
|
||||||
|
|
||||||
local name = user:get_player_name()
|
local name = user:get_player_name()
|
||||||
|
|
||||||
-- check node player occupies
|
-- check for protector near player (2 block radius)
|
||||||
local pos = user:getpos()
|
local pos = user:getpos()
|
||||||
local nod = minetest.get_node(pos).name
|
local pp = minetest.find_nodes_in_area(
|
||||||
if nod ~= "protector:protect2" then
|
vector.subtract(pos, 2), vector.add(pos, 2),
|
||||||
-- check node under player
|
{"protector:protect", "protector:protect2"})
|
||||||
pos.y = pos.y - 1
|
|
||||||
nod = minetest.get_node(pos).name
|
if #pp == 0 then return end -- none found
|
||||||
if nod ~= "protector:protect"
|
|
||||||
and nod ~= "protector:protect2" then
|
pos = pp[1] -- take position of first protector found
|
||||||
return
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
-- get members on protector
|
-- get members on protector
|
||||||
local meta = minetest.get_meta(pos)
|
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 dir = minetest.dir_to_facedir( user:get_look_dir() )
|
||||||
local vec = {x = 0, y = 0, z = 0}
|
local vec = {x = 0, y = 0, z = 0}
|
||||||
local gap = (protector.radius * 2) + 1
|
local gap = (protector.radius * 2) + 1
|
||||||
|
local pit = user:get_look_pitch()
|
||||||
|
|
||||||
-- set placement coords
|
-- 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
|
vec.z = gap -- north
|
||||||
elseif dir == 1 then
|
elseif dir == 1 then
|
||||||
vec.x = gap -- east
|
vec.x = gap -- east
|
||||||
@ -68,6 +70,7 @@ minetest.register_craftitem("protector:tool", {
|
|||||||
end
|
end
|
||||||
|
|
||||||
-- do we have protectors to use ?
|
-- do we have protectors to use ?
|
||||||
|
local nod
|
||||||
local inv = user:get_inventory()
|
local inv = user:get_inventory()
|
||||||
|
|
||||||
if not inv:contains_item("main", "protector:protect")
|
if not inv:contains_item("main", "protector:protect")
|
||||||
@ -76,11 +79,16 @@ minetest.register_craftitem("protector:tool", {
|
|||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
-- take protector
|
-- take protector (block first then logo)
|
||||||
if inv:contains_item("main", "protector:protect") then
|
if inv:contains_item("main", "protector:protect") then
|
||||||
|
|
||||||
inv:remove_item("main", "protector:protect")
|
inv:remove_item("main", "protector:protect")
|
||||||
|
nod = "protector:protect"
|
||||||
|
|
||||||
elseif inv:contains_item("main", "protector:protect2") then
|
elseif inv:contains_item("main", "protector:protect2") then
|
||||||
|
|
||||||
inv:remove_item("main", "protector:protect2")
|
inv:remove_item("main", "protector:protect2")
|
||||||
|
nod = "protector:protect2"
|
||||||
end
|
end
|
||||||
|
|
||||||
-- place protector
|
-- place protector
|
||||||
@ -88,6 +96,7 @@ minetest.register_craftitem("protector:tool", {
|
|||||||
|
|
||||||
-- set protector metadata
|
-- set protector metadata
|
||||||
local meta = minetest.get_meta(pos)
|
local meta = minetest.get_meta(pos)
|
||||||
|
|
||||||
meta:set_string("owner", name)
|
meta:set_string("owner", name)
|
||||||
meta:set_string("infotext", "Protection (owned by " .. name .. ")")
|
meta:set_string("infotext", "Protection (owned by " .. name .. ")")
|
||||||
|
|
||||||
@ -98,6 +107,9 @@ minetest.register_craftitem("protector:tool", {
|
|||||||
meta:set_string("members", "")
|
meta:set_string("members", "")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
minetest.chat_send_player(name,
|
||||||
|
"Protector placed at " .. minetest.pos_to_string(pos))
|
||||||
|
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user