[Mod] Wrench - node rotation tool [1.2] [rotate]

Argos
Member
 
Posts: 40
Joined: Tue Mar 04, 2014 21:47

[Mod] Wrench - node rotation tool [1.2] [rotate]

by Argos » Fri Feb 06, 2015 16:24

Wrench (rotate:wrench)
Screwdriver replacement / improvement

As I was unhappy with the intuitiveness and ease of use of the screwdriver for rotating nodes,
I created an alternative tool: the wrench. (not to be confused with the technic wrench,
which looks totally different, and serves a different purpose)

Image
It comes in a wooden, steel, copper and gold version. The wooden version is disabled by default.

Quick links: Manual, Download zip, Github repository, Changelog

News

12 Mar 2015: version 1.2:
  • Add optional ability to restrict wrench usage using a privilege.
  • Improvements to the manual

Features

  • Rotate a node 90° in any direction
  • Rotate a node to an absolute world orientation (north/south/east/west)
  • Rotate a node to an orientation relative to the player
  • Optionally, restrict usage using a privilege
  • API to create wrenches of other materials

Crafting

Example for the copper wrench:

Image

The steel and gold wrenches use steel and gold ingots instead. The wooden wrench
(if enabled) uses sticks.

Usage

The wrench has three major modes:
  • Rotating mode
  • Relative positioning mode
  • Absolute positioning mode

Rotating wrench:
  1. Craft a wrench (see above). Initially, it will be a rotating wrench, and its rotation
    direction will not be set
  2. Right-click any node. The rotation direction will cycle: clockwise, counter-clockwise, etc.
  3. Punch a node, and it will rotate according to the current rotation direction

Relative positioning wrench:
  1. Start with a rotating wrench (previously used, or not)
  2. Place it in the craft grid, and craft it to a relative positioning wrench
  3. Right-click any node to configure the wrench to that node's relative orientation
  4. Punch a node. It will now be oriented exactly as the original, with respect to the
    punched side (and player position if needed).
Example: right-click a chest on its front side. Then punch any other chest on any side,
and that is where the front side will be.

Absolute positioning wrench:
  1. Start with a relative positioning wrench (previously used, or not)
  2. Place it in the craft grid, and craft it to an absolute positioning wrench
  3. Right-click any node to configure the wrench to that node's absolute orientation
  4. Punch a node. It will now be oriented exactly as the original, with respect to the
    world.
Example: right-click a chest on any side. Say its front side was oriented east.
Then punch any other chest on any side. Now, that chest's front side will also be
towards the east.

To complete the crafting circle, an absolute positioning wrench can be crafted back to a
rotating wrench.

Screenshot
Image

Other features

- API for other mods to define their own wrenches.

Details and downloading

More information (manual)

Changelog

Download zip (latest)
Download v1.2
Download v1.1
Download v1.0

After unzipping, rename the directory to 'rotate' and place it in your mods folder.

Github repository

License: LGPLv2.1 (images: CC BY-SA 3.0)

Dependencies: default (optional; if you can do without the crafting recipe)
Attachments
wrench_copper_crafting.png
(2.38 KiB) Not downloaded yet
screenshot.png
(962.04 KiB) Not downloaded yet
wrench_copper.png
(565 Bytes) Not downloaded yet
Last edited by Argos on Thu Mar 12, 2015 11:55, edited 6 times in total.
 

User avatar
Wuzzy
Member
 
Posts: 3243
Joined: Mon Sep 24, 2012 15:01
GitHub: Wuzzy2
IRC: Wuzzy
In-game: Wuzzy

Re: [Mod] Rotating wrench [1.0] [rotate]

by Wuzzy » Fri Feb 06, 2015 16:35

Could you make the dependency on default optional, please? I guess this dependency is only there because of the crafting recipes.
Also, please don't say stuff like “None (except for default)”. “default” is a hard dependency, also it assumes that you have minetest_game (or a compatible subgame) installed, but not all subgames might have this mod. So this mod will not work in standalone subgames which are completely different from minetest_game.

With the code below you can check whether default is present and you can make the dependency on default optional:
Code: Select all
if minetest.get_modpath("default") ~= nil then
--[[ insert code which depends on default here, i.e. the crafting recipes ]]
else
--[[ insert alternative code here, when default is not present. This can be empty. ]]
end
 

Argos
Member
 
Posts: 40
Joined: Tue Mar 04, 2014 21:47

Re: [Mod] Rotating wrench [1.0] [rotate]

by Argos » Fri Feb 06, 2015 16:48

Wuzzy wrote:Could you make the dependency on default optional, please?

OK. Done.
 

User avatar
Wuzzy
Member
 
Posts: 3243
Joined: Mon Sep 24, 2012 15:01
GitHub: Wuzzy2
IRC: Wuzzy
In-game: Wuzzy

Re: [Mod] Rotating wrench [1.0] [rotate]

by Wuzzy » Fri Feb 06, 2015 21:48

This mod does not work in Minetest 0.4.11 for me.

I tested it once in Minetest the subgame and Empty. I got the same error both times.
22:45:07: ERROR[main]: ========== ERROR FROM LUA ===========
22:45:07: ERROR[main]: Failed to load and run script from
22:45:07: ERROR[main]: /home/wuzzy/.minetest/mods/rotate/init.lua:
22:45:07: ERROR[main]: /home/wuzzy/.minetest/mods/rotate/init.lua:279: attempt to index global 'bit' (a nil value)
22:45:07: ERROR[main]: stack traceback:
22:45:07: ERROR[main]: /home/wuzzy/.minetest/mods/rotate/init.lua:279: in function 'compute_wrench_orientation_codes'
22:45:07: ERROR[main]: /home/wuzzy/.minetest/mods/rotate/init.lua:853: in main chunk
22:45:07: ERROR[main]: ======= END OF ERROR FROM LUA ========
22:45:07: ERROR[main]: Server: Failed to load and run /home/wuzzy/.minetest/mods/rotate/init.lua
22:45:08: ERROR[main]: ModError: ModError: Failed to load and run /home/wuzzy/.minetest/mods/rotate/init.lua
 

Argos
Member
 
Posts: 40
Joined: Tue Mar 04, 2014 21:47

Re: [Mod] Rotating wrench [1.0] [rotate]

by Argos » Fri Feb 06, 2015 22:06

Wuzzy wrote:22:45:07: ERROR[main]: /home/wuzzy/.minetest/mods/rotate/init.lua:279: attempt to index global 'bit' (a nil value)


I'm not quite sure yet, but from my investigation so far, I suspect that you may be using lua 5.1.
The bitwise operations I am using are (apparently) in 5.2, but not in 5.1 and earlier...

Could you confirm you are using lua 5.1 ?

In any case, I'll fix the bitwise operations issue.

Regards,

-- Update: I fixed the issue with the bitwise operators.
 

User avatar
Wuzzy
Member
 
Posts: 3243
Joined: Mon Sep 24, 2012 15:01
GitHub: Wuzzy2
IRC: Wuzzy
In-game: Wuzzy

Re: [Mod] Rotating wrench [1.0] [rotate]

by Wuzzy » Fri Feb 06, 2015 22:37

I have Lua 5.2 installed on my system, but Minetest comes bundled with Lua 5.1 and so my Minetest uses Lua 5.1.
You can confirm for yourself which Lua version your Minetest uses by installing the luacmd mod and issuing the server command “/lua print(_VERSION)”. For me, it showed me “5.1”.

As far I know, this is intended by the developers; they want to stick to one Lua version to avoid confusion with mods. Maybe MAYBE Minetest will use Lua 5.2 in the future but I am not sure about that.

Therefore, you should currently only program in Lua 5.1. Lua 5.1 has bit32 instead, by the way.

Edit: OK, thanks. The mod now works correctly for me.
 

Argos
Member
 
Posts: 40
Joined: Tue Mar 04, 2014 21:47

Re: [Mod] Rotating wrench [1.0] [rotate]

by Argos » Fri Feb 06, 2015 23:02

Wuzzy wrote:I have Lua 5.2 installed on my system, but Minetest comes bundled with Lua 5.1 and so my Minetest uses Lua 5.1.
You can confirm for yourself which Lua version your Minetest uses by installing the luacmd mod and issuing the server command “/lua print(_VERSION)”. For me, it showed me “5.1”.

I wasn't aware of that...

From my CMakeCache.txt, it seems that my version uses lua 5.1 indeed - more specifically libluajit-5.1. Nevertheless, it *does* work for me... Probably it's luajit that provides bit.xxx() - or at the very least my version does.

Anyway, thanks for the feedback !

And good to hear it works.
 

Argos
Member
 
Posts: 40
Joined: Tue Mar 04, 2014 21:47

Re: [Mod] Wrench - node rotation tool [1.2] [rotate]

by Argos » Thu Mar 12, 2015 11:47

I pushed a new version (v1.2), with support for restricting the usage using a privilege (optional - not enabled by default)
My mods & tools:
My fork of Minetestmapper - much improved - features, manual, Windows downloads
[MOD] Wrench (rotate:wrench) - improved screwdriver alternative - manual, download
 


Return to Mod Releases



Who is online

Users browsing this forum: Google [Bot], R-One and 5 guests