-
-
Notifications
You must be signed in to change notification settings - Fork 452
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
Fix #3310: Improved client-side markers & Fix logic #3324
base: master
Are you sure you want to change the base?
Conversation
Adding new events to the built-in events
Why do we need an additional event separately for the player? |
To match the server side events. This will not break backwards compatibility, because the onClientMarkerHit event is also called when players hit the markers. |
You would need to fix all the scripts that use Do we actually need to change how that event works? The solution is simple. local mrk = createMarker(0, 0, 3)
local col = getElementColShape(mrk)
function markerHit(element, dim)
if not dim then
return
end
outputChatBox(inspect(element).." entered the marker")
end
addEventHandler("onClientColShapeHit", col, markerHit) |
Yes, because this event should have worked like this for 20 years, this is rather a bug, not an enhancement. By the way, it is not only triggered on the vehicle, but separately on the player, so getVehicleController is not needed, and this PR creates two more events, which can be used to register only the player's hit. |
Why? Where's the proof? Since 2008 the wiki states that marker events are for players only. Markers for players only makes sense (this also triggers when you are inside a vehicle btw), why would a marker need to be triggered when an object goes into contact with it? For that just use a colshape (or even better, the marker's colshape). Colshapes don't even have a player only event. I'm pretty sure this isn't an error nor a bug, just the intended way for this to work.
I don't understand this. Colshape events trigger once for the player and then once for the vehicle, so eitherway you need to use Arguments: element hitElement, boolean matchingDimension, element vehicle/table vehicleOccupants
At most if we are going to change the functionality of this event we shouldn't create a new one just for the players. Leave the one that already exists and create a new one for general purposes, or just change the one that already exists and do not add a new one. I would prefer to do neither and leave it the way it is, here's why: The problem is that we are just duplicating the event calls. Now not only we have the colshape event and the marker hit event, but we added a new marker hit event just for the sake of it. Now every time any element gets into the colshape of a marker it will trigger two events instead of one, and every time a player hits that same marker it will trigger three events instead of two. This is just clut. So I don't really get this change at all, the functionality that the main issue was asking is already there. The reviewer of this PR should consider this information first before merging. |
The answer to this question is simple. In the basic game, the markers are compatible with all type of elements, and the event on the server side also works in the same way, the client side event was "corrected" based on this model.
No, this event does not currently have such a function, and I consider it completely unnecessary, I probably worded this in a misunderstanding way, I'm sorry.
As I mentioned earlier in my answer, this PR is modeled after the event server-side counterpart.
This is how it is intended to work, for the reason you just mentioned: If someone needs to modify their existing code after this PR gets merged, they can do it much more easily, there is no need to perform any checks manually.
This is not necessary for the reasons mentioned above, although I consider it as a standard, because the server-side equivalent of this event is triggered for every element, I think most developers check the element type by default. |
One more thing I missed: You mentioned that onClientMarkerHit is also triggered for vehicles. This is not the case in the current implementation, but this PR also fixes this. In the current implementation, there is an if, which prevents all other element types except the player from passing. I think it's completely pointless to use the collision of the marker in Lua, because even though it really works this way, it's not the intended way. |
I mention that with this PR that change would be done and hence you will need to change your scripts to minimize triggering events for other elements. I was searching the wiki history and apparently I understand your reasoning to make this change, but I think this is unnecessary clutter we should avoid, and unnecessary hassle for the few scripters that are already expecting only players into their events. A fair compromise would be to make a new event instead of changing the one we already had working this way. I'm still against that change, but I think that's the best of both worlds. (with source being element) But that's all I wanted to say |
so what is the state of this pull request @Nico8340 is it backwards compatible? |
It is not fully backwards compatible, because if the necessary checks have not been carried out, then by default only a player element is expected, and this can disrupt the expected operation. |
1.6.1 backwards incompatible changes? |
Yes, read above |
This PR aims to fix the client-side logic of markers (events only got called for players), and it also creates two new events,
onClientPlayerMarkerHit
andonClientPlayerMarkerLeave
. Closes #3310.