Class LuaEntityHelper

java.lang.Object
games.stendhal.server.core.scripting.lua.LuaEntityHelper

public class LuaEntityHelper extends Object
Exposes some entity classes & functions to Lua.
  • Field Details

  • Method Details

    • get

      public static LuaEntityHelper get()
      Retrieves the static instance.
      Returns:
      Static EntityHelper instance.
    • create

      public Entity create(org.luaj.vm2.LuaTable lt)
      Creates a new `Entity` instance.
      Parameters:
      lt - Entity definition table.
      Returns:
      New `Entity` instance.
    • getPlayer

      public Player getPlayer(String name)
      Retrieves a logged in Player.
      Parameters:
      name - Name of player.
      Returns:
      Logged in player or null.
    • getNPC

      public SpeakerNPC getNPC(String name)
      Retrieves an existing SpeakerNPC. FIXME: cannot cast to LuaSpeakerNPC, so specialized methods will not work with entities retrieved from this method that are not instances of LuaSpeakerNPC.
      Parameters:
      name - Name of NPC.
      Returns:
      SpeakerNPC instance or null.
    • getItem

      public Item getItem(String name)
      Retrieves a registered Item.
      Parameters:
      name - Name of the item.
      Returns:
      Item instance or null if not a registered item.
    • getStackableItem

      public StackableItem getStackableItem(String name)
      Retrieves a registered StackableItem.
      Parameters:
      name - Name of the item.
      Returns:
      StackableItem instance or null if not a registered stackable item.
    • createSpeakerNPC

      @Deprecated public games.stendhal.server.core.scripting.lua.LuaEntityHelper.LuaSpeakerNPC createSpeakerNPC(String name)
      Deprecated.
      Creates a new SpeakerNPC instance.
      Parameters:
      name - Name of new NPC.
      Returns:
      New SpeakerNPC instance.
    • createSilentNPC

      @Deprecated public games.stendhal.server.core.scripting.lua.LuaEntityHelper.LuaSilentNPC createSilentNPC()
      Deprecated.
      Creates a new SilentNPC instance.
      Returns:
      New SilentNPC instance.
    • setPath

      @Deprecated public void setPath(RPEntity entity, org.luaj.vm2.LuaTable table, Boolean loop)
      Deprecated.
      Use {@link games.stendhal.server.entity.GuidedEntity#setPath(FixedPath).
      Helper function for setting an NPCs path.
      Parameters:
      entity - The NPC instance of which path is being set.
      table - Lua table with list of coordinates representing nodes.
    • setPathAndPosition

      @Deprecated public void setPathAndPosition(RPEntity entity, org.luaj.vm2.LuaTable table, Boolean loop)
      Helper function for setting an NPCs path & starting position.
      Parameters:
      entity - The NPC instance of which path is being set.
      table - Lua table with list of coordinates representing nodes.
    • createSign

      @Deprecated public Sign createSign()
      Deprecated.
      Creates a new Sign entity.
      Returns:
      New Sign instance.
    • createSign

      @Deprecated public Sign createSign(boolean visible)
      Deprecated.
      Creates a new Sign entity.
      Parameters:
      visible - If false, sign does not have a visual representation.
      Returns:
      New Sign instance.
    • createShopSign

      @Deprecated public ShopSign createShopSign(String name, String title, String caption, Boolean seller)
      Deprecated.
      Creates a new ShopSign entity.
      Parameters:
      name - The shop name.
      title - The sign title.
      caption - The caption above the table.
      seller - true, if this sign is for items sold by an NPC (defaults to true if null).
      Returns:
      New ShopSign instance.
    • summonCreature

      public int summonCreature(org.luaj.vm2.LuaTable table)