mirror of https://github.com/marrub--/zscript-doc
pull/1/head
commit
1242692f6f
|
@ -0,0 +1,44 @@
|
|||
Top-level
|
||||
=========
|
||||
|
||||
A ZScript file can have one of several things at the top level of the file:
|
||||
|
||||
- Class definitions
|
||||
- Structure definitions
|
||||
- Enumeration definitions
|
||||
- Constant definitions
|
||||
- Include directives
|
||||
|
||||
Class definitions
|
||||
=================
|
||||
|
||||
A class definition starts with a class header, followed by an opening brace, class data and a closing brace. Alternatively, you can follow the class header with a semicolon and the rest of the file will be considered class data.
|
||||
|
||||
Class headers
|
||||
-------------
|
||||
|
||||
The class header is formed as such:
|
||||
|
||||
```cs
|
||||
class Name [: BaseClass] [Class flags...]
|
||||
```
|
||||
|
||||
Class flags include:
|
||||
|
||||
| Flag | Description |
|
||||
| --------------------- | --- |
|
||||
| abstract | Cannot be instantiated with new(). |
|
||||
| native | Class is from the engine. |
|
||||
| ui | Has UI scope. |
|
||||
| play | Has Play scope. |
|
||||
| replaces ReplaceClass | Replaces ReplaceClass with this class. Only works on objects which are descendants of Actor. |
|
||||
| version("ver") | Restricted to version <ver>. |
|
||||
|
||||
Example usages:
|
||||
|
||||
```cs
|
||||
class MyCoolObject play // automatically inherits Object
|
||||
class MyCoolThinker : Thinker // inherits Thinker
|
||||
class MyCoolActor : Actor replaces OtherActor
|
||||
class MyCoolInterface abstract // can only be inherited
|
||||
```
|
Loading…
Reference in New Issue