Initial commit

This commit is contained in:
Fesiug 2021-06-23 21:23:39 -04:00
commit 9b1212b985
3 changed files with 331 additions and 0 deletions

2
.gitattributes vendored Normal file
View File

@ -0,0 +1,2 @@
# Auto detect text files and perform LF normalization
* text=auto

View File

@ -0,0 +1,209 @@
local hide = {
["CHudDamageIndicator"] = true
}
hook.Add( "HUDShouldDraw", "HideHUD", function( name )
if ( hide[ name ] and !GetConVar("fes_plymod_dmgindicator"):GetBool() ) then
return false
end
end )
hook.Add( "PopulateToolMenu", "FES_NPC_DMG", function()
spawnmenu.AddToolMenuOption( "Options", "Fesiug's utilities", "FES_NPC_DMG", "Damage mults", "", "", FES_NPC_DMG)
end )
function FES_NPC_DMG( CPanel )
CPanel:AddControl("Header", {Description = "> - Damage Multipliers" })
CPanel:AddControl("Slider", {Label = "Player to NPC", Command = "fes_ply2npc_mult", min = 0, max = 3, Type = "float" })
CPanel:AddControl("Slider", {Label = "NPC to Player", Command = "fes_npc2ply_mult", min = 0, max = 3, Type = "float" })
CPanel:AddControl("Slider", {Label = "Fall Damage Mult", Command = "fes_gra2ply_mult", min = 0, max = 3, Type = "float" })
CPanel:AddControl("Header", {Description = "> - Player Modifiers" })
CPanel:AddControl("Slider", {Label = "Max Health", Command = "fes_ply_health_max", min = 1, max = 300, Type = "int" })
CPanel:AddControl("Slider", {Label = "Max Armor", Command = "fes_ply_armor_max", min = 1, max = 300, Type = "int" })
CPanel:AddControl("Slider", {Label = "Start Health", Command = "fes_ply_health_start", min = 1, max = 300, Type = "int" })
CPanel:AddControl("Slider", {Label = "Start Armor", Command = "fes_ply_armor_start", min = 1, max = 300, Type = "int" })
CPanel:AddControl("Header", {Description = "" })
CPanel:AddControl("Slider", {Label = "Duck Enter", Command = "fes_plyspeed_duckenter", min = 0, max = .99, Type = "float" })
CPanel:AddControl("Slider", {Label = "Duck Exit", Command = "fes_plyspeed_duckexit", min = 0, max = .99, Type = "float" })
CPanel:AddControl("Header", {Description = "> - Player Speed" })
CPanel:AddControl("Slider", {Label = "Walk Speed", Command = "fes_plyspeed_walkslow", min = 1, max = 300, Type = "float" })
CPanel:AddControl("Slider", {Label = "Normal Speed", Command = "fes_plyspeed_walk", min = 100, max = 500, Type = "float" })
CPanel:AddControl("Slider", {Label = "Run Speed", Command = "fes_plyspeed_run", min = 100, max = 500, Type = "float" })
CPanel:AddControl("Slider", {Label = "Crouching Mult", Command = "fes_plyspeed_crouchedmult", min = 0, max = 1, Type = "float" })
CPanel:AddControl("Slider", {Label = "Ladder Speed", Command = "fes_plyspeed_ladder", min = 100, max = 500, Type = "float" })
CPanel:AddControl("Slider", {Label = "Jump Power", Command = "fes_plyspeed_jumppower", min = 1, max = 500, Type = "float" })
CPanel:AddControl("Checkbox", {Label = "Collide with Team", Command = "fes_plymod_collideteam" })
CPanel:AddControl("Checkbox", {Label = "Avoid Players", Command = "fes_plymod_avoidplayers" })
CPanel:AddControl("Checkbox", {Label = "Damage Indicator", Command = "fes_plymod_dmgindicator" })
CPanel:AddControl("Button", {Label = "Apply", Command = "fes_ply_apply" })
end
--[[
if ( CLIENT ) then
concommand.Add( "bones_cl", function( ply )
local ent = ply:GetEyeTrace().Entity
if ( !IsValid( ent ) ) then return end
ent:AddCallback( "BuildBonePositions", function( ent, numbones )
for i = 0, numbones - 1 do
local mat = ent:GetBoneMatrix( i )
if ( !mat ) then continue end
local scale = mat:GetScale()
mat:Scale( Vector( 1, 1, 1 ) * 0.5 )
ent:SetBoneMatrix( i, mat )
end
end )
end )
end
]]
FES_HT = FES_HT or {}
for i, v in pairs(FES_HT) do
if !IsValid(v) then
FES_HT[i] = nil
else
v:Remove()
FES_HT[i] = nil
end
end
list.Set( "DesktopWindows", "SquadOrder", {
title = "Order Squad",
icon = "icon64/squadorder.png",
init = function()
LocalPlayer():ConCommand("impulse 50")
end
})
if false then
local function DoMakeHands( rendergroup, when, scale2, tex )
table.insert( FES_HT, ClientsideModel( "models/weapons/c_arms_combine.mdl", rendergroup ) )
FES_HT[#FES_HT].When = when
FES_HT[#FES_HT].MyScale = 1
FES_HT[#FES_HT].Tex = tex
FES_HT[#FES_HT]:AddCallback( "BuildBonePositions", function( ent, numbones )
for i = 0, numbones - 1 do
local mat = ent:GetBoneMatrix( i )
if ( !mat ) then continue end
local scale = mat:GetScale()
mat:Scale( Vector( 1, 1, 1 ) * (ent.MyScale * scale2 ) )
ent:SetBoneMatrix( i, mat )
end
end )
end
-- 1
DoMakeHands( RENDERGROUP_VIEWMODEL_TRANSLUCENT, "Post", 1, "models/hhands/white2" )
-- 2
DoMakeHands( RENDERGROUP_VIEWMODEL_TRANSLUCENT, "Pre", 0.9, "models/hhands/white" )
print("\n\tyour new table:")
PrintTable(FES_HT)
local lastarmor = 0
local armorhurt = 0
local armorregennext = 0
local armorhurtat = 0
hook.Add( "Think", "FES_ArmorCHK", function()
local time = FrameTime()
local ply = LocalPlayer()
local al = 1 - ( ply:Armor() / ply:GetMaxArmor() )
local al2 = ( ply:Armor() / ply:GetMaxArmor() )
if ply:Alive() then
local armor = ply:Armor()
if armor < ( lastarmor or 0 ) then
armorhurtat = CurTime()
armorregennext = CurTime() + GetConVarNumber( "armorregen_delay" )
armorhurt = armorhurt + ( lastarmor - armor )
end
armorhurt = math.max( armorhurt - FrameTime(), 0 )
lastarmor = ply:Armor()
end
end)
local diff = diff or 0
local function DrawHands( i, v, hands, vm, ply, weapon )
v:SetNoDraw(true)
local simplemodel = player_manager.TranslateToPlayerModelName(ply:GetModel())
local info = player_manager.TranslatePlayerHands(simplemodel)
if info then
v:SetModel(info.model)
v:SetSkin(info.skin)
v:SetBodyGroups(info.body)
end
v:SetOwner( ply )
v:AddEffects( EF_BONEMERGE )
v:SetParent( hands )
v:SetMoveType( MOVETYPE_NONE )
local al = 1 - ( ply:Armor() / ply:GetMaxArmor() )
local al2 = ( ply:Armor() / ply:GetMaxArmor() )
diff = ( armorhurtat - CurTime() )
diff = math.Clamp(diff, -1, 0) + 1
local tim = diff
local s = (math.min(al, 0.67) * 1.7) + Lerp(al2*tim, 0, 1.2)
if al2 > 0 and tim > 0 then s = math.max(s, 1) end
if al2 <= 0 then
s = s + math.sin(CurTime()*3) / 20
end
v:RemoveEffects( EF_BRIGHTLIGHT + EF_DIMLIGHT )
if al >= 0.7 then
v:AddEffects( EF_BRIGHTLIGHT )
elseif al2 > 0 and tim > 0 then
v:AddEffects( EF_DIMLIGHT )
end
v.MyScale = s
v:SetPos( vector_origin )
v:SetAngles( angle_zero )
v:SetMaterial( v.Tex )
v:SetColor(Color(255, 25, 0, 0))
v:DrawModel()
end
end
hook.Add("PreDrawPlayerHands", "FES_PreDrawPlayerHands", function( hands, vm, ply, weapon )
for i, v in pairs(FES_HT) do
if v.When != "Pre" then continue end
DrawHands( i, v, hands, vm, ply, weapon )
end
end)
hook.Add("PostDrawPlayerHands", "FES_PreDrawPlayerHands", function( hands, vm, ply, weapon )
for i, v in pairs(FES_HT) do
if v.When != "Post" then continue end
DrawHands( i, v, hands, vm, ply, weapon )
end
end)
--hook.Remove( "PreDrawPlayerHands", "FES_PreDrawPlayerHands" )
--hook.Remove( "PostDrawPlayerHands", "FES_PreDrawPlayerHands" )

View File

@ -0,0 +1,120 @@
-- Written by Fesiug
-- But I stole the ConVars part from ArcCW :ujel:
local convars = {
-- Damage
["fes_ply2npc_mult"] = { def = 1, desc = "Player to NPC damage" },
["fes_npc2ply_mult"] = { def = 1, desc = "NPC to Player damage" },
["fes_gra2ply_mult"] = { def = 1, desc = "Fall damage multiplier" },
-- Health
["fes_ply_health_max"] = { def = 100, desc = "Player maximum health" },
["fes_ply_health_start"] = { def = 100, desc = "Player start health" },
["fes_ply_armor_max"] = { def = 100, desc = "Player maximum armor" },
["fes_ply_armor_start"] = { def = 0, desc = "Player start armor" },
-- Player modifiers
["fes_plyspeed_duckenter"] = { def = 0.1, desc = "Player duck enter speed" },
["fes_plyspeed_duckexit"] = { def = 0.1, desc = "Player duck exit speed" },
["fes_plyspeed_walkslow"] = { def = 100, desc = "Player +walk speed" },
["fes_plyspeed_crouchedmult"] = { def = 0.3, desc = "Player crouched speed mult" },
["fes_plyspeed_ladder"] = { def = 200, desc = "Player ladder climb speed" },
["fes_plyspeed_walk"] = { def = 200, desc = "Player normal walk speed" },
["fes_plyspeed_run"] = { def = 400, desc = "Player running speed" },
["fes_plyspeed_jumppower"] = { def = 200, desc = "Player jump power" },
-- Player options
["fes_plymod_collideteam"] = { def = 1, desc = "Player to collide with teammates?" },
["fes_plymod_avoidplayers"] = { def = 1, desc = "Player squirms away from other players when haves no personal space?" },
["fes_plymod_dmgindicator"] = { def = 0, desc = "Enable the damage indicator?" },
["fes_lockweps"] = { def = 0, desc = "" },
}
for name, data in pairs(convars) do
CreateConVar(name, data.def, FCVAR_ARCHIVE + FCVAR_REPLICATED, data.desc, data.min, data.max)
end
local function FES_GC( name, type )
local returned = GetConVar(name)
if type == "f" then
returned = returned:GetFloat()
elseif type == "i" then
returned = returned:GetFloat()
elseif type == "b" then
returned = returned:GetBool()
elseif type == "s" then
returned = returned:GetString()
end
return returned
end
hook.Add( "EntityTakeDamage", "YouWillFuckNPCs", function( target, dmginfo )
local dmg = dmginfo:GetDamage()
local mult = 1
if dmginfo:IsFallDamage() then
mult = mult * FES_GC("fes_gra2ply_mult", "f")
end
if dmginfo:GetAttacker():IsNPC() and target and target:IsPlayer() then
mult = mult * FES_GC("fes_npc2ply_mult", "f")
end
if target:IsNPC() and dmginfo:GetAttacker() and dmginfo:GetAttacker():IsPlayer() then
mult = mult * FES_GC("fes_ply2npc_mult", "f")
end
dmginfo:SetDamage( dmg * mult )
end )
if SERVER then
local function FES_Apply( ply )
timer.Simple( 0, function()
ply:SetHealth ( FES_GC("fes_ply_health_start", "i") )
ply:SetArmor ( FES_GC("fes_ply_armor_start", "i") )
ply:SetMaxHealth ( FES_GC("fes_ply_health_max", "i") )
ply:SetMaxArmor ( FES_GC("fes_ply_armor_max", "i") )
ply:SetDuckSpeed ( FES_GC("fes_plyspeed_duckenter", "f") )
ply:SetUnDuckSpeed ( FES_GC("fes_plyspeed_duckexit", "f") )
ply:SetSlowWalkSpeed ( FES_GC("fes_plyspeed_walkslow", "f") )
ply:SetWalkSpeed ( FES_GC("fes_plyspeed_walk", "f") )
ply:SetRunSpeed ( FES_GC("fes_plyspeed_run", "f") )
ply:SetLadderClimbSpeed ( FES_GC("fes_plyspeed_ladder", "f") )
ply:SetCrouchedWalkSpeed ( FES_GC("fes_plyspeed_crouchedmult", "f") )
ply:SetJumpPower ( FES_GC("fes_plyspeed_jumppower", "f") )
ply:SetNoCollideWithTeammates ( FES_GC("fes_plymod_collideteam", "b") )
ply:SetAvoidPlayers ( FES_GC("fes_plymod_avoidplayers", "b") )
end )
end
hook.Add( "PlayerSpawn", "FES_PlayerSpawn", FES_Apply )
concommand.Add("fes_ply_apply", function()
for i, v in ipairs( player.GetAll() ) do
FES_Apply( v )
end
end )
local fuckoff = {
["weapon_357"] = true,
["weapon_pistol"] = true,
["weapon_smg1"] = true,
["weapon_ar2"] = true,
["weapon_shotgun"] = true,
["weapon_rpg"] = true,
["weapon_frag"] = true,
["weapon_crossbow"] = true,
["weapon_slam"] = true,
["weapon_stunstick"] = true,
["weapon_crowbar"] = true,
}
hook.Add( "PlayerCanPickupWeapon", "FES_ToggleWhen", function( ply, weapon )
if GetConVar("fes_lockweps"):GetBool() and fuckoff[weapon:GetClass()] then return false end
--return !GetConVar("fes_lockweps"):GetBool()
end )
end