[antigrief][code] Universal Node-Ownership, Water/Lava Safeties

User avatar
mauvebic
Member
 
Posts: 1550
Joined: Fri Jan 27, 2012 11:32

[antigrief][code] Universal Node-Ownership, Water/Lava Safeties

by mauvebic » Wed Jun 27, 2012 14:20

Universal node ownership

each node placed records its owner. Blocks placed by the servers' mapgen, or mods, are diggable. Nodes w/ owners can be removed using worldedit or multinode, or whatever tool mod that removes nodes instead of digging them.
Theres nothing to download, since your placing and replacing snippets of code in builtin/misc_register.lua and default/init.lua
Last edited by mauvebic on Sat Dec 08, 2012 00:11, edited 1 time in total.
"Fuck the hat." - Paulie Gualtieri
 

neo
Member
 
Posts: 56
Joined: Fri Jun 15, 2012 07:50

by neo » Wed Jun 27, 2012 17:59

Interesting. What are you playing with ?
 

neo
Member
 
Posts: 56
Joined: Fri Jun 15, 2012 07:50

by neo » Wed Jun 27, 2012 18:14

the code ! the code !
 

User avatar
mauvebic
Member
 
Posts: 1550
Joined: Fri Jan 27, 2012 11:32

by mauvebic » Sun Jul 29, 2012 15:03

update
"Fuck the hat." - Paulie Gualtieri
 

cornernote
Member
 
Posts: 844
Joined: Wed Jul 11, 2012 15:02

by cornernote » Mon Jul 30, 2012 06:36

add this in builtin.lua, add this line (just under misc_register):
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
dofile(minetest.get_modpath("__builtin").."/my_file.lua")


Then you can add the rest into a file of its own:
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
local function is_node_owner(meta, player)
    if meta:get_string("owner") ~= player:get_player_name() and meta:get_string("owner") ~= '' then
        return false
    end
    return true
end
local can_dig = function(pos,player)
    meta = minetest.env:get_meta(pos)
    return is_node_owner(meta, player)
end

-- copy minetest.register_node to another function so we can still call it
minetest_register_node = minetest.register_node;

-- overwrite minetest.register_node
function minetest.register_node(name, nodedef)
    if not nodedef.can_dig then nodedef.can_dig = can_dig end
    minetest_register_node(name, nodedef) -- call the real minetest.register_node
end

minetest.register_on_placenode(function(p, node, placer)
    local meta = minetest.env:get_meta(p)
    local player = placer:get_player_name()
    meta:set_string("owner",player)
end)



p.s. awesome mod! very small but very useful
Last edited by cornernote on Mon Jul 30, 2012 06:38, edited 1 time in total.
 

User avatar
mauvebic
Member
 
Posts: 1550
Joined: Fri Jan 27, 2012 11:32

by mauvebic » Mon Jul 30, 2012 10:45

Well its not perfect (no antigriefing solution is 100%) - this one doesn't use zones so there's no hassle in setting them up, but if someone decides to strategically place nodes to block pathways and such, then it could be hassle having to remove them with wolrdedit or multinode (but by then youll probably ban the person for doing such, so at least they were never able to destroy any buildings)

I dont know how pertinent this mod is going to be once c55 is done implementing rollback. (saw a few references to it in the code). Im already not crazy about rollback, yesterday id find myself placing 20-30 nodes, then they'd all disappear, and come back again (wtf? lol)
"Fuck the hat." - Paulie Gualtieri
 

User avatar
mauvebic
Member
 
Posts: 1550
Joined: Fri Jan 27, 2012 11:32

by mauvebic » Wed Aug 01, 2012 01:39

update posted :-)
"Fuck the hat." - Paulie Gualtieri
 

User avatar
SegFault22
Member
 
Posts: 870
Joined: Mon May 21, 2012 03:17

by SegFault22 » Tue Aug 07, 2012 23:41

yesterday id find myself placing 20-30 nodes, then they'd all disappear, and come back again

That is called ''node prediction'' or something, when you place a node, Minetest predicts the node's position/collision box. Sometimes the server sends back the data for that area, before it gets the data that you changed the area, and the nodes will ''disappear'', until the server processes the data and sends the packet(s) with the data of the area back to the client. It has nothing to do with rollback.
Resources are abundant; only money is scarce. People should not have to work hard and remain poor just to pay for the needs of survival.
Society can thrive without money - but only if productive members of society are rewarded for being productive.
 


Return to WIP Mods

Who is online

Users browsing this forum: No registered users and 10 guests

cron