Jump to content
  • 1

Crafting Timer Question



I'm trying to add requirements to crafts, which went successful.



I can check if crafts met the requirements in Intersect.Server\Entities\Player.cs with Conditions.MeetsConditionLists()


While the check happens, and the craft won't happen, I still get the crafting bar to start (as seen in the video below)



As far as I understand, the crafting timer starts in Intersect.Client\Intersect.Client\Interface\Game\Crafting\CraftingWindow.cs in

void craft_Clicked(Base sender, ClickedEventArgs arguments)
            //This shouldn't be client side :(

I can't get an idea on how to do do a condition check here, or another way to not trigger the craft timer, so any help or pointing me in a good direction would be appreciated :769_heart:

Link to comment
Share on other sites

5 answers to this question

Recommended Posts

  • 1

The logic as it stands is pretty bad:

  1. Client checks if the craft can happen.
  2. Client tells the server it's crafting and starts the bar motion.
  3. Server receives the crafting  starts a timer.
  4. Once the timer is up the server checks if the craft can happen and then actually does the item changes.


In the base engine we need to change it so the logic happens as follows:

  1. Client tells server it want's to craft an item
  2. Server does the requirement checks and if it succeeds it sends a packet which triggers the bar to start moving
    1. If the requirements are not met server side a message should be send in the chatbox telling the client that they have inadquate resources
  3. Afterwards everything stays the same, the server monitors the timer and eventually crafts the item like normal.

In that second scenario there are bonus points if (in the base engine) the craft button is disabled if they don't have the resources.



All of that needs to be fixed in the base engine via a PR or by us devs at some point and then afterwards you can hook your requirement checks into the ingredient checks on the server side which would then control whether or not the crafting bar ever starts moving.

Link to comment
Share on other sites

  • Create New...