Skip to content

Many function docs unclearly mention entity index instead of entity reference #1895

Open
@psychonic

Description

@psychonic

Help us help you

Environment

  • Operating System version: N/A
  • Game/AppID (with version if applicable): N/A
  • Current SourceMod version: 1.12
  • Current SourceMod snapshot: 6959
  • Current Metamod: Source snapshot: N/A

Description

Numerous natives and forwards have descriptions for the function itself or params that refer to "entity index" when references (usually including backcompat references) are passed/accepted and preferred.

Some examples

/**
 * When an entity is created
 *
 * @param entity        Entity index
 * @param classname     Class name
 */
forward void OnEntityCreated(int entity, const char[] classname);

/**
 * Retrieves an integer value from an entity's property.
 *
 * This function is considered safer and more robust over GetEntData,
 * because it performs strict offset checking and typing rules.
 *
 * @param entity        Entity/edict index.
 * @param type          Property type.
 * @param prop          Property name.
 * @param size          Number of bytes to write (valid values are 1, 2, or 4).
 *                      This value is auto-detected, and the size parameter is
 *                      only used as a fallback in case detection fails.
 * @param element       Element # (starting from 0) if property is an array.
 * @return              Value at the given property offset.
 * @error               Invalid entity or property not found.
 */
native int GetEntProp(int entity, PropType type, const char[] prop, int size=4, int element=0);

This adds additional confusion to the already-confusing entity reference system that SourceMod uses.

Problematic Code (or Steps to Reproduce)

N/A

Logs

N/A

Metadata

Metadata

Assignees

No one assigned

    Labels

    Buggeneral bugs; can be anythingHelp Wantedup for grabs

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions