Solved Item stacking

Discussion in 'Plugin Requests' started by Robo2929, Dec 11, 2015.

  1. would it be possible to do stacking plugin like from rust
     
  2. I made a stack plugin for my server but there are annoying limitations. First off, the 255 most items stack to is hardcoded. I didn't investigate if bypassing that hardcoded limit is possible.

    The other issue is that most item classes are internal and thus not usable within a plugin. I imagine there are ways using reflection to get around this but I haven't done enough of that to know for sure.

    I was able to stack owrongs and steaks because they happen to be in a public class (ConsumableItem) but arrows are in another class which I can't use in the plugin. Even the base class for items is internal so I can't use that either.

    Kinda limiting!

    Also, stacking owrongs and steaks had unintended side effects. Owrongs in a stack will mould 1 at a time, so you need to split the stack up to have the same conversion rate as before.. Also steaks seem to act the same, steaks go rancid one at a time so when you have a huge stack, instead of having steaks go bad after 20 mins, you only ever get 1 go bad every 20 min.
     
  3. They will stack as high as you want. It will count down to zero then go back to max stack of two hundred fifty five. You can also split the stack and get the max as well. Tried with building walls (stone, metal, and wood) When it went down it reset to max. I've only tested up to ~1200 and it was still going.

    Hope that helps!
     
  4. Let me see if I understood that... if you stack Owrongs you will just have 1 mouldy? or will just mould 1 at time?
    and steaks? will go bad 1 by 1 or all the stack in same time?
     
  5. In both cases only the item on top of the stack will go bad. Steaks go bad after 20 mins so if you have 3 unstacked steaks they go bad after 20 mins but if you have them stacked only one goes bad then another one after 40 and the last one after 60. It throws off the food survival balance.

    Owrongs its mostly annoying.. A stack of 255 takes forever to mould..
     
  6. Is possible to I get your plugin?
     
  7. Was actually more of a test than a full fledged plugin but here goes:

    Code:
    namespace Oxide.Plugins
    {
        class Stacks : HurtworldPlugin
        {
            private void OnServerInitialized()
            {
                GlobalItemManager itemmanager = Singleton<GlobalItemManager>.Instance;
                (itemmanager.GetItem(25) as ConsumableItem)?.StackSize(5); // fresh owrong
                (itemmanager.GetItem(4) as ConsumableItem)?.StackSize(5); // raw steak
                (itemmanager.GetItem(5) as ConsumableItem)?.StackSize(5); // cooked steak
            }       
        }
    }
    
     
  8. Just need to do a .cs with that?

    edit: worked thank you
     
    Last edited by a moderator: Jan 7, 2016
  9. For me if the plugin already help manage the other game items would be great
    rotting of oranges and easy the player can separate in slots
     
  10. How do i use that owrong plugin on my server?
     
  11. Just save the code to a .cs...
     
  12. Wulf

    Wulf Community Admin

    Why not submit a full plugin which includes a config? ;)
     
  13. That would be awesomeeeee
     
  14. Need some help to that
     
  15. I did that yesterday :p
     
  16. I'm done writing plugins for now... The community has what it takes to make it better if they want.
     
  17. Wulf

    Wulf Community Admin

    Today for me. :p
    [DOUBLEPOST=1453657302][/DOUBLEPOST]
    Burnt out?
     
  18. Yeah I guess. I don't like where Rust has been going... And Hurtworld shows promise but its still it its infancy. Taking a break from it all.