[Mod] Better Screwdriver [0.4] [screwdriver2]

Post Reply
User avatar
12Me21
Member
Posts: 873
Joined: Tue Mar 05, 2013 00:36
GitHub: 12Me21
Location: (Ignore all of my posts before 2018)

[Mod] Better Screwdriver [0.4] [screwdriver2]

by 12Me21 » Post

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
Last edited by 12Me21 on Fri Oct 05, 2018 20:13, edited 5 times in total.

User avatar
DS-minetest
Member
Posts: 1137
Joined: Thu Jun 19, 2014 19:49
GitHub: Desour
IRC: DS-minetest
In-game: DS
Location: I'm scared that if this is too exact, I will be unable to use my keyboard.

Re: [Mod] Better Screwdriver [screwdriver2]

by DS-minetest » Post

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.
Note that I've recently renamed myself on github and co. to "Desour". (I'm bad at naming things.)
Feel free to call me DS.

User avatar
Pyrollo
Member
Posts: 367
Joined: Mon Jan 08, 2018 15:14
GitHub: pyrollo
In-game: Naj
Location: Paris

Re: [Mod] Better Screwdriver [screwdriver2]

by Pyrollo » Post

Good idea !

Have you tried to play with it with moreblocs ?
[ Display Modpack ] - [ Digiterms ] - [ Crater MG ] - [ LATE ]

User avatar
12Me21
Member
Posts: 873
Joined: Tue Mar 05, 2013 00:36
GitHub: 12Me21
Location: (Ignore all of my posts before 2018)

Re: [Mod] Better Screwdriver [screwdriver2]

by 12Me21 » Post

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...

Chiantos
Member
Posts: 377
Joined: Sun Jan 15, 2017 09:04

Re: [Mod] Better Screwdriver [screwdriver2]

by Chiantos » Post

Deleted message
Last edited by Chiantos on Mon Sep 30, 2019 04:59, edited 1 time in total.

User avatar
12Me21
Member
Posts: 873
Joined: Tue Mar 05, 2013 00:36
GitHub: 12Me21
Location: (Ignore all of my posts before 2018)

Re: [Mod] Better Screwdriver [screwdriver2]

by 12Me21 » Post

Chiantos wrote:License ?
Added

User avatar
12Me21
Member
Posts: 873
Joined: Tue Mar 05, 2013 00:36
GitHub: 12Me21
Location: (Ignore all of my posts before 2018)

Re: [Mod] Better Screwdriver [screwdriver2]

by 12Me21 » Post

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)

User avatar
12Me21
Member
Posts: 873
Joined: Tue Mar 05, 2013 00:36
GitHub: 12Me21
Location: (Ignore all of my posts before 2018)

Re: [Mod] Better Screwdriver [screwdriver2]

by 12Me21 » Post

Image
Adding particle effects to show the rotation axis/direction after you use the screwdriver

User avatar
texmex
Member
Posts: 1752
Joined: Mon Jul 11, 2016 21:08
GitHub: tacotexmex
In-game: tacotexmex

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

by texmex » Post

This mod is excellent. The particle effect is really useful, though I'd replace its texture with something simpler than the screwdriver texture.
Mods | Support Mesehub: bc1qluuests9rxmlnvpjrhsnyjg9ucwy6z3r0y3srw

User avatar
texmex
Member
Posts: 1752
Joined: Mon Jul 11, 2016 21:08
GitHub: tacotexmex
In-game: tacotexmex

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

by texmex » Post

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.
Mods | Support Mesehub: bc1qluuests9rxmlnvpjrhsnyjg9ucwy6z3r0y3srw

User avatar
12Me21
Member
Posts: 873
Joined: Tue Mar 05, 2013 00:36
GitHub: 12Me21
Location: (Ignore all of my posts before 2018)

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

by 12Me21 » Post

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?

User avatar
texmex
Member
Posts: 1752
Joined: Mon Jul 11, 2016 21:08
GitHub: tacotexmex
In-game: tacotexmex

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

by texmex » Post

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.
Mods | Support Mesehub: bc1qluuests9rxmlnvpjrhsnyjg9ucwy6z3r0y3srw

User avatar
12Me21
Member
Posts: 873
Joined: Tue Mar 05, 2013 00:36
GitHub: 12Me21
Location: (Ignore all of my posts before 2018)

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

by 12Me21 » Post

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.

User avatar
12Me21
Member
Posts: 873
Joined: Tue Mar 05, 2013 00:36
GitHub: 12Me21
Location: (Ignore all of my posts before 2018)

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

by 12Me21 » Post

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...

User avatar
texmex
Member
Posts: 1752
Joined: Mon Jul 11, 2016 21:08
GitHub: tacotexmex
In-game: tacotexmex

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

by texmex » Post

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
Mods | Support Mesehub: bc1qluuests9rxmlnvpjrhsnyjg9ucwy6z3r0y3srw

User avatar
12Me21
Member
Posts: 873
Joined: Tue Mar 05, 2013 00:36
GitHub: 12Me21
Location: (Ignore all of my posts before 2018)

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

by 12Me21 » Post

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)

User avatar
texmex
Member
Posts: 1752
Joined: Mon Jul 11, 2016 21:08
GitHub: tacotexmex
In-game: tacotexmex

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

by texmex » Post

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.
Mods | Support Mesehub: bc1qluuests9rxmlnvpjrhsnyjg9ucwy6z3r0y3srw

User avatar
12Me21
Member
Posts: 873
Joined: Tue Mar 05, 2013 00:36
GitHub: 12Me21
Location: (Ignore all of my posts before 2018)

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

by 12Me21 » Post

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.

User avatar
texmex
Member
Posts: 1752
Joined: Mon Jul 11, 2016 21:08
GitHub: tacotexmex
In-game: tacotexmex

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

by texmex » Post

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? :)
Mods | Support Mesehub: bc1qluuests9rxmlnvpjrhsnyjg9ucwy6z3r0y3srw

Post Reply

Who is online

Users browsing this forum: Bing [Bot], Google [Bot] and 10 guests