Commit Graph

87 Commits

Author SHA1 Message Date
tenplus1
6fdfd2554c Tnt: Various optimisations
Pass nodename to tnt.burn function where possible to reduce
use of 'get_node'.
Change 'ipairs' to 'pairs'.
Use 'nodeupdate_single(pos)' instead of 'nodeupdate(pos)' to
avoid every node triggering recursion, the loop itself takes
the place of recursion and works upwards through horizontal
planes as required.
2016-10-10 03:16:41 +01:00
Auke Kok
54235f3276 Xpanes: Convert to connected nodeboxes
I've rewritten this to use connected nodeboxes, but with a caveat. In
order to make flat nodes look better, I'm keeping one non-connected
pane that is flat around to convert flat sections to the flat nodes
instead of connected, as these look better and are easier to work
with. Once more sides are needed we convert the panes on the fly to
connected nodes and recalculate the shape.

We don't paint any of the half-panes that the previous generation of
xpanes did. There's no need and it's harder to work with. Updating the
nodes also seems more natural and placement and removal works straight
forward.

The conversion of old panes relies on an LBM, and does a reasonable
conversion job, but it's not exact, since the panes behave slightly
different now.

The game API documentation was wrong to begin with. We discard param
nr. 2 of the API entirely, and correct the tile usage text.
2016-09-10 05:18:02 +01:00
Tim
20fa037313 Screwdriver: disallow rotation with on_rotate = false
Other screwdriver mods, or mods that cause rotation, might operate without the screwdriver mod loaded and have `screwdriver.disallow` unavailable.
This allows nodes to default to full-disallow rather than full-rotation in such a situation.
2016-08-05 20:41:24 +01:00
rubenwardy
3661cb61e3 Move nyancats into a separate mod
Nyancats are independent in the default mod. Nothing else uses them or
their code. Separating it into a separate mod makes it easier for
subgames to remove them. It also makes it easier for a mod to depend
on nyancats, as lots of subgames don't have them.

Default/mapgen.lua: Register biomes, ores and decorations in
singlenode mapgen. These were never disabled anyway because
singlenode was removed from the world creation menu.
2016-07-18 04:15:44 +01:00
tenplus1
98551edd94 Game_api.txt: Add position table reference 2016-07-05 18:18:45 +01:00
tenplus1
c5b0fe72ea Game_api.txt: Add API information for sethome functions
- Documentation for sethome.get, sethome.set and sethome.go
2016-07-05 18:17:22 +01:00
tenplus1
6bf552eb10 Creative: Document creative.formspec_add in game_api.txt 2016-06-27 05:28:43 +01:00
Auke Kok
2199be5108 Stairs: Add mossy cobble slab and stair
Allow water to turn cobble slab and stairs to turn into mossy versions.

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

The slabs and stairs will turn mossy when water is adjacent, just like
cobblestone. You can either farm mossy versions by placing them in
water for a while, then collecting them, or run water over your craft.
2016-06-14 23:28:17 +01:00
rubenwardy
acafe5ca86 Add give_initial_items API 2016-05-01 19:29:15 +01:00
Auke Kok
098ea0d10a TNT: Allow mods to override entity physics.
Introduces an `on_blast(luaobj, damage)` callback that mods can attach
to an entity def. The function will get called with the damage that
TNT would make.

The function should return three values:

  bool do_damage, bool do_knockback, table drops

do_damage allows the mod to tell the TNT code to perform damage on
the entity for the mod. The mod code should not do anything with
the entity HP. The entity should not be immortal. If false, then
the entity will not be damaged by the TNT mod.

do_knockback allows the mod to tell the TNT mod to perform an
entity knockback effect. If false, no knockback effect is applied
to the entity.

the drops table is a list of items to drop. It may be nil. E.g. {
"wool:red" }.

I've documented both on_blast() API methods in game_api.txt. It is
a better place than lua_api.txt.
2016-04-30 20:47:21 +01:00
Auke Kok
54b87e955d TNT: Add on_blast to all nodes with an inventory
Adds a minor helper function that allows efficient retrieval of
several inventories from a node inventory. We use this helper to
quickly retrieve the items in chests, vessel shelves, book shelves
and furnaces, and return these with the nodes itself to the TNT caller.

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

We disable TNT doing anything with bones.

We expose a bug in the code that drops the items - metadata was lost
entirely. This patch corrects that by properly copying the metadata
and creating the drops list inclusive metadata.
2016-04-26 22:33:59 +01:00
Auke Kok
da5f4a939e Fix API docs after various changes. 2016-04-16 19:27:16 +01:00
red-001
cfef21f4d9 Add TNT API. 2016-04-16 19:27:16 +01:00
Rui914
a2ecc51fbc Create API for registration of fence gate. 2016-03-21 06:17:21 +00:00
Auke Kok
f8f7502e32 Basic stone walls, using NDT_CONNECTED.
These basic connected wall nodes automatically connect
to neigboring stone blocks, other wall blocks and anything
that's "cracky". The do not connect to wood (fences will do
that).

The walls are generated using a new walls.register() API.
Documentation on the API is included in game_api.txt.

This change requires minetest/minetest#3503.

Walls are added for all cobble stone materials. They generally
look best and are the natural use cases for these materials.
2016-03-13 04:11:22 +00:00
red-001
a5ad30748d Add an on_burn callback. 2016-03-11 15:27:57 +00:00
red-001
68f5740dcc Fix markdown formating in game_api.txt. 2016-03-06 01:30:58 +00:00
Auke Kok
363b95c003 Doors: Allow arbitrary recipe to be passed, even nil
This allows mod makers to register their own recipies, including
none, to register doors.
2016-02-18 13:57:09 +00:00
Auke Kok
f600a9f645 New mesh door models, and extensive door API
This patch replaces the default door nodes with a new mesh model
and nodes.

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

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

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

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

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

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

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

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

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

Thanks to red-001 <red-001@users.noreply.github.com> for some
of the conversion code, cleanups, and extra textures.
2016-02-13 03:47:28 +00:00
Auke Kok
2f39cad09b Create API for fence.register, and use it.
This converts the call to minetest.register() for the default
fence node, so it can be called by other mods to quickly
setup other fences.

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

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

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

This recipe yields 4 fence nodes.

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

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

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

Stick and fences nodes are named in a consistent way.
2016-02-03 19:33:19 +00:00
PilzAdam
c15bd9d529 Fix wrong nomenclature in game_api.txt 2015-10-11 18:29:39 +02:00
paramat
8e51f318b3 Rename to Minetest Game
Rename in game.conf and documentation
Update game_api.txt documentation for bucket API and tree functions
Fix tab, space and comment formatting in game_api.txt
Rename in mod READMEs
2015-09-30 23:33:12 +01:00
Wuzzy
0aebf864d1 Add gunpowder trails
Uses group “connect_to_raillike”
2015-06-07 14:27:18 +02:00
Novatux
2824562dc9 Add screwdriver callbacks, and code them for doors and beds 2015-05-14 10:24:56 +02:00
Wuzzy
852b337916 Use connect_to_raillike for rail
Used value: 2
2015-05-14 10:19:07 +02:00
MT-Modder
3e912f7b85 Add reverse recipes for hoes
- Adds material for crafting (keeps def.recipe compatibility)
- Fix two typos in api documentation
2015-02-28 22:05:07 +01:00
BlockMen
edb02e9d33 Add beds 2015-02-24 20:59:04 +01:00
Jeija
03c00a831d Clean up trapdoors code and make them more flexible, so custom trapdoors
can be registered by other mods
2015-02-14 00:48:28 +01:00
PilzAdam
d1e715ebac Add tree growing functions to game_api.txt 2015-01-10 15:47:30 +01:00
PilzAdam
c654c9fd11 Remove weird constants in default 2015-01-10 15:47:30 +01:00
PilzAdam
ef0eb4d435 Move doc for dyes to game_api.txt 2014-12-06 20:54:53 +01:00
PilzAdam
9ec33f34f1 Set param2 to 1 if player places leaves 2014-12-06 20:36:20 +01:00
PilzAdam
2c2edfad04 Move leafdecay doc to game_api.txt 2014-12-06 20:36:20 +01:00
BlockMen
c95cd8414b Fix xpanes API 2014-09-16 17:11:54 +02:00
Jat
5dbc738dbd Add API doors : Sound for door open and close. 2014-08-07 12:42:37 +02:00
BlockMen
584718a2a7 Rename functions, update API 2014-07-06 10:54:47 +02:00
webdesigner97
7e5dc6c374 Add a minetest_game API documentation 2014-07-06 10:22:20 +02:00