-
Notifications
You must be signed in to change notification settings - Fork 77
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
Continous Use: Reimplemented #1645
base: master
Are you sure you want to change the base?
Conversation
Not sure that all those actions were continously useable before my rework. Also I'd normally have said, that those actions are triggered every frame. 0.1s seems a bit weird. But I am not sure how the timing was before, but it should probably be tickrate dependent. And every implementation of continuos use should do some deltaTime calcs to make sure the amount is tickrate independent. |
Some of them are exited early, so are map entities withou continous use. I'm not sure how I could handle the rest, but I guess it is identical to how it was before? If you have any ideas, go ahead. And yes, I could change to timer ot every tick (0 time) as well. I wasn't sure what the best interval here would be |
@ZenBre4ker Judging by this: and this: I think it is safe to assume that it was handled every frame before. Now I'm wondering if a 0 tick timer would be a good solution here. Or if I should handle it in the Think hook as well. |
0 tick timer should suffice. But I will take a look at the continuous use for the other interactions. Feel free to merge this if you tested it, as I wont promise to come up with an analysis early. The following idea is meant as an enhancement and therefore should not be taken into consideration for this MR: Im actually thinking about reverting it a little, so to return true on serverside use again. This would bring the old behavior back in most cases and only add the feature that the client can argue that there is an entity to use. To not double activate use, we could cache used ents to see if Use was triggered on the server already. It could be complicated though, therefore its just an idea. |
I tested it and put it into today's release candidate. We will see what the feedback is |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Continuous use should be every tick and it should be tested on bodies, specs and all entities that are triggered in the timer. Then I'd approve.
if self:IsWeapon() or self.player_ragdoll then | ||
return true | ||
elseif self:IsScripted() and self.CanUseKey then |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if self:IsWeapon() or self.player_ragdoll then | |
return true | |
elseif self:IsScripted() and self.CanUseKey then | |
if self:IsWeapon() or self.player_ragdoll or (self:IsScripted() and self.CanUseKey) then |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure anymore if the brackets are needed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I split this into two because I thought it is more readable
end | ||
|
||
-- make sure it is called 10 times per second | ||
timer.Simple(0.1, function() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should be 0 IMO
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed, but I have to test this to see if that works
Fixes #1636
Due to the use rework, continuous use was broken. This PR fixes it by adding a timer that is called as long as the use key is pressed and the entity is close by.
Most of these changes are just code being moved into another function, the timer part is new though