AddCSLuaFile("shared.lua") include("shared.lua") ENT.MODEL = "models/ipha/mushroom_small.mdl" --if GetConVar("durgz_roleplay"):GetBool() then ENT.MODEL = "models/jellik/shroom.mdl" end ENT.MASS = 55; ENT.LASTINGEFFECT = 60; --how long the high lasts in seconds ENT.SPEED_SCALE = 5 --local LASTINGEFFECT = ENT.LASTINGEFFECT --called when you use it (after it sets the high visual values and removes itself already) function ENT:High(activator,caller) local health = activator:Health() if (health * 3 / 2 < 500) then activator:SetHealth (math.floor(health + 5)) else activator:SetHealth(health + 5) end if not self:Realistic() then if activator:Alive() then sound.Play("durgz/mushroom/powerup.wav", activator:GetPos(), 75, 100, 1) end activator:SetGravity(5); activator:SetJumpPower(DEFAULT_JUMP_POWER^2); -- really, i should have jump_scale and speed_scale built into the base, 1 is default --activator:SetWalkSpeed(DEFAULT_WALK_SPEED*self.SPEED_SCALE) activator:SetRunSpeed(DEFAULT_WALK_SPEED*self.SPEED_SCALE) end self:Say(activator, "what") end function ENT:AfterHigh(activator, caller) end hook.Add("GetFallDamage", "durgz_mushroom_fall", function(pl) if pl:GetNWFloat("durgz_mushroom_high_start") > 0 && pl:GetNWFloat("durgz_mushroom_high_end") > CurTime() then return 0 end end) hook.Add("OnPlayerJump","durgz_mushroom_jump",function(pl) if GetConVar("durgz_roleplay"):GetBool() then return end if pl:GetNWFloat("durgz_mushroom_high_start") > 0 && pl:GetNWFloat("durgz_mushroom_high_end") > CurTime() then sound.Play("durgz/mushroom/jump.wav", pl:GetPos(), 75, 100, 1) else return end end) hook.Add("DoPlayerDeath","durgz_mushroom_death",function(pl) if GetConVar("durgz_roleplay"):GetBool() then return end if pl:GetNWFloat("durgz_mushroom_high_start") > 0 && pl:GetNWFloat("durgz_mushroom_high_end") > CurTime() then sound.Play("durgz/mushroom/die.wav", pl:GetPos(), 75, 100, 1) else return end end) local function ResetGrav() for id, pl in pairs(player.GetAll()) do if (pl:GetNWFloat("durgz_mushroom_high_end") - 0.5 < CurTime() && pl:GetNWFloat("durgz_mushroom_high_end") > CurTime() ) then pl:SetWalkSpeed(DEFAULT_WALK_SPEED) --set speed back to normal pl:SetRunSpeed(DEFAULT_RUN_SPEED) --set speed back to normal pl:SetGravity(DEFAULT_GRAVITY) --no more floating pl:SetJumpPower(DEFAULT_JUMP_POWER) --no more big jump end end end hook.Add("Think", "durgz_mushroom_resetgrav", ResetGrav)