configurable cooldown time

master
Tai Kedzierski 2019-01-09 15:09:10 +00:00
parent f216ebd049
commit dc93d30155
3 changed files with 33 additions and 1 deletions

View File

@ -51,6 +51,7 @@ Note that the spawn generation is performed in the background on a timer, allowi
* `rspawn.spawn_anywhere` - whether to spawn anywhere in the world at sea level
* default `true`
* if `false`, will randomize around the static spawn point
* `rspawn.cooldown_time` - how many seconds between two uses of `/newspawn`, per player
* `rspawn.levvy_name` - name of the block to use as levvy charge on the player issuing an invitation, default `default:cobble`
* `rspawn.levvy_qtty` - number of blocks to levvy from the player who issued the invitation, default `10`
* `rspawn.kick_on_fail` - whether to kick the player if a randomized spawn cannot be set, default `false`
@ -77,6 +78,25 @@ Resolutions in order of best to worst:
* Stop minetest, delete the `force_loaded.txt` file, and start it again
* (bad - some things in the mods using the forceload mechanism may break)
## Singple Player Mode
This mod is mainly intended for use on servers with multiple players.
It is also suitable for single player sessions too - if you want a new location to start a creative build, but don't want to go through creating another, separate world for it, just grab yourself a new spawnpoint!
You may want to tune the mod to suit your computer's capabilities ; to this end, the following may be helpful:
* Add `rspawn` to your world
* Go to the *Advanced Settings* area of Minetest, look for `mods > rspawn`
* Change the frequency of pregeneration as required
* Good CPUs, enough RAM and SSD hard drives might get away with a frequency of 20sec (!)
* If you find your game immediately lagging due to excessive map generation, switch the frequency to say 120
* Change the Cooldown time - default is `300` seconds (5 minutes) between uses of `/newspawn`
* Optionally, change the maximum pregen to the desired number of spawnpoints to pregenerate and hold
* Start the game session; Wait around 1 minute or so as the initial spawn point gets generated and is assigned to you
* Jump around! (with `/newspawn`)
* Until you exhaust your pregens :-P
## License
(C) 2017 Tai "DuCake" Kedzierski

10
settingtypes.txt Normal file
View File

@ -0,0 +1,10 @@
rspawn.debug (Debug mode) bool false
rspawn.spawn_anywhere (Spawn anywhere) bool true
rspawn.kick_on_fail (Kick on fail) bool false
rspawn.max_pregen (Maximum blocks to pregenerate) string 10
rspawn.search_radius (Search radius) string 32
rspawn.gen_frequency (Spawnpoint generation frequency [seconds]) 60
rspawn.spawn_block (Node to place under new spawn point) string
rspawn.levvy_name (Levvy itemstring) string "default:cobble"
rspawn.levvy_qtty (Levvy quantity) string 10
rspawn.cooldown_time (Cooldown between /newspawn uses) string 300

View File

@ -1,5 +1,6 @@
local stepcount = 0
local newspawn_cooldown = {}
local cooldown_time = tonumber(minetest.settings:get("rspawn.cooldown_time")) or 300
-- Command privileges
@ -51,7 +52,7 @@ local function request_new_spawn(username, targetname)
if not newspawn_cooldown[timername] then
rspawn:renew_player_spawn(targetname)
newspawn_cooldown[timername] = 300
newspawn_cooldown[timername] = cooldown_time
else
minetest.chat_send_player(username, tostring(math.ceil(newspawn_cooldown[timername])).."sec until you can randomize a new spawn for "..targetname)
end
@ -87,6 +88,7 @@ minetest.register_chatcommand("spawn", {
elseif args[1] == "original" then
set_original_spawn(name)
return
elseif args[1] == "invite" then
if #args == 2 then