Commit Graph

28 Commits

Author SHA1 Message Date
zaoqi
077316b4cd Use creative.is_enabled_for for creative mode if possible (#1558) 2017-03-29 21:02:26 +02:00
Auke Kok
ecf160d93d Screwdriver: simplify logic, allow wallmounted rotation.
- Allow rotation of wallmounted nodeboxes (signs) since they are
  now rotating properly.
- Instead of testing `ndef` several times, do it once, correctly.
- Simplify exception logic for nodes that have `on_rotate` set.
- For simplicity, return itemstack, always.
- Remove a useless nil check.
2017-03-20 00:12:16 +00:00
Auke Kok
d5e19d70c2 Screwdriver: drop nodes if no longer attached.
This should be fairly cheap and pops off items if needed.
2017-03-12 10:20:19 +00:00
Dániel Juhász
efb81d188e Correct rotation of attached nodes, and rotate colored nodes 2017-03-12 10:20:19 +00:00
Auke Kok
297192dd39 Screwdriver: use table lookup for facedir rotations.
The table was generated using the old code. A table lookup
should be faster than lots of math and branches.

Allows us to drop `nextrange()` as well.
2017-03-12 10:20:19 +00:00
Auke Kok
f14b0a6ff5 Screwdriver: allow simple wallmounted rotation.
Allows rotating things like signs and torches. Axis rotation
rotates over all 6 faces, face rotation flips upside down to
flat on floor only, and of course in the 4 horizontal directions.

Made the code a bit more modular to account for different rotation
schemes. Should be easier to extend from here on to other needs,
and the functions can be reused by other mods for convenience.
2017-03-12 10:20:19 +00:00
tenplus1
6d67badcac Screwdriver: Fix crash
If 'node_box' is nil 'node_box.type' causes a crash.
2017-03-07 06:37:33 +00:00
Diego Martínez
496521f4a1 Fix some warnings.
Also fixes the failing travis checks.
2017-03-05 09:27:53 +00:00
Tim
20fa037313 Screwdriver: disallow rotation with on_rotate = false
Other screwdriver mods, or mods that cause rotation, might operate without the screwdriver mod loaded and have `screwdriver.disallow` unavailable.
This allows nodes to default to full-disallow rather than full-rotation in such a situation.
2016-08-05 20:41:24 +01:00
tenplus1
51891122f2 Changes to Screwdriver to add new drivers.
A few screwdriver changes so that mod makers can add new screwdrivers with different wear levels.  Tried and tested with new diamond screwdriver :)
2016-03-22 15:45:39 +00:00
tenplus1
20053d6b52 Fix bug rotating unknown node
This fixes a bug what crashes game when rotating an unknown node.
2016-03-13 04:49:15 +00:00
Auke Kok
82299b94dc Verify node type is facedir.
This prevents nodes that are not of the "facedir" paramtype2,
as these are generally not expected to be able to rotate. Mods
and other methods may still manipulate param2 of these nodes
as expected.

Addresses #712
2015-12-25 15:37:17 +00:00
Novatux
eae3740d85 Fix missing argument for on_rotate 2015-05-14 16:07:19 +02:00
Novatux
2824562dc9 Add screwdriver callbacks, and code them for doors and beds 2015-05-14 10:24:56 +02:00
Craig Davison
a9ac480dcd Set number of screwdriver uses to 200 2014-12-21 22:36:20 +01:00
PilzAdam
1237bc3a4b Don't override param2 bits that are not used for rotation in screwdriver 2014-12-20 13:06:53 +01:00
PilzAdam
697b39d40d Only allow rotating nodes that could be dug 2014-12-12 16:14:25 +01:00
PilzAdam
2b7ca68805 Cleanup
* Remove unused variables
* Fix wearing out of screwdriver
* Move magic numbers into constants
* Scale down texture
2014-12-12 16:14:25 +01:00
tenplus1
bd24c15db4 Screwdriver rewrite 2014-12-12 16:14:24 +01:00
Zefram
c39b9b29de Improve message about screwdriver control
The message to "hold shift" makes an unwarranted assumption about the
user's keybindings.  Messages from the server should refer to a key's
game function, rather than its extragame identity.
2014-07-22 13:04:20 +02:00
ShadowNinja
04e560328f Reverse and combine if statements in the screwdriver 2014-01-16 18:40:04 -05:00
ShadowNinja
c971ec7dc7 Fix crash when using the screwdriver on an unknown node 2014-01-16 18:32:13 -05:00
ShadowNinja
5dcc5cb305 Allow changing screwdriver mode when pointing at a protected node 2013-12-22 17:16:31 -05:00
ShadowNinja
64fdb49a32 Rework screwdriver and add protection support 2013-12-11 16:10:17 -05:00
Novatux
47a49eccf4 Use minetest.swap_node instead of hacky_swap_node 2013-12-08 18:12:44 +01:00
ShadowNinja
7b8ad5786c Add and use the stick group 2013-11-01 11:34:24 -04:00
PilzAdam
31a74ede18 Replace minetest.env: with minetest. 2013-05-25 00:40:03 +02:00
PilzAdam
fcf0816fa8 Move all common mods back to minetest_game 2013-05-18 16:05:16 +02:00