Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Place stairs upside down depending on click position #1572

Closed
MarkuBu opened this issue Feb 15, 2017 · 29 comments
Closed

Place stairs upside down depending on click position #1572

MarkuBu opened this issue Feb 15, 2017 · 29 comments

Comments

@MarkuBu
Copy link
Contributor

MarkuBu commented Feb 15, 2017

To place stairs upside down you need to place a node above or a screwdriver. It would make things easier if stairs are rotated if you click in the top half of the node and not rotated if you click in the lower half.

I don't know if it is possible to get the click position on a node

@paramat
Copy link
Contributor

paramat commented Feb 16, 2017

Getting the click position might be quite complex to do, needing a new API.

@MarkuBu
Copy link
Contributor Author

MarkuBu commented Feb 16, 2017

I know I saw this in a mod, but I don't remember

@sofar
Copy link
Contributor

sofar commented Feb 16, 2017

If you know the look yaw/pitch of the player, and you know their position, you can mathematically calculate where on the surface the cursor should be. This is what the painter mod does.

https://github.com/xyzz/painting/blob/master/init.lua#L91

However, wrt slab/stair placing, people have complained about the handling before and I fear that any change is just going to get more people complaining again. The code is already overly complex as is.

@paramat
Copy link
Contributor

paramat commented Feb 16, 2017

Yeah i would prefer simpler behaviour, impossible to satisfy most builders as building preferences vary so much.

@MarkuBu
Copy link
Contributor Author

MarkuBu commented Feb 16, 2017

Simpler behaviour (for the user) normally means more code

It is not simple to rotate each slab or stair with the screwdriver just because of the code is simple.

And to be honest: was there a change in history that has satisfied EVERYBODY?

The behaviour should be logical. And it is not logical that a slab is placed vertical if I attach it to a horizontal slab, for example.

@sofar, thanks for the link. Maybe I try a PR some day if no one else will

@paramat
Copy link
Contributor

paramat commented Feb 17, 2017

Yes i mean simple codewise.

@Desour
Copy link
Member

Desour commented Feb 17, 2017

Btw, not only the painting mod does this. Some other examples:
@HybridDog made a fork of digipad where you can punch at the digipad to use it, his technic_extras mod changes the music player so that you can punch the numbers to change and stop the music and he made a fork of travelnet where you can use the elevator by punching it.
There might be more but I don't remember everything.

@HybridDog
Copy link
Contributor

Getting the click position might be quite complex to do

It's very easy (it's taught at grammar school). The camera offset is 1.625 m above player:getpos() position + the bobbing offset. The offset caused by bobbing is not known serverside, but it's small, so it can be omitted.
https://github.com/HybridDog/technic_extras/blob/master/init.lua#L64

@paramat
Copy link
Contributor

paramat commented Feb 17, 2017

Yes, simple maths but it's a lot of code for something probably unnecessary. SImple code helps devs' heads.

@sofar
Copy link
Contributor

sofar commented Feb 21, 2017

If someone writes a PR, I'll review and help improve it (as I always do).

@MarkuBu
Copy link
Contributor Author

MarkuBu commented Feb 21, 2017

I don't think it is unnecessary. I think, a game should be K.I.S.S for the players, not for the devs

Will try to make a PR. I'll start with #1568

@MarkuBu
Copy link
Contributor Author

MarkuBu commented Feb 21, 2017

Well, then I'll fork the stairs mod

@C1ffisme
Copy link

Rather than simply adding code into the stairs mod to detect where on a node you have clicked, wouldn't it make sense to put this functionality into builtin?

@HybridDog
Copy link
Contributor

Well, then I'll fork the stairs mod

You can't fork the stairs mod because it's not an repository.
But you can run $ git subtree push -P mods/stairs/ https://github.com/<you>/<stairsrepo> master to get one with history, e.g.:
https://github.com/HybridDog/stairs (from my minetest_game fork)

@HybridDog
Copy link
Contributor

C1ffisme, that function detects where on the node you have clicked:
https://gist.github.com/HybridDog/76eee7890a439e6984aa4ca45c1e04e9

@MarkuBu
Copy link
Contributor Author

MarkuBu commented Feb 23, 2017

@HybridDog cool, thx. What does pt stand for? Position of the pointed node?

@Desour
Copy link
Member

Desour commented Feb 23, 2017

I think, it means pointed_thing.

@MarkuBu
Copy link
Contributor Author

MarkuBu commented Feb 23, 2017

perfect, thanks. It works

@MarkuBu
Copy link
Contributor Author

MarkuBu commented Feb 23, 2017

that was easy

https://youtu.be/KQRGy8Hkzhw

@MarkuBu
Copy link
Contributor Author

MarkuBu commented Feb 23, 2017

Is someone willing to add HybridDog's code to builtin? Might be useful for other mods

slabs are now a bit different. Also auto rotation works with different slab types

https://youtu.be/Qkb3acMjCig

@paramat
Copy link
Contributor

paramat commented Feb 23, 2017

Sorry for my comment, this looks good on both the videos, intuitive, i don't oppose.
I agree with slabs being horizontal whatever they are placed against, they are usually wanted horizontal.
I prefer this behaviour to the current.

@MarkuBu
Copy link
Contributor Author

MarkuBu commented Feb 23, 2017

If someone can add HybridDog's code to builtin I can remove the code from stairs mod. I'll make a PR tomorrow

@paramat
Copy link
Contributor

paramat commented Feb 24, 2017

Perhaps adding that code to builtin should be a separate PR?

@MarkuBu
Copy link
Contributor Author

MarkuBu commented Feb 24, 2017

I think about more rotations depending on click position. Vertical rotation if clicked on the left or right side of the surface and default rotation when click at the center. But I'm afraid that this is more complicated and I want to try first if it feels natural

@paramat
Copy link
Contributor

paramat commented Feb 24, 2017

Vertical rotation if clicked on the left or right side of the surface and default rotation when click at the center

Sorry i'm not keen on that.

@MarkuBu
Copy link
Contributor Author

MarkuBu commented Feb 24, 2017

I'll make a mod for this. It can be used in older MTG versions too

@hkzorman
Copy link

hkzorman commented Feb 24, 2017

The way this works as shown in the video is really good 👍 . I think this definitely should be part of MTG.

@paramat
Copy link
Contributor

paramat commented Apr 9, 2017

PR #1581

@paramat paramat added this to the 0.4.16 milestone Apr 9, 2017
@paramat
Copy link
Contributor

paramat commented Apr 11, 2017

#1697 merged.

@paramat paramat closed this as completed Apr 11, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants