Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- AddCSLuaFile()
- AddCSLuaFile("von.lua")
- include("von.lua")
- AddCSLuaFile("sans_shared.lua")
- include("sans_shared.lua")
- AddCSLuaFile("s_mathematics.lua")
- include( "s_mathematics.lua" )
- SWEP.Base = "weapon_base"
- SWEP.PrintName = "Sans' Abilities"
- SWEP.Purpose = "You're gonna have a BAD 15 minutes."
- SWEP.Slot = 1
- SWEP.SlotPos = 2
- SWEP.Spawnable = false
- SWEP.AdminSpawnable = false
- SWEP.AdminOnly = false
- SWEP.Category = "Glitchtale"
- SWEP.ViewModel = "models/koperplyar/sans/vm.mdl"
- SWEP.WorldModel = ""
- SWEP.UseHands = true
- SWEP.Primary.Automatic = true
- SWEP.Primary.Ammo = "none"
- SWEP.Primary.ClipSize = 0
- SWEP.Primary.DefaultClip = 0
- SWEP.Secondary.Automatic = true
- SWEP.Secondary.Ammo = "none"
- SWEP.Secondary.ClipSize = 0
- SWEP.Secondary.DefaultClip = 0
- SWEP.HoldType = "normal"
- SWEP.DrawCrosshair = true
- if CLIENT then
- SWEP.WepSelectIcon = surface.GetTextureID("weapons/vgui/gtsansabilities")
- killicon.Add( "glitchtale_sans", "weapons/vgui/telekinesisspikedboneorblaster", color_white )
- end
- SWEP.VElements = {
- ["1"] = { type = "Sprite", sprite = "sprites/physcannon_blueglow", bone = "ValveBiped.Bip01_R_Hand", rel = "", pos = Vector(3,1,0), size={x=20,y=20}, color = Color(255, 255, 255), nocull = true, additive = true, vertexalpha = true, vertexcolor = true, ignorez = false},
- ["2"] = { type = "Sprite", sprite = "sprites/physcannon_blueglow", bone = "ValveBiped.Bip01_L_Hand", rel = "", pos = Vector(2,1,0), size={x=20,y=20}, color = Color(255, 255, 255), nocull = true, additive = true, vertexalpha = true, vertexcolor = true, ignorez = false}
- }
- SWEP.WElements = {
- ["1"] = { type = "Sprite", sprite = "sprites/physcannon_blueglow", bone = "ValveBiped.Bip01_R_Hand", rel = "", pos = Vector(2.986, 0.439, 0), size = { x = 20, y = 20 }, color = Color(255, 255, 255, 255), nocull = true, additive = true, vertexalpha = true, vertexcolor = true, ignorez = false},
- ["1+"] = { type = "Sprite", sprite = "sprites/physcannon_blueglow", bone = "ValveBiped.Bip01_L_Hand", rel = "", pos = Vector(2.986, 0.439, 0), size = { x = 20, y = 20 }, color = Color(255, 255, 255, 255), nocull = true, additive = true, vertexalpha = true, vertexcolor = true, ignorez = false}
- }
- local secondarydelaybt = 0
- local selecteds
- local tpstopsv
- local d = 0
- local cooked = 0
- function SWEP:Initialize()
- if ( SERVER ) then
- util.AddNetworkString( "gbresetcount" )
- util.AddNetworkString( "teleportnownet" )
- util.AddNetworkString("tpeffects")
- util.AddNetworkString("tpeffects_everybody_can_see")
- util.AddNetworkString("tpeffects_everybody_can_seeCL")
- util.AddNetworkString("tpbeforeeffects")
- util.AddNetworkString("tpselectedtoserver")
- util.AddNetworkString("tpclose")
- util.AddNetworkString("tpclose_reclient")
- util.AddNetworkString("gb_updateclientside")
- util.AddNetworkString("gbaddtotable")
- util.AddNetworkString("gbnotdrivinganymore")
- util.AddNetworkString("gbdrivingupdateclient" .. tostring(self))
- --util.AddNetworkString("shieldeffectso")
- util.AddNetworkString("TeleEntity")
- util.AddNetworkString("UnTeleEntity")
- --util.AddNetworkString("dtsword_dropasoul")
- util.AddNetworkString( "miss" )
- end
- self:SetNWInt("Stre",0)
- self:SetNWInt("Tele",0)
- self:SetNWInt("D",0)
- --self.wantedfarness = victim:GetPos()
- self.wantedfarness = nil
- self.secondarytoggle = 0
- self:SetHoldType("normal")
- secondarydelaybt = 0
- self.Blasters = {}
- self.Blasters_cl = {}
- self.Shield = {}
- self.Blastercount = 0
- self.Victima = nil
- self.AmIDrivingVehicle = nil
- self.AmIDriving = nil
- self.telekanisisstage = 0
- self.panel = nil
- self.primocc = 0
- self.primaryattackoffi = 0
- self.primstab = 0
- self.Owner.Shielding = 0
- self.noteleport = 0
- self.secocc = 0
- self.secondarytoggle = 0
- --self.DMGboost = 0
- --self.BoostupC = nil
- self.zahealu = nil
- hook.Add( "EntityTakeDamage", "Dodge", function( ent, dmginfo )
- if( ent:IsPlayer() && ent:Health() > 0 ) then
- if( ent:GetActiveWeapon():IsValid() && ent:GetVar( "miss", NULL ) != NULL ) then
- if( CurTime() >= ent:GetVar( "miss", NULL ) ) then
- if( ent:GetActiveWeapon():GetClass() == "glitchtale_sans" ) then
- if not(dmginfo:IsDamageType(DMG_BURN + DMG_VEHICLE + DMG_FALL + DMG_BLAST + DMG_DROWN + DMG_RADIATION))then
- --net.Start( "miss" )
- --net.WriteEntity( ent )
- --local dmgpos = dmginfo:GetDamagePosition()
- --if( dmgpos != Vector() ) then
- --net.WriteVector( dmgpos )
- --else
- --net.WriteVector( ent:EyePos() )
- --end
- --net.Broadcast()
- --if not(dmginfo:IsDamageType(DMG_BURN))then
- --else
- --end
- local d=self:GetNWInt("D")
- if d>0||self.Tired then return end
- if not(dmginfo:IsDamageType(DMG_PARALYZE))then
- self:SetNWInt("Stre",math.Clamp(self:GetNWInt("Stre")+10.33,0,GetConVarNumber("gt_sans_sr")))
- else
- self:SetNWInt("Stre",math.Clamp(self:GetNWInt("Stre")+100,0,GetConVarNumber("gt_sans_sr")))
- end
- local s=self.Owner:GetModelScale()
- GT_MissEffect(self.Owner:EyePos()+Vector(0,0,10*s),32*s,2)
- ent:SetVar( "miss", CurTime() + 0.43 )
- self:SetNWInt("D",0.43)
- self.primocc = CurTime() + 0.53
- self.secocc = CurTime() + 0.53
- teleoc = CurTime() + 0.53
- stabocc = CurTime() + 0.53
- local entPos = ent:GetPos()
- local att = ent
- local newPos = ent:GetRight()*math.random(-69.3, 69.3)+entPos
- ent:SetPos(newPos)
- timer.Create("resetview",.001,1,function()
- if IsValid(self.Owner)then
- self.Owner:ViewPunchReset()
- self.Owner:ConCommand("gt_unstuck")
- else
- return false
- end
- end)
- dmginfo:SetDamage( 0 )
- dmginfo:SetDamageForce( Vector( 0, 0, 0 ) )
- dmginfo:SetDamageType( 0 )
- dmginfo:SetDamageBonus( 0 )
- local dodgeranduma = math.random(1,6)
- if(dodgeranduma == 1)then
- ent:EmitSound( Sound( "Weapon_Crowbar.Single" ), 75, math.random(80,100), 1, CHAN_AUTO )
- elseif(dodgeranduma == 2)then
- ent:EmitSound( Sound( "weapons/stunstick/stunstick_swing1.wav" ), 75, math.random(80,100), 1, CHAN_AUTO )
- elseif(dodgeranduma == 3)then
- ent:EmitSound( Sound( "weapons/stunstick/stunstick_swing2.wav" ), 75, math.random(80,100), 1, CHAN_AUTO )
- elseif(dodgeranduma == 4)then
- ent:EmitSound( Sound( "npc/vort/claw_swing1.wav" ), 75, math.random(80,100), 1, CHAN_AUTO )
- elseif(dodgeranduma == 5)then
- ent:EmitSound( Sound( "npc/vort/claw_swing2.wav" ), 75, math.random(80,100), 1, CHAN_AUTO )
- elseif(dodgeranduma == 6)then
- ent:EmitSound( Sound( "weapons/iceaxe/iceaxe_swing1.wav" ), 75, math.random(80,100), 1, CHAN_AUTO )
- end
- end
- end
- end
- end
- end
- end)
- if CLIENT then
- -- Create a new table for every weapon instance
- self.VElements = table.FullCopy( self.VElements )
- self.WElements = table.FullCopy( self.WElements )
- self.ViewModelBoneMods = table.FullCopy( self.ViewModelBoneMods )
- self:CreateModels(self.VElements) -- create viewmodels
- self:CreateModels(self.WElements) -- create worldmodels
- -- init view model bone build function
- if IsValid(self.Owner) then
- local vm = self.Owner:GetViewModel()
- if IsValid(vm) then
- self:ResetBonePositions(vm)
- -- Init viewmodel visibility
- if (self.ShowViewModel == nil or self.ShowViewModel) then
- vm:SetColor(Color(255,255,255,255))
- else
- -- we set the alpha to 1 instead of 0 because else ViewModelDrawn stops being called
- vm:SetColor(Color(255,255,255,1))
- -- ^ stopped working in GMod 13 because you have to do Entity:SetRenderMode(1) for translucency to kick in
- -- however for some reason the view model resets to render mode 0 every frame so we just apply a debug material to prevent it from drawing
- vm:SetMaterial("Debug/hsv")
- end
- end
- end
- end
- end
- if( CLIENT ) then
- net.Receive( "miss", function()
- local ply = net.ReadEntity()
- local vec = net.ReadVector()
- --print( ply, vec )
- local emitter = ParticleEmitter( vec, false )
- local particle = emitter:Add( Material( "undertale/miss" ), vec )
- if( particle ) then
- particle:SetVelocity( Vector( 0, 0, 10 ) )
- particle:SetColor( 255, 255, 255 )
- particle:SetLifeTime( 0 )
- particle:SetDieTime( 2 )
- particle:SetStartSize( 10 )
- particle:SetEndSize( 10 )
- particle:SetStartAlpha( 255 )
- particle:SetEndAlpha( 0 )
- particle:SetGravity( Vector( 0, 0, 0 ) )
- end
- emitter:Finish()
- end )
- end
- if CLIENT then
- local teledEntities = {}
- net.Receive("TeleEntity", function()
- local ent = net.ReadEntity()
- teledEntities[ent] = true
- end)
- net.Receive("UnTeleEntity", function()
- local ent = net.ReadEntity()
- if teledEntities[ent] then
- teledEntities[ent] = nil
- end
- end)
- hook.Add("PreDrawHalos", "AddHalosToteledEntitiesSanesss", function()
- halo.Add(table.GetKeys(teledEntities), Color(0, 155, 255), 5, 5, 2, true, false)
- end)
- end
- function SWEP:Deploy()
- self:SendWeaponAnim( 174 )
- return true
- end
- function SWEP:OnDrop( )
- if(self.Owner:GetModel() == "models/sansplayer/sansplayer.mdl") then
- self.Owner:SetBodygroup( 1, 0 )
- self.Owner:SetBodygroup( 2, 0 )
- end
- if(self.Owner:GetModel() == "models/nia/sans_pm.mdl") then
- self.Owner:SetBodygroup( 2, 0 )
- end
- end
- function SWEP:Holster( wep )
- if CLIENT and IsValid(self.Owner) then
- local vm = self.Owner:GetViewModel()
- if IsValid(vm) then
- self:ResetBonePositions(vm)
- end
- end
- if( CLIENT ) then return end
- if( !IsFirstTimePredicted() ) then return end
- self.Owner:DoAnimationEvent( ACT_GMOD_IN_CHAT )
- self.Owner:ManipulateBoneAngles( self.Owner:LookupBone( "ValveBiped.Bip01_R_Clavicle" ), Angle( 0, 0, 0 ) )
- self.Owner:ManipulateBoneAngles( self.Owner:LookupBone( "ValveBiped.Bip01_L_Clavicle" ), Angle( 0, 0, 0 ) )
- self.Owner:ManipulateBoneAngles( self.Owner:LookupBone( "ValveBiped.Bip01_R_Forearm" ), Angle( 0, 0, 0 ) )
- self.Owner:ManipulateBoneAngles( self.Owner:LookupBone( "ValveBiped.Bip01_L_Forearm" ), Angle( 0, 0, 0 ) )
- self.Owner:ManipulateBoneAngles( self.Owner:LookupBone( "ValveBiped.Bip01_R_Hand" ), Angle( 0, 0, 0 ) )
- self.Owner:ManipulateBoneAngles( self.Owner:LookupBone( "ValveBiped.Bip01_L_Hand" ), Angle( 0, 0, 0 ) )
- self:SetVar( "anim_reset", true )
- if(self.Owner:GetModel() == "models/sansplayer/sansplayer.mdl") then
- self.Owner:SetBodygroup( 1, 0 )
- self.Owner:SetBodygroup( 2, 0 )
- end
- if(self.Owner:GetModel() == "models/nia/sans_pm.mdl") then
- self.Owner:SetBodygroup( 2, 0 )
- end
- return true
- end
- function SWEP:Equip()
- self.Owner:SetVar( "miss", 0 )
- end
- local newposition = Vector(0,0,0)
- local pdelay = 4
- local pocc = 0
- local primdelay = 0.2
- local gasterblastercount = 0
- local secdelay = 3
- local altctrlnextOccurance = 0
- local altctrldelay = 8
- local saocc = 0
- local sadelay = 0.3
- local istpreallyowner
- local tddelay = 0.5
- local tdocc = 0
- local stabdelay = 0.75
- local stabocc = 0
- local rdelay = 0.2
- local rocc = 0
- SWEP.NextAtt=CurTime()
- function SWEP:PrimaryAttack()
- local primtimleft = self.primocc - CurTime()
- local primtimstableft = self.primstab - CurTime()
- if primtimleft < 0 then
- if(self.Owner.Shielding == 1) then return end
- if IsValid(self.Victima) then if primtimstableft < 0 then self:PiercingBones() self.primstab = CurTime() + 3 end return end
- if self.NextAtt>CurTime()||self.Tired then return end
- if self.AmIDriving == 1 then return end
- if self.primaryattackoffi == 0 then
- self:SetHoldType("pistol")
- self:SendWeaponAnim(179)
- timer.Create("settoprimaryidle" .. tostring(self),0.5,1,function()
- if(IsValid(self))then
- if(self.primaryattackoffi == 1)then
- self:SendWeaponAnim(180)
- end
- end
- end)
- self.primaryattackoffi = 1
- end
- timer.Remove("primaryattackoff" .. tostring(self))
- timer.Create("primaryattackoff" .. tostring(self),0.3,1,function()
- if(IsValid(self))then
- self:SetHoldType("normal")
- self:SendWeaponAnim(181)
- timer.Create("primbacktoidle" .. tostring(self),1,1,function()
- if(IsValid(self))then
- if(self.primaryattackoffi == 0)then
- self:SendWeaponAnim(174)
- end
- end
- end)
- self.primaryattackoffi = 0
- end
- end)
- self:SetNWInt("Stre",math.Clamp(self:GetNWInt("Stre")+2.43,0,GetConVarNumber("gt_sans_sr")))
- if(SERVER)then
- local ent = ents.Create( "ent_glitchtale_bone" )
- local pos = self.Owner:GetShootPos() + VectorRand() * 59 + self.Owner:EyeAngles():Right() * 1
- ent:SetPos( pos )
- ent:SetAngles( ( self.Owner:GetEyeTrace().HitPos - pos ):Angle() + Angle( 90, 0, 0 ) )
- ent:EmitSound( Sound( "undertale/bone_end.wav" ), 53, 100, 1, CHAN_AUTO )
- ent:SetOwner( self.Owner )
- ent:Spawn()
- ent:Activate()
- --local phys = ent:GetPhysicsObject()
- --phys:SetVelocity( ent:GetUp() * math.random(1500,2000) ) --og
- local phys = ent:GetPhysicsObject()
- phys:SetVelocity( ent:GetUp() * math.random(5000,4500) ) --new, adjusted to j. hall (I mean, monster attacks cant do kilometers, right?)
- --local phys = ent:GetPhysicsObject()
- --phys:SetVelocity( ent:GetUp() * 10000 ) --undertale sans abilities
- end
- self.primocc = CurTime() + primdelay
- end
- end
- function SWEP:SecondaryAttack()
- local sectimleft = self.secocc - CurTime()
- if sectimleft < 0 then
- if(self.Owner.Shielding == 1) then return end
- if self.NextAtt>CurTime()||self.Tired then return end
- if not (self.Owner:KeyDown(IN_SPEED)) then
- if not (self.Owner:KeyDown(IN_DUCK)) then
- -- Normal Blaster spawn
- if self.secondarytoggle == 0 then
- if (self.Blastercount < 7) then
- self:SetHoldType("melee")
- self:SendWeaponAnim(182)
- self.secocc = CurTime() + 0.45
- self:SetNWInt("Stre", math.Clamp(self:GetNWInt("Stre") + 2.6, 0, GetConVarNumber("gt_sans_sr")))
- self.Blastercount = self.Blastercount + 1
- if (SERVER) then
- local ent1 = ents.Create("ent_glitchtale_gaster_blaster")
- local pos1 = self.Owner:GetPos()
- ent1:SetAngles((self.Owner:GetEyeTrace().HitPos - pos1):Angle())
- ent1:SetPos(self.Owner:GetPos() + Vector(0, 0, 45) + self.Owner:GetForward() * 50)
- ent1:SetOwner(self.Owner)
- ent1:Spawn()
- ent1:Activate()
- ent1:SetCount(self.Blastercount)
- table.insert(self.Blasters, ent1)
- ent1:CallOnRemove("chrRemoveFromList", function(ent1)
- if IsValid(self) then
- table.RemoveByValue(self.Blasters, ent1)
- end
- end)
- end
- timer.Create("secidletimer" .. tostring(self), 0.6, 1, function()
- if not (IsValid(self)) then return end
- self.secondarytoggle = 1
- end)
- end
- end
- else
- -- Crouching Blaster spawn
- if (SERVER) then
- local eyeTrace = self.Owner:GetEyeTrace() -- Get player's aim trace
- -- Check if the traced target is a valid entity (not the world) and within 6666 units (memo: its double in phase 2 and gaster has it on 7777)
- if not eyeTrace.Hit or not IsValid(eyeTrace.Entity) or eyeTrace.HitWorld or self.Owner:GetPos():Distance(eyeTrace.HitPos) > 6666 then
- self.secocc = CurTime() + 0.3 --(or 1.3)
- return -- Do not spawn if the target is invalid or too far
- end
- -- Running Blaster spawn
- self:SetHoldType("melee")
- self:SendWeaponAnim(182)
- timer.Create("waitbeforebluorgh2", 0.8, 1, function()
- self:SendWeaponAnim(183)
- self:SetHoldType("pistol")
- end)
- timer.Create("backtonormalI2", 2.3, 1, function()
- if (IsValid(self)) then
- self:SendWeaponAnim(174)
- self:SetHoldType("normal")
- self.secondarytoggle = 0
- end
- end)
- self.secocc = CurTime() + 10
- self:SetNWInt("Stre", math.Clamp(self:GetNWInt("Stre") + 13, 0, GetConVarNumber("gt_sans_sr")))
- local entC = ents.Create("ent_glitchtale_gaster_blaster_homing")
- local ownerPos = self.Owner:GetPos()
- local targetPos = eyeTrace.HitPos -- Target position
- -- Generate a randomized direction
- local v = VectorRand()
- if v.z < 0 then v.z = 0 end
- -- Apply random force scaling (adjust as needed)
- local p = Vector(v.x, v.y, v.z) * math.random(3, 773) --should be around 1333 for Gaster
- -- Perform a trace check to adjust position
- local t = util.TraceLine({
- start = targetPos + Vector(0, 0, 60),
- endpos = targetPos + Vector(0, 0, 60) + p,
- filter = self.Owner
- })
- if t.Hit then
- p = t.HitPos + t.HitNormal * 30
- else
- p = targetPos + Vector(0, 0, math.random(-10,60)) + p
- end
- -- Additional positioning adjustment
- p = p + Vector(0, 0, math.random(40,140))
- -- Set final position and orientation
- entC:SetPos(p)
- entC:SetAngles((targetPos - p):Angle())
- entC:SetOwner(self.Owner)
- entC:SetBlasterTarget(eyeTrace.Entity)
- entC:Spawn()
- entC:Activate()
- end
- end
- else
- -- Running Blaster spawn
- self:SetHoldType("melee")
- self:SendWeaponAnim(182)
- timer.Create("waitbeforebluorgh", 0.8, 1, function()
- self:SendWeaponAnim(183)
- self:SetHoldType("pistol")
- end)
- timer.Create("backtonormalI", 2.3, 1, function()
- if (IsValid(self)) then
- self:SendWeaponAnim(174)
- self:SetHoldType("normal")
- self.secondarytoggle = 0
- end
- end)
- self.secocc = CurTime() + 6.66
- self:SetNWInt("Stre", math.Clamp(self:GetNWInt("Stre") + 11.46, 0, GetConVarNumber("gt_sans_sr")))
- if (SERVER) then
- local ent1I = ents.Create("ent_glitchtale_gaster_blaster_instant")
- local pos1I = self.Owner:GetPos()
- ent1I:SetAngles((self.Owner:GetEyeTrace().HitPos - pos1I):Angle())
- ent1I:SetPos(self.Owner:GetPos() + Vector(0, 0, 45) + self.Owner:GetForward() * 53)
- ent1I:SetOwner(self.Owner)
- ent1I:Spawn()
- ent1I:Activate()
- end
- end
- if self.secondarytoggle == 1 then
- self:SetHoldType( "pistol" )
- self:SendWeaponAnim(183)
- self.Blastercount = 0
- if(table.Count(self.Blasters) < 0) then return end
- for num,ent in pairs(self.Blasters) do
- if IsValid(ent) then
- ent:Shootnow()
- self:SetNWInt("Stre",math.Clamp(self:GetNWInt("Stre")+8.86,0,GetConVarNumber("gt_sans_sr")))
- self.secocc = CurTime() + 1.3
- end
- end
- self.Blasters = {}
- timer.Create("secanimebacktoidle" .. tostring(self),1.3,1,function()
- if(IsValid(self))then
- self:SendWeaponAnim(174)
- end
- end)
- timer.Create("backtonormal",1.5,1,function()
- if(IsValid(self))then
- self:SetHoldType( "normal" )
- end
- end)
- self.secocc = CurTime() + 1
- self.secondarytoggle = 0
- end
- end
- end
- --thx wiki
- -- HACK: SetPos does not ensure that the position wont be modified again by the gamemovement.
- -- There is currently no ENTITY:Teleport binding.
- TELEPORT_QUEUE = {}
- hook.Add("FinishMove", "SanessUnstuckTeleport", function(ply, mv)
- local tpData = TELEPORT_QUEUE[ply]
- if tpData ~= nil then
- ply:SetPos(tpData.Pos)
- ply:SetAngles(tpData.Angles)
- timer.Create("donotstucksas",.001,1,function()
- if IsValid(ply)then
- ply:ConCommand("gt_unstuck")
- end
- end)
- TELEPORT_QUEUE[ply] = nil
- return true
- end
- end)
- local function TeleportPlayer(ent, pos, ang, vel)
- -- Mimic IncrementInterpolationFrame, we just make sure we call the things at the right time.
- local data = {}
- data.Pos = pos
- data.Angles = ang
- data.Velocity = vel
- data.Ent = ent
- TELEPORT_QUEUE[ent] = data
- end
- net.Receive( "teleportnownet", function( len, ply )
- local danewpos = net.ReadVector()
- local friends = net.ReadTable()
- teleportnow = 1
- newposition = danewpos
- istpreallyowner = ply
- istpreallyowner:SetNWInt("Stre",math.Clamp(istpreallyowner:GetNWInt("Stre")+50,0,GetConVarNumber("gt_sans_sr")))
- timer.Create("donotstucksasshort",.001,1,function()
- if IsValid(istpreallyowner)then
- istpreallyowner:ConCommand("gt_unstuck")
- end
- end)
- ply.TPFriends = friends
- end )
- net.Receive( "tpeffects", function( len, ply )
- local enti = net.ReadEntity()
- if not ply == enti then return end
- local self = enti:GetWeapon( "glitchtale_sans" )
- if not(IsValid(self))then return end
- if(IsValid(self.Owner)) then
- local vec = self.Owner:GetPos() + Vector(0,0,-30)
- TPEffects(enti, vec, "effects/spark", Vector(0,0,120) + VectorRand() * 25, 2, 0.8, 15, 0, 255, 50, Vector( 0, 0, 40 ))
- if(CLIENT)then
- for i, a in pairs(player.GetAll()) do
- net.Start("tpeffects_everybody_can_see")
- net.WriteEntity(a)
- net.WriteEntity(enti)
- net.WriteVector(vec)
- net.WriteString("effects/spark")
- net.WriteVector(Vector(0,0,120) + VectorRand() * 25)
- net.WriteInt(2,32)
- net.WriteFloat(0.8)
- net.WriteInt(15,32)
- net.WriteInt(0,32)
- net.WriteInt(255,32)
- net.WriteInt(50,32)
- net.WriteVector(Vector( 0, 0, 40 ))
- net.SendToServer()
- end
- end
- end
- end )
- net.Receive( "tpbeforeeffects", function( len, ply )
- local enti = net.ReadEntity()
- local pos = net.ReadVector()
- TPEffects(enti, pos, "particle/smokestack", Vector(0,0,30) + VectorRand() * 30, 1, math.random(4,6), math.random(5,10), math.random(1,3), math.random(20,50), 0, Vector( 0, 0, 5 ))
- if(CLIENT)then
- for i, a in pairs(player.GetAll()) do
- net.Start("tpeffects_everybody_can_see")
- net.WriteEntity(a)
- net.WriteEntity(enti)
- net.WriteVector(pos)
- net.WriteString("particle/smokestack")
- net.WriteVector(Vector(0,0,30) + VectorRand() * 30)
- net.WriteInt(1,32)
- net.WriteFloat(math.random(4,6))
- net.WriteInt(math.random(5,10),32)
- net.WriteInt(math.random(1,3),32)
- net.WriteInt(math.random(20,50),32)
- net.WriteInt(0,32)
- net.WriteVector(Vector( 0, 0, 5 ))
- net.SendToServer()
- end
- end
- end )
- net.Receive("tpeffects_everybody_can_see",function(len,ply)
- --enti, pos, material, velocity, color, dietime, startsize, endsize, stalpha, edalpha, gravity)
- local localpl = net.ReadEntity()
- local enti = net.ReadEntity()
- local pos = net.ReadVector()
- local material = net.ReadString()
- local velocity = net.ReadVector()
- local color = net.ReadInt(32)
- local dietime = net.ReadFloat()
- local startsize = net.ReadInt(32)
- local endsize = net.ReadInt(32)
- local stalpha = net.ReadInt(32)
- local edalpha = net.ReadInt(32)
- local gravity = net.ReadVector()
- if not(IsValid(localpl))then return end
- net.Start("tpeffects_everybody_can_see")
- net.WriteEntity(a)
- net.WriteEntity(enti)
- net.WriteVector(pos)
- net.WriteString(material)
- net.WriteVector(velocity)
- net.WriteInt(color,32)
- net.WriteFloat(dietime)
- net.WriteInt(startsize,32)
- net.WriteInt(endsize,32)
- net.WriteInt(stalpha,32)
- net.WriteInt(edalpha,32)
- net.WriteVector(gravity)
- net.Send(localpl)
- end)
- net.Receive("tpeffects_everybody_can_seeCL",function(len,ply)
- local enti = net.ReadEntity()
- local pos = net.ReadVector()
- local material = net.ReadString()
- local velocity = net.ReadVector()
- local color = net.ReadInt(32)
- local dietime = net.ReadFloat()
- local startsize = net.ReadInt(32)
- local endsize = net.ReadInt(32)
- local stalpha = net.ReadInt(32)
- local edalpha = net.ReadInt(32)
- local gravity = net.ReadVector()
- TPEffects(enti, pos, material, velocity, color, dietime, startsize, endsize, stalpha, edalpha, gravity)
- end)
- function TPEffects(enti, pos, material, velocity, color, dietime, startsize, endsize, stalpha, edalpha, gravity)
- local vec = pos
- local emitterrr = ParticleEmitter( vec, false )
- local coloraR = 255
- local coloraG = 255
- local coloraB = 255
- if(color == 1)then
- coloraR = 100
- coloraG = 200
- coloraB = 255
- end
- if(color == 2)then
- coloraR = 0
- coloraG = 150
- coloraB = 255
- end
- local particle = emitterrr:Add( Material(material), vec )
- if( particle ) then
- particle:SetVelocity( velocity )
- particle:SetColor( coloraR, coloraG, coloraB )
- particle:SetLifeTime( 0 )
- particle:SetDieTime( dietime )
- particle:SetAngles( Angle( math.random( 0, 360 ), math.random( 0, 360 ), math.random( 0, 360 ) ) )
- particle:SetAngleVelocity( Angle( math.Rand( -1, 1 ), 0, 0 ) )
- particle:SetStartSize( startsize )
- particle:SetEndSize( endsize )
- particle:SetStartAlpha( stalpha )
- particle:SetEndAlpha( edalpha )
- particle:SetGravity( gravity )
- end
- emitterrr:Finish()
- end
- net.Receive( "tpclose", function( len, ply )
- tpstopsv = 1
- if IsValid(ply) then
- net.Start("tpclose_reclient")
- net.Send(ply)
- end
- end)
- function SWEP:TeleTarget(target)
- if IsValid(self.Victima)then
- if SERVER then
- -- Send a net message to all clients to draw the halo
- net.Start("TeleEntity")
- net.WriteEntity(target)
- net.Broadcast()
- end
- end
- --Print a message in the chat
- --if IsValid(target) then
- --local targetName = target:IsPlayer() and target:Nick() or target:GetClass()
- --end
- end
- function SWEP:OnRemove()
- -- if(self.BoostupC == 1)then
- -- self.Owner:SetMaxHealth(100)
- -- self.Owner:SetArmor(0)
- -- self.DMGboost = 0
- -- self.BoostupC = 0
- -- self.zahealu = nil
- -- if(CLIENT)then
- -- net.Start("dtsword_dropasoul")
- -- net.WriteVector(self:GetPos())
- -- net.SendToServer()
- -- end
- -- end
- cooked = 0
- self.Owner.Shielding = 0
- self.wantedfarness = nil
- self:Holster()
- if IsValid(self.Victima) then
- if(CLIENT)then
- net.Start("nomorebluemagic")
- net.WriteEntity(self.Victima)
- net.SendToServer()
- end
- if(SERVER)then
- if IsValid(self.Victima) then
- net.Start("UnTeleEntity")
- net.WriteEntity(self.Victima)
- net.Broadcast()
- end
- end
- self.Victima:SetNWEntity("blueauras",NULL)
- --self.wantedfarness = nil
- if self.Victima:IsPlayer() and self.Victima ~= self.Owner then
- -- Code to execute when the entity is a player and not the owner
- self.Victima:Freeze(false)
- self.Victima:ConCommand("pp_mat_overlay ")
- self.Victima:ConCommand("pp_mat_overlay blank")
- elseif (self.Victima:IsNPC() or self.Victima.Type == "nextbot") then
- if (SERVER) then
- self.Victima:RemoveFlags( FL_FROZEN )
- --self.Victima:RemoveEFlags(EFL_NO_THINK_FUNCTION)
- end
- end
- timer.Create("givemeasecondor",1,1,function()
- self.Victima = nil
- end)
- end
- end
- -- net.Receive("dtsword_dropasoul", function(len,ply)
- -- local pos = net.ReadVector()
- -- local ent = ents.Create( "ent_glitchtale_SCheart" )
- -- ent:SetPos( pos )
- -- ent:SetAngles(Angle(0,0,0))
- -- ent:SetOwner(self.Owner)
- -- ent:Spawn()
- -- end)
- --net.Receive("shieldeffectso", function(len,ply)
- --if(CLIENT)then
- --local self = net.ReadEntity()
- --local a = net.ReadTable()
- --if not(IsValid(self))then return end
- --for i, vecta in pairs(a) do
- --local vec = self:GetPos() + vecta + self.Owner:EyeAngles():Forward() * 40
- --local emitter = ParticleEmitter( vec, false )
- --local particle = emitter:Add( Material( "koperplyar/sans/sansfire" ), vec )
- --if( particle ) then
- --particle:SetVelocity( VectorRand() )
- --particle:SetColor( 150, 150, 255 )
- --particle:SetLifeTime( 0 )
- --particle:SetDieTime( 0.3 )
- --particle:SetAngles( Angle( math.Rand( 0, 360 ), 0, 0 ))
- --particle:SetAngleVelocity( Angle( math.Rand( -360, 360 ), 0, 0 ))
- --particle:SetStartSize( math.random(7,15) )
- --particle:SetEndSize( 0 )
- --particle:SetStartAlpha( 255 )
- --particle:SetEndAlpha( 0 )
- --particle:SetGravity( VectorRand() )
- --particle:SetCollide( true )
- --end
- --emitter:Finish()
- --end
- --end
- --end)
- local teleoc = 3
- --local ornot = self
- --hook.Add( "Think", "dothis", function() -- this works when the gun is holstered.
- --self:SetNWInt("Tele",math.Clamp(nt-.15,0,GetConVarNumber("gt_sans_tc")))
- --end)
- if CLIENT then
- SWEP.vRenderOrder = nil
- function SWEP:ViewModelDrawn()
- local vm = self.Owner:GetViewModel()
- if !IsValid(vm) then return end
- if (!self.VElements) then return end
- self:UpdateBonePositions(vm)
- if (!self.vRenderOrder) then
- -- we build a render order because sprites need to be drawn after models
- self.vRenderOrder = {}
- for k, v in pairs( self.VElements ) do
- if (v.type == "Model") then
- table.insert(self.vRenderOrder, 1, k)
- elseif (v.type == "Sprite" or v.type == "Quad") then
- table.insert(self.vRenderOrder, k)
- end
- end
- end
- for k, name in ipairs( self.vRenderOrder ) do
- local v = self.VElements[name]
- if (!v) then self.vRenderOrder = nil break end
- if (v.hide) then continue end
- local model = v.modelEnt
- local sprite = v.spriteMaterial
- if (!v.bone) then continue end
- local pos, ang = self:GetBoneOrientation( self.VElements, v, vm )
- if (!pos) then continue end
- if (v.type == "Model" and IsValid(model)) then
- model:SetPos(pos + ang:Forward() * v.pos.x + ang:Right() * v.pos.y + ang:Up() * v.pos.z )
- ang:RotateAroundAxis(ang:Up(), v.angle.y)
- ang:RotateAroundAxis(ang:Right(), v.angle.p)
- ang:RotateAroundAxis(ang:Forward(), v.angle.r)
- model:SetAngles(ang)
- --model:SetModelScale(v.size)
- local matrix = Matrix()
- matrix:Scale(v.size)
- model:EnableMatrix( "RenderMultiply", matrix )
- if (v.material == "") then
- model:SetMaterial("")
- elseif (model:GetMaterial() != v.material) then
- model:SetMaterial( v.material )
- end
- if (v.skin and v.skin != model:GetSkin()) then
- model:SetSkin(v.skin)
- end
- if (v.bodygroup) then
- for k, v in pairs( v.bodygroup ) do
- if (model:GetBodygroup(k) != v) then
- model:SetBodygroup(k, v)
- end
- end
- end
- if (v.surpresslightning) then
- render.SuppressEngineLighting(true)
- end
- render.SetColorModulation(v.color.r/255, v.color.g/255, v.color.b/255)
- render.SetBlend(v.color.a/255)
- model:DrawModel()
- render.SetBlend(1)
- render.SetColorModulation(1, 1, 1)
- if (v.surpresslightning) then
- render.SuppressEngineLighting(false)
- end
- elseif (v.type == "Sprite" and sprite) then
- local drawpos = pos + ang:Forward() * v.pos.x + ang:Right() * v.pos.y + ang:Up() * v.pos.z
- render.SetMaterial(sprite)
- render.DrawSprite(drawpos, v.size.x, v.size.y, v.color)
- elseif (v.type == "Quad" and v.draw_func) then
- local drawpos = pos + ang:Forward() * v.pos.x + ang:Right() * v.pos.y + ang:Up() * v.pos.z
- ang:RotateAroundAxis(ang:Up(), v.angle.y)
- ang:RotateAroundAxis(ang:Right(), v.angle.p)
- ang:RotateAroundAxis(ang:Forward(), v.angle.r)
- cam.Start3D2D(drawpos, ang, v.size)
- v.draw_func( self )
- cam.End3D2D()
- end
- end
- end
- SWEP.wRenderOrder = nil
- function SWEP:DrawWorldModel()
- if (self.ShowWorldModel == nil or self.ShowWorldModel) then
- self:DrawModel()
- end
- if (!self.WElements) then return end
- if (!self.wRenderOrder) then
- self.wRenderOrder = {}
- for k, v in pairs( self.WElements ) do
- if (v.type == "Model") then
- table.insert(self.wRenderOrder, 1, k)
- elseif (v.type == "Sprite" or v.type == "Quad") then
- table.insert(self.wRenderOrder, k)
- end
- end
- end
- if (IsValid(self.Owner)) then
- bone_ent = self.Owner
- else
- -- when the weapon is dropped
- bone_ent = self
- end
- for k, name in pairs( self.wRenderOrder ) do
- local v = self.WElements[name]
- if (!v) then self.wRenderOrder = nil break end
- if (v.hide) then continue end
- local pos, ang
- if (v.bone) then
- pos, ang = self:GetBoneOrientation( self.WElements, v, bone_ent )
- else
- pos, ang = self:GetBoneOrientation( self.WElements, v, bone_ent, "ValveBiped.Bip01_R_Hand" )
- end
- if (!pos) then continue end
- local model = v.modelEnt
- local sprite = v.spriteMaterial
- if (v.type == "Model" and IsValid(model)) then
- model:SetPos(pos + ang:Forward() * v.pos.x + ang:Right() * v.pos.y + ang:Up() * v.pos.z )
- ang:RotateAroundAxis(ang:Up(), v.angle.y)
- ang:RotateAroundAxis(ang:Right(), v.angle.p)
- ang:RotateAroundAxis(ang:Forward(), v.angle.r)
- model:SetAngles(ang)
- --model:SetModelScale(v.size)
- local matrix = Matrix()
- matrix:Scale(v.size)
- model:EnableMatrix( "RenderMultiply", matrix )
- if (v.material == "") then
- model:SetMaterial("")
- elseif (model:GetMaterial() != v.material) then
- model:SetMaterial( v.material )
- end
- if (v.skin and v.skin != model:GetSkin()) then
- model:SetSkin(v.skin)
- end
- if (v.bodygroup) then
- for k, v in pairs( v.bodygroup ) do
- if (model:GetBodygroup(k) != v) then
- model:SetBodygroup(k, v)
- end
- end
- end
- if (v.surpresslightning) then
- render.SuppressEngineLighting(true)
- end
- render.SetColorModulation(v.color.r/255, v.color.g/255, v.color.b/255)
- render.SetBlend(v.color.a/255)
- model:DrawModel()
- render.SetBlend(1)
- render.SetColorModulation(1, 1, 1)
- if (v.surpresslightning) then
- render.SuppressEngineLighting(false)
- end
- elseif (v.type == "Sprite" and sprite) then
- local drawpos = pos + ang:Forward() * v.pos.x + ang:Right() * v.pos.y + ang:Up() * v.pos.z
- render.SetMaterial(sprite)
- render.DrawSprite(drawpos, v.size.x, v.size.y, v.color)
- elseif (v.type == "Quad" and v.draw_func) then
- local drawpos = pos + ang:Forward() * v.pos.x + ang:Right() * v.pos.y + ang:Up() * v.pos.z
- ang:RotateAroundAxis(ang:Up(), v.angle.y)
- ang:RotateAroundAxis(ang:Right(), v.angle.p)
- ang:RotateAroundAxis(ang:Forward(), v.angle.r)
- cam.Start3D2D(drawpos, ang, v.size)
- v.draw_func( self )
- cam.End3D2D()
- end
- end
- end
- function SWEP:GetBoneOrientation( basetab, tab, ent, bone_override )
- local bone, pos, ang
- if (tab.rel and tab.rel != "") then
- local v = basetab[tab.rel]
- if (!v) then return end
- -- Technically, if there exists an element with the same name as a bone
- -- you can get in an infinite loop. Let's just hope nobody's that stupid.
- pos, ang = self:GetBoneOrientation( basetab, v, ent )
- if (!pos) then return end
- pos = pos + ang:Forward() * v.pos.x + ang:Right() * v.pos.y + ang:Up() * v.pos.z
- ang:RotateAroundAxis(ang:Up(), v.angle.y)
- ang:RotateAroundAxis(ang:Right(), v.angle.p)
- ang:RotateAroundAxis(ang:Forward(), v.angle.r)
- else
- bone = ent:LookupBone(bone_override or tab.bone)
- if (!bone) then return end
- pos, ang = Vector(0,0,0), Angle(0,0,0)
- local m = ent:GetBoneMatrix(bone)
- if (m) then
- pos, ang = m:GetTranslation(), m:GetAngles()
- end
- if (IsValid(self.Owner) and self.Owner:IsPlayer() and
- ent == self.Owner:GetViewModel() and self.ViewModelFlip) then
- ang.r = -ang.r -- Fixes mirrored models
- end
- end
- return pos, ang
- end
- function SWEP:CreateModels( tab )
- if (!tab) then return end
- -- Create the clientside models here because Garry says we can't do it in the render hook
- for k, v in pairs( tab ) do
- if (v.type == "Model" and v.model and v.model != "" and (!IsValid(v.modelEnt) or v.createdModel != v.model) and
- string.find(v.model, ".mdl") and file.Exists (v.model, "GAME") ) then
- v.modelEnt = ClientsideModel(v.model, RENDER_GROUP_VIEW_MODEL_OPAQUE)
- if (IsValid(v.modelEnt)) then
- v.modelEnt:SetPos(self:GetPos())
- v.modelEnt:SetAngles(self:GetAngles())
- v.modelEnt:SetParent(self)
- v.modelEnt:SetNoDraw(true)
- v.createdModel = v.model
- else
- v.modelEnt = nil
- end
- elseif (v.type == "Sprite" and v.sprite and v.sprite != "" and (!v.spriteMaterial or v.createdSprite != v.sprite)
- and file.Exists ("materials/"..v.sprite..".vmt", "GAME")) then
- local name = v.sprite.."-"
- local params = { ["$basetexture"] = v.sprite }
- -- make sure we create a unique name based on the selected options
- local tocheck = { "nocull", "additive", "vertexalpha", "vertexcolor", "ignorez" }
- for i, j in pairs( tocheck ) do
- if (v[j]) then
- params["$"..j] = 1
- name = name.."1"
- else
- name = name.."0"
- end
- end
- v.createdSprite = v.sprite
- v.spriteMaterial = CreateMaterial(name,"UnlitGeneric",params)
- end
- end
- end
- local allbones
- local hasGarryFixedBoneScalingYet = false
- function SWEP:UpdateBonePositions(vm)
- if self.ViewModelBoneMods then
- if (!vm:GetBoneCount()) then return end
- -- !! WORKAROUND !! --
- -- We need to check all model names :/
- local loopthrough = self.ViewModelBoneMods
- if (!hasGarryFixedBoneScalingYet) then
- allbones = {}
- for i=0, vm:GetBoneCount() do
- local bonename = vm:GetBoneName(i)
- if (self.ViewModelBoneMods[bonename]) then
- allbones[bonename] = self.ViewModelBoneMods[bonename]
- else
- allbones[bonename] = {
- scale = Vector(1,1,1),
- pos = Vector(0,0,0),
- angle = Angle(0,0,0)
- }
- end
- end
- loopthrough = allbones
- end
- -- !! ----------- !! --
- for k, v in pairs( loopthrough ) do
- local bone = vm:LookupBone(k)
- if (!bone) then continue end
- -- !! WORKAROUND !! --
- local s = Vector(v.scale.x,v.scale.y,v.scale.z)
- local p = Vector(v.pos.x,v.pos.y,v.pos.z)
- local ms = Vector(1,1,1)
- if (!hasGarryFixedBoneScalingYet) then
- local cur = vm:GetBoneParent(bone)
- while(cur >= 0) do
- local pscale = loopthrough[vm:GetBoneName(cur)].scale
- ms = ms * pscale
- cur = vm:GetBoneParent(cur)
- end
- end
- s = s * ms
- -- !! ----------- !! --
- if vm:GetManipulateBoneScale(bone) != s then
- vm:ManipulateBoneScale( bone, s )
- end
- if vm:GetManipulateBoneAngles(bone) != v.angle then
- vm:ManipulateBoneAngles( bone, v.angle )
- end
- if vm:GetManipulateBonePosition(bone) != p then
- vm:ManipulateBonePosition( bone, p )
- end
- end
- else
- self:ResetBonePositions(vm)
- end
- end
- function SWEP:ResetBonePositions(vm)
- if (!vm:GetBoneCount()) then return end
- for i=0, vm:GetBoneCount() do
- vm:ManipulateBoneScale( i, Vector(1, 1, 1) )
- vm:ManipulateBoneAngles( i, Angle(0, 0, 0) )
- vm:ManipulateBonePosition( i, Vector(0, 0, 0) )
- end
- end
- /**************************
- Global utility code
- **************************/
- -- Fully copies the table, meaning all tables inside this table are copied too and so on (normal table.Copy copies only their reference).
- -- Does not copy entities of course, only copies their reference.
- -- WARNING: do not use on tables that contain themselves somewhere down the line or you'll get an infinite loop
- function table.FullCopy( tab )
- if (!tab) then return nil end
- local res = {}
- for k, v in pairs( tab ) do
- if (type(v) == "table") then
- res[k] = table.FullCopy(v) -- recursion ho!
- elseif (type(v) == "Vector") then
- res[k] = Vector(v.x, v.y, v.z)
- elseif (type(v) == "Angle") then
- res[k] = Angle(v.p, v.y, v.r)
- else
- res[k] = v
- end
- end
- return res
- end
- end
- function SWEP:Think()
- -- if(self.BoostupC == 1)then
- -- self.DMGboost = 5
- -- if(self.zahealu == 0 or self.zahealu == nil)then
- -- self.Owner:SetHealth(300)
- -- self.Owner:SetMaxHealth(300)
- -- self.Owner:SetArmor(50)
- -- self.zahealu = 1
- -- end
- -- else
- -- self.zahealu = nil
- -- self.DMGboost = 0
- -- end
- --if self.Owner:Health() <= 0 then
- --end
- local o=self.Owner
- local n=self:GetNWInt("Stre")
- local blue=self:GetNWInt("Tele")
- --if not(o:Alive())then
- --local e=EffectData() e:SetMagnitude(3)
- --e:SetOrigin(self.Owner:GetPos()+Vector(math.random(-self.BBox.x,self.BBox.x),math.random(-self.BBox.y,self.BBox.y),self.BBox.z*(self:GetColor().a/255)))
- --util.Effect("dustdeath",e)
- --end
- self.Speed=1
- if n>97.3/100*GetConVarNumber("gt_sans_sr")then
- self.Tired=1
- self:SetNWBool("Tired",true)
- --if(self.Owner.Shielding == 1)then return end
- self.Speed=.3
- elseif n>70/100*GetConVarNumber("gt_sans_sr")then
- --if(self.Owner.Shielding == 1)then return end
- self.Speed=.5
- elseif n>50/100*GetConVarNumber("gt_sans_sr")then
- --if(self.Owner.Shielding == 1)then return end
- self.Speed=.7
- else
- self.Tired=nil
- self:SetNWBool("Tired",false)
- cooked = 0
- end
- if self.Tired then
- cooked = 1
- --if(self.Owner.Shielding == 1)then return end
- self.Speed=.33
- end
- --if(self.Owner.Shielding == 1)then
- --self.Speed=0
- --elseif(self.Owner.Shielding == 0)then
- --if self.Tired then return end
- --self.Speed=1
- --end
- if(cooked == 1)then
- self:SetNWInt("D",3)
- end
- if o:IsOnGround()and self.Speed<1 then
- o:SetLocalVelocity(o:GetVelocity()*self.Speed)
- end
- self:SetNWInt("Stre",math.Clamp(n-.15,0,GetConVarNumber("gt_sans_sr")))
- if not(IsValid(self.Victima))then
- self:SetNWInt("Tele",math.Clamp(blue-.15,0,GetConVarNumber("gt_sans_tc")))
- else
- if self.Victima:IsNPC() or self.Victima.Type == "nextbot" or self.Victima:IsPlayer() and self.Victima ~= self.Owner then
- self:SetNWInt("Tele",math.Clamp(blue+.15,0,GetConVarNumber("gt_sans_tc")))
- else
- self:SetNWInt("Tele",math.Clamp(blue+.075,0,GetConVarNumber("gt_sans_tc")))
- end
- end
- if self.Owner.Shielding == 1 then
- if not self.Tired then
- self:SetNWInt("Stre",math.Clamp(n+0.035,0,GetConVarNumber("gt_sans_sr")))
- else
- self.Owner:RemoveFlags(FL_ATCONTROLS)
- self.Owner.Shielding = 0
- if SERVER then
- for _, ent in ipairs(self.Shield) do
- if IsValid(ent) then ent:Removeself() end
- end
- end
- self.Shield = {}
- timer.Remove("CheckKeyRelease" .. tostring(self.Owner))
- end
- end
- local d=self:GetNWInt("D")
- if( self.Owner:GetVelocity():Length() < 30 || self.Owner:GetMoveType() == MOVETYPE_NOCLIP ) then
- --self.Owner:DoAnimationEvent( ACT_HL2MP_IDLE )
- --if (self.Owner:KeyDown(IN_DUCK))then return end --bugs everything crouch-related making it so think() only works when walking
- if( self:GetVar( "anim_reset" ) != NULL ) then
- if(self.Owner:GetModel() == "models/nia/sans_pm.mdl") then
- self.Owner:ManipulateBoneAngles( self.Owner:LookupBone( "ValveBiped.Bip01_R_Clavicle" ), Angle( 0, 10, -40 ) )
- self.Owner:ManipulateBoneAngles( self.Owner:LookupBone( "ValveBiped.Bip01_L_Clavicle" ), Angle( 0, 10, 30 ) )
- self.Owner:ManipulateBoneAngles( self.Owner:LookupBone( "ValveBiped.Bip01_R_Forearm" ), Angle( 0, -90, 0 ) )
- self.Owner:ManipulateBoneAngles( self.Owner:LookupBone( "ValveBiped.Bip01_L_Forearm" ), Angle( 0, -90, 0 ) )
- self.Owner:ManipulateBoneAngles( self.Owner:LookupBone( "ValveBiped.Bip01_R_Hand" ), Angle( 180, 0, 0 ) )
- self.Owner:ManipulateBoneAngles( self.Owner:LookupBone( "ValveBiped.Bip01_L_Hand" ), Angle( 180, 0, 0 ) )
- end
- if(self.Owner:GetModel() == "models/sansplayer/sansplayer.mdl") then
- self.Owner:ManipulateBoneAngles( self.Owner:LookupBone( "ValveBiped.Bip01_R_Clavicle" ), Angle( 0, 10, -30 ) )
- self.Owner:ManipulateBoneAngles( self.Owner:LookupBone( "ValveBiped.Bip01_L_Clavicle" ), Angle( 0, 10, 30 ) )
- self.Owner:ManipulateBoneAngles( self.Owner:LookupBone( "ValveBiped.Bip01_R_Forearm" ), Angle( 0, -60, 0 ) )
- self.Owner:ManipulateBoneAngles( self.Owner:LookupBone( "ValveBiped.Bip01_L_Forearm" ), Angle( 0, -60, 0 ) )
- end
- self:SetVar( "anim_reset", NULL )
- end
- else
- if( self:GetVar( "anim_reset" ) == NULL && self.Owner:GetVelocity():Length() > 150 ) then
- self:SetVar( "anim_reset", true )
- --self.Owner:DoAnimationEvent( ACT_GMOD_IN_CHAT )
- self.Owner:ManipulateBoneAngles( self.Owner:LookupBone( "ValveBiped.Bip01_R_Clavicle" ), Angle( 0, 0, 0 ) )
- self.Owner:ManipulateBoneAngles( self.Owner:LookupBone( "ValveBiped.Bip01_L_Clavicle" ), Angle( 0, 0, 0 ) )
- self.Owner:ManipulateBoneAngles( self.Owner:LookupBone( "ValveBiped.Bip01_R_Forearm" ), Angle( 0, 0, 0 ) )
- self.Owner:ManipulateBoneAngles( self.Owner:LookupBone( "ValveBiped.Bip01_L_Forearm" ), Angle( 0, 0, 0 ) )
- self.Owner:ManipulateBoneAngles( self.Owner:LookupBone( "ValveBiped.Bip01_R_Hand" ), Angle( 0, 0, 0 ) )
- self.Owner:ManipulateBoneAngles( self.Owner:LookupBone( "ValveBiped.Bip01_L_Hand" ), Angle( 0, 0, 0 ) )
- end
- end
- net.Receive("tpclose_reclient",function(len,ply)
- self.panel = nil
- end)
- net.Receive("gb_updateclientside", function(len,ply)
- local gb = net.ReadTable()
- if(gb)then
- self.Blasters_cl = gb
- end
- end)
- net.Receive("gbaddtotable", function(len,ply)
- local gb = net.ReadEntity()
- local owna = net.ReadEntity()
- if not(ply == owna) then return end
- if(gb)then
- table.insert(self.Blasters, gb)
- end
- end)
- if(SERVER)then
- net.Start("gb_updateclientside")
- net.WriteTable(self.Blasters)
- net.Send(self.Owner)
- for i,a in pairs(self.Blasters) do
- local drva = a:GetNWFloat( "Driver" )
- if(drva == self.Owner)then
- self.AmIDriving = 1
- self.AmIDrivingVehicle = a
- end
- end
- if(self.AmIDriving == 1)then
- for i,a in pairs(self.Blasters) do
- local drva = a:GetNWFloat( "Driver" )
- if(drva != self.Owner)then
- self.AmIDriving = 0
- end
- end
- end
- end
- net.Receive("gbdrivingupdateclient" .. tostring(self), function(len,ply)
- local driveh = net.ReadInt(32)
- if(CLIENT)then
- self.AmIDriving = driveh
- end
- end)
- if(SERVER)then
- if(self.AmIDriving)then
- net.Start("gbdrivingupdateclient" .. tostring(self))
- net.WriteInt(self.AmIDriving,32)
- net.Send(self.Owner)
- end
- end
- local timleft = teleoc - CurTime()
- if(timleft < 0)then
- if(self.Owner:KeyDown( IN_USE ))then
- if(self.AmIDriving == 1) then return end
- if(self.Owner.Shielding == 1) then return end
- if self.NextAtt>CurTime()||self.Tired then return end
- if blue > 31 then return end
- timer.Remove("removezahvictim" .. tostring(self))
- timer.Create("removezahvictim" .. tostring(self),0.1,1,function()
- if(IsValid(self))then
- teleoc = CurTime() + 6.3
- if IsValid(self.Victima)then
- if(CLIENT)then
- net.Start("nomorebluemagic")
- net.WriteEntity(self.Victima)
- net.SendToServer()
- end
- if(SERVER)then
- if IsValid(self.Victima) then
- net.Start("UnTeleEntity")
- net.WriteEntity(self.Victima)
- net.Broadcast()
- end
- end
- self.Victima:SetNWEntity("blueauras",NULL)
- --self.wantedfarness = nil
- self.wantedfarness = nil
- if self.Victima:IsPlayer() and self.Victima ~= self.Owner then
- -- Code to execute when the entity is a player and not the owner
- self.Victima:Freeze(false)
- self.Victima:ConCommand("pp_mat_overlay ")
- self.Victima:ConCommand("pp_mat_overlay blank")
- elseif (self.Victima:IsNPC() or self.Victima.Type == "nextbot") then
- if (SERVER) then
- self.Victima:RemoveFlags( FL_FROZEN )
- --self.Victima:RemoveEFlags(EFL_NO_THINK_FUNCTION)
- end
- end
- --timer.Create("givemeasecond",1,1,function() --breaks blue functions
- self.Victima = nil
- -- end)
- if(self.Owner:GetModel() == "models/sansplayer/sansplayer.mdl") then
- self.Owner:SetBodygroup( 1, 0 )
- self.Owner:SetBodygroup( 2, 0 )
- end
- if(self.Owner:GetModel() == "models/nia/sans_pm.mdl") then
- self.Owner:SetBodygroup( 2, 0 )
- end
- else
- teleoc = CurTime() + 3.3
- end
- self:SetVar( "anim_reset", true )
- self:TelekanisisAnim_Stop()
- self.telekanisisstage = nil
- end
- end)
- if not(self.telekanisisstage == 1)then
- self:TelekanisisAnim_Start()
- self.telekanisisstage = 1
- end
- if(self.Owner:GetModel() == "models/sansplayer/sansplayer.mdl") then
- self.Owner:SetBodygroup( 1, 1 )
- self.Owner:SetBodygroup( 2, 1 )
- end
- if(self.Owner:GetModel() == "models/nia/sans_pm.mdl") then
- self.Owner:SetBodygroup( 2, 1 )
- end
- if not(IsValid(self.Victima))then
- if self.NextAtt>CurTime()||self.Tired then return end
- local tr = util.TraceLine( {
- start = self.Owner:GetShootPos(),
- endpos = self.Owner:GetShootPos() + self.Owner:EyeAngles():Forward() * 1450,
- filter = self.Owner
- } )
- self.Victima = tr.Entity
- if(self.Owner:GetModel() == "models/sansplayer/sansplayer.mdl") then
- self.Owner:SetBodygroup( 1, 0 )
- self.Owner:SetBodygroup( 2, 0 )
- end
- if(self.Owner:GetModel() == "models/nia/sans_pm.mdl") then
- self.Owner:SetBodygroup( 2, 0 )
- end
- end
- local victim = self.Victima
- if(IsValid(victim))then
- if self.NextAtt>CurTime()||self.Tired then return end
- if blue > 31 then return end
- local eyeAng = self.Owner:GetAngles()
- self.Owner:ManipulateBoneAngles( self.Owner:LookupBone( "ValveBiped.Bip01_R_Clavicle" ), Angle( 0, 0, 0 ) )
- self.Owner:ManipulateBoneAngles( self.Owner:LookupBone( "ValveBiped.Bip01_R_Clavicle" ), Angle( 0, 20, 45 - eyeAng.x ) )
- if(CLIENT) then
- net.Start("dobluemagic")
- net.WriteEntity(victim)
- net.SendToServer()
- end
- victim:SetNWEntity("blueauras",self.Owner)
- self:TeleTarget(victim)
- if victim:IsPlayer() then
- if(victim == self.Owner)then return false end
- -- Code to execute when the entity is a player and not the owner
- victim:ConCommand("pp_mat_overlay overlays/teleka")
- victim:Freeze(true)
- --victim:DrawViewModel(false)
- elseif (victim:IsNPC() or victim.Type == "nextbot") then
- if (SERVER) then
- victim:AddFlags( FL_FROZEN )
- --victim:AddEFlags(EFL_NO_THINK_FUNCTION)
- end
- end
- local victvelo = victim:GetVelocity() / 3.7 --Telekanisis force strength
- local farness = (self.Owner:GetPos() - victim:GetPos()):Length()
- local controllUB = Vector(0,0,0)
- local controllLR = Vector(0,0,0)
- local controllUD = Vector(0,0,0)
- if(victim:IsPlayer())then
- if(victim:KeyDown( IN_FORWARD ))then
- controllUB = victim:EyeAngles():Forward()
- end
- if(victim:KeyDown( IN_BACK ))then
- controllUB = victim:EyeAngles():Forward() * -1
- end
- if(victim:KeyDown( IN_MOVELEFT ))then
- controllLR = victim:EyeAngles():Right() * -1
- end
- if(victim:KeyDown( IN_MOVERIGHT ))then
- controllLR = victim:EyeAngles():Right()
- end
- if(victim:KeyDown( IN_JUMP ))then
- controllUD = victim:EyeAngles():Up()
- end
- end
- local controll = (controllUB + controllLR)
- if(victim.CustomControll)then
- controll = (controllUB + controllLR) * victim.CustomControll --To set an advantage over the average victim
- end
- if not(self.wantedfarness)then
- self.wantedfarness = farness
- end
- local aim = self.Owner:EyeAngles():Forward()
- local actuallcontroll = (controll * (farness / 3))
- local posforvictim = ((aim * self.wantedfarness) + self.Owner:GetPos()) + actuallcontroll - victvelo
- local addedvector = Vector(0,0,0)
- if(victim:IsPlayer() or victim:IsNPC())then
- addedvector = Vector(0,0,40)
- end
- local directionofposition = ((posforvictim + addedvector) - victim:GetPos()):GetNormalized()
- victim:SetVelocity(((posforvictim + addedvector) - victim:GetPos()))
- local oldfarnness = farness
- local angularvel = Vector(0,0,0)
- if(self.Owner:KeyDown( IN_JUMP ))then
- if(self.Owner:KeyDown( IN_FORWARD ))then
- angularvel = angularvel + self.Owner:EyeAngles():Forward() * 5
- end
- if(self.Owner:KeyDown( IN_MOVERIGHT ))then
- angularvel = angularvel + self.Owner:EyeAngles():Right() * 5
- end
- if(self.Owner:KeyDown( IN_MOVELEFT ))then
- angularvel = angularvel + self.Owner:EyeAngles():Right() * -5
- end
- if(self.Owner:KeyDown( IN_BACK ))then
- angularvel = angularvel + self.Owner:EyeAngles():Forward() * -5
- end
- local dephys = victim:GetPhysicsObject()
- if(IsValid(dephys))then
- dephys:AddAngleVelocity( angularvel )
- end
- end
- if(self.Owner:KeyDown( IN_WALK ) && !self.Owner:KeyDown( IN_SPEED ))then
- victim:SetVelocity(self.Owner:EyeAngles():Forward() * (366666 / farness))
- farness = 10000
- end
- farness = oldfarnness
- local phys = victim:GetPhysicsObject()
- if(IsValid(phys))then
- phys:AddVelocity((posforvictim + Vector(0,0,80)) - victim:GetPos())
- if(self.Owner:KeyDown( IN_WALK ) && !self.Owner:KeyDown( IN_SPEED ))then
- phys:SetVelocity(self.Owner:EyeAngles():Forward() * (366666 / farness))
- farness = 10000
- end
- end
- if(farness > 1451)then
- teleoc = CurTime() + 3
- self:SetVar( "anim_reset", true )
- if IsValid(self.Victima) then
- if self.Victima:IsPlayer() and self.Victima ~= self.Owner then
- -- Code to execute when the entity is a player and not the owner
- self.Victima:Freeze(false)
- self.Victima:ConCommand("pp_mat_overlay ")
- self.Victima:ConCommand("pp_mat_overlay blank")
- elseif (self.Victima:IsNPC() or self.Victima.Type == "nextbot") then
- if (SERVER) then
- self.Victima:RemoveFlags( FL_FROZEN )
- --self.Victima:RemoveEFlags(EFL_NO_THINK_FUNCTION)
- end
- end
- if(CLIENT)then
- net.Start("nomorebluemagic")
- net.WriteEntity(self.Victima)
- net.SendToServer()
- end
- if(SERVER)then
- if IsValid(self.Victima) then
- net.Start("UnTeleEntity")
- net.WriteEntity(self.Victima)
- net.Broadcast()
- end
- end
- victim:SetNWEntity("blueauras",NULL)
- timer.Create("givemeasecond2",1,1,function()
- self.Victima = nil
- end)
- end
- end
- if(victim:GetClass() == "ent_glitchtale_gintegrity")then
- victim:ReOwner(self.Owner)
- end
- local up = util.TraceLine({
- startpos = victim:GetPos();
- endpos = victim:GetPos() + Vector(0,0,victim:GetModelRadius() + 10);
- filter = victim
- })
- local down = util.TraceLine({
- startpos = victim:GetPos();
- endpos = victim:GetPos() + Vector(0,0,-10);
- filter = victim
- })
- local left = util.TraceLine({
- startpos = victim:GetPos();
- endpos = victim:GetPos() + (victim:EyeAngles():Right() * -10);
- filter = victim
- })
- local right = util.TraceLine({
- startpos = victim:GetPos();
- endpos = victim:GetPos() + (victim:EyeAngles():Right() * 10);
- filter = victim
- })
- local forwards = util.TraceLine({
- startpos = victim:GetPos();
- endpos = victim:GetPos() + (victim:EyeAngles():Forward() * 10);
- filter = victim
- })
- local backwards = util.TraceLine({
- startpos = victim:GetPos();
- endpos = victim:GetPos() + (victim:EyeAngles():Forward() * -10);
- filter = victim
- })
- local uE = up.Entity
- local dE = down.Entity
- local lE = left.Entity
- local rE = right.Entity
- local fE = forwards.Entity
- local bE = backwards.Entity
- local dmgpositions = {}
- table.insert(dmgpositions,uE)
- table.insert(dmgpositions,dE)
- table.insert(dmgpositions,lE)
- table.insert(dmgpositions,rE)
- table.insert(dmgpositions,fE)
- table.insert(dmgpositions,bE)
- for i, a in pairs(dmgpositions) do
- if(a && a:IsWorld())then
- local distanca = (posforvictim - victim:GetPos()):Length()
- if(distanca > 150)then
- local tdtimleft = tdocc - CurTime()
- if tdtimleft < 0 then
- if(SERVER)then
- local d = DamageInfo()
- d:SetInflictor(self.Owner)
- d:SetAttacker(self.Owner)
- d:SetDamage( (distanca / 50) )
- victim:TakeDamageInfo( d )
- end
- tdocc = CurTime() + tddelay
- end
- end
- end
- end
- if(self.Owner:KeyDown( IN_SPEED ))then
- if(self.wantedfarness)then
- self.wantedfarness = self.wantedfarness + 10
- end
- end
- if(self.Owner:KeyDown( IN_DUCK ))then
- if(self.wantedfarness)then
- self.wantedfarness = self.wantedfarness - 10
- end
- end
- if self.wantedfarness > 1450 then
- self.wantedfarness = 1450
- end
- if self.wantedfarness < 1 then
- self.wantedfarness = 1
- end
- end
- end
- end
- if(timleft < 0)then
- if !self.Tired and o:KeyDown(IN_USE)then
- self:SetNWInt("Stre",math.Clamp(self:GetNWInt("Stre")+.25,0,GetConVarNumber("gt_sans_sr")))
- end
- end
- --if !self.Tired and o:KeyDown(IN_USE)then
- --self:SetNWInt("D",math.Clamp(self:GetNWInt("D")-.03,0,1))
- --else
- --self:SetNWInt("D",math.Clamp(self:GetNWInt("D")-.01,0,1))
- --end
- if !self.Tired then --! is like [different]
- self:SetNWInt("D",math.Clamp(self:GetNWInt("D")-.01,0,1))
- end
- if(self.Owner:KeyDown( IN_WALK ) && !self.Owner:KeyDown( IN_SPEED ) && !self.Owner:KeyDown( IN_DUCK ) && !self.Owner:KeyDown( IN_USE ))then
- local stabtimleft = stabocc - CurTime()
- if stabtimleft < 0 then
- if(self.AmIDriving == 1) then return end
- self:SendWeaponAnim( 186 )
- timer.Create("stabbacktoidle" .. tostring(self),0.7,1,function()
- if !IsValid(self) then return end
- self:SendWeaponAnim( 174 )
- self:SetHoldType("normal")
- end)
- self:SetHoldType("knife")
- timer.Create("stabtime" .. tostring(self),0.1,1,function()
- if !IsValid(self) then return end
- self.Owner:SetAnimation(PLAYER_ATTACK1)
- self:SetNWInt("Stre",math.Clamp(self:GetNWInt("Stre")+1,0,GetConVarNumber("gt_sans_sr")))
- local tr = util.TraceLine( {
- start = self.Owner:GetShootPos(),
- endpos = self.Owner:GetShootPos() + self.Owner:GetAimVector() * 60,
- filter = self.Owner,
- mask = MASK_SHOT_HULL
- } )
- local victim = tr.Entity
- if ( !IsValid( victim ) ) then
- tr = util.TraceHull( {
- start = self.Owner:GetShootPos(),
- endpos = self.Owner:GetShootPos() + self.Owner:GetAimVector() * 60,
- filter = self.Owner,
- mins = Vector( -10, -10, -8 ),
- maxs = Vector( 10, 10, 8 ),
- mask = MASK_SHOT_HULL
- } )
- end
- if(IsValid(victim))then
- if(SERVER)then
- local d = DamageInfo()
- d:SetDamage( math.random(25,30) )
- d:SetAttacker( self.Owner )
- d:SetInflictor( self )
- d:SetDamageType( DMG_SLASH )
- victim:TakeDamageInfo( d )
- end
- end
- end)
- stabocc = CurTime() + stabdelay
- end
- end
- if self.noteleport == 0 then
- net.Receive("tpselectedtoserver",function(len,ply)
- local ita = net.ReadTable()
- selecteds = ita
- end)
- if (self.Owner:KeyDown( IN_DUCK )) && (self.Owner:KeyDown( IN_WALK )) then
- if not(self.Owner:KeyDown( IN_USE ))then
- if self.NextAtt>CurTime()||self.Tired then return end
- self:SansTeleport()
- end
- end
- if (self.Owner:KeyDown( IN_SPEED )) && (self.Owner:KeyDown( IN_DUCK )) then
- if not(self.Owner:KeyDown( IN_USE ))then
- if self.NextAtt>CurTime()||self.Tired then return end
- self:SansTeleportShort()
- end
- end
- if teleportnow == 1 then
- if(istpreallyowner == self.Owner)then
- sound.Play( "koperplyar/teleport.wav" , self.Owner:GetPos(), 75, math.random(85,105), 1 )
- self:SetNWInt("Stre",math.Clamp(self:GetNWInt("Stre")+25.3,0,GetConVarNumber("gt_sans_sr")))
- if(CLIENT) then
- net.Start("dobluemagic")
- net.WriteEntity(self.Owner)
- net.SendToServer()
- end
- if(self.Owner.TPFriends)then
- for i, a in pairs(self.Owner.TPFriends) do
- self:SetNWInt("Stre",math.Clamp(self:GetNWInt("Stre")+10,0,GetConVarNumber("gt_sans_sr")))
- local fpos = self.Owner:GetPos() - a:GetPos()
- a:SetVelocity( -a:GetVelocity() )
- a:SetPos(newposition - fpos)
- if(CLIENT) then
- net.Start("dobluemagic")
- net.WriteEntity(a)
- net.SendToServer()
- end
- end
- end
- self.Owner.TPFriends = nil
- self.Owner:SetVelocity( -self.Owner:GetVelocity() )
- self.Owner:SetPos(newposition)
- sound.Play( "koperplyar/teleport.wav" , self.Owner:GetPos(), 75, math.random(85,105), 1 )
- self:SetHoldType( "normal" )
- timer.Create("moretpeffectsa" .. tostring(self),0.01,50,function()
- net.Start( "tpeffects" )
- net.WriteEntity(self.Owner)
- net.Send( self.Owner )
- end)
- timer.Create("removeteleporteffects" .. tostring(self),0.75,1,function()
- timer.Remove( "teleportationeffects" .. tostring(self) )
- end)
- teleportnow = 0
- end
- end
- end
- if self.noteleport == 0 then
- if not(self.Owner:KeyDown( IN_USE ))then
- if (self.Owner:KeyDown( IN_SPEED )) && (self.Owner:KeyDown( IN_WALK )) then
- local altctrltimeLeft = altctrlnextOccurance - CurTime()
- if altctrltimeLeft < 0 then
- if(self.Owner.Shielding == 1) then return end
- if self.NextAtt>CurTime()||self.Tired then return end
- local ptimleft = pocc - CurTime()
- if ptimleft < 0 then
- self:PiercingBones()
- pocc = CurTime() + pdelay
- end
- end
- end
- end
- end
- SansShared(self)
- end
- function SWEP:PiercingBones()
- if SERVER then
- --local g=ents.Create("ent_glitchtale_pbone")
- --local p=VectorRand()*math.random(60,139)
- --p.z=l*math.random(30,129)
- --local t=util.TraceLine({start=o:EyePos(),endpos=o:EyePos()+p,filter=o})
- --if t.Hit then p=t.HitPos+t.HitNormal*30 else p=o:EyePos()+p end
- --g:SetPos(p)
- --local e=(o:GetEyeTrace().HitPos-p):Angle()
- --g:SetAngles(e+Angle(90))
- --g:SetOwner(o)
- --g:SetVar( "pos", p )
- --g:SetVar( "normal", p )
- --g.Dmg=7+(l-.1)*10
- --local s=1
- --g:Spawn()
- --g:SetParent(self.Owner)
- --self.NextAtt=CurTime()
- local tr = util.TraceLine( {
- start = self.Owner:GetShootPos(),
- endpos = self.Owner:GetShootPos() + self.Owner:EyeAngles():Forward() * 3333,
- filter = function( ent ) if ( ent:GetClass() == "prop_physics" ) then return false end end
- } )
- local pos = tr.HitPos
- local rad = 104
- sound.Play( Sound( "undertale/bone_start.wav" ), tr.HitPos )
- for i = 1, 47 do --69 in second phase
- self:SendWeaponAnim(190)
- self:SetHoldType("pistol")
- local n=self:GetNWInt("Stre")
- self:SetNWInt("Stre",math.Clamp(n+0.43,0,GetConVarNumber("gt_sans_sr")))
- local vec = Vector( math.Rand( -rad, rad ), math.Rand( -rad, rad ), 0 )
- vec:Rotate( tr.HitNormal:Angle() + Angle( 90, 0, 0 ) )
- local ang = ( tr.HitNormal * 3 + VectorRand() ):Angle() --number adjusts how straight the bones are
- local traceGrd = util.TraceLine( {
- start = pos + vec,
- endpos = pos + vec - ang:Up() * 50,
- filter = function( ent ) if ( ent:GetClass() == "prop_physics" ) then return true end end
- } )
- if( traceGrd.Hit ) then
- local ent = ents.Create( "ent_glitchtale_pbone" )
- ent:SetAngles( ang + Angle( 90, 0, 0 ) )
- ent:SetVar( "pos", pos )
- ent:SetVar( "normal", tr.HitNormal )
- ent:SetPos( traceGrd.HitPos )
- ent:SetOwner( self.Owner )
- --ent:EmitSound( "undertale/bone_start.wav", 75, 100, 1, CHAN_AUTO )
- ent:Spawn()
- self.NextAtt=CurTime()
- end
- end
- else
- self.NextAtt=CurTime()+1
- self:SetNextPrimaryFire(CurTime()+1)
- self:SetNextSecondaryFire(CurTime()+1)
- end
- self.Owner.Shielding = 0
- end
- function SWEP:Reload()
- local rtimeleft = rocc - CurTime()
- if rtimeleft < 0 then
- --timer.Remove("checkreload" .. tostring(self))
- -- timer.Create("checkreload" .. tostring(self), 0.25, 1, function()
- --self.Owner.Shielding = 0
- --end)
- if self.NextAtt>CurTime()||self.Tired then return end
- if self.Owner.Shielding == 0 then
- if SERVER then
- local entsb = ents.Create("ent_glitchtale_bone_spinner")
- local possb = self.Owner:GetPos()
- entsb:SetAngles((self.Owner:GetEyeTrace().HitPos - possb):Angle())
- entsb:SetPos(self.Owner:GetPos() + Vector(0, 0, 45) + self.Owner:GetForward() * 50)
- entsb:SetOwner(self.Owner)
- entsb:Spawn()
- table.insert(self.Shield, entsb)
- entsb:CallOnRemove("chrRemoveFromList", function(entsb)
- if IsValid(self) then
- table.RemoveByValue(self.Shield, entsb)
- end
- end)
- local entsbfake = ents.Create("ent_glitchtale_bone_faker")
- local posfake = self.Owner:GetPos()
- entsbfake:SetAngles((self.Owner:GetEyeTrace().HitPos - posfake):Angle())
- entsbfake:SetPos(self.Owner:GetPos() + Vector(0, 0, 45) + self.Owner:GetForward() * 50)
- entsbfake:SetOwner(self.Owner)
- entsbfake:Spawn()
- table.insert(self.Shield, entsbfake)
- entsbfake:CallOnRemove("chrRemoveFromList", function(entsbfake)
- if IsValid(self) then
- table.RemoveByValue(self.Shield, entsbfake)
- end
- end)
- end
- self:SetHoldType("pistol")
- self:TelekanisisAnim_Start()
- self.Owner:AddFlags(FL_ATCONTROLS)
- self.Owner.Shielding = 1
- timer.Create("CheckKeyRelease" .. tostring(self.Owner), 0.1, 0, function()
- if not IsValid(self) or not IsValid(self.Owner) then return end
- if not self.Owner:KeyDown(IN_RELOAD) then
- self:TelekanisisAnim_Stop()
- self:SetHoldType("normal")
- self.Owner:RemoveFlags(FL_ATCONTROLS)
- self.Owner.Shielding = 0
- if SERVER then
- for _, ent in ipairs(self.Shield) do
- if IsValid(ent) then ent:Removeself() end
- end
- end
- self.Shield = {}
- timer.Remove("CheckKeyRelease" .. tostring(self.Owner))
- end
- end)
- end
- --if not(self.Sradiusa)then
- --self.Sradiusa = 20
- --end
- --self.Sradiusa = self.Sradiusa + 20
- --if(self.Sradiusa > 100)then
- --self.Sradiusa = 20
- --end
- --local tablecircle = {}
- --for i = 1,360, 20 do
- --local x, y = CalculateCircle( self.Sradiusa, i , 0, 0 )
- --local vectori = Vector(x,0,y)
- --vectori:Rotate( self.Owner:EyeAngles() + Angle(0,90,0) )
- --table.insert(tablecircle, vectori)
- --end
- --if(SERVER)then
- --for i, a in pairs(player.GetAll()) do
- --net.Start("shieldeffectso")
- --net.WriteEntity(self)
- --net.WriteTable(tablecircle)
- --net.Send(a)
- --end
- --end
- rocc = CurTime() + 2.57
- end
- end
- function SWEP:TelekanisisAnim_Start()
- self:SendWeaponAnim(195)
- timer.Create("telekanisisidlea" .. tostring(self),0.5,1,function()
- if(IsValid(self))then
- if(self.Telekanisising == nil)then
- self:TelekanisisAnim_Idle()
- end
- end
- end)
- self.Telekanisising = nil
- end
- function SWEP:TelekanisisAnim_Idle()
- self:SendWeaponAnim(196)
- end
- function SWEP:TelekanisisAnim_Stop()
- self.Telekanisising = 1
- self:SendWeaponAnim(197)
- timer.Create("backtoidletelekanisis" .. tostring(self),0.5,1,function()
- if(IsValid(self))then
- if(self.Telekanisising == 1)then
- self:SendWeaponAnim(174)
- end
- end
- end)
- end
- function SWEP:SansTeleportShort()
- local shiftalttimeLeft = saocc - CurTime()
- if shiftalttimeLeft < 0 then
- self:SendWeaponAnim(189)
- timer.Create("shortteleportbacktoidle" .. tostring(self),0.45,1,function()
- if(IsValid(self))then
- self:SendWeaponAnim(174)
- end
- end)
- local teleportnow = 0
- local number = 1500
- local forwarda = Vector((self.Owner:EyeAngles():Forward() * number).x,(self.Owner:EyeAngles():Forward() * number).y,0)
- local tr = util.TraceLine( {
- start = self.Owner:GetPos() + Vector(0,0,30),
- endpos = self.Owner:GetPos() + Vector(0,0,30) + forwarda,
- filter = self.Owner
- } )
- local tr2 = util.TraceLine( {
- start = self.Owner:GetPos() + Vector(0,0,30) + forwarda,
- endpos = self.Owner:GetPos() + Vector(0,0,30) + forwarda + Vector(0,0,number),
- filter = self.Owner
- } )
- local tr3 = util.TraceLine( {
- start = self.Owner:GetPos(),
- endpos = self.Owner:GetPos(),
- filter = self.Owner
- } )
- local posu = Vector(0,0,0)
- local posu1 = Vector(0,0,0)
- if(tr2.HitNormal)then
- posu = tr3.HitPos - self.Owner:GetPos()
- end
- if(tr.HitNormal)then
- posu1 = tr.HitNormal * 40
- end
- local pos = tr.HitPos + posu + posu1
- if(CLIENT)then
- net.Start( "teleportnownet" )
- net.WriteVector(pos)
- net.SendToServer()
- end
- if(self.ShortTpadddelay)then
- self.ShortTpadddelay = self.ShortTpadddelay + 0.1
- else
- self.ShortTpadddelay = 0
- end
- timer.Remove("setitbacktonormaldelay" .. tostring(self))
- timer.Create("setitbacktonormaldelay" .. tostring(self),3,1,function()
- if(IsValid(self))then
- self.ShortTpadddelay = 0
- end
- end)
- saocc = CurTime() + 0.451 + self.ShortTpadddelay
- end
- end
- function SWEP:SansTeleport()
- local shiftalttimeLeft = saocc - CurTime()
- if shiftalttimeLeft < 0 then
- self:SendWeaponAnim(187)
- self:SetHoldType( "melee" )
- local selected
- local locations = {}
- local map = game.GetMap()
- local teleportnow = 0
- local selected2
- local changed = false
- timer.Create("teleportationeffects" .. tostring(self),0.01,0,function()
- if(CLIENT)then return end
- if(IsValid(self))then
- if(tpstopsv == 1)then
- self:SendWeaponAnim(188)
- timer.Remove("teleportationeffects" .. tostring(self))
- timer.Remove("snapingidle" .. tostring(self))
- tpstopsv = 0
- return
- end
- net.Start( "tpeffects" )
- net.WriteEntity(self.Owner)
- net.Send( self.Owner )
- if selecteds then
- net.Start( "tpbeforeeffects" )
- net.WriteEntity(self.Owner)
- net.WriteVector(selecteds.pos)
- net.Send( self.Owner )
- end
- else
- timer.Remove("teleportationeffects" .. tostring(self))
- timer.Remove("snapingidle" .. tostring(self))
- end
- end)
- tpstopsv = 0
- if(CLIENT) then
- if(self.panel)then
- return
- end
- local window = vgui.Create( "DFrame" )
- window:SetSize( 600,600 )
- window:Center()
- window:SetTitle( "Sans Teleportation Menu" )
- window:MakePopup()
- window.Paint = function( self, w, h ) -- 'function Frame:Paint( w, h )' works too
- draw.RoundedBox( 0, 0, 0, w, h, Color( 100, 150, 255, 150 ) ) -- Draw a red box instead of the frame
- end
- function window:OnClose()
- net.Start("tpclose")
- net.SendToServer()
- timer.Remove("teleportationeffects" .. tostring(self))
- timer.Remove("snapingidle" .. tostring(self))
- end
- local label = vgui.Create( "DLabel", window )
- label:SetPos(320,100)
- label:SetColor(Color(255,255,255,255))
- label:SetFont("DermaLarge")
- label:SetText("Cordinates")
- label:SizeToContents()
- local vec1 = vgui.Create( "DTextEntry", window )
- vec1:SetPos( 250, 150 )
- vec1:SetSize( 100, 25 )
- vec1:SetText( "X" )
- vec1.OnGetFocus = function( self )
- if self:GetValue()=="X" then
- self:SetText("")
- end
- end
- vec1.OnLoseFocus = function( self )
- if self:GetValue()=="" then
- self:SetText("X")
- else
- self:OnEnter()
- end
- end
- vec1.OnEnter = function( self )
- if selected and tonumber(self:GetValue()) then
- selected.pos.x=tonumber(self:GetValue())
- changed=true
- end
- end
- local vec2 = vgui.Create( "DTextEntry", window )
- vec2:SetPos( 340, 150 )
- vec2:SetSize( 100, 25 )
- vec2:SetText( "Y" )
- vec2.OnGetFocus = function( self )
- if self:GetValue()=="Y" then
- self:SetText("")
- end
- end
- vec2.OnLoseFocus = function( self )
- if self:GetValue()=="" then
- self:SetText("Y")
- else
- self:OnEnter()
- end
- end
- vec2.OnEnter = function( self )
- if selected and tonumber(self:GetValue()) then
- selected.pos.y=tonumber(self:GetValue())
- changed=true
- end
- end
- local vec3 = vgui.Create( "DTextEntry", window )
- vec3:SetPos( 430, 150 )
- vec3:SetSize( 100, 25 )
- vec3:SetText( "Z" )
- vec3.OnGetFocus = function( self )
- if self:GetValue()=="Z" then
- self:SetText("")
- end
- end
- vec3.OnLoseFocus = function( self )
- if self:GetValue()=="" then
- self:SetText("Z")
- else
- self:OnEnter()
- end
- end
- vec3.OnEnter = function( self )
- if selected and tonumber(self:GetValue()) then
- selected.pos.z=tonumber(self:GetValue())
- changed=true
- end
- end
- local function UpdateTextBoxes()
- if selected then
- local vec=selected.pos
- if vec then
- vec1:SetText(vec.x)
- vec2:SetText(vec.y)
- vec3:SetText(vec.z)
- end
- else
- vec1:SetText("X")
- vec2:SetText("Y")
- vec3:SetText("Z")
- end
- end
- local listview = vgui.Create( "DListView", window )
- listview:SetPos(10,30)
- listview:SetSize(225,260)
- listview:SetMultiSelect( false )
- listview:AddColumn( "Saved Locations" )
- listview.OnClickLine = function(self,line)
- local name=line:GetValue(1)
- self:ClearSelection()
- self:SelectItem(line)
- for k,v in pairs(locations[map]) do
- if v.name==name then
- selected=v
- selected2=line
- UpdateTextBoxes()
- if selected then
- net.Start("tpselectedtoserver")
- net.WriteTable(selected)
- net.SendToServer()
- end
- end
- end
- end
- local friendfoe = {}
- listview.OnRowRightClick = function(lineid,line)
- local name=lineid:GetValue(1)
- for k,v in pairs(locations[map]) do
- if v.name==name then
- selected=v
- selected2=lineid
- UpdateTextBoxes()
- if selected then
- net.Start("tpselectedtoserver")
- net.WriteTable(selected)
- net.SendToServer()
- end
- end
- end
- if selected then
- for i, a in pairs(friendfoe)do
- if((a:GetPos() - self.Owner:GetPos()):Length() > 150)then
- table.RemoveByValue(friendfoe,a)
- end
- end
- self.Owner.ReturnPrevios = self.Owner:GetPos()
- net.Start( "teleportnownet" )
- net.WriteVector(selected.pos)
- if friendfoe then
- net.WriteTable(friendfoe)
- end
- net.SendToServer()
- window:Close()
- else
- LocalPlayer():ChatPrint("No location selected.")
- end
- end
- local nowline
- local listview1 = vgui.Create( "DListView", window )
- listview1:SetPos(190,400)
- listview1:SetSize(200,150)
- listview1:SetMultiSelect( false )
- listview1:AddColumn( "Friends or Foes?" )
- listview1.OnClickLine = function(self,line)
- nowline = line:GetValue(1)
- if(table.HasValue( friendfoe, nowline ))then
- table.RemoveByValue(friendfoe,line:GetValue(1))
- function line:Paint( width, hight )
- end
- else
- table.insert(friendfoe,line:GetValue(1))
- function line:Paint( width, hight )
- surface.SetDrawColor( 0, 200, 150, 150 )
- surface.DrawRect(0, 0, width, hight)
- end
- end
- end
- local function Reload()
- listview:ClearSelection()
- listview:Clear()
- selected=nil
- selected2=nil
- for k,v in pairs(locations[map]) do
- listview:AddLine( v.name )
- end
- if(self.Owner)then
- local friends = ents.FindInSphere( self.Owner:GetPos(), 300 )
- for i, f in pairs(friends) do
- if((f:IsPlayer() or f:IsNPC()) && f != self.Owner)then
- listview1:AddLine( f )
- end
- end
- end
- UpdateTextBoxes()
- end
- local function Load(msg)
- locations={}
- locations[map]={}
- if file.Exists("sans_locations.txt", "DATA") then
- locations=von.deserialize(file.Read("sans_locations.txt"))
- if not locations[map] then
- locations[map]={}
- end
- if msg then
- LocalPlayer():ChatPrint("Sans Locations loaded.")
- end
- elseif file.Exists("gasters_locations.txt", "DATA") then
- locations=von.deserialize(file.Read("gasters_locations.txt"))
- if not locations[map] then
- locations[map]={}
- end
- if msg then
- LocalPlayer():ChatPrint("No Sans's Locations found, but found Gaster's Locations.")
- end
- end
- Reload()
- end
- Load(false)
- local function Save(msg)
- file.Write("sans_locations.txt", von.serialize(locations))
- changed=false
- if msg then
- LocalPlayer():ChatPrint("Sans Locations saved.")
- end
- end
- local function New()
- Derma_StringRequest(
- "New Location",
- "Please enter a name for the new location",
- "",
- function(name)
- local exists=false
- for k,v in pairs(locations[map]) do
- if v.name==name then
- exists=true
- break
- end
- end
- if string.len(name)==0 then
- LocalPlayer():ChatPrint("Invalid name.")
- elseif exists then
- LocalPlayer():ChatPrint("Name already in use.")
- else
- local pos=Vector(0,0,0)
- local ang=Angle(0,0,0)
- Derma_Query(
- "Would you like to use the current Position?",
- "Use Current Pos?",
- "Yes",
- function()
- if IsValid(self.Owner) then
- pos=self.Owner:GetPos()
- ang=self.Owner:GetAngles()
- else
- LocalPlayer():ChatPrint("Error, som shit gone wrong")
- end
- table.insert(locations[map], {name=name, pos=pos, ang=ang})
- Reload()
- changed=true
- end,
- "No",
- function()
- table.insert(locations[map], {name=name, pos=pos, ang=ang})
- Reload()
- changed=true
- end
- )
- end
- end,
- function(name) end
- )
- end
- local function Rename(location,line)
- Derma_StringRequest(
- "New Location",
- "Please enter a new name for the location",
- location.name,
- function(name)
- local exists=false
- for k,v in pairs(locations[map]) do
- if v.name==name then
- exists=true
- break
- end
- end
- if string.len(name)==0 then
- LocalPlayer():ChatPrint("We don't tolerate nothingness here!")
- elseif exists then
- local funninamealreadyexistsnames = {"Nope.", "Nah.", "No. I Refuse", "Originality is nice to have."}
- LocalPlayer():ChatPrint(table.Random(funninamealreadyexistsnames))
- else
- location.name=name
- Reload()
- changed=true
- end
- end,
- function(name) end
- )
- end
- local function Clear()
- Derma_Query(
- "Are you sure you want to clear this maps stored location data?",
- "Clear Data",
- "Yes",
- function()
- locations[map]={}
- Reload()
- LocalPlayer():ChatPrint("Map location data cleared.")
- changed=true
- end,
- "No",
- function()
- end
- )
- end
- local function Delete(location)
- for k,v in pairs(locations[map]) do
- if v.name==location.name then
- table.remove(locations[map],k)
- Reload()
- changed=true
- end
- end
- end
- local closefunc = window.Close
- window.Close=function(self)
- if changed then
- Save(true)
- closefunc(self)
- else
- closefunc(self)
- end
- net.Start("tpclose")
- net.SendToServer()
- timer.Remove("checkforpeople" .. tostring(self))
- end
- local button = vgui.Create( "DButton", window )
- button:SetSize( 100, 30 )
- button:SetPos( 250, 200 )
- button:SetText( "New" )
- button.DoClick = function( button )
- New()
- end
- local button = vgui.Create( "DButton", window )
- button:SetSize( 100, 30 )
- button:SetPos( 340, 200 )
- button:SetText( "Rename" )
- button.DoClick = function( button )
- if selected then
- Rename(selected,selected2)
- else
- LocalPlayer():ChatPrint("No location selected.")
- end
- end
- local button = vgui.Create( "DButton", window )
- button:SetSize( 100, 30 )
- button:SetPos( 430, 200 )
- button:SetText( "Delete" )
- button.DoClick = function( button )
- if selected then
- Delete(selected)
- else
- LocalPlayer():ChatPrint("No location selected.")
- end
- end
- local button = vgui.Create( "DButton", window )
- button:SetSize( 100, 30 )
- button:SetPos( 400, 300 )
- button:SetText( "Music" )
- button.DoClick = function( button )
- local randuma = math.random(1,3)
- if(randuma == 1)then
- self:StopSound("koperplyar/megalovania1.mp3")
- self:StopSound("koperplyar/megalovania2.mp3")
- self:StopSound("koperplyar/megalovania3.mp3")
- self:EmitSound("koperplyar/megalovania1.mp3", 75, 100, 1)
- end
- if(randuma == 2)then
- self:StopSound("koperplyar/megalovania1.mp3")
- self:StopSound("koperplyar/megalovania2.mp3")
- self:StopSound("koperplyar/megalovania3.mp3")
- self:EmitSound("koperplyar/megalovania2.mp3", 75, 100, 1)
- end
- if(randuma == 3)then
- self:StopSound("koperplyar/megalovania1.mp3")
- self:StopSound("koperplyar/megalovania2.mp3")
- self:StopSound("koperplyar/megalovania3.mp3")
- self:EmitSound("koperplyar/megalovania3.mp3", 75, 100, 1)
- end
- end
- local button = vgui.Create( "DButton", window )
- button:SetSize( 100, 30 )
- button:SetPos( 490, 300 )
- button:SetText( "Stop" )
- button.DoClick = function( button )
- self:StopSound("koperplyar/megalovania1.mp3")
- self:StopSound("koperplyar/megalovania2.mp3")
- self:StopSound("koperplyar/megalovania3.mp3")
- end
- local button = vgui.Create( "DButton", window )
- button:SetSize( 100, 30 )
- button:SetPos( 0, 500 )
- button:SetText( "Help (console)" )
- button.DoClick = function( button )
- print("Main Controlls:")
- print("Primary: Fast Shooting Bones")
- print("Secondary: Gasterblaster. (up to 7)")
- print("50% can be locked down, so the other 50% aims further: (hold down E)")
- print("feature: can use telekanisis to edit the gasterblasters position (accidental feature)")
- print("Press E on the gasterblaster to fly it! and repress E to jump off.")
- print("Telekanisis (E): Can make objects fly to your will. (warning! players might be able to escape! keep them near you! this is a feature!)")
- print("can also use Shift / Tab to make them come closer or farther.")
- print("when pressing Alt it will launch it.")
- print("holding down SPACE and the movement-keys, will make it rotate!")
- print("Quick Teleport: When you press Shift + Crouch, you will quick teleport (you cannot teleport UP. this is intentional)")
- print("Long Teleport: When you press Schift + Alt, a menu will appear (this menu) where you can;")
- print("make new locations using X,Y,Z cordinates.")
- print("teleport to destination by right clicking.")
- print("or select the position. (this will show in game where the position is... via blue-effects)")
- print("delete....rename....and clear everything.")
- print("the music button plays one of the 3 remixes of megalovania. the stop button makes it stop.")
- print("the friends or foes is an feature that lets you click on nearby allies for them to teleport with you")
- print("it works by left clicking on one of the nearby entities within a radius on the menu, it should be highlited greenish blue")
- print("and to deselect simply left click again. it should return to white.")
- print("Piercing Bones: Shift + Crouch allows you to draw a line, wich will make an rectangle wich includes bones. that damage....")
- print("simply press the buttons, and move your mouse within 1 second")
- print("Shield (R): Simply hold down R to have a shield on. if working correctly. particles in formations of circles will appear, and you will get * 0.25 the damage")
- print("or otherwise known as /4 the damage.")
- print("Misc:")
- print("Custom Death: simply die. (if working correctly: body will dust / disintegrate)")
- print("Able to receive /~quote~/SOUL/~quote~/ from DT Sword, NOT YET IMPLEMENTED, IT AIN HIA.")
- end
- local label = vgui.Create( "DLabel", window )
- label:SetPos(260,300) -- Position
- label:SetColor(Color(255,255,255,255)) -- Color
- label:SetFont("Trebuchet24")
- label:SetText("Data") -- Text
- label:SizeToContents() -- make the control the same size as the text.
- local button = vgui.Create( "DButton", window )
- button:SetSize( 100, 30 )
- button:SetPos( 75, 300 )
- button:SetText( "Return" )
- button.DoClick = function( button )
- if(self.Owner.ReturnPrevios)then
- for i, a in pairs(friendfoe)do
- if((a:GetPos() - self.Owner:GetPos()):Length() > 150)then
- table.RemoveByValue(friendfoe,a)
- end
- end
- net.Start( "teleportnownet" )
- net.WriteVector(self.Owner.ReturnPrevios)
- if friendfoe then
- net.WriteTable(friendfoe)
- end
- net.SendToServer()
- window:Close()
- else
- self.Owner:ChatPrint("No earlier Location!")
- end
- end
- local button = vgui.Create( "DButton", window )
- button:SetSize( 100, 30 )
- button:SetPos( 140, 350 )
- button:SetText( "Clear Data" )
- button.DoClick = function( button )
- Clear()
- end
- local button = vgui.Create( "DButton", window )
- button:SetSize( 100, 30 )
- button:SetPos( 240, 350 )
- button:SetText( "Load Data" )
- button.DoClick = function( button )
- Load(true)
- end
- local button = vgui.Create( "DButton", window )
- button:SetSize( 100, 30 )
- button:SetPos( 340, 350 )
- button:SetText( "Save Data" )
- button.DoClick = function( button )
- Save(true)
- end
- self.panel = 1
- end
- saocc = CurTime() + sadelay
- end
- end
- local dodgeFadeAlphaD = 255 -- Start at full opacity
- local fadeSpeedD = 23 -- Speed at which the bar fades away
- local dodgeFadeAlphaS = 255 -- Start at full opacity
- local fadeSpeedS = 11 -- Speed at which the bar fades away
- local dodgeFadeAlphaT = 255 -- Start at full opacity
- local fadeSpeedT = 20 -- Speed at which the bar fades away
- if (CLIENT) then
- function SWEP:DrawHUD()
- local x=ScrW()/2
- local y=ScrH()/2
- local tc=TEXT_ALIGN_CENTER
- local tr=TEXT_ALIGN_RIGHT
- local tl=TEXT_ALIGN_LEFT
- local p=self.Owner
- local te=p:GetEyeTrace()
- local ta=te.Entity
- local c=color_white
- local d = self:GetNWInt("D") -- Dodge delay
- local n = self:GetNWInt("Stre")
- local tele = self:GetNWInt("Tele")
- local fadeOutD = false
- local fadeOutS = false
- local fadeOutT = false
- if d <= 0 then
- fadeOutD = true -- Start fading when the bar is full
- else
- fadeOutD = false
- dodgeFadeAlphaD = 255 -- Reset opacity when dodging again
- end
- if n <= 0 then
- fadeOutS = true -- Start fading when the bar is full
- else
- fadeOutS = false
- dodgeFadeAlphaS = 255 -- Reset opacity when dodging again
- end
- if tele <= 0 then
- fadeOutT = true -- Start fading when the bar is full
- else
- fadeOutT = false
- dodgeFadeAlphaT = 255 -- Reset opacity when dodging again
- end
- -- Gradually decrease alpha when fading
- if fadeOutD then
- dodgeFadeAlphaD = math.max(0, dodgeFadeAlphaD - (FrameTime() * fadeSpeedD))
- end
- if fadeOutS then
- dodgeFadeAlphaS = math.max(0, dodgeFadeAlphaS - (FrameTime() * fadeSpeedS))
- end
- if fadeOutT then
- dodgeFadeAlphaT = math.max(0, dodgeFadeAlphaT - (FrameTime() * fadeSpeedT))
- end
- surface.SetDrawColor(d*100,0,0,255 * (dodgeFadeAlphaD / 255))
- surface.DrawRect(ScrW()*.96-5,ScrH()*.35-5,ScrW()*.025+10,ScrH()*.1+10)
- surface.SetDrawColor(0,205-d*100,255-d* 100, dodgeFadeAlphaD)
- surface.DrawRect(ScrW()*.96,ScrH()*.35,ScrW()*.025,ScrH()*.1*(1-d))
- draw.SimpleText("Dodge delay", "8bitoperator", ScrW() * .99, ScrH() * .47,Color(255,255-d*100,255-d * 100, dodgeFadeAlphaD),tr,tc)
- surface.SetDrawColor(0,0,0,255 * (dodgeFadeAlphaS / 255))
- surface.DrawRect(ScrW()*.96-5,ScrH()*.5-5,ScrW()*.025+10,ScrH()*.25+10)
- --surface.SetDrawColor(0,0,255,155)
- --surface.SetDrawColor(255,255,255,255)
- surface.SetDrawColor(255,255-n*2.3,102-n*2.3, dodgeFadeAlphaS)
- local g=1-self:GetNWInt("Stre")/GetConVarNumber("gt_sans_sr")
- local u=math.floor(math.sin(CurTime()*9)*1.2)
- local u2=0
- local r=math.floor(math.sin(CurTime()*4.5+1)*1.1)
- if g<.35 then r=0 u=math.floor(math.sin(CurTime()*2)/2*3.6)u2=u/2 end
- u=ScrH()-298+u
- r=ScrW()-250+r
- surface.DrawRect(ScrW()*.96,ScrH()*.5,ScrW()*.025,ScrH()*.25*g)
- --surface.SetDrawColor(0,0,0,255)
- local t=1-math.Clamp(self:GetNextPrimaryFire()-CurTime(),0,5)*2
- --surface.SetDrawColor(255,255,255,255*t)
- draw.SimpleText("Strength", "8bitoperator", ScrW() * .99, ScrH() * .77,Color(255,255-n*2,255-n*2, dodgeFadeAlphaS),tr,tc)
- surface.SetDrawColor(0,0,0,255 * (dodgeFadeAlphaT / 255))
- surface.DrawRect(ScrW()*.01-5,ScrH()*.5-5,ScrW()*.025+10,ScrH()*.25+10) -- Adjusted position to left side
- surface.SetDrawColor(0,105-tele*3.5,255-tele*3.5, dodgeFadeAlphaT)
- local gtele=1-self:GetNWInt("Tele")/GetConVarNumber("gt_sans_tc")
- local utele=math.floor(math.sin(CurTime()*9)*1.2)
- local utele2=0
- local l=math.floor(math.sin(CurTime()*4.5+1)*1.1)
- if gtele<.35 then l=0 utele=math.floor(math.sin(CurTime()*2)/2*3.6)utele2=utele/2 end
- utele=ScrH()-298+utele
- l=250+l -- Changed from ScrW()-250+l to move it to the left
- surface.DrawRect(ScrW()*.01,ScrH()*.5,ScrW()*.025,ScrH()*.25*gtele) -- Adjusted position to left side
- local t=1-math.Clamp(self:GetNextPrimaryFire()-CurTime(),0,5)*2
- draw.SimpleText("Telekinesis", "8bitoperator", ScrW() * .01, ScrH() * .77,Color(255,255-tele*3.5,255-tele*3.5, dodgeFadeAlphaT),tl,tc) -- Adjusted text position to left
- local sizex = 300
- local sizey = 30
- local indentx = 10
- local indenty = 10
- local quarter = 105.6 -- Each quarter of the bar in units
- local sastatus = saspower >= max_saspower and "Special Ability (Ready)" or "Special Ability"
- -- Text
- surface.SetFont("ChatFont")
- surface.SetTextColor(100 + saspower, 100 + saspower, 100 + saspower, 255)
- surface.SetTextPos(ScrW() - sizex - indentx, ScrH() - sizey - indenty - 19)
- surface.DrawText(sastatus)
- -- Background bar
- surface.SetDrawColor(90, 90, 90, 125)
- surface.DrawRect(ScrW() - sizex - indentx, ScrH() - sizey - indenty, sizex, sizey)
- -- Progress bar
- surface.SetDrawColor(150 + saspower, 150 + saspower, 150 + saspower, 255)
- surface.DrawRect(ScrW() - sizex - indentx, ScrH() - sizey - indenty, (saspower / max_saspower) * sizex, sizey)
- -- Quarter separators
- for i = 1, 2 do -- Draw 3 separators at 1/4, 1/2, and 3/4
- local separatorX = ScrW() - sizex - indentx + (i * quarter * (sizex / 300))
- surface.SetDrawColor(155 - saspower, 155 - saspower, 155 - saspower, 255) -- Black color for the separators
- surface.DrawRect(separatorX, ScrH() - sizey - indenty, 2, sizey) -- 2-pixel wide line
- end
- end
- end
- if CLIENT then
- hook.Add( "RenderScreenspaceEffects", "blueauras.RenderScreenspaceEffects", function()
- local lp = LocalPlayer()
- for k,v in ipairs( ents.GetAll() ) do
- local sanessuser = v:GetNWEntity( "blueauras", NULL)
- if IsValid(sanessuser) then
- local col = Color(sanessuser:GetPlayerColor().x*2550,sanessuser:GetPlayerColor().y*2550,sanessuser:GetPlayerColor().z*2550,255)
- end
- end
- for k,v in ipairs( player.GetAll() ) do
- local weap = v:GetActiveWeapon()
- if IsValid(weap) and IsValid(weap:GetNWEntity( "blueauras", NULL)) then
- local sanessuser = weap:GetNWEntity( "blueauras", NULL)
- local col = Color(sanessuser:GetPlayerColor().x*2550,sanessuser:GetPlayerColor().y*2550,sanessuser:GetPlayerColor().z*2550,255)
- end
- end
- end)
- hook.Add( "Think", "blueauras.Glow", function()
- for k,v in ipairs( ents.GetAll() ) do
- local sanessuser = v:GetNWEntity( "blueauras", NULL)
- if IsValid(sanessuser) then
- local light = DynamicLight( v:EntIndex() )
- if ( light ) then
- light.r = 0
- light.g = 155
- light.b = 255
- light.Pos = v:WorldSpaceCenter() + LocalPlayer():GetAimVector()
- light.Brightness = 22
- light.Size = 6
- light.Decay = 25
- light.DieTime = CurTime() + 0.2
- light.Style = 1
- end
- end
- end
- end )
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement