fix + feature

modify prop distance with plus and equal keys
fixed swing ropes
This commit is contained in:
relaxtakenotes 2023-06-08 02:33:41 +05:00
parent ab30f4c404
commit c0625a3fff
2 changed files with 21 additions and 3 deletions

View file

@ -85,6 +85,7 @@ hook.Add("SetupMove", "Grapple", function(ply, mv, cmd)
ply:SetJumpTurn(false)
ply:SetCrouchJumpBlocked(false)
ply:SetNW2Entity("grappleEntity", trout.Entity)
ply:SetNW2Bool("grappledNonCourse", true)
if CLIENT_IFTP() or game.SinglePlayer() then
ply:EmitSound("MirrorsEdge/Gadgets/ME_Magrope_Fire.wav", 40, 100 + math.random(-25, 10))
@ -107,7 +108,7 @@ hook.Add("SetupMove", "Grapple", function(ply, mv, cmd)
local ent = ply:GetNW2Entity("grappleEntity")
local is_ent_invalid = (ent == NULL or ent == nil)
local is_ent_invalid = (ent == NULL or ent == nil) and ply:GetNW2Bool("grappledNonCourse")
local is_getting_off = (not ply:Alive() or mv:KeyPressed(IN_JUMP) and not grappled and not ply:OnGround() or ply:GetClimbing() ~= 0 or ply:GetMantle() ~= 0 or not usingrh)
local c_delta = 0
if not is_ent_invalid then
@ -122,6 +123,8 @@ hook.Add("SetupMove", "Grapple", function(ply, mv, cmd)
ent:SetNWVector("gpos", nil)
end
ply:SetNW2Bool("grappledNonCourse", false)
ply:SetGrappling(false)
if CLIENT_IFTP() or game.SinglePlayer() then
@ -147,7 +150,7 @@ hook.Add("SetupMove", "Grapple", function(ply, mv, cmd)
return
end
if ent:GetClass() ~= "worldspawn" then
if ply:GetNW2Bool("grappledNonCourse") and ent:GetClass() ~= "worldspawn" then
ent:SetNWVector("glastpos", ent:GetNWVector("gpos", ent:GetPos()))
ent:SetNWVector("gpos", ent:GetPos())
local delta = ent:GetNWVector("gpos", Vector(0,0,0)) - ent:GetNWVector("glastpos", Vector(0, 0, 0))

View file

@ -743,6 +743,8 @@ if CLIENT then
local ziplinemins = Vector(-8, -8, -8)
local ziplinemaxs = Vector(8, 8, 8)
local placedistance = 1000
surface.CreateFont("BuildMode", {
shadow = false,
blursize = 0,
@ -824,8 +826,21 @@ if CLIENT then
aimvector = util.AimVector(eyeang, 133, mousex, mousey, ScrW(), ScrH())
local dmult = 1
if input.IsKeyDown(KEY_LALT) then dmult = 0.1 end
if input.IsKeyDown(KEY_EQUAL) then
placedistance = math.min(placedistance + 100 * FrameTime() * dmult, inf)
end
if input.IsKeyDown(KEY_MINUS) then
placedistance = math.max(placedistance - 100 * FrameTime() * dmult, 0)
end
trace.start = eyepos
trace.endpos = eyepos + aimvector * (not PlaceStartPos and 100000 or PlaceStartPos:Distance(ply:GetPos()))
trace.endpos = eyepos + aimvector * (not PlaceStartPos and placedistance or PlaceStartPos:Distance(ply:GetPos()))
trace.filter = ply
trace.output = tracer