Compare commits

...

5 Commits

Author SHA1 Message Date
codeandfix df5f522532 - fixed two wrong default return values which could lead to build outside of a concession
- added a dev output (outcommented)
2012-11-17 15:50:50 -08:00
codeandfix 7c256d3fae protect on node punch for mesecons delay 2012-10-07 11:39:56 -07:00
codeandfix 46203072ec - blocked subconcessions from childs, so that the recursive removal problem is circumvented on clean databases
- added some debug output information (see config changes)
- added some messages to the player
2012-09-28 09:30:10 -07:00
codeandfix 9668e918f0 very detailed usage description added 2012-09-26 09:33:24 -07:00
codeandfix 592f15f877 better configuration guide 2012-09-26 08:46:35 -07:00
3 changed files with 121 additions and 8 deletions

View File

@ -13,6 +13,13 @@ Node Ownership (node_ownership)
# Configuration (requires restart)
########################
1. Change ServerAdmin name in settings.lua if you want [optional]
# Installation
########################
@ -21,10 +28,73 @@ Node Ownership (node_ownership)
# Configuration
# Usage
########################
1. Change ServerAdmin name in settings.lua if you want [optional]
NOTE: If you use a command which needs <PlayerName> as Parameter, the Player you address needs to be online at the moment. Otherwise the command wont work.
This does not apply to the Player named "Sandbox".
Set Owner:
As a Player with the "privs" privilege you (Grantor) can use this command to grant a concession to a Player (Concessionaire).
Remember: Every Owner (Concessionaire) has the right to grant subconcessions for his concessionary area using Add Owner.
Syntax: /set_owner <PlayerName> <pos1.x>,<pos1.y>,<pos1.z> <pos2.x>,<pos2.y>,<pos2.z>
Parameters: <PlayerName> = Player's Name (Concessionaire)
<pos1.x>..<pos2.z> = Position of two points in the world describing a cuboid
Example: /set_owner JohnDoe -100,-100,-100 100,100,100
Add Owner:
As a Player with a granted concession (Concessionaire), you can give out subconcessions to other Players (Subconcessionaires).
Syntax: /add_owner <PlayerName> <pos1.x>,<pos1.y>,<pos1.z> <pos2.x>,<pos2.y>,<pos2.z>
Parameters: <PlayerName> = Player's Name (Subconcessionaire)
<pos1.x>..<pos2.z> = Position of two points in the cuboid of the concession describing a smaller or equal cuboid (unstrict subset)
Example: /add_owner SamDoe -100,-100,-100 100,100,100
List Areas:
As a Player with the "privs" privilege (Grantor) you can list all areas describing all current concessions and subconcessions.
As a Player with a concession (Concessionaire) you can list only your areas.
The Area Number which is shown is required to delete a concession.
For each tuple of (cuboid,playername) there is one area identifier.
Syntax: /list_areas
Remove Areas:
To remove a concession belonging to a Player (Concessionaire/Subconcessionaire) you need the AreaID from the List Areas command.
Syntax: /remove_areas <areaID>
Parameters: <areaID> = Area Identifier from the List Areas command.
Example: /remove_areas 1
Change Area Owner:
To change a Players (Concessionaire) concession you can use the Change Area Owner command.
You need the AreaID from List Areas and the Playername of the new concessionaire.
Syntax: /change_area_owner <areaID> <PlayerName>
Parameters: <areaID> = Area Identifier from the List Areas command.
<PlayerName> = Player's Name of the new Concessionaire
Example: /change_area_owner 1 FooDoe
Sandbox Concession:
A Sandbox concession is a concession where everyone with interact privilege can dig or place.
To grant a Sandbox concession you have to set an owner to the Player named "Sandbox".
It also works for subconcessions using add owner.

View File

@ -1,7 +1,7 @@
-- load static configuration
dofile(minetest.get_modpath("node_ownership").."/settings.lua")
if _STATIC_DEBUG then print("node_ownership: DEBUG: true") end
-- declare local variables
@ -157,7 +157,7 @@ if type(owner_defs) ~= "table" then
end
function IsPlayerNodeOwner(pos, name)
r = true
r = false
for _,def in pairs(owner_defs) do
if pos.x >= def.x1 and pos.x <= def.x2 or
pos.x <= def.x1 and pos.x >= def.x2 then
@ -183,7 +183,7 @@ end
function GetNodeOwnerName(pos)
r = true
r = false
for _,def in pairs(owner_defs) do
if pos.x >= def.x1 and pos.x <= def.x2 or
pos.x <= def.x1 and pos.x >= def.x2 then
@ -260,7 +260,7 @@ function minetest.node_dig(pos, node, digger)
if HasOwner(pos) then
if not ( IsPlayerNodeOwner(pos, digger:get_player_name()) or IsPlayerNodeOwner(pos, "Sandbox") ) then
minetest.chat_send_player(digger:get_player_name(), "You need a concession to dig nodes here - Grantor: ".._STATIC_grantor.." - ".."Concessionaire: "..GetNodeOwnerName(pos).." (X"..pos.x.." Y"..pos.y.." Z"..pos.z..")")
minetest.chat_send_player(digger:get_player_name(), "You need a concession to dig nodes here - Grantor: ".._STATIC_grantor.." - ".."Concessionaire: "..GetNodeOwnerName(pos).." (X"..pos.x.." Y"..pos.y.." Z"..pos.z..")")
return
end
else
@ -272,6 +272,28 @@ function minetest.node_dig(pos, node, digger)
old_node_dig(pos, node, digger)
end
local old_node_punch = minetest.node_punch
function minetest.node_punch(pos, node, puncher)
-- print (string.sub(node.name,1,17))
if string.sub(node.name,1,17) == "mesecons_delayer:" then
if not minetest.check_player_privs(puncher:get_player_name(), {griefing=true}) then
if HasOwner(pos) then
if not ( IsPlayerNodeOwner(pos, puncher:get_player_name()) or IsPlayerNodeOwner(pos, "Sandbox") ) then
minetest.chat_send_player(puncher:get_player_name(), "You need a concession to punch this node here - Grantor: ".._STATIC_grantor.." - ".."Concessionaire: "..GetNodeOwnerName(pos).." (X"..pos.x.." Y"..pos.y.." Z"..pos.z..")")
return
end
else
minetest.chat_send_player(puncher:get_player_name(), "You need a concession to punch this node here - Grantor: ".._STATIC_grantor.." (X"..pos.x.." Y"..pos.y.." Z"..pos.z..")")
return
end
end
end
old_node_punch(pos, node, puncher)
end
function CheckCollisions(pos1, pos2)
-- Find all 8 cube corners and make sure all 8 are not already in someone elses zone
pos3 = {x=pos2.x,y=pos1.y,z=pos1.z}
@ -348,7 +370,7 @@ minetest.register_on_chat_message(function(name, message)
minetest.chat_send_player(name, 'usage: '..cmd..' playername startpos endpos')
return true -- Handled chat message
end
print("WARNING: Please look inside code for comment to fix this soon "..name..ownername) -- Problem: If the Playername is not online at the moment it wont set. this should be fixed. but dont remove the function because it protects against bad strings
if _STATIC_DEBUG then print("WARNING: Please look inside code for comment to fix this soon "..name..ownername) end -- Problem: If the Playername is not online at the moment it wont set. this should be fixed. but dont remove the function because it protects against bad strings
local player = minetest.env:get_player_by_name(ownername)
if ownername == "Sandbox" then
@ -378,6 +400,9 @@ print("WARNING: Please look inside code for comment to fix this soon "..name..ow
owner_defs[table.maxn(owner_defs)].id = table.maxn(owner_defs)
table_save( owner_defs, owners_db_filename )
minetest.chat_send_player(ownername, "A concession has been granted to you! Type /list_areas to show your concessions.")
minetest.chat_send_player(name, "You granted "..ownername.." a concession successfully!")
return true -- Handled chat message
end
local cmd = "/add_owner"
@ -441,6 +466,15 @@ print("WARNING: Please look inside code for comment to fix this soon "..name..ow
--OK, found entry that has both area_poss
if def.owner == name or minetest.check_player_privs(name, {privs=true}) then
p=def.id
if _STATIC_DEBUG then print ("DEBUG (add_owner): Owner ID is: "..def.id) end
if def.parent ~= nil then
p=nil --disallow child of childs
if _STATIC_DEBUG then print("DEBUG (add_owner): Owner Parent is: "..def.parent) end
else
print("DEBUG (add_owner): Unset Parent")
end
break
end
end
@ -460,6 +494,9 @@ print("WARNING: Please look inside code for comment to fix this soon "..name..ow
owner_defs[table.maxn(owner_defs)].id = table.maxn(owner_defs)
table_save( owner_defs, owners_db_filename )
minetest.chat_send_player(new_ownername, name.." granted you a subconcession!")
minetest.chat_send_player(name, "You granted "..new_ownername.." a subconcession successfully!")
return true -- Handled chat message
end
local cmd = "/list_areas"

View File

@ -2,4 +2,10 @@
-- this Text will be shown if a user digs or places without permission.
-- e.g. DoeMiner
_STATIC_grantor = "ServerAdmin"
_STATIC_grantor = "ServerAdmin"
-- Disable or enable debugging output to server console
_STATIC_DEBUG = false