Marauroa Core API: Difference between revisions
Content deleted Content added
imported>Hendrik Brummermann |
imported>Hendrik Brummermann |
||
Line 101:
</source>
These methods add attributes to the RPClass and set their type and visibility. You can also set the parent of this class. Of course
Once the class has been filled, you can query the data using these methods. These methods
▲Once the class has been filled, you can query the data using these methods. These methods alow you to get the class name of the class, the the type of an attribute, determine if an attribute exists and to know if that RPClass is a subclass of another.<br>
'''Query''':
<source lang="java">
Line 113 ⟶ 114:
</source>
You can query the system classes using these methods. Note that it is '''not''' a good idea to modify them once you are running. The class definitions are send to the client on connect hence if you change the class definitions in the middle of a game you will crash your clients!
'''Class wide query''':
<source lang="java">
</source>
Line 128 ⟶ 130:
// a general entity with a position
RPClass objclass = new RPClass("entity");
objclass.add("x", RPClass.BYTE);
objclass.add("y", RPClass.BYTE);
// an entity specialized in players
objclass = RPClass("player");
objclass.isA("entity");
objclass.add("name", RPClass.SHORT_STRING);
objclass.add("
objclass.add("score", RPClass.INT);
objclass.add("super", RPClass.BYTE);
objclass.add("!vdir", RPClass.STRING,RPClass.HIDDEN);
objclass.add("!hdir", RPClass.STRING,RPClass.HIDDEN);
objclass.add("?kill", RPClass.FLAG);
</source>
Each time you create a new RPClass, as long as you give it a name (
Notice in the example that the
Note: You can choose not to use RPClasses in your application
== RPAction ==
| |||