Commit Graph

855 Commits

Author SHA1 Message Date
Auke Kok
e6cef57661 TNT: Move timer start to on_create() for burning nodes.
We add on_create() handlers for both burning TNT and burning
gunpowder. Because gunpowder will explode TNT in 1 second,
and not 4, we need to modify the 4 second timer after we
make the TNT burning. Other mods can now place burning TNT
that will by default explode after 4 seconds.
2016-04-16 19:27:16 +01:00
Auke Kok
0736d30e33 TNT: Fix up nil derefs
I spotted two places where under stress (many explosions) luajit would
end up passing nil to these functions. I'm not entirely sure how,
but it seems good form to guard against it, which does make it
more robust. After this patch, I'm not able to crash the server. With
many explosions, it may still lag significantly, but always returns
in the end.
2016-04-16 19:27:16 +01:00
Auke Kok
da5f4a939e Fix API docs after various changes. 2016-04-16 19:27:16 +01:00
red-001
a84e2669c7 Restructure code to only check def once. 2016-04-16 19:27:16 +01:00
Auke Kok
ccee025ce3 Calculate blast intensity at all locations.
We define the blast intensity as the square of the tnt_radius, divided
by the square of the distance to the explosion center, where distance
is limited to 1 at the lower end.

When destroying nodes, we calculate the intensity for each node, and
only destroy the nodes when the intensity is 1.0 or larger. To avoid
perfectly spherical explosions, we make sure to retain a randomness
factor of 20%. This will make explosion edges jagged and not smooth,
but not too much.

We pass the calculated intensity to on_blast() functions as well,
except we take the jitter here out and make sure it's always 1.0
or larger.
2016-04-16 19:27:16 +01:00
Auke Kok
8c801529df TNT: Limit amount of stacks ejected.
We apply a log scale to the size of the stacks ejected, so that
in larger explosions we are getting larger stacks. For normal r=3
explosions, this gives stack sizes ~6-7 or so, but for r=10 explosions
it could end up giving stacks of 25+.V
2016-04-16 19:27:16 +01:00
Auke Kok
3ddff2fbea TNT: Chain reaction
With the new high res timer, we can make TNT much better create chain
reactions. This does exactly that.
2016-04-16 19:27:16 +01:00
Auke Kok
eafd1ebc43 TNT particles: use drops list smartly
The drops list already has quantities, so let's just select the one
with the highest quantity from it, and use that as tile. Fallback
tile will therefore only be used if explosion happens in air. Oh well.
2016-04-16 19:27:16 +01:00
Auke Kok
3623398b78 TNT: Spacing / codestyle fixes
- Fix spacing errors around = and ..
- Indentation fixes
- Break up long lines
2016-04-16 19:27:16 +01:00
red-001
b25889e742 Make TNT faster by using VoxelManip() for removing nodes. 2016-04-16 19:27:16 +01:00
red-001
9f4dc1412b Fix TNT mod calculate blast intensity.
Currently the TNT mod uses a dummy vaule of 1 for this.
2016-04-16 19:27:16 +01:00
red-001
cfef21f4d9 Add TNT API. 2016-04-16 19:27:16 +01:00
Auke Kok
8556dd30e2 TNT: add some depth to the explosion effect
We add a dirt-like particle (drawn from scratch, uses some
colors from default_dirt's palette) to spawn many particles
that have collision enabled around the center of the blast.

This has the effect of obscuring the center of the blast, as
that is a painfully visible empty area when the explosion happens,
as there's only a little spark.

The dirt particles bounce around the walls and floor a bit,
and disappear rapidly, well before the smoke particles disappear.

This is a nice visual distraction that obscures the sudden
appearance of the gaping hole, and makes it a whole lot more
believable.
2016-04-16 19:27:16 +01:00
Auke Kok
8cd049c224 Make TNT a bit more fun.
But not too much.

TNT is a bit underwhelming at the moment. We can make it a bit
more interesting by ejecting not just one or two itemstacks,
but a bunch of them. This code splits up the drops into
separate itemstacks that are 2-5 items together, which
results in generally roughly 10 itemstacks being ejected.

Since now we have multiple ejecta, it makes sense to tune
the ejecta velocities a bit better to get the appearance of
an actual explosion better. The items will not all start
with the same vertical velocity, since that would look
like fireworks. Instead we give them all a different vertical
speed.
2016-04-16 19:27:16 +01:00
Auke Kok
12d5ca2f48 Allow the on_blast API to pass an itemstack.
If the node is special and has an on_blast() handler, we need
to call it instead of getting node drops manually. However, we
do want to know if drops should be added for the special nodes,
so we modify the on_blast() handler code to allow the nodedef
handlers to pass back itemstacks. This could be used by e.g.
the doors mod to drop door items after a blast.

Since this API is documented in lua_api.txt, a separate PR will
be incoming to update the on_blast() documentation.
2016-04-16 19:27:16 +01:00
Auke Kok
3ecafbcfb4 Remove composed shelf side.
Don't compose the shelf side texture. The texture isn't transparent,
and unlikely to be in any case.
2016-04-14 02:46:03 +01:00
kilbith
082b36d3e7 Books: Split text per page relatively to number of lines 2016-04-14 02:45:57 +01:00
kilbith
7be008936e Flowers: Fix itemstack when waterlily is placed 2016-04-12 01:28:16 +01:00
tenplus1
6e1a329763 default: Strengthen obsidian glass Remove group 'oddly_breakable_by_hand' 2016-04-12 01:27:55 +01:00
kilbith
47b197e4d5 Flowers: Cleaning of waterlily's placement 2016-04-08 01:13:14 +01:00
paramat
be05441e77 Farming: Override dirt_with_dry_grass to enable cultivation 2016-04-08 01:13:05 +01:00
paramat
aadac1223d Default/mapgen: Denser rainforest, fewer logs 2016-04-08 01:12:56 +01:00
kilbith
9a6cb2d7c8 Creative: Add myself in credits
Some people borrowed the creative code for their sub-games with an exclusive attribution to celeron55.

This is frustrating since I've largely rewritten, redesigned and carefully maintained this mod for the last months.

I expect to be credited.
2016-04-04 05:39:29 +01:00
Auke Kok
f4e77edcc6 Flood snow with either lava or water.
Fixes #1005

This doesn't flood snow or ice blocks.
2016-04-04 05:39:23 +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
Auke Kok
874b1ae326 Beds: Check for buildable_to for bottom half
We properly checked top half already, just not the top half
target location.

Assure both checked positions are not unknown nodes.

Fixes #991
2016-04-04 05:39:06 +01:00
Auke Kok
1977ae19ae Boats: Optimize, re-UV unwrap.
The boat model had over 1700 tris (!) before this redo. I've reduced
the amount of tris to ~150, which is very reasonable given that there
are almost 45 faces to this model.

I've also spent a good hour re-UV unwrapping the entire model which
has a huuuge impact on the boats' appearance. As much as possible,
the boat now looks like it's made out of actual blocks of wood,
and I've even attempted to make the grains connect around edges,
appear in the same pattern and spacing, and generally make it look
like it's just a nice crafted thing out of several pieces of wood.

I've had to tweak the rudder part to make the texture actually have
square texture pixels. I did that by varying the vertical position of
the botton of the rudder handle and the top of the rudder bottom, which
worked well. I also had to 'slice' the rear face of the boat to prevent
a strange texture tear, probably due to non-flat surface somewhere,
but I couldn't spot the issue there anymore after adding 2 extra edges.

This looks totally like a new boat now.

 - http://i.imgur.com/stiVzsa.jpg
2016-03-30 23:11:12 +01:00
Rui
7bbbcbf7b0 Fire: Use get_item_group instead of get_node_group 2016-03-30 23:11:04 +01:00
Auke Kok
4d7dbfc826 Start timer as well when moving items around.
It's possible to hit this when using an e.g. charcoal mod
where a tree is both a fuel and a source.
2016-03-30 23:10:59 +01:00
tenplus1
787ccb5747 Add recipe to craft clay block back into lumps
Added a recipe to craft a clay block back into 4 clay lumps.
2016-03-30 23:10:52 +01:00
Jean-Patrick Guerrero
12bcfeab4d Shelves: Fix listring functionality + code cleaning 2016-03-30 23:10:46 +01:00
paramat
14334a1d89 Default: Reduce sand footstep and dug sound gains 2016-03-25 13:15:22 +00:00
Jean-Patrick Guerrero
6749da1070 Books: Ensure backward compatibility for older written books 2016-03-25 13:15:12 +00:00
Jean-Patrick Guerrero
7a29d26e3e Fire: Allow placing only above flammable blocks 2016-03-25 13:15:04 +00:00
Rui
7cba7af894 Rename Glass Door (the obisian one) to Obsidian Glass Door 2016-03-22 15:46:26 +00:00
Jean-Patrick Guerrero
a71948c007 Books: Move page buttons at the bottom 2016-03-22 15:46:19 +00:00
Jean-Patrick Guerrero
c3d2bc383b Wooden Sign: Add group oddly_breakable_by_hand 2016-03-22 15:46:13 +00:00
paramat
7d55320d5c Default: Make some plant nodes non-flammable 2016-03-22 15:46:07 +00:00
paramat
0d3bca790c Default: Fix rotation errors for mapgen aspen and sapling jungletree 2016-03-22 15:46:00 +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
Jean-Patrick Guerrero
1a5f89e750 Creative: Code cleaning + Fix items moving in virtual inventory 2016-03-22 15:45:48 +00: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
paramat
537f94c28e Fire: Speed up fire spread and burn out 2016-03-21 06:17:50 +00:00
Auke Kok
da0cc7f6f6 Beds: priv/griefing fixes.
- disallow placing beds in protected areas
- fix rotation of beds(broken after 41c2b2ae)
- allow using others' beds, but don't change spawn location

Fixes #953. #943 isn't something I think was ever implemented, and
this does a fair job of addressing the main concern (spawning in
others' houses)
2016-03-21 06:17:45 +00:00
Jean-Patrick Guerrero
b57dd0f9b2 Books: Add support for multiple pages 2016-03-21 06:17:40 +00:00
Rui
8fdcfea9f9 Allow for shift+clicking inventory from bones 2016-03-21 06:17:33 +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
James Stevenson
d90a081722 Rename argument to priv check
Fixes crash when punching bones not owned by you, and may resolve https://github.com/minetest/minetest_game/issues/940
2016-03-18 02:35:38 +00:00
Auke Kok
70248505ae Walls: Don't connect to group:cracky
the ```group:cracky``` group contains all sorts of odds and ends
nodes that we shouldn't connect to. There are a few nodes that
walls now no longer connect to, that probably should get
```group:stone``` added, or something similar, though.
2016-03-18 02:35:28 +00:00