This commit is contained in:
lifestorm
2024-08-04 22:55:00 +03:00
parent 0e770b2b49
commit 94063e4369
7342 changed files with 1718932 additions and 14 deletions

View File

@@ -0,0 +1,70 @@
--[[
| 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/
--]]
local PLUGIN = PLUGIN
AddCSLuaFile()
if (CLIENT) then
SWEP.PrintName = "Rappel Gear"
SWEP.DrawAmmo = false
SWEP.DrawCrosshair = false
end
SWEP.Category = "HL2 RP"
SWEP.Author = "wowm0d"
SWEP.Instructions = "Primary Fire: Attach/Cut Rope"
SWEP.Spawnable = true
SWEP.AdminOnly = true
SWEP.ViewModelFOV = 45
SWEP.ViewModelFlip = false
SWEP.AnimPrefix = "rpg"
SWEP.Primary.ClipSize = -1
SWEP.Primary.DefaultClip = -1
SWEP.Primary.Automatic = false
SWEP.Primary.Ammo = ""
SWEP.Secondary.ClipSize = -1
SWEP.Secondary.DefaultClip = 0
SWEP.Secondary.Automatic = false
SWEP.Secondary.Ammo = ""
SWEP.ViewModel = Model("models/weapons/c_arms_animations.mdl")
SWEP.WorldModel = ""
SWEP.UseHands = false
SWEP.IsAlwaysLowered = true
SWEP.FireWhenLowered = true
SWEP.HoldType = "passive"
function SWEP:Initialize()
self:SetHoldType(self.HoldType)
end
function SWEP:PrimaryAttack()
if (!IsFirstTimePredicted()) then return end
local owner = self:GetOwner()
if (!IsValid(owner) or owner:GetMoveType() == MOVETYPE_NOCLIP) then return end
if (owner.rappelling) then
PLUGIN:EndRappel(owner)
elseif (owner:OnGround()) then
PLUGIN:StartRappel(owner)
end
end
function SWEP:SecondaryAttack()
end

View File

@@ -0,0 +1,17 @@
--[[
| 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/
--]]
ITEM.name = "Rappel Gear"
ITEM.description = "Gear that, when used properly, allows you to rappel down a building."
ITEM.model = Model("models/willardnetworks/clothingitems/backpack.mdl")
ITEM.class = "rappel_gear"
ITEM.weaponCategory = "melee"
ITEM.width = 1
ITEM.height = 1

View File

@@ -0,0 +1,122 @@
--[[
| 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/
--]]
local PLUGIN = PLUGIN
function PLUGIN:PostPlayerDeath(client)
if (client.rappelling) then
self:EndRappel(client)
end
end
function PLUGIN:PlayerLoadout(client)
if (client.rappelling) then
self:EndRappel(client)
end
end
function PLUGIN:DoAnimationEvent(client)
if (client:GetNetVar("forcedSequence") == client:LookupSequence("rappelloop")) then
return ACT_INVALID
end
end
function PLUGIN:OnPlayerHitGround(client, inWater, onFloater, speed)
if (client.rappelling and client.rappelPos.z - client:GetPos().z > 64) then
self:EndRappel(client)
if (SERVER) then
client:EmitSound("npc/combine_soldier/zipline_hitground" .. math.random(2) .. ".wav")
end
if (speed >= 196) then
client:ViewPunch(Angle(7, 0, 0))
end
end
end
function PLUGIN:PlayerTick(client, moveData)
if (client:HasWeapon("rappel_gear")) then
local onGround = client:OnGround()
if (onGround and !client.wasOnGround) then
client.wasOnGround = true
elseif (!onGround and client.wasOnGround) then
client.wasOnGround = false
if (!client.rappelling and moveData:KeyDown(IN_WALK) and client:GetMoveType() != MOVETYPE_NOCLIP) then
self:StartRappel(client)
end
end
end
end
function PLUGIN:Move(client, moveData)
if (client.rappelling) then
local vel = moveData:GetVelocity()
local dir = (client.rappelPos - client:GetPos()) * 0.1
vel.x = (vel.x + dir.x) * 0.95
vel.y = (vel.y + dir.y) * 0.95
local rappelFalling = false
if (!client:OnGround() and (client:EyePos().z) < client.rappelPos.z) then
rappelFalling = true
if (moveData:KeyDown(IN_WALK)) then
moveData:SetForwardSpeed(0)
moveData:SetSideSpeed(0)
vel.z = math.max(vel.z - 8, -128)
else
vel.z = math.max(vel.z - 8, -200)
end
end
moveData:SetVelocity(vel)
if (rappelFalling) then
if (SERVER) then
local sequence = client:LookupSequence("rappelloop")
if (sequence != -1) then
client:SetNetVar("forcedSequence", sequence)
end
if (!client.oneTimeRappelSound) then
client.oneTimeRappelSound = true
client:EmitSound("npc/combine_soldier/zipline" .. math.random(2) .. ".wav")
end
end
if (client:WaterLevel() >= 1) then
self:EndRappel(client)
end
else
if (SERVER) then
local sequence = client:LookupSequence("rappelloop")
if (sequence != 1 and client:GetNetVar("forcedSequence") == sequence) then
client:SetNetVar("forcedSequence", nil)
end
end
local origin = moveData:GetOrigin()
if (math.Distance(origin.x, origin.y, client.rappelPos.x, client.rappelPos.y) > 256) then
self:EndRappel(client)
end
end
end
end

View File

@@ -0,0 +1,43 @@
--[[
| 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/
--]]
local PLUGIN = PLUGIN
PLUGIN.name = "Rappelling"
PLUGIN.author = "wowm0d"
PLUGIN.description = "Adds rappelling gear into the Schema."
PLUGIN.schema = "HL2 RP"
PLUGIN.license = [[
Copyright 2022 wowm0d
This work is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.
To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-sa/4.0/.
]]
ix.util.Include("sv_plugin.lua")
ix.util.Include("sh_hooks.lua")
ix.util.Include("sv_hooks.lua")
function PLUGIN:StartRappel(client)
client.rappelling = true
client.rappelPos = client:GetPos()
if (SERVER) then
self:CreateRope(client)
end
end
function PLUGIN:EndRappel(client)
client.rappelling = nil
if (SERVER) then
self:RemoveRope(client)
end
end

View File

@@ -0,0 +1,18 @@
--[[
| 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/
--]]
local PLUGIN = PLUGIN
function PLUGIN:OnPlayerObserve(client, state)
if (client.rappelling) then
self:EndRappel(client)
end
end

View File

@@ -0,0 +1,61 @@
--[[
| 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/
--]]
local PLUGIN = PLUGIN
function PLUGIN:CreateRope(client)
local attachmentIndex
if (client.ixAnimModelClass == "metrocop") then
attachmentIndex = client:LookupAttachment("anim_attachment_LH")
else
attachmentIndex = client:LookupAttachment("hips")
end
local attachment = client:GetAttachment(attachmentIndex)
if (attachmentIndex == 0 or attachmentIndex == -1) then
attachment = {Pos = client:GetBonePosition(client:LookupBone("ValveBiped.Bip01_Pelvis"))}
attachmentIndex = client:LookupAttachment("forward")
end
local rappelRope = ents.Create("keyframe_rope")
rappelRope:SetParent(client, attachmentIndex)
rappelRope:SetPos(attachment and attachment.Pos or client:GetPos())
rappelRope:SetColor(Color(150, 150, 150))
rappelRope:SetEntity("StartEntity", rappelRope)
rappelRope:SetEntity("EndEntity", Entity(0))
rappelRope:SetKeyValue("Width", 2)
rappelRope:SetKeyValue("Collide", 1)
rappelRope:SetKeyValue("RopeMaterial", "cable/cable")
rappelRope:SetKeyValue("EndOffset", tostring(client.rappelPos or client:GetPos()))
rappelRope:SetKeyValue("EndBone", 0)
client.rappelRope = rappelRope
client:DeleteOnRemove(rappelRope)
client:EmitSound("npc/combine_soldier/zipline_clip" .. math.random(2) .. ".wav")
end
function PLUGIN:RemoveRope(client)
if (IsValid(client.rappelRope)) then
client.rappelRope:Remove()
end
client.rappelRope = nil
client.oneTimeRappelSound = nil
local sequence = client:LookupSequence("rappelloop")
if (sequence != 1 and client:GetNetVar("forcedSequence") == sequence) then
client:SetNetVar("forcedSequence", nil)
end
end