Skip to content

Add setElementCollidableWith server-side #4101

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

Draft
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

Proxy-99
Copy link
Contributor

@Proxy-99 Proxy-99 commented Mar 14, 2025

#3681

test code

vehicle1 = createVehicle ( 411, 2044.65942, 1526.35352, 10.67188)
object = createObject( 3578, 2044.40405, 1510.24036, 10.67188)

setTimer(function()
  res = setElementCollidableWith(vehicle1,object,false)
  print(res)
end, 2000, 1)

Comment on lines 775 to 776
bitStream.Read(ElementID);
bitStream.ReadBit(bCollidable);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

bitStream.Read can return false

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It cannot. The protocol guarantees that the message is fully received.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It cannot. The protocol guarantees that the message is fully received.

So what is the purpose of this function being a bool, and why does most of the code check if it returns true?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code == documentation
It has sense on the server side. The client reads server packets only.
Checks on client could be used to add a new data to a packet without increasing bitstream version, i think

@Proxy-99 Proxy-99 requested a review from FileEX March 14, 2025 11:42
@TheNormalnij
Copy link
Member

The function doesn't work for a new connected players and after reconnect

@Proxy-99 Proxy-99 marked this pull request as draft March 14, 2025 12:10
Comment on lines +781 to +782
if (collidableWith == nullptr) // validity check
return;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if (!collidableWith)
    return;

@Proxy-99
Copy link
Contributor Author

The function doesn't work for a new connected players and after reconnect

What packet file should I write the info?
is it Server\mods\deathmatch\logic\packets\CPlayerJoinCompletePacket.cpp

@FileEX
Copy link
Contributor

FileEX commented Mar 18, 2025

The function doesn't work for a new connected players and after reconnect

What packet file should I write the info? is it Server\mods\deathmatch\logic\packets\CPlayerJoinCompletePacket.cpp

I think you should store informations on the server side and then send it in the CMapInfoPacket. Check how it's done, for example, with setJetpackWeaponEnabled (CGame::SetJetpackWeaponEnabled & CGame::GetJetpackWeaponEnabled)

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.

3 participants