--[[ | 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/ --]] include( "ai_translations.lua" ) include( "sh_anim.lua" ) include( "shared.lua" ) SWEP.Slot = 0 -- Slot in the weapon selection menu SWEP.SlotPos = 10 -- Position in the slot SWEP.DrawAmmo = true -- Should draw the default HL2 ammo counter SWEP.DrawCrosshair = true -- Should draw the default crosshair SWEP.DrawWeaponInfoBox = true -- Should draw the weapon info box SWEP.BounceWeaponIcon = true -- Should the weapon icon bounce? SWEP.SwayScale = 1.0 -- The scale of the viewmodel sway SWEP.BobScale = 1.0 -- The scale of the viewmodel bob SWEP.RenderGroup = RENDERGROUP_OPAQUE -- Override this in your SWEP to set the icon in the weapon selection SWEP.WepSelectIcon = surface.GetTextureID( "weapons/swep" ) -- This is the corner of the speech bubble SWEP.SpeechBubbleLid = surface.GetTextureID( "gui/speech_lid" ) --[[--------------------------------------------------------- You can draw to the HUD here - it will only draw when the client has the weapon deployed.. -----------------------------------------------------------]] function SWEP:DrawHUD() end --[[--------------------------------------------------------- Checks the objects before any action is taken This is to make sure that the entities haven't been removed -----------------------------------------------------------]] function SWEP:DrawWeaponSelection( x, y, wide, tall, alpha ) -- Set us up the texture surface.SetDrawColor( 255, 255, 255, alpha ) surface.SetTexture( self.WepSelectIcon ) -- Lets get a sin wave to make it bounce local fsin = 0 if ( self.BounceWeaponIcon == true ) then fsin = math.sin( CurTime() * 10 ) * 5 end -- Borders y = y + 10 x = x + 10 wide = wide - 20 -- Draw that mother surface.DrawTexturedRect( x + fsin, y - fsin, wide - fsin * 2 , ( wide / 2 ) + fsin ) -- Draw weapon info box self:PrintWeaponInfo( x + wide + 20, y + tall * 0.95, alpha ) end --[[--------------------------------------------------------- This draws the weapon info box -----------------------------------------------------------]] function SWEP:PrintWeaponInfo( x, y, alpha ) if ( self.DrawWeaponInfoBox == false ) then return end if ( self.InfoMarkup == nil ) then local title_color = "" local text_color = "" local str = "" if ( self.Author != "" ) then str = str .. title_color .. "Author:\t" .. text_color .. self.Author .. "\n" end if ( self.Contact != "" ) then str = str .. title_color .. "Contact:\t" .. text_color .. self.Contact .. "\n\n" end if ( self.Purpose != "" ) then str = str .. title_color .. "Purpose:\n" .. text_color .. self.Purpose .. "\n\n" end if ( self.Instructions != "" ) then str = str .. title_color .. "Instructions:\n" .. text_color .. self.Instructions .. "\n" end str = str .. "" self.InfoMarkup = markup.Parse( str, 250 ) end surface.SetDrawColor( 60, 60, 60, alpha ) surface.SetTexture( self.SpeechBubbleLid ) surface.DrawTexturedRect( x, y - 64 - 5, 128, 64 ) draw.RoundedBox( 8, x - 5, y - 6, 260, self.InfoMarkup:GetHeight() + 18, Color( 60, 60, 60, alpha ) ) self.InfoMarkup:Draw( x + 5, y + 5, nil, nil, alpha ) end --[[--------------------------------------------------------- Name: SWEP:FreezeMovement() Desc: Return true to freeze moving the view -----------------------------------------------------------]] function SWEP:FreezeMovement() return false end --[[--------------------------------------------------------- Name: SWEP:ViewModelDrawn( viewModel ) Desc: Called straight after the viewmodel has been drawn -----------------------------------------------------------]] function SWEP:ViewModelDrawn( vm ) end --[[--------------------------------------------------------- Name: OnRestore Desc: Called immediately after a "load" -----------------------------------------------------------]] function SWEP:OnRestore() end --[[--------------------------------------------------------- Name: CustomAmmoDisplay Desc: Return a table -----------------------------------------------------------]] function SWEP:CustomAmmoDisplay() end --[[--------------------------------------------------------- Name: GetViewModelPosition Desc: Allows you to re-position the view model -----------------------------------------------------------]] function SWEP:GetViewModelPosition( pos, ang ) return pos, ang end --[[--------------------------------------------------------- Name: TranslateFOV Desc: Allows the weapon to translate the player's FOV (clientside) -----------------------------------------------------------]] function SWEP:TranslateFOV( current_fov ) return current_fov end --[[--------------------------------------------------------- Name: DrawWorldModel Desc: Draws the world model (not the viewmodel) -----------------------------------------------------------]] function SWEP:DrawWorldModel() self:DrawModel() end --[[--------------------------------------------------------- Name: DrawWorldModelTranslucent Desc: Draws the world model (not the viewmodel) -----------------------------------------------------------]] function SWEP:DrawWorldModelTranslucent() self:DrawModel() end --[[--------------------------------------------------------- Name: AdjustMouseSensitivity Desc: Allows you to adjust the mouse sensitivity. -----------------------------------------------------------]] function SWEP:AdjustMouseSensitivity() return nil end --[[--------------------------------------------------------- Name: GetTracerOrigin Desc: Allows you to override where the tracer comes from (in first person view) returning anything but a vector indicates that you want the default action -----------------------------------------------------------]] function SWEP:GetTracerOrigin() --[[ local ply = self:GetOwner() local pos = ply:EyePos() + ply:EyeAngles():Right() * -5 return pos --]] end --[[--------------------------------------------------------- Name: FireAnimationEvent Desc: Allows you to override weapon animation events -----------------------------------------------------------]] function SWEP:FireAnimationEvent( pos, ang, event, options ) if ( !self.CSMuzzleFlashes ) then return end -- CS Muzzle flashes if ( event == 5001 or event == 5011 or event == 5021 or event == 5031 ) then local data = EffectData() data:SetFlags( 0 ) data:SetEntity( self:GetOwner():GetViewModel() ) data:SetAttachment( math.floor( ( event - 4991 ) / 10 ) ) data:SetScale( 1 ) if ( self.CSMuzzleX ) then util.Effect( "CS_MuzzleFlash_X", data ) else util.Effect( "CS_MuzzleFlash", data ) end return true end end