Page 1 of 1

[Mod] Better Screwdriver [0.4] [screwdriver2]

Posted: Sun Sep 23, 2018 16:16
by 12Me21
The default screwdriver is a very useful tool, but it only makes sense if you understand how the facedir axis/rotation system works (and even then, I usually just resort to clicking randomly until I get the rotation I want)

This mod adds a new screwdriver that (I think) is more intuitive:
Image

Left click "pushes" an edge of the node, and right click rotates the face that you're pointing at.

Crafting:
(Same recipe as the old screwdriver)

Version 0.4 Changelog:
- Added WorldEdit screw
Version 0.3 Changelog:
- Improved pointed position detection
- Added sounds when rotating nodes
Version 0.2 Changelog:
- Added particles when nodes are rotated
- Checks to make sure the raycaster finds the correct node
- Added long item description for the doc mod
- Won't crash if you click inside a node's collision box (IDK if this ever actually happened but now it definitely won't)
- Error message when minetest.raycast does not exist (for versions before 5.0)
- Added mod.conf
- You can now sneak to reverse the rotation direction when left clicking.

Dependencies: none

Download:
(Requires minetest version 5.0 or later)
https://github.com/12Me21/screwdriver2
Zip: https://github.com/12Me21/screwdriver2/ ... master.zip

License:
WTFPL

Re: [Mod] Better Screwdriver [screwdriver2]

Posted: Sun Sep 23, 2018 17:22
by Desour
Nice!
12Me21 wrote:Crafting:
(Same recipe as the old screwdriver)
I've seen, you add a recipe for the mtg screwdriver, but no recipe to craft it back.
Also I think, it's better to clear the craft recipe before overwriting it. Else craft guide mods will show both.
12Me21 wrote:2. Camera position
The way I check the pointed-at position uses the new Raycast feature in minetest 0.5. However, this is not completely accurate, because (as far as I know,) there is no way to get the exact camera position. (Sure, you can check the player's eye height now, but the camera also bobs up and down whenever you walk.)
Is this the only thing that makes the camera position inaccurate?
The bobbing is probably done client side, the server doesn't know it better. But the crosshair could bob with the rest of the screen, too, maybe.

Imo you should leave the special rotation behaviors of nodes to the mods that add the nodes.

Re: [Mod] Better Screwdriver [screwdriver2]

Posted: Sun Sep 23, 2018 18:37
by Pyrollo
Good idea !

Have you tried to play with it with moreblocs ?

Re: [Mod] Better Screwdriver [screwdriver2]

Posted: Sun Sep 23, 2018 19:43
by 12Me21
DS-minetest wrote:Nice!
12Me21 wrote:Crafting:
(Same recipe as the old screwdriver)
I've seen, you add a recipe for the mtg screwdriver, but no recipe to craft it back.
Also I think, it's better to clear the craft recipe before overwriting it. Else craft guide mods will show both.
Yeah I'll fix that. I wonder if I should just override screwdriver:screwdriver rather than adding a new item...
DS-minetest wrote:
12Me21 wrote:2. Camera position
The way I check the pointed-at position uses the new Raycast feature in minetest 0.5. However, this is not completely accurate, because (as far as I know,) there is no way to get the exact camera position. (Sure, you can check the player's eye height now, but the camera also bobs up and down whenever you walk.)
Is this the only thing that makes the camera position inaccurate?
The bobbing is probably done client side, the server doesn't know it better. But the crosshair could bob with the rest of the screen, too, maybe.
There are small amounts of inaccuracies in the other calculations, but I'm pretty sure most of the problems come from this animation. The animation is probably done client side, but the server must know the camera position when you place a node or use an item.
Hopefully someday `pointed_thing` will always contain the exact pointing location (when applicable), so I won't have to use Raycast for this.

Anyway, I just remembered that there's the sonic screwdriver from technic, and I finally checked what the actual difference is between it and the normal screwdriver. It doesn't check can_dig, so it's able to rotate nodes like chests and machines with items inside. Maybe I'll do the same thing...

Re: [Mod] Better Screwdriver [screwdriver2]

Posted: Sun Sep 23, 2018 19:48
by Chiantos
Deleted message

Re: [Mod] Better Screwdriver [screwdriver2]

Posted: Sun Sep 23, 2018 20:22
by 12Me21
Chiantos wrote:License ?
Added

Re: [Mod] Better Screwdriver [screwdriver2]

Posted: Mon Sep 24, 2018 01:13
by 12Me21
So it turns out that there is already a mod that does nearly the exact same thing!
Rhotator Screwdriver
It's definitely a lot more polished than my version (and compatible with Minetest 0.4), but doesn't always work on nodes that don't have full nodeboxes (Which is nearly impossible without the raycast system added in 0.5)

Re: [Mod] Better Screwdriver [screwdriver2]

Posted: Tue Sep 25, 2018 13:57
by 12Me21
Image
Adding particle effects to show the rotation axis/direction after you use the screwdriver

Re: [Mod] Better Screwdriver [0.3] [screwdriver2]

Posted: Wed Oct 03, 2018 07:57
by texmex
This mod is excellent. The particle effect is really useful, though I'd replace its texture with something simpler than the screwdriver texture.

Re: [Mod] Better Screwdriver [0.3] [screwdriver2]

Posted: Thu Oct 04, 2018 10:12
by texmex
Here’s a killer feature: the ability to rotate not only individual nodes but whole worldedit selections. It could be mapped to punching a special node so when rotating the node the worldedit selection rotates with it.

Re: [Mod] Better Screwdriver [0.3] [screwdriver2]

Posted: Fri Oct 05, 2018 14:12
by 12Me21
texmex wrote:This mod is excellent. The particle effect is really useful, though I'd replace its texture with something simpler than the screwdriver texture.
I was planning to use a different texture, but couldn't think of anything...
texmex wrote:Here’s a killer feature: the ability to rotate not only individual nodes but whole worldedit selections. It could be mapped to punching a special node so when rotating the node the worldedit selection rotates with it.
How would this work with non-cube-shaped areas?

Re: [Mod] Better Screwdriver [0.3] [screwdriver2]

Posted: Fri Oct 05, 2018 16:37
by texmex
Imo it shouldn’t matter what dimensions a WE area consists of. The ”WorldEdit rotation node” would simply trigger the regular WE rotation command and WE would deal with the rotation accordingly.

Re: [Mod] Better Screwdriver [0.3] [screwdriver2]

Posted: Fri Oct 05, 2018 18:35
by 12Me21
texmex wrote:Imo it shouldn’t matter what dimensions a WE area consists of. The ”WorldEdit rotation node” would simply trigger the regular WE rotation command and WE would deal with the rotation accordingly.
oh ok
(I've never actually used worldedit before)
That should be pretty simple to add.

Re: [Mod] Better Screwdriver [0.3] [screwdriver2]

Posted: Fri Oct 05, 2018 20:12
by 12Me21
Alright, I added the worldedit rotation. Rotating the "WorldEdit Screw" node with the screwdriver will also rotate the worldedit region.
I feel like this isn't very useful since it requires a special node and a special tool... Maybe just adding a worldedit screwdriver tool would be a better option...

Re: [Mod] Better Screwdriver [0.4] [screwdriver2]

Posted: Sun Oct 07, 2018 18:38
by texmex
Any idea why I'm getting this error at boot?

Code: Select all

ERROR[Main]: ModError: Failed to load and run script from /Users/user/Library/Application Support/minetest/mods/screwdriver2/init.lua:
ERROR[Main]: .../mods/screwdriver2/worldedit.lua:7: attempt to index field '/rotate' (a nil value)
ERROR[Main]: stack traceback:
ERROR[Main]: 	...mods/screwdriver2/worldedit.lua:7: in main chunk
ERROR[Main]: 	[C]: in function 'dofile'
ERROR[Main]: 	...mods/screwdriver2/init.lua:319: in main chunk

Re: [Mod] Better Screwdriver [0.4] [screwdriver2]

Posted: Sun Oct 07, 2018 22:37
by 12Me21
texmex wrote:Any idea why I'm getting this error at boot?

Code: Select all

ERROR[Main]: ModError: Failed to load and run script from /Users/user/Library/Application Support/minetest/mods/screwdriver2/init.lua:
ERROR[Main]: .../mods/screwdriver2/worldedit.lua:7: attempt to index field '/rotate' (a nil value)
ERROR[Main]: stack traceback:
ERROR[Main]: 	...mods/screwdriver2/worldedit.lua:7: in main chunk
ERROR[Main]: 	[C]: in function 'dofile'
ERROR[Main]: 	...mods/screwdriver2/init.lua:319: in main chunk
Should be fixed now. (https://github.com/12Me21/screwdriver2/issues/1)

Re: [Mod] Better Screwdriver [0.4] [screwdriver2]

Posted: Mon Oct 08, 2018 04:45
by texmex
Indeed it’s fixed, thanks! This feature is awesome. :D I'm thinking that the screw node can interpret other actions as well, such as "pushes" by punching it translates to the WE move command. Perhaps it should grow into its own mod if added.

Re: [Mod] Better Screwdriver [0.4] [screwdriver2]

Posted: Mon Oct 08, 2018 18:58
by 12Me21
texmex wrote:Indeed it’s fixed, thanks! This feature is awesome. :D I'm thinking that the screw node can interpret other actions as well, such as "pushes" by punching it translates to the WE move command. Perhaps it should grow into its own mod if added.
Yeah, I was thinking about that too.
The problem with punching is that you wouldn't be able to break the node without triggering worldedit commands. Maybe right click would work, though.

Re: [Mod] Better Screwdriver [0.4] [screwdriver2]

Posted: Fri Oct 12, 2018 21:02
by texmex
12Me21 wrote:
texmex wrote:Indeed it’s fixed, thanks! This feature is awesome. :D I'm thinking that the screw node can interpret other actions as well, such as "pushes" by punching it translates to the WE move command. Perhaps it should grow into its own mod if added.
Yeah, I was thinking about that too.
The problem with punching is that you wouldn't be able to break the node without triggering worldedit commands. Maybe right click would work, though.
Seems apt.

Btw,I’m trying to come up with an alternative tool name and texture for a more medieval setting, where screwdrivers don’t exist. Any ideas? :)