Commit Graph

23 Commits

Author SHA1 Message Date
Paul Ouellette
27ce6d0ecc Clean up craft replacements docs 2019-12-07 23:46:24 +01:00
Paul Ouellette
120155f312 Fix some issues with minetest.clear_craft (#8712)
* Fix some issues with minetest.clear_craft

- Fix memory leak
- Fix crafts with an output count not being cleared when clearing by
  input.
- Fix recipe list being reversed when clearing by input.

* Add CraftInput::empty()
2019-08-10 23:28:00 +02:00
Paul Ouellette
fe6c666da2 Prefix RecipePriority elements with PRIORITY_ 2019-07-27 14:42:41 +02:00
Paul Ouellette
395b1b3346 Initialize priority in CraftDefinition constructors
The priority is used by getCraftResult, which may be used before
initHash is called.
2019-07-27 14:42:41 +02:00
HybridDog
12e3d3d12f Prioritise craft recipes
When multiple recipes are applicable, the recipes are prioritised in this order:
toolrepair < shapeless with groups < shapeless < shaped with groups < shaped
For cooking and fuel, items are prioritised over item groups
2019-05-20 20:59:51 +02:00
HybridDog
1604b949fd Test crafting hash type only once for a recipe 2019-05-20 20:59:36 +02:00
Loïc Blot
13e995b811 Modernize src/c* src/d* and src/e* files (#6263)
* Modernize src/c* src/d* and src/e* files

* default operator
* redundant init
* delete default constructors on CraftDefinition childs (never used)
* fix some missing init values
* const ref fix reported by clang-tidy
* ranged-based for loops
* simple conditions & returns
* empty stl function instead of size
* emplace_back stl function instead of push_back + construct temp obj
* auto for some iterators
* code style fixes
* c++ stl headers instead of C stl headers (stdio.h -> cstdio)
2017-08-17 23:02:50 +02:00
Loïc Blot
921151d97a C++ modernize: Pragma once (#6264)
* Migrate cpp headers to pragma once
2017-08-17 22:19:39 +02:00
Loïc Blot
76be103a91 C++11 patchset 9: move hardcoded init parameters to class definitions (part 1) (#5984)
* C++11 patchset 9: move hardcoded init parameters to class definitions

C++11 introduced the possibility to define the default values directly in class definitions, do it on current code

Also remove some unused attributes

* CollisionInfo::bouncy
* collisionMoveResult::collides_xy
* collisionMoveResult::standing_on_unloaded
* Clouds::speed

* More constructor cleanups + some variables removal

* remove only write guiFormSpecMenu::m_old_tooltip
* move header included inside defintions in genericobject.h
* remove some unused since years exception classes
* remove unused & empty debug_stacks_init
* remove unused & empty content_nodemeta_serialize_legacy
* remove forgotten useless bool (bouncy) in collision.cpp code
2017-06-16 11:25:52 +02:00
Loïc Blot
f3fe62a0bf Fix various copy instead of const ref reported by cppcheck (#5615)
* Also remove InventoryList::peekItem unused function
* Fix some post increment to preincrement reported by cppcheck
2017-04-19 23:02:07 +02:00
Foghrye4
281e9f39fd Adding minetest.clear_craft
Modifications by est31: grammar fixes in doc + error messages and
a little style fix, no functional change.
2016-07-05 21:40:13 +02:00
TeTpaAka
17ba584fe2 Fix bug when craft input isn't replaced 2015-06-22 19:30:35 +02:00
est31
27e3a353d8 Remove craftdef serialisation
It isn't needed anymore, sending ICraftDefManager over the network has been obsoleted
by protocol version 7.
2015-04-26 21:30:52 +02:00
est31
334e70455b Crafting speedup
This greatly increases crafting performance, especially in worlds with many mods.

Approved by @kwolekr.

Introduces a hash-type-layered fall-through mechanism, where every layer specifies one hash algorithm,
and the "deeper the fall", the more collisions to expect for the algorithm. One Craft definition
only resides at one layer, which improves speed for lower layers (and a complete fail), due to most
craft definitions residing at high layers.

Due to the fall-through design, the undocumented behaviour that later craft recipes
override older ones had to be weaked up a bit, but craft recipes with the same hash and layer
will still override.
2015-04-05 09:25:46 +02:00
gregorycu
03e0dd33a8 Optimize minetest.get_(all)_craft_recipe(s)
Signed off by: ShadowNinja, kwolekr
2015-03-20 21:41:18 -04:00
RealBadAngel
5af8acfa6e Added method to get all registered recipes for item(node) 2013-03-05 23:32:33 -05:00
Sfan5
6d0ea26c2d Update Copyright Years 2013-02-24 20:15:24 +01:00
PilzAdam
497ff1ecd6 Change Minetest-c55 to Minetest 2013-02-24 18:49:03 +01:00
darkrose
38580fbee7 Add minetest.get_craft_recipe() 2012-07-21 02:33:22 +03:00
Kahrl
e070f1e525 Allow replacements in cooking and fuel recipes 2012-06-06 00:22:34 +03:00
Perttu Ahola
037b259197 Switch the license to be LGPLv2/later, with small parts still remaining as GPLv2/later, by agreement of major contributors 2012-06-05 18:54:07 +03:00
Kahrl
6a76c226e1 The huge item definition and item namespace unification patch (itemdef), see http://c55.me/minetest/wiki/doku.php?id=changes:itemdef 2012-01-12 06:10:39 +01:00
Perttu Ahola
9d5b458479 Crafting definition in scripts 2011-11-29 19:13:48 +02:00