Base class for all world entities (game objects) and containers (modules, areas).
More...
|
async Task | AddActionToQueue (System.Action action) |
| Inserts the function call aCommand into the Action Queue, ensuring the calling object will perform actions in a particular order. More...
|
|
async Task | ClearActionQueue (bool clearCombatState=false) |
| Clear all the object's actions. More...
|
|
void | ClearEventSubscriptions () |
| Clears any event subscriptions associated with this object. More...
|
|
bool | Equals (NwObject? other) |
|
override bool | Equals (object? obj) |
|
void | ForceRefreshUUID () |
|
string | GetEventScript (EventScriptType eventType) |
| Gets the script assigned to run for the specified object event. More...
|
|
override int | GetHashCode () |
|
T | GetObjectVariable< T > (string name) |
| Gets the specified object variable for this object. More...
|
|
bool | IsEventLocked (EventScriptType eventType) |
| Gets a value indicating whether the event script can be modified for the specified event. More...
|
|
abstract ? Guid | PeekUUID () |
| Attempts to get the UUID of this object, if assigned. More...
|
|
Json | SerializeToJson (bool saveObjectState) |
| Serializes this game object to a json representation More...
|
|
void | SetEventScript (EventScriptType eventType, string? script) |
| Sets the script to be run on the specified object event. More...
|
|
async Task | SpeakString (string message, TalkVolume talkVolume=TalkVolume.Talk, bool queueAsAction=false) |
| Instructs this object to speak. More...
|
|
override string | ToString () |
| The ID of this object as a string. Can be used in StringExtensions.ParseObject while the object is alive.
This cannot be used across server restarts. See UUID for a persistent unique identifier. More...
|
|
bool | TryGetUUID (out Guid uid) |
| Attempts to get the UUID for this object, assigning a new ID if it does not already exist.
More...
|
|
async Task | WaitForObjectContext () |
| Notifies then awaits for this object to become the current active object for the purpose of implicitly assigned values (e.g. effect creators).
If the current active object is already this object, then the code runs immediately. Otherwise, it will be run with all other closures.
This is the async equivalent of AssignCommand in NWScript. More...
|
|
|
readonly uint | ObjectId |
| The ID of this object instance. Not persistent, changes after every spawn of the object.
See UUID for a persistent unique ID for objects. More...
|
|
|
| NwObject (ICGameObject gameObject) |
|
void | AssertObjectValid () |
|
|
string | Description [get, set] |
| Gets or sets the description for this object. More...
|
|
static EventService | EventService = null! [get] |
|
bool | HasUUID [get] |
| Gets a value indicating whether this object has an assigned UUID. More...
|
|
bool | IsValid [get] |
| Gets a value indicating whether this is a valid object. More...
|
|
IEnumerable< ObjectVariable > | LocalVariables [get] |
| Gets all local variables assigned on this object. More...
|
|
string | Name [get, set] |
| Gets or sets the name of this object. More...
|
|
static Lazy< ObjectVisibilityService > | ObjectVisibilityService = null! [get] |
|
string | OriginalDescription [get] |
| Gets the original description for this object as defined in the toolset. More...
|
|
static ResourceManager | ResourceManager = null! [get] |
|
string | ResRef [get] |
| Gets the resource reference used to create this object. More...
|
|
string | Tag [get, set] |
| Gets or sets the tag for this object. More...
|
|
Guid | UUID [get] |
| Gets the globally unique identifier for this object. More...
|
|
static VirtualMachine | VirtualMachine = null! [get] |
|
Base class for all world entities (game objects) and containers (modules, areas).
◆ AddActionToQueue()
async Task Anvil.API.NwObject.AddActionToQueue |
( |
System.Action |
action | ) |
|
|
inline |
Inserts the function call aCommand into the Action Queue, ensuring the calling object will perform actions in a particular order.
◆ ClearActionQueue()
async Task Anvil.API.NwObject.ClearActionQueue |
( |
bool |
clearCombatState = false | ) |
|
|
inline |
Clear all the object's actions.
- No return value, but if an error occurs, the log file will contain "ClearAllActions failed.".
- clearCombatState: if true, this will immediately clear the combat state on a creature, which will stop the combat music and allow them to rest, engage in dialog, or other actions that they would normally have to wait for.
◆ ClearEventSubscriptions()
void Anvil.API.NwObject.ClearEventSubscriptions |
( |
| ) |
|
|
inline |
Clears any event subscriptions associated with this object.
◆ FindObjectsOfType< T >()
static IEnumerable<T> Anvil.API.NwObject.FindObjectsOfType< T > |
( |
| ) |
|
|
inlinestatic |
Locates all objects of the specified type.
- Template Parameters
-
T | The type of objects to search. |
- Returns
- An enumeration containing all objects of the specified type.
◆ FindObjectsWithTag()
static IEnumerable<NwObject> Anvil.API.NwObject.FindObjectsWithTag |
( |
params string[] |
tags | ) |
|
|
inlinestatic |
Locates all objects of that have the specified tag.
- Parameters
-
tags | The tag/s of the objects to locate. |
- Returns
- An enumeration containing all objects with the specified tags.
◆ FindObjectsWithTag< T >()
Locates all objects of the specified type that have the specified tag.
- Parameters
-
tags | The tag/s of the objects to locate. |
- Template Parameters
-
T | The type of objects to search. |
- Returns
- An enumeration containing all objects with the specified tags.
◆ GetEventScript()
string Anvil.API.NwObject.GetEventScript |
( |
EventScriptType |
eventType | ) |
|
|
inline |
Gets the script assigned to run for the specified object event.
- Parameters
-
eventType | The event type to query. |
- Returns
- The script that has been assigned to the event, otherwise an string.Empty string.
◆ GetObjectVariable< T >()
T Anvil.API.NwObject.GetObjectVariable< T > |
( |
string |
name | ) |
|
|
inline |
Gets the specified object variable for this object.
- Parameters
-
- Template Parameters
-
- Returns
- A LocalVariable instance for getting/setting the variable's value.
- Type Constraints
-
T | : | ObjectVariable | |
T | : | new() | |
◆ IsEventLocked()
bool Anvil.API.NwObject.IsEventLocked |
( |
EventScriptType |
eventType | ) |
|
|
inline |
Gets a value indicating whether the event script can be modified for the specified event.
- Parameters
-
eventType | The event type to query. |
- Returns
- True if the event is locked and the script cannot be modified, otherwise false.
◆ PeekUUID()
abstract ? Guid Anvil.API.NwObject.PeekUUID |
( |
| ) |
|
|
pure virtual |
◆ SerializeToJson()
Json Anvil.API.NwObject.SerializeToJson |
( |
bool |
saveObjectState | ) |
|
|
inline |
Serializes this game object to a json representation
◆ SetEventScript()
void Anvil.API.NwObject.SetEventScript |
( |
EventScriptType |
eventType, |
|
|
string? |
script |
|
) |
| |
|
inline |
Sets the script to be run on the specified object event.
- Parameters
-
eventType | The event to be assigned. |
script | The new script to assign to this event. |
- Exceptions
-
InvalidOperationException | Thrown if setting the event script failed. This can be from an invalid event script type, or this event is locked as a service has subscribed to this event. See IsEventLocked to determine if an event script can be changed. |
ArgumentOutOfRangeException | Thrown if the specified script name is invalid. |
◆ SpeakString()
async Task Anvil.API.NwObject.SpeakString |
( |
string |
message, |
|
|
TalkVolume |
talkVolume = TalkVolume.Talk , |
|
|
bool |
queueAsAction = false |
|
) |
| |
|
inline |
Instructs this object to speak.
- Parameters
-
message | The message the object should speak. |
talkVolume | The channel/volume of this message. |
queueAsAction | Whether the object should speak immediately (false), or be queued in the object's action queue (true). |
◆ ToString()
override string Anvil.API.NwObject.ToString |
( |
| ) |
|
|
inline |
The ID of this object as a string. Can be used in StringExtensions.ParseObject while the object is alive.
This cannot be used across server restarts. See UUID for a persistent unique identifier.
◆ TryGetUUID()
bool Anvil.API.NwObject.TryGetUUID |
( |
out Guid |
uid | ) |
|
|
inline |
Attempts to get the UUID for this object, assigning a new ID if it does not already exist.
See PeekUUID to check if the object has an existing UUID, without creating a new one.
This function will return false if the UUID is not globally unique, and conflicts with an existing object.
- Parameters
-
- Returns
- True if the object has a valid unique identifier, otherwise false.
◆ WaitForObjectContext()
async Task Anvil.API.NwObject.WaitForObjectContext |
( |
| ) |
|
|
inline |
Notifies then awaits for this object to become the current active object for the purpose of implicitly assigned values (e.g. effect creators).
If the current active object is already this object, then the code runs immediately. Otherwise, it will be run with all other closures.
This is the async equivalent of AssignCommand in NWScript.
◆ ObjectId
readonly uint Anvil.API.NwObject.ObjectId |
The ID of this object instance. Not persistent, changes after every spawn of the object.
See UUID for a persistent unique ID for objects.
◆ Description
string Anvil.API.NwObject.Description |
|
getset |
Gets or sets the description for this object.
◆ HasUUID
bool Anvil.API.NwObject.HasUUID |
|
get |
Gets a value indicating whether this object has an assigned UUID.
◆ IsValid
bool Anvil.API.NwObject.IsValid |
|
get |
Gets a value indicating whether this is a valid object.
◆ LocalVariables
Gets all local variables assigned on this object.
◆ Name
string Anvil.API.NwObject.Name |
|
getset |
Gets or sets the name of this object.
◆ OriginalDescription
string Anvil.API.NwObject.OriginalDescription |
|
get |
Gets the original description for this object as defined in the toolset.
◆ ResRef
string Anvil.API.NwObject.ResRef |
|
get |
Gets the resource reference used to create this object.
◆ Tag
string Anvil.API.NwObject.Tag |
|
getset |
Gets or sets the tag for this object.
◆ UUID
Guid Anvil.API.NwObject.UUID |
|
get |
Gets the globally unique identifier for this object.
If the UUID conflicts with an existing object, a new one will be generated.
Use TryGetUUID to control this behaviour.
The documentation for this class was generated from the following files:
- NWN.Anvil/src/main/API/Objects/NwObject.Create.cs
- NWN.Anvil/src/main/API/Objects/NwObject.cs