Skip to content

Conversation

@rdcklinux
Copy link

has_method returns true even if node isn't the master
is_network_master returns correct validation.

@Calinou Calinou added the bug label Jul 14, 2020
@akien-mga akien-mga requested a review from Faless July 15, 2020 08:03
@Faless
Copy link
Contributor

Faless commented Jul 20, 2020

I believe this is incorrect. has_method is used to make sure it's the right kind of object (i.e. not another physics object without that met6hod). Additionally, that function is called by puppets on the master, so it would actually prevent it from working.

@rdcklinux
Copy link
Author

rdcklinux commented Jul 20, 2020

I believe this is incorrect. has_method is used to make sure it's the right kind of object (i.e. not another physics object without that met6hod). Additionally, that function is called by puppets on the master, so it would actually prevent it from working.

the method has_method doesn't work in this scope, when the game instance isn't master it's returning true too.

@rdcklinux
Copy link
Author

rdcklinux commented Jul 20, 2020

I believe this is incorrect. has_method is used to make sure it's the right kind of object (i.e. not another physics object without that met6hod). Additionally, that function is called by puppets on the master, so it would actually prevent it from working.

it's possible or sense add this methods: is_master_method() and is_puppet_method()

@Meriipu
Copy link
Contributor

Meriipu commented Jul 30, 2020

It is probably a good change.

The actual demo contains this:

bomb.gd-# Called from the animation.
bomb.gd:func explode():
bomb.gd-  if not is_network_master():
bomb.gd:    # Explode only on master.
bomb.gd-    return
bomb.gd-  for p in in_area:
bomb.gd:    if p.has_method("exploded"):
bomb.gd:      # Exploded has a master keyword, so it will only be received by the master.
bomb.gd:      p.rpc("exploded", from_player)
bomb.gd-
bomb.gd-

But the tutorial leaves the first three lines of explode implicit (which this pull-request is adding in, albeit in a different place).
It might be a good idea to maybe instead include the whole definition of func explode(): in the tutorial?

This does not change the often-raised issue of authoritativeness, which might still exist (but should probably be addressed separately).

@jonbonazza
Copy link

perhaps it's just a matter of ANDing the two conditions?

if (p.is_network_master() && p.has_method("exploded")) {
    // Do the thing...
}

@skyace65 skyace65 added the area:manual Issues and PRs related to the Manual/Tutorials section of the documentation label Jan 13, 2023
@Calinou
Copy link
Member

Calinou commented Nov 16, 2023

Is this still relevant with the latest documentation as of 4.1?

@Piralein
Copy link
Member

The Page was updated by #7675 and cherry picked to all 4.x branches.

Closing as the change is no longer relevant.
Thank you for your contribution nonetheless!

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

Labels

archived area:manual Issues and PRs related to the Manual/Tutorials section of the documentation bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants