Class RoleChangeSystem

All Implemented Interfaces:
ISystem<EntityStore>, TickableSystem<EntityStore>

public class RoleChangeSystem extends TickingSystem<EntityStore>
Handles the processing of RoleChangeSystem.RoleChangeRequests once per tick so that the NPC is reinitialised with the new Role. Role changes can be requested by calling requestRoleChange(Ref, Role, int, boolean, Store).

Should be set as the last NPC system to run in a tick.

  • Constructor Details

  • Method Details

    • getDependencies

      @Nonnull public Set<Dependency<EntityStore>> getDependencies()
    • tick

      public void tick(float dt, int systemIndex, @Nonnull Store<EntityStore> store)
      Description copied from class: TickingSystem
      Required reading: CommandBuffer

      Called once per world tick.

      Specified by:
      tick in interface TickableSystem<EntityStore>
      Specified by:
      tick in class TickingSystem<EntityStore>
      Parameters:
      dt - The delta time in seconds.
      systemIndex - The index of this system, used for faster lookups in Store.
    • requestRoleChange

      public static void requestRoleChange(@Nonnull Ref<EntityStore> ref, @Nonnull Role role, int roleIndex, boolean changeAppearance, @Nonnull Store<EntityStore> store)
      Called to request a role change for a specific NPC entity
      Parameters:
      ref - The entity reference of the NPC entity to request a role change for
      role - The Role instance to change the NPC to
      roleIndex - The asset index of the role to change to
      changeAppearance - true if the NPC entities appearance should change, false otherwise
      store - The entity store for component access
    • requestRoleChange

      public static void requestRoleChange(@Nonnull Ref<EntityStore> ref, @Nonnull Role role, int roleIndex, boolean changeAppearance, @Nullable String state, @Nullable String subState, @Nonnull ComponentAccessor<EntityStore> store)
      Called to request a role change for a specific NPC entity
      Parameters:
      ref - The entity reference of the NPC entity to request a role change for
      role - The Role instance to change the NPC to
      roleIndex - The asset index of the role to change to
      changeAppearance - true if the NPC entities appearance should change, false otherwise
      state - The configured state, or null if undesired
      subState - The configured substate, or null if undesired
      store - The entity store for component access
    • requestRoleChange

      public static void requestRoleChange(@Nonnull Ref<EntityStore> ref, @Nonnull Role role, int roleIndex, boolean changeAppearance, @Nullable String state, @Nullable String subState, boolean detachFromSpawning, @Nonnull ComponentAccessor<EntityStore> store)
      Called to request a role change for a specific NPC entity
      Parameters:
      ref - The entity reference of the NPC entity to request a role change for
      role - The Role instance to change the NPC to
      roleIndex - The asset index of the role to change to
      changeAppearance - true if the NPC entities appearance should change, false otherwise
      state - The configured state, or null if undesired
      subState - The configured substate, or null if undesired
      detachFromSpawning - true to remove the NPC from world-spawn population tracking and despawning
      store - The entity store for component access