Don't Starve
Sort Inventory
Brody  [dezvoltator] 18 apr. 2014 la 0:01
Suggestions for future updates
If you have any suggestions for new sorting methods, ways to implement chest sorting, or anything you'd like me to add please leave it here and I'll take a look at it!
< >
Se afișează 1-15 din 28 comentarii
Hello Brody, thank you for this mod it's fantastic.

I don't know if this is possible, but it would be very practical if the sort keys were rebindable. Could it maybe be includied in the 'Controls' menu? On my keyboard, the 'Z' key is in another position. Although for now I have a workaround going, making it rebindable would get rid of the hassle.

I've also tried Don't Starve with a gamepad recently and your mod would really work wonders with that control method. If the sorting key can't made rebindable, you could include the left stick button (for instance on a 360 pad) as an alternative key, since it's currently not used by the standard control scheme.
Brody  [dezvoltator] 1 mai 2014 la 8:00 
Thanks for the suggestions. I've been looking into adding the keybind into controls or something for a while now but I haven't been able to figure it out. If you know of any other mods that do it let me know. I should be able to add the left thumb stick keybind fairly easily though so I'll try to get that out sometime next week.
Can you add different keybinds for backpack and inventory? It's fine, but I was annoyed when my backpack which was for storing torches got sorted and moved the torches into my inventory.
Brody  [dezvoltator] 10 mai 2014 la 23:25 
@Urist For now I'm going to set it to toggle sorting the backpack when you press 'p'. It should print what it'll sort in the console if you press ctrl+L. Check again in an hour or so for the update unless I run into a bug.
i dont know how others, but i prefer to keep food and healing things it first slots
so there a changes i made in local copy :

function sort_inv :
.... if item then local ft = nil if item.components.edible then ft = item.components.edible.foodtype end .... -- foods elseif (ft and not (ft == "ELEMENTAL" or ft == "WOOD" or ft == "RAW")) then -- includes anything you can eat, sorted by hungervalue if (#foods == 0) then foods[1] = item else -- big loop to insert the new food local new_food_index = 1 local gone = false for n = 1, #foods do f = foods[n] if f["components"]["edible"]["hungervalue"] >= item["components"]["edible"]["hungervalue"] then new_food_index = new_food_index+1 if f.prefab == item.prefab then gone = combine_stacks(f, item) end end end if not gone then table.insert(foods, new_food_index, item) end end --heals elseif item.components.healer then if (#heals == 0) then heals = {item} else -- big loop to insert the new heals local new_heal_index = 1 local gone = false for n = 1, #heals do f = heals[n] if f.components.healer.health >= item.components.healer.health then new_heal_index = new_heal_index+1 if f.prefab == item.prefab then gone = combine_stacks(f, item) end end end if not gone then table.insert(heals, new_heal_index, item) end end -- others else

Editat ultima dată de Rincewind; 17 mai 2014 la 16:39
and then i changed my favorite method 2:
-- Method 2: Stick others at end, starting in the pack if present if method == 2 then if foods then for h, a in pairs(foods) do player.components.inventory:GiveItem(a, index, nil) index = index+1 end end if heals then for h, a in pairs(heals) do player.components.inventory:GiveItem(a, index, nil) index = index+1 end end if others then others = reverse_table(others) -- reverse the table for h, b in pairs(others) do place_item_at_end(b) index = index+1 end end if weapons then for h, x in pairs(weapons) do player.components.inventory:GiveItem(x, index, nil) index = index+1 end end if equips then for h, z in pairs(equips) do player.components.inventory:GiveItem(z, index, nil) index = index+1 end end if tools then for h, y in pairs(tools) do player.components.inventory:GiveItem(y, index, nil) index = index+1 end end

btw there no point to make global variables in mod, its not PHP or whatever :)
local sort_backpack = true local sort_method = 2 local lowest_sort_index = 1 local open_chest = nil
in modmain.lua works fine too, same with your functions.

and you dont need to copy open_chest value, even if its global variable its just reference(pointer) to chest component and you doesnt change it inside "quick_stack*" functions
Brody  [dezvoltator] 17 mai 2014 la 19:36 
Thanks for the tips. This mod has been my first time working with both lua and Don't Starve mods so I'm still pretty inexperienced.
Rebindable key would be great, as this mod does not work with an AZERTY-keyboard (the Z-key is used for moving up).
oh no 29 iul. 2014 la 12:28 
Great mod! I dont think you have to change anything its realy great
Brody  [dezvoltator] 29 iul. 2014 la 13:44 
@Tristan I've looked into that quite a bit. Unfortunately it seems no one has been able to do it properly with a mod using the controls screen so I've been stuck. You can go into the code and switch it manually if you need to though.
That would work! What do I have to change exactly in the code?
Brody  [dezvoltator] 30 iul. 2014 la 12:23 
Go to line 541ish in modmain and change the Z in GLOBAL.TheInput:AddKeyDownHandler(GLOBAL.KEY_Z, function()
to whatever key you want. You might want to change the name of the mod folder afterwards to prevent Don't Starve from fixing it back once you're done.
I noticed there seems to be a problem for some people with unintentional sort spam. Since sorting dozens of time per second is quite useless and there is a risk of causing problems (the very least of which is cpu load), I'd recommend changing the key handler to `KeyUp` like so:
GLOBAL.TheInput:AddKeyUpHandler(GLOBAL.KEY_Z, function()
I tried it and it works - this way, sorting is triggered on each keypress, rather than as long as the player holds the key down (which is not the intended behavior). Might want to do this for all key handlers of this kind. Of course (i don't know the don't starve api) it would be ideal if there's a handler for a complete keypress or even better some handling for spam prevention (which would be more complicated but would provide the functionality of action on keydown without spam, like trigger on keydown once and reset the handler on keyup).

Not blaming you for this, the api doesn't seem to be documented and most mods use KeyDown anyway (which is wasteful unless you actually _do_ want to have something happen while keeping the key pressed). Great mod btw, extremely useful - was talking about this kind of functionality with my brother like an hour ago, glad to see someone implemented this already :)
Editat ultima dată de mechalynx; 31 iul. 2014 la 15:10
Cheggf 16 aug. 2014 la 4:29 
I love this mod very much because of how bad the inventory gets quickly. However, I have some suggestions on how to make this my favourite mod.
You currently have an option to not sort the first two slots. Why? Why not around 8? Axe, hammer, pitchfork, shovel, pickaxe, torch, weapon, maybe some more? You could have an option to customize it like some mods have here.
http://puu.sh/aUNp8/00ba3778a9.jpg
I would also like some options for sorting into segments, maybe also customizable on that page. Like food goes in backpack, items go from left to right or right to left starting in location of bar, stuff that would be nice. And sorting combustible items next to eachother, maybe? And I'm not sure how well your coding capabilities are, or how customizable this game is, but sorting food by spoil date, or x value such as hunger, or overall value (higher total number of stats given), or all of them would be excellent.
http://puu.sh/aUNnP/ee8055b3fb.jpg
Another great feature, however I doubt this one is feasable, is auto sorting. Something like a check every x ticks or a check on item pickup to sort the inventory? I'm not sure, and it would probably come with a hassle of flaws.

Also pig skin is counted as food. Edit: Gears too.

Edit: Forgot to also mention a 'useless' type of tag for items you can't actively use, like trinkets and things, and apparel being seperate.

Edit: Keep forgetting things. Stuff like placables (Spider dens, pinecones, etc.) would also be a nice sort criteria. And maybe further support for the RPG HUD mods? Such as tools going from bottom row left to right, placables bottom row right to left, food top row right to left, items top row left to right, and 'useless' items middle try to stay near the middle of the rows. Stuff like that would be amazingly cool. And giving certain item types certain slots, like tools and clothing go in certain spots.


Locking certain spots of your inventory through ctrl+alt clicking it or something would be an easy way to do a lot of the aforementioned recommendations, as well as being a great feature in of it's own.
Editat ultima dată de Cheggf; 16 aug. 2014 la 11:43
< >
Se afișează 1-15 din 28 comentarii
Per pagină: 1530 50