Request to alter this mod slightly (no idea how to myself)

User avatar
yohoho
Member
 
Posts: 13
Joined: Tue Nov 27, 2012 17:47

Request to alter this mod slightly (no idea how to myself)

by yohoho » Tue Nov 27, 2012 17:52

I'm not exactly a new Minetest user but I still cannot grasp lua. There is a mod that I used to use a lot awhile back called node_ownership but someone had modded it for me. In the updated node_ownership mod I cannot figure out how to edit it to do as needed.

The alteration should be simple enough. I want it to by default allow all users with interact privs to dig build and whatnot any area that is not owned. Only if the area is owned should a user not be allowed to dig/build/whatnot unless they are the owner of said area.

Link to mod:
https://github.com/codeandfix/node_ownership/

I would greatly appreciate anyone willing to help here with this.
 

User avatar
PilzAdam
Member
 
Posts: 4026
Joined: Fri Jul 20, 2012 16:19
GitHub: PilzAdam
IRC: PilzAdam

by PilzAdam » Fri Nov 30, 2012 12:16

A "hack" would be:
Under line 159 in init.lua
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
function IsPlayerNodeOwner(pos, name)

insert:
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
    if name == "Sandbox" then
        return true
    end
 

User avatar
yohoho
Member
 
Posts: 13
Joined: Tue Nov 27, 2012 17:47

by yohoho » Sat Dec 01, 2012 05:01

PilzAdam wrote:A "hack" would be:
Under line 159 in init.lua
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
function IsPlayerNodeOwner(pos, name)

insert:
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
    if name == "Sandbox" then
        return true
    end


This "hack" doesn't seem to work. With it the behavior of the mod is same. Players with interact cannot dig on unowned land (and I only want the protection on owned land). Thank you anyway for trying.
 

User avatar
PilzAdam
Member
 
Posts: 4026
Joined: Fri Jul 20, 2012 16:19
GitHub: PilzAdam
IRC: PilzAdam

by PilzAdam » Sat Dec 01, 2012 10:52

I just noticed that this hack wouldnt work as expected because it sets the whole world to a sandbox. Even the protected areas of other users.
Another atempt:
Restore the original mod (delete the changes I mentioned in the other post).
Remove line 243 to 245 in default init.lua. These lines are:
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
else
    minetest.chat_send_player(placer:get_player_name(), "You need a concession to place nodes here - Grantor: ".._STATIC_grantor.." (X"..pos.x.." Y"..pos.y.." Z"..pos.z..")")
    return itemstack

Again: This is untested. So feel free to ask me again.
EDIT: And this isnt a "hack".
Last edited by PilzAdam on Sat Dec 01, 2012 10:53, edited 1 time in total.
 

User avatar
yohoho
Member
 
Posts: 13
Joined: Tue Nov 27, 2012 17:47

by yohoho » Mon Dec 03, 2012 00:00

PilzAdam wrote:I just noticed that this hack wouldnt work as expected because it sets the whole world to a sandbox. Even the protected areas of other users.
Another atempt:
Restore the original mod (delete the changes I mentioned in the other post).
Remove line 243 to 245 in default init.lua. These lines are:
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
else
    minetest.chat_send_player(placer:get_player_name(), "You need a concession to place nodes here - Grantor: ".._STATIC_grantor.." (X"..pos.x.." Y"..pos.y.." Z"..pos.z..")")
    return itemstack

Again: This is untested. So feel free to ask me again.
EDIT: And this isnt a "hack".


This doesn't work either. Players with interact still cannot dig unowned blocks :S
 

User avatar
RAPHAEL
Member
 
Posts: 627
Joined: Tue Nov 01, 2011 09:09

by RAPHAEL » Wed Dec 05, 2012 01:36

Fixed:
http://ompldr.org/vZ25wMw

EDIT: fixed broken link
Last edited by RAPHAEL on Tue Dec 11, 2012 23:59, edited 1 time in total.
"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)
 


Return to WIP Mods

Who is online

Users browsing this forum: No registered users and 50 guests

cron