add sborka

This commit is contained in:
2026-03-31 10:27:04 +03:00
commit f5e5f56c84
2345 changed files with 382127 additions and 0 deletions

View File

@@ -0,0 +1,101 @@
AddCSLuaFile()
local animCooldown = CreateConVar("talking_animation_cooldown", "2.5", FCVAR_ARCHIVE, "Change cooldown of animation(starts with the animation)")
local animChance = CreateClientConVar("talking_animation_chance", "1",true,true, "Change the chance of talking animation happening", 0, 1)
local enableAnimsClient = CreateClientConVar("enable_player_talking_animation", "1",true,true, "Enable or disable your talking animation.", 0, 1)
local enableVoiceText = CreateClientConVar("talking_chatvoice_animations", "0", true, true, "Enable talking animation only for voice/text chat or both")
local enableWeaponAnims = CreateClientConVar("enable_player_weapon_anims","1",true,true,"Enable talking animations with weapons")
if SERVER then
util.AddNetworkString( "TalkingStart" )
end
if CLIENT then
local doingAnim = false
timer.Create("toggleAnim", 5, 0, function()
if doingAnim then
doingAnim = false
end
end )
hook.Add("PopulateToolMenu", "TalkingAnimationMenu", function()
spawnmenu.AddToolMenuOption("Options", "Player Talking Animation", "TalkingAnimationMenu", "Settings", "", "", function(panel)
local isAdmin = LocalPlayer():IsAdmin()
panel:NumSlider("Talking animation chance", "talking_animation_chance", 0, 1, 2)
panel:NumSlider("Talking animation cooldown", "talking_animation_cooldown", 0,60,1)
panel:Help("(Cooldown starts with the animation)")
panel:NumSlider("Talking animation only for voice/text chat or both", "talking_chatvoice_animations", 0,2,0)
panel:Help("0 - Animations for both text and voice chat")
panel:Help("1 - Animations only for voice chat")
panel:Help("2 - Animations only for text chat")
panel:CheckBox("Enable talking animation with weapons", "enable_player_weapon_anims")
panel:CheckBox("Enable talking animation", "enable_player_talking_animation")
if isAdmin then
panel:Help("------------------------------------")
panel:CheckBox("Enable talking animation (Server)", "enable_talking_animation")
panel:Help("Enable or disable talking animation for everyone")
end
end)
end)
hook.Add("PlayerStartVoice", "AnimationStart", function(player)
if ( player != LocalPlayer() ) then return end
if enableAnimsClient:GetBool() and (!bDead) and enableVoiceText:GetInt() == 0 or enableVoiceText:GetInt() == 1 then
local chance = math.Rand(0,1)
if chance <= animChance:GetFloat() and doingAnim == false then
doingAnim = true
lookup = player:LookupSequence("M_g_sweepout")
if lookup == -1 then
net.Start( "TalkingStart" )
net.WriteBool(true)
net.WriteString("M")
net.WriteBool(enableWeaponAnims:GetBool())
net.SendToServer()
else
net.Start( "TalkingStart" )
net.WriteBool(true)
net.WriteString("W")
net.WriteBool(enableWeaponAnims:GetBool())
net.SendToServer()
end
end
end
end)
hook.Add( "OnPlayerChat", "SendChatTalkingAnimation", function( ply, strText, bTeam, bDead )
if ( ply != LocalPlayer() ) then return end
if enableAnimsClient:GetBool() and (!bDead) and enableVoiceText:GetInt() == 0 or enableVoiceText:GetInt() == 2 then
local chance = math.Rand(0,1)
if chance <= animChance:GetFloat() and doingAnim == false then
doingAnim = true
lookup = ply:LookupSequence("M_g_sweepout")
if lookup == -1 then
net.Start( "TalkingStart" )
net.WriteBool(true)
net.WriteString("M")
net.WriteBool(enableWeaponAnims:GetBool())
net.SendToServer()
else
net.Start( "TalkingStart" )
net.WriteBool(true)
net.WriteString("W")
net.WriteBool(enableWeaponAnims:GetBool())
net.SendToServer()
end
end
end
end)
net.Receive("TalkingAnimNet", function()
local ply = net.ReadPlayer()
local lookup = net.ReadUInt(16)
if not IsValid(ply) then return end
if not ply:IsPlayer() then return end
if not lookup or lookup == 0 then return end
ply:SetLayerBlendIn(lookup, 1)
ply:AddVCDSequenceToGestureSlot(6, lookup, 0, true)
timer.Adjust("toggleAnim", animCooldown:GetFloat())
timer.Start("toggleAnim")
end)
end

View File

@@ -0,0 +1,23 @@
hook.Add( "InitLoadAnimations", "wOS.DynaBase.CustomMount", function()
wOS.DynaBase:RegisterSource({
Name = "Player Talking Animation",
Type = WOS_DYNABASE.EXTENSION,
Male = "models/humans/male_gestures.mdl",
Female = "models/humans/female_gestures.mdl",
})
hook.Add( "PreLoadAnimations", "wOS.DynaBase.MountPTA", function( gender )
if gender == WOS_DYNABASE.SHARED then return end
if gender == WOS_DYNABASE.FEMALE then
IncludeModel( "models/mossman_gestures.mdl" )
IncludeModel( "models/alyx_gest_ep1.mdl")
IncludeModel( "models/alyx_gest_ep2.mdl")
IncludeModel( "models/Eli_gestures.mdl" )
IncludeModel( "models/humans/male_gestures.mdl")
elseif gender == WOS_DYNABASE.MALE then
IncludeModel( "models/Eli_gestures.mdl" )
IncludeModel( "models/humans/male_gestures.mdl")
end
end )
end )

View File

@@ -0,0 +1,233 @@
AddCSLuaFile()
local enableAnims = CreateConVar("enable_talking_animation", "1", FCVAR_ARCHIVE, "Enable or disable talking animation.")
local animCooldown = CreateConVar("talking_animation_cooldown", "2.5", FCVAR_ARCHIVE, "Change cooldown of animation(starts with the animation)")
local gender = "M"
local lastAnim = ""
local talkingAnimationM = {
"Gesture01",
"Gesture05",
"Gesture05NP",
"Gesture06",
"Gesture06NP",
"Gesture07",
"Gesture13",
"E_g_shrug",
"G_medurgent_mid",
"G_righthandroll",
"G_righthandheavy",
"g_palm_out_l",
"g_palm_out_high_l"
}
local talkingAnimationWeaponsM = {
"g_Rifle_Lhand",
"g_Rifle_Lhand_low",
"bg_accentUp",
"bg_up_l",
"bg_up_r",
"g_palm_out_high_l",
"g_palm_up_high_l"
}
local talkingAnimationW = {
"A_gesture16",
"M_g_sweepout",
"A_g_midhigh_arcout",
"A_g_midhigh_arcout_left",
"A_g_midhigh_arcout_right",
"A_g_rtl_dwnshp",
"A_g_low2side_palmsout",
"A_g_hflipout",
"A_g_armscrossed",
"A_g_rthdflipout",
"A_g_mid_rtfingflareout",
"A_g_mid_2hdcutdwn",
"A_g_mid_2hdcutdwn_rt",
"A_g_midrtarcdwnout",
"A_g_rtsweepoutbig",
"A_g_leftsweepoutbig",
"A_g_mid_rtcutdwn"
}
local talkingAnimationWeaponsW = {
"A_g_midhigh_arcout_left",
"g_Rifle_Lhand",
"g_Rifle_Lhand_low",
"bg_accentUp",
"bg_up_l",
"bg_up_r"
}
local nonweapon = {
"camera",
"duel",
"knife",
"melee",
"melee2",
"physgun",
"slam",
"normal",
"grenade",
"fist"
}
local doingAnim = false
local lastAnim = ""
function fixtables()
print("Fixed tables!")
talkingAnimationWeaponsM = {
"g_Rifle_Lhand",
"g_Rifle_Lhand_low",
"bg_accentUp",
"bg_up_l",
"bg_up_r",
"g_palm_out_high_l",
"g_palm_up_high_l"
}
talkingAnimationM = {
"Gesture01",
"Gesture05",
"Gesture05NP",
"Gesture06",
"Gesture06NP",
"Gesture07",
"Gesture13",
"E_g_shrug",
"G_medurgent_mid",
"G_righthandroll",
"G_righthandheavy",
"g_palm_out_l",
"g_palm_out_high_l"
}
talkingAnimationW = {
"A_gesture16",
"M_g_sweepout",
"A_g_midhigh_arcout",
"A_g_midhigh_arcout_left",
"A_g_midhigh_arcout_right",
"A_g_rtl_dwnshp",
"A_g_low2side_palmsout",
"A_g_hflipout",
"A_g_armscrossed",
"A_g_rthdflipout",
"A_g_mid_rtfingflareout",
"A_g_mid_2hdcutdwn",
"A_g_mid_2hdcutdwn_rt",
"A_g_midrtarcdwnout",
"A_g_rtsweepoutbig",
"A_g_leftsweepoutbig",
"A_g_mid_rtcutdwn"
}
talkingAnimationWeaponsW = {
"A_g_midhigh_arcout_left",
"g_Rifle_Lhand",
"g_Rifle_Lhand_low",
"bg_accentUp",
"bg_up_l",
"bg_up_r"
}
end
if SERVER then
util.AddNetworkString("TalkingAnimNet")
function GetWeaponHoldAnim( ent)
if( !IsValid( ent ) ) then return nil end
local physObj = ent:GetPhysicsObject()
if (!IsValid(physObj)) then return false end
local activeweapon = ent:GetActiveWeapon()
print(activeweapon)
if activeweapon == not nil then
local wephold = activeweapon:GetHoldType()
elseif activeweapon == nil then
local wephold = "normal"
end
for i=0,#nonweapon do
if wephold == nonweapon[i] then
return true
end
end
end
net.Receive("TalkingStart", function(len,ply)
local IsDeveloper = GetConVar("developer"):GetInt()
local isTalking = net.ReadBool()
local gender = net.ReadString()
local enableWeaponAnims = net.ReadBool()
local isDealingWithTables = false
if(!IsValid(ply)) then return nil end
if (!ply:Alive()) then return nil end
if(!isTalking) then return nil end
if isTalking and isDealingWithTables == false and enableAnims:GetBool() then
local wephold = GetWeaponHoldAnim(ply)
local animationToLookup = ""
isDealingWithTables = true
if wephold and gender == "M" then
animationToLookup = talkingAnimationM[math.random(#talkingAnimationM)]
if lastAnim == animationToLookup then
table.RemoveByValue(talkingAnimationM, lastAnim)
animationToLookup = talkingAnimationM[math.random(#talkingAnimationM)]
table.insert(talkingAnimationM, lastAnim)
end
elseif wephold and gender == "W" then
animationToLookup = talkingAnimationW[math.random(#talkingAnimationW)]
if lastAnim == animationToLookup then
table.RemoveByValue(talkingAnimationW, lastAnim)
animationToLookup = talkingAnimationW[math.random(#talkingAnimationW)]
table.insert(talkingAnimationW, lastAnim)
end
elseif gender == "M" and enableWeaponAnims then
animationToLookup = talkingAnimationWeaponsM[math.random(#talkingAnimationWeaponsM)]
if lastAnim == animationToLookup then
table.RemoveByValue(talkingAnimationWeaponsM, lastAnim)
animationToLookup = talkingAnimationWeaponsM[math.random(#talkingAnimationWeaponsM)]
table.insert(talkingAnimationWeaponsM, lastAnim)
end
elseif gender == "W" and enableWeaponAnims then
animationToLookup = talkingAnimationWeaponsW[math.random(#talkingAnimationWeaponsW)]
if lastAnim == animationToLookup then
table.RemoveByValue(talkingAnimationWeaponsW, lastAnim)
animationToLookup = talkingAnimationWeaponsW[math.random(#talkingAnimationWeaponsW)]
table.insert(talkingAnimationWeaponsW, lastAnim)
end
end
if animationToLookup == nil then
fixtables()
return
end
lookup = ply:LookupSequence(animationToLookup)
isDealingWithTables = false
if lookup == -1 then
if IsDeveloper > 0 then
print("Sequence not found!")
ply:ChatPrint(animationToLookup)
print(lookup)
end
else
if IsDeveloper > 0 then
ply:ChatPrint(animationToLookup)
print(lookup)
end
net.Start("TalkingAnimNet")
net.WritePlayer(ply)
net.WriteUInt(lookup, 16)
net.Broadcast()
lastAnim = animationToLookup
end
end
end)
end