Commit Graph

101 Commits

Author SHA1 Message Date
SmallJoker f2fd443262
Inventory: Make addList() consistent (#11382)
Fixes list clearing for inv:set_list() using same size, since 2db6b07.
addList() now clears the list in all cases. Use setSize() to resize without clearing.
2021-06-30 20:39:38 +02:00
SmallJoker 2db6b07de1
Inventory: show error on invalid list names (#11368) 2021-06-20 17:21:50 +02:00
DS f3ae45b2b2
Add a short_description to be used by mods (#8980) 2020-10-09 19:11:21 +01:00
Paul Ouellette b16f841756
LuaItemStack: Add __tostring metamethod (#8785)
* LuaItemStack: Add __tostring metamethod

* Clean up LuaItemStack::checkobject
2020-06-09 19:37:25 +02:00
SmallJoker 94a5df795c
Inventory: Properly revert client predictions (#8945)
Caused by incremental inventory sending
Previously everything was overwritten by serializing the entire inventory
2019-09-18 18:47:09 +02:00
SmallJoker 0b4f424f41
Inventory: Send dirty lists where appropriate (#8742)
This change reduces the amount of sent data towards clients. Inventory lists that are already known to the player are skipped, saving quite some data over time.

Raises protocol version to 38 to ensure correct backwards-compatible code.
2019-08-24 19:07:38 +02:00
Paul Ouellette 008b80fe1c Add ItemStack:get_description() to get tooltip (#8847) 2019-08-24 18:38:02 +02:00
ANAND ︻气デ═一 8e3b63bd28 Define operators == and != for ItemStack 2019-05-11 18:48:27 +02:00
raymoo a637107a4e Allow overriding tool capabilities through itemstack metadata
This makes it possible to modify the tool capabilities of individual
itemstacks by calling a method on itemstack metadata references.
2017-10-29 11:57:38 +00:00
Loïc Blot ae9b5e0098 Modernize code: very last fixes (#6290)
Last modernization fixes
2017-08-20 19:37:29 +02:00
Loïc Blot fd3afbced5 Optimize headers (part 2) (#6272)
* Optimize headers (part 2)

* less debug.h in headers
* less remoteplayer.h for everybody

* Cleanup (part 2)

* camera.h: mesh.h
* mapgen.h: mapnode.h
* serverenvironment.h: mapblock.h
* nodedef.h: shader.h
2017-08-18 19:25:07 +02:00
Loic Blot 1d086aee7c
Modernize various files (part 2)
* range-based for loops
* emplace_back instead of push_back
* code style
* C++ headers instead of C headers
* Default operators
* empty stl function
2017-08-18 08:07:59 +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
SmallJoker c08cc0533f Inventory: Fix wrong stack size behaviour and item loss (#6039)
Also fix itemFits and remove constness-nonsense
2017-06-25 11:39:39 +02:00
Dániel Juhász 0fcaf9fb1b Automatic item and node colorization (#5640)
* Automatic item and node colorization

Now nodes with a palette yield colored item stacks, and colored items
place colored nodes by default. The client predicts the colorization.

* Backwards compatibility

* Use nil

* Style fixes

* Fix code style

* Document changes
2017-06-20 11:19:56 +02:00
Loïc Blot 8f7785771b Cpp11 initializers 2 (#5999)
* C++11 patchset 10: continue cleanup on constructors

* Drop obsolete bool MainMenuData::enable_public (setting is called with cURL in server loop)

* More classes cleanup

* More classes cleanup + change NULL tests to boolean tests
2017-06-17 19:11:28 +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
rubenwardy f2aa2c6a98 Add ItemStack key-value meta storage 2017-02-04 22:07:55 +00:00
SmallJoker 2de8c22a99 Make getStackMax return the correct maximal stack size 2016-09-08 03:37:03 -04:00
est31 1fadf7f21e Fix inventory replace bug 2015-08-19 03:42:00 +02:00
est31 2c1fd29884 Add MoveSomewhere inventory action
Improve shift+click experience
2015-06-23 20:18:41 +02:00
Craig Robbins ced6d20295 For usages of assert() that are meant to persist in Release builds (when NDEBUG is defined), replace those usages with persistent alternatives 2015-03-07 22:41:47 +10:00
ShadowNinja b1965ac209 Clean up rollback 2014-11-19 16:21:59 -05:00
ShadowNinja e9c9b66ae9 Make players check inventory modification properly 2014-10-01 18:44:36 -04:00
Kahrl 51e6feb17c Add operator!= to Inventory(List), make operator== a const method 2014-01-11 19:46:37 +01:00
Kahrl 4e1f50035e Omnicleanup: header cleanup, add ModApiUtil shared between game and mainmenu 2013-08-14 21:03:33 +02:00
PilzAdam 280946ba83 Dont write player files all the time 2013-06-28 14:15:48 +00: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
Ilya Zhuravlev 6a16075912 Add InventoryList width property & allow custom crafting grids. 2012-09-01 10:01:41 +03:00
Perttu Ahola 9f031a6759 Optimize headers 2012-06-17 04:03:39 +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
Perttu Ahola 81c5e5200b Fix loading of legacy chests 2012-06-03 22:31:01 +03:00
Perttu Ahola 3899f83da8 NodeMetaRef:{to,from}_table and lua_api.txt additions 2012-06-03 22:31:01 +03:00
Kahrl f8c3743991 added PlayerSAO and RemotePlayer, removed ServerRemotePlayer 2012-03-29 14:05:45 +03:00
Perttu Ahola 562ac3bce9 Digging time groups WIP 2012-03-10 11:28:12 +02:00
Kahrl b4dd5d3bd7 Client-side prediction of inventory changes, and some inventory menu fixes 2012-01-22 17:31:20 +02: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 103173fc9b Add InvRef and InvStack (currently untested and unusable) 2012-01-02 01:49:38 +02:00
Giuseppe Bilotta 135a65e200 Add virtual destructors to abstract classes
IRespawnInitiator and InventoryActions are abstract classes, but they
were missing a virtual destructor. Define it, even if it does nothing
and its absence most likely makes no difference other tha causing
warnings during compile.
2011-12-28 20:50:21 +02:00
Perttu Ahola 6145a135bd Make ToolItem and MaterialItem to convert names by aliases at creation time too (necessary for eg. crafting) 2011-12-04 02:12:45 +02:00
Perttu Ahola 4ad8891e05 Convert CraftItems directly to the name pointed by alias; necessary due to lua definition table 2011-12-04 01:16:22 +02:00
Perttu Ahola e494b5d422 Show infotext for unknown items placed on ground 2011-12-03 13:46:19 +02:00
Perttu Ahola 69bc9224db Rename "NodeItem"/"ToolItem"/"CraftItem" to "node"/"tool"/"craft" 2011-12-02 12:12:07 +02:00
Giuseppe Bilotta 96c30452f9 Fix structs being declared as classes
Some compilers complain when a class is declared as a struct or vice
versa. Fix by making sure that the correct tag is used both in
declaration and definition.
2011-12-01 10:39:47 +02:00
Perttu Ahola d8d6d0dc95 Do not assert if count becomes larger than getStackMax() in InventoryItem::add(); it is nicer for scripting and overall hacking this way, because rising it higher than the limit is does not break anything. It should be, and is, enforced elsewhere where appropriate. 2011-12-01 00:07:21 +02:00
Kahrl d6b30dd3a5 CraftItem rework and Lua interface 2011-11-29 19:13:58 +02:00
Perttu Ahola e880cc40e9 Fix stuff in inventory.{cpp,h} 2011-11-29 19:13:57 +02:00
Kahrl f42c57d9a8 Add IDropAction and related stuff 2011-11-29 19:13:54 +02:00
Perttu Ahola 9d5b458479 Crafting definition in scripts 2011-11-29 19:13:48 +02:00