1
0
mirror of https://github.com/minetest/minetest_game.git synced 2025-06-28 20:56:02 +02:00

164 Commits

Author SHA1 Message Date
d6a66860af Prevent divide by zero (#2106)
This forces all explosions to damage entities within the 1 node
range. If that needs to be disabled, the damage_radius needs to
be set to 0.
2018-05-18 12:50:47 +02:00
6d850f23a5 Flower spread ABM: Optimise
Match maximum spread density to maximum mapgen density for flowers.
Place 3 flora nodes at once instead of 1.
Change ABM chance value to 300 to match previous spread rate.
ABM becomes 3 times less intensive.
2018-05-18 12:50:47 +02:00
2c1af0861f Doors: Avoid crash on nil player in 'can dig door' 2018-05-18 12:50:47 +02:00
d2ae721235 Stairs: unbind table groups (#2036)
Unbind table groups for base block, stairs, slabs.
2018-05-18 12:50:18 +02:00
01db55cee5 default:dirt_with_snow: Re-add to soil group
Previously, saplings were not growing if the dirt they are on turned to
'dirt with snow' before growth.
Also for consistency with other dirt nodes.
2018-05-06 20:44:30 +02:00
4ba2b5179e Furnace: Fix being able to cook items without enough fuel
This was triggered when too much time had elapsed when timer was called.
Also, fix timer resolution giving free fuel time.
2018-05-06 20:44:30 +02:00
a5092c0df6 creative: Add missing tooltips. 2018-05-06 20:44:30 +02:00
575c098bae Book textures: Reset colour profiles to remove warnings 2018-05-06 20:44:22 +02:00
cddd59b578 Book textures: Replace with more original textures 2018-05-06 20:40:45 +02:00
7a4b1e0ce1 Default: Make burntimes more rational and consistent 2017-12-05 21:24:02 +01:00
0216fa08ec Add nil checks for placer 2017-11-19 23:03:38 +01:00
ca3e807d35 Creative: Make the placenode registration check for non-player placers 2017-11-19 23:03:38 +01:00
ca38bb2390 Creative: Make handle_node_drops override work for non-player diggers 2017-11-19 23:03:38 +01:00
7d07c52d09 Books: Convert \r to \n
Some files or editors may use \r instand of \n like notepad++. If you copy
text written in notepad++ and pasted into the book. The book will only have
one page.
2017-11-19 23:03:38 +01:00
532013a032 Creative: Cache inventory items on load 2017-11-19 23:03:38 +01:00
a52622669f TNT: Add tnt.boom defaults
This adds def, def.radius and def.damage_radius defaults to the
tnt.boom() function if they aren't specified on call.
2017-11-19 23:03:38 +01:00
ce5e668681 Bones: Return bones when taking the last ItemStack 2017-11-19 23:03:38 +01:00
6530fa914b Flowers: Add waterlily right-click checks
Check for on_rightclick functions of nodes when holding a waterlily.
2017-11-19 23:03:38 +01:00
86eb0e1617 Sfinv: Remove possibility of infinite loop when homepage doesn't exist 2017-11-19 23:03:38 +01:00
93fb9b36ce Sfinv: Rename navigation tabs to reduce chance of a conflict 2017-11-19 23:03:38 +01:00
09e3505ea1 Chests: Fix locked chest protection against explosions (#1886)
Fixes #1885
2017-11-19 23:03:38 +01:00
cecbfc1676 Chests: Fix open chest after player leave (#1884)
This should fix the chest staying open when a player disconnects while inside.
2017-11-19 23:03:38 +01:00
fba6f6a4cf TNT: Add explode_center flag
Add 'explode_centre' flag which when false explodes as normal and when true runs on_blast on centre node as well as dropping items.
2017-11-19 23:03:38 +01:00
6053456af1 Mushroom spread: Optimise and make overridable
Move mushroom spread ABM action into a global and overridable function.
Optimise spread code.
Reduce spread range to reduce spread through walls.
2017-11-19 23:03:38 +01:00
cc2f75b2f9 Register fence: Allow setting nodedefs to 'false' 2017-11-19 23:03:38 +01:00
b6ef71c92e TNT's tnt:boom cleanup (#1868)
The tnt:boom node doesn't actually need the on_construct and on_timer functions to remove the node after 0.4 seconds as the tnt_explode function already does this beforehand.
2017-11-19 23:03:38 +01:00
876da2fbc6 Beds: Do not crash when placing in an unknown node 2017-11-19 23:03:38 +01:00
ea45ca57a5 Lava cooling: Increase interval to 2
An excessive load has been reported caused by the node searching, so even
when no lava is present.
2017-11-19 23:03:34 +01:00
6fa3ebfa75 Carts: Check for last pathfinder predition too Minor fix to reduce cart jitter slightly 2017-11-19 22:57:28 +01:00
efe6fb6dfb TNT: Only burn visually connected powder (#1857) 2017-11-19 22:57:28 +01:00
1aeb2baa91 Creative: Prevent unauthorized item access (#1840) 2017-11-19 22:57:28 +01:00
e4d6425846 Correct farming/stairs dependency (#1838) 2017-11-19 22:57:28 +01:00
81f885795d Crafting: Remove duplicate reversed recipes (#1777)
For axes and hoes only use one recipe that matches the appearance of the texture and in inventory.
2017-11-19 22:53:53 +01:00
f3e29bc2cc Saplings: Reduce grow time to ABM equivalent
Previous times were chosen using statistical maths, but reports suggested
this was too long.
I tested by timing an ABM acting on 100 nodes, with interval and chance equal
to the old sapling ABM.
50 at 4m59s.
99 at 24m58s.
100 at 26m58s.
So choose a grow time between 5 and 25 min for tree and bush saplings.
If 'can grow' is false at grow time the timer is reset to 5 min.
2017-11-19 22:53:53 +01:00
3a72f7b84b Add backface_culling to open chests and fencegates 2017-11-19 22:53:53 +01:00
Foz
20bd4560f8 TNT: Track TNT owner in metadata for protection mods
It is useful for protection mods to know who owns an exploding
TNT block. This allows the blocks destroyed by the TNT to be
limited to the same ones the owner could destroy without using
TNT.

TNT placed within a protected area by the area owner, and later
ignited by another player will destroy within the protected area
nodes the igniter may not otherwise be able to interact with. Any
player could significantly increase the size of an explosion by
placing more TNT in an adjacent unprotected area if the original
TNT block was placed withing 1 node of such a boundary. This
feature sounds dangerous, but we are talking about TNT. Players
should use it carefully.
2017-11-19 22:53:53 +01:00
8991b9fe54 Carts: Do not connect rails with gunpowder (#1812) 2017-11-19 22:53:53 +01:00
aea6c5dd1d Stairs: Add backface culling to stair meshes
If backface culling is not specified for a tile in 'images' it is set to true.
Slabs already have backface culling due to being defined as nodeboxes (which
are then converted to meshnodes).
2017-11-19 22:53:53 +01:00
da41caca66 Chests: Check 'def' of node above chest to avoid crash
In 'chest_lid_obstructed(pos)' check for nil 'def' to avoid a crash caused by
an unknown node above the chest.
2017-11-19 22:53:14 +01:00
103af98864 Books: Also limit the max size of the title
This limits the max size of the full title of the book to `80` letters and
the size of the part thats displayed in the tooltip to `35` letters.
2017-11-19 22:53:14 +01:00
26606b0520 Books: Limit the size of books
Really large books just waste hard drive space and the engine is not designed to
handle that much data in item metadata, this can cause strange things to happen.
2017-11-19 22:52:00 +01:00
706844e8bf Books: Add nil value checks to the book formspec handler 2017-11-19 22:52:00 +01:00
a56274c230 Stairs: Use one recipe matching inventory appearence
No longer have 2 recipes for stairs, choose the one that matches the appearence
in inventory (stair rising toward the right).
Helps to reduce recipe count now that an increasing number of stairs are
being registered.
2017-11-19 22:52:00 +01:00
3512226867 Default: Revert "Default: Shorter and better ABMs"
This reverts commit e523c3a296 to re-enable
the overriding and redefinition of these global functions.
2017-11-19 17:16:32 +01:00
d5b9fee6fe Merge 0.4.16 into stable-0.4 2017-06-03 17:22:59 -04:00
18956c7f69 Change "Junglewood" to "Jungle Wood" 2017-06-03 11:55:13 -04:00
a8a60d33a3 Resize book textures from 16x17 to 16x16 2017-06-03 11:54:39 -04:00
eec1c5a03b Settings: Use new settings object 2017-05-24 07:18:26 +01:00
e523c3a296 Default: Shorter and better ABMs (#1739)
Action of some abm's call functions directly, instead of calling the function inside a function.
2017-05-20 14:32:52 +02:00
b25317fc64 Remove set_inventory_formspec in default, remove delay in sfinv 2017-05-18 09:54:18 +01:00
d104b9b10f Chest: Redo new chests to use single-tile textures where possible
This keeps the filenames the same, but adds a new "inside" double texture
for the open chest.
Use regular drawtype for closed chest and delete the "cube.obj" model.
X-flip the right-side texture for the closed chest.
2017-05-18 09:45:56 +01:00
758d5010b8 Fire: Disable fire by default in multiplayer 2017-05-15 17:39:59 +01:00
63b3542d00 Chests: Revert inventory name
Revert the new 'default:game' inventory back to the old 'main' and use the
lbm to restore the contents of the chest.
Change the name of the conversion LBM to ensure it is run again on already
converted chests.
2017-05-15 13:47:03 +01:00
5bd44c21ef Change the selection_box of bush stems (#1733)
This is needed because you can't place a node above a bush stem when you are pointing at the bush stem.
2017-05-13 12:49:04 +02:00
c7d558c09e Chest open model: UV map fix.
The back side had a UV mapping issue which caused the bottom
rear part to "shrink" when opened.
2017-05-07 20:47:17 -07:00
55f81d0802 Fix nil deref issue with people hitting chests too often. 2017-05-07 20:47:17 -07:00
a533434b58 Chests: Keep old textures for mod compability
Prevents generating ugly looking dummy images for mods that weren't updated yet.
2017-05-07 20:46:49 -07:00
08706313f4 Add option to disable lavacooling (#1726) 2017-05-07 18:25:53 +02:00
6737952fbf Fix merging mistake (crash in "stairs") 2017-05-01 21:26:10 +02:00
Tim
519d166ce3 Stairs: Add snowblock and ice stairs and slabs 2017-05-01 19:48:54 +01:00
be9121214c TNT: Gunpowder (and tnt.burn) will trigger the on_ignite of nodes
The previous behaviour is kept as fallback for compatibility, for when the on_ignite
is not defined in the node.
2017-05-01 19:38:38 +01:00
011ad78b42 Improve Chest appearance - opening chests.
Adds a mesh model that appears when a chest is opened. The chest
stays visibly open as long as the player keeps it open. When the
player closes the formspec, the chest returns back to the closed
shape. While opening and closing, a sound plays.

A second person inspecting the chest will trigger a second sound
open. However, only after the last player closes the chest, does the
chest actually visually close and is the sound close played. This
keeps mesh updates to a minimum.

While it's possible that a server shutting down may cause chests
to remain open, this does not affect the chests' working matter,
and opening or closing them should fix them.

Old chests are converted to the new style by LBM. I previously
had them converted on open but this was unreliable, and LBMs
don't have that problem.

Open chests cannot be dug up. This prevents people from keeping
a chest open and digging it out as well, since closing a chest
would place a chest back (swap) at the spot. We could protect
against this, but it still messes up the client and causes a lot
of "missing node inventory" error messages otherwise. It's
unlikely but possible that a player lagging out causes a chest
to stay "open" and thus unremovable by digging, but there are
other ways of dealing with that - a server restart fixes that
issue.

If the lid of the chest is obstructed, the sounds continue to play,
but the lid isn't opened. Obstructed means that a node is present
above the chest lid, however, we ignore several node types like signs,
torches (not 3d) and wallmounted nodeboxes (typically signs) since
they don't pose any major obstruction in almost any case, and are
typically found above chests. Additionally, the selection box of the
opened chest does not include the lid, and so one can still interact
with e.g. a sign behind an open lid.

Due to the fact that chests now have 7+ textures, we can no longer
use materials (limit: 6) to texture the chest, and so there is now
a single UV mapped image that applies both to open and closed chests.
While this does mean texture pack makers need to create it, this
is extremely simple and consists of a simple cut'n'paste over the
template and should be really easy to do. Only one texture file is
now then used for both open and closed chests.
2017-05-01 19:36:35 +01:00
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
67b13a5942 Fix books getting erased on page button use.
Changing the book page caused the entire itemstack meta to
get wiped due to improper calling of meta:from_table().

Fixes #1711
2017-04-28 21:52:39 -07:00
ae7206c006 Remove dye craft recipe conflict.
We have enough gray recipes, but brown is more difficult.

Fixes #1710
2017-04-26 20:19:59 -07:00
2917562728 Fix owner not being checked on write to book 2017-04-27 02:28:23 +01:00
c2d1a5ed4b Tin: Tune mapgen, bugfix, fix texture credits
Previously i had matched ore density to moreores, but this density was
too high and out of balance with MTGame, reduce density to be similar
to copper ore.
The 2 levels of underground ore were overlapping, fix.
Textures are actually by kilbith, update credits.

Also credit kilbith for bronze, copper, gold and steel blocks, credits
had not been updated at the time.
2017-04-23 23:05:31 +01:00
4d9fd7ad61 Textures: Reduce contrast of snow ripples 2017-04-23 23:05:31 +01:00
24559d012e Creative: Automatic item colorization for creative mode 2017-04-23 23:05:06 +01:00
2668619638 Ores: Add tin ore, lump, ingot and block
Use Calinou's textures from moreores mod.
Craft bronze from tin and copper instead of steel and copper.
Match ore density to the moreores mod but start ore at a depth of
y = -32 to be part of the depth progression of other ores.
2017-04-20 19:55:05 +01:00
6335525757 Doors: Ignore permission check if player parameter is omitted
As written in game_api.txt.
2017-04-20 19:54:27 +01:00
c54a7e882f Keys: Move skeleton key to craftitems.lua
Commit 73d61cbb10 makes skeleton keys
craftitems rather than tools, warranting the move from tools.lua
to craftitems.lua.
2017-04-20 19:51:51 +01:00
701abc2d2f Keys: Allow skeleton keys to be stacked
Allow skeleton keys to be stacked by converting them to craftitems and
adding a few lines of code to add a new itemstack to the inventory with
the new key or drop it at the player position if the inventory is full.
2017-04-20 19:50:34 +01:00
98216810ef nodebox -> node_box
Seems like this was a typo
2017-04-12 18:39:42 -07:00
a57d2db54a Bushes: Add saplings
Bush saplings grow in half the time of tree saplings.
Bushes do not need 'from sapling' schematic variants because only the
stem node is force-placed in the mapgen schematic, so only the sapling
is force-replaced.
Bush leaves drop saplings with a rarity that ensures at least 1 sapling
per bush on average.
2017-04-12 17:18:50 +01:00
d68d2c08ef PB&J Pup: Remove mod
Also delete nyancat API documentation from game_api.txt.
2017-04-12 17:18:35 +01:00
e2b3ab768a Fix .luacheckrc (missing Settings class) 2017-04-11 16:53:38 +02:00
e6d0d775e3 Stairs: Improve stair and slab rotation on placement
Slabs are placed horizontal instead of vertical, even if they are
placed on a wall.
Slabs are rotated automatically if they are placed to another slab,
no matter which material.
Slabs are placed at the lower position if the placer points into
the lower half of the pointed node and to the upper position if
pointed to the upper half.
Stairs are placed normal if the placer points to the lower half of
the pointed node and rotated upside down if pointed to the upper half.
2017-04-11 08:33:30 +01:00
8d43b984fc Screwdriver: Allow non-native rotations if supported by targeted node
This also allows custom actions (such as using the screwdriver as a wrench).
2017-04-11 03:58:13 +01:00
LNJ
fe021281e6 Textures: Replace aspen leaves texture with BlockMen's 2017-04-11 03:57:44 +01:00
9e4f0d3689 Leafdecay: Do not restart aready running timers 2017-04-11 03:57:07 +01:00
acfd58cdeb Carts: Make rail recipes more generous
As part of making vertical travel easier to reduce reliance on
sneak ladders.
Calculate using cubic pixels of steel.

A steelblock is 16^3 = 4096 cubic pixels steel.
6 ingots is 6/9 steelblocks.
A rail is a 2*2*16 pixel length of steel, 64 cubic pixels steel.
6 ingots produces 2*21 rails = 21 rail nodes.
Choose 18 for an even number that is a multiple of ingot number.

Replace the stick with 2 wood in the recipe to be closer to the amount
of wood that would be needed for 20*4 sleepers.

Replace 2 mese crystal fragments with 1 mese crystal to
compensate for the larger number of nodes returned. The result
is the recipe is much more generous with steel usage but slightly
less generous with mese usage, keeping power rail cost reasonably high.

Replace 2 coal lumps with 1 for a similar recipe to power rails.
2017-04-11 03:57:01 +01:00
b377aaa50d doors: Fix craftitem not listed in inventory (#1683)
Fixes bug caused by b847888
2017-04-02 10:01:01 +02:00
5fe831ed13 Carts: Remove '+' added in commit 077316b 2017-03-30 04:24:29 +01:00
2f46103ff8 Glasslike_framed nodes: Add 'glasslikeliquidlevel' paramtype2 2017-03-30 04:24:23 +01:00
077316b4cd Use creative.is_enabled_for for creative mode if possible (#1558) 2017-03-29 21:02:26 +02:00
b847888cb7 doors: add groups to the door craftitem 2017-03-29 20:40:56 +02:00
7c42c41170 doors: record protection violation if it cannot be dug 2017-03-26 03:06:44 +01:00
08eec2beb7 Flora spread: Re-enable dry shrub replacing flora in desert sand
Flora is converted to dry shrub in desert sand and silver sand.
No conversion in sand to preserve sand dune grasses.
Dry shrubs do not spread so this conversion, used by players, is the
only way to generate them.
2017-03-26 03:06:37 +01:00
9b45e7b3e9 PB&J Pup.
Replace possibly trademarked artwork with royalty free and
OK for commercial use artwork.

The Pup appears by default but does not alias the Nyan Cat nodes
away. For that you will have to enable the setting. A settingtypes.txt
is provided to make that really easy. This allows people to get
an out-of-tree mod and not have their Nyan nodes disappear.

The mod can also be disabled entirely this way for those who don't
want it.

There's some eatser eggs in here as well. Instead of making the
nodes burnable, they are edible, and make you bark and howl. And
perhaps something else too.
2017-03-26 03:05:57 +01:00
91182d6a9e Flora spread: Do not replace flora with dry shrub, only 'return'
If there is no group:soil node found below, do not replace flora with
dry shrub, this was breaking flower pots and other mods.
Originally, flora would only turn to dry shrub if in desert sand.
2017-03-22 22:30:35 +00:00
86fd616f3c Flora spread: Allow spread on rainforest litter. Other improvements
Use the soil group more instead of checking for multiple node names.
Remove 'neighbors' from ABM.
Turn any flora to dry shrub if on a non-soil, except when on default:sand
to avoid dune grasses being replaced.
Search for "group:soil" when searching for a position for the new flora
node, instead of searching for multiple node names, however do not spread
flora onto desert sand, which is in the soil group.

Remove default:dirt_with_snow from the soil group as it would be frozen
soil. It can be dug and placed to turn it into dirt (consider this some
extra work needed to make it cultivatable).
2017-03-20 00:14:56 +00:00
2a74032745 Books: Fix backwards compatibility issues
Commit c68b8274fe prevented books from
being copied in the crafting grid, and made it so that old books, though
seemingly successfully transferred to the new format, could not be written
to as the old data still persisted.
2017-03-20 00:13:31 +00:00
ecf160d93d Screwdriver: simplify logic, allow wallmounted rotation.
- Allow rotation of wallmounted nodeboxes (signs) since they are
  now rotating properly.
- Instead of testing `ndef` several times, do it once, correctly.
- Simplify exception logic for nodes that have `on_rotate` set.
- For simplicity, return itemstack, always.
- Remove a useless nil check.
2017-03-20 00:12:16 +00:00
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
d2aae95c39 Leafdecay: Change Aspen radius back to 3
Although the new aspen tree schematic only requires a radius of 2 the
many existing aspen trees in a world require radius 3.
2017-03-17 05:52:06 +00:00
02921baa7a Junglegrass: Prevent seeding of dirt_with_grass
Previously you could place junglegrass on dirt to convert that dirt to
dirt_with_grass, but this is unsuitable now that rainforest has a
surface of dirt_with_rainforest_litter.
Remove junglegrass from the 'grass' group.
2017-03-17 05:52:06 +00:00
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
68212967c0 Biomes: Add and auto-select mgv7 floatland biomes
A simple set of biomes for now: Ocean, coniferous forest, grassland,
sandstone desert.
Update biome lists for blob ores and decorations.

Make sandstone desert filler 1 node deeper to match other deserts.
2017-03-17 05:49:57 +00:00
73e4666f28 Change doors to default.can_interact_with_node() 2017-03-16 09:11:20 -07:00
bd4d2dff1c Farming: Add override for default:dirt_with_rainforest_litter 2017-03-15 22:22:21 +00:00
61d7c43c83 Skeleton key: Change to use left-click (tool on_use)
Instead of right click, the skeleton key is now a true `tool`
in the sense that it's default left-click action is to create
a key for the locked object.

This is far better than the outcome of the patches we've done
where the only way to create a key for a locked item was to
use sneak+rightclick. Now keys are perhaps a bit more sensible,
left for making keys, right for opening stuff with keys.

Fixes #1625
2017-03-15 22:22:21 +00:00
780f991a87 Sapling_on_place: Restore after_place_node() calls 2017-03-15 22:18:50 +00:00
1c78fd346d Sethome: Migrate sethome mod to player attributes.
Migrates settings safely and evacuates the `homes` file
entirely over time.
2017-03-15 22:18:36 +00:00
da69fcdf91 TNT: Clarify new TNT receipe
Update readme.txt with new TNT crafting recipe.
2017-03-14 19:05:49 +00:00
37c81f70b0 Textures: New textures for silver sandstone nodes 2017-03-14 19:05:14 +00:00
7b90044574 TNT: start fire nodetimers for created fire nodes.
Without this patch, any fire created(placed) by tnt explosions
will remain forever on the map.
2017-03-14 19:03:34 +00:00
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
07a5fca432 Leafdecay: Register leafdecay for bush leaves 2017-03-12 10:20:26 +00:00
d5e19d70c2 Screwdriver: drop nodes if no longer attached.
This should be fairly cheap and pops off items if needed.
2017-03-12 10:20:19 +00:00
efb81d188e Correct rotation of attached nodes, and rotate colored nodes 2017-03-12 10:20:19 +00:00
297192dd39 Screwdriver: use table lookup for facedir rotations.
The table was generated using the old code. A table lookup
should be faster than lots of math and branches.

Allows us to drop `nextrange()` as well.
2017-03-12 10:20:19 +00:00
f14b0a6ff5 Screwdriver: allow simple wallmounted rotation.
Allows rotating things like signs and torches. Axis rotation
rotates over all 6 faces, face rotation flips upside down to
flat on floor only, and of course in the 4 horizontal directions.

Made the code a bit more modular to account for different rotation
schemes. Should be easier to extend from here on to other needs,
and the functions can be reused by other mods for convenience.
2017-03-12 10:20:19 +00:00
0850314d74 luacheck 0.19.0 complains about unpack(). 2017-03-11 18:38:56 -08:00
ad118ea98d Flint & steel sounds: Fix bugs caused by nil position
Usage and tool break sounds were played at 'pointed_thing.above' which
can be nil if not pointing at anything or at an entity. This caused
sounds to be played to all players on a server non-positionally.

Fallback to player pos for sounds if 'pointed_thing.above' is nil.

Replace 'pt' variable with 'pointed_thing' in 'register_tool'.
2017-03-10 19:30:18 +00:00
c52ad140ae Mapgen: Use decoration sidelen 16 for jungletrees and junglegrass
Currently jungletrees and junglegrass use sidelen 80 for simplicity,
but this results in a more uneven distribution of decorations. A more
even distribution helps keep rainforest darker with a more unbroken
canopy.
This is also more consistent. 80 is based on the default mapchunk
size, all other decorations use sidelen 16 or smaller to divide into
any mapchunk size.
2017-03-10 19:28:43 +00:00
0f0dd0f6e8 Tree schematics: Alter jungletree, aspen, pine, appletree
Denser jungletree for darker rainforest:
Highest 'jungletree' nodes now prob 255.
Add a 5th lower branch layer.
Increase lower branch layer y-slice prob to 191.

Aspen:
Extend trunk upwards by 1 node to reduce leafdecay radius to 2.

Pine:
Make lower trunk 1 node longer so that lowest branches are more often
higher off the ground, also to make pines taller.

Appletree:
Make 2 opposite branches prob 255, the other 2 prob 127, to avoid
trees with 1 or 0 branches. Therefore also add random rotation.
2017-03-10 19:28:38 +00:00
1f6d633037 Ladder recipe: Make wooden ladder recipe more generous
Increase to 5 ladders from 7 sticks.
More generous to help with vertical travel.

Divide the log core volume of 14 * 14 * 16 cubic pixels by the volume of
a ladder node with two 2 * 2 * 16 side pieces and four 2 * 1 * 16 rungs
(cut down to length 14), to get 12.25 ladders per log.
The recipe of 7 stick items is 7 / 16 = 0.4375 logs.
Ladders per 7 stick items = 0.4375 * 12.25 = 5.36.
2017-03-07 06:43:44 +00:00
a16413f96c sfinv: Fix wrong tab being highlighted
Thank you to @ForbiddenJ for finding cause of the issue.
2017-03-07 06:43:18 +00:00
6d67badcac Screwdriver: Fix crash
If 'node_box' is nil 'node_box.type' causes a crash.
2017-03-07 06:37:33 +00:00
1d45b27c12 Add desert/silver sandstone-related blocks. (#1596)
Add desert and silver sand-related blocks, and stairs.
2017-03-06 19:03:30 -08:00
496521f4a1 Fix some warnings.
Also fixes the failing travis checks.
2017-03-05 09:27:53 +00:00
28ecb3b261 Dungeons: Use 'block' instead of 'brick' for nodebox stairs 2017-03-05 09:27:44 +00:00
c68b8274fe Show title and author of book in description
Utilizes the new key-meta (as with nodes) and the ability to set the description of an itemstack with the `description` meta key. Includes code to convert old metadata to new key-meta.
2017-02-28 18:16:55 -08:00
78c632ebd4 Allow interaction with nodes while wielding these items.
- beds
- boats
- carts
- key/skeleton key
- seeds

All these had on_place handlers that did not allow nodes with
an on_rightclick() handler to be used first (if not using
sneak). This code is taken from the torches mod and applied
everywhere.

This allows all these items to e.g. be inserted into the `frame`
mod's item frames.
2017-02-28 18:16:12 -08:00
d1b132555b Biomes: New surface node for rainforest
Moist rainforest plant litter.
Textures by npx.
2017-02-28 05:32:19 +00:00
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
bb18eeccaf Corals: Smaller, less dense reefs 2017-02-25 03:52:31 +00:00
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
1ec31d8472 Torches: Reduce light source level from 13 to 12
As part of the original plan for a new lightcurve.

With the old lightcurve lights were so dim all light sources had light
source level 13 or 14 to compensate, resulting in almost no difference
between torchlight and a maximum brightness light.

The new lightcurve makes all light sources effectively much brighter by
spreading visually-bright light further, torches are now slightly too
bright. So now we can reduce the light source level of torches while
actually making them effectively brighter than with the old lightcurve.
This also creates a desirable difference between torchlight and a
maximum-brightness light source.
2017-02-25 03:52:19 +00:00
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
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
89c45993ac Carts: Fix the rail table overwrite behaviour 2017-02-12 11:39:52 -08:00
0819d4bade Visual scale: Update plantlike nodes to post-bugfix values
Plantlike drawtype no longer applies 'visual scale' twice, so now we
use the actual scale factor desired.
Remove unnecessary 'visual_scale = 1.0' lines.
2017-02-12 01:27:34 +00:00
f6dfa4a1cb Waterlily: Avoid z-fighting of base texture with water surface
Avoid z-fighting visible from below.
Raise the nodebox base 1/64th of a node.
2017-02-12 01:23:53 +00:00
e3dd3d19cd Add sfinv.set_page, plus other helper functions 2017-02-10 23:54:57 +00:00
86849d9eec Default: Add nodebox mese post light usable as a growlamp (#1480)
Light level 14 to be able to grow plants.
3 returned from crafting with 1 glass node, 3 mese crystals and 1
wood plank.
Seamlessly placable on appletree wood fence posts.
2017-02-08 16:01:30 -08:00
c88c0a98fd Make drop logic work better for non-8-step-plants. (#1544)
Using @paramat's formula.
2017-02-08 15:59:25 -08:00
2e950ac61c Mapgen: Dedicated registrations for mgv6 blob ores
Now that biomes are being specified for blob ores we need a separate
set of blob ore registrations for mgv6 which has no Biome API biomes
defined.
Various minor improvements to mapgen.lua.
2017-02-02 17:20:53 +00:00
2b215848d8 Trees: Add 'snowy' group for pine sapling snow detection
Use the 'snowy' group in the 'is snow nearby' function instead of
default nodes. Often snow nodes are not from the default mod.
2017-02-01 17:51:44 +00:00
e86955afae Creative: Cache creative mode setting 2017-02-01 17:51:35 +00:00
d560f59a74 Ores: Add silver sand blob ore, relocate other blob ores 2017-02-01 17:51:22 +00:00
b06368adf2 Fix node drops not being added to inventory when not in creative mode 2017-01-27 19:48:59 +00:00
1dd9fdb530 Dungeons: Add mapgen alias for desert stone stairs 2017-01-26 17:56:16 +00:00
38500da655 Stairs: Fix smooth lighting of stair mesh 2017-01-26 17:55:16 +00:00
bee5b316a8 Creative: Add creative.is_enabled_for 2017-01-26 17:54:45 +00:00
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
eb1805ea0a Textures: Strip color profiles from some textures
Removes the "iCCP: known incorrect sRGB profile" error messages on the
console when starting minetest_game by stripping offending color profiles.
2017-01-22 07:43:12 +00:00
1104d571b0 TNT: Log explosions and player igniting tnt or gunpowder 2017-01-19 21:57:34 -08:00
6dcf541f6e Revert "Doors: Remove ..." and "Doors: Allow the screwdriver to ..."
This reverts commit 5e4a6e8ac6, and
             commit 60cf3f85b6.

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
1470b9df79 Tree log decorations: Replace lua tables with .mts files 2017-01-15 04:29:56 +00:00
8715b83ff0 Fire: Make explosions remove flames
TNT removes flammable nodes from the destruction radius and should
remove flames within it too because they lose their fuel and would
be removed by ABM later anyway.
2017-01-15 04:24:01 +00:00
57eb906047 Add support for custom bed sounds 2017-01-12 12:42:38 -08:00
df19b4eab0 Dye: Simplify recipes.
Create a simple triplet table (src1, src2, dst) for all the dye
recipes and group them logically, with a bit of explanation where
they actually come from.

This prunes a lot of recipes from the list, but the old list had a
ton of combinations that did not make any sense, as well as recipes
that were just gross approximations and duplicates, mixing the same
color with itself just to get the same color back, which just wastes
packets at logon.

The list has been checked to allow all colors created from the basic
dyes (flowers+coal) so that all colors can be crafted.
2017-01-11 23:53:44 -08:00
c8b1671ef0 Default: Alter sand to sandstone recipe
Craft 4 default:sand to default:sandstone.

Previously, 4 group:sand was craftable to sandstone and sandstone was
craftable back into default:sand, allowing silver and desert sands to
be converted into incorrect colour sandstone and yellow sand.
2017-01-07 22:01:36 +00:00
96aac5ff5b Fire: Reduce flame light level to 13 2017-01-07 22:01:30 +00:00
b6889134d3 License.txt: Include full official LGPL 2.1 .txt file
Copy-paste and only remove form-feed characters.
2017-01-07 22:01:24 +00:00
cadc8b34d7 Add /killme chat command
Added as a new mod as it doesn't fit anywhere else.

This is a game play change, so it better suited to
Minetest Game rather than builtin

Fixes #857
2017-01-07 22:01:19 +00:00
48ab62db88 Make doors place when shift is held instead of calling on_rightclick
Fixes #1364
2017-01-03 16:54:01 +00:00
9ab50702fb Add LICENSE.txt 2017-01-02 18:38:36 +00:00
42700a4b4b Default: More generous meselamp recipe
Require only 1 mese crystal instead of 3.
To make farming in dark locations easier.
To reduce and balance recipe ore cost.
2017-01-02 18:31:01 +00:00
8bc93598c6 Papyrus, cactus: Require light level 13 for growth 2017-01-02 18:30:05 +00:00
f07c4dcd83 Decrease the cost of gunpowder for trails
The cost of TNT remains the same
2017-01-01 23:41:04 +00:00
437860feff Merge tag '0.4.15' into stable-0.4
0.4.15
2016-12-22 23:00:57 +01:00
116 changed files with 2920 additions and 1254 deletions

View File

@ -8,6 +8,10 @@ read_globals = {
"vector", "vector",
"VoxelManip", "VoxelArea", "VoxelManip", "VoxelArea",
"PseudoRandom", "ItemStack", "PseudoRandom", "ItemStack",
"Settings",
"unpack",
-- Silence "accessing undefined field copy of global table".
table = { fields = { "copy" } }
} }
-- Overwrites minetest.handle_node_drops -- Overwrites minetest.handle_node_drops

519
LICENSE.txt Normal file
View File

@ -0,0 +1,519 @@
License of media (textures and sounds)
--------------------------------------
Copyright (C) 2010-2012 celeron55, Perttu Ahola <celeron55@gmail.com>
See README.txt in each mod directory for information about other authors.
Attribution-ShareAlike 3.0 Unported (CC BY-SA 3.0)
http://creativecommons.org/licenses/by-sa/3.0/
License of menu/header.png
Copyright (C) 2015 paramat CC BY-SA 3.0
License of source code
----------------------
Copyright (C) 2010-2012 celeron55, Perttu Ahola <celeron55@gmail.com>
See README.txt in each mod directory for information about other authors.
GNU LESSER GENERAL PUBLIC LICENSE
Version 2.1, February 1999
Copyright (C) 1991, 1999 Free Software Foundation, Inc.
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
[This is the first released version of the Lesser GPL. It also counts
as the successor of the GNU Library Public License, version 2, hence
the version number 2.1.]
Preamble
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
Licenses are intended to guarantee your freedom to share and change
free software--to make sure the software is free for all its users.
This license, the Lesser General Public License, applies to some
specially designated software packages--typically libraries--of the
Free Software Foundation and other authors who decide to use it. You
can use it too, but we suggest you first think carefully about whether
this license or the ordinary General Public License is the better
strategy to use in any particular case, based on the explanations below.
When we speak of free software, we are referring to freedom of use,
not price. Our General Public Licenses are designed to make sure that
you have the freedom to distribute copies of free software (and charge
for this service if you wish); that you receive source code or can get
it if you want it; that you can change the software and use pieces of
it in new free programs; and that you are informed that you can do
these things.
To protect your rights, we need to make restrictions that forbid
distributors to deny you these rights or to ask you to surrender these
rights. These restrictions translate to certain responsibilities for
you if you distribute copies of the library or if you modify it.
For example, if you distribute copies of the library, whether gratis
or for a fee, you must give the recipients all the rights that we gave
you. You must make sure that they, too, receive or can get the source
code. If you link other code with the library, you must provide
complete object files to the recipients, so that they can relink them
with the library after making changes to the library and recompiling
it. And you must show them these terms so they know their rights.
We protect your rights with a two-step method: (1) we copyright the
library, and (2) we offer you this license, which gives you legal
permission to copy, distribute and/or modify the library.
To protect each distributor, we want to make it very clear that
there is no warranty for the free library. Also, if the library is
modified by someone else and passed on, the recipients should know
that what they have is not the original version, so that the original
author's reputation will not be affected by problems that might be
introduced by others.
Finally, software patents pose a constant threat to the existence of
any free program. We wish to make sure that a company cannot
effectively restrict the users of a free program by obtaining a
restrictive license from a patent holder. Therefore, we insist that
any patent license obtained for a version of the library must be
consistent with the full freedom of use specified in this license.
Most GNU software, including some libraries, is covered by the
ordinary GNU General Public License. This license, the GNU Lesser
General Public License, applies to certain designated libraries, and
is quite different from the ordinary General Public License. We use
this license for certain libraries in order to permit linking those
libraries into non-free programs.
When a program is linked with a library, whether statically or using
a shared library, the combination of the two is legally speaking a
combined work, a derivative of the original library. The ordinary
General Public License therefore permits such linking only if the
entire combination fits its criteria of freedom. The Lesser General
Public License permits more lax criteria for linking other code with
the library.
We call this license the "Lesser" General Public License because it
does Less to protect the user's freedom than the ordinary General
Public License. It also provides other free software developers Less
of an advantage over competing non-free programs. These disadvantages
are the reason we use the ordinary General Public License for many
libraries. However, the Lesser license provides advantages in certain
special circumstances.
For example, on rare occasions, there may be a special need to
encourage the widest possible use of a certain library, so that it becomes
a de-facto standard. To achieve this, non-free programs must be
allowed to use the library. A more frequent case is that a free
library does the same job as widely used non-free libraries. In this
case, there is little to gain by limiting the free library to free
software only, so we use the Lesser General Public License.
In other cases, permission to use a particular library in non-free
programs enables a greater number of people to use a large body of
free software. For example, permission to use the GNU C Library in
non-free programs enables many more people to use the whole GNU
operating system, as well as its variant, the GNU/Linux operating
system.
Although the Lesser General Public License is Less protective of the
users' freedom, it does ensure that the user of a program that is
linked with the Library has the freedom and the wherewithal to run
that program using a modified version of the Library.
The precise terms and conditions for copying, distribution and
modification follow. Pay close attention to the difference between a
"work based on the library" and a "work that uses the library". The
former contains code derived from the library, whereas the latter must
be combined with the library in order to run.
GNU LESSER GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License Agreement applies to any software library or other
program which contains a notice placed by the copyright holder or
other authorized party saying it may be distributed under the terms of
this Lesser General Public License (also called "this License").
Each licensee is addressed as "you".
A "library" means a collection of software functions and/or data
prepared so as to be conveniently linked with application programs
(which use some of those functions and data) to form executables.
The "Library", below, refers to any such software library or work
which has been distributed under these terms. A "work based on the
Library" means either the Library or any derivative work under
copyright law: that is to say, a work containing the Library or a
portion of it, either verbatim or with modifications and/or translated
straightforwardly into another language. (Hereinafter, translation is
included without limitation in the term "modification".)
"Source code" for a work means the preferred form of the work for
making modifications to it. For a library, complete source code means
all the source code for all modules it contains, plus any associated
interface definition files, plus the scripts used to control compilation
and installation of the library.
Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope. The act of
running a program using the Library is not restricted, and output from
such a program is covered only if its contents constitute a work based
on the Library (independent of the use of the Library in a tool for
writing it). Whether that is true depends on what the Library does
and what the program that uses the Library does.
1. You may copy and distribute verbatim copies of the Library's
complete source code as you receive it, in any medium, provided that
you conspicuously and appropriately publish on each copy an
appropriate copyright notice and disclaimer of warranty; keep intact
all the notices that refer to this License and to the absence of any
warranty; and distribute a copy of this License along with the
Library.
You may charge a fee for the physical act of transferring a copy,
and you may at your option offer warranty protection in exchange for a
fee.
2. You may modify your copy or copies of the Library or any portion
of it, thus forming a work based on the Library, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:
a) The modified work must itself be a software library.
b) You must cause the files modified to carry prominent notices
stating that you changed the files and the date of any change.
c) You must cause the whole of the work to be licensed at no
charge to all third parties under the terms of this License.
d) If a facility in the modified Library refers to a function or a
table of data to be supplied by an application program that uses
the facility, other than as an argument passed when the facility
is invoked, then you must make a good faith effort to ensure that,
in the event an application does not supply such function or
table, the facility still operates, and performs whatever part of
its purpose remains meaningful.
(For example, a function in a library to compute square roots has
a purpose that is entirely well-defined independent of the
application. Therefore, Subsection 2d requires that any
application-supplied function or table used by this function must
be optional: if the application does not supply it, the square
root function must still compute square roots.)
These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Library,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works. But when you
distribute the same sections as part of a whole which is a work based
on the Library, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote
it.
Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Library.
In addition, mere aggregation of another work not based on the Library
with the Library (or with a work based on the Library) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.
3. You may opt to apply the terms of the ordinary GNU General Public
License instead of this License to a given copy of the Library. To do
this, you must alter all the notices that refer to this License, so
that they refer to the ordinary GNU General Public License, version 2,
instead of to this License. (If a newer version than version 2 of the
ordinary GNU General Public License has appeared, then you can specify
that version instead if you wish.) Do not make any other change in
these notices.
Once this change is made in a given copy, it is irreversible for
that copy, so the ordinary GNU General Public License applies to all
subsequent copies and derivative works made from that copy.
This option is useful when you wish to copy part of the code of
the Library into a program that is not a library.
4. You may copy and distribute the Library (or a portion or
derivative of it, under Section 2) in object code or executable form
under the terms of Sections 1 and 2 above provided that you accompany
it with the complete corresponding machine-readable source code, which
must be distributed under the terms of Sections 1 and 2 above on a
medium customarily used for software interchange.
If distribution of object code is made by offering access to copy
from a designated place, then offering equivalent access to copy the
source code from the same place satisfies the requirement to
distribute the source code, even though third parties are not
compelled to copy the source along with the object code.
5. A program that contains no derivative of any portion of the
Library, but is designed to work with the Library by being compiled or
linked with it, is called a "work that uses the Library". Such a
work, in isolation, is not a derivative work of the Library, and
therefore falls outside the scope of this License.
However, linking a "work that uses the Library" with the Library
creates an executable that is a derivative of the Library (because it
contains portions of the Library), rather than a "work that uses the
library". The executable is therefore covered by this License.
Section 6 states terms for distribution of such executables.
When a "work that uses the Library" uses material from a header file
that is part of the Library, the object code for the work may be a
derivative work of the Library even though the source code is not.
Whether this is true is especially significant if the work can be
linked without the Library, or if the work is itself a library. The
threshold for this to be true is not precisely defined by law.
If such an object file uses only numerical parameters, data
structure layouts and accessors, and small macros and small inline
functions (ten lines or less in length), then the use of the object
file is unrestricted, regardless of whether it is legally a derivative
work. (Executables containing this object code plus portions of the
Library will still fall under Section 6.)
Otherwise, if the work is a derivative of the Library, you may
distribute the object code for the work under the terms of Section 6.
Any executables containing that work also fall under Section 6,
whether or not they are linked directly with the Library itself.
6. As an exception to the Sections above, you may also combine or
link a "work that uses the Library" with the Library to produce a
work containing portions of the Library, and distribute that work
under terms of your choice, provided that the terms permit
modification of the work for the customer's own use and reverse
engineering for debugging such modifications.
You must give prominent notice with each copy of the work that the
Library is used in it and that the Library and its use are covered by
this License. You must supply a copy of this License. If the work
during execution displays copyright notices, you must include the
copyright notice for the Library among them, as well as a reference
directing the user to the copy of this License. Also, you must do one
of these things:
a) Accompany the work with the complete corresponding
machine-readable source code for the Library including whatever
changes were used in the work (which must be distributed under
Sections 1 and 2 above); and, if the work is an executable linked
with the Library, with the complete machine-readable "work that
uses the Library", as object code and/or source code, so that the
user can modify the Library and then relink to produce a modified
executable containing the modified Library. (It is understood
that the user who changes the contents of definitions files in the
Library will not necessarily be able to recompile the application
to use the modified definitions.)
b) Use a suitable shared library mechanism for linking with the
Library. A suitable mechanism is one that (1) uses at run time a
copy of the library already present on the user's computer system,
rather than copying library functions into the executable, and (2)
will operate properly with a modified version of the library, if
the user installs one, as long as the modified version is
interface-compatible with the version that the work was made with.
c) Accompany the work with a written offer, valid for at
least three years, to give the same user the materials
specified in Subsection 6a, above, for a charge no more
than the cost of performing this distribution.
d) If distribution of the work is made by offering access to copy
from a designated place, offer equivalent access to copy the above
specified materials from the same place.
e) Verify that the user has already received a copy of these
materials or that you have already sent this user a copy.
For an executable, the required form of the "work that uses the
Library" must include any data and utility programs needed for
reproducing the executable from it. However, as a special exception,
the materials to be distributed need not include anything that is
normally distributed (in either source or binary form) with the major
components (compiler, kernel, and so on) of the operating system on
which the executable runs, unless that component itself accompanies
the executable.
It may happen that this requirement contradicts the license
restrictions of other proprietary libraries that do not normally
accompany the operating system. Such a contradiction means you cannot
use both them and the Library together in an executable that you
distribute.
7. You may place library facilities that are a work based on the
Library side-by-side in a single library together with other library
facilities not covered by this License, and distribute such a combined
library, provided that the separate distribution of the work based on
the Library and of the other library facilities is otherwise
permitted, and provided that you do these two things:
a) Accompany the combined library with a copy of the same work
based on the Library, uncombined with any other library
facilities. This must be distributed under the terms of the
Sections above.
b) Give prominent notice with the combined library of the fact
that part of it is a work based on the Library, and explaining
where to find the accompanying uncombined form of the same work.
8. You may not copy, modify, sublicense, link with, or distribute
the Library except as expressly provided under this License. Any
attempt otherwise to copy, modify, sublicense, link with, or
distribute the Library is void, and will automatically terminate your
rights under this License. However, parties who have received copies,
or rights, from you under this License will not have their licenses
terminated so long as such parties remain in full compliance.
9. You are not required to accept this License, since you have not
signed it. However, nothing else grants you permission to modify or
distribute the Library or its derivative works. These actions are
prohibited by law if you do not accept this License. Therefore, by
modifying or distributing the Library (or any work based on the
Library), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Library or works based on it.
10. Each time you redistribute the Library (or any work based on the
Library), the recipient automatically receives a license from the
original licensor to copy, distribute, link with or modify the Library
subject to these terms and conditions. You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties with
this License.
11. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Library at all. For example, if a patent
license would not permit royalty-free redistribution of the Library by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Library.
If any portion of this section is held invalid or unenforceable under any
particular circumstance, the balance of the section is intended to apply,
and the section as a whole is intended to apply in other circumstances.
It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system which is
implemented by public license practices. Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.
This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.
12. If the distribution and/or use of the Library is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Library under this License may add
an explicit geographical distribution limitation excluding those countries,
so that distribution is permitted only in or among countries not thus
excluded. In such case, this License incorporates the limitation as if
written in the body of this License.
13. The Free Software Foundation may publish revised and/or new
versions of the Lesser General Public License from time to time.
Such new versions will be similar in spirit to the present version,
but may differ in detail to address new problems or concerns.
Each version is given a distinguishing version number. If the Library
specifies a version number of this License which applies to it and
"any later version", you have the option of following the terms and
conditions either of that version or of any later version published by
the Free Software Foundation. If the Library does not specify a
license version number, you may choose any version ever published by
the Free Software Foundation.
14. If you wish to incorporate parts of the Library into other free
programs whose distribution conditions are incompatible with these,
write to the author to ask for permission. For software which is
copyrighted by the Free Software Foundation, write to the Free
Software Foundation; we sometimes make exceptions for this. Our
decision will be guided by the two goals of preserving the free status
of all derivatives of our free software and of promoting the sharing
and reuse of software generally.
NO WARRANTY
15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
DAMAGES.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Libraries
If you develop a new library, and you want it to be of the greatest
possible use to the public, we recommend making it free software that
everyone can redistribute and change. You can do so by permitting
redistribution under these terms (or, alternatively, under the terms of the
ordinary General Public License).
To apply these terms, attach the following notices to the library. It is
safest to attach them to the start of each source file to most effectively
convey the exclusion of warranty; and each file should have at least the
"copyright" line and a pointer to where the full notice is found.
<one line to give the library's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
Also add information on how to contact you by electronic and paper mail.
You should also get your employer (if you work as a programmer) or your
school, if any, to sign a "copyright disclaimer" for the library, if
necessary. Here is a sample; alter the names:
Yoyodyne, Inc., hereby disclaims all copyright interest in the
library `Frob' (a library for tweaking knobs) written by James Random Hacker.
<signature of Ty Coon>, 1 April 1990
Ty Coon, President of Vice
That's all there is to it!

View File

@ -22,32 +22,7 @@ When stable releases are made, Minetest Game is packaged and made available in
and in case the repository has grown too much, it may be reset. In that sense, and in case the repository has grown too much, it may be reset. In that sense,
this is not a "real" git repository. (Package maintainers please note!) this is not a "real" git repository. (Package maintainers please note!)
License of source code Licensing
---------------------- ---------
Copyright (C) 2010-2012 celeron55, Perttu Ahola <celeron55@gmail.com>
See README.txt in each mod directory for information about other authors.
This program is free software; you can redistribute it and/or modify See LICENSE.txt
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
License of media (textures and sounds)
--------------------------------------
Copyright (C) 2010-2012 celeron55, Perttu Ahola <celeron55@gmail.com>
See README.txt in each mod directory for information about other authors.
Attribution-ShareAlike 3.0 Unported (CC BY-SA 3.0)
http://creativecommons.org/licenses/by-sa/3.0/
License of menu/header.png
Copyright (C) 2015 paramat CC BY-SA 3.0

View File

@ -78,6 +78,12 @@ For example,
is used to show all tools. Name is used in the sfinv page name, title is the is used to show all tools. Name is used in the sfinv page name, title is the
human readable title. human readable title.
`is_enabled_for` is used to check whether a player is in creative mode:
creative.is_enabled_for(name)
Override this to allow per-player game modes.
The contents of `creative.formspec_add` is appended to every creative inventory The contents of `creative.formspec_add` is appended to every creative inventory
page. Mods can use it to add additional formspec elements onto the default page. Mods can use it to add additional formspec elements onto the default
creative inventory formspec to be drawn after each update. creative inventory formspec to be drawn after each update.
@ -149,7 +155,8 @@ The doors mod allows modders to register custom doors and trapdoors.
### Fence gate definition ### Fence gate definition
description = "Wooden Fence Gate", description = "Wooden Fence Gate",
texture = "default_wood.png", texture = "default_wood.png", -- `backface_culling` will automatically be
-- set to `true` if not specified.
material = "default:wood", material = "default:wood",
groups = {choppy = 2, oddly_breakable_by_hand = 2, flammable = 2}, groups = {choppy = 2, oddly_breakable_by_hand = 2, flammable = 2},
sounds = default.node_sound_wood_defaults(), -- optional sounds = default.node_sound_wood_defaults(), -- optional
@ -276,18 +283,6 @@ Give Initial Stuff API
^ str is a comma separated list of initial stuff ^ str is a comma separated list of initial stuff
^ Adds items to the list of items to be given ^ Adds items to the list of items to be given
Nyancat API
-----------
`nyancat.place(pos, facedir, length)`
^ Place a cat at `pos` facing `facedir` with tail length `length`
Only accepts facedir 0-3, if facedir > 3 then it will be interpreted as facedir = 0
`nyancat.generate(minp, maxp, seed)`
^ Called by `minetest.register_on_generated`. To disable nyancat generation,
you can redefine nyancat.generate() to be an empty function
TNT API TNT API
---------- ----------
@ -309,17 +304,20 @@ TNT API
* `bottom` Bottom tile. By default the name of the tnt with a suffix of `_bottom.png`. * `bottom` Bottom tile. By default the name of the tnt with a suffix of `_bottom.png`.
* `burning` Top tile when lit. By default the name of the tnt with a suffix of `_top_burning_animated.png". * `burning` Top tile when lit. By default the name of the tnt with a suffix of `_top_burning_animated.png".
`tnt.boom(position, definition)` `tnt.boom(position[, definition])`
^ Create an explosion. ^ Create an explosion.
* `position` The center of explosion. * `position` The center of explosion.
* `definition` The TNT definion as passed to `tnt.register` * `definition` The TNT definion as passed to `tnt.register` with the following addition:
* `explode_center` false by default which removes TNT node on blast, when true will explode center node.
`tnt.burn(position, [nodename])` `tnt.burn(position, [nodename])`
^ Ignite TNT at position, nodename isn't required unless already known. ^ Ignite node at position, triggering its `on_ignite` callback (see fire mod).
If no such callback exists, fallback to turn tnt group nodes to their
"_burning" variant.
nodename isn't required unless already known.
To make dropping items from node inventories easier, you can use the To make dropping items from node inventories easier, you can use the
following helper function from 'default': following helper function from 'default':
@ -406,18 +404,28 @@ Sfinv API
### sfinv Methods ### sfinv Methods
* sfinv.set_player_inventory_formspec(player, context) - builds page formspec **Pages**
and calls set_inventory_formspec().
If context is nil, it is either found or created. * sfinv.set_page(player, pagename) - changes the page
* sfinv.get_formspec(player, context) - builds current page's formspec
* sfinv.get_nav_fs(player, context, nav, current_idx) - see above
* sfinv.get_homepage_name(player) - get the page name of the first page to show to a player * sfinv.get_homepage_name(player) - get the page name of the first page to show to a player
* sfinv.make_formspec(player, context, content, show_inv, size) - adds a theme to a formspec
* show_inv, defaults to false. Whether to show the player's main inventory
* size, defaults to `size[8,8.6]` if not specified
* sfinv.register_page(name, def) - register a page, see section below * sfinv.register_page(name, def) - register a page, see section below
* sfinv.override_page(name, def) - overrides fields of an page registered with register_page. * sfinv.override_page(name, def) - overrides fields of an page registered with register_page.
* Note: Page must already be defined, (opt)depend on the mod defining it. * Note: Page must already be defined, (opt)depend on the mod defining it.
* sfinv.set_player_inventory_formspec(player) - (re)builds page formspec
and calls set_inventory_formspec().
* sfinv.get_formspec(player, context) - builds current page's formspec
**Contexts**
* sfinv.get_or_create_context(player) - gets the player's context
* sfinv.set_context(player, context)
**Theming**
* sfinv.make_formspec(player, context, content, show_inv, size) - adds a theme to a formspec
* show_inv, defaults to false. Whether to show the player's main inventory
* size, defaults to `size[8,8.6]` if not specified
* sfinv.get_nav_fs(player, context, nav, current_idx) - creates tabheader or ""
### sfinv Members ### sfinv Members
@ -642,20 +650,36 @@ default.player_get_animation(player)
Leafdecay Leafdecay
--------- ---------
To enable leaf decay for a node, add it to the `leafdecay` group. To enable leaf decay for leaves when a tree is cut down by a player,
register the tree with the default.register_leafdecay(leafdecaydef)
function.
The rating of the group determines how far from a node in the group `tree` If `param2` of any registered node is ~= 0, the node will always be
the node can be without decaying. preserved. Thus, if the player places a node of that kind, you will
want to set `param2 = 1` or so.
If `param2` of the node is ~= 0, the node will always be preserved. Thus, if The function `default.after_place_leaves` can be set as
the player places a node of that kind, you will want to set `param2 = 1` or so. `after_place_node of a node` to set param2 to 1 if the player places
the node (should not be used for nodes that use param2 otherwise
(e.g. facedir)).
The function `default.after_place_leaves` can be set as `after_place_node of a node` If the node is in the `leafdecay_drop` group then it will always be
to set param2 to 1 if the player places the node (should not be used for nodes dropped as an item.
that use param2 otherwise (e.g. facedir)).
`default.register_leafdecay(leafdecaydef)`
`leafdecaydef` is a table, with following members:
{
trunks = {"default:tree"}, -- nodes considered trunks
leaves = {"default:leaves", "default:apple"},
-- nodes considered for removal
radius = 3, -- radius to consider for searching
}
Note: all the listed nodes in `trunks` have their `on_after_destruct`
callback overridden. All the nodes listed in `leaves` have their
`on_timer` callback overridden.
If the node is in the `leafdecay_drop` group then it will always be dropped as an
item.
Dyes Dyes
---- ----
@ -746,14 +770,20 @@ Trees
* `default.grow_new_pine_tree(pos)` * `default.grow_new_pine_tree(pos)`
* Grows a new design pine tree at pos * Grows a new design pine tree at pos
* `default.grow_new_snowy_pine_tree(pos)`
* Grows a new design snowy pine tree at pos
* `default.grow_new_acacia_tree(pos)` * `default.grow_new_acacia_tree(pos)`
* Grows a new design acacia tree at pos * Grows a new design acacia tree at pos
* `default.grow_new_aspen_tree(pos)` * `default.grow_new_aspen_tree(pos)`
* Grows a new design aspen tree at pos * Grows a new design aspen tree at pos
* `default.grow_new_snowy_pine_tree(pos)` * `default.grow_bush(pos)`
* Grows a new design snowy pine tree at pos * Grows a bush at pos
* `default.grow_acacia_bush(pos)`
* Grows an acaia bush at pos
Carts Carts
----- -----

View File

@ -27,6 +27,9 @@
# Enable flame sound. # Enable flame sound.
#flame_sound = true #flame_sound = true
# Whether lavacooling should be enabled.
#enable_lavacooling = true
# Whether the stuff in initial_stuff should be given to new players # Whether the stuff in initial_stuff should be given to new players
#give_initial_stuff = false #give_initial_stuff = false
#initial_stuff = default:pick_steel,default:axe_steel,default:shovel_steel,default:torch 99,default:cobble 99 #initial_stuff = default:pick_steel,default:axe_steel,default:shovel_steel,default:torch 99,default:cobble 99

View File

@ -34,7 +34,7 @@ function beds.register_bed(name, def)
is_ground_content = false, is_ground_content = false,
stack_max = 1, stack_max = 1,
groups = {choppy = 2, oddly_breakable_by_hand = 2, flammable = 3, bed = 1}, groups = {choppy = 2, oddly_breakable_by_hand = 2, flammable = 3, bed = 1},
sounds = default.node_sound_wood_defaults(), sounds = def.sounds or default.node_sound_wood_defaults(),
node_box = { node_box = {
type = "fixed", type = "fixed",
fixed = def.nodebox.bottom, fixed = def.nodebox.bottom,
@ -46,16 +46,27 @@ function beds.register_bed(name, def)
on_place = function(itemstack, placer, pointed_thing) on_place = function(itemstack, placer, pointed_thing)
local under = pointed_thing.under local under = pointed_thing.under
local node = minetest.get_node(under)
local udef = minetest.registered_nodes[node.name]
if udef and udef.on_rightclick and
not (placer and placer:is_player() and
placer:get_player_control().sneak) then
return udef.on_rightclick(under, node, placer, itemstack,
pointed_thing) or itemstack
end
local pos local pos
if minetest.registered_items[minetest.get_node(under).name].buildable_to then if udef and udef.buildable_to then
pos = under pos = under
else else
pos = pointed_thing.above pos = pointed_thing.above
end end
if minetest.is_protected(pos, placer:get_player_name()) and local player_name = placer and placer:get_player_name() or ""
not minetest.check_player_privs(placer, "protection_bypass") then
minetest.record_protection_violation(pos, placer:get_player_name()) if minetest.is_protected(pos, player_name) and
not minetest.check_player_privs(player_name, "protection_bypass") then
minetest.record_protection_violation(pos, player_name)
return itemstack return itemstack
end end
@ -64,12 +75,13 @@ function beds.register_bed(name, def)
return itemstack return itemstack
end end
local dir = minetest.dir_to_facedir(placer:get_look_dir()) local dir = placer and placer:get_look_dir() and
minetest.dir_to_facedir(placer:get_look_dir()) or 0
local botpos = vector.add(pos, minetest.facedir_to_dir(dir)) local botpos = vector.add(pos, minetest.facedir_to_dir(dir))
if minetest.is_protected(botpos, placer:get_player_name()) and if minetest.is_protected(botpos, player_name) and
not minetest.check_player_privs(placer, "protection_bypass") then not minetest.check_player_privs(player_name, "protection_bypass") then
minetest.record_protection_violation(botpos, placer:get_player_name()) minetest.record_protection_violation(botpos, player_name)
return itemstack return itemstack
end end
@ -81,7 +93,8 @@ function beds.register_bed(name, def)
minetest.set_node(pos, {name = name .. "_bottom", param2 = dir}) minetest.set_node(pos, {name = name .. "_bottom", param2 = dir})
minetest.set_node(botpos, {name = name .. "_top", param2 = dir}) minetest.set_node(botpos, {name = name .. "_top", param2 = dir})
if not minetest.setting_getbool("creative_mode") then if not (creative and creative.is_enabled_for
and creative.is_enabled_for(player_name)) then
itemstack:take_item() itemstack:take_item()
end end
return itemstack return itemstack
@ -138,7 +151,7 @@ function beds.register_bed(name, def)
is_ground_content = false, is_ground_content = false,
pointable = false, pointable = false,
groups = {choppy = 2, oddly_breakable_by_hand = 2, flammable = 3, bed = 2}, groups = {choppy = 2, oddly_breakable_by_hand = 2, flammable = 3, bed = 2},
sounds = default.node_sound_wood_defaults(), sounds = def.sounds or default.node_sound_wood_defaults(),
drop = name .. "_bottom", drop = name .. "_bottom",
node_box = { node_box = {
type = "fixed", type = "fixed",

View File

@ -1,7 +1,7 @@
local pi = math.pi local pi = math.pi
local player_in_bed = 0 local player_in_bed = 0
local is_sp = minetest.is_singleplayer() local is_sp = minetest.is_singleplayer()
local enable_respawn = minetest.setting_getbool("enable_bed_respawn") local enable_respawn = minetest.settings:get_bool("enable_bed_respawn")
if enable_respawn == nil then if enable_respawn == nil then
enable_respawn = true enable_respawn = true
end end
@ -22,7 +22,7 @@ local function get_look_yaw(pos)
end end
local function is_night_skip_enabled() local function is_night_skip_enabled()
local enable_night_skip = minetest.setting_getbool("enable_bed_night_skip") local enable_night_skip = minetest.settings:get_bool("enable_bed_night_skip")
if enable_night_skip == nil then if enable_night_skip == nil then
enable_night_skip = true enable_night_skip = true
end end

View File

@ -110,7 +110,8 @@ function boat.on_punch(self, puncher)
if not self.driver then if not self.driver then
self.removed = true self.removed = true
local inv = puncher:get_inventory() local inv = puncher:get_inventory()
if not minetest.setting_getbool("creative_mode") if not (creative and creative.is_enabled_for
and creative.is_enabled_for(puncher:get_player_name()))
or not inv:contains_item("main", "boats:boat") then or not inv:contains_item("main", "boats:boat") then
local leftover = inv:add_item("main", "boats:boat") local leftover = inv:add_item("main", "boats:boat")
-- if no room in inventory add a replacement boat to the world -- if no room in inventory add a replacement boat to the world
@ -225,6 +226,16 @@ minetest.register_craftitem("boats:boat", {
groups = {flammable = 2}, groups = {flammable = 2},
on_place = function(itemstack, placer, pointed_thing) on_place = function(itemstack, placer, pointed_thing)
local under = pointed_thing.under
local node = minetest.get_node(under)
local udef = minetest.registered_nodes[node.name]
if udef and udef.on_rightclick and
not (placer and placer:is_player() and
placer:get_player_control().sneak) then
return udef.on_rightclick(under, node, placer, itemstack,
pointed_thing) or itemstack
end
if pointed_thing.type ~= "node" then if pointed_thing.type ~= "node" then
return itemstack return itemstack
end end
@ -234,8 +245,12 @@ minetest.register_craftitem("boats:boat", {
pointed_thing.under.y = pointed_thing.under.y + 0.5 pointed_thing.under.y = pointed_thing.under.y + 0.5
boat = minetest.add_entity(pointed_thing.under, "boats:boat") boat = minetest.add_entity(pointed_thing.under, "boats:boat")
if boat then if boat then
boat:setyaw(placer:get_look_horizontal()) if placer then
if not minetest.setting_getbool("creative_mode") then boat:setyaw(placer:get_look_horizontal())
end
local player_name = placer and placer:get_player_name() or ""
if not (creative and creative.is_enabled_for and
creative.is_enabled_for(player_name)) then
itemstack:take_item() itemstack:take_item()
end end
end end

View File

@ -21,8 +21,8 @@ local bones_formspec =
"listring[current_player;main]" .. "listring[current_player;main]" ..
default.get_hotbar_bg(0,4.85) default.get_hotbar_bg(0,4.85)
local share_bones_time = tonumber(minetest.setting_get("share_bones_time")) or 1200 local share_bones_time = tonumber(minetest.settings:get("share_bones_time")) or 1200
local share_bones_time_early = tonumber(minetest.setting_get("share_bones_time_early")) or share_bones_time / 4 local share_bones_time_early = tonumber(minetest.settings:get("share_bones_time_early")) or share_bones_time / 4
minetest.register_node("bones:bones", { minetest.register_node("bones:bones", {
description = "Bones", description = "Bones",
@ -68,6 +68,12 @@ minetest.register_node("bones:bones", {
on_metadata_inventory_take = function(pos, listname, index, stack, player) on_metadata_inventory_take = function(pos, listname, index, stack, player)
local meta = minetest.get_meta(pos) local meta = minetest.get_meta(pos)
if meta:get_inventory():is_empty("main") then if meta:get_inventory():is_empty("main") then
local inv = player:get_inventory()
if inv:room_for_item("main", {name = "bones:bones"}) then
inv:add_item("main", {name = "bones:bones"})
else
minetest.add_item(pos, "bones:bones")
end
minetest.remove_node(pos) minetest.remove_node(pos)
end end
end, end,
@ -161,13 +167,14 @@ end
minetest.register_on_dieplayer(function(player) minetest.register_on_dieplayer(function(player)
local bones_mode = minetest.setting_get("bones_mode") or "bones" local bones_mode = minetest.settings:get("bones_mode") or "bones"
if bones_mode ~= "bones" and bones_mode ~= "drop" and bones_mode ~= "keep" then if bones_mode ~= "bones" and bones_mode ~= "drop" and bones_mode ~= "keep" then
bones_mode = "bones" bones_mode = "bones"
end end
-- return if keep inventory set or in creative mode -- return if keep inventory set or in creative mode
if bones_mode == "keep" or minetest.setting_getbool("creative_mode") then if bones_mode == "keep" or (creative and creative.is_enabled_for
and creative.is_enabled_for(player:get_player_name())) then
return return
end end

View File

@ -69,7 +69,8 @@ function bucket.register_liquid(source, flowing, itemname, inventory_image, name
-- Call on_rightclick if the pointed node defines it -- Call on_rightclick if the pointed node defines it
if ndef and ndef.on_rightclick and if ndef and ndef.on_rightclick and
user and not user:get_player_control().sneak then not (user and user:is_player() and
user:get_player_control().sneak) then
return ndef.on_rightclick( return ndef.on_rightclick(
pointed_thing.under, pointed_thing.under,
node, user, node, user,

View File

@ -58,7 +58,8 @@ end
function cart_entity:on_punch(puncher, time_from_last_punch, tool_capabilities, direction) function cart_entity:on_punch(puncher, time_from_last_punch, tool_capabilities, direction)
local pos = self.object:getpos() local pos = self.object:getpos()
if not self.railtype then local vel = self.object:getvelocity()
if not self.railtype or vector.equals(vel, {x=0, y=0, z=0}) then
local node = minetest.get_node(pos).name local node = minetest.get_node(pos).name
self.railtype = minetest.get_item_group(node, "connect_to_raillike") self.railtype = minetest.get_item_group(node, "connect_to_raillike")
end end
@ -92,7 +93,8 @@ function cart_entity:on_punch(puncher, time_from_last_punch, tool_capabilities,
end end
-- Pick up cart -- Pick up cart
local inv = puncher:get_inventory() local inv = puncher:get_inventory()
if not minetest.setting_getbool("creative_mode") if not (creative and creative.is_enabled_for
and creative.is_enabled_for(puncher:get_player_name()))
or not inv:contains_item("main", "carts:cart") then or not inv:contains_item("main", "carts:cart") then
local leftover = inv:add_item("main", "carts:cart") local leftover = inv:add_item("main", "carts:cart")
-- If no room in inventory add a replacement cart to the world -- If no room in inventory add a replacement cart to the world
@ -104,7 +106,6 @@ function cart_entity:on_punch(puncher, time_from_last_punch, tool_capabilities,
return return
end end
-- Player punches cart to alter velocity -- Player punches cart to alter velocity
local vel = self.object:getvelocity()
if puncher:get_player_name() == self.driver then if puncher:get_player_name() == self.driver then
if math.abs(vel.x + vel.z) > carts.punch_speed_max then if math.abs(vel.x + vel.z) > carts.punch_speed_max then
return return
@ -362,6 +363,16 @@ minetest.register_craftitem("carts:cart", {
inventory_image = minetest.inventorycube("carts_cart_top.png", "carts_cart_side.png", "carts_cart_side.png"), inventory_image = minetest.inventorycube("carts_cart_top.png", "carts_cart_side.png", "carts_cart_side.png"),
wield_image = "carts_cart_side.png", wield_image = "carts_cart_side.png",
on_place = function(itemstack, placer, pointed_thing) on_place = function(itemstack, placer, pointed_thing)
local under = pointed_thing.under
local node = minetest.get_node(under)
local udef = minetest.registered_nodes[node.name]
if udef and udef.on_rightclick and
not (placer and placer:is_player() and
placer:get_player_control().sneak) then
return udef.on_rightclick(under, node, placer, itemstack,
pointed_thing) or itemstack
end
if not pointed_thing.type == "node" then if not pointed_thing.type == "node" then
return return
end end
@ -376,7 +387,8 @@ minetest.register_craftitem("carts:cart", {
minetest.sound_play({name = "default_place_node_metal", gain = 0.5}, minetest.sound_play({name = "default_place_node_metal", gain = 0.5},
{pos = pointed_thing.above}) {pos = pointed_thing.above})
if not minetest.setting_getbool("creative_mode") then if not (creative and creative.is_enabled_for
and creative.is_enabled_for(placer:get_player_name())) then
itemstack:take_item() itemstack:take_item()
end end
return itemstack return itemstack

View File

@ -159,30 +159,36 @@ function carts:get_rail_direction(pos_, dir, ctrl, old_switch, railtype)
end end
function carts:pathfinder(pos_, old_pos, old_dir, ctrl, pf_switch, railtype) function carts:pathfinder(pos_, old_pos, old_dir, ctrl, pf_switch, railtype)
if vector.equals(old_pos, pos_) then
return true
end
local pos = vector.round(pos_) local pos = vector.round(pos_)
local pf_pos = vector.round(old_pos) local pf_pos = vector.round(old_pos)
local pf_dir = vector.new(old_dir) local pf_dir = vector.new(old_dir)
for i = 1, 3 do for i = 1, 3 do
if vector.equals(pf_pos, pos) then pf_dir, pf_switch = carts:get_rail_direction(
-- Success! Cart moved on correctly pf_pos, pf_dir, ctrl, pf_switch, railtype)
return true
end
pf_dir, pf_switch = carts:get_rail_direction(pf_pos, pf_dir, ctrl, pf_switch, railtype)
if vector.equals(pf_dir, {x=0, y=0, z=0}) then if vector.equals(pf_dir, {x=0, y=0, z=0}) then
-- No way forwards -- No way forwards
return false return false
end end
pf_pos = vector.add(pf_pos, pf_dir) pf_pos = vector.add(pf_pos, pf_dir)
if vector.equals(pf_pos, pos) then
-- Success! Cart moved on correctly
return true
end
end end
-- Cart not found -- Cart not found
return false return false
end end
function carts:register_rail(name, def, railparams) function carts:register_rail(name, def_overwrite, railparams)
local def_default = { local def = {
drawtype = "raillike", drawtype = "raillike",
paramtype = "light", paramtype = "light",
sunlight_propagates = true, sunlight_propagates = true,
@ -194,7 +200,7 @@ function carts:register_rail(name, def, railparams)
}, },
sounds = default.node_sound_metal_defaults() sounds = default.node_sound_metal_defaults()
} }
for k, v in pairs(def_default) do for k, v in pairs(def_overwrite) do
def[k] = v def[k] = v
end end
if not def.inventory_image then if not def.inventory_image then
@ -211,7 +217,12 @@ end
function carts:get_rail_groups(additional_groups) function carts:get_rail_groups(additional_groups)
-- Get the default rail groups and add more when a table is given -- Get the default rail groups and add more when a table is given
local groups = {dig_immediate = 2, attached_node = 1, rail = 1, connect_to_raillike = 1} local groups = {
dig_immediate = 2,
attached_node = 1,
rail = 1,
connect_to_raillike = minetest.raillike_group("rail")
}
if type(additional_groups) == "table" then if type(additional_groups) == "table" then
for k, v in pairs(additional_groups) do for k, v in pairs(additional_groups) do
groups[k] = v groups[k] = v

View File

@ -10,11 +10,11 @@ carts:register_rail("carts:rail", {
}, {}) }, {})
minetest.register_craft({ minetest.register_craft({
output = "carts:rail 16", output = "carts:rail 18",
recipe = { recipe = {
{"default:steel_ingot", "group:wood", "default:steel_ingot"},
{"default:steel_ingot", "", "default:steel_ingot"}, {"default:steel_ingot", "", "default:steel_ingot"},
{"default:steel_ingot", "group:stick", "default:steel_ingot"}, {"default:steel_ingot", "group:wood", "default:steel_ingot"},
{"default:steel_ingot", "", "default:steel_ingot"},
} }
}) })
@ -31,11 +31,11 @@ carts:register_rail("carts:powerrail", {
}, {acceleration = 5}) }, {acceleration = 5})
minetest.register_craft({ minetest.register_craft({
output = "carts:powerrail 8", output = "carts:powerrail 18",
recipe = { recipe = {
{"default:steel_ingot", "default:mese_crystal_fragment", "default:steel_ingot"}, {"default:steel_ingot", "group:wood", "default:steel_ingot"},
{"default:steel_ingot", "group:stick", "default:steel_ingot"}, {"default:steel_ingot", "default:mese_crystal", "default:steel_ingot"},
{"default:steel_ingot", "default:mese_crystal_fragment", "default:steel_ingot"}, {"default:steel_ingot", "group:wood", "default:steel_ingot"},
} }
}) })
@ -50,10 +50,10 @@ carts:register_rail("carts:brakerail", {
}, {acceleration = -3}) }, {acceleration = -3})
minetest.register_craft({ minetest.register_craft({
output = "carts:brakerail 8", output = "carts:brakerail 18",
recipe = { recipe = {
{"default:steel_ingot", "group:wood", "default:steel_ingot"},
{"default:steel_ingot", "default:coal_lump", "default:steel_ingot"}, {"default:steel_ingot", "default:coal_lump", "default:steel_ingot"},
{"default:steel_ingot", "group:stick", "default:steel_ingot"}, {"default:steel_ingot", "group:wood", "default:steel_ingot"},
{"default:steel_ingot", "default:coal_lump", "default:steel_ingot"},
} }
}) })

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.0 KiB

After

Width:  |  Height:  |  Size: 459 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.1 KiB

After

Width:  |  Height:  |  Size: 486 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.1 KiB

After

Width:  |  Height:  |  Size: 522 B

View File

@ -1,6 +1,14 @@
creative = {}
local creative_mode_cache = minetest.settings:get_bool("creative_mode")
function creative.is_enabled_for(name)
return creative_mode_cache
end
dofile(minetest.get_modpath("creative") .. "/inventory.lua") dofile(minetest.get_modpath("creative") .. "/inventory.lua")
if minetest.setting_getbool("creative_mode") then if creative_mode_cache then
-- Dig time is modified according to difference (leveldiff) between tool -- Dig time is modified according to difference (leveldiff) between tool
-- 'maxlevel' and node 'level'. Digtime is divided by the larger of -- 'maxlevel' and node 'level'. Digtime is divided by the larger of
-- leveldiff and 1. -- leveldiff and 1.
@ -28,22 +36,27 @@ if minetest.setting_getbool("creative_mode") then
damage_groups = {fleshy = 10}, damage_groups = {fleshy = 10},
} }
}) })
end
minetest.register_on_placenode(function(pos, newnode, placer, oldnode, itemstack) -- Unlimited node placement
return true minetest.register_on_placenode(function(pos, newnode, placer, oldnode, itemstack)
end) if placer and placer:is_player() then
return creative.is_enabled_for(placer:get_player_name())
end
end)
function minetest.handle_node_drops(pos, drops, digger) -- Don't pick up if the item is already in the inventory
if not digger or not digger:is_player() then local old_handle_node_drops = minetest.handle_node_drops
return function minetest.handle_node_drops(pos, drops, digger)
end if not digger or not digger:is_player() or
local inv = digger:get_inventory() not creative.is_enabled_for(digger:get_player_name()) then
if inv then return old_handle_node_drops(pos, drops, digger)
for _, item in ipairs(drops) do end
item = ItemStack(item):get_name() local inv = digger:get_inventory()
if not inv:contains_item("main", item) then if inv then
inv:add_item("main", item) for _, item in ipairs(drops) do
end if not inv:contains_item("main", item, true) then
inv:add_item("main", item)
end end
end end
end end

View File

@ -1,5 +1,19 @@
creative = {}
local player_inventory = {} local player_inventory = {}
local inventory_cache = {}
local function init_creative_cache(items)
inventory_cache[items] = {}
local i_cache = inventory_cache[items]
for name, def in pairs(items) do
if def.groups.not_in_creative_inventory ~= 1 and
def.description and def.description ~= "" then
i_cache[name] = def
end
end
table.sort(i_cache)
return i_cache
end
function creative.init_creative_inventory(player) function creative.init_creative_inventory(player)
local player_name = player:get_player_name() local player_name = player:get_player_name()
@ -11,22 +25,25 @@ function creative.init_creative_inventory(player)
minetest.create_detached_inventory("creative_" .. player_name, { minetest.create_detached_inventory("creative_" .. player_name, {
allow_move = function(inv, from_list, from_index, to_list, to_index, count, player2) allow_move = function(inv, from_list, from_index, to_list, to_index, count, player2)
if not to_list == "main" then local name = player2 and player2:get_player_name() or ""
return count if not creative.is_enabled_for(name) or
else to_list == "main" then
return 0 return 0
end end
return count
end, end,
allow_put = function(inv, listname, index, stack, player2) allow_put = function(inv, listname, index, stack, player2)
return 0 return 0
end, end,
allow_take = function(inv, listname, index, stack, player2) allow_take = function(inv, listname, index, stack, player2)
local name = player2 and player2:get_player_name() or ""
if not creative.is_enabled_for(name) then
return 0
end
return -1 return -1
end, end,
on_move = function(inv, from_list, from_index, to_list, to_index, count, player2) on_move = function(inv, from_list, from_index, to_list, to_index, count, player2)
end, end,
on_put = function(inv, listname, index, stack, player2)
end,
on_take = function(inv, listname, index, stack, player2) on_take = function(inv, listname, index, stack, player2)
if stack and stack:get_count() > 0 then if stack and stack:get_count() > 0 then
minetest.log("action", player_name .. " takes " .. stack:get_name().. " from creative inventory") minetest.log("action", player_name .. " takes " .. stack:get_name().. " from creative inventory")
@ -34,22 +51,20 @@ function creative.init_creative_inventory(player)
end, end,
}, player_name) }, player_name)
creative.update_creative_inventory(player_name, minetest.registered_items) return player_inventory[player_name]
end end
function creative.update_creative_inventory(player_name, tab_content) function creative.update_creative_inventory(player_name, tab_content)
local creative_list = {} local creative_list = {}
local inv = player_inventory[player_name] or
creative.init_creative_inventory(minetest.get_player_by_name(player_name))
local player_inv = minetest.get_inventory({type = "detached", name = "creative_" .. player_name}) local player_inv = minetest.get_inventory({type = "detached", name = "creative_" .. player_name})
local inv = player_inventory[player_name]
if not inv then
creative.init_creative_inventory(minetest.get_player_by_name(player_name))
end
for name, def in pairs(tab_content) do local items = inventory_cache[tab_content] or init_creative_cache(tab_content)
if not (def.groups.not_in_creative_inventory == 1) and
def.description and def.description ~= "" and for name, def in pairs(items) do
(def.name:find(inv.filter, 1, true) or if def.name:find(inv.filter, 1, true) or
def.description:lower():find(inv.filter, 1, true)) then def.description:lower():find(inv.filter, 1, true) then
creative_list[#creative_list+1] = name creative_list[#creative_list+1] = name
end end
end end
@ -79,7 +94,7 @@ function creative.register_tab(name, title, items)
sfinv.register_page("creative:" .. name, { sfinv.register_page("creative:" .. name, {
title = title, title = title,
is_in_nav = function(self, player, context) is_in_nav = function(self, player, context)
return minetest.setting_getbool("creative_mode") return creative.is_enabled_for(player:get_player_name())
end, end,
get = function(self, player, context) get = function(self, player, context)
local player_name = player:get_player_name() local player_name = player:get_player_name()
@ -103,6 +118,8 @@ function creative.register_tab(name, title, items)
button[2.75,3.4;0.8,0.5;creative_clear;X] button[2.75,3.4;0.8,0.5;creative_clear;X]
tooltip[creative_search;Search] tooltip[creative_search;Search]
tooltip[creative_clear;Reset] tooltip[creative_clear;Reset]
tooltip[creative_prev;Previous page]
tooltip[creative_next;Next page]
listring[current_player;main] listring[current_player;main]
field_close_on_enter[creative_filter;false] field_close_on_enter[creative_filter;false]
]] .. ]] ..
@ -161,10 +178,6 @@ function creative.register_tab(name, title, items)
}) })
end end
minetest.register_on_joinplayer(function(player)
creative.init_creative_inventory(player)
end)
creative.register_tab("all", "All", minetest.registered_items) creative.register_tab("all", "All", minetest.registered_items)
creative.register_tab("nodes", "Nodes", minetest.registered_nodes) creative.register_tab("nodes", "Nodes", minetest.registered_nodes)
creative.register_tab("tools", "Tools", minetest.registered_tools) creative.register_tab("tools", "Tools", minetest.registered_tools)
@ -172,7 +185,7 @@ creative.register_tab("craftitems", "Items", minetest.registered_craftitems)
local old_homepage_name = sfinv.get_homepage_name local old_homepage_name = sfinv.get_homepage_name
function sfinv.get_homepage_name(player) function sfinv.get_homepage_name(player)
if minetest.setting_getbool("creative_mode") then if creative.is_enabled_for(player:get_player_name()) then
return "creative:all" return "creative:all"
else else
return old_homepage_name(player) return old_homepage_name(player)

View File

@ -17,6 +17,7 @@ Cisoun's texture pack (CC BY-SA 3.0):
default_lava.png default_lava.png
default_leaves.png default_leaves.png
default_sapling.png default_sapling.png
default_bush_sapling.png
default_stone.png default_stone.png
default_tree.png default_tree.png
default_tree_top.png default_tree_top.png
@ -77,10 +78,6 @@ Splizard (CC BY-SA 3.0):
Zeg9 (CC BY-SA 3.0): Zeg9 (CC BY-SA 3.0):
default_coal_block.png default_coal_block.png
default_steel_block.png
default_copper_block.png
default_bronze_block.png
default_gold_block.png
paramat (CC BY-SA 3.0): paramat (CC BY-SA 3.0):
wieldhand.png -- Copied from character.png by Jordach (CC BY-SA 3.0) wieldhand.png -- Copied from character.png by Jordach (CC BY-SA 3.0)
@ -90,6 +87,7 @@ paramat (CC BY-SA 3.0):
default_acacia_leaves.png default_acacia_leaves.png
default_acacia_leaves_simple.png default_acacia_leaves_simple.png
default_acacia_sapling.png default_acacia_sapling.png
default_acacia_bush_sapling.png
default_acacia_tree.png default_acacia_tree.png
default_acacia_tree_top.png default_acacia_tree_top.png
default_acacia_wood.png default_acacia_wood.png
@ -115,18 +113,25 @@ paramat (CC BY-SA 3.0):
default_grass_side.png default_grass_side.png
default_mese_block.png default_mese_block.png
default_silver_sand.png default_silver_sand.png
default_mese_post_light_side.png
default_mese_post_light_side_dark.png
default_mese_post_light_top.png
default_silver_sandstone.png -- Derived from a texture by GreenXenith (CC-BY-SA 3.0)
default_silver_sandstone_brick.png -- Derived from a texture by GreenXenith (CC-BY-SA 3.0)
default_silver_sandstone_block.png -- Derived from a texture by GreenXenith (CC-BY-SA 3.0)
default_bookshelf_slot.png -- Derived from a texture by Gambit (CC-BY-SA 3.0)
brunob.santos (CC BY-SA 4.0): brunob.santos (CC BY-SA 4.0):
default_desert_cobble.png default_desert_cobble.png
BlockMen (CC BY-SA 3.0): BlockMen (CC BY-SA 3.0):
default_aspen_leaves.png -- Derived from Sofar's texture
default_wood.png default_wood.png
default_clay_brick.png default_clay_brick.png
default_iron_ingot.png default_iron_ingot.png
default_gold_ingot.png default_gold_ingot.png
default_tool_steelsword.png default_tool_steelsword.png
default_diamond.png default_diamond.png
default_book.png
default_tool_*.png default_tool_*.png
default_lava_source_animated.png default_lava_source_animated.png
default_lava_flowing_animated.png default_lava_flowing_animated.png
@ -140,16 +145,14 @@ BlockMen (CC BY-SA 3.0):
bubble.png bubble.png
gui_*.png gui_*.png
Wuzzy (CC BY-SA 3.0):
default_bookshelf_slot.png (based on default_book.png)
sofar (CC BY-SA 3.0): sofar (CC BY-SA 3.0):
default_book_written.png, based on default_book.png
default_aspen_sapling default_aspen_sapling
default_aspen_leaves
default_aspen_tree default_aspen_tree
default_aspen_tree_top, derived from default_pine_tree_top (by paramat) default_aspen_tree_top, derived from default_pine_tree_top (by paramat)
default_aspen_wood, derived from default_pine_wood (by paramat) default_aspen_wood, derived from default_pine_wood (by paramat)
default_chest_inside
sofar (WTFPL):
default_gravel.png -- Derived from Gambit's PixelBOX texture pack light gravel default_gravel.png -- Derived from Gambit's PixelBOX texture pack light gravel
Neuromancer (CC BY-SA 2.0): Neuromancer (CC BY-SA 2.0):
@ -179,6 +182,7 @@ Gambit (CC BY-SA 3.0):
default_snowball.png default_snowball.png
default_key.png default_key.png
default_key_skeleton.png default_key_skeleton.png
default_book.png
asl97 (CC BY-SA 3.0): asl97 (CC BY-SA 3.0):
default_ice.png default_ice.png
@ -195,6 +199,28 @@ Ferk (CC0 1.0)
default_item_smoke.png default_item_smoke.png
default_item_smoke.ogg, based on sound by http://opengameart.org/users/bart default_item_smoke.ogg, based on sound by http://opengameart.org/users/bart
npx (CC BY-SA 3.0)
default_rainforest_litter.png
default_rainforest_litter_side.png
kaeza (CC-BY-SA 3.0):
default_desert_sandstone.png
default_desert_sandstone_brick.png
default_desert_sandstone_block.png
kilbith (CC BY-SA 3.0):
default_steel_block.png
default_copper_block.png
default_bronze_block.png
default_gold_block.png
default_tin_block.png
default_mineral_tin.png
default_tin_ingot.png
default_tin_lump.png
CloudyProton (CC BY-SA 3.0):
default_book_written.png, based on default_book.png by Gambit
Glass breaking sounds (CC BY 3.0): Glass breaking sounds (CC BY 3.0):
1: http://www.freesound.org/people/cmusounddesign/sounds/71947/ 1: http://www.freesound.org/people/cmusounddesign/sounds/71947/
2: http://www.freesound.org/people/Tomlija/sounds/97669/ 2: http://www.freesound.org/people/Tomlija/sounds/97669/
@ -262,3 +288,13 @@ https://www.freesound.org/people/AGFX/packs/1253/
blukotek (CC0 1.0) blukotek (CC0 1.0)
https://www.freesound.org/people/blukotek/sounds/251660/ https://www.freesound.org/people/blukotek/sounds/251660/
default_dig_snappy.ogg default_dig_snappy.ogg
Chests sounds added by sofar, derived of several files mixed together:
default_chest_open.ogg
default_chest_close.ogg
- http://www.freesound.org/people/Sevin7/sounds/269722/ CC0
- http://www.freesound.org/people/Percy%20Duke/sounds/23448/ CC-BY-3.0
- http://www.freesound.org/people/kingsamas/sounds/135576/ CC-BY-3.0
- http://www.freesound.org/people/bulbastre/sounds/126887/ CC-BY-3.0
- http://www.freesound.org/people/Yoyodaman234/sounds/183541/ CC0

View File

@ -190,6 +190,9 @@ minetest.register_craft({
} }
}) })
-- Axes
-- Recipes face left to match appearence in textures and inventory
minetest.register_craft({ minetest.register_craft({
output = 'default:axe_wood', output = 'default:axe_wood',
recipe = { recipe = {
@ -244,60 +247,6 @@ minetest.register_craft({
} }
}) })
minetest.register_craft({
output = 'default:axe_wood',
recipe = {
{'group:wood', 'group:wood'},
{'group:stick', 'group:wood'},
{'group:stick',''},
}
})
minetest.register_craft({
output = 'default:axe_stone',
recipe = {
{'group:stone', 'group:stone'},
{'group:stick', 'group:stone'},
{'group:stick', ''},
}
})
minetest.register_craft({
output = 'default:axe_steel',
recipe = {
{'default:steel_ingot', 'default:steel_ingot'},
{'group:stick', 'default:steel_ingot'},
{'group:stick', ''},
}
})
minetest.register_craft({
output = 'default:axe_bronze',
recipe = {
{'default:bronze_ingot', 'default:bronze_ingot'},
{'group:stick', 'default:bronze_ingot'},
{'group:stick', ''},
}
})
minetest.register_craft({
output = 'default:axe_mese',
recipe = {
{'default:mese_crystal', 'default:mese_crystal'},
{'group:stick', 'default:mese_crystal'},
{'group:stick', ''},
}
})
minetest.register_craft({
output = 'default:axe_diamond',
recipe = {
{'default:diamond', 'default:diamond'},
{'group:stick', 'default:diamond'},
{'group:stick', ''},
}
})
minetest.register_craft({ minetest.register_craft({
output = 'default:sword_wood', output = 'default:sword_wood',
recipe = { recipe = {
@ -392,12 +341,6 @@ minetest.register_craft({
} }
}) })
minetest.register_craft({
type = "shapeless",
output = "default:bronze_ingot",
recipe = {"default:steel_ingot", "default:copper_ingot"},
})
minetest.register_craft({ minetest.register_craft({
output = 'default:coalblock', output = 'default:coalblock',
recipe = { recipe = {
@ -446,6 +389,31 @@ minetest.register_craft({
} }
}) })
minetest.register_craft({
output = "default:tinblock",
recipe = {
{"default:tin_ingot", "default:tin_ingot", "default:tin_ingot"},
{"default:tin_ingot", "default:tin_ingot", "default:tin_ingot"},
{"default:tin_ingot", "default:tin_ingot", "default:tin_ingot"},
}
})
minetest.register_craft({
output = "default:tin_ingot 9",
recipe = {
{"default:tinblock"},
}
})
minetest.register_craft({
output = "default:bronze_ingot 9",
recipe = {
{"default:copper_ingot", "default:copper_ingot", "default:copper_ingot"},
{"default:copper_ingot", "default:tin_ingot", "default:copper_ingot"},
{"default:copper_ingot", "default:copper_ingot", "default:copper_ingot"},
}
})
minetest.register_craft({ minetest.register_craft({
output = 'default:bronzeblock', output = 'default:bronzeblock',
recipe = { recipe = {
@ -495,34 +463,98 @@ minetest.register_craft({
}) })
minetest.register_craft({ minetest.register_craft({
output = 'default:sandstone', output = "default:sandstone",
recipe = { recipe = {
{'group:sand', 'group:sand'}, {"default:sand", "default:sand"},
{'group:sand', 'group:sand'}, {"default:sand", "default:sand"},
} }
}) })
minetest.register_craft({ minetest.register_craft({
output = 'default:sand 4', output = "default:sand 4",
recipe = { recipe = {
{'default:sandstone'}, {"default:sandstone"},
} }
}) })
minetest.register_craft({ minetest.register_craft({
output = 'default:sandstonebrick 4', output = "default:sandstonebrick 4",
recipe = { recipe = {
{'default:sandstone', 'default:sandstone'}, {"default:sandstone", "default:sandstone"},
{'default:sandstone', 'default:sandstone'}, {"default:sandstone", "default:sandstone"},
} }
}) })
minetest.register_craft({ minetest.register_craft({
output = 'default:sandstone_block 9', output = "default:sandstone_block 9",
recipe = { recipe = {
{'default:sandstone', 'default:sandstone', 'default:sandstone'}, {"default:sandstone", "default:sandstone", "default:sandstone"},
{'default:sandstone', 'default:sandstone', 'default:sandstone'}, {"default:sandstone", "default:sandstone", "default:sandstone"},
{'default:sandstone', 'default:sandstone', 'default:sandstone'}, {"default:sandstone", "default:sandstone", "default:sandstone"},
}
})
minetest.register_craft({
output = "default:desert_sandstone",
recipe = {
{"default:desert_sand", "default:desert_sand"},
{"default:desert_sand", "default:desert_sand"},
}
})
minetest.register_craft({
output = "default:desert_sand 4",
recipe = {
{"default:desert_sandstone"},
}
})
minetest.register_craft({
output = "default:desert_sandstone_brick 4",
recipe = {
{"default:desert_sandstone", "default:desert_sandstone"},
{"default:desert_sandstone", "default:desert_sandstone"},
}
})
minetest.register_craft({
output = "default:desert_sandstone_block 9",
recipe = {
{"default:desert_sandstone", "default:desert_sandstone", "default:desert_sandstone"},
{"default:desert_sandstone", "default:desert_sandstone", "default:desert_sandstone"},
{"default:desert_sandstone", "default:desert_sandstone", "default:desert_sandstone"},
}
})
minetest.register_craft({
output = "default:silver_sandstone",
recipe = {
{"default:silver_sand", "default:silver_sand"},
{"default:silver_sand", "default:silver_sand"},
}
})
minetest.register_craft({
output = "default:silver_sand 4",
recipe = {
{"default:silver_sandstone"},
}
})
minetest.register_craft({
output = "default:silver_sandstone_brick 4",
recipe = {
{"default:silver_sandstone", "default:silver_sandstone"},
{"default:silver_sandstone", "default:silver_sandstone"},
}
})
minetest.register_craft({
output = "default:silver_sandstone_block 9",
recipe = {
{"default:silver_sandstone", "default:silver_sandstone", "default:silver_sandstone"},
{"default:silver_sandstone", "default:silver_sandstone", "default:silver_sandstone"},
{"default:silver_sandstone", "default:silver_sandstone", "default:silver_sandstone"},
} }
}) })
@ -582,11 +614,11 @@ minetest.register_craft({
}) })
minetest.register_craft({ minetest.register_craft({
output = 'default:ladder_wood 3', output = "default:ladder_wood 5",
recipe = { recipe = {
{'group:stick', '', 'group:stick'}, {"group:stick", "", "group:stick"},
{'group:stick', 'group:stick', 'group:stick'}, {"group:stick", "group:stick", "group:stick"},
{'group:stick', '', 'group:stick'}, {"group:stick", "", "group:stick"},
} }
}) })
@ -632,10 +664,19 @@ minetest.register_craft({
}) })
minetest.register_craft({ minetest.register_craft({
output = 'default:meselamp 1', output = 'default:meselamp',
recipe = { recipe = {
{'', 'default:mese_crystal',''}, {'default:glass'},
{'default:mese_crystal', 'default:glass', 'default:mese_crystal'}, {'default:mese_crystal'},
}
})
minetest.register_craft({
output = "default:mese_post_light 3",
recipe = {
{"", "default:glass", ""},
{"default:mese_crystal", "default:mese_crystal", "default:mese_crystal"},
{"", "group:wood", ""},
} }
}) })
@ -776,6 +817,12 @@ minetest.register_craft({
recipe = "default:copper_lump", recipe = "default:copper_lump",
}) })
minetest.register_craft({
type = "cooking",
output = "default:tin_ingot",
recipe = "default:tin_lump",
})
minetest.register_craft({ minetest.register_craft({
type = "cooking", type = "cooking",
output = "default:gold_ingot", output = "default:gold_ingot",
@ -806,7 +853,7 @@ minetest.register_craft({
-- Fuels -- Fuels
-- --
-- Support use of group:tree -- Support use of group:tree, includes default:tree which has the same burn time
minetest.register_craft({ minetest.register_craft({
type = "fuel", type = "fuel",
recipe = "group:tree", recipe = "group:tree",
@ -829,12 +876,6 @@ minetest.register_craft({
burntime = 26, burntime = 26,
}) })
minetest.register_craft({
type = "fuel",
recipe = "default:tree",
burntime = 30,
})
minetest.register_craft({ minetest.register_craft({
type = "fuel", type = "fuel",
recipe = "default:acacia_tree", recipe = "default:acacia_tree",
@ -848,7 +889,7 @@ minetest.register_craft({
}) })
-- Support use of group:wood -- Support use of group:wood, includes default:wood which has the same burn time
minetest.register_craft({ minetest.register_craft({
type = "fuel", type = "fuel",
recipe = "group:wood", recipe = "group:wood",
@ -867,12 +908,6 @@ minetest.register_craft({
burntime = 6, burntime = 6,
}) })
minetest.register_craft({
type = "fuel",
recipe = "default:wood",
burntime = 7,
})
minetest.register_craft({ minetest.register_craft({
type = "fuel", type = "fuel",
recipe = "default:acacia_wood", recipe = "default:acacia_wood",
@ -886,41 +921,47 @@ minetest.register_craft({
}) })
-- Support use of group:sapling -- Support use of group:sapling, includes default:sapling which has the same burn time
minetest.register_craft({ minetest.register_craft({
type = "fuel", type = "fuel",
recipe = "group:sapling", recipe = "group:sapling",
burntime = 10, burntime = 5,
})
minetest.register_craft({
type = "fuel",
recipe = "default:bush_sapling",
burntime = 3,
})
minetest.register_craft({
type = "fuel",
recipe = "default:acacia_bush_sapling",
burntime = 4,
}) })
minetest.register_craft({ minetest.register_craft({
type = "fuel", type = "fuel",
recipe = "default:aspen_sapling", recipe = "default:aspen_sapling",
burntime = 8, burntime = 4,
}) })
minetest.register_craft({ minetest.register_craft({
type = "fuel", type = "fuel",
recipe = "default:pine_sapling", recipe = "default:pine_sapling",
burntime = 9, burntime = 5,
})
minetest.register_craft({
type = "fuel",
recipe = "default:sapling",
burntime = 10,
}) })
minetest.register_craft({ minetest.register_craft({
type = "fuel", type = "fuel",
recipe = "default:acacia_sapling", recipe = "default:acacia_sapling",
burntime = 11, burntime = 6,
}) })
minetest.register_craft({ minetest.register_craft({
type = "fuel", type = "fuel",
recipe = "default:junglesapling", recipe = "default:junglesapling",
burntime = 12, burntime = 6,
}) })
@ -970,13 +1011,13 @@ minetest.register_craft({
minetest.register_craft({ minetest.register_craft({
type = "fuel", type = "fuel",
recipe = "default:junglegrass", recipe = "default:junglegrass",
burntime = 2, burntime = 3,
}) })
minetest.register_craft({ minetest.register_craft({
type = "fuel", type = "fuel",
recipe = "group:leaves", recipe = "group:leaves",
burntime = 1, burntime = 4,
}) })
minetest.register_craft({ minetest.register_craft({
@ -988,7 +1029,7 @@ minetest.register_craft({
minetest.register_craft({ minetest.register_craft({
type = "fuel", type = "fuel",
recipe = "default:papyrus", recipe = "default:papyrus",
burntime = 1, burntime = 3,
}) })
minetest.register_craft({ minetest.register_craft({
@ -1000,7 +1041,7 @@ minetest.register_craft({
minetest.register_craft({ minetest.register_craft({
type = "fuel", type = "fuel",
recipe = "default:ladder_wood", recipe = "default:ladder_wood",
burntime = 2, burntime = 7,
}) })
minetest.register_craft({ minetest.register_craft({
@ -1033,12 +1074,6 @@ minetest.register_craft({
burntime = 30, burntime = 30,
}) })
minetest.register_craft({
type = "fuel",
recipe = "default:apple",
burntime = 3,
})
minetest.register_craft({ minetest.register_craft({
type = "fuel", type = "fuel",
recipe = "default:coal_lump", recipe = "default:coal_lump",

View File

@ -12,14 +12,23 @@ minetest.register_craftitem("default:paper", {
groups = {flammable = 3}, groups = {flammable = 3},
}) })
local lpp = 14 -- Lines per book's page local lpp = 14 -- Lines per book's page
local function book_on_use(itemstack, user) local function book_on_use(itemstack, user)
local player_name = user:get_player_name() local player_name = user:get_player_name()
local data = minetest.deserialize(itemstack:get_metadata()) local meta = itemstack:get_meta()
local title, text, owner = "", "", player_name local title, text, owner = "", "", player_name
local page, page_max, lines, string = 1, 1, {}, "" local page, page_max, lines, string = 1, 1, {}, ""
if data then -- Backwards compatibility
local old_data = minetest.deserialize(itemstack:get_metadata())
if old_data then
meta:from_table({ fields = old_data })
end
local data = meta:to_table().fields
if data.owner then
title = data.title title = data.title
text = data.text text = data.text
owner = data.owner owner = data.owner
@ -63,14 +72,19 @@ local function book_on_use(itemstack, user)
end end
minetest.show_formspec(player_name, "default:book", formspec) minetest.show_formspec(player_name, "default:book", formspec)
return itemstack
end end
local max_text_size = 10000
local max_title_size = 80
local short_title_size = 35
minetest.register_on_player_receive_fields(function(player, formname, fields) minetest.register_on_player_receive_fields(function(player, formname, fields)
if formname ~= "default:book" then return end if formname ~= "default:book" then return end
local inv = player:get_inventory() local inv = player:get_inventory()
local stack = player:get_wielded_item() local stack = player:get_wielded_item()
if fields.save and fields.title ~= "" and fields.text ~= "" then if fields.save and fields.title and fields.text
and fields.title ~= "" and fields.text ~= "" then
local new_stack, data local new_stack, data
if stack:get_name() ~= "default:book_written" then if stack:get_name() ~= "default:book_written" then
local count = stack:get_count() local count = stack:get_count()
@ -81,35 +95,47 @@ minetest.register_on_player_receive_fields(function(player, formname, fields)
new_stack = ItemStack("default:book_written") new_stack = ItemStack("default:book_written")
end end
else else
data = minetest.deserialize(stack:get_metadata()) data = stack:get_meta():to_table().fields
end
if data and data.owner and data.owner ~= player:get_player_name() then
return
end end
if not data then data = {} end if not data then data = {} end
data.title = fields.title data.title = fields.title:sub(1, max_title_size)
data.text = fields.text data.owner = player:get_player_name()
data.text_len = #data.text local short_title = data.title
-- Don't bother triming the title if the trailing dots would make it longer
if #short_title > short_title_size + 3 then
short_title = short_title:sub(1, short_title_size) .. "..."
end
data.description = "\""..short_title.."\" by "..data.owner
data.text = fields.text:sub(1, max_text_size)
data.text = data.text:gsub("\r\n", "\n"):gsub("\r", "\n")
data.page = 1 data.page = 1
data.page_max = math.ceil((#data.text:gsub("[^\n]", "") + 1) / lpp) data.page_max = math.ceil((#data.text:gsub("[^\n]", "") + 1) / lpp)
data.owner = player:get_player_name()
local data_str = minetest.serialize(data)
if new_stack then if new_stack then
new_stack:set_metadata(data_str) new_stack:get_meta():from_table({ fields = data })
if inv:room_for_item("main", new_stack) then if inv:room_for_item("main", new_stack) then
inv:add_item("main", new_stack) inv:add_item("main", new_stack)
else else
minetest.add_item(player:getpos(), new_stack) minetest.add_item(player:getpos(), new_stack)
end end
else else
stack:set_metadata(data_str) stack:get_meta():from_table({ fields = data })
end end
elseif fields.book_next or fields.book_prev then elseif fields.book_next or fields.book_prev then
local data = minetest.deserialize(stack:get_metadata()) local data = stack:get_meta():to_table().fields
if not data or not data.page then if not data or not data.page then
return return
end end
data.page = tonumber(data.page)
data.page_max = tonumber(data.page_max)
if fields.book_next then if fields.book_next then
data.page = data.page + 1 data.page = data.page + 1
if data.page > data.page_max then if data.page > data.page_max then
@ -122,11 +148,11 @@ minetest.register_on_player_receive_fields(function(player, formname, fields)
end end
end end
local data_str = minetest.serialize(data) stack:get_meta():from_table({fields = data})
stack:set_metadata(data_str) stack = book_on_use(stack, player)
book_on_use(stack, player)
end end
-- Update stack
player:set_wielded_item(stack) player:set_wielded_item(stack)
end) end)
@ -167,13 +193,69 @@ minetest.register_on_craft(function(itemstack, player, old_craft_grid, craft_inv
if not original then if not original then
return return
end end
local copymeta = original:get_metadata() local copymeta = original:get_meta():to_table()
-- copy of the book held by player's mouse cursor -- copy of the book held by player's mouse cursor
itemstack:set_metadata(copymeta) itemstack:get_meta():from_table(copymeta)
-- put the book with metadata back in the craft grid -- put the book with metadata back in the craft grid
craft_inv:set_stack("craft", index, original) craft_inv:set_stack("craft", index, original)
end) end)
minetest.register_craftitem("default:skeleton_key", {
description = "Skeleton Key",
inventory_image = "default_key_skeleton.png",
groups = {key = 1},
on_use = function(itemstack, user, pointed_thing)
if pointed_thing.type ~= "node" then
return itemstack
end
local pos = pointed_thing.under
local node = minetest.get_node(pos)
if not node then
return itemstack
end
local on_skeleton_key_use = minetest.registered_nodes[node.name].on_skeleton_key_use
if not on_skeleton_key_use then
return itemstack
end
-- make a new key secret in case the node callback needs it
local random = math.random
local newsecret = string.format(
"%04x%04x%04x%04x",
random(2^16) - 1, random(2^16) - 1,
random(2^16) - 1, random(2^16) - 1)
local secret, _, _ = on_skeleton_key_use(pos, user, newsecret)
if secret then
local inv = minetest.get_inventory({type="player", name=user:get_player_name()})
-- update original itemstack
itemstack:take_item()
-- finish and return the new key
local new_stack = ItemStack("default:key")
local meta = new_stack:get_meta()
meta:set_string("secret", secret)
meta:set_string("description", "Key to "..user:get_player_name().."'s "
..minetest.registered_nodes[node.name].description)
if itemstack:get_count() == 0 then
itemstack = new_stack
else
if inv:add_item("main", new_stack):get_count() > 0 then
minetest.add_item(user:getpos(), new_stack)
end -- else: added to inventory successfully
end
return itemstack
end
end
})
minetest.register_craftitem("default:coal_lump", { minetest.register_craftitem("default:coal_lump", {
description = "Coal Lump", description = "Coal Lump",
inventory_image = "default_coal_lump.png", inventory_image = "default_coal_lump.png",
@ -190,6 +272,11 @@ minetest.register_craftitem("default:copper_lump", {
inventory_image = "default_copper_lump.png", inventory_image = "default_copper_lump.png",
}) })
minetest.register_craftitem("default:tin_lump", {
description = "Tin Lump",
inventory_image = "default_tin_lump.png",
})
minetest.register_craftitem("default:mese_crystal", { minetest.register_craftitem("default:mese_crystal", {
description = "Mese Crystal", description = "Mese Crystal",
inventory_image = "default_mese_crystal.png", inventory_image = "default_mese_crystal.png",
@ -220,6 +307,11 @@ minetest.register_craftitem("default:copper_ingot", {
inventory_image = "default_copper_ingot.png", inventory_image = "default_copper_ingot.png",
}) })
minetest.register_craftitem("default:tin_ingot", {
description = "Tin Ingot",
inventory_image = "default_tin_ingot.png",
})
minetest.register_craftitem("default:bronze_ingot", { minetest.register_craftitem("default:bronze_ingot", {
description = "Bronze Ingot", description = "Bronze Ingot",
inventory_image = "default_bronze_ingot.png", inventory_image = "default_bronze_ingot.png",
@ -249,4 +341,3 @@ minetest.register_craftitem("default:flint", {
description = "Flint", description = "Flint",
inventory_image = "default_flint.png" inventory_image = "default_flint.png"
}) })

View File

@ -77,8 +77,6 @@ function default.node_sound_leaves_defaults(table)
{name = "default_grass_footstep", gain = 0.45} {name = "default_grass_footstep", gain = 0.45}
table.dug = table.dug or table.dug = table.dug or
{name = "default_grass_footstep", gain = 0.7} {name = "default_grass_footstep", gain = 0.7}
table.dig = table.dig or
{name = "default_dig_crumbly", gain = 0.4}
table.place = table.place or table.place = table.place or
{name = "default_place_node", gain = 1.0} {name = "default_place_node", gain = 1.0}
default.node_sound_defaults(table) default.node_sound_defaults(table)
@ -133,18 +131,19 @@ default.cool_lava = function(pos, node)
{pos = pos, max_hear_distance = 16, gain = 0.25}) {pos = pos, max_hear_distance = 16, gain = 0.25})
end end
minetest.register_abm({ if minetest.settings:get_bool("enable_lavacooling") ~= false then
label = "Lava cooling", minetest.register_abm({
nodenames = {"default:lava_source", "default:lava_flowing"}, label = "Lava cooling",
neighbors = {"group:cools_lava", "group:water"}, nodenames = {"default:lava_source", "default:lava_flowing"},
interval = 1, neighbors = {"group:cools_lava", "group:water"},
chance = 1, interval = 2,
catch_up = false, chance = 2,
action = function(...) catch_up = false,
default.cool_lava(...) action = function(...)
end, default.cool_lava(...)
}) end,
})
end
-- --
-- optimized helper to put all items in an inventory into a drops list -- optimized helper to put all items in an inventory into a drops list
@ -186,6 +185,9 @@ function default.grow_cactus(pos, node)
if height == 4 or node.name ~= "air" then if height == 4 or node.name ~= "air" then
return return
end end
if minetest.get_node_light(pos) < 13 then
return
end
minetest.set_node(pos, {name = "default:cactus"}) minetest.set_node(pos, {name = "default:cactus"})
return true return true
end end
@ -209,6 +211,9 @@ function default.grow_papyrus(pos, node)
if height == 4 or node.name ~= "air" then if height == 4 or node.name ~= "air" then
return return
end end
if minetest.get_node_light(pos) < 13 then
return
end
minetest.set_node(pos, {name = "default:papyrus"}) minetest.set_node(pos, {name = "default:papyrus"})
return true return true
end end
@ -292,7 +297,7 @@ function default.register_fence(name, def)
groups = {}, groups = {},
} }
for k, v in pairs(default_fields) do for k, v in pairs(default_fields) do
if not def[k] then if def[k] == nil then
def[k] = v def[k] = v
end end
end end
@ -314,54 +319,72 @@ end
-- Prevent decay of placed leaves -- Prevent decay of placed leaves
default.after_place_leaves = function(pos, placer, itemstack, pointed_thing) default.after_place_leaves = function(pos, placer, itemstack, pointed_thing)
if placer and not placer:get_player_control().sneak then if placer and placer:is_player() and not placer:get_player_control().sneak then
local node = minetest.get_node(pos) local node = minetest.get_node(pos)
node.param2 = 1 node.param2 = 1
minetest.set_node(pos, node) minetest.set_node(pos, node)
end end
end end
-- Leafdecay ABM -- Leafdecay
local function leafdecay_after_destruct(pos, oldnode, def)
minetest.register_abm({ for _, v in pairs(minetest.find_nodes_in_area(vector.subtract(pos, def.radius),
label = "Leaf decay", vector.add(pos, def.radius), def.leaves)) do
nodenames = {"group:leafdecay"}, local node = minetest.get_node(v)
neighbors = {"air"}, local timer = minetest.get_node_timer(v)
interval = 2, if node.param2 == 0 and not timer:is_started() then
chance = 10, timer:start(math.random(20, 120) / 10)
catch_up = false,
action = function(pos, node, _, _)
-- Check if leaf is placed
if node.param2 ~= 0 then
return
end end
end
end
local rad = minetest.registered_nodes[node.name].groups.leafdecay local function leafdecay_on_timer(pos, def)
-- Assume ignore is a trunk, to make this if minetest.find_node_near(pos, def.radius, def.trunks) then
-- work at the border of a loaded area return false
if minetest.find_node_near(pos, rad, {"ignore", "group:tree"}) then end
return
end local node = minetest.get_node(pos)
-- Drop stuff local drops = minetest.get_node_drops(node.name)
local itemstacks = minetest.get_node_drops(node.name) for _, item in ipairs(drops) do
for _, itemname in ipairs(itemstacks) do local is_leaf
if itemname ~= node.name or for _, v in pairs(def.leaves) do
minetest.get_item_group(node.name, "leafdecay_drop") ~= 0 then if v == item then
local p_drop = { is_leaf = true
x = pos.x - 0.5 + math.random(),
y = pos.y - 0.5 + math.random(),
z = pos.z - 0.5 + math.random(),
}
minetest.add_item(p_drop, itemname)
end end
end end
-- Remove node if minetest.get_item_group(item, "leafdecay_drop") ~= 0 or
minetest.remove_node(pos) not is_leaf then
minetest.check_for_falling(pos) minetest.add_item({
x = pos.x - 0.5 + math.random(),
y = pos.y - 0.5 + math.random(),
z = pos.z - 0.5 + math.random(),
}, item)
end
end end
})
minetest.remove_node(pos)
minetest.check_for_falling(pos)
end
function default.register_leafdecay(def)
assert(def.leaves)
assert(def.trunks)
assert(def.radius)
for _, v in pairs(def.trunks) do
minetest.override_item(v, {
after_destruct = function(pos, oldnode)
leafdecay_after_destruct(pos, oldnode, def)
end,
})
end
for _, v in pairs(def.leaves) do
minetest.override_item(v, {
on_timer = function(pos)
leafdecay_on_timer(pos, def)
end,
})
end
end
-- --
-- Convert dirt to something that fits the environment -- Convert dirt to something that fits the environment
@ -512,3 +535,46 @@ minetest.register_abm({
minetest.set_node(pos, {name = "default:coral_skeleton"}) minetest.set_node(pos, {name = "default:coral_skeleton"})
end, end,
}) })
--
-- NOTICE: This method is not an official part of the API yet!
-- This method may change in future.
--
function default.can_interact_with_node(player, pos)
if player then
if minetest.check_player_privs(player, "protection_bypass") then
return true
end
else
return false
end
local meta = minetest.get_meta(pos)
local owner = meta:get_string("owner")
if not owner or owner == "" or owner == player:get_player_name() then
return true
end
-- is player wielding the right key?
local item = player:get_wielded_item()
if item:get_name() == "default:key" then
local key_meta = item:get_meta()
if key_meta:get_string("secret") == "" then
local key_oldmeta = item:get_metadata()
if key_oldmeta == "" or not minetest.parse_json(key_oldmeta) then
return false
end
key_meta:set_string("secret", minetest.parse_json(key_oldmeta).secret)
item:set_metadata("")
end
return meta:get_string("key_lock_secret") == key_meta:get_string("secret")
end
return false
end

View File

@ -119,7 +119,7 @@ local function furnace_node_timer(pos, elapsed)
local fuel local fuel
local update = true local update = true
while update do while elapsed > 0 and update do
update = false update = false
srclist = inv:get_list("src") srclist = inv:get_list("src")
@ -134,13 +134,18 @@ local function furnace_node_timer(pos, elapsed)
cooked, aftercooked = minetest.get_craft_result({method = "cooking", width = 1, items = srclist}) cooked, aftercooked = minetest.get_craft_result({method = "cooking", width = 1, items = srclist})
cookable = cooked.time ~= 0 cookable = cooked.time ~= 0
local el = math.min(elapsed, fuel_totaltime - fuel_time)
if cookable then -- fuel lasts long enough, adjust el to cooking duration
el = math.min(el, cooked.time - src_time)
end
-- Check if we have enough fuel to burn -- Check if we have enough fuel to burn
if fuel_time < fuel_totaltime then if fuel_time < fuel_totaltime then
-- The furnace is currently active and has enough fuel -- The furnace is currently active and has enough fuel
fuel_time = fuel_time + elapsed fuel_time = fuel_time + el
-- If there is a cookable item then check if it is ready yet -- If there is a cookable item then check if it is ready yet
if cookable then if cookable then
src_time = src_time + elapsed src_time = src_time + el
if src_time >= cooked.time then if src_time >= cooked.time then
-- Place result in dst list if possible -- Place result in dst list if possible
if inv:room_for_item("dst", cooked.item) then if inv:room_for_item("dst", cooked.item) then
@ -149,6 +154,9 @@ local function furnace_node_timer(pos, elapsed)
src_time = src_time - cooked.time src_time = src_time - cooked.time
update = true update = true
end end
else
-- Item could not be cooked: probably missing fuel
update = true
end end
end end
else else
@ -166,8 +174,7 @@ local function furnace_node_timer(pos, elapsed)
-- Take fuel from fuel list -- Take fuel from fuel list
inv:set_stack("fuel", 1, afterfuel.items[1]) inv:set_stack("fuel", 1, afterfuel.items[1])
update = true update = true
fuel_totaltime = fuel.time + (fuel_time - fuel_totaltime) fuel_totaltime = fuel.time + (fuel_totaltime - fuel_time)
src_time = src_time + elapsed
end end
else else
-- We don't need to get new fuel since there is no cookable item -- We don't need to get new fuel since there is no cookable item
@ -177,7 +184,7 @@ local function furnace_node_timer(pos, elapsed)
fuel_time = 0 fuel_time = 0
end end
elapsed = 0 elapsed = elapsed - el
end end
if fuel and fuel_totaltime > fuel.time then if fuel and fuel_totaltime > fuel.time then

View File

@ -19,7 +19,7 @@ Licenses of media (textures, models and sounds)
----------------------------------------------- -----------------------------------------------
Attribution-ShareAlike 3.0 Unported (CC BY-SA 3.0) Attribution-ShareAlike 3.0 Unported (CC BY-SA 3.0)
Copyright (C) 2010-2016: Copyright (C) 2010-2017:
celeron55, Perttu Ahola <celeron55@gmail.com> celeron55, Perttu Ahola <celeron55@gmail.com>
Cisoun Cisoun
G4JC G4JC
@ -41,6 +41,10 @@ Copyright (C) 2010-2016:
asl97 asl97
KevDoy KevDoy
Mito551 Mito551
GreenXenith
kaeza
kilbith
CloudyProton
You are free to: You are free to:
Share — copy and redistribute the material in any medium or format. Share — copy and redistribute the material in any medium or format.
@ -108,7 +112,6 @@ http://creativecommons.org/licenses/by-sa/4.0/
Attribution-ShareAlike 2.0 Generic (CC BY-SA 2.0) Attribution-ShareAlike 2.0 Generic (CC BY-SA 2.0)
Copyright (C) 2014-2016 Neuromancer Copyright (C) 2014-2016 Neuromancer
You are free to: You are free to:
Share — copy and redistribute the material in any medium or format. Share — copy and redistribute the material in any medium or format.
Adapt — remix, transform, and build upon the material for any purpose, even commercially. Adapt — remix, transform, and build upon the material for any purpose, even commercially.

View File

@ -1,5 +1,5 @@
-- --
-- Aliases for map generator outputs -- Aliases for map generators
-- --
minetest.register_alias("mapgen_stone", "default:stone") minetest.register_alias("mapgen_stone", "default:stone")
@ -34,18 +34,21 @@ minetest.register_alias("mapgen_pine_needles", "default:pine_needles")
minetest.register_alias("mapgen_cobble", "default:cobble") minetest.register_alias("mapgen_cobble", "default:cobble")
minetest.register_alias("mapgen_stair_cobble", "stairs:stair_cobble") minetest.register_alias("mapgen_stair_cobble", "stairs:stair_cobble")
minetest.register_alias("mapgen_mossycobble", "default:mossycobble") minetest.register_alias("mapgen_mossycobble", "default:mossycobble")
minetest.register_alias("mapgen_stair_desert_stone", "stairs:stair_desert_stone")
minetest.register_alias("mapgen_sandstonebrick", "default:sandstonebrick") minetest.register_alias("mapgen_sandstonebrick", "default:sandstonebrick")
minetest.register_alias("mapgen_stair_sandstonebrick", "stairs:stair_sandstonebrick") minetest.register_alias("mapgen_stair_sandstone_block", "stairs:stair_sandstone_block")
-- --
-- Register ores -- Register ores
-- --
function default.register_ores() -- Blob ores
minetest.clear_registered_ores() -- These first to avoid other ores in blobs
-- Blob ores
-- These first to avoid other ores in blobs -- Mgv6
function default.register_mgv6_blob_ores()
-- Clay -- Clay
-- This first to avoid clay in sand blobs -- This first to avoid clay in sand blobs
@ -74,8 +77,7 @@ function default.register_ores()
minetest.register_ore({ minetest.register_ore({
ore_type = "blob", ore_type = "blob",
ore = "default:sand", ore = "default:sand",
wherein = {"default:stone", "default:sandstone", wherein = {"default:stone", "default:desert_stone"},
"default:desert_stone"},
clust_scarcity = 16 * 16 * 16, clust_scarcity = 16 * 16 * 16,
clust_size = 5, clust_size = 5,
y_min = -31, y_min = -31,
@ -110,8 +112,6 @@ function default.register_ores()
octaves = 1, octaves = 1,
persist = 0.0 persist = 0.0
}, },
biomes = {"taiga", "snowy_grassland", "grassland", "coniferous_forest",
"deciduous_forest", "savanna", "rainforest"}
}) })
-- Gravel -- Gravel
@ -134,8 +134,123 @@ function default.register_ores()
persist = 0.0 persist = 0.0
}, },
}) })
end
-- Scatter ores
-- All mapgens except mgv6
function default.register_blob_ores()
-- Clay
minetest.register_ore({
ore_type = "blob",
ore = "default:clay",
wherein = {"default:sand"},
clust_scarcity = 16 * 16 * 16,
clust_size = 5,
y_min = -15,
y_max = 0,
noise_threshold = 0.0,
noise_params = {
offset = 0.5,
scale = 0.2,
spread = {x = 5, y = 5, z = 5},
seed = -316,
octaves = 1,
persist = 0.0
},
})
-- Silver sand
minetest.register_ore({
ore_type = "blob",
ore = "default:silver_sand",
wherein = {"default:stone"},
clust_scarcity = 16 * 16 * 16,
clust_size = 5,
y_min = -31000,
y_max = 31000,
noise_threshold = 0.0,
noise_params = {
offset = 0.5,
scale = 0.2,
spread = {x = 5, y = 5, z = 5},
seed = 2316,
octaves = 1,
persist = 0.0
},
biomes = {"icesheet_ocean", "tundra", "tundra_beach", "tundra_ocean",
"taiga", "taiga_ocean", "snowy_grassland", "snowy_grassland_ocean",
"grassland", "grassland_dunes", "grassland_ocean", "coniferous_forest",
"coniferous_forest_dunes", "coniferous_forest_ocean", "deciduous_forest",
"deciduous_forest_shore", "deciduous_forest_ocean", "cold_desert",
"cold_desert_ocean", "savanna", "savanna_shore", "savanna_ocean",
"rainforest", "rainforest_swamp", "rainforest_ocean", "underground",
"floatland_ocean", "floatland_grassland", "floatland_coniferous_forest"}
})
-- Dirt
minetest.register_ore({
ore_type = "blob",
ore = "default:dirt",
wherein = {"default:stone"},
clust_scarcity = 16 * 16 * 16,
clust_size = 5,
y_min = -31,
y_max = 31000,
noise_threshold = 0.0,
noise_params = {
offset = 0.5,
scale = 0.2,
spread = {x = 5, y = 5, z = 5},
seed = 17676,
octaves = 1,
persist = 0.0
},
biomes = {"taiga", "snowy_grassland", "grassland", "coniferous_forest",
"deciduous_forest", "deciduous_forest_shore", "savanna", "savanna_shore",
"rainforest", "rainforest_swamp", "floatland_grassland",
"floatland_coniferous_forest"}
})
-- Gravel
minetest.register_ore({
ore_type = "blob",
ore = "default:gravel",
wherein = {"default:stone"},
clust_scarcity = 16 * 16 * 16,
clust_size = 5,
y_min = -31000,
y_max = 31000,
noise_threshold = 0.0,
noise_params = {
offset = 0.5,
scale = 0.2,
spread = {x = 5, y = 5, z = 5},
seed = 766,
octaves = 1,
persist = 0.0
},
biomes = {"icesheet_ocean", "tundra", "tundra_beach", "tundra_ocean",
"taiga", "taiga_ocean", "snowy_grassland", "snowy_grassland_ocean",
"grassland", "grassland_dunes", "grassland_ocean", "coniferous_forest",
"coniferous_forest_dunes", "coniferous_forest_ocean", "deciduous_forest",
"deciduous_forest_shore", "deciduous_forest_ocean", "cold_desert",
"cold_desert_ocean", "savanna", "savanna_shore", "savanna_ocean",
"rainforest", "rainforest_swamp", "rainforest_ocean", "underground",
"floatland_ocean", "floatland_grassland", "floatland_coniferous_forest"}
})
end
-- Scatter ores
-- All mapgens
function default.register_ores()
-- Coal -- Coal
@ -242,6 +357,41 @@ function default.register_ores()
y_max = -64, y_max = -64,
}) })
-- Tin
minetest.register_ore({
ore_type = "scatter",
ore = "default:stone_with_tin",
wherein = "default:stone",
clust_scarcity = 10 * 10 * 10,
clust_num_ores = 5,
clust_size = 3,
y_min = 1025,
y_max = 31000,
})
minetest.register_ore({
ore_type = "scatter",
ore = "default:stone_with_tin",
wherein = "default:stone",
clust_scarcity = 13 * 13 * 13,
clust_num_ores = 4,
clust_size = 3,
y_min = -127,
y_max = -32,
})
minetest.register_ore({
ore_type = "scatter",
ore = "default:stone_with_tin",
wherein = "default:stone",
clust_scarcity = 10 * 10 * 10,
clust_num_ores = 5,
clust_size = 3,
y_min = -31000,
y_max = -128,
})
-- Gold -- Gold
minetest.register_ore({ minetest.register_ore({
@ -377,10 +527,9 @@ end
-- Register biomes -- Register biomes
-- --
-- All mapgens except mgv6 and singlenode -- All mapgens except mgv6
function default.register_biomes() function default.register_biomes(upper_limit)
minetest.clear_registered_biomes()
-- Icesheet -- Icesheet
@ -399,7 +548,7 @@ function default.register_biomes()
node_riverbed = "default:gravel", node_riverbed = "default:gravel",
depth_riverbed = 2, depth_riverbed = 2,
y_min = -8, y_min = -8,
y_max = 31000, y_max = upper_limit,
heat_point = 0, heat_point = 0,
humidity_point = 73, humidity_point = 73,
}) })
@ -439,7 +588,7 @@ function default.register_biomes()
node_riverbed = "default:gravel", node_riverbed = "default:gravel",
depth_riverbed = 2, depth_riverbed = 2,
y_min = 2, y_min = 2,
y_max = 31000, y_max = upper_limit,
heat_point = 0, heat_point = 0,
humidity_point = 40, humidity_point = 40,
}) })
@ -501,7 +650,7 @@ function default.register_biomes()
node_riverbed = "default:sand", node_riverbed = "default:sand",
depth_riverbed = 2, depth_riverbed = 2,
y_min = 2, y_min = 2,
y_max = 31000, y_max = upper_limit,
heat_point = 25, heat_point = 25,
humidity_point = 70, humidity_point = 70,
}) })
@ -543,7 +692,7 @@ function default.register_biomes()
node_riverbed = "default:sand", node_riverbed = "default:sand",
depth_riverbed = 2, depth_riverbed = 2,
y_min = 5, y_min = 5,
y_max = 31000, y_max = upper_limit,
heat_point = 20, heat_point = 20,
humidity_point = 35, humidity_point = 35,
}) })
@ -585,7 +734,7 @@ function default.register_biomes()
node_riverbed = "default:sand", node_riverbed = "default:sand",
depth_riverbed = 2, depth_riverbed = 2,
y_min = 6, y_min = 6,
y_max = 31000, y_max = upper_limit,
heat_point = 50, heat_point = 50,
humidity_point = 35, humidity_point = 35,
}) })
@ -647,7 +796,7 @@ function default.register_biomes()
node_riverbed = "default:sand", node_riverbed = "default:sand",
depth_riverbed = 2, depth_riverbed = 2,
y_min = 6, y_min = 6,
y_max = 31000, y_max = upper_limit,
heat_point = 45, heat_point = 45,
humidity_point = 70, humidity_point = 70,
}) })
@ -709,7 +858,7 @@ function default.register_biomes()
node_riverbed = "default:sand", node_riverbed = "default:sand",
depth_riverbed = 2, depth_riverbed = 2,
y_min = 1, y_min = 1,
y_max = 31000, y_max = upper_limit,
heat_point = 60, heat_point = 60,
humidity_point = 68, humidity_point = 68,
}) })
@ -771,7 +920,7 @@ function default.register_biomes()
node_riverbed = "default:sand", node_riverbed = "default:sand",
depth_riverbed = 2, depth_riverbed = 2,
y_min = 5, y_min = 5,
y_max = 31000, y_max = upper_limit,
heat_point = 92, heat_point = 92,
humidity_point = 16, humidity_point = 16,
}) })
@ -804,7 +953,7 @@ function default.register_biomes()
node_top = "default:sand", node_top = "default:sand",
depth_top = 1, depth_top = 1,
node_filler = "default:sand", node_filler = "default:sand",
depth_filler = 0, depth_filler = 1,
node_stone = "default:sandstone", node_stone = "default:sandstone",
--node_water_top = "", --node_water_top = "",
--depth_water_top = , --depth_water_top = ,
@ -813,7 +962,7 @@ function default.register_biomes()
node_riverbed = "default:sand", node_riverbed = "default:sand",
depth_riverbed = 2, depth_riverbed = 2,
y_min = 5, y_min = 5,
y_max = 31000, y_max = upper_limit,
heat_point = 60, heat_point = 60,
humidity_point = 0, humidity_point = 0,
}) })
@ -855,7 +1004,7 @@ function default.register_biomes()
node_riverbed = "default:sand", node_riverbed = "default:sand",
depth_riverbed = 2, depth_riverbed = 2,
y_min = 5, y_min = 5,
y_max = 31000, y_max = upper_limit,
heat_point = 40, heat_point = 40,
humidity_point = 0, humidity_point = 0,
}) })
@ -897,7 +1046,7 @@ function default.register_biomes()
node_riverbed = "default:sand", node_riverbed = "default:sand",
depth_riverbed = 2, depth_riverbed = 2,
y_min = 1, y_min = 1,
y_max = 31000, y_max = upper_limit,
heat_point = 89, heat_point = 89,
humidity_point = 42, humidity_point = 42,
}) })
@ -947,7 +1096,7 @@ function default.register_biomes()
minetest.register_biome({ minetest.register_biome({
name = "rainforest", name = "rainforest",
--node_dust = "", --node_dust = "",
node_top = "default:dirt_with_grass", node_top = "default:dirt_with_rainforest_litter",
depth_top = 1, depth_top = 1,
node_filler = "default:dirt", node_filler = "default:dirt",
depth_filler = 3, depth_filler = 3,
@ -959,7 +1108,7 @@ function default.register_biomes()
node_riverbed = "default:sand", node_riverbed = "default:sand",
depth_riverbed = 2, depth_riverbed = 2,
y_min = 1, y_min = 1,
y_max = 31000, y_max = upper_limit,
heat_point = 86, heat_point = 86,
humidity_point = 65, humidity_point = 65,
}) })
@ -1026,6 +1175,100 @@ function default.register_biomes()
end end
-- Biomes for floatlands
function default.register_floatland_biomes(floatland_level, shadow_limit)
-- Coniferous forest
minetest.register_biome({
name = "floatland_coniferous_forest",
--node_dust = "",
node_top = "default:dirt_with_grass",
depth_top = 1,
node_filler = "default:dirt",
depth_filler = 3,
--node_stone = "",
--node_water_top = "",
--depth_water_top = ,
--node_water = "",
--node_river_water = "",
--node_riverbed = "",
--depth_riverbed = ,
y_min = floatland_level + 2,
y_max = 31000,
heat_point = 50,
humidity_point = 70,
})
-- Grassland
minetest.register_biome({
name = "floatland_grassland",
--node_dust = "",
node_top = "default:dirt_with_grass",
depth_top = 1,
node_filler = "default:dirt",
depth_filler = 1,
--node_stone = "",
--node_water_top = "",
--depth_water_top = ,
--node_water = "",
--node_river_water = "",
--node_riverbed = "",
--depth_riverbed = ,
y_min = floatland_level + 2,
y_max = 31000,
heat_point = 50,
humidity_point = 35,
})
-- Sandstone desert
minetest.register_biome({
name = "floatland_sandstone_desert",
--node_dust = "",
node_top = "default:sand",
depth_top = 1,
node_filler = "default:sand",
depth_filler = 1,
node_stone = "default:sandstone",
--node_water_top = "",
--depth_water_top = ,
--node_water = "",
--node_river_water = "",
--node_riverbed = "",
--depth_riverbed = ,
y_min = floatland_level + 2,
y_max = 31000,
heat_point = 50,
humidity_point = 0,
})
-- Floatland ocean / underground
minetest.register_biome({
name = "floatland_ocean",
--node_dust = "",
node_top = "default:sand",
depth_top = 1,
node_filler = "default:sand",
depth_filler = 3,
--node_stone = "",
--node_water_top = "",
--depth_water_top = ,
--node_water = "",
--node_river_water = "",
--node_riverbed = "",
--depth_riverbed = ,
y_min = shadow_limit,
y_max = floatland_level + 1,
heat_point = 50,
humidity_point = 50,
})
end
-- --
-- Register decorations -- Register decorations
-- --
@ -1033,7 +1276,6 @@ end
-- Mgv6 -- Mgv6
function default.register_mgv6_decorations() function default.register_mgv6_decorations()
minetest.clear_registered_decorations()
-- Papyrus -- Papyrus
@ -1137,7 +1379,8 @@ local function register_grass_decoration(offset, scale, length)
persist = 0.6 persist = 0.6
}, },
biomes = {"grassland", "grassland_dunes", "deciduous_forest", biomes = {"grassland", "grassland_dunes", "deciduous_forest",
"coniferous_forest", "coniferous_forest_dunes"}, "coniferous_forest", "coniferous_forest_dunes",
"floatland_grassland", "floatland_coniferous_forest"},
y_min = 1, y_min = 1,
y_max = 31000, y_max = 31000,
decoration = "default:grass_" .. length, decoration = "default:grass_" .. length,
@ -1166,7 +1409,6 @@ end
function default.register_decorations() function default.register_decorations()
minetest.clear_registered_decorations()
-- Apple tree and log -- Apple tree and log
@ -1187,6 +1429,7 @@ function default.register_decorations()
y_max = 31000, y_max = 31000,
schematic = minetest.get_modpath("default") .. "/schematics/apple_tree.mts", schematic = minetest.get_modpath("default") .. "/schematics/apple_tree.mts",
flags = "place_center_x, place_center_z", flags = "place_center_x, place_center_z",
rotation = "random",
}) })
minetest.register_decoration({ minetest.register_decoration({
@ -1204,20 +1447,7 @@ function default.register_decorations()
biomes = {"deciduous_forest"}, biomes = {"deciduous_forest"},
y_min = 1, y_min = 1,
y_max = 31000, y_max = 31000,
schematic = { schematic = minetest.get_modpath("default") .. "/schematics/apple_log.mts",
size = {x = 3, y = 3, z = 1},
data = {
{name = "air", prob = 0},
{name = "air", prob = 0},
{name = "air", prob = 0},
{name = "default:tree", param2 = 12, prob = 191},
{name = "default:tree", param2 = 12},
{name = "default:tree", param2 = 12, prob = 127},
{name = "air", prob = 0},
{name = "flowers:mushroom_brown", prob = 63},
{name = "air", prob = 0},
},
},
flags = "place_center_x", flags = "place_center_x",
rotation = "random", rotation = "random",
}) })
@ -1226,8 +1456,8 @@ function default.register_decorations()
minetest.register_decoration({ minetest.register_decoration({
deco_type = "schematic", deco_type = "schematic",
place_on = {"default:dirt_with_grass", "default:dirt"}, place_on = {"default:dirt_with_rainforest_litter", "default:dirt"},
sidelen = 80, sidelen = 16,
fill_ratio = 0.1, fill_ratio = 0.1,
biomes = {"rainforest", "rainforest_swamp"}, biomes = {"rainforest", "rainforest_swamp"},
y_min = -1, y_min = -1,
@ -1239,26 +1469,13 @@ function default.register_decorations()
minetest.register_decoration({ minetest.register_decoration({
deco_type = "schematic", deco_type = "schematic",
place_on = {"default:dirt_with_grass", "default:dirt"}, place_on = {"default:dirt_with_rainforest_litter", "default:dirt"},
sidelen = 80, sidelen = 16,
fill_ratio = 0.005, fill_ratio = 0.005,
biomes = {"rainforest", "rainforest_swamp"}, biomes = {"rainforest", "rainforest_swamp"},
y_min = 1, y_min = 1,
y_max = 31000, y_max = 31000,
schematic = { schematic = minetest.get_modpath("default") .. "/schematics/jungle_log.mts",
size = {x = 3, y = 3, z = 1},
data = {
{name = "air", prob = 0},
{name = "air", prob = 0},
{name = "air", prob = 0},
{name = "default:jungletree", param2 = 12, prob = 191},
{name = "default:jungletree", param2 = 12},
{name = "default:jungletree", param2 = 12, prob = 127},
{name = "air", prob = 0},
{name = "flowers:mushroom_brown", prob = 127},
{name = "air", prob = 0},
},
},
flags = "place_center_x", flags = "place_center_x",
rotation = "random", rotation = "random",
}) })
@ -1277,7 +1494,7 @@ function default.register_decorations()
octaves = 3, octaves = 3,
persist = 0.66 persist = 0.66
}, },
biomes = {"taiga", "coniferous_forest"}, biomes = {"taiga", "coniferous_forest", "floatland_coniferous_forest"},
y_min = 2, y_min = 2,
y_max = 31000, y_max = 31000,
schematic = minetest.get_modpath("default") .. "/schematics/pine_tree.mts", schematic = minetest.get_modpath("default") .. "/schematics/pine_tree.mts",
@ -1299,20 +1516,7 @@ function default.register_decorations()
biomes = {"taiga", "coniferous_forest"}, biomes = {"taiga", "coniferous_forest"},
y_min = 1, y_min = 1,
y_max = 31000, y_max = 31000,
schematic = { schematic = minetest.get_modpath("default") .. "/schematics/pine_log.mts",
size = {x = 3, y = 3, z = 1},
data = {
{name = "air", prob = 0},
{name = "air", prob = 0},
{name = "air", prob = 0},
{name = "default:pine_tree", param2 = 12, prob = 191},
{name = "default:pine_tree", param2 = 12},
{name = "default:pine_tree", param2 = 12, prob = 127},
{name = "air", prob = 0},
{name = "flowers:mushroom_red", prob = 63},
{name = "air", prob = 0},
},
},
flags = "place_center_x", flags = "place_center_x",
rotation = "random", rotation = "random",
}) })
@ -1354,17 +1558,7 @@ function default.register_decorations()
biomes = {"savanna"}, biomes = {"savanna"},
y_min = 1, y_min = 1,
y_max = 31000, y_max = 31000,
schematic = { schematic = minetest.get_modpath("default") .. "/schematics/acacia_log.mts",
size = {x = 3, y = 2, z = 1},
data = {
{name = "air", prob = 0},
{name = "air", prob = 0},
{name = "air", prob = 0},
{name = "default:acacia_tree", param2 = 12, prob = 191},
{name = "default:acacia_tree", param2 = 12},
{name = "default:acacia_tree", param2 = 12, prob = 127},
},
},
flags = "place_center_x", flags = "place_center_x",
rotation = "random", rotation = "random",
}) })
@ -1405,20 +1599,7 @@ function default.register_decorations()
biomes = {"deciduous_forest"}, biomes = {"deciduous_forest"},
y_min = 1, y_min = 1,
y_max = 31000, y_max = 31000,
schematic = { schematic = minetest.get_modpath("default") .. "/schematics/aspen_log.mts",
size = {x = 3, y = 3, z = 1},
data = {
{name = "air", prob = 0},
{name = "air", prob = 0},
{name = "air", prob = 0},
{name = "default:aspen_tree", param2 = 12},
{name = "default:aspen_tree", param2 = 12},
{name = "default:aspen_tree", param2 = 12, prob = 127},
{name = "flowers:mushroom_red", prob = 63},
{name = "flowers:mushroom_brown", prob = 63},
{name = "air", prob = 0},
},
},
flags = "place_center_x", flags = "place_center_x",
rotation = "random", rotation = "random",
}) })
@ -1501,7 +1682,8 @@ function default.register_decorations()
octaves = 3, octaves = 3,
persist = 0.7, persist = 0.7,
}, },
biomes = {"snowy_grassland", "grassland", "deciduous_forest"}, biomes = {"snowy_grassland", "grassland", "deciduous_forest",
"floatland_grassland"},
y_min = 1, y_min = 1,
y_max = 31000, y_max = 31000,
schematic = minetest.get_modpath("default") .. "/schematics/bush.mts", schematic = minetest.get_modpath("default") .. "/schematics/bush.mts",
@ -1549,8 +1731,8 @@ function default.register_decorations()
minetest.register_decoration({ minetest.register_decoration({
deco_type = "simple", deco_type = "simple",
place_on = {"default:dirt_with_grass"}, place_on = {"default:dirt_with_rainforest_litter"},
sidelen = 80, sidelen = 16,
fill_ratio = 0.1, fill_ratio = 0.1,
biomes = {"rainforest"}, biomes = {"rainforest"},
y_min = 1, y_min = 1,
@ -1585,9 +1767,9 @@ function default.register_decorations()
deco_type = "schematic", deco_type = "schematic",
place_on = {"default:sand"}, place_on = {"default:sand"},
noise_params = { noise_params = {
offset = -0.1, offset = -0.15,
scale = 0.1, scale = 0.1,
spread = {x = 200, y = 200, z = 200}, spread = {x = 100, y = 100, z = 100},
seed = 7013, seed = 7013,
octaves = 3, octaves = 3,
persist = 1, persist = 1,
@ -1607,15 +1789,38 @@ end
-- --
-- Detect mapgen to select functions -- Detect mapgen, flags and parameters to select functions
-- --
-- Get setting or default
local mgv7_spflags = minetest.get_mapgen_setting("mgv7_spflags") or
"mountains, ridges, nofloatlands"
local captures_float = string.match(mgv7_spflags, "floatlands")
local captures_nofloat = string.match(mgv7_spflags, "nofloatlands")
local mgv7_floatland_level = minetest.get_mapgen_setting("mgv7_floatland_level") or 1280
local mgv7_shadow_limit = minetest.get_mapgen_setting("mgv7_shadow_limit") or 1024
minetest.clear_registered_biomes()
minetest.clear_registered_ores()
minetest.clear_registered_decorations()
local mg_name = minetest.get_mapgen_setting("mg_name") local mg_name = minetest.get_mapgen_setting("mg_name")
if mg_name == "v6" then if mg_name == "v6" then
default.register_mgv6_blob_ores()
default.register_ores() default.register_ores()
default.register_mgv6_decorations() default.register_mgv6_decorations()
elseif mg_name == "v7" and captures_float == "floatlands" and
captures_nofloat ~= "nofloatlands" then
-- Mgv7 with floatlands
default.register_biomes(mgv7_shadow_limit - 1)
default.register_floatland_biomes(mgv7_floatland_level, mgv7_shadow_limit)
default.register_blob_ores()
default.register_ores()
default.register_decorations()
else else
default.register_biomes() default.register_biomes(31000)
default.register_blob_ores()
default.register_ores() default.register_ores()
default.register_decorations() default.register_decorations()
end end

View File

@ -0,0 +1,79 @@
# Blender v2.78 (sub 0) OBJ File: 'chest-open.blend'
# www.blender.org
o Top_Cube.002_None_Top_Cube.002_None_bottom
v -0.500000 0.408471 0.720970
v -0.500000 1.115578 0.013863
v -0.500000 0.894607 -0.207108
v -0.500000 0.187501 0.499999
v 0.500000 1.115578 0.013863
v 0.500000 0.408471 0.720970
v 0.500000 0.187501 0.499999
v 0.500000 0.894607 -0.207108
v -0.500000 0.187500 -0.500000
v -0.500000 -0.500000 -0.500000
v -0.500000 -0.500000 0.500000
v 0.500000 0.187500 -0.500000
v 0.500000 -0.500000 0.500000
v 0.500000 -0.500000 -0.500000
vt 0.0000 1.0000
vt 0.0000 0.0000
vt 1.0000 0.0000
vt 1.0000 1.0000
vt 1.0000 0.0000
vt 1.0000 1.0000
vt 0.0000 1.0000
vt 0.0000 0.0000
vt 0.0000 1.0000
vt 1.0000 1.0000
vt 1.0000 0.6875
vt 0.0000 0.6875
vt 1.0000 1.0000
vt 0.0000 0.6875
vt 1.0000 0.6875
vt 1.0000 0.6875
vt 1.0000 0.0000
vt 0.0000 0.0000
vt 1.0000 0.6875
vt 1.0000 0.0000
vt 1.0000 1.0000
vt 1.0000 0.6875
vt 1.0000 0.0000
vt 0.0000 1.0000
vt 0.0000 0.6875
vt 0.0000 0.6875
vt 0.0000 0.0000
vt 1.0000 0.5000
vt 1.0000 1.0000
vt 0.0000 1.0000
vt 0.0000 0.5000
vt 0.0000 0.0000
vt 1.0000 0.0000
vn 0.0000 0.7071 0.7071
vn -0.0000 -1.0000 -0.0000
vn -1.0000 0.0000 0.0000
vn 1.0000 0.0000 -0.0000
vn 0.0000 -0.7071 0.7071
vn 0.0000 0.0000 1.0000
vn -0.0000 0.7071 -0.7071
vn -0.0000 0.0000 -1.0000
vn -0.0000 -0.7071 -0.7071
vn -0.0000 1.0000 -0.0000
g Top_Cube.002_None_Top_Cube.002_None_bottom_Top_Cube.002_None_Top_Cube.002_None_bottom_Top
s off
f 6/1/1 5/2/1 2/3/1 1/4/1
g Top_Cube.002_None_Top_Cube.002_None_bottom_Top_Cube.002_None_Top_Cube.002_None_bottom_Bottom
f 11/5/2 10/6/2 14/7/2 13/8/2
g Top_Cube.002_None_Top_Cube.002_None_bottom_Top_Cube.002_None_Top_Cube.002_None_bottom_Right-Left
f 1/9/3 2/10/3 3/11/3 4/12/3
f 5/13/4 6/1/4 7/14/4 8/15/4
f 4/12/3 9/16/3 10/17/3 11/18/3
f 12/19/4 7/14/4 13/8/4 14/20/4
g Top_Cube.002_None_Top_Cube.002_None_bottom_Top_Cube.002_None_Top_Cube.002_None_bottom_Back
f 6/21/5 1/9/5 4/12/5 7/22/5
f 7/22/6 4/12/6 11/18/6 13/23/6
g Top_Cube.002_None_Top_Cube.002_None_bottom_Top_Cube.002_None_Top_Cube.002_None_bottom_Front
f 2/10/7 5/24/7 8/25/7 3/11/7
f 9/16/8 12/26/8 14/27/8 10/17/8
g Top_Cube.002_None_Top_Cube.002_None_bottom_Top_Cube.002_None_Top_Cube.002_None_bottom_Inside
f 4/28/9 3/29/9 8/30/9 7/31/9
f 7/31/10 12/32/10 9/33/10 4/28/10

File diff suppressed because it is too large Load Diff

View File

@ -95,10 +95,6 @@ minetest.register_on_joinplayer(function(player)
default.player_set_model(player, "character.b3d") default.player_set_model(player, "character.b3d")
player:set_local_animation({x=0, y=79}, {x=168, y=187}, {x=189, y=198}, {x=200, y=219}, 30) player:set_local_animation({x=0, y=79}, {x=168, y=187}, {x=189, y=198}, {x=200, y=219}, 30)
-- set GUI
if not minetest.setting_getbool("creative_mode") then
player:set_inventory_formspec(default.gui_survival_form)
end
player:hud_set_hotbar_image("gui_hotbar.png") player:hud_set_hotbar_image("gui_hotbar.png")
player:hud_set_hotbar_selected_image("gui_hotbar_selected.png") player:hud_set_hotbar_selected_image("gui_hotbar_selected.png")
end) end)

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 151 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 761 B

After

Width:  |  Height:  |  Size: 873 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 201 B

After

Width:  |  Height:  |  Size: 204 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 228 B

After

Width:  |  Height:  |  Size: 262 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 216 B

After

Width:  |  Height:  |  Size: 140 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 165 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 102 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 422 B

After

Width:  |  Height:  |  Size: 423 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 275 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 587 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 630 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.0 KiB

After

Width:  |  Height:  |  Size: 397 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.9 KiB

After

Width:  |  Height:  |  Size: 300 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.9 KiB

After

Width:  |  Height:  |  Size: 336 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.0 KiB

After

Width:  |  Height:  |  Size: 418 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.1 KiB

After

Width:  |  Height:  |  Size: 503 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.2 KiB

After

Width:  |  Height:  |  Size: 628 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.0 KiB

After

Width:  |  Height:  |  Size: 415 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.0 KiB

After

Width:  |  Height:  |  Size: 423 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.1 KiB

After

Width:  |  Height:  |  Size: 587 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 353 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 353 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 155 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 171 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 940 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 497 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.1 KiB

After

Width:  |  Height:  |  Size: 537 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.1 KiB

After

Width:  |  Height:  |  Size: 550 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.3 KiB

After

Width:  |  Height:  |  Size: 758 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.3 KiB

After

Width:  |  Height:  |  Size: 770 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 211 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 290 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 314 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.5 KiB

After

Width:  |  Height:  |  Size: 522 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.4 KiB

After

Width:  |  Height:  |  Size: 848 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.0 KiB

After

Width:  |  Height:  |  Size: 446 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 274 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 198 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 166 B

View File

@ -379,59 +379,27 @@ minetest.register_tool("default:sword_diamond", {
sound = {breaks = "default_tool_breaks"}, sound = {breaks = "default_tool_breaks"},
}) })
minetest.register_tool("default:skeleton_key", {
description = "Skeleton Key",
inventory_image = "default_key_skeleton.png",
groups = {key = 1},
on_place = function(itemstack, placer, pointed_thing)
if pointed_thing.type ~= "node" then
return itemstack
end
local pos = pointed_thing.under
local node = minetest.get_node(pos)
if not node then
return itemstack
end
local on_skeleton_key_use = minetest.registered_nodes[node.name].on_skeleton_key_use
if on_skeleton_key_use then
-- make a new key secret in case the node callback needs it
local random = math.random
local newsecret = string.format(
"%04x%04x%04x%04x",
random(2^16) - 1, random(2^16) - 1,
random(2^16) - 1, random(2^16) - 1)
local secret, _, _ = on_skeleton_key_use(pos, placer, newsecret)
if secret then
-- finish and return the new key
itemstack:take_item()
itemstack:add_item("default:key")
itemstack:set_metadata(minetest.write_json({
secret = secret
}))
return itemstack
end
end
return nil
end
})
minetest.register_tool("default:key", { minetest.register_tool("default:key", {
description = "Key", description = "Key",
inventory_image = "default_key.png", inventory_image = "default_key.png",
groups = {key = 1, not_in_creative_inventory = 1}, groups = {key = 1, not_in_creative_inventory = 1},
stack_max = 1, stack_max = 1,
on_place = function(itemstack, placer, pointed_thing) on_place = function(itemstack, placer, pointed_thing)
local under = pointed_thing.under
local node = minetest.get_node(under)
local def = minetest.registered_nodes[node.name]
if def and def.on_rightclick and
not (placer and placer:is_player() and
placer:get_player_control().sneak) then
return def.on_rightclick(under, node, placer, itemstack,
pointed_thing) or itemstack
end
if pointed_thing.type ~= "node" then if pointed_thing.type ~= "node" then
return itemstack return itemstack
end end
local pos = pointed_thing.under local pos = pointed_thing.under
local node = minetest.get_node(pos) node = minetest.get_node(pos)
if not node or node.name == "ignore" then if not node or node.name == "ignore" then
return itemstack return itemstack

View File

@ -50,7 +50,7 @@ minetest.register_node("default:torch", {
sunlight_propagates = true, sunlight_propagates = true,
walkable = false, walkable = false,
liquids_pointable = false, liquids_pointable = false,
light_source = 13, light_source = 12,
groups = {choppy=2, dig_immediate=3, flammable=1, attached_node=1, torch=1}, groups = {choppy=2, dig_immediate=3, flammable=1, attached_node=1, torch=1},
drop = "default:torch", drop = "default:torch",
selection_box = { selection_box = {
@ -63,7 +63,8 @@ minetest.register_node("default:torch", {
local node = minetest.get_node(under) local node = minetest.get_node(under)
local def = minetest.registered_nodes[node.name] local def = minetest.registered_nodes[node.name]
if def and def.on_rightclick and if def and def.on_rightclick and
((not placer) or (placer and not placer:get_player_control().sneak)) then not (placer and placer:is_player() and
placer:get_player_control().sneak) then
return def.on_rightclick(under, node, placer, itemstack, return def.on_rightclick(under, node, placer, itemstack,
pointed_thing) or itemstack pointed_thing) or itemstack
end end
@ -97,7 +98,7 @@ minetest.register_node("default:torch_wall", {
paramtype2 = "wallmounted", paramtype2 = "wallmounted",
sunlight_propagates = true, sunlight_propagates = true,
walkable = false, walkable = false,
light_source = 13, light_source = 12,
groups = {choppy=2, dig_immediate=3, flammable=1, not_in_creative_inventory=1, attached_node=1, torch=1}, groups = {choppy=2, dig_immediate=3, flammable=1, not_in_creative_inventory=1, attached_node=1, torch=1},
drop = "default:torch", drop = "default:torch",
selection_box = { selection_box = {
@ -118,7 +119,7 @@ minetest.register_node("default:torch_ceiling", {
paramtype2 = "wallmounted", paramtype2 = "wallmounted",
sunlight_propagates = true, sunlight_propagates = true,
walkable = false, walkable = false,
light_source = 13, light_source = 12,
groups = {choppy=2, dig_immediate=3, flammable=1, not_in_creative_inventory=1, attached_node=1, torch=1}, groups = {choppy=2, dig_immediate=3, flammable=1, not_in_creative_inventory=1, attached_node=1, torch=1},
drop = "default:torch", drop = "default:torch",
selection_box = { selection_box = {
@ -144,4 +145,3 @@ minetest.register_lbm({
end end
end end
}) })

View File

@ -27,17 +27,16 @@ end
-- 'is snow nearby' function -- 'is snow nearby' function
local function is_snow_nearby(pos) local function is_snow_nearby(pos)
return minetest.find_node_near(pos, 1, return minetest.find_node_near(pos, 1, {"group:snowy"})
{"default:snow", "default:snowblock", "default:dirt_with_snow"})
end end
-- Sapling ABM -- Grow sapling
function default.grow_sapling(pos) function default.grow_sapling(pos)
if not default.can_grow(pos) then if not default.can_grow(pos) then
-- try a bit later again -- try again 5 min later
minetest.get_node_timer(pos):start(math.random(240, 600)) minetest.get_node_timer(pos):start(300)
return return
end end
@ -78,6 +77,14 @@ function default.grow_sapling(pos)
minetest.log("action", "An aspen sapling grows into a tree at ".. minetest.log("action", "An aspen sapling grows into a tree at "..
minetest.pos_to_string(pos)) minetest.pos_to_string(pos))
default.grow_new_aspen_tree(pos) default.grow_new_aspen_tree(pos)
elseif node.name == "default:bush_sapling" then
minetest.log("action", "A bush sapling grows into a bush at "..
minetest.pos_to_string(pos))
default.grow_bush(pos)
elseif node.name == "default:acacia_bush_sapling" then
minetest.log("action", "An acacia bush sapling grows into a bush at "..
minetest.pos_to_string(pos))
default.grow_acacia_bush(pos)
end end
end end
@ -87,7 +94,7 @@ minetest.register_lbm({
"default:pine_sapling", "default:acacia_sapling", "default:pine_sapling", "default:acacia_sapling",
"default:aspen_sapling"}, "default:aspen_sapling"},
action = function(pos) action = function(pos)
minetest.get_node_timer(pos):start(math.random(1200, 2400)) minetest.get_node_timer(pos):start(math.random(300, 1500))
end end
}) })
@ -373,7 +380,7 @@ function default.grow_new_apple_tree(pos)
local path = minetest.get_modpath("default") .. local path = minetest.get_modpath("default") ..
"/schematics/apple_tree_from_sapling.mts" "/schematics/apple_tree_from_sapling.mts"
minetest.place_schematic({x = pos.x - 2, y = pos.y - 1, z = pos.z - 2}, minetest.place_schematic({x = pos.x - 2, y = pos.y - 1, z = pos.z - 2},
path, "0", nil, false) path, "random", nil, false)
end end
@ -427,6 +434,29 @@ function default.grow_new_aspen_tree(pos)
end end
-- Bushes do not need 'from sapling' schematic variants because
-- only the stem node is force-placed in the schematic.
-- Bush
function default.grow_bush(pos)
local path = minetest.get_modpath("default") ..
"/schematics/bush.mts"
minetest.place_schematic({x = pos.x - 1, y = pos.y - 1, z = pos.z - 1},
path, "0", nil, false)
end
-- Acacia bush
function default.grow_acacia_bush(pos)
local path = minetest.get_modpath("default") ..
"/schematics/acacia_bush.mts"
minetest.place_schematic({x = pos.x - 1, y = pos.y - 1, z = pos.z - 1},
path, "0", nil, false)
end
-- --
-- Sapling 'on place' function to check protection of node and resulting tree volume -- Sapling 'on place' function to check protection of node and resulting tree volume
-- --
@ -438,7 +468,9 @@ function default.sapling_on_place(itemstack, placer, pointed_thing,
local node = minetest.get_node_or_nil(pos) local node = minetest.get_node_or_nil(pos)
local pdef = node and minetest.registered_nodes[node.name] local pdef = node and minetest.registered_nodes[node.name]
if pdef and pdef.on_rightclick and not placer:get_player_control().sneak then if pdef and pdef.on_rightclick and
not (placer and placer:is_player() and
placer:get_player_control().sneak) then
return pdef.on_rightclick(pos, node, placer, itemstack, pointed_thing) return pdef.on_rightclick(pos, node, placer, itemstack, pointed_thing)
end end
@ -451,26 +483,54 @@ function default.sapling_on_place(itemstack, placer, pointed_thing,
end end
end end
local player_name = placer:get_player_name() local player_name = placer and placer:get_player_name() or ""
-- Check sapling position for protection -- Check sapling position for protection
if minetest.is_protected(pos, player_name) then if minetest.is_protected(pos, player_name) then
minetest.record_protection_violation(pos, player_name) minetest.record_protection_violation(pos, player_name)
return itemstack return itemstack
end end
-- Check tree volume for protection -- Check tree volume for protection
if not default.intersects_protection( if default.intersects_protection(
vector.add(pos, minp_relative), vector.add(pos, minp_relative),
vector.add(pos, maxp_relative), vector.add(pos, maxp_relative),
player_name, player_name,
interval) then interval) then
minetest.set_node(pos, {name = sapling_name})
if not minetest.setting_getbool("creative_mode") then
itemstack:take_item()
end
else
minetest.record_protection_violation(pos, player_name) minetest.record_protection_violation(pos, player_name)
-- Print extra information to explain -- Print extra information to explain
minetest.chat_send_player(player_name, "Tree will intersect protection") minetest.chat_send_player(player_name, "Tree will intersect protection")
return itemstack
end
minetest.log("action", player_name .. " places node "
.. sapling_name .. " at " .. minetest.pos_to_string(pos))
local take_item = not (creative and creative.is_enabled_for
and creative.is_enabled_for(player_name))
local newnode = {name = sapling_name}
local ndef = minetest.registered_nodes[sapling_name]
minetest.set_node(pos, newnode)
-- Run callback
if ndef and ndef.after_place_node then
-- Deepcopy place_to and pointed_thing because callback can modify it
if ndef.after_place_node(table.copy(pos), placer,
itemstack, table.copy(pointed_thing)) then
take_item = false
end
end
-- Run script hook
for _, callback in ipairs(minetest.registered_on_placenodes) do
-- Deepcopy pos, node and pointed_thing because callback can modify them
if callback(table.copy(pos), table.copy(newnode),
placer, table.copy(node or {}),
itemstack, table.copy(pointed_thing)) then
take_item = false
end
end
if take_item then
itemstack:take_item()
end end
return itemstack return itemstack

View File

@ -6,6 +6,15 @@ local _doors = {}
_doors.registered_doors = {} _doors.registered_doors = {}
_doors.registered_trapdoors = {} _doors.registered_trapdoors = {}
local function replace_old_owner_information(pos)
local meta = minetest.get_meta(pos)
local owner = meta:get_string("doors_owner")
if owner and owner ~= "" then
meta:set_string("owner", owner)
meta:set_string("doors_owner", "")
end
end
-- returns an object to a door object or nil -- returns an object to a door object or nil
function doors.get(pos) function doors.get(pos)
local node_name = minetest.get_node(pos).name local node_name = minetest.get_node(pos).name
@ -82,7 +91,7 @@ minetest.register_node("doors:hidden", {
on_blast = function() end, on_blast = function() end,
tiles = {"doors_blank.png"}, tiles = {"doors_blank.png"},
-- 1px transparent block inside door hinge near node top. -- 1px transparent block inside door hinge near node top.
nodebox = { node_box = {
type = "fixed", type = "fixed",
fixed = {-15/32, 13/32, -15/32, -13/32, 1/2, -13/32}, fixed = {-15/32, 13/32, -15/32, -13/32, 1/2, -13/32},
}, },
@ -139,22 +148,10 @@ function _doors.door_toggle(pos, node, clicker)
state = tonumber(state) state = tonumber(state)
end end
if clicker and not minetest.check_player_privs(clicker, "protection_bypass") then replace_old_owner_information(pos)
-- is player wielding the right key?
local item = clicker:get_wielded_item()
local owner = meta:get_string("doors_owner")
if item:get_name() == "default:key" then
local key_meta = minetest.parse_json(item:get_metadata())
local secret = meta:get_string("key_lock_secret")
if secret ~= key_meta.secret then
return false
end
elseif owner ~= "" then if clicker and not default.can_interact_with_node(clicker, pos) then
if clicker:get_player_name() ~= owner then return false
return false
end
end
end end
-- until Lua-5.2 we have no bitwise operators :( -- until Lua-5.2 we have no bitwise operators :(
@ -205,11 +202,8 @@ local function on_place_node(place_to, newnode,
end end
local function can_dig_door(pos, digger) local function can_dig_door(pos, digger)
local digger_name = digger and digger:get_player_name() replace_old_owner_information(pos)
if digger_name and minetest.get_player_privs(digger_name).protection_bypass then return default.can_interact_with_node(digger, pos)
return true
end
return minetest.get_meta(pos):get_string("doors_owner") == digger_name
end end
function doors.register(name, def) function doors.register(name, def)
@ -255,6 +249,7 @@ function doors.register(name, def)
minetest.register_craftitem(":" .. name, { minetest.register_craftitem(":" .. name, {
description = def.description, description = def.description,
inventory_image = def.inventory_image, inventory_image = def.inventory_image,
groups = table.copy(def.groups),
on_place = function(itemstack, placer, pointed_thing) on_place = function(itemstack, placer, pointed_thing)
local pos local pos
@ -265,7 +260,9 @@ function doors.register(name, def)
local node = minetest.get_node(pointed_thing.under) local node = minetest.get_node(pointed_thing.under)
local pdef = minetest.registered_nodes[node.name] local pdef = minetest.registered_nodes[node.name]
if pdef and pdef.on_rightclick then if pdef and pdef.on_rightclick and
not (placer and placer:is_player() and
placer:get_player_control().sneak) then
return pdef.on_rightclick(pointed_thing.under, return pdef.on_rightclick(pointed_thing.under,
node, placer, itemstack, pointed_thing) node, placer, itemstack, pointed_thing)
end end
@ -289,12 +286,12 @@ function doors.register(name, def)
return itemstack return itemstack
end end
local pn = placer:get_player_name() local pn = placer and placer:get_player_name() or ""
if minetest.is_protected(pos, pn) or minetest.is_protected(above, pn) then if minetest.is_protected(pos, pn) or minetest.is_protected(above, pn) then
return itemstack return itemstack
end end
local dir = minetest.dir_to_facedir(placer:get_look_dir()) local dir = placer and minetest.dir_to_facedir(placer:get_look_dir()) or 0
local ref = { local ref = {
{x = -1, y = 0, z = 0}, {x = -1, y = 0, z = 0},
@ -323,14 +320,16 @@ function doors.register(name, def)
meta:set_int("state", state) meta:set_int("state", state)
if def.protected then if def.protected then
meta:set_string("doors_owner", pn) meta:set_string("owner", pn)
meta:set_string("infotext", "Owned by " .. pn) meta:set_string("infotext", "Owned by " .. pn)
end end
if not minetest.setting_getbool("creative_mode") then if not (creative and creative.is_enabled_for and creative.is_enabled_for(pn)) then
itemstack:take_item() itemstack:take_item()
end end
minetest.sound_play(def.sounds.place, {pos = pos})
on_place_node(pos, minetest.get_node(pos), on_place_node(pos, minetest.get_node(pos),
placer, node, itemstack, pointed_thing) placer, node, itemstack, pointed_thing)
@ -375,7 +374,9 @@ function doors.register(name, def)
minetest.remove_node({x = pos.x, y = pos.y + 1, z = pos.z}) minetest.remove_node({x = pos.x, y = pos.y + 1, z = pos.z})
minetest.check_for_falling({x = pos.x, y = pos.y + 1, z = pos.z}) minetest.check_for_falling({x = pos.x, y = pos.y + 1, z = pos.z})
end end
def.on_rotate = false def.on_rotate = function(pos, node, user, mode, new_param2)
return false
end
if def.protected then if def.protected then
def.can_dig = can_dig_door def.can_dig = can_dig_door
@ -385,8 +386,9 @@ function doors.register(name, def)
door:toggle(player) door:toggle(player)
end end
def.on_skeleton_key_use = function(pos, player, newsecret) def.on_skeleton_key_use = function(pos, player, newsecret)
replace_old_owner_information(pos)
local meta = minetest.get_meta(pos) local meta = minetest.get_meta(pos)
local owner = meta:get_string("doors_owner") local owner = meta:get_string("owner")
local pname = player:get_player_name() local pname = player:get_player_name()
-- verify placer is owner of lockable door -- verify placer is owner of lockable door
@ -523,23 +525,11 @@ end
function _doors.trapdoor_toggle(pos, node, clicker) function _doors.trapdoor_toggle(pos, node, clicker)
node = node or minetest.get_node(pos) node = node or minetest.get_node(pos)
if clicker and not minetest.check_player_privs(clicker, "protection_bypass") then
-- is player wielding the right key?
local item = clicker:get_wielded_item()
local meta = minetest.get_meta(pos)
local owner = meta:get_string("doors_owner")
if item:get_name() == "default:key" then
local key_meta = minetest.parse_json(item:get_metadata())
local secret = meta:get_string("key_lock_secret")
if secret ~= key_meta.secret then
return false
end
elseif owner ~= "" then replace_old_owner_information(pos)
if clicker:get_player_name() ~= owner then
return false if clicker and not default.can_interact_with_node(clicker, pos) then
end return false
end
end end
local def = minetest.registered_nodes[node.name] local def = minetest.registered_nodes[node.name]
@ -581,10 +571,10 @@ function doors.register_trapdoor(name, def)
def.after_place_node = function(pos, placer, itemstack, pointed_thing) def.after_place_node = function(pos, placer, itemstack, pointed_thing)
local pn = placer:get_player_name() local pn = placer:get_player_name()
local meta = minetest.get_meta(pos) local meta = minetest.get_meta(pos)
meta:set_string("doors_owner", pn) meta:set_string("owner", pn)
meta:set_string("infotext", "Owned by "..pn) meta:set_string("infotext", "Owned by "..pn)
return minetest.setting_getbool("creative_mode") return (creative and creative.is_enabled_for and creative.is_enabled_for(pn))
end end
def.on_blast = function() end def.on_blast = function() end
@ -593,8 +583,9 @@ function doors.register_trapdoor(name, def)
door:toggle(player) door:toggle(player)
end end
def.on_skeleton_key_use = function(pos, player, newsecret) def.on_skeleton_key_use = function(pos, player, newsecret)
replace_old_owner_information(pos)
local meta = minetest.get_meta(pos) local meta = minetest.get_meta(pos)
local owner = meta:get_string("doors_owner") local owner = meta:get_string("owner")
local pname = player:get_player_name() local pname = player:get_player_name()
-- verify placer is owner of lockable door -- verify placer is owner of lockable door
@ -717,7 +708,7 @@ function doors.register_fencegate(name, def)
local fence = { local fence = {
description = def.description, description = def.description,
drawtype = "mesh", drawtype = "mesh",
tiles = {def.texture}, tiles = {},
paramtype = "light", paramtype = "light",
paramtype2 = "facedir", paramtype2 = "facedir",
sunlight_propagates = true, sunlight_propagates = true,
@ -739,6 +730,16 @@ function doors.register_fencegate(name, def)
}, },
} }
if type(def.texture) == "string" then
fence.tiles[1] = {name = def.texture, backface_culling = true}
elseif def.texture.backface_culling == nil then
fence.tiles[1] = table.copy(def.texture)
fence.tiles[1].backface_culling = true
else
fence.tiles[1] = def.texture
end
if not fence.sounds then if not fence.sounds then
fence.sounds = default.node_sound_wood_defaults() fence.sounds = default.node_sound_wood_defaults()
end end
@ -792,7 +793,7 @@ doors.register_fencegate("doors:gate_acacia_wood", {
}) })
doors.register_fencegate("doors:gate_junglewood", { doors.register_fencegate("doors:gate_junglewood", {
description = "Junglewood Fence Gate", description = "Jungle Wood Fence Gate",
texture = "default_junglewood.png", texture = "default_junglewood.png",
material = "default:junglewood", material = "default:junglewood",
groups = {choppy = 2, oddly_breakable_by_hand = 2, flammable = 2} groups = {choppy = 2, oddly_breakable_by_hand = 2, flammable = 2}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.0 KiB

After

Width:  |  Height:  |  Size: 491 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.9 KiB

After

Width:  |  Height:  |  Size: 420 B

View File

@ -74,36 +74,39 @@ minetest.register_craft({
}) })
-- Mix recipes -- Mix recipes
-- Just mix everything to everything somehow sanely local dye_recipes = {
-- src1, src2, dst
local mixbases = {"pink", "magenta", "red", "orange", "brown", "yellow", "green", "dark_green", "cyan", "blue", "violet", "black", "dark_grey", "grey", "white"} -- RYB mixes
{"red", "blue", "violet"}, -- "purple"
local mixes = { {"yellow", "red", "orange"},
-- pink, magenta, red, orange, brown, yellow, green, dark_green, cyan, blue, violet, black, dark_grey, grey, white {"yellow", "blue", "green"},
white = {"pink", "pink", "pink", "orange", "orange", "yellow", "green", "green", "grey", "cyan", "violet","grey", "grey", "grey","white"}, -- RYB complementary mixes
grey = {"pink", "pink", "pink", "orange", "orange", "yellow", "green", "green", "grey", "cyan", "violet","dark_grey","grey", "grey"}, {"yellow", "violet", "dark_grey"},
dark_grey = {"brown", "brown", "brown", "brown", "brown", "brown", "dark_green","dark_green","blue", "blue", "violet","black", "dark_grey"}, {"blue", "orange", "dark_grey"},
black = {"black", "black", "black", "black", "black", "black", "black", "black", "black","black", "black", "black"}, -- CMY mixes - approximation
violet = {"magenta","magenta","magenta","red", "brown", "red", "cyan", "brown", "blue", "violet","violet"}, {"cyan", "yellow", "green"},
blue = {"violet", "violet", "magenta","brown", "brown", "dark_green","cyan", "cyan", "cyan", "blue"}, {"cyan", "magenta", "blue"},
cyan = {"brown", "blue", "brown", "dark_green","dark_grey", "green", "cyan", "dark_green","cyan"}, {"yellow", "magenta", "red"},
dark_green = {"brown", "brown", "brown", "brown", "brown", "green", "green", "dark_green"}, -- other mixes that result in a color we have
green = {"yellow", "brown", "yellow", "yellow", "dark_green","green", "green"}, {"red", "green", "brown"},
yellow = {"orange", "red", "orange", "yellow", "orange", "yellow"}, {"magenta", "blue", "violet"},
brown = {"brown", "brown", "brown", "orange", "brown"}, {"green", "blue", "cyan"},
orange = {"orange", "red", "orange", "orange"}, {"pink", "violet", "magenta"},
red = {"pink", "magenta","red"}, -- mixes with black
magenta = {"magenta","magenta"}, {"white", "black", "grey"},
pink = {"pink"}, {"grey", "black", "dark_grey"},
{"green", "black", "dark_green"},
{"orange", "black", "brown"},
-- mixes with white
{"white", "red", "pink"},
{"white", "dark_grey", "grey"},
{"white", "dark_green", "green"},
} }
for one, results in pairs(mixes) do for _, mix in pairs(dye_recipes) do
for i, result in ipairs(results) do minetest.register_craft({
local another = mixbases[i] type = "shapeless",
minetest.register_craft({ output = 'dye:' .. mix[3] .. ' 2',
type = "shapeless", recipe = {'dye:' .. mix[1], 'dye:' .. mix[2]},
output = 'dye:' .. result .. ' 2', })
recipe = {'dye:' .. one, 'dye:' .. another},
})
end
end end

View File

@ -57,7 +57,8 @@ farming.hoe_on_use = function(itemstack, user, pointed_thing, uses)
gain = 0.5, gain = 0.5,
}) })
if not minetest.setting_getbool("creative_mode") then if not (creative and creative.is_enabled_for
and creative.is_enabled_for(user:get_player_name())) then
-- wear tool -- wear tool
local wdef = itemstack:get_definition() local wdef = itemstack:get_definition()
itemstack:add_wear(65535/(uses-1)) itemstack:add_wear(65535/(uses-1))
@ -117,15 +118,6 @@ farming.register_hoe = function(name, def)
{"", "group:stick", ""} {"", "group:stick", ""}
} }
}) })
-- Reverse Recipe
minetest.register_craft({
output = name:sub(2),
recipe = {
{"", def.material, def.material},
{"", "group:stick", ""},
{"", "group:stick", ""}
}
})
end end
end end
@ -152,12 +144,14 @@ farming.place_seed = function(itemstack, placer, pointed_thing, plantname)
local under = minetest.get_node(pt.under) local under = minetest.get_node(pt.under)
local above = minetest.get_node(pt.above) local above = minetest.get_node(pt.above)
if minetest.is_protected(pt.under, placer:get_player_name()) then local player_name = placer and placer:get_player_name() or ""
minetest.record_protection_violation(pt.under, placer:get_player_name())
if minetest.is_protected(pt.under, player_name) then
minetest.record_protection_violation(pt.under, player_name)
return return
end end
if minetest.is_protected(pt.above, placer:get_player_name()) then if minetest.is_protected(pt.above, player_name) then
minetest.record_protection_violation(pt.above, placer:get_player_name()) minetest.record_protection_violation(pt.above, player_name)
return return
end end
@ -187,7 +181,8 @@ farming.place_seed = function(itemstack, placer, pointed_thing, plantname)
-- add the node and remove 1 item from the itemstack -- add the node and remove 1 item from the itemstack
minetest.add_node(pt.above, {name = plantname, param2 = 1}) minetest.add_node(pt.above, {name = plantname, param2 = 1})
tick(pt.above) tick(pt.above)
if not minetest.setting_getbool("creative_mode") then if not (creative and creative.is_enabled_for
and creative.is_enabled_for(player_name)) then
itemstack:take_item() itemstack:take_item()
end end
return itemstack return itemstack
@ -313,6 +308,16 @@ farming.register_plant = function(name, def)
}), }),
on_place = function(itemstack, placer, pointed_thing) on_place = function(itemstack, placer, pointed_thing)
local under = pointed_thing.under
local node = minetest.get_node(under)
local udef = minetest.registered_nodes[node.name]
if udef and udef.on_rightclick and
not (placer and placer:is_player() and
placer:get_player_control().sneak) then
return udef.on_rightclick(under, node, placer, itemstack,
pointed_thing) or itemstack
end
return farming.place_seed(itemstack, placer, pointed_thing, mname .. ":seed_" .. pname) return farming.place_seed(itemstack, placer, pointed_thing, mname .. ":seed_" .. pname)
end, end,
next_plant = mname .. ":" .. pname .. "_1", next_plant = mname .. ":" .. pname .. "_1",
@ -330,12 +335,16 @@ farming.register_plant = function(name, def)
-- Register growing steps -- Register growing steps
for i = 1, def.steps do for i = 1, def.steps do
local base_rarity = 1
if def.steps ~= 1 then
base_rarity = 8 - (i - 1) * 7 / (def.steps - 1)
end
local drop = { local drop = {
items = { items = {
{items = {mname .. ":" .. pname}, rarity = 9 - i}, {items = {mname .. ":" .. pname}, rarity = base_rarity},
{items = {mname .. ":" .. pname}, rarity= 18 - i * 2}, {items = {mname .. ":" .. pname}, rarity = base_rarity * 2},
{items = {mname .. ":seed_" .. pname}, rarity = 9 - i}, {items = {mname .. ":seed_" .. pname}, rarity = base_rarity},
{items = {mname .. ":seed_" .. pname}, rarity = 18 - i * 2}, {items = {mname .. ":seed_" .. pname}, rarity = base_rarity * 2},
} }
} }
local nodegroups = {snappy = 3, flammable = 2, plant = 1, not_in_creative_inventory = 1, attached_node = 1} local nodegroups = {snappy = 3, flammable = 2, plant = 1, not_in_creative_inventory = 1, attached_node = 1}

View File

@ -1,2 +1,3 @@
default default
wool wool
stairs

View File

@ -22,6 +22,14 @@ minetest.override_item("default:dirt_with_dry_grass", {
} }
}) })
minetest.override_item("default:dirt_with_rainforest_litter", {
soil = {
base = "default:dirt_with_rainforest_litter",
dry = "farming:soil",
wet = "farming:soil_wet"
}
})
minetest.register_node("farming:soil", { minetest.register_node("farming:soil", {
description = "Soil", description = "Soil",
tiles = {"default_dirt.png^farming_soil.png", "default_dirt.png"}, tiles = {"default_dirt.png^farming_soil.png", "default_dirt.png"},
@ -90,6 +98,16 @@ minetest.register_node("farming:straw", {
sounds = default.node_sound_leaves_defaults(), sounds = default.node_sound_leaves_defaults(),
}) })
stairs.register_stair_and_slab(
"straw",
"farming:straw",
{snappy = 3, flammable = 4},
{"farming_straw.png"},
"Straw Stair",
"Straw Slab",
default.node_sound_leaves_defaults()
)
minetest.register_abm({ minetest.register_abm({
label = "Farming soil", label = "Farming soil",
nodenames = {"group:field"}, nodenames = {"group:field"},

View File

@ -24,7 +24,7 @@ minetest.register_node("fire:basic_flame", {
}, },
inventory_image = "fire_basic_flame.png", inventory_image = "fire_basic_flame.png",
paramtype = "light", paramtype = "light",
light_source = 14, light_source = 13,
walkable = false, walkable = false,
buildable_to = true, buildable_to = true,
sunlight_propagates = true, sunlight_propagates = true,
@ -44,9 +44,6 @@ minetest.register_node("fire:basic_flame", {
on_construct = function(pos) on_construct = function(pos)
minetest.get_node_timer(pos):start(math.random(30, 60)) minetest.get_node_timer(pos):start(math.random(30, 60))
end, end,
on_blast = function() -- Unaffected by explosions
end,
}) })
minetest.register_node("fire:permanent_flame", { minetest.register_node("fire:permanent_flame", {
@ -65,16 +62,13 @@ minetest.register_node("fire:permanent_flame", {
}, },
inventory_image = "fire_basic_flame.png", inventory_image = "fire_basic_flame.png",
paramtype = "light", paramtype = "light",
light_source = 14, light_source = 13,
walkable = false, walkable = false,
buildable_to = true, buildable_to = true,
sunlight_propagates = true, sunlight_propagates = true,
damage_per_second = 4, damage_per_second = 4,
groups = {igniter = 2, dig_immediate = 3}, groups = {igniter = 2, dig_immediate = 3},
drop = "", drop = "",
on_blast = function() -- Unaffected by explosions
end,
}) })
@ -86,36 +80,37 @@ minetest.register_tool("fire:flint_and_steel", {
sound = {breaks = "default_tool_breaks"}, sound = {breaks = "default_tool_breaks"},
on_use = function(itemstack, user, pointed_thing) on_use = function(itemstack, user, pointed_thing)
local pt = pointed_thing local sound_pos = pointed_thing.above or user:get_pos()
minetest.sound_play( minetest.sound_play(
"fire_flint_and_steel", "fire_flint_and_steel",
{pos = pt.above, gain = 0.5, max_hear_distance = 8} {pos = sound_pos, gain = 0.5, max_hear_distance = 8}
) )
if pt.type == "node" then local player_name = user:get_player_name()
local node_under = minetest.get_node(pt.under).name if pointed_thing.type == "node" then
local node_under = minetest.get_node(pointed_thing.under).name
local nodedef = minetest.registered_nodes[node_under] local nodedef = minetest.registered_nodes[node_under]
if not nodedef then if not nodedef then
return return
end end
local player_name = user:get_player_name() if minetest.is_protected(pointed_thing.under, player_name) then
if minetest.is_protected(pt.under, player_name) then
minetest.chat_send_player(player_name, "This area is protected") minetest.chat_send_player(player_name, "This area is protected")
return return
end end
if nodedef.on_ignite then if nodedef.on_ignite then
nodedef.on_ignite(pt.under, user) nodedef.on_ignite(pointed_thing.under, user)
elseif minetest.get_item_group(node_under, "flammable") >= 1 elseif minetest.get_item_group(node_under, "flammable") >= 1
and minetest.get_node(pt.above).name == "air" then and minetest.get_node(pointed_thing.above).name == "air" then
minetest.set_node(pt.above, {name = "fire:basic_flame"}) minetest.set_node(pointed_thing.above, {name = "fire:basic_flame"})
end end
end end
if not minetest.setting_getbool("creative_mode") then if not (creative and creative.is_enabled_for
and creative.is_enabled_for(player_name)) then
-- Wear tool -- Wear tool
local wdef = itemstack:get_definition() local wdef = itemstack:get_definition()
itemstack:add_wear(1000) itemstack:add_wear(1000)
-- Tool break sound -- Tool break sound
if itemstack:get_count() == 0 and wdef.sound and wdef.sound.breaks then if itemstack:get_count() == 0 and wdef.sound and wdef.sound.breaks then
minetest.sound_play(wdef.sound.breaks, {pos = pt.above, gain = 0.5}) minetest.sound_play(wdef.sound.breaks, {pos = sound_pos, gain = 0.5})
end end
return itemstack return itemstack
end end
@ -153,7 +148,7 @@ minetest.override_item("default:coalblock", {
-- Sound -- Sound
-- --
local flame_sound = minetest.setting_getbool("flame_sound") local flame_sound = minetest.settings:get_bool("flame_sound")
if flame_sound == nil then if flame_sound == nil then
-- Enable if no setting present -- Enable if no setting present
flame_sound = true flame_sound = true
@ -295,11 +290,16 @@ minetest.register_abm({
-- Enable the following ABMs according to 'enable fire' setting -- Enable the following ABMs according to 'enable fire' setting
local fire_enabled = minetest.setting_getbool("enable_fire") local fire_enabled = minetest.settings:get_bool("enable_fire")
if fire_enabled == nil then if fire_enabled == nil then
-- New setting not specified, check for old setting. -- enable_fire setting not specified, check for disable_fire
-- If old setting is also not specified, 'not nil' is true. local fire_disabled = minetest.settings:get_bool("disable_fire")
fire_enabled = not minetest.setting_getbool("disable_fire") if fire_disabled == nil then
-- Neither setting specified, check whether singleplayer
fire_enabled = minetest.is_singleplayer()
else
fire_enabled = not fire_disabled
end
end end
if not fire_enabled then if not fire_enabled then

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.0 KiB

After

Width:  |  Height:  |  Size: 459 B

View File

@ -107,11 +107,16 @@ function flowers.flower_spread(pos, node)
pos.y = pos.y - 1 pos.y = pos.y - 1
local under = minetest.get_node(pos) local under = minetest.get_node(pos)
pos.y = pos.y + 1 pos.y = pos.y + 1
if under.name == "default:desert_sand" then -- Replace flora with dry shrub in desert sand and silver sand,
-- as this is the only way to generate them.
-- However, preserve grasses in sand dune biomes.
if minetest.get_item_group(under.name, "sand") == 1 and
under.name ~= "default:sand" then
minetest.set_node(pos, {name = "default:dry_shrub"}) minetest.set_node(pos, {name = "default:dry_shrub"})
return return
elseif under.name ~= "default:dirt_with_grass" and end
under.name ~= "default:dirt_with_dry_grass" then
if minetest.get_item_group(under.name, "soil") == 0 then
return return
end end
@ -122,30 +127,37 @@ function flowers.flower_spread(pos, node)
local pos0 = vector.subtract(pos, 4) local pos0 = vector.subtract(pos, 4)
local pos1 = vector.add(pos, 4) local pos1 = vector.add(pos, 4)
if #minetest.find_nodes_in_area(pos0, pos1, "group:flora") > 3 then -- Maximum flower density created by mapgen is 13 per 9x9 area.
-- The limit of 7 below was tuned by in-game testing to result in a maximum
-- flower density by ABM spread of 13 per 9x9 area.
-- Warning: Setting this limit theoretically without in-game testing
-- results in a maximum flower density by ABM spread that is far too high.
if #minetest.find_nodes_in_area(pos0, pos1, "group:flora") > 7 then
return return
end end
local seedling = minetest.find_nodes_in_area_under_air(pos0, pos1, local soils = minetest.find_nodes_in_area_under_air(
{"default:dirt_with_grass", "default:dirt_with_dry_grass"}) pos0, pos1, "group:soil")
if #seedling > 0 then local num_soils = #soils
seedling = seedling[math.random(#seedling)] if num_soils >= 1 then
seedling.y = seedling.y + 1 for si = 1, math.min(3, num_soils) do
light = minetest.get_node_light(seedling) local soil = soils[math.random(num_soils)]
if not light or light < 13 then local soil_above = {x = soil.x, y = soil.y + 1, z = soil.z}
return light = minetest.get_node_light(soil_above)
if light and light >= 13 and
-- Desert sand is in the soil group
minetest.get_node(soil).name ~= "default:desert_sand" then
minetest.set_node(soil_above, {name = node.name})
end
end end
minetest.set_node(seedling, {name = node.name})
end end
end end
minetest.register_abm({ minetest.register_abm({
label = "Flower spread", label = "Flower spread",
nodenames = {"group:flora"}, nodenames = {"group:flora"},
neighbors = {"default:dirt_with_grass", "default:dirt_with_dry_grass",
"default:desert_sand"},
interval = 13, interval = 13,
chance = 96, chance = 300,
action = function(...) action = function(...)
flowers.flower_spread(...) flowers.flower_spread(...)
end, end,
@ -197,38 +209,34 @@ minetest.register_node("flowers:mushroom_brown", {
-- Mushroom spread and death -- Mushroom spread and death
function flowers.mushroom_spread(pos, node)
if minetest.get_node_light(pos, nil) == 15 then
minetest.remove_node(pos)
return
end
local positions = minetest.find_nodes_in_area_under_air(
{x = pos.x - 1, y = pos.y - 2, z = pos.z - 1},
{x = pos.x + 1, y = pos.y + 1, z = pos.z + 1},
{"group:soil", "group:tree"})
if #positions == 0 then
return
end
local pos2 = positions[math.random(#positions)]
pos2.y = pos2.y + 1
if minetest.get_node_light(pos, 0.5) <= 3 and
minetest.get_node_light(pos2, 0.5) <= 3 then
minetest.set_node(pos2, {name = node.name})
end
end
minetest.register_abm({ minetest.register_abm({
label = "Mushroom spread", label = "Mushroom spread",
nodenames = {"flowers:mushroom_brown", "flowers:mushroom_red"}, nodenames = {"flowers:mushroom_brown", "flowers:mushroom_red"},
interval = 11, interval = 11,
chance = 50, chance = 150,
action = function(pos, node) action = function(...)
if minetest.get_node_light(pos, nil) == 15 then flowers.mushroom_spread(...)
minetest.remove_node(pos) end,
return
end
local random = {
x = pos.x + math.random(-2, 2),
y = pos.y + math.random(-1, 1),
z = pos.z + math.random(-2, 2)
}
local random_node = minetest.get_node_or_nil(random)
if not random_node or random_node.name ~= "air" then
return
end
local node_under = minetest.get_node_or_nil({x = random.x,
y = random.y - 1, z = random.z})
if not node_under then
return
end
if (minetest.get_item_group(node_under.name, "soil") ~= 0 or
minetest.get_item_group(node_under.name, "tree") ~= 0) and
minetest.get_node_light(pos, 0.5) <= 3 and
minetest.get_node_light(random, 0.5) <= 3 then
minetest.set_node(random, {name = node.name})
end
end
}) })
@ -264,7 +272,7 @@ minetest.register_node("flowers:waterlily", {
node_placement_prediction = "", node_placement_prediction = "",
node_box = { node_box = {
type = "fixed", type = "fixed",
fixed = {-0.5, -0.5, -0.5, 0.5, -15 / 32, 0.5} fixed = {-0.5, -31 / 64, -0.5, 0.5, -15 / 32, 0.5}
}, },
selection_box = { selection_box = {
type = "fixed", type = "fixed",
@ -273,16 +281,22 @@ minetest.register_node("flowers:waterlily", {
on_place = function(itemstack, placer, pointed_thing) on_place = function(itemstack, placer, pointed_thing)
local pos = pointed_thing.above local pos = pointed_thing.above
local node = minetest.get_node(pointed_thing.under).name local node = minetest.get_node(pointed_thing.under)
local def = minetest.registered_nodes[node] local def = minetest.registered_nodes[node.name]
local player_name = placer:get_player_name() local player_name = placer and placer:get_player_name() or ""
if def and def.on_rightclick then
return def.on_rightclick(pointed_thing.under, node, placer, itemstack,
pointed_thing)
end
if def and def.liquidtype == "source" and if def and def.liquidtype == "source" and
minetest.get_item_group(node, "water") > 0 then minetest.get_item_group(node.name, "water") > 0 then
if not minetest.is_protected(pos, player_name) then if not minetest.is_protected(pos, player_name) then
minetest.set_node(pos, {name = "flowers:waterlily", minetest.set_node(pos, {name = "flowers:waterlily",
param2 = math.random(0, 3)}) param2 = math.random(0, 3)})
if not minetest.setting_getbool("creative_mode") then if not (creative and creative.is_enabled_for
and creative.is_enabled_for(player_name)) then
itemstack:take_item() itemstack:take_item()
end end
else else

View File

@ -94,7 +94,8 @@ local function register_flower(seed, name)
octaves = 3, octaves = 3,
persist = 0.6 persist = 0.6
}, },
biomes = {"grassland", "deciduous_forest", "coniferous_forest"}, biomes = {"grassland", "deciduous_forest", "coniferous_forest",
"floatland_grassland", "floatland_coniferous_forest"},
y_min = 1, y_min = 1,
y_max = 31000, y_max = 31000,
decoration = "flowers:"..name, decoration = "flowers:"..name,
@ -114,7 +115,8 @@ local function register_mushroom(name)
octaves = 3, octaves = 3,
persist = 0.66 persist = 0.66
}, },
biomes = {"deciduous_forest", "coniferous_forest"}, biomes = {"deciduous_forest", "coniferous_forest",
"floatland_coniferous_forest"},
y_min = 1, y_min = 1,
y_max = 31000, y_max = 31000,
decoration = "flowers:"..name, decoration = "flowers:"..name,

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.3 KiB

After

Width:  |  Height:  |  Size: 690 B

View File

@ -1,4 +1,4 @@
local stuff_string = minetest.setting_get("initial_stuff") or local stuff_string = minetest.settings:get("initial_stuff") or
"default:pick_steel,default:axe_steel,default:shovel_steel," .. "default:pick_steel,default:axe_steel,default:shovel_steel," ..
"default:torch 99,default:cobble 99" "default:torch 99,default:cobble 99"
@ -39,6 +39,6 @@ function give_initial_stuff.get_list()
end end
give_initial_stuff.add_from_csv(stuff_string) give_initial_stuff.add_from_csv(stuff_string)
if minetest.setting_getbool("give_initial_stuff") then if minetest.settings:get_bool("give_initial_stuff") then
minetest.register_on_newplayer(give_initial_stuff.give) minetest.register_on_newplayer(give_initial_stuff.give)
end end

24
mods/killme/init.lua Normal file
View File

@ -0,0 +1,24 @@
minetest.register_chatcommand("killme", {
description = "Kill yourself to respawn",
func = function(name)
local player = minetest.get_player_by_name(name)
if player then
if minetest.settings:get_bool("enable_damage") then
player:set_hp(0)
return true
else
for _, callback in pairs(core.registered_on_respawnplayers) do
if callback(player) then
return true
end
end
-- There doesn't seem to be a way to get a default spawn pos from the lua API
return false, "No static_spawnpoint defined"
end
else
-- Show error message if used when not logged in, eg: from IRC mod
return false, "You need to be online to be killed!"
end
end
})

View File

@ -1,16 +0,0 @@
Minetest Game mod: nyancat
==========================
See license.txt for license information.
Authors of source code
----------------------
Originally by celeron55, Perttu Ahola <celeron55@gmail.com> (LGPL 2.1)
Various Minetest developers and contributors (LGPL 2.1)
Authors of media files
----------------------
VanessaE (CC BY-SA 3.0):
nyancat_front.png
nyancat_back.png
nyancat_side.png
nyancat_rainbow.png

Some files were not shown because too many files have changed in this diff Show More