Author Topic: Change Ownership - Give your bricks to someone else  (Read 4542 times)

Change Ownership
Can't wait for Christmas? Want to give a gift to a friend? Then build something and give the bricks to him so he can claim it as his. And then he destroys it.

This tool will make it easy to give your bricks to an another player. Just use the tool on a structure you own, then use it on the player you're giving it to. This can also be done the other way around. If the person is not around, you may even use the built in command to give the build to them manually. Keep in mind that you require at least Build trust between yourself and the one you're giving it to and you need to own the bricks you're giving.

If you're a Super Admin, then you can easily take over other builds, giving it to someone else or why not gift it to the host of the server.

If you know what the chown command in the unix system is and what it does, this does exactly that, hence the name on the tool.

Command
Code: [Select]
/chown [bl_id/name]Skipping the argument results in getting the tool. With already the tool in your hand, you'll be presented with a quick help.

Credits
McTwist - Creator
Demian - Tester

Download (aposoc.net)

GitHub
« Last Edit: December 18, 2016, 07:00:48 AM by mctwist »

Build trust between the one handling it, the one owning the bricks and the one you're giving it to.
Ooh interesting, I didn't think of that. Say player B wants to transfer bricks from player A to player C.
  • Obviously A and C need to trust each other to transfer bricks between the two.
  • A and B need to trust each other so B can hit A's bricks with the wand.
  • Does B need to trust C?

Ooh interesting, I didn't think of that. Say player B wants to transfer bricks from player A to player C.
  • Obviously A and C need to trust each other to transfer bricks between the two.
  • A and B need to trust each other so B can hit A's bricks with the wand.
  • Does B need to trust C?
It is an interesting question, but sadly I got a boring answer.

Only the one owning the bricks can give the bricks away. You cannot "steal" bricks from someone else. So it's a one-way transfer, but the one receiving it can transfer it back. I may rephrase that in the post.

It is an interesting question, but sadly I got a boring answer.

Only the one owning the bricks can give the bricks away. You cannot "steal" bricks from someone else. So it's a one-way transfer, but the one receiving it can transfer it back. I may rephrase that in the post.
What is the trust situation of player B is a Super Admin?

What is the trust situation of player B is a Super Admin?
Like I mentioned in the post, this mod is like chown. For normal users, only you can use it on your content. But for the SA(sudo user), you can change anything.
« Last Edit: November 18, 2016, 02:34:41 PM by mctwist »

Interesting, neat idea.

Also great to see you're back and making add ons!

Does it convert spawnbrick and name variables over too?

Does it convert spawnbrick[...]
That depends on how spawnbricks are used. I haven't looked into them that much, so I'm not sure.

If, for instance, the mod is like CityRP(G), then it'll probably keep their spawns in a separate list. For this situation I wont know about this list and have therefore no way from preventing this from happening.

The only way to prevent this from happening is if I'm adding a function which each mod that relies on this functionality will implement it as well so every mod will know about the change of the owner. That is, I need collaboration from all add-ons that rely on this functionality. This should be quite a few, really.


Well, they are not added. I'll make an update for that.

[...]and name variables over too?
I actually forgot about those. This is embarrassing. I'll hand out an update later today.

Code: (Changelog) [Select]
Fixed the tool not working at all.
Added handling for named bricks and spawnbricks.

Instead of messing with the ntobject variables, you should do it like this:

1) %brick.clearNTObjectName()
2) move to new group
3) %brick.setNTObjectName(blah)

The default clearNTObjectName() is extremely slow, so I've made much better ones here:
https://github.com/Zeblote/Tool_NewDuplicator/blob/master/scripts/server/namedtargets.cs?ts=4

But they can only work if all mods consistently use these methods instead of changing the variables.
« Last Edit: November 23, 2016, 07:27:17 AM by Zeblote »

You learn new things every day. I'll implement it asap.

Quite a silly question, but what would you recommend how to implement those functions in my add-on and still maintain a compatibility for other mods? Just blatantly copy it into my add-on seems bad, but I don't know an another option but to look out for your New Duplicator.

Edit: Why don't we make a similar function for spawn bricks? Does New Duplicator implement such a functionality as well, or is that already implemented automatically?
« Last Edit: November 23, 2016, 08:02:24 AM by mctwist »

That code is meant to replace the default functions (no package) and is unlikely to ever need changes, so you can just copy paste it in your add-on as is.
Other mods will automatically be compatible as long as they previously used the default set/clear name functions.

No idea how spawn bricks are handled, I think they just work on their own in ::onRemove and ::onPlant
« Last Edit: November 23, 2016, 08:11:21 AM by Zeblote »

They are handled in a similar way. A list of the bricks and a count for how many. The only difference is that they are updated on a schedule(Noted this when the list was not updated one second and the other it was updated) and they reset each entry with a "-1" instead of just removing it. I added the changes you mentioned(I was required to set empty name for the functions to work properly) and also optimized the spawn bricks in a similar manner. There's no index list, but it doesn't need to iterate through the whole list on best case scenarios now(Also, it's rare to have too many spawn bricks anyway).

(I was required to set empty name for the functions to work properly)

That's strange. All it does if you set an empty name is call clearNTObjectName.

Oh, it also sets the name to "" after removing it. So that's probably why just clear wasn't working
« Last Edit: November 23, 2016, 08:22:47 AM by Zeblote »

Well, I put the setName in there myself. It works so I wont fix that little issue.



Code: (Changelog) [Select]
Added better compatibility toward brick names.
Variety of optimizations.