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

Remove unreachable dmg indicator code #3217

Open
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

ChillerDragon
Copy link
Contributor

@ChillerDragon ChillerDragon commented Jan 2, 2024

NetIntRange("m_ClientID", 0, 'MAX_CLIENTS-1'),

NetEvent("Damage:Common", [ # Unused yet
	NetIntRange("m_ClientID", 0, 'MAX_CLIENTS-1'),
	NetIntAny("m_Angle"),
	NetIntRange("m_HealthAmount", 0, 9),
	NetIntRange("m_ArmorAmount", 0, 9),
	NetBool("m_Self"),
]),

Snap items with a m_ClientID out of range will be dropped during snap item validation.

Thanks to @TsFreddie the original author of this code for helping me figure this out c:

@ChillerDragon
Copy link
Contributor Author

Now that I think about it thats not very nice. The way I understand it the m_Angle parameter is fully ignored at all times. The server sends it as part of the damage snap event. But then the client overwrites it at all times with its locally computed value. This dead branch was the only place were the client would use the angle sent by the server. But it is unreachable due to the validation that invalidates the snap item with the client id out of bounds. So I would propose to remove the validation or maybe loosen it up to allow something like NetIntRange("m_ClientID", -1, 'MAX_CLIENTS-1'), where -1 is supposed to be used for the custom angles and the rest is for client ids.

The 0.7 protocol includes this parameter and there should be a way to use it. Imo it can be done before 0.8 and older clients simply see no damage indicators if a server decides to send client id -1 with a custom angle.

ChillerDragon and others added 6 commits January 16, 2024 10:29
…_space_in_systemc

Remove trailing space in system.c teeworlds#3220
…unused

Mark unused NETMSG_SNAPSMALL for 0.8 removal teeworlds#3210
https://github.com/teeworlds/teeworlds/blob/a1911c8f7d8458fb4076ef8e7651e8ef5e91ab3e/datasrc/network.py#L253

NetEvent("Damage:Common", [ # Unused yet
	NetIntRange("m_ClientID", 0, 'MAX_CLIENTS-1'),
	NetIntAny("m_Angle"),
	NetIntRange("m_HealthAmount", 0, 9),
	NetIntRange("m_ArmorAmount", 0, 9),
	NetBool("m_Self"),
]),

Snap items with a m_ClientID out of range will be dropped during snap item validation.
github-merge-queue bot pushed a commit to teeworlds-community/teeworlds that referenced this pull request Feb 23, 2024
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

Successfully merging this pull request may close these issues.

None yet

3 participants