diff options
author | madmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6> | 2013-07-12 22:01:25 +0200 |
---|---|---|
committer | madmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6> | 2013-07-12 22:01:25 +0200 |
commit | 4fb771f3fffb63d8c54c9201ca6d2ce21bd09e5f (patch) | |
tree | 9b4f5f3e7da05719a3458c2d0e2a9694764b48c5 /MCServer | |
parent | Added the cFastRandom class (diff) | |
download | cuberite-4fb771f3fffb63d8c54c9201ca6d2ce21bd09e5f.tar cuberite-4fb771f3fffb63d8c54c9201ca6d2ce21bd09e5f.tar.gz cuberite-4fb771f3fffb63d8c54c9201ca6d2ce21bd09e5f.tar.bz2 cuberite-4fb771f3fffb63d8c54c9201ca6d2ce21bd09e5f.tar.lz cuberite-4fb771f3fffb63d8c54c9201ca6d2ce21bd09e5f.tar.xz cuberite-4fb771f3fffb63d8c54c9201ca6d2ce21bd09e5f.tar.zst cuberite-4fb771f3fffb63d8c54c9201ca6d2ce21bd09e5f.zip |
Diffstat (limited to 'MCServer')
-rw-r--r-- | MCServer/Plugins/Debuggers/Debuggers.lua | 43 |
1 files changed, 41 insertions, 2 deletions
diff --git a/MCServer/Plugins/Debuggers/Debuggers.lua b/MCServer/Plugins/Debuggers/Debuggers.lua index e2124c079..e2523e63e 100644 --- a/MCServer/Plugins/Debuggers/Debuggers.lua +++ b/MCServer/Plugins/Debuggers/Debuggers.lua @@ -5,6 +5,8 @@ ShouldDumpFunctions = true; -- If set to true, all available functions are writ g_DropSpensersToActivate = {}; -- A list of dispensers and droppers (as {World, X, Y Z} quadruplets) that are to be activated every tick
+g_HungerReportTick = 10;
+
@@ -29,6 +31,8 @@ function Initialize(Plugin) 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");
-- Enable the following line for BlockArea / Generator interface testing:
-- PluginManager:AddHook(Plugin, cPluginManager.HOOK_CHUNK_GENERATED);
@@ -480,6 +484,19 @@ function OnTick() GCOnTick = GCOnTick - 1;
end
+ --[[
+ if (g_HungerReportTick > 0) then
+ g_HungerReportTick = g_HungerReportTick - 1;
+ else
+ g_HungerReportTick = 10;
+ cRoot:Get():GetDefaultWorld():ForEachPlayer(
+ function(a_Player)
+ a_Player:SendMessage("FoodStat: " .. a_Player:GetFoodLevel() .. " / " .. a_Player:GetFoodExhaustionLevel());
+ end
+ );
+ end
+ ]]
+
return false;
end
@@ -502,6 +519,14 @@ end +function OnChat(a_Player, a_Message)
+ return false, "blabla " .. a_Message;
+end
+
+
+
+
+
-- Function "round" copied from http://lua-users.org/wiki/SimpleRound
function round(num, idp)
local mult = 10^(idp or 0)
@@ -669,8 +694,22 @@ end; -function OnChat(a_Player, a_Message)
- return false, "blabla " .. a_Message;
+function HandleHungerCmd(a_Split, a_Player)
+ a_Player:SendMessage("FoodLevel: " .. a_Player:GetFoodLevel());
+ a_Player:SendMessage("FoodSaturationLevel: " .. a_Player:GetFoodSaturationLevel());
+ a_Player:SendMessage("FoodTickTimer: " .. a_Player:GetFoodTickTimer());
+ a_Player:SendMessage("FoodExhaustionLevel: " .. a_Player:GetFoodExhaustionLevel());
+ a_Player:SendMessage("FoodPoisonedTicksRemaining: " .. a_Player:GetFoodPoisonedTicksRemaining());
+ return true;
+end
+
+
+
+
+
+function HandlePoisonCmd(a_Split, a_Player)
+ a_Player:FoodPoison(15 * 20);
+ return true;
end
|