diff options
author | madmaxoft <github@xoft.cz> | 2013-08-07 15:46:43 +0200 |
---|---|---|
committer | madmaxoft <github@xoft.cz> | 2013-08-07 15:46:43 +0200 |
commit | 3d027a8928ee423ee6a475637752bd50a5f0d44c (patch) | |
tree | 82c6993605326422e188410dda8b897a28ce16ef /MCServer | |
parent | Merge pull request #47 from tonibm19/master (diff) | |
parent | Debuggers plugin: added the "/spidey" command. (diff) | |
download | cuberite-3d027a8928ee423ee6a475637752bd50a5f0d44c.tar cuberite-3d027a8928ee423ee6a475637752bd50a5f0d44c.tar.gz cuberite-3d027a8928ee423ee6a475637752bd50a5f0d44c.tar.bz2 cuberite-3d027a8928ee423ee6a475637752bd50a5f0d44c.tar.lz cuberite-3d027a8928ee423ee6a475637752bd50a5f0d44c.tar.xz cuberite-3d027a8928ee423ee6a475637752bd50a5f0d44c.tar.zst cuberite-3d027a8928ee423ee6a475637752bd50a5f0d44c.zip |
Diffstat (limited to 'MCServer')
-rw-r--r-- | MCServer/.gitignore | 8 | ||||
-rw-r--r-- | MCServer/Plugins/Debuggers/Debuggers.lua | 54 | ||||
-rw-r--r-- | MCServer/webadmin/template.lua | 16 |
3 files changed, 59 insertions, 19 deletions
diff --git a/MCServer/.gitignore b/MCServer/.gitignore index 62225e137..ca10d90e8 100644 --- a/MCServer/.gitignore +++ b/MCServer/.gitignore @@ -1,11 +1,8 @@ *.exe -ChunkWorx.ini -ChunkWorxSave.ini +*.ini MCServer -banned.ini logs players -whitelist.ini world* API.txt *.dat @@ -15,9 +12,6 @@ schematics *.pdb memdump.xml *.grab -ProtectionAreas.ini ProtectionAreas.sqlite helgrind.log -settings.ini -webadmin.ini motd.txt diff --git a/MCServer/Plugins/Debuggers/Debuggers.lua b/MCServer/Plugins/Debuggers/Debuggers.lua index f26b9a98d..e864cfe92 100644 --- a/MCServer/Plugins/Debuggers/Debuggers.lua +++ b/MCServer/Plugins/Debuggers/Debuggers.lua @@ -23,17 +23,18 @@ function Initialize(Plugin) PluginManager:AddHook(Plugin, cPluginManager.HOOK_CHAT); PluginManager:AddHook(Plugin, cPluginManager.HOOK_PLAYER_RIGHT_CLICKING_ENTITY); - PluginManager:BindCommand("/le", "debuggers", HandleListEntitiesCmd, "Shows a list of all the loaded entities"); - PluginManager:BindCommand("/ke", "debuggers", HandleKillEntitiesCmd, "Kills all the loaded entities"); - PluginManager:BindCommand("/wool", "debuggers", HandleWoolCmd, "Sets all your armor to blue wool"); - PluginManager:BindCommand("/testwnd", "debuggers", HandleTestWndCmd, "Opens up a window using plugin API"); - PluginManager:BindCommand("/gc", "debuggers", HandleGCCmd, "Activates the Lua garbage collector"); - PluginManager:BindCommand("/fast", "debuggers", HandleFastCmd, "Switches between fast and normal movement speed"); - PluginManager:BindCommand("/dash", "debuggers", HandleDashCmd, "Switches between fast and normal sprinting speed"); - PluginManager:BindCommand("/hunger", "debuggers", HandleHungerCmd, "Lists the current hunger-related variables"); - PluginManager:BindCommand("/poison", "debuggers", HandlePoisonCmd, "Sets food-poisoning for 15 seconds"); - PluginManager:BindCommand("/starve", "debuggers", HandleStarveCmd, "Sets the food level to zero"); - PluginManager:BindCommand("/fl", "debuggers", HandleFoodLevelCmd, "Sets the food level to the given value"); + PluginManager:BindCommand("/le", "debuggers", HandleListEntitiesCmd, "- Shows a list of all the loaded entities"); + PluginManager:BindCommand("/ke", "debuggers", HandleKillEntitiesCmd, "- Kills all the loaded entities"); + PluginManager:BindCommand("/wool", "debuggers", HandleWoolCmd, "- Sets all your armor to blue wool"); + PluginManager:BindCommand("/testwnd", "debuggers", HandleTestWndCmd, "- Opens up a window using plugin API"); + PluginManager:BindCommand("/gc", "debuggers", HandleGCCmd, "- Activates the Lua garbage collector"); + PluginManager:BindCommand("/fast", "debuggers", HandleFastCmd, "- Switches between fast and normal movement speed"); + PluginManager:BindCommand("/dash", "debuggers", HandleDashCmd, "- Switches between fast and normal sprinting speed"); + PluginManager:BindCommand("/hunger", "debuggers", HandleHungerCmd, "- Lists the current hunger-related variables"); + PluginManager:BindCommand("/poison", "debuggers", HandlePoisonCmd, "- Sets food-poisoning for 15 seconds"); + PluginManager:BindCommand("/starve", "debuggers", HandleStarveCmd, "- Sets the food level to zero"); + PluginManager:BindCommand("/fl", "debuggers", HandleFoodLevelCmd, "- Sets the food level to the given value"); + PluginManager:BindCommand("/spidey", "debuggers", HandleSpideyCmd, "- Shoots a line of web blocks until it hits non-air"); -- Enable the following line for BlockArea / Generator interface testing: -- PluginManager:AddHook(Plugin, cPluginManager.HOOK_CHUNK_GENERATED); @@ -707,3 +708,34 @@ end + +function HandleSpideyCmd(a_Split, a_Player) + -- Place a line of cobwebs from the player's eyes until non-air block, in the line-of-sight of the player + local World = a_Player:GetWorld(); + + local Callbacks = { + OnNextBlock = function(a_BlockX, a_BlockY, a_BlockZ, a_BlockType, a_BlockMeta) + if (a_BlockType ~= E_BLOCK_AIR) then + -- abort the trace + return true; + end + World:SetBlock(a_BlockX, a_BlockY, a_BlockZ, E_BLOCK_COBWEB, 0); + end + }; + + local EyePos = a_Player:GetEyePosition(); + local LookVector = a_Player:GetLookVector(); + LookVector:Normalize(); + + -- Start cca 2 blocks away from the eyes + local Start = EyePos + LookVector + LookVector; + local End = EyePos + LookVector * 50; + + cLineBlockTracer.Trace(World, Callbacks, Start.x, Start.y, Start.z, End.x, End.y, End.z); + + return true; +end + + + + diff --git a/MCServer/webadmin/template.lua b/MCServer/webadmin/template.lua index f508ad5aa..1ab1aab88 100644 --- a/MCServer/webadmin/template.lua +++ b/MCServer/webadmin/template.lua @@ -4,6 +4,10 @@ function Output(String) table.insert(SiteContent, String) end + + + + function GetTableSize(Table) local Size = 0 for key,value in pairs(Table) do @@ -12,6 +16,10 @@ function GetTableSize(Table) return Size end + + + + function GetDefaultPage() local PM = cRoot:Get():GetPluginManager() @@ -42,11 +50,15 @@ function GetDefaultPage() return Content, SubTitle end + + + + function ShowPage(WebAdmin, TemplateRequest) SiteContent = {} local BaseURL = WebAdmin:GetBaseURL(TemplateRequest.Request.Path) local Title = "MCServer" - local MemoryUsage = WebAdmin:GetMemoryUsage() + local MemoryUsage = cWebAdmin:GetMemoryUsage() local NumChunks = cRoot:Get():GetTotalChunkCount() local PluginPage = WebAdmin:GetPage(TemplateRequest.Request) local PageContent = PluginPage.Content @@ -408,6 +420,7 @@ function ShowPage(WebAdmin, TemplateRequest) <div id="sidebar"> <ul class="sideNav"> ]]) + local AllPlugins = WebAdmin:GetPlugins() for key,value in pairs(AllPlugins) do @@ -421,6 +434,7 @@ function ShowPage(WebAdmin, TemplateRequest) end end end + Output([[ </ul> |