The LimitWorlds function now uses cCuboid
git-svn-id: http://mc-server.googlecode.com/svn/trunk@1633 0a769ca7-a7f5-676a-18bf-c427514a06d6
This commit is contained in:
parent
623adcad0f
commit
290ab0b588
@ -10,7 +10,7 @@ WhiteListIni = {}
|
|||||||
X = {}
|
X = {}
|
||||||
Y = {}
|
Y = {}
|
||||||
Z = {}
|
Z = {}
|
||||||
|
LimitWorldsCuboid = {}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -19,7 +19,7 @@ function Initialize(Plugin)
|
|||||||
PLUGIN = Plugin
|
PLUGIN = Plugin
|
||||||
|
|
||||||
Plugin:SetName("Core")
|
Plugin:SetName("Core")
|
||||||
Plugin:SetVersion(12)
|
Plugin:SetVersion(13)
|
||||||
|
|
||||||
PluginManager = cRoot:Get():GetPluginManager()
|
PluginManager = cRoot:Get():GetPluginManager()
|
||||||
PluginManager:AddHook(Plugin, cPluginManager.HOOK_PLAYER_JOINED)
|
PluginManager:AddHook(Plugin, cPluginManager.HOOK_PLAYER_JOINED)
|
||||||
@ -68,10 +68,19 @@ function Initialize(Plugin)
|
|||||||
if ( IniFile:ReadFile() == true ) then
|
if ( IniFile:ReadFile() == true ) then
|
||||||
HardCore = IniFile:GetValueSet("GameMode", "Hardcore", "false")
|
HardCore = IniFile:GetValueSet("GameMode", "Hardcore", "false")
|
||||||
LimitWorld = IniFile:GetValueSetB("Worlds", "LimitWorld", true)
|
LimitWorld = IniFile:GetValueSetB("Worlds", "LimitWorld", true)
|
||||||
LimitWorldWidth = IniFile:GetValueSetI("Worlds", "LimitWorldWidth", 200)
|
LimitWorldWidth = IniFile:GetValueSetI("Worlds", "LimitWorldWidth", 10)
|
||||||
SHOW_PLUGIN_NAMES = IniFile:GetValueSetB("HelpPlugin", "ShowPluginNames", true )
|
SHOW_PLUGIN_NAMES = IniFile:GetValueSetB("HelpPlugin", "ShowPluginNames", true )
|
||||||
|
IniFile:WriteFile()
|
||||||
end
|
end
|
||||||
|
|
||||||
|
cRoot:Get():ForEachWorld(
|
||||||
|
function( World )
|
||||||
|
LimitWorldsCuboid[World:GetName()] = cCuboid()
|
||||||
|
LimitWorldsCuboid[World:GetName()].p1 = Vector3i( math.floor(World:GetSpawnX() / 16) + LimitWorldWidth, 0, math.floor(World:GetSpawnZ() / 16) + LimitWorldWidth)
|
||||||
|
LimitWorldsCuboid[World:GetName()].p2 = Vector3i( math.floor(World:GetSpawnX() / 16) - LimitWorldWidth, 256, math.floor(World:GetSpawnZ() / 16) - LimitWorldWidth)
|
||||||
|
LimitWorldsCuboid[World:GetName()]:Sort()
|
||||||
|
end
|
||||||
|
)
|
||||||
-- Load whitelist, and add default values and stuff
|
-- Load whitelist, and add default values and stuff
|
||||||
WhiteListIni = cIniFile( Plugin:GetLocalDirectory() .. "/whitelist.ini" )
|
WhiteListIni = cIniFile( Plugin:GetLocalDirectory() .. "/whitelist.ini" )
|
||||||
if ( WhiteListIni:ReadFile() == true ) then
|
if ( WhiteListIni:ReadFile() == true ) then
|
||||||
|
@ -1,17 +1,12 @@
|
|||||||
function OnChunkGenerating(World, ChunkX, ChunkZ, ChunkDesc)
|
function OnChunkGenerating(World, ChunkX, ChunkZ, ChunkDesc)
|
||||||
if LimitWorld == true then
|
if (LimitWorld == true) then
|
||||||
SpawnX = math.floor(World:GetSpawnX() / 16)
|
if not LimitWorldsCuboid[World:GetName()]:IsInside( Vector3i(ChunkX, 128, ChunkZ) ) then
|
||||||
SpawnZ = math.floor(World:GetSpawnZ() / 16)
|
FillBlocks(ChunkDesc)
|
||||||
if ( (SpawnX + LimitWorldWidth) < ChunkX ) or ( (SpawnX - LimitWorldWidth) > ChunkX ) then
|
|
||||||
FillBlocks(World, ChunkX, ChunkZ, ChunkDesc)
|
|
||||||
end
|
|
||||||
if ( (SpawnZ + LimitWorldWidth) < ChunkZ ) or ( (SpawnZ - LimitWorldWidth) > ChunkZ ) then
|
|
||||||
FillBlocks(World, ChunkX, ChunkZ, ChunkDesc)
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function FillBlocks(World, ChunkX, ChunkZ, ChunkDesc)
|
function FillBlocks(ChunkDesc)
|
||||||
ChunkDesc:FillBlocks(0,0)
|
ChunkDesc:FillBlocks(0,0)
|
||||||
ChunkDesc:SetUseDefaultBiomes(false)
|
ChunkDesc:SetUseDefaultBiomes(false)
|
||||||
ChunkDesc:SetUseDefaultHeight(false)
|
ChunkDesc:SetUseDefaultHeight(false)
|
||||||
|
Loading…
Reference in New Issue
Block a user