Class LuaEntityHelper
java.lang.Object
games.stendhal.server.core.scripting.lua.LuaEntityHelper
Exposes some entity classes & functions to Lua.
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionvoidaddKnownChatOptions(SpeakerNPC npc, org.luaj.vm2.LuaTable keywords) Helper function as SpeakerNPC.addKnownChatOptions cannot seem to handle array of LuaString.create(org.luaj.vm2.LuaTable lt) Creates a new `Entity` instance.createItemSpawner(String name, int meanTurns) Creates an item spawner.createItemSpawner(String name, int meanTurns, boolean initOnAdded) Creates an item spawner.createShopSign(String name, String title, String caption, Boolean seller) Deprecated.Use `LuaEntityHelper.create(LuaTable)`.Deprecated.Use `LuaEntityHelper.create(LuaTable)`.createSign(boolean visible) Deprecated.Use `LuaEntityHelper.create(LuaTable)`.Deprecated.Use `LuaEntityHelper.create`.games.stendhal.server.core.scripting.lua.LuaEntityHelper.LuaSpeakerNPCcreateSpeakerNPC(String name) Deprecated.Use `LuaEntityHelper.create`.fixedPath(org.luaj.vm2.LuaTable table, boolean loop) Creates a path for a guided entity.static LuaEntityHelperget()Retrieves the static instance.Retrieves a registered Item.Retrieves an existing SpeakerNPC.Retrieves a logged in Player.getStackableItem(String name) Retrieves a registered StackableItem.voidDeprecated.Use {@link games.stendhal.server.entity.GuidedEntity#setPath(FixedPath).voidsetPathAndPosition(RPEntity entity, org.luaj.vm2.LuaTable table, Boolean loop) Deprecated.intsummonCreature(org.luaj.vm2.LuaTable table) Summons a creature into the world.
-
Field Details
-
manager
-
-
Method Details
-
get
Retrieves the static instance.- Returns:
- Static EntityHelper instance.
-
create
Creates a new `Entity` instance.- Parameters:
lt- Entity definition table.- Returns:
- New `Entity` instance.
-
getPlayer
Retrieves a logged in Player.- Parameters:
name- Name of player.- Returns:
- Logged in player or `null`.
-
getNPC
Retrieves an existing SpeakerNPC.- Parameters:
name- Name of NPC.- Returns:
- SpeakerNPC instance or `null`.
-
getItem
Retrieves a registered Item.- Parameters:
name- Name of the item.- Returns:
- Item instance or `null` if not a registered item.
-
getStackableItem
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.Use `LuaEntityHelper.create`.Creates a new SpeakerNPC instance.- Parameters:
name- Name of new NPC.- Returns:
- New SpeakerNPC instance.
-
createSilentNPC
Deprecated.Use `LuaEntityHelper.create`.Creates a new SilentNPC instance.- Returns:
- New SilentNPC instance.
-
createItemSpawner
Creates an item spawner.- Parameters:
name- Name of item to be spawned.meanTurns- Average number of turns for item to respawn.initOnAdded- If `true`, sets to full grown and initializes respawn timer when added to zone.- Returns:
- PassiveEntityRespawnPoint instance.
-
createItemSpawner
Creates an item spawner.- Parameters:
name- Name of item to be spawned.meanTurns- Average number of turns for item to respawn.- Returns:
- `PassiveEntityRespawnPoint` instance.
-
setPath
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.loop- If `true` entity will restart path upon completion.
-
setPathAndPosition
@Deprecated public void setPathAndPosition(RPEntity entity, org.luaj.vm2.LuaTable table, Boolean loop) Deprecated.Helper function for setting an NPCs path & starting position.- Parameters:
entity- The NPC instance whose path is being set.table- Lua table with list of coordinates representing nodes.loop- If `true` entity will restart path upon completion.
-
createSign
Deprecated.Use `LuaEntityHelper.create(LuaTable)`.Creates a new Sign entity.- Returns:
- New Sign instance.
-
createSign
Deprecated.Use `LuaEntityHelper.create(LuaTable)`.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.Use `LuaEntityHelper.create(LuaTable)`.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) Summons a creature into the world.- Parameters:
table- Creature attributes.- Returns:
- 0 = success 1 = creature not found 2 = zone not found
-
fixedPath
Creates a path for a guided entity.- Parameters:
table- List of path coordinates.loop- Whether the path should loop.- Returns:
- Instance of `games.stendhal.server.core.pathfinder.FixedPath`.
-
addKnownChatOptions
Helper function as SpeakerNPC.addKnownChatOptions cannot seem to handle array of LuaString.- Parameters:
npc- NPC to which options should be added.keywords- Keyword(s) to be added.
-