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

trace filters inverted behavior? #1826

Closed
bluemetaknight opened this issue Aug 18, 2024 · 15 comments
Closed

trace filters inverted behavior? #1826

bluemetaknight opened this issue Aug 18, 2024 · 15 comments

Comments

@bluemetaknight
Copy link

bluemetaknight commented Aug 18, 2024

Just updated starfall today and noticed that the behavior on all my trace functions has been inverted.

Once where i used local function filter(ent) return ent:getOwner() != owner() end

I now have to use local function filter(ent) return ent:getOwner() == owner() end

I would like to know if this behavior is intentional or not before I go update all the instances of this in my scripts.

To clarify, the behavior I would like is to not hit entities owned by me.

@thegrb93
Copy link
Owner

The trace filter behavior hasn't been touched. Do you have a better code example?

@bluemetaknight
Copy link
Author

This is the actual trace that is using the above filter.

            local tr = trace.line(Gun:getPos(),Gun:getPos()+(Gun:getForward()*RangerDist),filter)
            local AimPos = tr.HitPos:toScreen()

This code worked before I updated earlier today.

@thegrb93
Copy link
Owner

I tested with this and it seems to work fine.

--@server

local owner = owner()
hook.add("think","",function()
    local start = owner:getShootPos()
    local tr = trace.line(start, start+owner:getAimVector()*10000,
        function(e) return e~=owner end)
    print(tr.Entity)
end)

@bluemetaknight
Copy link
Author

I did neglect to mention that my code is running client side. Just tested it with your above code and it seems like getOwner() doesnt function clientside anymore. It returns nothing, even when just checking the trace hit ent.

@ax255
Copy link
Contributor

ax255 commented Aug 19, 2024

Seem like a CPPI issue, check what cppi addon you use. It's possible that the one you use doesn't specify ownership of props client side or you call :getOwner() before client know the owner.

@thegrb93
Copy link
Owner

It does sound like a prop protection issue. I don't the SF has changed anything regarding prop protection in a long time.

@thegrb93
Copy link
Owner

I'll give it a try using my prop protection sometime later.

@bluemetaknight
Copy link
Author

Im using Nadmod Prop Protection, which itself hasant been updated in awhile.

@Advers
Copy link
Contributor

Advers commented Aug 20, 2024

I just had a problem similar to this, although it's more like "filters not working in specific cases." It seems filtering players has stopped working? Specifically, filtering for a player entity does not work, but filtering for a table with a player or players in it does.

@thegrb93
Copy link
Owner

I just had a problem similar to this, although it's more like "filters not working in specific cases." It seems filtering players has stopped working? Specifically, filtering for a player entity does not work, but filtering for a table with a player or players in it does.

This should fix the entity table issue #1832

@thegrb93
Copy link
Owner

thegrb93 commented Aug 21, 2024

I just tested this and didn't have any problem

--@client

local owner = owner()
local chip = chip()
hook.add("think","",function()
    local start = owner:getShootPos()
    local tr = trace.line(start, start+owner:getAimVector()*10000, function(e)
        return e~=owner and e:getOwner()~=owner
    end)
    print(tr.Entity)
end)

@bluemetaknight
Copy link
Author

The whole point of my original code was to AVOID tracing objects owned by myself. The above code fails to do that because getOwner() no longer seems to work client side.

--@client

local owner = chip():getOwner()
print(owner)

This code should return owner, however it returns nil, at least on my machine.

@friztailo
Copy link
Contributor

The whole point of my original code was to AVOID tracing objects owned by myself. The above code fails to do that because getOwner() no longer seems to work client side.


--@client



local owner = chip():getOwner()

print(owner)

This code should return owner, however it returns nil, at least on my machine.

https://github.com/thegrb93/StarfallEx/blob/master/lua/starfall/libs_sh/entities.lua#L102

Maybe you have disabled the permission?

@thegrb93
Copy link
Owner

thegrb93 commented Aug 24, 2024

It works for me with and without nadmod pp.

Maybe you have disabled the permission?

That wouldn't affect anything. I'm not even sure why that if check is there.

@thegrb93
Copy link
Owner

Try updating your version of nadmodpp, it works fine for me.

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

No branches or pull requests

5 participants