Class LuaEntityHelper
java.lang.Object
games.stendhal.server.core.scripting.lua.LuaEntityHelper
Exposes some entity classes & functions to Lua.
-
Field Summary
-
Method Summary
Modifier and TypeMethodDescriptioncreate(org.luaj.vm2.LuaTable lt)
Creates a new `Entity` instance.createShopSign(String name, String title, String caption, Boolean seller)
Deprecated.Deprecated.Usecreate(LuaTable)
.createSign(boolean visible)
Deprecated.Usecreate(LuaTable)
.games.stendhal.server.core.scripting.lua.LuaEntityHelper.LuaSilentNPC
Deprecated.Usecreate(LuaTable)
.games.stendhal.server.core.scripting.lua.LuaEntityHelper.LuaSpeakerNPC
createSpeakerNPC(String name)
Deprecated.Usecreate(LuaTable)
.static LuaEntityHelper
get()
Retrieves the static instance.Retrieves a registered Item.Retrieves an existing SpeakerNPC.Retrieves a logged in Player.getStackableItem(String name)
Retrieves a registered StackableItem.void
Deprecated.Use {@link games.stendhal.server.entity.GuidedEntity#setPath(FixedPath).void
setPathAndPosition(RPEntity entity, org.luaj.vm2.LuaTable table, Boolean loop)
Deprecated.int
summonCreature(org.luaj.vm2.LuaTable table)
-
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. 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
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.Usecreate(LuaTable)
.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.Usecreate(LuaTable)
.Creates a new SilentNPC instance.- Returns:
- New SilentNPC 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.
-
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 of which path is being set.table
- Lua table with list of coordinates representing nodes.
-
createSign
Deprecated.Usecreate(LuaTable)
.Creates a new Sign entity.- Returns:
- New Sign instance.
-
createSign
Deprecated.Usecreate(LuaTable)
.Creates a new Sign entity.- Parameters:
visible
- Iffalse
, 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.Usecreate(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 totrue
ifnull
).- Returns:
- New ShopSign instance.
-
summonCreature
public int summonCreature(org.luaj.vm2.LuaTable table)
-
create(LuaTable)
.