First commit
commit
3e0b2b3a7f
|
@ -0,0 +1,27 @@
|
|||
multispawn
|
||||
=========
|
||||
|
||||
Extremely basic mod by Shara RedCat for multiple spawn points. Written for Billre.
|
||||
|
||||
Note: This is mostly intended as a working concept.
|
||||
Better implementation can be done later if needed.
|
||||
|
||||
Other note: This mod not yet tested.
|
||||
|
||||
|
||||
How to Use
|
||||
-----------
|
||||
|
||||
Set desired spawn points in minetest.conf for:
|
||||
spawn_coordinate_1, spawn_coordinate_2, spawn_coordinate_3, spawn_coordinate_4
|
||||
|
||||
You can expand this with additional spawn points by editing the code in init.lua.
|
||||
It should be simple. Ask if you need help.
|
||||
|
||||
The /spawn command teleports the player to the highest level spawn they have the priv for.
|
||||
|
||||
|
||||
Licenses and Attribution
|
||||
-----------------------
|
||||
|
||||
Code for this mod is released under MIT (https://opensource.org/licenses/MIT).
|
|
@ -0,0 +1,37 @@
|
|||
|
||||
-- register privs for spawn points
|
||||
minetest.register_privilege("spawn1", {description = "Starting spawn.", give_to_singleplayer=false})
|
||||
minetest.register_privilege("spawn2", {description = "Second spawn.", give_to_singleplayer=false})
|
||||
minetest.register_privilege("spawn3", {description = "Third spawn.", give_to_singleplayer=false})
|
||||
minetest.register_privilege("spawn4", {description = "Fourth spawn.", give_to_singleplayer=false})
|
||||
|
||||
|
||||
-- spawn command
|
||||
minetest.register_chatcommand("spawn", {
|
||||
description = "Teleport to current spawn point.",
|
||||
privs = {},
|
||||
func = function(name)
|
||||
|
||||
-- check minetest.conf file for correct coordinates depending on privs
|
||||
local player = minetest.get_player_by_name(name)
|
||||
if minetest.check_player_privs(name, {spawn4=true}) then
|
||||
spawnpos = minetest.setting_get_pos("spawn_coordinate_4")
|
||||
elseif minetest.check_player_privs(name, {spawn3=true}) then
|
||||
spawnpos = minetest.setting_get_pos("spawn_coordinate_3")
|
||||
elseif minetest.check_player_privs(name, {spawn2=true}) then
|
||||
spawnpos = minetest.setting_get_pos("spawn_coordinate_2")
|
||||
elseif minetest.check_player_privs(name, {spawn1=true}) then
|
||||
spawnpos = minetest.setting_get_pos("spawn_coordinate_1")
|
||||
end
|
||||
|
||||
-- return if no valid spawn position...
|
||||
if not spawnpos then
|
||||
return false, "No spawn point set..."
|
||||
end
|
||||
|
||||
-- if spawn position found, teleport player
|
||||
player:setpos(spawnpos)
|
||||
return true, "Teleported to Current Spawn!"
|
||||
|
||||
end
|
||||
})
|
|
@ -0,0 +1,30 @@
|
|||
|
||||
Code:
|
||||
License: MIT (https://opensource.org/licenses/MIT)
|
||||
By Shara RedCat
|
||||
|
||||
|
||||
|
||||
---
|
||||
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2017 Shara RedCat
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
Loading…
Reference in New Issue