Commit Graph

82 Commits

Author SHA1 Message Date
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
paramat
c17c317669 Doors: Update glass door item textures to new design 2016-03-15 16:23:05 +00:00
Auke Kok
7c966db4bc Fencegate: prevent y-fighting at top.
We raise the height of the fencegate node by 0.0001 to make the
fencegate post stop fighting with node blocks. This makes the
gate pole appear to be cut through the node, and doesn't leave
a gap when stacking fencegates, which would look odd.
2016-03-15 16:22:58 +00:00
Auke Kok
dfee51c21e Clean up door tops if fire destroys bottom.
Fixes #909. Door tops are never flammable.

This doesn't guard yet against a voxelmanip removing the top node,
but that is less of an issue since if a voxelmanip removes the top,
then the bottom part remains functional and visibly intact. If the
voxelmanip removes the bottom part, but not the top, then this patch
makes it clean up the top just fine.
2016-03-13 04:49:21 +00:00
Auke Kok
2fb40be409 Add "protection_bypass" priv.
The access privilege allows players that have it to bypass protection
on locked doors/trapdoors, chests and bones.

The priv also allows bypassing any minetest.is_protected() check,
including digging nodes and placing them. It is meant for world
moderators to clean up and fix map issues.

Original patch by red-001. Split up and rebased/rewritten by sofar.

This patch requires https://github.com/minetest/minetest/pull/3800
2016-03-13 04:48:57 +00:00
Auke Kok
b998ab1b3a Add a simple, but stylish fence gate.
This fence gate builds on NDT_CONNECTED by assuming fence nodes will
automatically connect to it's sides properly. The fence gate will
open and close just like doors, with sounds, but it only opens one
way. The gate sticks out quite a bit and can be bumped into, so the
fence may be used as some sort of path switch.

The fence gate offers no form of protection and can be opened and
closed by anyone. This is done on purpose - the fencegate isn't
meant to provide protection from players, as fences can be
trivially jumped over. Instead, these fences should be used for
protecting crops from hungry sheep, or keeping rabbits in their
pen, or just decoration. Mods can also modify the mod to add
protection, of course.

A recipe is added to make these. It's 4 sticks and 2 wood (any)
as follows:

  stick  wood  stick
  stick  wood  stick

The collision box of the open gate is such that if two gates are
connected but mirrored (making an M shape) then you can walk a large
entity that's larger than 1.0 wide through the opening. The gate of
an opened fence can also be stood upon or bumped into.

I've mixed together some sounds to provide a somewhat light sound
experience, one that one would expect from a small gate latching open
and close.

This change requires #873, otherwise it doesn't connect to fences.
2016-03-13 04:11:03 +00:00
MT-Modder
29252c6fb2 Allow non-players to dig steel doors. 2016-03-03 00:37:01 +00:00
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