Hey everyone, I decided to give our saturation system a little rewrite to make it a bit more challenging.
First of all, the old system:
Until now each working citizens had his saturation reduced when the night arrived by a fixed amount depending on his worker hut level.
While this is a decent way, it is neither very realistic nor very practical.
And at the same time, it leads to an overflow of food at highly active colonies.
The new System:
Now workers lose saturation during the days depending on the executed actions and walked blocks.
For that reason, we needed to implement two things.
- A way to detect actions done and decrease saturation
- A way to detect blocks walked and decrease saturation.
I solved the first step quite smoothly.
Since we were already using a variable to take track of what the workers do to send him to dumb his inventory I simply reused most of that code.
So I renamed that method to signalize what it actually does.
And only changed it back to the old method at the places I really don't to decrease the saturation as fast, as for example, each block mined.
And then I added the decrease saturation call to it.
Then inside the entity class, I created a utility method to get the complexity of the building the worker works at to calculate a nice value he should decrease his saturation by.
And then I just decrease it and mark the worker dirty to be updated on the client side for it.
For the second point, there is a nice vanilla value called distanceWalkedModified with which vanilla Minecraft already takes track of their entities.
Therefore, I decrease the saturation each offset with the modulo.
Short remark, I made +1 to avoid that the saturation gets hammered while the citizen doesn't move.
On the way, I also already fixed some small code style issues and similar.
Like avoiding magic numbers.
Or documenting a bunch of important attributes.
Besides that I fixed some other issues:
Fixed herders not getting any experience.
Then I fixed herders causing too much lag because they always check all their inventories by adding a delay.
I also fixed the new scan command to scan certain areas by command.
First of all, I added the player name as an optional argument.
Then I adapted the command structure to ignore old command input by removing the old dependencies.
After that, I started parsing the player argument correctly.
Basically:
If the command gets an argument, then save it at the player of the argument, if there is none, then save it at the sender, if the sender is no player then return a failure message.
Finally, after that has been done I had to fix a bunch of unit tests to make them compatible with the new Input.
I hope you liked the new changes, we're slowly progressing to our goal, moving away from performance issues and bringing new content and balance at the same time.
Did you know you can sell your vote to Minnowbooster?
You don't even need high voting power to get it sold and you will get out >85% of the profits!
If you register via my link you will get a tip of 0.5% on each of your sold >votes and BuildTeam puts another 1.5% on top of it for me!
https://www.minnowbooster.com/referral/49434
Posted on Utopian.io - Rewarding Open Source Contributors
Wow!It's an amazing programming.If you provide your codes with a link, It will help us better than this.By the way, thanks for your share.
if you click on the Utopian.io link this will get you to more details =)
Okay.Thank you.I'll see it on the Utopian.io.
You did a good programming upgrade :)
Hello, I am new to this community, I will be following your publications, I invite you to go through my account.
Thank you for the contribution. It has been approved.
You can contact us on Discord.
[utopian-moderator]
Hey @raycoms I am @utopian-io. I have just upvoted you!
Achievements
Community-Driven Witness!
I am the first and only Steem Community-Driven Witness. Participate on Discord. Lets GROW TOGETHER!
Up-vote this comment to grow my power and help Open Source contributions like this one. Want to chat? Join me on Discord https://discord.gg/Pc8HG9x