OgelGames / beacon

A redo of the Minetest beacon mod by AgentNagel42 (WIP)
Other
4 stars 3 forks source link

Beam can destroy beam of other player #12

Closed SwissalpS closed 3 years ago

SwissalpS commented 3 years ago

If a beam is on the border of a protected area, another player can place a beam on the unprotected side pointing at that beam. When he then digs the beacon, the beam in protected area is removed too.

on_dig seems to be the hook we need.

There is probably a reason why on_destruct is being used to remove the beams instead of on_dig or could that be moved easily?

SwissalpS commented 3 years ago

I'm guessing this is for the cleanup lbm to use same function.

OgelGames commented 3 years ago

on_destruct is used so that even if it is removed by something that doesn't call on_dig (like worldedit or jumpdrive) the beam will still be removed.

I think it would still be possible to check protection using the owner stored in the metadata, but another possible solution to this would be to only remove beam nodes with the same orientation as the removing beacon, which would also fix beacons being able to cut off other beacons.

SwissalpS commented 3 years ago

checking orientation would certainly cover a lot of cases, but also disable having horizontal beams without bases. Well, sure you can dig the beacon with digtron, I guess. I did like the way segments of beam can be made using other beams.

SwissalpS commented 3 years ago

I also understand how annoying it can be when you accidentally hit a beacon perpendicularly and it is cut short. Maybe if beams could be rotated and placed with replacer in selected orientation, we could have both best solutions.

OgelGames commented 3 years ago

Maybe if beams could be rotated and placed with replacer in selected orientation, we could have both best solutions.

AFAIK they can...

SwissalpS commented 3 years ago

not yet. I've been using the perpendicular cutting technique to place horizontal beams without bases and beacons. :) (unless you meant: ... they can be made to be rotated. In which case I'm excited :D)

OgelGames commented 3 years ago

I just tested it, and they can be rotated with a sonic screwdriver, and replacer does work to place rotated beams. The rotatability of beams is actually not intended, I just can't prevent the sonic screwdriver from rotating them like I did for the normal screwdriver: https://github.com/OgelGames/beacon/blob/05d66dc534352376a09dd29e264e2ed38c6a3959/register.lua#L18-L20 But beacons can be rotated, and the beams that come out of them will be rotated too, so individual beam rotation doesn't matter anyway in this case.

SwissalpS commented 3 years ago

so individual beam rotation doesn't matter anyway in this case.

I disagree with that statement. Say I want multicoloured beam horizontally. I can't do that with beacons directly, I need individual beams for that. Currently only vertical multicoloured beams are possible, horizontally we can make two colours and only two segments.

6r1d commented 3 years ago

so individual beam rotation doesn't matter anyway in this case.

For most of the players, that is correct. Personally, I think it's cool to make a factory of, for instance, red beacon beams just for the fun of it. They are a light source and they are colored. Also, cheap, but require time.

You can consider that cheating, but it's something to be discussed.

SwissalpS commented 3 years ago

I feel foolish now :/ was 'holding it wrong' Need to use sonic correctly then it works :D

Sorry about that :(

OgelGames commented 3 years ago

so individual beam rotation doesn't matter anyway in this case.

I disagree with that statement. Say I want multicoloured beam horizontally. I can't do that with beacons directly, I need individual beams for that.

Perhaps I worded that wrong... What I meant is that you can place beacons in different directions, and use the replacer to copy the rotation, which you can then use to rotate other beams. This means that you don't even need to use the sonic screwdriver to rotate the beams individually. Of course you can also place beams with the replacer too if you have them.

Also, pistons can push beams, so that is another way to do it without screwdriver or replacer.

Personally, I think it's cool to make a factory of, for instance, red beacon beams just for the fun of it. You can consider that cheating, but it's something to be discussed.

And that's exactly why I let beacon beams remain diggable with some things :wink:

SwissalpS commented 3 years ago

This means that you don't even need to use the sonic screwdriver to rotate the beams individually.

Yes exactly :D

Also, pistons can push beams, so that is another way to do it without screwdriver or replacer.

Yes, pistons... need screwdriver or replacer to place those right :p

We will also find some more ways. I'm curious to find out especially what happens when: place beacon on ground, rotate base beam, remove beacon. Now already first beam is in wrong orientation and stops the removal. If this works, then this fix will bring a fast way to make the beacon-less beams quickly.