Minetest logo

IRC log for #minetest-mods, 2014-09-27

| Channels | #minetest-mods index | Today | | Google Search | Plaintext

All times shown according to UTC.

Time Nick Message
00:45 phantombeta joined #minetest-mods
04:04 Miner_48er joined #minetest-mods
04:21 jin_xi joined #minetest-mods
05:22 psedlak joined #minetest-mods
10:29 Guest48959 joined #minetest-mods
10:52 rubenwardy joined #minetest-mods
12:07 GrimKriegor joined #minetest-mods
12:26 phantombeta joined #minetest-mods
12:43 phantombeta joined #minetest-mods
13:24 jin_xi joined #minetest-mods
13:27 Animetrom joined #minetest-mods
15:13 LazyJ joined #minetest-mods
15:18 Wuzzy joined #minetest-mods
16:53 jin_xi joined #minetest-mods
17:00 rubenwardy joined #minetest-mods
17:07 aldobr joined #minetest-mods
17:20 aldobr how to detect if a itemstack is a tool ?
17:20 Zefram_Fysh you can't
17:20 aldobr oh great
17:20 Zefram_Fysh there's no is-a-tool flag on registered items
17:21 aldobr how the game itself detects if you are yelding a tool ?
17:21 Zefram_Fysh it doesn't.  everything is potentially a tool
17:21 Zefram_Fysh the tool capabilities might be what you want
17:21 jin_xi McGuyver approves
17:21 aldobr how the game decides to apply wear to a item ?
17:21 Zefram_Fysh depends which aspect of toolness you're really interested in
17:22 aldobr if i dig with a meseblock the meseblock stack does not get a wear
17:22 aldobr wear
17:22 aldobr and ability to be stored a a stack or as a single entity
17:22 aldobr *as
17:22 Zefram_Fysh the engine has builtin logic for wearing something which is used for digging via tool capabilities.  non-digging tools have to implement their own wear logic
17:22 aldobr ok
17:22 aldobr how the engine detects when to apply wear then ?
17:23 aldobr i want to move itemstacks around
17:23 Zefram_Fysh when digging with a mese block, the mese block has no tool caps, so you actually dig with the empty hand instead.  the hand doesn't wear
17:23 aldobr hm
17:23 aldobr how to check the tool caps of a itemstack ?
17:24 Zefram_Fysh if you just want to move itemstacks around, you shouldn't need to know whether something is a tool
17:24 aldobr i need
17:24 aldobr becouse i have auto-stack logic
17:24 aldobr the mod reorganizes stacks to match the 99 limit
17:24 Zefram_Fysh ah, all you want to know there is the stack limit for the item type
17:24 Zefram_Fysh which *is* in the registration
17:25 aldobr so i can assume that max stack = 1 means tool ?
17:25 Zefram_Fysh and can be 1 for non-tool items, and can have values other than 1 and 99
17:25 Zefram_Fysh no, stack_max=1 only means stack_max=1
17:26 Zefram_Fysh stack:get_stack_max() tells you the stacking limit
17:26 aldobr does non tool nodes have wear ?
17:26 Zefram_Fysh they can, depending on how you define "tool"
17:27 aldobr should i carry non-tool stack wear and metadata around ?
17:27 aldobr default:mese
17:27 Zefram_Fysh you should preserve wear and metadata wherever they exist
17:27 aldobr its possible for they to not exist ?
17:28 Zefram_Fysh no wear is equivalent to wear=0, and there's similarly a null value for metadata
17:28 aldobr ok
17:28 aldobr thanks
17:28 aldobr very helpfull
17:29 Zefram_Fysh see for example the chest sorting logic in technic (technic/technic_chests/register.lua function sort_inventory()) for this kind of stack manipulation
17:34 rubenwardy aldobr - do minetest.registered_items[name].type == "tool"
17:35 rubenwardy assuming tools are registered like minetest.register_tool
17:36 rubenwardy yeah
17:36 Zefram_Fysh having been registered through register_tool() is probably the least useful sense of "is a tool"
17:37 rubenwardy Zefram_Fysh is incorrect. Nontool items can act like tools, such as food items which do stuff on left click, but aren't tools.
17:41 rubenwardy Do      minetest.registered_items[name].type == "tool" or minetest.registered_items[name].tool_capabilities
17:41 Animetrom joined #minetest-mods
17:41 Zefram_Fysh er, I said above that everything can be used as a tool
17:46 jin_xi_ joined #minetest-mods
17:46 DuDraig joined #minetest-mods
17:57 Animetrom1 joined #minetest-mods
17:59 aldobr tool_capabilities upon a non-tool will return the characteristics of a hand
17:59 aldobr the best way possible
17:59 aldobr would be to discover how the engine decides to grab hand characteristics upon tool_capabilites call
17:59 aldobr that would clearly show when a item can have wear like all tools or not like all nodes/craft items
18:00 aldobr food cannot have wear
18:00 aldobr can be used "tool like", but cannot have a wear bar
18:00 aldobr i need this to store and transport inventories around
18:00 aldobr a tool cannot be stacked becouse you wouldnot know the tool wear from the stack
18:00 Zefram_Fysh food *could* be implemented to use a wear bar.  presumably representing multiple portions
18:00 aldobr thats the whole point
18:00 aldobr but its not usually
18:00 aldobr i dont care about corner cases
18:01 aldobr but the usual game mechanics
18:01 aldobr you can stack food, so it cant have a wear bar
18:01 aldobr the whole point is centered around this : cannot be stacked because has a wear bar
18:01 aldobr if i stack, i lose wear info
18:01 Zefram_Fysh wear bars can be used fairly arbitrarily.  many technic `tools' don't suffer mechanical wear but use a wear bar to represent electrical charge
18:02 aldobr doesnt matter
18:02 aldobr its a info
18:02 aldobr that should not be lost, and would be lost if the item is stored as a stack
18:02 Zefram_Fysh it's not inherently impossible to have a multi-item stack with a wear bar.  it's just that there's one wear bar for the stack, not one per item
18:03 aldobr so its inherently impossible (at least until someone changes the code)
18:03 aldobr if i cannot diff between item wears inside a stack, that info is impossible to be stored
18:03 Zefram_Fysh in practice, everything I know of that uses a wear bar declares stack_max=1, thus avoiding this issue
18:03 aldobr thats the whole point
18:03 aldobr can i safely assume that stack_max = 1 means item with wear ?
18:03 Zefram_Fysh likewise, everything that uses metadata also has stack_max=1
18:04 Zefram_Fysh no, you can't assume that
18:04 aldobr separate register_tool and register_item would make things easier
18:04 Zefram_Fysh stack_max=1 only means stack_max=1.  it doesn't tell you why the item isn't stackable
18:04 aldobr or a istool field on item registration
18:04 aldobr or haswear
18:05 aldobr i dont care about metadata
18:05 aldobr becouse when you dig an empty locked chest, metadata is lost anyway
18:05 rubenwardy bread in has a stack_max of 1
18:05 aldobr so it is usually stored without metadata
18:05 rubenwardy At least it did when it was an external mod
18:05 Zefram_Fysh bucket:bucket_empty is an example of an item type that doesn't use wear or metadata but has stack_max=1
18:05 aldobr nope, on linuxgaming bread is stackable
18:05 aldobr Zefram_Fysh: i can handle THAT specific corner case
18:06 aldobr becouse a bucket can have water (and become a bucket_with_water instead of a bucket)
18:06 aldobr i can stack empty buckets and dont stack filled buckets (water or lava)
18:06 aldobr well
18:06 Zefram_Fysh filled buckets also qualify.  no wear or metadata, but stack_max=1
18:06 aldobr i will do the following
18:07 aldobr use stack_max and split items based on that
18:07 aldobr while storing full info for every stack
18:07 aldobr metadata plus wear
18:07 aldobr so if stack_max says 8
18:07 aldobr i create stacks of 8 items and so on
18:07 aldobr whatever value is stored there
18:08 aldobr where does item definition gets stored ?
18:08 Zefram_Fysh right
18:09 Zefram_Fysh stack:get_definition() is the easy way to get at the definition
18:09 aldobr ok
18:09 aldobr thanks
18:10 Zefram_Fysh and stack:get_stack_max() is easier than stack:get_definition().stack_max if that's all you want from the definition
19:13 Nitori joined #minetest-mods
19:21 Animetrom joined #minetest-mods
19:21 Animetrom left #minetest-mods
19:24 Animetrom joined #minetest-mods
19:25 Animetrom left #minetest-mods
19:31 Animetrom joined #minetest-mods
19:32 Animetrom left #minetest-mods
19:52 LazyJ joined #minetest-mods
20:24 phantombeta joined #minetest-mods
20:55 Miner_48er joined #minetest-mods
21:25 Wuzzy2 joined #minetest-mods

| Channels | #minetest-mods index | Today | | Google Search | Plaintext