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

ZScriptify a detection check in P_LookForPlayers #2731

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

mykola-ambar
Copy link
Contributor

This PR zscriptifies a detection check in P_LookForPlayers, and adds two new functions to Actor: virtual bool CanDetect(Actor other) and virtual bool CanBeDetectedBy(Actor other). Both must return true for the check to pass.

Copy link
Member

@coelckers coelckers left a comment

Choose a reason for hiding this comment

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

Three things:

  1. Please do not remove comments in unrelated code.
  2. The way you set the static FName variables is VERY inefficient and involves a mutex! Please change this to constants to be defined in namedef_custom.h. With this function I am not even sure that fully scriptifying it would be better because it also saves the dynamic lookup of the two variables.
  3. Making CanDetect native is pointless. The VM has a shortcut for empty functions that is a lot faster than calling into an empty native function. So this should be moved into script code as well.

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.

2 participants