summaryrefslogtreecommitdiffstats
path: root/MCServer/Plugins
diff options
context:
space:
mode:
authormadmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2013-05-26 16:39:04 +0200
committermadmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2013-05-26 16:39:04 +0200
commit5c3235ecdc3f718ce20e006f1ecfa2159df82c87 (patch)
treeaea2e4a722715498c59b0a828486b30b74506bb5 /MCServer/Plugins
parentItemGrid: Added the RemoveOneItem() function (diff)
downloadcuberite-5c3235ecdc3f718ce20e006f1ecfa2159df82c87.tar
cuberite-5c3235ecdc3f718ce20e006f1ecfa2159df82c87.tar.gz
cuberite-5c3235ecdc3f718ce20e006f1ecfa2159df82c87.tar.bz2
cuberite-5c3235ecdc3f718ce20e006f1ecfa2159df82c87.tar.lz
cuberite-5c3235ecdc3f718ce20e006f1ecfa2159df82c87.tar.xz
cuberite-5c3235ecdc3f718ce20e006f1ecfa2159df82c87.tar.zst
cuberite-5c3235ecdc3f718ce20e006f1ecfa2159df82c87.zip
Diffstat (limited to 'MCServer/Plugins')
-rw-r--r--MCServer/Plugins/Debuggers/Debuggers.lua25
1 files changed, 12 insertions, 13 deletions
diff --git a/MCServer/Plugins/Debuggers/Debuggers.lua b/MCServer/Plugins/Debuggers/Debuggers.lua
index 571f1f185..edb638e22 100644
--- a/MCServer/Plugins/Debuggers/Debuggers.lua
+++ b/MCServer/Plugins/Debuggers/Debuggers.lua
@@ -3,8 +3,7 @@
PLUGIN = {}; -- Reference to own plugin object
ShouldDumpFunctions = true; -- If set to true, all available functions are logged upon plugin initialization
-g_DispensersToActivate = {}; -- A list of dispensers (as {World, X, Y Z} quadruplets) that are to be activated every tick
-g_DroppersToActivate = {}; -- A list of droppers (as {World, X, Y Z} quadruplets) that are to be activated every tick
+g_DropSpensersToActivate = {}; -- A list of dispensers and droppers (as {World, X, Y Z} quadruplets) that are to be activated every tick
@@ -366,11 +365,11 @@ function OnUsingRedstoneTorch(Player, BlockX, BlockY, BlockZ, BlockFace, CursorX
-- Redstone torch activates a rapid dispenser / dropper discharge (at every tick):
local BlockType = Player:GetWorld():GetBlock(BlockX, BlockY, BlockZ);
if (BlockType == E_BLOCK_DISPENSER) then
- table.insert(g_DispensersToActivate, {World = Player:GetWorld(), x = BlockX, y = BlockY, z = BlockZ});
+ table.insert(g_DropSpensersToActivate, {World = Player:GetWorld(), x = BlockX, y = BlockY, z = BlockZ});
Player:SendMessage("Dispenser at {" .. BlockX .. ", " .. BlockY .. ", " .. BlockZ .. "} discharging");
return true;
elseif (BlockType == E_BLOCK_DROPPER) then
- table.insert(g_DroppersToActivate, {World = Player:GetWorld(), x = BlockX, y = BlockY, z = BlockZ});
+ table.insert(g_DropSpensersToActivate, {World = Player:GetWorld(), x = BlockX, y = BlockY, z = BlockZ});
Player:SendMessage("Dropper at {" .. BlockX .. ", " .. BlockY .. ", " .. BlockZ .. "} discharging");
return true;
else
@@ -445,20 +444,20 @@ end
function OnTick()
- -- Activate all dispensers in the g_DispensersToActivate list:
- local ActivateDisp = function(Dispenser)
- if (Dispenser:GetContents():GetFirstUsedSlot() == -1) then
+ -- Activate all dropspensers in the g_DropSpensersToActivate list:
+ local ActivateDrSp = function(DropSpenser)
+ if (DropSpenser:GetContents():GetFirstUsedSlot() == -1) then
return true;
end
- Dispenser:Activate();
+ DropSpenser:Activate();
return false;
end
-
- local idx = #g_DispensersToActivate;
+ -- Walk the list backwards, because we're removing some items
+ local idx = #g_DropSpensersToActivate;
for i = idx, 1, -1 do
- local Disp = g_DispensersToActivate[i];
- if not(Disp.World:DoWithDispenserAt(Disp.x, Disp.y, Disp.z, ActivateDisp)) then
- table.remove(g_DispensersToActivate, i);
+ local DrSp = g_DropSpensersToActivate[i];
+ if not(DrSp.World:DoWithDropSpenserAt(DrSp.x, DrSp.y, DrSp.z, ActivateDrSp)) then
+ table.remove(g_DropSpensersToActivate, i);
end
end