Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Suggestion] Medkit improvement #329

Open
Mikk155 opened this issue Dec 14, 2024 · 4 comments
Open

[Suggestion] Medkit improvement #329

Mikk155 opened this issue Dec 14, 2024 · 4 comments

Comments

@Mikk155
Copy link
Contributor

Mikk155 commented Dec 14, 2024

Already discussed in discord

Problem

Using the medkit for reviving players is hard as you can not look away for a moment (TraceLine#L136), dead corpses floats in water and it's hard to aim at them, and you can not revive players in small places #L256 I am not entirely sure if this latter one but it's worth to look at it too

Another problem would be the stucking players when they are revived, depends a lot on the map structure and where their corpses where but if a "unstuck" command or something is implemented it would be helpful.

Solution

Suggested by zehmatt a TraceHull

Alternative a bit expensive but in my personal experience and preference more reliable and fun

local SEARCH_RADIUS = 128

function SWEP:GetActorForReviving()
    local ragdoll = nil
    local owner = self:GetOwner()
    local startPos = owner:GetShootPos()
    local endPos = startPos + (owner:GetAimVector() * TRACE_LEN)

    for _, pPlayer in ipairs(player.GetAll()) do
        if pPlayer:IsRagdoll() and ( pPlayer:GetPos() - owner:GetPos() ).Length() < SEARCH_RADIUS then
            ragdoll = pPlayer
            break
        end
    end

    return ragdoll
end

Note: I don't know Lua neither the API, i did what i though was correct and didn't even tested it but you get the "prototype" to call it somehow.

@Mikk155
Copy link
Contributor Author

Mikk155 commented Dec 15, 2024

Learned Lua in the night 🤓
A functional range-search would be this commit from Mikk155/Lambda though it may be overkill and sure there are better methods, yet there is the prototype of it

@ZehMatt
Copy link
Collaborator

ZehMatt commented Dec 15, 2024

Learned Lua in the night 🤓 A functional range-search would be this commit from Mikk155/Lambda though it may be overkill and sure there are better methods, yet there is the prototype of it

You want to use a hull trace but that commit would also work just as well I guess the downside being that it wouldn't be lag compensated. I will update this eventually.

@ZehMatt
Copy link
Collaborator

ZehMatt commented Dec 16, 2024

I've improved it a bit, the healing is now done with hull trace and uses the entire bounding box of the player, the situation where trying to revive players are in small confined spaces is not that easy to deal with as I would have to force them into a ducked state which is not that simple, I changed it from line trace to hull trace with a generous bounding box so that should ease the pain a bit at least. As for stuck players I will have to do some testing, do you know any areas where this can easily happen?

@Mikk155
Copy link
Contributor Author

Mikk155 commented Dec 16, 2024

So far that i have seen, before d2_coast map just after exiting Ravenholm, in the train section that you have to pass ducking to avoid snipers, a friend of mine was revived where the headcrab npc is spawned and he was stuck, there were other cases but i am not entirely sure if you could replicate them as the map-structure wasn't really suspicious. if i get to do another run i'll take notes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants