52 an action is just some lua code that is made by the user and they can do all kinds of things like spawn new characters into the battle, add or remove modifiers, remove characters from battles, change locations of characters and maybe more I haven't thought of yet/forgot.
At the end of running an action I need to update the database to actually store these changes.
There are 2 ways to do this, the efficient one, being to first calculate the changes and update the database accordingly or the easy one which is to throw the old data away and start over.
For now, I am going for the easy route, and doing so in the easiest way. If it turns out to become a bottleneck I can always improve upon it.
Also, going with the remove everything and start over way could allow me to run the updates with just 2 calls to the database per character. (1 to remove and 1 to add everything back). Something that isn't easy to do when updating only the changes. (and yes, I said could as right now I use 1 database call for each modifier that needs to be added. Like I said, its a crude method right now)
And yes, I realize that I can add helper methods to the lua code that access the database so it gets updated while the lua code runs, but then you need to deal with people who think its fun to write code like
Code:
while true do
getAllCharactersInRP()
end
which does nothing more but bombard my database with requests, because people find doing that stuff fun......
Of course, I could make them more complicated so they don't directly make requests to the database unless it can't be avoided, but then I am back to the first problem.
TL,DR: Currently in the process to just make it work as it can always be improved later on if it ends up being needed.