-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathRegion Reset Randomiser
71 lines (59 loc) · 3.93 KB
/
Region Reset Randomiser
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
Region Reset Randomiser
-----------------------
2024/08/08 - Updated for 7 Days to Die v1.0
Using CSMM and the CSMM Patreon Mod (CPM), server admins can schedule automatic resets of flagged regions. Following the "resetregions"
command, flagged regions are untouched once more; all holes filled and ore deposits restored, all player structures and vehicles gone.
Running this on all regions at once creates two concerns. Resetting all regions on a regular basis may unbalance a server economy (mudflation)
and since reset times are predictable, players may camp their favourite looting locations to the detriment of other players. With
this in mind, I conceived a process to reset a randomly-selected subset of the total number of regions-to-reset. With this process,
there will be some regeneration of resources for new players to find (and old-timers to mine) but players will have to search,
rather than just returning to their favourite spots.
It flows as follows:
1. Remove all region reset flags using "mrr remove"
2. Select a number of regions from the pool
3. Flag them for reset
4. Reset regions using the "resetregions" command
5. Re-flag the full set of reset regions so players can't build in areas that may be reset later.
Notes:
* As of the CPM for 7DTD ver1.0, resetting regions is fast and does NOT require a reboot!
* Programatically building a list of currently-flagged regions is beyond my ability. As such, when the server is initially set up, I generate
a handlebars script containing commands to store the region list as variables. See "Preparation", below.
* From our pool of ~100 regions, we're resetting only 5 per execution. This can be adjusted with the {{#times 5}} instruction in the first code block.
* I could not have done this without the generous assistance of RDois on the CSMM Discord. Thanks mate!
PREPARATION
* Once the server is up and running, use the CPM webUI to create claims and turn them into reset regions. Once you're done, run the
following command in the console: w2l command "mrr list" splitlog
* Open output.log and copy/paste the resulting list into Notepad++ then run some find and replaces to convert the list into the following format:
{{setVar "masterRegionList1" "r.-8.7.7rg"}};{{setVar "masterRegionList2" "r.-8.6.7rg"}}; etc.
(This could be done pretty easily with a python script but I'm no programmer!)
SET MASTER REGION LIST
* This script takes the prepared "Master Region List" and stores contents as persistent variables.
* Add it to CSMM in Server Automation but leave it deactivated.
* This script needs to be run manually after the list is created and if/when modified/updated.
{{! Set Master Region List}}
{{! Set this in Server Automation but leave it disabled.}}
{{! Execute once with the Run Now button after modifying the list.}}
{{setVar "masterRegionList1" "r.-8.7.7rg"}};{{setVar "masterRegionList2" "r.-8.6.7rg"}}; etc.
RANDOMISE & RESET REGIONS
* This script selects a subset of your reset regions then resets them.
* Run this as a CSMM Server Automation job (with cron) whenever you like
* Change the XX in randNum to be the total number of reset regions for your map +1
* Change the {{#times 5}} to adjust the number of regions randomly selected
{{! Randomise Regions for Reset }}
sendDiscord(<channelID>, "--- Resetting 5 random regions.");
mrr remove -5024 5024 5024 -5024;
{{#times 5}}
mrr add {{itemAt (arrayify (split (getVar (add "masterRegionList" (randNum 1 XX))))) this}};
{{/times}};
resetregions
RESTORE MASTER REGION LIST
* Following the reset of the short list, you'll want to re-flag the full set of reset regions
* Run this as a CSMM Server Automation job (with cron), starting 1 or 2 mins after the Randomise
{{! Restore Master List }}
{{! Ensure the #times value is at least 1 more than your number of regions }}
mrr remove -5024 5024 5024 -5024;
{{#times 127}}
{{#each (arrayify (split (getVar (add "masterRegionList" index))))}};
mrr add {{this}};
{{/each}};
{{/times}}