Server Suggestion Slight change to crafting system

Messages
695
Reaction score
1,455
Points
1,035
Location
Cockandballtorshire
Suggestion Title: Slight change to crafting system
Suggestion Description: As it stands, this is currently how crafting works.
If you have 300 materials on you, which is the current maximum number you can hold in your inventory at one time, and you go to craft something that requires a 25% pure metal the server will not allow you to craft that 25% metal because you already have the max number of crafting materials on you.
THIS MEANS THAT the server tries to add the 25% metal to your inventory before it removes the materials required to craft the metal from your inventory.

My suggestion is that this is reversed, that it removes the crafting materials before it gives you the items.

Why should this be added?:
- quality of life for crafters
- easier crafting in big bulk orders

What negatives could this have?:
- seems like it will be long and complicated to code, but I cant even code in scratch so who am I to know how hard it will be
- is it even worth it, I could just get over myself and adapt
 
Messages
206
Reaction score
96
Points
430
Location
Poland
In general, how it SHOULD work:
The database begins a transaction, a block of instructions, that if fails, reverts all changes to the state from before the transaction, but if it succeeds it commits(does) all the changes in the block of instructions at once.

1. the crafting process begins, nothing changes
2. the crafting hits 100% transaction begins
3a user has free space, transaction subtracts materials, adds item (transaction commits changes, everything, subtracting and adding materials is done at once)
3b user does not have space(an error occurs) - nothing happens (transaction rolls back the changes)
3c any other error occurs i.e. user disconnects, connection lost, server crached, script error - nothing happens(transaction rolls back the changes)

This is the only way to ensure that the communication part of the script and database works properly, and it does not risk any data loss(material loss) in terms of materials and crafted items.

As this is a DB operation(i suppose) subtracting materials before adding crafting results to inventory carries a great risk of something going wrong in the process, and bugs appearing.

I think that the correct implementation of crafting system is the REASON of what you described in the post.

I may be mistaken, because I have no idea how the crafting system actually works.
 
Top