![]() |
|
Question about multi-worlds - Printable Version +- Cuberite Forum (https://forum.cuberite.org) +-- Forum: Cuberite (https://forum.cuberite.org/forum-4.html) +--- Forum: Discussion (https://forum.cuberite.org/forum-5.html) +--- Thread: Question about multi-worlds (/thread-2219.html) Pages:
1
2
|
RE: Question about multi-worlds - worktycho - 11-22-2015 Yes, this is one of the bugs I'm working on. Unfortunately it involves a lot of work, due to complexities at the hart of the server. RE: Question about multi-worlds - LogicParrot - 11-22-2015 Thanks for the info. I've updated the book accordingly. RE: Question about multi-worlds - LogicParrot - 11-22-2015 How stable is it to have multiple worlds at the moment? @DrMasik could you provide a link to your problematic plugin? RE: Question about multi-worlds - DrMasik - 11-22-2015 (11-22-2015, 08:14 PM)Safwat Wrote: How stable is it to have multiple worlds at the moment? 10-20 minutes and i'm post the code. (11-22-2015, 08:14 PM)Safwat Wrote: How stable is it to have multiple worlds at the moment? Schema ( Player login -> Teleport to wrap world ->Teleport to selected world) Move player to main world
function teleport_to_wrap_world(a_player)
local func_name = "teleport_to_wrap_world()";
-- Get spawn world
local obj_world = cRoot:Get():GetWorld(g_spawn_world);
-- Get free SIZO coordinates
local SpawnX = 14;
local SpawnZ = 4;
-- Mark SIZO as beasy
-- Calculate Y
-- local ret1, SpawnY = obj_world:TryGetHeight(SpawnX, SpawnZ);
-- Run function after chunks loaded
local OnAllChunksAvailable = function()
console_log(func_name .." -> chunks redy for player ID ".. a_player:GetUniqueID(), 1);
-- Move to spawn world
a_player:MoveToWorld(obj_world);
-- Calculate Y
local ret1, SpawnY = obj_world:TryGetHeight(SpawnX, SpawnZ);
if ret1 then
console_log(func_name .." -> SpawnY detected", 1);
else
console_log(func_name .." -> SpawnY NOT detected", 1);
end
console_log(func_name .." -> SpawnY =".. SpawnY, 1);
-- Move to SIZO
-- a_player:TeleportToCoords(SpawnX, SpawnY, SpawnZ);
-- Set clear player inventory
-- a_player:GetInventory():Clear();
-- Set game mode for the plater
-- a_player:SetGameMode(0);
end
-- Prepare chunks for teleportation
console_log(func_name .." -> prepare chunks", 1);
obj_world:ChunkStay({{SpawnX/16, SpawnZ/16}}, OnChunkAvailable, OnAllChunksAvailable)
return 0;
end
Next function called to teleport into some of worlds (survival1):
function teleport_to_survival1(a_player)
local func_name = "teleport_to_survival1()";
if not a_player then
console_log(func_name .." -> a_player is nil", 2);
return (-1);
end
local world_name = "survival1";
local obj_world = cRoot:Get():GetWorld(world_name);
if not obj_world then
console_log(func_name .." -> do not find world ".. world_name, 2);
return (-1);
end
-- Get player respawn point into current world
local SpawnX = 1024;
local SpawnZ = 1024;
-- Get world default spawn points
local WSpawnX = obj_world:GetSpawnX();
local WSpawnZ = obj_world:GetSpawnZ();
-- Save player ID
local player_id = a_player:GetUniqueID();
local player = g_players[player_id];
-- Run function after chunks loaded
local OnAllChunksAvailable = function()
console_log(func_name .." -> chunks redy for player ID ".. a_player:GetUniqueID(), 1);
local ret1, SpawnY = obj_world:TryGetHeight(SpawnX, SpawnZ);
local ret2, WSpawnY = obj_world:TryGetHeight(WSpawnX, WSpawnZ);
-- Move to spawn world
a_player:MoveToWorld(obj_world);
-- Teleport to coordinates
a_player:TeleportToCoords(SpawnX, SpawnY, SpawnZ);
-- Load player inventory
player:LoadInventory(a_player);
-- Load player experience
player:LoadExperience(a_player);
-- Set game mode for the plater
a_player:SetGameMode(0);
end
-- Prepare chunks for teleportation
console_log(func_name .." -> prepare chunks", 1);
obj_world:ChunkStay({{WSpawnX/16, WSpawnZ/16}, {SpawnX/16, SpawnZ/16}}, OnChunkAvailable, OnAllChunksAvailable)
return 0;
end
More questions - LogicParrot - 11-24-2015 The book has basic multi-world documentation now. I'd like to improve it further. Here are several more questions.
Quote:You'll have to create a plugin to do that. You can only tell what type of portal (nether, end) should go to what world. In this post, Tonibm19 mentioned Essentials. So, can Essentials do that already? Related plugin ftr: https://forum.cuberite.org/showthread.php?tid=2179&highlight=BungeeCord @DrMasik Thanks for the code. I'll have a look when I learn the API. RE: Question about multi-worlds - LogicParrot - 11-24-2015 Edited the last post and added more questions. RE: Question about multi-worlds - DrMasik - 11-24-2015 (11-24-2015, 05:15 PM)Safwat Wrote: . Do not confuse "Multi world" and "Multi server". The "Multi server" - it is Bungeecord. It is multiply instances of running servers. Different IPs or/and ports. The "Multi world" - it is one instance of the running server to provide multiply independent worlds. (11-24-2015, 04:59 PM)Safwat Wrote: .. Bungeecord servers can not share inventory. In my plugin player inventory saved for the world. Updated when player disconnected. Clean and load when player connect to the world. It is simple but block to transfer inventory from creative to survival
|