archfan7411 / clearplayers Goto Github PK
View Code? Open in Web Editor NEWPython script to clear unused Minetest players, reducing lag
License: GNU General Public License v3.0
Python script to clear unused Minetest players, reducing lag
License: GNU General Public License v3.0
First, I fell that it's more convenient opening another issue for that, since that editing the first would be confusing.
Not every player without certain items is just useless, MANY times this is because the player was clearing his inventory for doing something else(like selling cobble in my case) and couldn't continue in this day, this algorithm would destroy many players that are not inactive. I have a better sollution for the algorithm that would be easier too.
My solution involves a lua mod and the python program, a lua mod that checks if the player have been inactive and didn't do much progress(the mod I could do) and if the player is, it sets a player attribute like
inactive = "true"
that could be easily detected.
The "part two of the part two" is that read function does not take the line number to read as param, it takes how many bytes to read, so you could use readlines or something instead, that with my solution would be even easier
When run, the current script returns an error stating that it is trying to read an unopened file. This IS a known bug and the reason the script is unstable.
Error-causing syntax:
file = open(fullPath, "r")
where fullPath is the path of the player file, for instance
/home/user/.minetest/worlds/testworld/players/archfan
I'm relatively new to Python, and I need help debugging/fixing this.
This won't work by the reason that extended attributes are stored at the start of the file, increasing the number of lines making line 18 and 42 not where the inventory respectivily starts and ends. If you want to keep this current algorithm idea(the partial solution) you would have to check from line total_number_of_lines - 32 to total_number_of_lines and 32 could be the "line" var that decreases one each iteration
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.