mirror of
https://github.com/lifestorm/wnsrc.git
synced 2025-12-17 13:53:45 +03:00
Upload
This commit is contained in:
71
gamemodes/darkrp/plugins/rave/cl_hooks.lua
Normal file
71
gamemodes/darkrp/plugins/rave/cl_hooks.lua
Normal file
@@ -0,0 +1,71 @@
|
||||
--[[
|
||||
| This file was obtained through the combined efforts
|
||||
| of Madbluntz & Plymouth Antiquarian Society.
|
||||
|
|
||||
| Credits: lifestorm, Gregory Wayne Rossel JR.,
|
||||
| Maloy, DrPepper10 @ RIP, Atle!
|
||||
|
|
||||
| Visit for more: https://plymouth.thetwilightzone.ru/
|
||||
--]]
|
||||
|
||||
|
||||
local PLUGIN = PLUGIN
|
||||
|
||||
local haloColor = haloColor
|
||||
function PLUGIN:PreDrawHalos()
|
||||
if (!self.active or ix.option.Get("drugEffects", true) == false) then return end
|
||||
|
||||
if (CurTime() > self.nextFlash) then
|
||||
haloColor = Color(math.Rand(0, 255), math.Rand(0, 255), math.Rand(0, 255))
|
||||
end
|
||||
|
||||
if (haloColor) then
|
||||
halo.Add(self:GetEntityTargets(), haloColor, 1, 32, 32, true, false)
|
||||
end
|
||||
end
|
||||
|
||||
function PLUGIN:RenderScreenspaceEffects()
|
||||
if (!self.active) then return end
|
||||
|
||||
if (ix.option.Get("drugEffects", true) == false) then
|
||||
local drugHighText = "You are currently high!"
|
||||
|
||||
surface.SetTextColor(239, 37, 14)
|
||||
surface.SetFont("HUDFontExtraLarge")
|
||||
surface.SetTextPos(ScrW() / 2 - (surface.GetTextSize(drugHighText) / 2), 0 + SScaleMin(100 / 3))
|
||||
surface.DrawText(drugHighText)
|
||||
|
||||
surface.SetDrawColor(239, 37, 14, 200)
|
||||
surface.DrawOutlinedRect(0, 0, ScrW(), ScrH(), 10)
|
||||
|
||||
return
|
||||
end
|
||||
|
||||
local tab = {}
|
||||
tab[ "$pp_colour_addr" ] = 0
|
||||
tab[ "$pp_colour_addg" ] = 0
|
||||
tab[ "$pp_colour_addb" ] = 0
|
||||
//tab[ "$pp_colour_brightness" ] = 0
|
||||
//tab[ "$pp_colour_contrast" ] = 1
|
||||
tab[ "$pp_colour_mulr" ] = 0
|
||||
tab[ "$pp_colour_mulg" ] = 0
|
||||
tab[ "$pp_colour_mulb" ] = 0
|
||||
|
||||
tab[ "$pp_colour_colour" ] = 5
|
||||
tab[ "$pp_colour_brightness" ] = -0.21
|
||||
tab[ "$pp_colour_contrast" ] = 0.5
|
||||
|
||||
DrawColorModify( tab )
|
||||
|
||||
--DrawMotionBlur(0.1,1,0.01)
|
||||
--DrawMaterialOverlay("effects/water_warp01",-0.1)
|
||||
DrawSharpen(5,5)
|
||||
DrawBloom(0,0.4,0,0,10,20,1,1,1)
|
||||
--DrawSobel(0.15)
|
||||
end
|
||||
|
||||
function PLUGIN:Think()
|
||||
if (!self.active or ix.option.Get("drugEffects", true) == false) then return end
|
||||
|
||||
self:FFTFlash({14, 15, 16}, 300)
|
||||
end
|
||||
201
gamemodes/darkrp/plugins/rave/cl_plugin.lua
Normal file
201
gamemodes/darkrp/plugins/rave/cl_plugin.lua
Normal file
@@ -0,0 +1,201 @@
|
||||
--[[
|
||||
| This file was obtained through the combined efforts
|
||||
| of Madbluntz & Plymouth Antiquarian Society.
|
||||
|
|
||||
| Credits: lifestorm, Gregory Wayne Rossel JR.,
|
||||
| Maloy, DrPepper10 @ RIP, Atle!
|
||||
|
|
||||
| Visit for more: https://plymouth.thetwilightzone.ru/
|
||||
--]]
|
||||
|
||||
|
||||
local PLUGIN = PLUGIN
|
||||
if (PLUGIN.active == nil) then
|
||||
PLUGIN.active = false
|
||||
else
|
||||
PLUGIN.active = PLUGIN.active
|
||||
end
|
||||
|
||||
local DRUG_NUM_OF_SONGS = 5
|
||||
|
||||
PLUGIN.music = {
|
||||
"https://willard.network/game/drugs/oasis.mp3",
|
||||
"https://willard.network/game/drugs/iloveit.mp3",
|
||||
"https://willard.network/game/drugs/silhouettes.mp3",
|
||||
"https://willard.network/game/drugs/nero.mp3",
|
||||
"https://willard.network/game/drugs/greyhound.mp3",
|
||||
"https://willard.network/game/drugs/ruiner.mp3",
|
||||
"https://willard.network/game/drugs/majesty.mp3",
|
||||
"https://willard.network/game/drugs/blahblahblah.mp3",
|
||||
"https://willard.network/game/drugs/desire.mp3",
|
||||
"https://willard.network/game/drugs/tidalwave.mp3",
|
||||
"https://willard.network/game/drugs/solarsystem.mp3",
|
||||
"https://willard.network/game/drugs/skrillex.mp3",
|
||||
}
|
||||
|
||||
net.Receive("ixRaveDrug", function(len)
|
||||
if (net.ReadBool()) then
|
||||
PLUGIN:Apply()
|
||||
else
|
||||
PLUGIN:Clear()
|
||||
end
|
||||
end)
|
||||
|
||||
function PLUGIN:GetEntityTargets()
|
||||
local entities = ents.GetAll()
|
||||
local targets = {}
|
||||
for i = 1, #entities do
|
||||
local ent = entities[i]
|
||||
if (!IsValid(ent)) then continue end
|
||||
if (ent:IsPlayer() or ent:IsNPC() or ent:IsNextBot()) then
|
||||
targets[#targets + 1] = ent
|
||||
end
|
||||
end
|
||||
|
||||
return targets
|
||||
end
|
||||
|
||||
function PLUGIN:Apply()
|
||||
self.songs = 0
|
||||
|
||||
if (!self.active) then
|
||||
self.nextFlash = 0
|
||||
self.active = true
|
||||
|
||||
if (ix.option.Get("drugEffects", true) == false) then
|
||||
|
||||
return
|
||||
end
|
||||
|
||||
LocalPlayer():ScreenFade(SCREENFADE.IN, Color(0, 0, 0, 255), 3, 1)
|
||||
self:Music()
|
||||
end
|
||||
end
|
||||
|
||||
function PLUGIN:Clear()
|
||||
self.active = false
|
||||
if (self.sound ~= nil and IsValid(self.sound)) then
|
||||
self.sound:Stop()
|
||||
self.sound = nil
|
||||
end
|
||||
|
||||
timer.Remove("ixRaveMusic")
|
||||
|
||||
for k, v in ipairs(self:GetEntityTargets()) do
|
||||
v:DisableMatrix("RenderMultiply")
|
||||
end
|
||||
end
|
||||
|
||||
function PLUGIN:Music()
|
||||
if (!self.active) then return end
|
||||
|
||||
if (self.songs >= math.min(#self.music, DRUG_NUM_OF_SONGS)) then
|
||||
net.Start("ixRaveDrug")
|
||||
net.SendToServer()
|
||||
return
|
||||
--self:Clear(LocalPlayer())
|
||||
end
|
||||
|
||||
if (!self.toPlay or #self.toPlay == 0) then
|
||||
self.toPlay = {}
|
||||
for i = 1, #self.music do self.toPlay[i] = i end
|
||||
end
|
||||
|
||||
local random = math.random(1, #self.toPlay)
|
||||
local url = self.music[self.toPlay[random]]
|
||||
table.remove(self.toPlay, random)
|
||||
|
||||
sound.PlayURL(url, "noplay", function (s, errId, err)
|
||||
if (!s and self.fails < 5) then
|
||||
-- If this fails, try another.
|
||||
self.fails = (self.fails or 0) + 1
|
||||
return self:Music()
|
||||
end
|
||||
|
||||
self.fails = 0
|
||||
self.sound = s
|
||||
s:Play()
|
||||
s:SetVolume(2.0)
|
||||
|
||||
self.songs = self.songs + 1
|
||||
self.song = url
|
||||
|
||||
timer.Create("ixRaveMusic", s:GetLength(), 1, function () self:Music() end)
|
||||
end)
|
||||
end
|
||||
|
||||
function PLUGIN:FFTFlash(triggerBands, threshold)
|
||||
if (not self.sound or not IsValid(self.sound) or self.sound:GetState() ~= GMOD_CHANNEL_PLAYING) then
|
||||
return false
|
||||
end
|
||||
|
||||
local s = self.sound
|
||||
local bands = {}
|
||||
local bandThickness = 18
|
||||
local bandMaxHeight = ((ScrH()/3) * 2) - 75
|
||||
local amp = 5000
|
||||
local dext = 2
|
||||
local offset = 0
|
||||
local realBands = {}
|
||||
|
||||
self.sound:FFT(bands , FFT_8192)
|
||||
for i = 1 , 64 do
|
||||
if (bands[i + offset] * amp > bandMaxHeight) then
|
||||
bands[i + offset] = bandMaxHeight / amp
|
||||
end
|
||||
|
||||
if (bands[i + offset] * amp < 2) then
|
||||
bands[i + offset] = 2
|
||||
else
|
||||
bands[i + offset] = bands[i + offset] * amp
|
||||
end
|
||||
|
||||
realBands[i] = Lerp(30*FrameTime(),realBands[i] or 0,bands[i + offset])
|
||||
if (i < 63 and i > 2) then
|
||||
local a = realBands[i] or 0
|
||||
local b = realBands[i + 1] or 0
|
||||
local c = realBands[i - 1] or 0
|
||||
realBands[i] = (a+b+c) / 3
|
||||
elseif (i < 3) then
|
||||
local a = realBands[i] or 0
|
||||
local b = realBands[i + 1] or 0
|
||||
local c = 0
|
||||
realBands[i] = (a+b+c) / 3
|
||||
end
|
||||
end
|
||||
|
||||
--print(sum)
|
||||
--print(realBands[15])
|
||||
local amp2 = 0
|
||||
for k, v in pairs(triggerBands) do
|
||||
amp2 = amp2 + realBands[v]
|
||||
end
|
||||
|
||||
if (amp2 > threshold and CurTime() > self.nextFlash) then
|
||||
LocalPlayer():ScreenFade(SCREENFADE.IN, Color(math.Rand(200, 255), math.Rand(200, 255), math.Rand(200, 255), 80), 0.4, 0)
|
||||
|
||||
self.nextFlash = CurTime() + 0.2
|
||||
|
||||
-- Light
|
||||
local dl = DynamicLight(LocalPlayer():EntIndex())
|
||||
if (dl) then
|
||||
dl.pos = LocalPlayer():GetPos()
|
||||
dl.r = 255
|
||||
dl.g = 192
|
||||
dl.b = 255
|
||||
dl.brightness = 2
|
||||
dl.Decay = 1000
|
||||
dl.Size = 4096
|
||||
dl.DieTime = CurTime() + 1.0
|
||||
end
|
||||
|
||||
self.dl = dl
|
||||
local scaleMatrix = Matrix()
|
||||
local factor = math.Clamp(1 + math.sin(CurTime()), 0.4, 0.8)
|
||||
scaleMatrix:Scale(Vector(factor, factor, factor))
|
||||
|
||||
for k, v in ipairs(self:GetEntityTargets()) do
|
||||
v:EnableMatrix("RenderMultiply", scaleMatrix)
|
||||
end
|
||||
end
|
||||
end
|
||||
26
gamemodes/darkrp/plugins/rave/items/sh_rave.lua
Normal file
26
gamemodes/darkrp/plugins/rave/items/sh_rave.lua
Normal file
@@ -0,0 +1,26 @@
|
||||
--[[
|
||||
| This file was obtained through the combined efforts
|
||||
| of Madbluntz & Plymouth Antiquarian Society.
|
||||
|
|
||||
| Credits: lifestorm, Gregory Wayne Rossel JR.,
|
||||
| Maloy, DrPepper10 @ RIP, Atle!
|
||||
|
|
||||
| Visit for more: https://plymouth.thetwilightzone.ru/
|
||||
--]]
|
||||
|
||||
|
||||
-- Original item by Xalphox, used on HL2RP with his permission
|
||||
|
||||
ITEM.name = "RAVE"
|
||||
ITEM.model = Model("models/willardnetworks/skills/medx.mdl")
|
||||
ITEM.description = "A hallucinogenic party drug designed to induce the powerful sensation of being in a rave."
|
||||
ITEM.category = "Drugs"
|
||||
|
||||
ITEM.colorAppendix = {["red"] = "EPILEPSY WARNING! Lots of flashing colors upon using this."}
|
||||
|
||||
local PLUGIN = PLUGIN
|
||||
ITEM.functions.Consume = {
|
||||
OnRun = function (item)
|
||||
PLUGIN:Apply(item.player)
|
||||
end
|
||||
}
|
||||
19
gamemodes/darkrp/plugins/rave/sh_plugin.lua
Normal file
19
gamemodes/darkrp/plugins/rave/sh_plugin.lua
Normal file
@@ -0,0 +1,19 @@
|
||||
--[[
|
||||
| This file was obtained through the combined efforts
|
||||
| of Madbluntz & Plymouth Antiquarian Society.
|
||||
|
|
||||
| Credits: lifestorm, Gregory Wayne Rossel JR.,
|
||||
| Maloy, DrPepper10 @ RIP, Atle!
|
||||
|
|
||||
| Visit for more: https://plymouth.thetwilightzone.ru/
|
||||
--]]
|
||||
|
||||
|
||||
PLUGIN.name = "Rave"
|
||||
PLUGIN.author = "Xalphox & Gr4Ss"
|
||||
PLUGIN.description = "Adds in the one and only rave drugs"
|
||||
|
||||
ix.util.Include("cl_hooks.lua")
|
||||
ix.util.Include("cl_plugin.lua")
|
||||
ix.util.Include("sv_hooks.lua")
|
||||
ix.util.Include("sv_plugin.lua")
|
||||
16
gamemodes/darkrp/plugins/rave/sv_hooks.lua
Normal file
16
gamemodes/darkrp/plugins/rave/sv_hooks.lua
Normal file
@@ -0,0 +1,16 @@
|
||||
--[[
|
||||
| This file was obtained through the combined efforts
|
||||
| of Madbluntz & Plymouth Antiquarian Society.
|
||||
|
|
||||
| Credits: lifestorm, Gregory Wayne Rossel JR.,
|
||||
| Maloy, DrPepper10 @ RIP, Atle!
|
||||
|
|
||||
| Visit for more: https://plymouth.thetwilightzone.ru/
|
||||
--]]
|
||||
|
||||
|
||||
local PLUGIN = PLUGIN
|
||||
|
||||
function PLUGIN:PlayerLoadedCharacter(client, character, lastChar)
|
||||
self:Clear(client)
|
||||
end
|
||||
51
gamemodes/darkrp/plugins/rave/sv_plugin.lua
Normal file
51
gamemodes/darkrp/plugins/rave/sv_plugin.lua
Normal file
@@ -0,0 +1,51 @@
|
||||
--[[
|
||||
| This file was obtained through the combined efforts
|
||||
| of Madbluntz & Plymouth Antiquarian Society.
|
||||
|
|
||||
| Credits: lifestorm, Gregory Wayne Rossel JR.,
|
||||
| Maloy, DrPepper10 @ RIP, Atle!
|
||||
|
|
||||
| Visit for more: https://plymouth.thetwilightzone.ru/
|
||||
--]]
|
||||
|
||||
|
||||
local PLUGIN = PLUGIN
|
||||
|
||||
util.AddNetworkString("ixRaveDrug")
|
||||
|
||||
net.Receive("ixRaveDrug", function(len, client)
|
||||
PLUGIN:Clear(client)
|
||||
end)
|
||||
|
||||
ix.log.AddType("drugsRaveRanOut", function(client)
|
||||
return string.format("%s raved too hard and could not stand his rave running out.", client:GetName())
|
||||
end, FLAG_DANGER)
|
||||
|
||||
function PLUGIN:Apply(client)
|
||||
net.Start("ixRaveDrug")
|
||||
net.WriteBool(true)
|
||||
net.Send(client)
|
||||
client:GetCharacter():SetSpecialBoost("strength", 5, true)
|
||||
if (!client:GetNetVar("ixRave")) then
|
||||
local oldMaxHealth = client:GetMaxHealth()
|
||||
client:SetMaxHealth(client:GetMaxHealth() * 2)
|
||||
client:SetHealth(math.min(client:GetMaxHealth(), client:Health() + oldMaxHealth))
|
||||
client:SetNetVar("ixRave", true)
|
||||
end
|
||||
end
|
||||
|
||||
function PLUGIN:Clear(client)
|
||||
net.Start("ixRaveDrug")
|
||||
net.WriteBool(false)
|
||||
net.Send(client)
|
||||
if (client:GetNetVar("ixRave")) then
|
||||
if (client:Health() < client:GetMaxHealth() / 2) then
|
||||
client:Kill()
|
||||
ix.log.Add(client, "drugsRaveRanOut")
|
||||
return
|
||||
end
|
||||
client:SetHealth(client:Health() - client:GetMaxHealth() / 2)
|
||||
client:SetMaxHealth(client:GetMaxHealth() / 2)
|
||||
client:SetNetVar("ixRave", false)
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user