[Mod] Node ownership [node_ownership]
For some reason, when I try to remove the owner of an area that I set for that area, nothing happens. I accidentally set the owner of a house in ecube's server, but I meant to set myself as the owner of the city and add owners for each lot.
The lot is in the owner's list as area #3.
Can someone help me get this to work right?
The lot is in the owner's list as area #3.
Can someone help me get this to work right?
Ok, i have two strong suggesttion:
First: optimization:
second thing: on redcrab server there was crashes when removing some area, debug tells that is stack overflow related. Therefore i suggest double check in the only recursive function:
First: optimization:
Code: Select all
function minetest.item_place(itemstack, placer, pointed_thing)
if itemstack:get_definition().type == "node" then
local pos = pointed_thing.above
if HasOwner(pos) then
-- this is pointless as next function check the exactly same thing: return true when player is owner of area OR there is no owner, so this check here only adds cost.
if not IsPlayerNodeOwner(pos, placer:get_player_name()) then
minetest.chat_send_player(placer:get_player_name(), "You can not place nodes here.")
return itemstack
end
end
return old_node_place(itemstack, placer, pointed_thing)
end
return old_node_place(itemstack, placer, pointed_thing)
end
Code: Select all
function RemoveTableEntryRe(r_id)
--Find child entries and remove them
for n,def in pairs(owner_defs) do
-- if delete flag is set, so this branch was already visited - you can even issue a error message here - it should not happen
if def.parent == r_id and not def.delete then
def.delete = true
RemoveTableEntryRe(def.id)
end
end
-- now remove main entry
for n,def in pairs(owner_defs) do
if def.id == r_id then
table.remove(owner_defs, n)
break
end
end
end
function RemoveTableEntry(r_id)
-- initialize 'guardians'
for n,def in pairs(owner_defs) do
def.delete = false
end
RemoveTableEntryRe(r_id)
--Re-number ids to match place in table
for n,ndef in pairs(owner_defs) do
if ndef.id ~= n then
for p,pdef in pairs(owner_defs) do
if pdef.parent == ndef.id then
pdef.parent = n
end
end
ndef.id = n
end
end
table_save( owner_defs, owners_db_filename )
end
Last edited by wieszak on Tue Sep 11, 2012 20:08, edited 1 time in total.
After big issues with this mod when you try to "/remove_areas" but with a too large protected area list (lua stackoverflow error, with server crash and often sqlite map corrupted afterward)...
I 've updated the lua code to place a fix ... it works so far ...
original code
replaced by
I 've updated the lua code to place a fix ... it works so far ...
original code
Code: Select all
function RemoveTableEntryRe(r_id)
--Find child entries and remove them
for n,def in pairs(owner_defs) do
if def.parent == r_id then
RemoveTableEntryRe(def.id)
end
end
-- now remove main entry
for n,def in pairs(owner_defs) do
if def.id == r_id then
table.remove(owner_defs, n)
break
end
end
end
function RemoveTableEntry(r_id)
RemoveTableEntryRe(r_id)
--Re-number ids to match place in table
for n,ndef in pairs(owner_defs) do
if ndef.id ~= n then
for p,pdef in pairs(owner_defs) do
if pdef.parent == ndef.id then
pdef.parent = n
end
end
ndef.id = n
end
end
table_save( owner_defs, owners_db_filename )
end
Code: Select all
function RemoveTableEntry(r_id)
--Find child entries and remove them
local nomorechild = true
repeat
nomorechild = true
for n,def in pairs(owner_defs) do
if def.parent == r_id then
table.remove(owner_defs, n) --RemoveTableEntryRe(def.id)
nomorechild = false
break
end
end
until nomorechild
-- now remove main entry
for n,def in pairs(owner_defs) do
if def.id == r_id then
table.remove(owner_defs, n)
break
end
end
--Re-number ids to match place in table
for n,ndef in pairs(owner_defs) do
if ndef.id ~= n then
for p,pdef in pairs(owner_defs) do
if pdef.parent == ndef.id then
pdef.parent = n
end
end
ndef.id = n
end
end
table_save( owner_defs, owners_db_filename )
end
Last edited by redcrab on Thu Sep 20, 2012 13:18, edited 1 time in total.
0.4 for serious builder click here
Dedicated Minetest redcrab server forum at http://minetestbb.suret.net
It's nice to be important but it is more important to be nice.
Dedicated Minetest redcrab server forum at http://minetestbb.suret.net
It's nice to be important but it is more important to be nice.
This is wrong - it will not delete area which has area which has area. If you want make it by iterations not recursive, you should not delete entries, but mark them to be deleted, then for all marked entries check again if they have childs and mark them if find, and repeat it until no more childs found, then delete all marked entries.
I did some change to the code:
1. added redcrabs fix
2. figured out, that the changes of the core minetest application are already built into. so diff files can be dropped.
3. locked the whole world, so noone can dig/place everywhere without concession
4. added a sandbox user. if you grant the sandbox user an area, everyone with interact can edit this.
you can also give subconcessions to the sandbox user if you are a concessionaire of an area.
for example you want to have a trading/play place in your home.
5. added a griefing priv, so players with "griefing" priv set can dig/place everywhere on the map
6. added coords and grantor/concessionaire output on blocked action.
planned:
- fix redcrabs recursion problem (if it exists) or add an depth lock for childs to just one level of childs.
- cleanup code and put hardcoded stuff into statics at top of the file
maybe:
- add a gui
offtopic: added a priv "creative" to the creative inventory, so only these players get the creative inventory.
i will release the code here soon.
if someone wants to work on this mod it would be nice to cooperate.
1. added redcrabs fix
2. figured out, that the changes of the core minetest application are already built into. so diff files can be dropped.
3. locked the whole world, so noone can dig/place everywhere without concession
4. added a sandbox user. if you grant the sandbox user an area, everyone with interact can edit this.
you can also give subconcessions to the sandbox user if you are a concessionaire of an area.
for example you want to have a trading/play place in your home.
5. added a griefing priv, so players with "griefing" priv set can dig/place everywhere on the map
6. added coords and grantor/concessionaire output on blocked action.
planned:
- fix redcrabs recursion problem (if it exists) or add an depth lock for childs to just one level of childs.
- cleanup code and put hardcoded stuff into statics at top of the file
maybe:
- add a gui
offtopic: added a priv "creative" to the creative inventory, so only these players get the creative inventory.
i will release the code here soon.
if someone wants to work on this mod it would be nice to cooperate.
Last edited by mike on Wed Sep 26, 2012 01:33, edited 1 time in total.
-
- Member
- Posts: 844
- Joined: Wed Jul 11, 2012 15:02
https://github.com/codeandfix/node_ownership
this is not the announced release.. just an alpha of the current state!
but it works mostly..
this is not the announced release.. just an alpha of the current state!
but it works mostly..
-
- Member
- Posts: 844
- Joined: Wed Jul 11, 2012 15:02
it seems randomproof has not been on the forums for a few months. i think if you are actively developing this mod then your repo should be considered the most up-to-date (i had to stop myself using the word "master").
i recommend creating a new thread so that you can manage the first post.
once done, ask the forum mods to mark this one as old
remember to give credit back to this mod in your thread/readme/etc taking into account the current license. With GPL I think you can just add yourself to the list of copyright people, and then re-release it under GPL.
i recommend creating a new thread so that you can manage the first post.
once done, ask the forum mods to mark this one as old
remember to give credit back to this mod in your thread/readme/etc taking into account the current license. With GPL I think you can just add yourself to the list of copyright people, and then re-release it under GPL.
- subconcessions from childs to childs are forbidden now, to circumvent problems with recursive deletion.
- code cleaned up a bit
get latest version here
https://github.com/codeandfix/node_ownership/
- code cleaned up a bit
get latest version here
https://github.com/codeandfix/node_ownership/
Last edited by mike on Fri Sep 28, 2012 17:06, edited 1 time in total.
"Fixed" node_ownership..
Whole world diggable by default. Only owned land cannot be dug by anyone except owner.
http://ompldr.org/vZ25wMw
Whole world diggable by default. Only owned land cannot be dug by anyone except owner.
http://ompldr.org/vZ25wMw
"Before you speak, ask yourself: Is it kind, is it true, is it necessary, does it improve upon the silence?"
My mods: http://goo.gl/n4kpn
(Currently Various, Industrial, Fakeblocks, Jail, MoarCraft, Christmas, Replicator, minetest dev installer for linux, bash mod installer, windows mod installer)
My mods: http://goo.gl/n4kpn
(Currently Various, Industrial, Fakeblocks, Jail, MoarCraft, Christmas, Replicator, minetest dev installer for linux, bash mod installer, windows mod installer)
- VanessaE
- Moderator
- Posts: 4655
- Joined: Sun Apr 01, 2012 12:38
- GitHub: VanessaE
- IRC: VanessaE
- In-game: VanessaE
- Location: Western NC
- Contact:
Can someone tell me just how to let this mod know that I am the admin of my own server (so I can do routine maintenance)? :-)
You might like some of my stuff: Plantlife ~ More Trees ~ Home Decor ~ Pipeworks ~ HDX Textures (64-512px)
I think you edit the settings file and change ServerAdmin to your player name.VanessaE wrote:Can someone tell me just how to let this mod know that I am the admin of my own server (so I can do routine maintenance)? :-)
"Before you speak, ask yourself: Is it kind, is it true, is it necessary, does it improve upon the silence?"
My mods: http://goo.gl/n4kpn
(Currently Various, Industrial, Fakeblocks, Jail, MoarCraft, Christmas, Replicator, minetest dev installer for linux, bash mod installer, windows mod installer)
My mods: http://goo.gl/n4kpn
(Currently Various, Industrial, Fakeblocks, Jail, MoarCraft, Christmas, Replicator, minetest dev installer for linux, bash mod installer, windows mod installer)
- VanessaE
- Moderator
- Posts: 4655
- Joined: Sun Apr 01, 2012 12:38
- GitHub: VanessaE
- IRC: VanessaE
- In-game: VanessaE
- Location: Western NC
- Contact:
That only affects some chat/print output.
You might like some of my stuff: Plantlife ~ More Trees ~ Home Decor ~ Pipeworks ~ HDX Textures (64-512px)
You sure? If that's not the case then I presume you need some form of server privs (unsure which). On DTAmedia server I have two people as able to use node_ownership and only thing that was done is editing that settings file. Of course both also have all the server privs.VanessaE wrote:That only affects some chat/print output.
"Before you speak, ask yourself: Is it kind, is it true, is it necessary, does it improve upon the silence?"
My mods: http://goo.gl/n4kpn
(Currently Various, Industrial, Fakeblocks, Jail, MoarCraft, Christmas, Replicator, minetest dev installer for linux, bash mod installer, windows mod installer)
My mods: http://goo.gl/n4kpn
(Currently Various, Industrial, Fakeblocks, Jail, MoarCraft, Christmas, Replicator, minetest dev installer for linux, bash mod installer, windows mod installer)
- VanessaE
- Moderator
- Posts: 4655
- Joined: Sun Apr 01, 2012 12:38
- GitHub: VanessaE
- IRC: VanessaE
- In-game: VanessaE
- Location: Western NC
- Contact:
Yep, I looked at the code and didn't see any use of that variable that was part of an actual piece of code.
You might like some of my stuff: Plantlife ~ More Trees ~ Home Decor ~ Pipeworks ~ HDX Textures (64-512px)
- Menche
- Member
- Posts: 1001
- Joined: Sat Jul 02, 2011 00:43
- IRC: Menchers
- In-game: Menche
- Location: An island in a lava lake.
Use "name = [your name]" to set the admin. You then have all privs automatically and they can't be revoked.
Last edited by Menche on Sat Dec 15, 2012 16:22, edited 1 time in total.
An innocent kitten dies every time you top-post.
I suggest to visit https://github.com/codeandfix/node_ownership/ and read the huge manual!
- VanessaE
- Moderator
- Posts: 4655
- Joined: Sun Apr 01, 2012 12:38
- GitHub: VanessaE
- IRC: VanessaE
- In-game: VanessaE
- Location: Western NC
- Contact:
Menche: Actually node_ownership ignores/overrides that.
No matter, here's my variation of this mod. All this does is allow the user to tell the mod who the server admin is by uncommenting and changing the SERVER_ADMIN variable in settings.lua. The actual tweak to make it work was done inside the HasOwner() function. If a player with that name attempts to dig/place, the mod bypasses its usual protection code and just lets the action happen.
http://digitalaudioconcepts.com/vanessa ... 130123.zip
No matter, here's my variation of this mod. All this does is allow the user to tell the mod who the server admin is by uncommenting and changing the SERVER_ADMIN variable in settings.lua. The actual tweak to make it work was done inside the HasOwner() function. If a player with that name attempts to dig/place, the mod bypasses its usual protection code and just lets the action happen.
http://digitalaudioconcepts.com/vanessa ... 130123.zip
You might like some of my stuff: Plantlife ~ More Trees ~ Home Decor ~ Pipeworks ~ HDX Textures (64-512px)
Who is online
Users browsing this forum: No registered users and 2 guests