From 30906a597c660f1f22508f7c055f3219551adf77 Mon Sep 17 00:00:00 2001 From: Samuel Barney Date: Mon, 2 Dec 2013 14:11:45 -0700 Subject: Fire no longer goes out when on top of nether rack --- src/Simulator/FireSimulator.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/Simulator/FireSimulator.cpp b/src/Simulator/FireSimulator.cpp index ac3fb9695..bfbc4b1c7 100644 --- a/src/Simulator/FireSimulator.cpp +++ b/src/Simulator/FireSimulator.cpp @@ -94,7 +94,9 @@ void cFireSimulator::SimulateChunk(float a_Dt, int a_ChunkX, int a_ChunkZ, cChun for (cCoordWithIntList::iterator itr = Data.begin(); itr != Data.end();) { int idx = cChunkDef::MakeIndexNoCheck(itr->x, itr->y, itr->z); + int idb = cChunkDef::MakeIndexNoCheck(itr->x, itr->y - 1, itr->z); BLOCKTYPE BlockType = a_Chunk->GetBlock(idx); + BLOCKTYPE Burnee = a_Chunk->GetBlock(idb); if (!IsAllowedBlock(BlockType)) { @@ -135,7 +137,10 @@ void cFireSimulator::SimulateChunk(float a_Dt, int a_ChunkX, int a_ChunkZ, cChun itr = Data.erase(itr); continue; } - a_Chunk->SetMeta(idx, BlockMeta + 1); + if(Burnee != E_BLOCK_NETHERRACK) + { + a_Chunk->SetMeta(idx, BlockMeta + 1); + } itr->Data = GetBurnStepTime(a_Chunk, itr->x, itr->y, itr->z); // TODO: Add some randomness into this } // for itr - Data[] } -- cgit v1.2.3 From efae54db0a9afe70237c427e855d5834e837342a Mon Sep 17 00:00:00 2001 From: Samuel Barney Date: Tue, 3 Dec 2013 19:05:34 -0700 Subject: Made suggested changes --- src/Simulator/FireSimulator.cpp | 15 ++++++++++----- src/Simulator/FireSimulator.h | 2 +- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/src/Simulator/FireSimulator.cpp b/src/Simulator/FireSimulator.cpp index bfbc4b1c7..8e46ed320 100644 --- a/src/Simulator/FireSimulator.cpp +++ b/src/Simulator/FireSimulator.cpp @@ -94,9 +94,7 @@ void cFireSimulator::SimulateChunk(float a_Dt, int a_ChunkX, int a_ChunkZ, cChun for (cCoordWithIntList::iterator itr = Data.begin(); itr != Data.end();) { int idx = cChunkDef::MakeIndexNoCheck(itr->x, itr->y, itr->z); - int idb = cChunkDef::MakeIndexNoCheck(itr->x, itr->y - 1, itr->z); BLOCKTYPE BlockType = a_Chunk->GetBlock(idx); - BLOCKTYPE Burnee = a_Chunk->GetBlock(idb); if (!IsAllowedBlock(BlockType)) { @@ -137,7 +135,14 @@ void cFireSimulator::SimulateChunk(float a_Dt, int a_ChunkX, int a_ChunkZ, cChun itr = Data.erase(itr); continue; } - if(Burnee != E_BLOCK_NETHERRACK) + + BLOCKTYPE Burnee = E_BLOCK_AIR; + if (itr->y > 0) + { + Burnee = a_Chunk->GetBlock(itr->x, itr->y - 1, itr->z); + } + + if(!DoesBurnForever(Burnee)) { a_Chunk->SetMeta(idx, BlockMeta + 1); } @@ -181,7 +186,7 @@ bool cFireSimulator::IsFuel(BLOCKTYPE a_BlockType) -bool cFireSimulator::IsForever(BLOCKTYPE a_BlockType) +bool cFireSimulator::DoesBurnForever(BLOCKTYPE a_BlockType) { return (a_BlockType == E_BLOCK_NETHERRACK); } @@ -230,7 +235,7 @@ int cFireSimulator::GetBurnStepTime(cChunk * a_Chunk, int a_RelX, int a_RelY, in if (a_RelY > 0) { BLOCKTYPE BlockBelow = a_Chunk->GetBlock(a_RelX, a_RelY - 1, a_RelZ); - if (IsForever(BlockBelow)) + if (DoesBurnForever(BlockBelow)) { // Is burning atop of netherrack, burn forever (re-check in 10 sec) return 10000; diff --git a/src/Simulator/FireSimulator.h b/src/Simulator/FireSimulator.h index 0d8a548ef..59cc62540 100644 --- a/src/Simulator/FireSimulator.h +++ b/src/Simulator/FireSimulator.h @@ -28,7 +28,7 @@ public: virtual bool IsAllowedBlock(BLOCKTYPE a_BlockType) override; bool IsFuel (BLOCKTYPE a_BlockType); - bool IsForever(BLOCKTYPE a_BlockType); + bool DoesBurnForever(BLOCKTYPE a_BlockType); protected: /// Time (in msec) that a fire block takes to burn with a fuel block into the next step -- cgit v1.2.3 From 3d9396b097626dc81740b61f9552733c57201bf0 Mon Sep 17 00:00:00 2001 From: Samuel Barney Date: Thu, 5 Dec 2013 07:34:56 -0700 Subject: Finished Merge --- src/Simulator/FireSimulator.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Simulator/FireSimulator.h b/src/Simulator/FireSimulator.h index 59cc62540..66c31b440 100644 --- a/src/Simulator/FireSimulator.h +++ b/src/Simulator/FireSimulator.h @@ -27,8 +27,8 @@ public: virtual bool IsAllowedBlock(BLOCKTYPE a_BlockType) override; - bool IsFuel (BLOCKTYPE a_BlockType); - bool DoesBurnForever(BLOCKTYPE a_BlockType); + static bool IsFuel (BLOCKTYPE a_BlockType); + static bool DoesBurnForever(BLOCKTYPE a_BlockType); protected: /// Time (in msec) that a fire block takes to burn with a fuel block into the next step -- cgit v1.2.3 From d62bfdaca4eb29678c5a82ff69e35965d7007640 Mon Sep 17 00:00:00 2001 From: Samuel Barney Date: Thu, 5 Dec 2013 10:01:23 -0700 Subject: Merged if statements. --- src/Simulator/FireSimulator.cpp | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/src/Simulator/FireSimulator.cpp b/src/Simulator/FireSimulator.cpp index 8e46ed320..03e4f6e45 100644 --- a/src/Simulator/FireSimulator.cpp +++ b/src/Simulator/FireSimulator.cpp @@ -136,13 +136,7 @@ void cFireSimulator::SimulateChunk(float a_Dt, int a_ChunkX, int a_ChunkZ, cChun continue; } - BLOCKTYPE Burnee = E_BLOCK_AIR; - if (itr->y > 0) - { - Burnee = a_Chunk->GetBlock(itr->x, itr->y - 1, itr->z); - } - - if(!DoesBurnForever(Burnee)) + if((itr->y > 0) && (!DoesBurnForever(a_Chunk->GetBlock(itr->x, itr->y - 1, itr->z)))) { a_Chunk->SetMeta(idx, BlockMeta + 1); } -- cgit v1.2.3 From 88d64548821a24fd8036a75ed6f30fb8069181b3 Mon Sep 17 00:00:00 2001 From: Samuel Barney Date: Thu, 5 Dec 2013 22:42:52 -0700 Subject: I don't know how this dissapeard. --- MCServer/Plugins/TestLuaRocks/TestLuaRocks.lua | 49 ++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 MCServer/Plugins/TestLuaRocks/TestLuaRocks.lua diff --git a/MCServer/Plugins/TestLuaRocks/TestLuaRocks.lua b/MCServer/Plugins/TestLuaRocks/TestLuaRocks.lua new file mode 100644 index 000000000..6e90b1ae9 --- /dev/null +++ b/MCServer/Plugins/TestLuaRocks/TestLuaRocks.lua @@ -0,0 +1,49 @@ + +-- TestLuaRocks.lua + +-- This is a mockup plugin that does a quick test of LuaRocks capability in MCServer + +-- "Success" is when the plugin loads, downloads the forum webpage and displays the headers and length and then displays both libs as loaded. +-- "Failure" usually manifests as one of the "require" lines failing, although you have the luarock installed. +-- Note that the plugin deliberately never fully loads, so that it can be reloaded fast by pressing its Enable button in the webadmin's plugin list. + + + + + + +local log30 = require("30log"); +local socket = require("socket"); +local http = require("socket.http"); + + + + + +LOGINFO("Trying to download a webpage..."); +local body, code, headers = http.request('http://forum.mc-server.org/index.php'); +LOG("code: " .. tostring(code)); +LOG("headers: "); +for k, v in pairs(headers or {}) do + LOG(" " .. k .. ": " .. v); +end +LOG("body length: " .. string.length(body)); + + + + + +function Initialize(a_Plugin) + if (socket == nil) then + LOG("LuaSocket not found"); + else + LOG("LuaSocket loaded"); + end + if (log30 == nil) then + LOG("30log not found"); + else + LOG("30log loaded"); + end + LOGINFO("Preventing plugin load so that it may be requested again from the webadmin."); + return false; +end \ No newline at end of file -- cgit v1.2.3