From d2469d857ab345961e7991339de490ddafebf4a8 Mon Sep 17 00:00:00 2001 From: "madmaxoft@gmail.com" Date: Thu, 30 Aug 2012 12:37:55 +0000 Subject: 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 --- MCServer/Plugins/ChunkWorx/chunkworx_main.lua | 2 +- MCServer/Plugins/ChunkWorx/chunkworx_web.lua | 14 ++++++++++---- 2 files changed, 11 insertions(+), 5 deletions(-) (limited to 'MCServer/Plugins') diff --git a/MCServer/Plugins/ChunkWorx/chunkworx_main.lua b/MCServer/Plugins/ChunkWorx/chunkworx_main.lua index 26f9ca624..87702ff79 100644 --- a/MCServer/Plugins/ChunkWorx/chunkworx_main.lua +++ b/MCServer/Plugins/ChunkWorx/chunkworx_main.lua @@ -23,7 +23,7 @@ function Initialize(Plugin) PLUGIN = Plugin PLUGIN:SetName("ChunkWorx") - PLUGIN:SetVersion(4) + PLUGIN:SetVersion(5) PluginManager = cRoot:Get():GetPluginManager() PluginManager:AddHook(PLUGIN, cPluginManager.E_PLUGIN_TICK) diff --git a/MCServer/Plugins/ChunkWorx/chunkworx_web.lua b/MCServer/Plugins/ChunkWorx/chunkworx_web.lua index 7bc4bc4e9..cc577bbbe 100644 --- a/MCServer/Plugins/ChunkWorx/chunkworx_web.lua +++ b/MCServer/Plugins/ChunkWorx/chunkworx_web.lua @@ -102,19 +102,25 @@ function HandleRequest_Generation( Request ) GENERATION_STATE = 3 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! if( Request.PostParams["PlayerExact"] ~= nil and Request.PostParams["PlayerName"] ~= nil ) then -- Making BOOM! I meant, regenereate... - AreaStartX = cRoot:Get():GetWorld(WORK_WORLD):GetPlayer(Request.PostParams["PlayerName"]):GetChunkX() - AreaStartZ = cRoot:Get():GetWorld(WORK_WORLD):GetPlayer(Request.PostParams["PlayerName"]):GetChunkZ() + cRoot:Get():GetWorld(WORK_WORLD):DoWithPlayer(Request.PostParams["PlayerName"],GetAreaByPlayer) AreaEndX = AreaStartX AreaEndZ = AreaStartZ GENERATION_STATE = 3 end if( Request.PostParams["Player3x3"] ~= nil and Request.PostParams["PlayerName"] ~= nil ) then -- Making BOOM! I meant, regenereate... - AreaStartX = cRoot:Get():GetWorld(WORK_WORLD):GetPlayer(Request.PostParams["PlayerName"]):GetChunkX() - 1 - AreaStartZ = cRoot:Get():GetWorld(WORK_WORLD):GetPlayer(Request.PostParams["PlayerName"]):GetChunkZ() - 1 + cRoot:Get():GetWorld(WORK_WORLD):DoWithPlayer(Request.PostParams["PlayerName"],GetAreaByPlayer) + AreaStartX = AreaStartX - 1 + AreaStartZ = AreaStartZ - 1 AreaEndX = AreaStartX + 2 AreaEndZ = AreaStartZ + 2 GENERATION_STATE = 3 -- cgit v1.2.3