Commit Graph

56 Commits

Author SHA1 Message Date
Auke Kok
00a0d9a5d4 Doors: Prevent placement in protected areas.
https://forum.minetest.net/viewtopic.php?f=42&t=1523&start=500#p208773

Currently, doors can be placed inside others' protected areas. We
need to check protection for both bottom and top halves.
2016-02-29 20:29:47 +01:00
Auke Kok
2c355a8642 Allow mod namespace for door registrations.
This is an adapted version of #861 - by oleastre

Most mods had been calling `doors.register_door() with a door
name that included the "modname:" prefix, and we should continue
to allow mods to do so, without registering the nodenames created
in the "doors:" namespace.

The default case is to use the "modname:" prefix verbatim. If
mods or code calls this function without a prefix, then "doors:"
is automatically used.

Now that the namespace is corrected, the copy replacement ABM is
no longer needed.
2016-02-23 20:34:23 +00:00
Auke Kok
777088481b Fallback doors.register_door() code.
This function maps doors.register_door to the new API as far as
reasonable. We can't map the texture, so we fall back to a default
texture. An error message is printed if mod writers did not provide the
needed new tiles field for the door. The created doors are functional
and a full replacement. Old doors are replaced with the new ones
through an ABM.
2016-02-23 20:34:23 +00:00
Auke Kok
6b055ae18a Fix broken door protection.
A previous fix overwrote the `def` variable during registration,
causing protected doors no longer to be placed with protection.
2016-02-23 20:34:23 +00:00
Auke Kok
ed9fd475de Call on_place_node() callbacks after placing door.
Other mods may depend on knowing whether doors are placed
to setup additional attributes or perform node manipulations.

This is something e.g. mesecons does to connect circuits
to doors. This was tested with mesecons. Placing a door next
to a mesecon wire will make the wire automatically
connect, which was otherwise not happening.
2016-02-19 19:54:55 +00:00
Auke Kok
2cc6640edf Open doors when right-clicking a door with a door.
And similarly, if we wield a door and right click any node
that has an on_rightclick() handler, call the handler
instead.

Just to be on the safe side, assure that none of this
code runs when right-clicking an entity or player, which
would likely crash the server.

Fold in PR #831 as well - prevent server crash on door
place on unknown blocks, by @tenplus1.
2016-02-19 19:54:50 +00:00
Auke Kok
bbf17c9eca Allow building doors on buildable_to nodes.
This code never allowed placing a door on e.g. a grass
plant. The code to handle this isn't that complex. With
this code, doors can be placed on flowers and on normal
node surfaces without issues.
2016-02-19 19:54:50 +00:00
Auke Kok
363b95c003 Doors: Allow arbitrary recipe to be passed, even nil
This allows mod makers to register their own recipies, including
none, to register doors.
2016-02-18 13:57:09 +00:00
Jean-Patrick Guerrero
04f01bc57f Doors: fix unability to register doors outside of doors mod 2016-02-13 18:37:16 +01:00
Auke Kok
f600a9f645 New mesh door models, and extensive door API
This patch replaces the default door nodes with a new mesh model
and nodes.

Two new models were added that are 2 blocks high. One for left-hinge
and one for right-hinge doors. This allows us to make a single texture
fit on both models. The alternative would have been 1 model and 2
unmapped textures, which is more work for mod developers.

Doors work exactly like the old doors, including ownership, breaking
doors, opening and closing.

Under the hood, we can prevent the top part of the door from being
obstructed by placing an invisible node. This prevents liquids from
flowing through doors or people placing sand or other blocks in the
top half. The door code automatically places and removes these as
needed.

Metadata is used to store door state, just like the old version.

A doors API is added, it allows mods to use the API to open/close or
toggle door states without worrying about sounds, permissions and
other details. This is intended for e.g. mesecons. This API allows
mods to manipulate or inspect doors for players or for themselves.

In-game old door nodes are automatically converted using an ABM and
preserve ownership and orientation and state.

TNT blows up all doors and trapdoors except for the steel ones,
who can survive a blast. We return an itemstack in on_blast(),
which requires a TNT API patch which is also pending.

We enable backface culling for most of these doors, as this gives
the identical visual appearance that the old doors had. In the case
of the glass door, there's a slight twist.

The texture files used by the new doors have new names that do
not conflict with previous texture file names to avoid texture
pack conflicts.

Thanks to red-001 <red-001@users.noreply.github.com> for some
of the conversion code, cleanups, and extra textures.
2016-02-13 03:47:28 +00:00
Auke Kok
322967d2d1 Better trapdoor side appearance.
We're using a normal wooden side texture to draw the sides
of trapdoors. But the side textures have only 2 edges that
have a nice texture for the 2px wide trapdoor. We can
either repaint the textures, or just rotate the texture
properly for the two sides that need it.

Because the side texture for wooden doors was just a default:wood
texture, it clashes with the colors in the trapdoor, and so
we add a wooden trapdoor-matching tile side texture as well.

This also improves the steel trapdoor side, but without a
texture change there since that was already a specially
drawn texture for that node.

We also increase the thickness of the trapdoor to 2px. Right
now the model is 0.4 large, but this causes the side textures
to look odd as there's a mismatch in pixel size. By scaling the
trapdoor side up to exactly 2px, the sides look natural.

Thanks to @kilbith for the suggestion.
2016-01-20 22:17:25 +00:00
Auke Kok
f41314185e Allow trapdoors to be rotated all ways.
There really is no reason to prevent rotation in trapdoors, I
expect this to be an oversight.

Trapdoors work perfectly well sideways, upside down and can
work like fences, gates and more. Most commonly, people will
want to put them in the top half of the node so they remain
flush with a floor.
2016-01-20 22:17:13 +00:00
Auke Kok
535e611eb1 Fix trapdoor recipe conflict with iron bar recipe.
In oversight, I added this recipe not verifying that it was already
taken.

We change this to a 2x2 iron bar recipe. The shape and amount are
reasonable (reduced to output 1 steel trapdoor), and I verified that
it wasn't in use.

Fixes #779
2016-01-12 04:03:19 +00:00
Auke Kok
9542d119f6 Fix endless trapdoor bug.
Closes #770 - thanks to @tenplus1, @kilbith
2016-01-05 23:29:24 +00:00
Auke Kok
e9a7782c88 Steel Trapdoor.
Adds a steel trapdoor. Textures were painted from scratch, and
inspired by the current Steel Door. Ownership on the trapdoor
works as expected, and so does the crafting recipe.
2016-01-03 02:11:40 +00:00
Auke Kok
481d1758ad Fix door volume level.
Playing stereo sounds positionally in OpenAL causes it to play
the sounds unattenuated - same volume for all distances. This
shouldn't happen, and makes door sounds unneccesarily loud from
very far away.

Convert all door samples to mono, 22kHz 64kbit.

Trimmed all door samples to remove lead, trail silence.
2015-12-28 21:41:15 +00:00
paramat
8e51f318b3 Rename to Minetest Game
Rename in game.conf and documentation
Update game_api.txt documentation for bucket API and tree functions
Fix tab, space and comment formatting in game_api.txt
Rename in mod READMEs
2015-09-30 23:33:12 +01:00
Christian Wischenbart
35de5241f4 Fixed invalid check. This fixes minetest/minetest_game#609 2015-08-11 18:56:15 +02:00
paramat
e15fde1624 Fix is_ground_content settings for nodes
Remove line if set to the default of 'true'
2015-06-18 02:25:02 +01:00
Novatux
46c6154444 Make doors not depend on screwdriver. 2015-05-14 14:24:14 +02:00
Novatux
2824562dc9 Add screwdriver callbacks, and code them for doors and beds 2015-05-14 10:24:56 +02:00
Novatux
81259e9fcc De-duplicate code in doors mod in make_on_blast 2015-05-12 20:55:46 +02:00
Novatux
4bd1094619 Fix problems with TNT 2015-05-12 16:53:04 +02:00
Wuzzy
8bc8dd64c5 Make TNT respect on_blast, implement on_blast for some nodes
Implemented nodes:
- Steel Door: Ignores explosion
- Locked Chest: Ignores explosion
- Fire: Ignores explosion
- TNT: Starts burning
- Burning TNT: Explodes immediately
- Gunpowder: Starts burning
- Burning Gunpowder: Ignores explosion
2015-05-12 16:32:52 +02:00
jp
f86ac2fdff Optimize textures and model (use *.b3d instead *.x) 2015-02-28 22:33:19 +01:00
Jeija
03c00a831d Clean up trapdoors code and make them more flexible, so custom trapdoors
can be registered by other mods
2015-02-14 00:48:28 +01:00
Xanthin
047ecea3a2 Make trapdoor better visible when held in the hand
Screenshots at: https://github.com/minetest/minetest_game/issues/411
2015-02-12 16:51:32 +01:00
Xanthin
4468015cbe Fix typo for obsidian glass door texture
I think that was just a typo?
2015-01-24 20:40:08 +01:00
Craig Davison
6157982787 Follow naming convention of textures and sounds in doors 2015-01-17 16:05:23 +01:00
Craig Davison
128f0adb24 Fix some undeclared global variables 2014-11-30 18:02:33 +01:00
Amaz
8007c142de Added the new door textures 2014-11-30 17:34:35 +01:00
Zefram
a1aee9a68f Fix door hardness detection for open/close sounds 2014-08-07 13:47:01 +02:00
Jat
5dbc738dbd Add API doors : Sound for door open and close. 2014-08-07 12:42:37 +02:00
Zefram
ea3fcdd077 Pair door with door of any type
Mirror the setup of a door placed next to any door, not just next to
a door of the same type.  This is particularly useful where there are
multiple door types that have the same appearance, but one wants the
doors of a pair to have different behaviour in some other respect.
2014-07-22 13:41:32 +02:00
Zefram
820e48badc Make open trapdoor climbable
When a trapdoor is mounted upside down, to make its top surface flush
with the floor above when closed, it is necessary to have some way to
climb through the trapdoor node when it's open.  Making it climbable
like a ladder satisfies this need.  It is somewhat realistic, as a real
trapdoor can have a ladder segment mounted on one face.  When the trapdoor
is mounted in its default orientation, making the bottom surface flush
with the ceiling below when closed, the climbability when open is not
strictly necessary, but is still a convenience.
2014-07-22 13:04:45 +02:00
BlockMen
584718a2a7 Rename functions, update API 2014-07-06 10:54:47 +02:00
David Gumberg
e106fd51ca Compress all textures losslessly using optipng and advpng 2014-07-05 16:06:00 +02:00
PenguinDad
da9579846c Added Glass and Obsidian Glass door (doors mod) 2014-07-05 16:02:17 +02:00
ShadowNinja
d5fcae085d Remove trailing whitespace from doors 2014-02-12 18:26:48 -05:00
ShadowNinja
3e2781bc00 Add protection support to doors 2014-02-12 18:26:43 -05:00
Novatux
47a49eccf4 Use minetest.swap_node instead of hacky_swap_node 2013-12-08 18:12:44 +01:00
Sfan5
c2ce3d032e Pngcrush all Textures 2013-05-25 16:20:35 +02: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
PilzAdam
d6ec56811b Use common mods 2013-03-21 18:44:36 +01:00
PilzAdam
6c70e0295a Dont place doors if node under it has on_rightclick 2013-03-01 17:40:26 +01:00
jojoa1997
86cff038a4 makes wood doors craftable from wood group 2013-02-12 15:46:03 -05:00
Lord89James
716397819d Update mods/doors/init.lua
Fix door's glitch in creative mode
2013-01-26 17:00:15 +01:00
PilzAdam
686c0d087c Open/close doors with rightclick 2013-01-05 17:25:19 +01:00
PilzAdam
5311c6ec96 Replace the doors mod 2012-11-28 14:43:49 +01:00