Class: ScriptingReference
ScriptingReference is a reference that ties together a script and the game engine, with functions for the script to retrieve information/send messages to the game engine.
Table of contents
Constructors
Methods
Constructors
constructor
+ new ScriptingReference(getScriptEntity: () => undefined | SystemEntity, getEntityByID: (id: number) => undefined | SystemEntity, getEntitiesByTag: (tag: string) => SystemEntity[], getEntitiesByLayer: (layer: string) => SystemEntity[], sendMessage: (message: IMessage) => void): ScriptingReference
Parameters:
| Name | Type |
|---|---|
getScriptEntity |
() => undefined | SystemEntity |
getEntityByID |
(id: number) => undefined | SystemEntity |
getEntitiesByTag |
(tag: string) => SystemEntity[] |
getEntitiesByLayer |
(layer: string) => SystemEntity[] |
sendMessage |
(message: IMessage) => void |
Returns: ScriptingReference
Methods
GetEntitiesByLayer
▸ GetEntitiesByLayer(layer: string): SystemEntity[]
GetEntitiesByLayer returns a list of any entities with the layer provided.
Parameters:
| Name | Type | Description |
|---|---|---|
layer |
string | Layer to search for |
Returns: SystemEntity[]
GetEntitiesByTag
▸ GetEntitiesByTag(tag: string): SystemEntity[]
GetEntitiesByTag returns a list of any entities with the tag provided.
Parameters:
| Name | Type | Description |
|---|---|---|
tag |
string | Tag to search for |
Returns: SystemEntity[]
GetEntityByID
▸ GetEntityByID(id: number): undefined | SystemEntity
GetEntityByID returns any entity with a matching ID, otherwise it returns undefined.
Parameters:
| Name | Type | Description |
|---|---|---|
id |
number | ID of the entity to search for. |
Returns: undefined | SystemEntity
GetScriptEntity
▸ GetScriptEntity(): undefined | SystemEntity
GetScriptEntity returns any entity associated with the script being executed. This can be undefined if no entity is associated.
Returns: undefined | SystemEntity
SendMessage
▸ SendMessage(message: IMessage): void
SendMessage sends a message to the JamJar engine message bus.
Parameters:
| Name | Type |
|---|---|
message |
IMessage |
Returns: void