summaryrefslogtreecommitdiff
path: root/src/inventory.h
Commit message (Expand)AuthorAge
* Inventory: Properly revert client predictions (#8945)SmallJoker2019-09-18
* Inventory: Send dirty lists where appropriate (#8742)SmallJoker2019-08-24
* Add ItemStack:get_description() to get tooltip (#8847)Paul Ouellette2019-08-24
* Define operators == and != for ItemStackANAND ︻气デ═一2019-05-11
* Allow overriding tool capabilities through itemstack metadataraymoo2017-10-29
* Modernize code: very last fixes (#6290)Loïc Blot2017-08-20
* Optimize headers (part 2) (#6272)Loïc Blot2017-08-18
* Modernize various files (part 2)Loic Blot2017-08-18
* C++ modernize: Pragma once (#6264)Loïc Blot2017-08-17
* Inventory: Fix wrong stack size behaviour and item loss (#6039)SmallJoker2017-06-25
* Automatic item and node colorization (#5640)Dániel Juhász2017-06-20
* Cpp11 initializers 2 (#5999)Loïc Blot2017-06-17
* Fix various copy instead of const ref reported by cppcheck (#5615)Loïc Blot2017-04-19
* Add ItemStack key-value meta storagerubenwardy2017-02-04
* Make getStackMax return the correct maximal stack sizeSmallJoker2016-09-08
* Fix inventory replace bugest312015-08-19
* Add MoveSomewhere inventory actionest312015-06-23
* For usages of assert() that are meant to persist in Release builds (when NDEB...Craig Robbins2015-03-07
* Clean up rollbackShadowNinja2014-11-19
* Make players check inventory modification properlyShadowNinja2014-10-01
* Add operator!= to Inventory(List), make operator== a const methodKahrl2014-01-11
* Omnicleanup: header cleanup, add ModApiUtil shared between game and mainmenuKahrl2013-08-14
* Dont write player files all the timePilzAdam2013-06-28
* Update Copyright YearsSfan52013-02-24
* Change Minetest-c55 to MinetestPilzAdam2013-02-24
* Add InventoryList width property & allow custom crafting grids.Ilya Zhuravlev2012-09-01
* Optimize headersPerttu Ahola2012-06-17
* Switch the license to be LGPLv2/later, with small parts still remaining as GP...Perttu Ahola2012-06-05
* Fix loading of legacy chestsPerttu Ahola2012-06-03
* NodeMetaRef:{to,from}_table and lua_api.txt additionsPerttu Ahola2012-06-03
* added PlayerSAO and RemotePlayer, removed ServerRemotePlayerKahrl2012-03-29
* Digging time groups WIPPerttu Ahola2012-03-10
* Client-side prediction of inventory changes, and some inventory menu fixesKahrl2012-01-22
* The huge item definition and item namespace unification patch (itemdef), see ...Kahrl2012-01-12
* Add InvRef and InvStack (currently untested and unusable)Perttu Ahola2012-01-02
* Add virtual destructors to abstract classesGiuseppe Bilotta2011-12-28
* Make ToolItem and MaterialItem to convert names by aliases at creation time t...Perttu Ahola2011-12-04
* Convert CraftItems directly to the name pointed by alias; necessary due to lu...Perttu Ahola2011-12-04
* Show infotext for unknown items placed on groundPerttu Ahola2011-12-03
* Rename "NodeItem"/"ToolItem"/"CraftItem" to "node"/"tool"/"craft"Perttu Ahola2011-12-02
* Fix structs being declared as classesGiuseppe Bilotta2011-12-01
* Do not assert if count becomes larger than getStackMax() in InventoryItem::ad...Perttu Ahola2011-12-01
* CraftItem rework and Lua interfaceKahrl2011-11-29
* Fix stuff in inventory.{cpp,h}Perttu Ahola2011-11-29
* Add IDropAction and related stuffKahrl2011-11-29
* Crafting definition in scriptsPerttu Ahola2011-11-29
* Improve item serializationPerttu Ahola2011-11-29
* Clean InventoryItem interface a bitPerttu Ahola2011-11-29
* Improved MaterialItem (stores nodename)Perttu Ahola2011-11-29
* Remove burn time definitions from FurnaceNodeMetadataPerttu Ahola2011-11-29
ss="hl kwa">if not minetest.check_player_privs(player:get_player_name(), {atlatc=true}) then minetest.chat_send_player(player:get_player_name(), "Missing privilege: atlatc - Operation cancelled!") return end local meta=minetest.get_meta(pos) local ph=minetest.pos_to_string(pos) local nodetbl = ac.nodes[ph] or {} --if fields.quit then return end if fields.env then nodetbl.env=fields.env end if fields.code then nodetbl.code=fields.code end if fields.save then -- reset certain things nodetbl.err=nil if advtrains.lines and advtrains.lines.sched then -- discard all schedules for this node advtrains.lines.sched.discard_all(advtrains.encode_pos(pos)) end end if fields.cle then nodetbl.data={} end ac.nodes[ph]=nodetbl meta:set_string("formspec", ac.getform(pos, meta)) if nodetbl.env then meta:set_string("infotext", "LuaAutomation component, assigned to environment '"..nodetbl.env.."'") else meta:set_string("infotext", "LuaAutomation component, invalid enviroment set!") end end function ac.run_in_env(pos, evtdata, customfct_p) local ph=minetest.pos_to_string(pos) local nodetbl = ac.nodes[ph] if not nodetbl then atwarn("LuaAutomation component at",ph,": Data not in memory! Please visit component and click 'Save'!") return end local meta if advtrains.is_node_loaded(pos) then meta=minetest.get_meta(pos) end if not nodetbl.env or not atlatc.envs[nodetbl.env] then atwarn("LuaAutomation component at",ph,": Not an existing environment: "..(nodetbl.env or "<nil>")) return false end local env = atlatc.envs[nodetbl.env] if not nodetbl.code or nodetbl.code=="" then env:log("warning", "LuaAutomation component at",ph,": No code to run! (insert -- to suppress warning)") return false end local customfct=customfct_p or {} -- add interrupt function customfct.interrupt=function(t, imesg) assertt(t, "number") assert(t >= 0) atlatc.interrupt.add(t, pos, {type="int", int=true, message=imesg, msg=imesg}) --Compatiblity "message" field. end customfct.interrupt_safe=function(t, imesg) assertt(t, "number") assert(t >= 0) if atlatc.interrupt.has_at_pos(pos) then return false end atlatc.interrupt.add(t, pos, {type="int", int=true, message=imesg, msg=imesg}) --Compatiblity "message" field. return true end customfct.clear_interrupts=function() atlatc.interrupt.clear_ints_at_pos(pos) end -- add digiline_send function, if digiline is loaded if minetest.global_exists("digiline") then customfct.digiline_send=function(channel, msg) assertt(channel, "string") if advtrains.is_node_loaded(pos) then digiline:receptor_send(pos, digiline.rules.default, channel, msg) end end end -- add lines scheduler if enabled if advtrains.lines and advtrains.lines.sched then customfct.schedule = function(rwtime, msg) return advtrains.lines.sched.enqueue(rwtime, "atlatc_env", {pos=pos, msg=msg}, advtrains.encode_pos(pos), 1) end customfct.schedule_in = function(rwtime, msg) return advtrains.lines.sched.enqueue_in(rwtime, "atlatc_env", {pos=pos, msg=msg}, advtrains.encode_pos(pos), 1) end end local datain=nodetbl.data or {} local succ, dataout = env:execute_code(datain, nodetbl.code, evtdata, customfct) if succ then atlatc.active.nodes[ph].data=atlatc.remove_invalid_data(dataout) else atlatc.active.nodes[ph].err=dataout env:log("error", "LuaATC component at",ph,": LUA Error:",dataout) if meta then meta:set_string("infotext", "LuaATC component, ERROR:"..dataout) end --TODO temporary --if customfct.atc_id then -- advtrains.drb_dump(customfct.atc_id) -- error("Debug: LuaATC error hit!") --end end if meta then meta:set_string("formspec", ac.getform(pos, meta)) end end function ac.on_digiline_receive(pos, node, channel, msg) atlatc.interrupt.add(0, pos, {type="digiline", digiline=true, channel = channel, msg = msg}) end if advtrains.lines and advtrains.lines.sched then advtrains.lines.sched.register_callback("atlatc_env", function(data) -- This adds another interrupt to the atlatc queue... there might be a better way atlatc.interrupt.add(0, data.pos, {type="schedule",schedule=true, msg=data.msg}) end) end ac.trackdef_advtrains_defs = { on_train_enter = function(pos, train_id) --do async. Event is fired in train steps atlatc.interrupt.add(0, pos, {type="train", train=true, id=train_id}) end, } atlatc.active=ac