1
0

ChunkWorx: fixed API change breaking exact and 3x3 playerpos regeneration (fix contributed by Taugeshtu)

git-svn-id: http://mc-server.googlecode.com/svn/trunk@806 0a769ca7-a7f5-676a-18bf-c427514a06d6
This commit is contained in:
madmaxoft@gmail.com 2012-08-30 12:37:55 +00:00
parent f5fe723b2a
commit d2469d857a
2 changed files with 11 additions and 5 deletions

View File

@ -23,7 +23,7 @@ function Initialize(Plugin)
PLUGIN = Plugin PLUGIN = Plugin
PLUGIN:SetName("ChunkWorx") PLUGIN:SetName("ChunkWorx")
PLUGIN:SetVersion(4) PLUGIN:SetVersion(5)
PluginManager = cRoot:Get():GetPluginManager() PluginManager = cRoot:Get():GetPluginManager()
PluginManager:AddHook(PLUGIN, cPluginManager.E_PLUGIN_TICK) PluginManager:AddHook(PLUGIN, cPluginManager.E_PLUGIN_TICK)

View File

@ -102,19 +102,25 @@ function HandleRequest_Generation( Request )
GENERATION_STATE = 3 GENERATION_STATE = 3
end end
end end
local GetAreaByPlayer = function(Player)
-- Player is valid only within this function, it cannot be stord and used later!
AreaStartX = Player:GetChunkX()
AreaStartZ = Player:GetChunkZ()
end
-- PLAYERS REGEN! -- PLAYERS REGEN!
if( Request.PostParams["PlayerExact"] ~= nil if( Request.PostParams["PlayerExact"] ~= nil
and Request.PostParams["PlayerName"] ~= nil ) then -- Making BOOM! I meant, regenereate... and Request.PostParams["PlayerName"] ~= nil ) then -- Making BOOM! I meant, regenereate...
AreaStartX = cRoot:Get():GetWorld(WORK_WORLD):GetPlayer(Request.PostParams["PlayerName"]):GetChunkX() cRoot:Get():GetWorld(WORK_WORLD):DoWithPlayer(Request.PostParams["PlayerName"],GetAreaByPlayer)
AreaStartZ = cRoot:Get():GetWorld(WORK_WORLD):GetPlayer(Request.PostParams["PlayerName"]):GetChunkZ()
AreaEndX = AreaStartX AreaEndX = AreaStartX
AreaEndZ = AreaStartZ AreaEndZ = AreaStartZ
GENERATION_STATE = 3 GENERATION_STATE = 3
end end
if( Request.PostParams["Player3x3"] ~= nil if( Request.PostParams["Player3x3"] ~= nil
and Request.PostParams["PlayerName"] ~= nil ) then -- Making BOOM! I meant, regenereate... and Request.PostParams["PlayerName"] ~= nil ) then -- Making BOOM! I meant, regenereate...
AreaStartX = cRoot:Get():GetWorld(WORK_WORLD):GetPlayer(Request.PostParams["PlayerName"]):GetChunkX() - 1 cRoot:Get():GetWorld(WORK_WORLD):DoWithPlayer(Request.PostParams["PlayerName"],GetAreaByPlayer)
AreaStartZ = cRoot:Get():GetWorld(WORK_WORLD):GetPlayer(Request.PostParams["PlayerName"]):GetChunkZ() - 1 AreaStartX = AreaStartX - 1
AreaStartZ = AreaStartZ - 1
AreaEndX = AreaStartX + 2 AreaEndX = AreaStartX + 2
AreaEndZ = AreaStartZ + 2 AreaEndZ = AreaStartZ + 2
GENERATION_STATE = 3 GENERATION_STATE = 3