Zombie's Coding Suggestions.

Discussion in 'Suggestions & Feedback' started by Zombie_Striker, Jul 25, 2016.

  1. Zombie_Striker

    Zombie_Striker Citizen

    Messages:
    41
    Likes Received:
    11
    The following are some suggestions for the way current features seem to be coded, and not any new features. I may be entirely off as to how these things are coded, and as such such solutions may be off as well.

    Directory:
    [P] = The problem
    [S.] = My solution for the problem.

    [#1] Multiple instance inventories.

    [P]
    For the metal mixer and the metal former, it seems that multiple inventories are created for every time a player clicks on the inventory and there is only one inventory that gets updated. If II let the iron pour into a mold, I will see the iron flow into each empty slot. However, if I exit and re-open the inventory, then the inventory will no longer update, showing me how the inventory should have looked at the time I opened it. This could be because there is no a single inventory that is stored, but instead that an inventory is created each time a player clicks on the metal former.
    [S.]

    If a player opens a metal former, save the instance of the inventory somewhere. If another player opens that same metal former's inventory, open that saved inventory instead of creating a new inventory. If you did this to make sure no other player can "tamper" with the mold, then create an "owner" for each mold. Once the owner exits the inventory, then you can change the owner for the inventory.


    [#2] Accepting ores for the metal mixer
    [P]
    When placing ores into the metal mixer, sometimes the ores are not added to the rest. This means that there can be two stacks of iron or gold in the same inventory, and that the ores are not accounted for and disappear if the player closes the inventory.
    [S.]
    If you implement suggestion #1, then there should only be one inventory to account for. In that case, you can just create a thread that will loop through all the active metal mixer inventories and add the itemstacks together after a certain amount of time. Even a task that checks every five seconds should be to make sure there will no longer be any glitched ores.

    [#3] Specific crafting recipes
    [P]
    Certain recipes require items to be in specific slots. To craft Simple Sticks, you need to have the split logs stack on top of each other at the top left corner of the crafting bench. Any other location will not work. There should be no reason that steak must be at the center bottom of the crafting bench in order for me to throw salt on it.
    [S.]
    It seems you use a basic system that checks if the items are in the correct spots relative to the crafting bench, and looping through all the contents fall in the right order. I would recommend building a new object that stores a center object, and store the items location relative to the center object's location. When a player tries to craft an object, you would loop through all the recipes and see if the contents of the crafting table contains the center item. After that, then you would also check if all the other items fall in the correct location relative to that center object. This will allow structured crafting recipes to exist, while also allowing the recipe to work for all slots.
     
  2. Zombie_Striker

    Zombie_Striker Citizen

    Messages:
    41
    Likes Received:
    11
  3. Nico

    Nico Known Citizen

    Messages:
    143
    Likes Received:
    40
    I have a feeling this is 10/10 useless now
     

Share This Page