Commit Graph

61 Commits

Author SHA1 Message Date
Ezhh 08706313f4 Add option to disable lavacooling (#1726) 2017-05-07 18:25:53 +02:00
paramat 9e4f0d3689 Leafdecay: Do not restart aready running timers 2017-04-11 03:57:07 +01:00
Thomas--S 6a55e150af Doors: Fix wood/glass doors not opening or closing
Some code was lost during a rebase of a recently merged commit (73e4666).
2017-03-19 00:43:12 +00:00
octacian 07e11427cf Keys: Fix crash when using unconfigured default:key
Since meta secret field is blank on any keys (default:key) obtained using
/give, the game will crash if you attempt to use one of these. This follows
along the principle that the game should never have any reason to crash.
2017-03-17 05:50:50 +00: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
paramat d5f1f964e3 Lavacooling: Return to chance = 2
Return to previous parameters interval = 1, chance = 2.
Compensates for the increase in default active block radius.
Large amounts of lava cooling at once is known to overload sound
creation, producing error messages.
2017-02-25 03:52:26 +00:00
MarkuBu 60e5b299af Leafdecay: Node timer based implementation, API
This implements a node-timer based leafdecay mechanism, and exposes
an API to use it in mods.

The API is documented in game_api.txt.

`default.register_leafdecay(leafdecaydef)`

`leafdecaydef` is a table, with following members:
{
	trunks = { "default:tree"}, -- nodes considered trunks
	leaves = { "default:leaves", "default:apple"}, -- nodes considered leaves
	radius = 3, -- activates leafdecay this far from the trunk
}

The algorithm will drop `leaves` items in the area if no `trunks` are found
in the `trunk_radius` sized area around the position of the leaf. If a node
listed in `leaves` has a group `leafdecay_drop > 0`, then the item is dropped,
otherwise the item is removed but not dropped.

The algorithm also implements a value `default.leafdecay_speed` (default
15) which can be modified to increase or decrease of the leaf decay. The
algorithm will vary the actual speed a bit to introduce randomness.

Leaf decay is randomized by 0.1 seconds to reduce the chance that
decay happens many times on the same second interval. This requires
nodetimer_interval to be set to values lower than 1.0 to have an
effect.

The leaves will decay between 2 and 10 seconds after digging the trunk,
and happen at non-integer second intervals.

-- The API was added by sofar.
2017-02-25 03:50:15 +00:00
Thomas--S 37dd910747 Globalize, rename and change the behaviour of has_locked_chest_privilege
* rename to default.can_interact_with_node()
* pass pos instead of meta
* change order of arguments
2017-02-21 10:17:12 -08:00
paramat ae426878d4 Sounds: Remove 'default_dig_crumbly' from leaves defaults table
Now that the missing 'default_dig_snappy' sound has been added we can
remove the dirt dig sound from the table. All nodes that use the
leaves defaults table have group 'snappy' so 'default_dig_snappy' now
becomes their default dig sound.
2017-01-22 07:47:04 +00:00
SmallJoker 8bc93598c6 Papyrus, cactus: Require light level 13 for growth 2017-01-02 18:30:05 +00:00
paramat 12b1541971 Sounds: Edit some sound gains, mostly footsteps
I recently made glass footstep and dig gains too low, raise slightly.
Change dirt dug gain from above-maximum 1.5 to maximum 1.0.
Reduce gain of footsteps: stone, dirt, gravel, wood, metal
Raise gain of leaves footstep.
2016-12-17 20:02:40 +00:00
paramat 55a16cd2c6 Default: Add missing 'default_dig_snappy' sound
Some nodes with the snappy group (wool, glass pane, seeds) were missing
sound when dug with a sword.
Adding the sound causes it to be used for glass pane, so define a 'dig'
sound in the 'node sound glass defaults' table, use the footstep sound.
Adding the sound also causes it to be used for seeds which deliberately
have no dig sound, so add an empty sound override for seed dig.

Reduce the gain of the glass footstep sound which was excessively loud.

Add some freesound members to license.txt.
2016-12-13 03:15:30 +00:00
Napiophelios 0413cb67b8 Add Cobble Walls to Moss Growth ABM 2016-12-01 12:59:25 +01:00
paramat 09a229b412 Update 'nodeupdate()' to 'check_for_falling()' API 2016-11-22 05:55:36 +00:00
paramat ec95f47021 Default: Add water footstep sounds
Plus one silent sound to break repetition 'default_water_footstep.4.ogg'.
2016-11-21 03:19:37 +00:00
paramat c3f3406e8e Default: Add 'group:cools_lava' for lavacooling by snowblock and ice
Make lava cooling ABM use a new group 'group:cools_lava'.
Nodes other than water can cool lava. We assume snowblock and ice melt,
turn to water and cool lava.
Leave 'group:water' present temporarily to not break mod liquids.
2016-11-18 08:09:45 +00:00
Auke Kok fa9a34554b Default: Add metal sound table function and metal sounds 2016-10-25 02:34:39 +01:00
paramat 3d26b33e5b Default: Add coral nodes and death ABM
Original code by Sofar.
Textures by Pithydon.
Exposure to air converts live coral to coral skeleton.
Live corals drop coral skeleton.
2016-10-12 23:55:46 +01:00
paramat 1906ab84f5 Default/functions: Tune speed of grass spread ABM
Through testing the chance is changed to 50 such that grass spread
speed matches that of the previous (0.4.13) ABM version.
2016-10-05 22:24:02 +01:00
paramat c0de5646d2 Default: Generalise, optimise and simplify grass spread function
Credit to tenplus1 for the suggestion to generalise for mod use.
Mods can add mod nodes to 'group:spreading_dirt_type' enabling the
function to work with mod nodes.

Add some nodes to this group.

Removing 'dirt_with_grass' etc. from 'neighbors' stops the ABM action
running everywhere and constantly, on the dirt nodes immediately below
the surface nodes. Now the action only runs in the rare case of a dirt
node with neighbouring air, grass decorations or snow.

Remove check for air above to allow grass to spread under light-
transmitting nodes such as fences, walls, plants. This causes spread
under slabs, stairs and glass, when near air, but seems worth it.

Remove unnecessary check for nil node.
2016-10-01 23:15:05 +01:00
paramat 2ecbc43a7a Default: Optimise and simplify leafdecay ABM, remove cache
With thanks to contributor tenplus1
Remove leaf cache and globalstep accumulator limiter
Use 'pos' instead of 'p0'
Remove non-essential 'group:liquid' from 'neighbors'
Increase chance value to 10 to compensate for disabled cache
Disable 'catch-up' to avoid the ABM often becoming 10 times more
intensive
Remove use of 'do preserve' bool, instead simply 'return'
Remove unnecessary checks for 'd' and 'd == 0'
Don't 'get' n0, use already present 'node' instead
Swap order two conditionals so that the one most likely is first
2016-08-15 20:42:50 +01:00
tenplus1 619ac52693 Add labels to ABMs
Useful for searches and the mod profiler.
2016-08-09 03:56:37 +01:00
paramat 0ac096991c Default: Prevent placing sapling if grown tree intersects protection
Add a global 'intersects protection' function to functions.lua for
checking if a specified volume intersects with a protected volume.
A 3D lattice of points are checked with an adjustable interval.
Add a global 'sapling on place' function to avoid duplicated code in
nodes.lua.
2016-07-27 21:39:22 +01:00
Auke Kok 2199be5108 Stairs: Add mossy cobble slab and stair
Allow water to turn cobble slab and stairs to turn into mossy versions.

There is no crafting recipe for mossy stairs and mossy slabs, the
stair/slab API has been modified to allow for a recipeitem that
is `nil`, which will omit adding a crafting recipe for these two
items. The API documentation is updated.

The slabs and stairs will turn mossy when water is adjacent, just like
cobblestone. You can either farm mossy versions by placing them in
water for a while, then collecting them, or run water over your craft.
2016-06-14 23:28:17 +01:00
Foz 1a6298958e Default: Add function 'node_sound_gravel_defaults()' 2016-04-29 23:19:30 +01:00
Auke Kok 54b87e955d TNT: Add on_blast to all nodes with an inventory
Adds a minor helper function that allows efficient retrieval of
several inventories from a node inventory. We use this helper to
quickly retrieve the items in chests, vessel shelves, book shelves
and furnaces, and return these with the nodes itself to the TNT caller.

The TNT caller then performs the entity physics, and we don't need
to do anything else.

We disable TNT doing anything with bones.

We expose a bug in the code that drops the items - metadata was lost
entirely. This patch corrects that by properly copying the metadata
and creating the drops list inclusive metadata.
2016-04-26 22:33:59 +01:00
paramat 0ca43e42bc Default: Create 'grass', 'dry_grass' groups, use in dirt conversion ABM 2016-04-18 01:52:03 +01:00
Auke Kok 7d93272caa Change how dirt turns to dirt_with_(something)
This changes how dirt blocks turn to dirt_with -grass, -dry_grass
or -snow.

Previously, dirt that was sunlit would turn to dirt_with_grass no
matter what, but this happened without any context, so you could
get green patches of dirt_with_grass in the middle of a savannah or
even desert.

Dirt no longer turns to covered dirt unless it's within 1 node from
another dirt_with_grass or dirt_with_dry_grass or dirt_with_snow.
This makes dirt_with_grass "growback" a lot slower, since it now only
happens on the edges, but it retains the context nicely now.

If there is any dirt with a grass or dry grass plant, or snow on top,
and enough light, we'll convert it sporadically to dirt_with_grass
or dirt_with_dry_grass or dirt_with_snow.

This allows us to plant grass of our choice in a large dirt patch,
or in a region where otherwise that type of grass is not present.

This used to be done by 2 abms, but I've combined them in to a single
ABM that is ordered to run with maximum efficiency, solving for the
most common outcome first before attempting more complex checks.
2016-04-16 19:27:34 +01:00
Auke Kok 64fe69f382 Remove "grass under snow" from default:dirt_with_snow in darkness.
This is technically "dirt with grass" that's just under a snow
cover, so in darkness the grass on these nodes will also die,
turning it into dirt.

This doesn't convert dirt_with_snow under snow.
2016-04-16 19:27:34 +01:00
paramat 14334a1d89 Default: Reduce sand footstep and dug sound gains 2016-03-25 13:15:22 +00:00
Auke Kok d979293f14 Convert fences to NDT_CONNECTED.
This changes the drawtype of fences to NDT_CONNECTED nodebox drawtype.

These nodes are drawn by the client with the needed connections on
the fly as the scene is drawn. There is no logic needed by mods to
modify the nodes.

These fences connect to (1) other fences, (2) planks and (3) tree
trunks, but nothing else. They do not connect to stone, dirt, wool,
etc. This is done by the "connects_to" parameter, which takes groups
and node names.

Due to the way textures are wrapped, we can make these nodes look a
lot better by giving them a special tile.

This change requires minetest/minetest#3503.
2016-03-13 04:10:51 +00:00
MT-Modder 3a55e19055 Control leaf decay with sneak.
As requested by @paramat.
Leaves are preserved by default and only decay when using place + sneak.
2016-02-23 20:35:08 +00:00
paramat 7d2dfe4101 Consolidate ABMs
Spread ABM intervals evenly across 1 to 16 seconds
16s ensures no nodes are missed when player walks past
Adjust chance values to compensate, for identical action rates
Combine lavacooling ABMs into one, return to chance = 1
Grass growth: add 'neighbors = "air"' to avoid
processing the thousands of underground dirt nodes
Grass death: Reduce action rate to that of grass growth
Fire: Use chance = 1 for flame extinguishing
and flame removal when mod is disabled
2016-02-14 05:22:20 +00:00
Auke Kok 2f39cad09b Create API for fence.register, and use it.
This converts the call to minetest.register() for the default
fence node, so it can be called by other mods to quickly
setup other fences.

Since this creates an API, insert it into the game_api.txt.

The api looks like minetest.register(name, {def}), and has two
uncommon fields: "texture" and "material". Any normal nodedef
property can be passed through, except "drawtype". The "fence"
group will always be added.

The default fence recipe is modified to be as follows:
  wood, stick, wood
  wood, stick, wood

This recipe yields 4 fence nodes.

This allows us to create according recipes for acacia, pine,
aspen, and junglewood fences without adding new stick types:

  pine wood, stick, pine wood
  pine wood, stick, pine wood

This is a from-scratch implementation, written by heart but inspired
by (#665 - Add many wooden fences).

Stick and fences nodes are named in a consistent way.
2016-02-03 19:33:19 +00:00
paramat e41a411f1c Default, fire: Disable catch-up in some ABMs
To avoid processing spikes where catch-up is non-essential
Disable in: Lavacooling, grass growing, grass removal
and all fire mod ABMs
2015-11-14 04:49:03 +00:00
paramat 2729777b94 Default/functions: ABM for mossycobble replacing cobble next to water 2015-10-25 23:11:29 +00:00
paramat f4a412d9c1 Papyrus: Grow on dirt and grass only, remove from desert ocean 2015-10-05 01:47:37 +01:00
paramat 4d9b595a69 Default: Allow papyrus growing on default:sand
Mgv5/mgv7 papyrus schematic now has sand nodes as a base
Add sand beach to mgv5/mgv7 deserts
2015-08-31 22:58:33 +01:00
paramat 547a7b3304 Default/functions: Reduce lavacooling ABM/sound overload 2015-08-04 01:01:25 +01:00
paramat 6843ddb814 Default: Add savanna nodes, textures, crafting and fuels 2015-07-12 22:41:59 +01:00
paramat f92d49feff Default/functions: Fix cactus growing by rotation again. Cleanup code 2015-06-08 00:32:40 +01:00
paramat 016fa0da40 Default/functions: Fix cacti not growing when rotation is 1-3 2015-06-07 04:39:25 +01:00
HybridDog fe3c5a7090 allow overriding papyrus and cactus grow functions
dont grow cactus on a lying one

use minetest.get_node 2 times less

do a bit what ShadowNinja wrote

add comment

return true if the plant is set
2015-04-27 01:09:32 +01:00
Craig Davison a9137e8c21 Fix typo in survival formspec & create legacy file 2015-02-12 22:18:22 +01:00
PilzAdam 2edfb55c29 Restructure default/nodes.lua 2015-01-10 15:47:30 +01:00
PilzAdam 2c0f716a13 Remove useless, empty callbacks 2015-01-10 15:47:29 +01:00
PilzAdam 9ec33f34f1 Set param2 to 1 if player places leaves 2014-12-06 20:36:20 +01:00
PilzAdam 2c2edfad04 Move leafdecay doc to game_api.txt 2014-12-06 20:36:20 +01:00
Craig Davison 128f0adb24 Fix some undeclared global variables 2014-11-30 18:02:33 +01:00
ShadowNinja 9670c27161 Clean up treegen code 2014-09-16 18:38:11 +02:00