mirror of
https://github.com/lifestorm/wnsrc.git
synced 2025-12-17 13:53:45 +03:00
Upload
This commit is contained in:
145
gamemodes/base/gamemode/player_class/player_default.lua
Normal file
145
gamemodes/base/gamemode/player_class/player_default.lua
Normal file
@@ -0,0 +1,145 @@
|
||||
--[[
|
||||
| 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/
|
||||
--]]
|
||||
|
||||
|
||||
AddCSLuaFile()
|
||||
|
||||
include( "taunt_camera.lua" )
|
||||
|
||||
local PLAYER = {}
|
||||
|
||||
PLAYER.DisplayName = "Default Class"
|
||||
|
||||
PLAYER.SlowWalkSpeed = 200 -- How fast to move when slow-walking (+WALK)
|
||||
PLAYER.WalkSpeed = 400 -- How fast to move when not running
|
||||
PLAYER.RunSpeed = 600 -- How fast to move when running
|
||||
PLAYER.CrouchedWalkSpeed = 0.3 -- Multiply move speed by this when crouching
|
||||
PLAYER.DuckSpeed = 0.3 -- How fast to go from not ducking, to ducking
|
||||
PLAYER.UnDuckSpeed = 0.3 -- How fast to go from ducking, to not ducking
|
||||
PLAYER.JumpPower = 200 -- How powerful our jump should be
|
||||
PLAYER.CanUseFlashlight = true -- Can we use the flashlight
|
||||
PLAYER.MaxHealth = 100 -- Max health we can have
|
||||
PLAYER.MaxArmor = 100 -- Max armor we can have
|
||||
PLAYER.StartHealth = 100 -- How much health we start with
|
||||
PLAYER.StartArmor = 0 -- How much armour we start with
|
||||
PLAYER.DropWeaponOnDie = false -- Do we drop our weapon when we die
|
||||
PLAYER.TeammateNoCollide = true -- Do we collide with teammates or run straight through them
|
||||
PLAYER.AvoidPlayers = true -- Automatically swerves around other players
|
||||
PLAYER.UseVMHands = true -- Uses viewmodel hands
|
||||
|
||||
--
|
||||
-- Name: PLAYER:SetupDataTables
|
||||
-- Desc: Set up the network table accessors
|
||||
-- Arg1:
|
||||
-- Ret1:
|
||||
--
|
||||
function PLAYER:SetupDataTables()
|
||||
end
|
||||
|
||||
--
|
||||
-- Name: PLAYER:Init
|
||||
-- Desc: Called when the class object is created (shared)
|
||||
-- Arg1:
|
||||
-- Ret1:
|
||||
--
|
||||
function PLAYER:Init()
|
||||
end
|
||||
|
||||
--
|
||||
-- Name: PLAYER:Spawn
|
||||
-- Desc: Called serverside only when the player spawns
|
||||
-- Arg1:
|
||||
-- Ret1:
|
||||
--
|
||||
function PLAYER:Spawn()
|
||||
end
|
||||
|
||||
--
|
||||
-- Name: PLAYER:Loadout
|
||||
-- Desc: Called on spawn to give the player their default loadout
|
||||
-- Arg1:
|
||||
-- Ret1:
|
||||
--
|
||||
function PLAYER:Loadout()
|
||||
|
||||
self.Player:Give( "weapon_pistol" )
|
||||
self.Player:GiveAmmo( 255, "Pistol", true )
|
||||
|
||||
end
|
||||
|
||||
function PLAYER:SetModel()
|
||||
|
||||
local cl_playermodel = self.Player:GetInfo( "cl_playermodel" )
|
||||
local modelname = player_manager.TranslatePlayerModel( cl_playermodel )
|
||||
util.PrecacheModel( modelname )
|
||||
self.Player:SetModel( modelname )
|
||||
|
||||
end
|
||||
|
||||
function PLAYER:Death( inflictor, attacker )
|
||||
end
|
||||
|
||||
-- Clientside only
|
||||
function PLAYER:CalcView( view ) end -- Setup the player's view
|
||||
function PLAYER:CreateMove( cmd ) end -- Creates the user command on the client
|
||||
function PLAYER:ShouldDrawLocal() end -- Return true if we should draw the local player
|
||||
|
||||
-- Shared
|
||||
function PLAYER:StartMove( cmd, mv ) end -- Copies from the user command to the move
|
||||
function PLAYER:Move( mv ) end -- Runs the move (can run multiple times for the same client)
|
||||
function PLAYER:FinishMove( mv ) end -- Copy the results of the move back to the Player
|
||||
|
||||
--
|
||||
-- Name: PLAYER:ViewModelChanged
|
||||
-- Desc: Called when the player changes their weapon to another one causing their viewmodel model to change
|
||||
-- Arg1: Entity|viewmodel|The viewmodel that is changing
|
||||
-- Arg2: string|old|The old model
|
||||
-- Arg3: string|new|The new model
|
||||
-- Ret1:
|
||||
--
|
||||
function PLAYER:ViewModelChanged( vm, old, new )
|
||||
end
|
||||
|
||||
--
|
||||
-- Name: PLAYER:PreDrawViewmodel
|
||||
-- Desc: Called before the viewmodel is being drawn (clientside)
|
||||
-- Arg1: Entity|viewmodel|The viewmodel
|
||||
-- Arg2: Entity|weapon|The weapon
|
||||
-- Ret1:
|
||||
--
|
||||
function PLAYER:PreDrawViewModel( vm, weapon )
|
||||
end
|
||||
|
||||
--
|
||||
-- Name: PLAYER:PostDrawViewModel
|
||||
-- Desc: Called after the viewmodel has been drawn (clientside)
|
||||
-- Arg1: Entity|viewmodel|The viewmodel
|
||||
-- Arg2: Entity|weapon|The weapon
|
||||
-- Ret1:
|
||||
--
|
||||
function PLAYER:PostDrawViewModel( vm, weapon )
|
||||
end
|
||||
|
||||
--
|
||||
-- Name: PLAYER:GetHandsModel
|
||||
-- Desc: Called on player spawn to determine which hand model to use
|
||||
-- Arg1:
|
||||
-- Ret1: table|info|A table containing model, skin and body
|
||||
--
|
||||
function PLAYER:GetHandsModel()
|
||||
|
||||
-- return { model = "models/weapons/c_arms_cstrike.mdl", skin = 1, body = "0100000" }
|
||||
|
||||
local playermodel = player_manager.TranslateToPlayerModelName( self.Player:GetModel() )
|
||||
return player_manager.TranslatePlayerHands( playermodel )
|
||||
|
||||
end
|
||||
|
||||
player_manager.RegisterClass( "player_default", PLAYER, nil )
|
||||
133
gamemodes/base/gamemode/player_class/taunt_camera.lua
Normal file
133
gamemodes/base/gamemode/player_class/taunt_camera.lua
Normal file
@@ -0,0 +1,133 @@
|
||||
--[[
|
||||
| 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/
|
||||
--]]
|
||||
|
||||
|
||||
AddCSLuaFile()
|
||||
|
||||
--
|
||||
-- This is designed so you can call it like
|
||||
--
|
||||
-- tauntcam = TauntCamera()
|
||||
--
|
||||
-- Then you have your own copy.
|
||||
--
|
||||
function TauntCamera()
|
||||
|
||||
local CAM = {}
|
||||
|
||||
local WasOn = false
|
||||
|
||||
local CustomAngles = angle_zero
|
||||
local PlayerLockAngles = nil
|
||||
|
||||
local InLerp = 0
|
||||
local OutLerp = 1
|
||||
|
||||
--
|
||||
-- Draw the local player if we're active in any way
|
||||
--
|
||||
CAM.ShouldDrawLocalPlayer = function( self, ply, on )
|
||||
|
||||
return on || OutLerp < 1
|
||||
|
||||
end
|
||||
|
||||
--
|
||||
-- Implements the third person, rotation view (with lerping in/out)
|
||||
--
|
||||
CAM.CalcView = function( self, view, ply, on )
|
||||
|
||||
if ( !ply:Alive() || !IsValid( ply:GetViewEntity() ) || ply:GetViewEntity() != ply ) then on = false end
|
||||
|
||||
if ( WasOn != on ) then
|
||||
|
||||
if ( on ) then InLerp = 0 end
|
||||
if ( !on ) then OutLerp = 0 end
|
||||
|
||||
WasOn = on
|
||||
|
||||
end
|
||||
|
||||
if ( !on && OutLerp >= 1 ) then
|
||||
|
||||
CustomAngles = view.angles * 1
|
||||
CustomAngles.r = 0
|
||||
PlayerLockAngles = nil
|
||||
InLerp = 0
|
||||
return
|
||||
|
||||
end
|
||||
|
||||
if ( PlayerLockAngles == nil ) then return end
|
||||
|
||||
--
|
||||
-- Simple 3rd person camera
|
||||
--
|
||||
local TargetOrigin = view.origin - CustomAngles:Forward() * 100
|
||||
local tr = util.TraceHull( { start = view.origin, endpos = TargetOrigin, mask = MASK_SHOT, filter = player.GetAll(), mins = Vector( -8, -8, -8 ), maxs = Vector( 8, 8, 8 ) } )
|
||||
TargetOrigin = tr.HitPos + tr.HitNormal
|
||||
|
||||
if ( InLerp < 1 ) then
|
||||
|
||||
InLerp = InLerp + FrameTime() * 5.0
|
||||
view.origin = LerpVector( InLerp, view.origin, TargetOrigin )
|
||||
view.angles = LerpAngle( InLerp, PlayerLockAngles, CustomAngles )
|
||||
return true
|
||||
|
||||
end
|
||||
|
||||
if ( OutLerp < 1 ) then
|
||||
|
||||
OutLerp = OutLerp + FrameTime() * 3.0
|
||||
view.origin = LerpVector( 1-OutLerp, view.origin, TargetOrigin )
|
||||
view.angles = LerpAngle( 1-OutLerp, PlayerLockAngles, CustomAngles )
|
||||
return true
|
||||
|
||||
end
|
||||
|
||||
view.angles = CustomAngles * 1
|
||||
view.origin = TargetOrigin
|
||||
return true
|
||||
|
||||
end
|
||||
|
||||
--
|
||||
-- Freezes the player in position and uses the input from the user command to
|
||||
-- rotate the custom third person camera
|
||||
--
|
||||
CAM.CreateMove = function( self, cmd, ply, on )
|
||||
|
||||
if ( !ply:Alive() ) then on = false end
|
||||
if ( !on ) then return end
|
||||
|
||||
if ( PlayerLockAngles == nil ) then
|
||||
PlayerLockAngles = CustomAngles * 1
|
||||
end
|
||||
|
||||
--
|
||||
-- Rotate our view
|
||||
--
|
||||
CustomAngles.pitch = CustomAngles.pitch + cmd:GetMouseY() * 0.01
|
||||
CustomAngles.yaw = CustomAngles.yaw - cmd:GetMouseX() * 0.01
|
||||
|
||||
--
|
||||
-- Lock the player's controls and angles
|
||||
--
|
||||
cmd:SetViewAngles( PlayerLockAngles )
|
||||
cmd:ClearButtons()
|
||||
cmd:ClearMovement()
|
||||
|
||||
return true
|
||||
|
||||
end
|
||||
|
||||
return CAM
|
||||
|
||||
end
|
||||
Reference in New Issue
Block a user