Pullrequest for fix Halloween/Easter event overlappingSolved
When one of the 2 events fired while the other was still active, the first just gets canceled and the event item pickups would still linger around the world.
I fixed that by just checking if the other event was scheduled in the next 5 minutes, and if so set it to 5 minutes to make sure they don't overlap. Works, but it should probably just be scheduled around each other where one event can't get a scheduled event in the bounds +-5 min of the other one.

https://gitlab.com/Lightningblade/updates-for-umod-plugins/-/commit/fa8d24a2cc9641734860970079a6db87d1d73ce0
(This does mean that the min/max range might get exceeded (by max 5 minutes))
Server events can only be run in the events active period in game, so running two events like this will never work as expected. What is your experience running these outside their normal active period? Typically I found they resulted in failed or malfunctioning events. I will take a look at your code, but I always assumed the operator would be running only one, and only during their active time in game. So this use case is unexpected.
Not quite sure what you mean with active period, but you can reproduce the bug/undefined behaviour if you schedule the halloween and the easter event close to each other (1 minute should be sufficient), or just manually runevent (runevent egg, wait a bit, runevent halloween) those events right after each other. You will see the pickups from the first event will still be around, and the first event will not conclude with a winner. (Will not be deconstructed either).

I just fired up my test server to show, that the pickups even stay around after a long shutdown (restart) although to be fair, i spammed the event quite a lot. (And that's not the plugins responsibility)


P.S.: Now that I think about it, my code would not fix the same event overlapping with itself if the min(/max) bounds were shorter than the event itself.
You probably should not run events outside of their period as they can have bad side effects (at least in my testing). Are these events now working 100% correctly outside of their event dates? Normally it is up to the operator to schedule things to avoid overlaps that can cause issues. Trying to code around bad scheduling takes away agency from operators and responsibility. Unless you can show me multiple events work 100% normally outside their normal period I do not see this as something worth putting effort into.

If you mean with normal period the plugin-scheduled time; The reason why I made the patch IS because they were scheduled close to each other like 1 minute apart from each other or so.
The running event manually / out of the scheduled time was just to show what happens and to reproduce the bug easielly.

Also, you can't schedule around it, even if you schedule them to be in the time intervals of 2 prime numbers, x and y, it would still overlap at the (x*y)th time. And I think thats the best you can mathematically do / achive. (Even with random, there is the theorem: https://en.wikipedia.org/wiki/Infinite_monkey_theorem ). It is mathematically unavoidable that the events cut each other of at some point in time.

And I think they are working OK enough outside their event dates, IF they are not scheduled on top of each other.

Ofcourse the bug is in Rust's event code, or at least it should be fixed there, but the bug never would occur in the real world since it is never halloween and easter at the same time. But this plugin can make that happen and I think that is a good thing, it's just that I can't think of any other place to prevent this bug from occuring other than this plugin.

 

As I stated before an adjustment of the scheduling process would be better and more clean, and my fix wasn't that clever in hindsight. So I will try to adjust the plugin so that everyone can be happy,  hopefully. Give me a few days.



Merged post

Also, if it is the operators responsibility, why do something like this:

                if (config.MinimumTimeBetween <= config.MaximumTimeBetween)
                    randomTime = Oxide.Core.Random.Range(config.MinimumTimeBetweenconfig.MaximumTimeBetween);
                else
                    randomTime = Oxide.Core.Random.Range(config.MaximumTimeBetweenconfig.MinimumTimeBetween);
Please just stop.Server Events only run correctly when it is their time to do so. So there will only ever be one valid event. I do not support running buggy events outside their periods, that is in the documentation. I try to be nice for operators making typos is all, please stop as your input is not congruent with the plugin. If you want please make your own plugin to run server events off schedule, as it is not something I will support.
Locked automatically