Skip to content

IS_NPL boolean getters from Flags property #87

@mkapal

Description

@mkapal

Implementation

class IS_NPL extends Packet {
  // ...
  @byte() PType: PlayerType | 0 = 0;
  // ... new code below
  public get isFemale() {
    return (this.PType & PlayerType.FEMALE) !== 0;
  }
}

Usage

inSim.on(PacketType.IS_NPL, (packet) => {
  console.log((packet.PType & PlayerType.FEMALE) !== 0); // raw
  console.log(packet.isFemale); // computed property
});

List of getters

Computed property Implementation
isFemale (packet.PType & PlayerType.FEMALE) !== 0
isAI (packet.PType & PlayerType.AI) !== 0
isRemote (packet.PType & PlayerType.REMOTE) !== 0
isDriverOnLeftSide (packet.Flags & PlayerFlags.PIF_LEFTSIDE) !== 0
hasAutoGears (packet.Flags & PlayerFlags.PIF_AUTOGEARS) !== 0
hasShifter (packet.Flags & PlayerFlags.PIF_SHIFTER) !== 0
hasBrakeHelp (packet.Flags & PlayerFlags.PIF_HELP_B) !== 0
isInPits (packet.Flags & PlayerFlags.PIF_INPITS) !== 0
hasAutoClutch (packet.Flags & PlayerFlags.PIF_AUTOCLUTCH) !== 0
hasMouseSteering (packet.Flags & PlayerFlags.PIF_MOUSE) !== 0
hasKeyboardSteeringNoHelp (packet.Flags & PlayerFlags.PIF_KB_NO_HELP) !== 0
hasKeyboardSteeringStabilised (packet.Flags & PlayerFlags.PIF_KB_STABILISED) !== 0
isInCustomView (packet.Flags & PlayerFlags.PIF_CUSTOM_VIEW) !== 0

Metadata

Metadata

Assignees

Labels

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions