Class TrainzGameObject
From TrainzOnline
(Difference between revisions)
Line 36: | Line 36: | ||
*The returned [[Class Asset|Asset]] reference can be used to retrieve the KUID, StringTable or configuration data of the Asset. | *The returned [[Class Asset|Asset]] reference can be used to retrieve the KUID, StringTable or configuration data of the Asset. | ||
<br> | <br> | ||
+ | |||
+ | |||
+ | ==IssueSecurityToken== | ||
+ | {{MethodHeader|native SecurityToken IssueSecurityToken(KUID asset, string[] rights)}} | ||
+ | |||
+ | ==IssueSecurityToken== | ||
+ | {{MethodHeader|native SecurityToken IssueSecurityToken(SecurityToken source, KUID asset, string[] rights))}} | ||
+ | |||
+ | ==MergeSecurityTokens== | ||
+ | {{MethodHeader|native SecurityToken MergeSecurityTokens(SecurityToken[] tokens)}} | ||
+ | |||
+ | ==Validate== | ||
+ | {{MethodHeader|native bool Validate(SecurityToken token, TrainzGameObject owner, string operation)}} | ||
+ | |||
+ | ==Validate== | ||
+ | {{MethodHeader|native bool Validate(SecurityToken token, KUID owner, string operation)}} | ||
==Categories== | ==Categories== | ||
[[Category:Script Class]] | [[Category:Script Class]] |
Revision as of 11:07, 26 February 2024
- API Hierarchy
- GSObject
- GameObject
- Class TrainzGameObject
- GameObject
- GSObject
- Base class for a GameObject that is an instance of a Trainz asset.
Contents |
Init
public void Init(void)
public void Init(Asset asset)
public void Init(Asset asset)
- Parameters
- asset = Reference to the script's associated asset.
- Returned Value
- None
- Syntax
- None, method is automatically called by the game.
- Notes
- Initialisation method which is called by Trainz when the object is first created.
- It is up to the script programmer to do any initialization tasks required here.
- This may include starting monitor threads, adding message handlers, and so on.
- Some derived classes have both an Init() and Init(Asset) method. It is recommended that you use the Init(Asset) version whenever you can.
- Uses the 'mandatory' keyword, meaning you must call inherited() when overriding this function.
- Since Init() is called from native Trainz code, you cannot use Sleep() or wait(). However, Init() can start threaded methods that are allowed to sleep and process messages.
GetAsset
public Asset GetAsset(void)
- Parameters
- None
- Returned Value
- A reference to the owning asset.
- Syntax
Asset asset = GetAsset();
- Notes
- The returned Asset reference can be used to retrieve the KUID, StringTable or configuration data of the Asset.
IssueSecurityToken
native SecurityToken IssueSecurityToken(KUID asset, string[] rights)
IssueSecurityToken
native SecurityToken IssueSecurityToken(SecurityToken source, KUID asset, string[] rights))
MergeSecurityTokens
native SecurityToken MergeSecurityTokens(SecurityToken[] tokens)
Validate
native bool Validate(SecurityToken token, TrainzGameObject owner, string operation)
Validate
native bool Validate(SecurityToken token, KUID owner, string operation)