1
0

Debuggers: added the /starve and /fl (foodlevel) commands for manipulating player food level

This commit is contained in:
madmaxoft 2013-07-28 16:01:56 +02:00
parent 0caadbb25c
commit 64845e81b3

View File

@ -33,6 +33,8 @@ function Initialize(Plugin)
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");
-- Enable the following line for BlockArea / Generator interface testing:
-- PluginManager:AddHook(Plugin, cPluginManager.HOOK_CHUNK_GENERATED);
@ -715,3 +717,28 @@ end
function HandleStarveCmd(a_Split, a_Player)
a_Player:SetFoodLevel(0);
a_Player:SendMessage("You are now starving");
return true;
end
function HandleFoodLevelCmd(a_Split, a_Player)
if (#a_Split ~= 2) then
a_Player:SendMessage("Missing an argument: the food level to set");
return true;
end
a_Player:SetFoodLevel(tonumber(a_Split[2]));
a_Player:SendMessage("Food level set to " .. a_Player:GetFoodLevel());
return true;
end