Fixed sprinting in 1.6.1, made speeds available through API; fixed messages containing quotes.
Fixes FS #415 git-svn-id: http://mc-server.googlecode.com/svn/trunk@1660 0a769ca7-a7f5-676a-18bf-c427514a06d6
This commit is contained in:
@@ -27,6 +27,8 @@ function Initialize(Plugin)
|
||||
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");
|
||||
|
||||
-- Enable the following line for BlockArea / Generator interface testing:
|
||||
-- PluginManager:AddHook(Plugin, cPluginManager.HOOK_CHUNK_GENERATED);
|
||||
@@ -633,6 +635,40 @@ end
|
||||
|
||||
|
||||
|
||||
function HandleFastCmd(a_Split, a_Player)
|
||||
if (a_Player:GetNormalMaxSpeed() <= 0.11) then
|
||||
-- The player has normal speed, set double speed:
|
||||
a_Player:SetNormalMaxSpeed(0.2);
|
||||
a_Player:SendMessage("You are now fast");
|
||||
else
|
||||
-- The player has fast speed, set normal speed:
|
||||
a_Player:SetNormalMaxSpeed(0.1);
|
||||
a_Player:SendMessage("Back to normal speed");
|
||||
end
|
||||
return true;
|
||||
end
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
function HandleDashCmd(a_Split, a_Player)
|
||||
if (a_Player:GetSprintingMaxSpeed() <= 0.14) then
|
||||
-- The player has normal sprinting speed, set double Sprintingspeed:
|
||||
a_Player:SetSprintingMaxSpeed(0.4);
|
||||
a_Player:SendMessage("You can now sprint very fast");
|
||||
else
|
||||
-- The player has fast sprinting speed, set normal sprinting speed:
|
||||
a_Player:SetSprintingMaxSpeed(0.13);
|
||||
a_Player:SendMessage("Back to normal sprinting");
|
||||
end
|
||||
return true;
|
||||
end;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
function OnChat(a_Player, a_Message)
|
||||
return false, "blabla " .. a_Message;
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user