Skip to content

Commit

Permalink
Bug fix, Hooks Add.
Browse files Browse the repository at this point in the history
  • Loading branch information
10sa committed Apr 7, 2017
1 parent 771f1b9 commit 35bc5f6
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 16 deletions.
2 changes: 1 addition & 1 deletion nutscript/gamemode/sh_config.lua
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ end
nut.config = nut.config or {}

// Don't Touch This, This's Version Counter. //
nut.config.frameworkVersion = "0.18.2";
nut.config.frameworkVersion = "0.19.2";

-- What language Nutscript shall use.
nut.config.language = "korean"
Expand Down
15 changes: 4 additions & 11 deletions nutscript/plugins/improvedcooking/sv_plugin.lua
Original file line number Diff line number Diff line change
Expand Up @@ -41,18 +41,14 @@ local math_Clamp = math.Clamp
function PLUGIN:Think()

local curTime = CurTime()

if HUNGER_RATE < curTime then
for _, player in pairs( player.GetAll() ) do
local character = player.characterlocal hunger_curtime = 0;
local thirst_curtime = 0;
local character = player.character;
local thirst_curtime = 0;

if character then
local hunger = character:GetVar("hunger", 0)
if(math.random(1, 50) <= 1) then
continue
end


character:SetVar("hunger", math_Clamp( hunger - math.random(1, 3), 0, HUNGER_MAX ))

-------------------------------------------------------------------------------
Expand All @@ -76,10 +72,7 @@ local thirst_curtime = 0;

if character then
local thirst = character:GetVar("thirst", 0)
if(math.random(1, 50) <= 1) then
continue
end


character:SetVar("thirst", math.Clamp( thirst - math.random(1, 3), 0, THIRST_MAX ))

-------------------------------------------------------------------------------
Expand Down
11 changes: 7 additions & 4 deletions nutscript/plugins/improvedstamina/sv_hooks.lua
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,17 @@ function PLUGIN:PlayerLoadedChar(client)
end;
end;
end;

client:SetRunSpeed(math.Max(nut.config.walkSpeed / 2, (nut.config.runSpeed * 1.25) + (client:GetAttrib(ATTRIB_SPD, 1) * 0.25) - (100 / (math.Max(client.character:GetVar("stamina"), 1) * 0.5))));
client:SetWalkSpeed(math.Max(nut.config.walkSpeed / 2, (nut.config.walkSpeed * 1.25) + (client:GetAttrib(ATTRIB_SPD, 1) * 0.05) - (100 / (math.Max(client.character:GetVar("stamina"), 1) * 0.5))));
client:SetRunSpeed(hook.Run("PlayerGetRunSpeed", client, math.Max(nut.config.walkSpeed / 2, (nut.config.runSpeed * 1.25) + (client:GetAttrib(ATTRIB_SPD, 1) * 0.25) - (100 / (math.Max(client.character:GetVar("stamina"), 1) * 0.5)))));
client:SetWalkSpeed(hook.Run("PlayerGetWalkSpeed", client, math.Max(nut.config.walkSpeed / 2, (nut.config.walkSpeed * 1.25) + (client:GetAttrib(ATTRIB_SPD, 1) * 0.05) - (100 / (math.Max(client.character:GetVar("stamina"), 1) * 0.5)))));
end);
end

function PLUGIN:PlayerSpawn(client)
if (client.character) then
client.character:SetVar("stamina", client.character:GetData("stamina") or 100);
end
end
end

function PLUGIN:PlayerGetRunSpeed(client, calcSpeed) return calcSpeed; end;
function PLUGIN:PlayerGetWalkSpeed(client, calcSpeed) return calcSpeed; end;

0 comments on commit 35bc5f6

Please sign in to comment.