Commit Graph

102 Commits

Author SHA1 Message Date
Auke Kok
4ec0fd974b Doors: place sound when placing a door.
Due to door items being the thing that's placed, we need to
explicitly play a sound when placing a door.

Fixes #1363
2017-04-28 21:52:59 -07:00
upsilon
6335525757 Doors: Ignore permission check if player parameter is omitted
As written in game_api.txt.
2017-04-20 19:54:27 +01:00
Thomas--S
98216810ef nodebox -> node_box
Seems like this was a typo
2017-04-12 18:39:42 -07:00
SmallJoker
b377aaa50d doors: Fix craftitem not listed in inventory (#1683)
Fixes bug caused by b847888
2017-04-02 10:01:01 +02:00
zaoqi
077316b4cd Use creative.is_enabled_for for creative mode if possible (#1558) 2017-03-29 21:02:26 +02:00
cx384
b847888cb7 doors: add groups to the door craftitem 2017-03-29 20:40:56 +02:00
upsilon
7c42c41170 doors: record protection violation if it cannot be dug 2017-03-26 03:06:44 +01:00
Thomas--S
73e4666f28 Change doors to default.can_interact_with_node() 2017-03-16 09:11:20 -07:00
SmallJoker
b87ef5ccde Keys: Update default.can_interact_with_node to new item meta
Completes a forgotten update in 9d3a526
2017-03-12 12:20:31 -07:00
octacian
9d3a526324 Keys: Show owner in description
Utilizes several new features allowing the description of an item to be changed using the `description` meta key. This also moves keys from using the old single-value itemstack metadata system to the new node-like metadata system.
2017-02-27 19:00:14 -08:00
Auke Kok
6dcf541f6e Revert "Doors: Remove ..." and "Doors: Allow the screwdriver to ..."
This reverts commit 5e4a6e8ac68b92c7394b80bb67839b71b4a4a00b, and
             commit 60cf3f85b6e661482ec2705cadbdc1b04e388d19.

The original door API rewrite I posted had all rotation disabled using
the correct on_rotate() handler returning `false`. Two subsequent
changes attempting first to enable simple rotation and second disabling
that again changed the callback handler to a boolean `false`, which
is incorrect use in the screwdriver API, and actually allows rotation.

The proper way to disable rotation for facedir nodes it to use a full
callback handler that does `return false`.
2017-01-15 17:43:17 -08:00
rubenwardy
48ab62db88 Make doors place when shift is held instead of calling on_rightclick
Fixes #1364
2017-01-03 16:54:01 +00:00
Auke Kok
e4b1c93512 Keys: Allow easy sharing of access without commands
This code adds the key concept to minetest_game, and integrates it
with lockable nodes. Currently supported lockable items are the Steel
Door, the Steel Trapdoor, and the Locked Chest.

The goal of this modification is to introduce a fine-grained multi-
player permission system that is intuitive and usable without any
console or chat commands, and doesn't require extra privileges to
be granted or setup. Keys can also physically be conveyed to other
players, adding to gameplay and adding some personality that is
preferable to console commands or editing formspecs.

A skeleton key can be crafted with 1 gold ingot. Skeleton keys can
then be matched to a lockable node by right-clicking the skeleton
key on a lockable node, which changes the skeleton key to a "key".

Gold was chosen as it's currently a not-so very useful item, and
therefore it's likely that players have some, but aren't really
using it for any purpose.

This key can subsequently used by any player to open or access that
lockable node, including retrieving items from Locked Chests, or
putting items in them.

They key is programmed to fit only the particular locked node it is
programmed to. This is achieved by storing a secret value in both
key and locked node. If this secret value doesn't match, the key
will not open the locked node. This allows many keys to be created
for one chest or door, but a key will only fit one node ever. The
secrets are stored in node, and item meta for the key.

If a locked node is removed, all keys that opened it are no longer
valid. Even if a new door/chest is placed in exactly the same spot,
the old keys will no longer fit that node.

Keys can be smelted back in gold ingots if they are no longer useful.

The method of storing a secret in nodemeta and itemstackmeta is secure
as there is no way for the client to create new items on the server
with a particular secret metadata value. Even if you could possible
create such an itemstack on the client, the server does not ever read
itemstackmeta from a client package.

The patch adds an API that allows other nodes and nodes added by
mods to use the same keys as well. The method how to implement this
is described in game_api.txt. The mod should add 2 callbacks to it's
node definition. Example code is given.

Textures are from PixelBOX, thanks to Gambit.
2016-11-25 03:01:14 +00:00
paramat
09a229b412 Update 'nodeupdate()' to 'check_for_falling()' API 2016-11-22 05:55:36 +00:00
Auke Kok
75caa9167c Fix whitespace errors to silence luacheck.
Currently all minetest_game PR's are failing travis since the
upstream luacheck now also warns about whitespace issues, and
there are a few of those in the code. This fixes all of them
so we can yet again rely on luacheck.
2016-11-19 19:39:51 -08:00
cx384
23ba2d3a0c Add and edit fuel registrations
Edited fuels: fences, wooden ladder.
New fuels:
boat, paper, book, dry shrub, stick, vessels shelf, wooden tools,
wooden door, trapdoor, fence gates, farming crops, stairs, slabs, beds.
2016-11-02 13:04:25 +00:00
Auke Kok
fbac9be51c Change many metal nodes to use default metal sounds 2016-10-25 02:37:36 +01:00
paramat
5e4a6e8ac6 Doors: Remove ability to rotate doors with screwdrivers
Rotating doors with screwdrivers causes too many issues to be worth it.
2016-09-30 02:44:24 +01:00
paramat
3e05870706 Doors: Trim open fencegate collison box again
The collision box still extended into a neighbouring empty node, causing
falling node objects to collide but not transform back into normal nodes.
Completes the fix started in a previous similar commit.
2016-09-23 18:24:47 +01:00
paramat
992f295880 Licenses: (Part 4) Remove overlooked WTFPL text. Cleanup 2016-09-08 06:17:05 +01:00
paramat
995256744a Default, stairs, doors: Vary wood flammable and choppy group values
Make the softer woods, pine and aspen, 'flammable = 3'.
Correct inconsistent flammability of wood and stairs in relation
to all other solid wood nodes in MTGame.
Make the the softer woods, pine and aspen, 'choppy = 3'.
2016-08-29 00:24:30 +01:00
Tim
76211624ac Use minetest instead of core namespace, discourage via luacheck 2016-08-09 03:47:27 +01:00
Tim
60cf3f85b6 Doors: Allow the screwdriver to rotate doors around y-axis.
Keep other axis' disabled to prevent the hidden placeholder node to become irremovable to players.
2016-08-05 12:34:46 +02:00
paramat
265c40b558 Doors: Trim open fence gate collision box
Previously, the collision box extended into an empty node, causing
falling node objects to land on the open gate but not transform
back into normal nodes. Now fallng node objects will fall through and
either side of the end of the open gate and transform back.
2016-08-04 03:21:09 +01:00
Tim
00c2dde4ea Doors: Fix potential crashes, code improvements
Fix crash when doors are placed under unknown nodes.
Share a can_dig among doors, that does not crash on nil-player.
Only set can_dig if we actually protect the door.
2016-08-01 01:21:57 +01:00
Thomas--S
72f4c6be48 Doors: Fix orientations of trapdoor textures 2016-07-23 04:56:09 +01:00
Thomas--S
f018e06d9b Doors: Fix trapdoor on_blast
Removing the node above was an error and is unnecessary
2016-07-18 23:45:48 +01:00
Thomas--S
9862bbc8e5 Doors: Same naming for trapdoors as for doors
This makes register_trapdoor act the same as the register_door.
If `name` isn't prefixed, it will be prefixed with "doors:".
2016-07-18 23:43:51 +01:00
tenplus1
0bd13d11cf Doors: Make door groups consistent with corresponding materials 2016-07-15 22:01:20 +01:00
Tim
30b0a155fb Stop shadowing upvalues and definitions. 2016-07-15 21:58:49 +01:00
Tim
4473627de0 Remove unused and clean up missused variable-value assignments.
* Unused variables
* Unused values (assigned to variables, but overwritten before use)
* Defining already defined variables instead of reassigning to them.
2016-07-15 21:58:49 +01:00
Tim
b74954969c Doors: Fix missing node parameter passing 2016-07-13 14:45:18 +01:00
Tim
fcceec0e8c Doors: Fix trapdoor crash on can_dig with nil-player (e.g. minetest.dig_node) 2016-07-10 21:07:17 +01:00
Tim
594365310d Doors: Remove unnecessary node lookups 2016-07-09 16:34:28 +01:00
Tim
71c7e21669 Always return the leftover ItemStack for on_place and on_rightclick 2016-07-09 16:32:41 +01:00
paramat
3d44804074 Doors: Code cleanup
Remove spaces inside curly brackets
Split lines over 90 columns
2016-07-07 18:14:36 +01:00
paramat
60f6564c75 Doors / default: Remove 'hot', 'bendy' and 'melty' groups from nodes 2016-07-07 18:14:36 +01:00
Thomas--S
55fd286083 Doors: Remove use_texture_alpha from door definition 2016-07-01 07:05:19 +01:00
paramat
f796194c69 Doors: Add dedicated sounds for glass doors
Changed node sounds for steel door/trapdoor to stone
defaults instead of wood defaults
2016-06-27 05:32:36 +01:00
Auke Kok
3e9afe097c Doors: Clean up nodedef usage
Allows for more properties to be passed through. Somewhat simplifies
the code as well.
2016-06-21 02:20:47 +01:00
Auke Kok
ba33639887 Doors: Pass pointed_thing to on_rightclick() callback
This is an omission technicality. The callee should be able
to trust this isn't `nil`
2016-05-30 11:55:12 +01:00
Duane Robertson
7681682d28 Doors: Fix uninitialized state variable 2016-05-23 08:37:11 +01:00
Auke Kok
80664f9f8a Doors: Use LBM instead of ABM to convert doors.
This works much more efficiently to replace old style doors.
2016-04-19 02:57:54 +01:00
tenplus1
e38f69d549 Fix doors disappearing while underwater
Currently any doors viewed from underwater will disappear but removing the line 'use_texture_alpha = true,' seems to fix this.  Thanks to Thomas-S for finding this glitch.
2016-04-04 05:39:16 +01:00
Rui
7cba7af894 Rename Glass Door (the obisian one) to Obsidian Glass Door 2016-03-22 15:46:26 +00:00
Auke Kok
ffba9d978e Doors: Allow schematic placement of wooden doors.
If LVM or some other nonmetadata method is used to place a door,
then metadata is missing that tells us whether the door is left
or right-hinged.

However, we can detect that nodemeta is missing and see if the node
name is _a or _b. In the case of _a, nothing needs to be done and we
can just open the door. In the case of _b we assume the door is right
hinged, and tune the state nodemeta value so that the door opens the
right way. This all of course assumes that the schematic method places
the doors *closed* by default, which is reasonable.
2016-03-22 15:45:54 +00:00
Auke Kok
9de43cdf7d Doors: Allow falling nodes to fall onto doors.
We were cleverly attempting to use an airlike node as the
top half of the doors, but as airlike nodes are not walkable,
falling nodes would not stop falling and thus remain an entity
stuck on top of a door.

After inspecting the builtin/game/falling.lua code, I considered
the remaining options: (a) revert doors such that the top part is
actually the door, (b) play with nodedef fields and see if other
flags may work, or (c) modify the hidden door part to another
drawtype that properly prevents this issue.

(a) seemed way over the top for now, although it would solve the
issue, it would cause a rewrite of most of the code including the
old-door-conversion.

(b) turned up nothing.

(c) turned out to be relatively simple.

So, here's the implementation where I turn the hidden door top
into a tiny, non-targetable but walkable nodebox that is entirely
inside the door hinge. It's entirely transparent, so you still
can't see it, can't hit it, nor can you place anything in it or
make liquids flow through it. The top part is placed in the right
position on placement and not touched further.

Falling nodes will properly stop on top of these doors. I've
adjusted the door conversion code to properly account for the
issue as well, so the only thing remaining is people who have
been running a git branch - those can upgrade by re-placing the
door.
2016-03-21 06:17:27 +00:00
Rui914
a2ecc51fbc Create API for registration of fence gate. 2016-03-21 06:17:21 +00:00
Auke Kok
22e32a01ad Allow digging of protected doors with "protection_bypass"
This was probably lost in either the API rewrite or a merge/rebase.

Fixes #929
2016-03-18 02:35:20 +00:00
Auke Kok
cb57f70aab Add steel door/trapdoor sounds.
I've found a favorable steel door sound from a parking garage
door that isn't abrupt or scary, just sounds like a nice solid
metal door. The sample had both opening and closing sounds, and
so they match nicely. Amplified and mixed several samples together
to reduce ambient noise, and get the right level compared to
wood doors. Attribution was added as well. CC-BY-3.0 sounds.
2016-03-18 02:34:43 +00:00