Minetest_game: Open/close both sides of a double door by opening/closing one of the doors

Created on 13 Dec 2017  路  13Comments  路  Source: minetest/minetest_game

Currently doors are aligned to look like double door but aren't connected in any further way.

Since they look like double doors it would be nice if they'd open/close like them by opening or closing either one of them (i.e. both doors synchronize their state with the door that was changed).

since the doors know eachother (-> automatic alignment) I'm pretty sure it would be possible for doors to check if there is another door in a double door setup and change the state of that door, too, when changing the own state.

Feature request Won't add

Most helpful comment

The current door API is purposely simple to accomodate adding new doors easily, but keeping the amount of nodes to a minimum, and sacrificing some features.

It could be fixed, of course, you'd have to do some major work because if you do want to fix it, you should support doors that are different on the inside and the outside, which has been requested a lot, and that would require making 2 new models at a minimum, and more handling code, although much of the door code already handles the interface part well.

If you really also want to be fully complete about it, you need to add 4 more meshes and UV maps in order to account for people who want the outside of the door to be on the opposite side so that an outside door can either be "sunk into" a wall or at the outside face of the building, too.

Since that is all a bit too much for my taste, I kept it simple.

A good way to approach this problem is to create a new standalone mod that proves the concept, implements the correct mechanics and publish it, and then discuss the concepts and let players tinker with it. This makes merging features a lot easier, since talking about actual code is a lot simpler when you can see it work and compare it.

All 13 comments

I don't think the doors really "know each other", this is not so simple. The alignment is not automatic, at least it wasn't the last time I checked.

You could just check on the node next to it and propagate the effect if it's a door, but one must be careful since this could create a loop that crashes the server if someone places 4 doors in a cycle.

For anyone thinking on changing the doors It would be interesting to have a look at #1361
The textures in the right-hinged & left-hinged doors were mirrored to look aligned, but this causes a bug in which opening/closing a door makes the textures flip sides in a very glitchy way. This could be fixed if 2 new door nodes were added to represent the closed version of right-hinged and left-hinged doors.

I don't think the doors really "know each other", this is not so simple. The alignment is not automatic, at least it wasn't the last time I checked.

They at least once know each other because the door knob and direction of the door are adjusted ... well, at least one of the doors knows the other door. But that might be possible in "both directions" when interacting with the door.

Here is some pseudocode that could be used in addition to the already existing function to open/close a door.

~~Pseudocode
user interacts with the door
-> if door is open: close. if closed, open
-> store this doors state as [state]
-> check in all directions if there is another door
-> if door found: set that doors state to [state]
done
~
~

And if you have 20 doors side by side you can't open just one without open all the other 19.

Or it you are followed by a larger mob and you just want to open one door to escape?

You can use mesecons for this I think

store this doors state as [state]

Currently there's no such thing as an open/closed "state". There's a left-hinged door and a right-hinged door.

The right-hinged door, when clicked, transforms into a left-hinged door and it's rotated 90掳 clockwise.
The left-hinged door, when clicked, transforms into a right-hinged door and it's rotated 90掳 counter-clockwise.

Depending on where the wall around it is, a single right-hinged door can be an open door but change the wall around it, without touching the door and it becomes a closed door. Closed and open are just conceptual, they are not specifically defined states in the door code.

The expert is @sofar

The right-hinged door, when clicked, transforms into a left-hinged door and it's rotated 90掳 clockwise.
The left-hinged door, when clicked, transforms into a right-hinged door and it's rotated 90掳 counter-clockwise.

That is some really nasty hacky shit ... So first there should be actual doors that have an "open" and "closed" state, I guess.

Yes, but for that you either need 4 nodes instead of 2 (so you can have left-closed, left-open, right-closed and right-open), or there needs to be a way in the engine to modify a node's texture or mesh depending on its rotation.

@sofar also mentioned in #1361 using metadata overrides for the nodedef. I think there was already an issue in the engine open for that.

Honestly I do not see the sense in having both doors open/close, by just operating one of the doors.
I have a couple of double doors in my home, and each need to be open/closed individually.

I guess if people would like it as an option, which could be ticked on or off, that would be fine. Or, to use mesecons or other means to do so.

This is not to ridicule the idea, I just personally don't see it as logical feature.

Yes, should be optional if done, maybe by what part of a door you click (top/bottom).

The current door API is purposely simple to accomodate adding new doors easily, but keeping the amount of nodes to a minimum, and sacrificing some features.

It could be fixed, of course, you'd have to do some major work because if you do want to fix it, you should support doors that are different on the inside and the outside, which has been requested a lot, and that would require making 2 new models at a minimum, and more handling code, although much of the door code already handles the interface part well.

If you really also want to be fully complete about it, you need to add 4 more meshes and UV maps in order to account for people who want the outside of the door to be on the opposite side so that an outside door can either be "sunk into" a wall or at the outside face of the building, too.

Since that is all a bit too much for my taste, I kept it simple.

A good way to approach this problem is to create a new standalone mod that proves the concept, implements the correct mechanics and publish it, and then discuss the concepts and let players tinker with it. This makes merging features a lot easier, since talking about actual code is a lot simpler when you can see it work and compare it.

Idea is fine but i don't think it's needed enough to be worth the complexity, it's not much of a problem to click both, and players will want and need to open one only as an option :-1:

@Ezhh close?

Honestly I do not see the sense in having both doors open/close, by just operating one of the doors.

This covered my thoughts perfectly, so yes, I think it's a close.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

paramat picture paramat  路  3Comments

cx384 picture cx384  路  6Comments

paramat picture paramat  路  3Comments

stujones11 picture stujones11  路  4Comments

benrob0329 picture benrob0329  路  4Comments