Showing the changes to libraries/script-engine/src/ScriptEngine.cpp (1 of 4 files). Show all
Unified · Split
| @@ -987,6 +987,31 @@ void ScriptEngine::addEventHandler(const EntityItemID& entityID, const QString& · 986 unmodified lines | ||
| 987 | 987 | }; |
| 988 | 988 | }; |
| 989 | 989 | |
| 990 | + /**jsdoc | |
| 991 | + * The name of an entity event. When the entity event occurs, any function that has been registered for that event via | |
| 992 | + * {@link Script.addEventHandler} is called with parameters per the entity event. | |
| 993 | + * <table> | |
| 994 | + * <thead> | |
| 995 | + * <tr><th>Event Name</th><th>Entity Event</th></tr> | |
| 996 | + * </thead> | |
| 997 | + * <tbody> | |
| 998 | + * <tr><td><code>"enterEntity"</code></td><td>{@link Entities.enterEntity}</td></tr> | |
| 999 | + * <tr><td><code>"leaveEntity"</code></td><td>{@link Entities.leaveEntity}</td></tr> | |
| 1000 | + * <tr><td><code>"mousePressOnEntity"</code></td><td>{@link Entities.mousePressOnEntity}</td></tr> | |
| 1001 | + * <tr><td><code>"mouseMoveOnEntity"</code></td><td>{@link Entities.mouseMoveOnEntity}</td></tr> | |
| 1002 | + * <tr><td><code>"mouseReleaseOnEntity"</code></td><td>{@link Entities.mouseReleaseOnEntity}</td></tr> | |
| 1003 | + * <tr><td><code>"clickDownOnEntity"</code></td><td>{@link Entities.clickDownOnEntity}</td></tr> | |
| 1004 | + * <tr><td><code>"holdingClickOnEntity"</code></td><td>{@link Entities.holdingClickOnEntity}</td></tr> | |
| 1005 | + * <tr><td><code>"clickReleaseOnEntity"</code></td><td>{@link Entities.clickReleaseOnEntity}</td></tr> | |
| 1006 | + * <tr><td><code>"hoverEnterEntity"</code></td><td>{@link Entities.hoverEnterEntity}</td></tr> | |
| 1007 | + * <tr><td><code>"hoverOverEntity"</code></td><td>{@link Entities.hoverOverEntity}</td></tr> | |
| 1008 | + * <tr><td><code>"hoverLeaveEntity"</code></td><td>{@link Entities.hoverLeaveEntity}</td></tr> | |
| 1009 | + * <tr><td><code>"collisionWithEntity"</code></td><td>{@link Entities.collisionWithEntity}</td></tr> | |
| 1010 | + * </tbody> | |
| 1011 | + * </table> | |
| 1012 | + * | |
| 1013 | + * @typedef {string} Script.EntityEvent | |
| 1014 | + */ | |
| 990 | 1015 | connect(entities.data(), &EntityScriptingInterface::enterEntity, this, makeSingleEntityHandler("enterEntity")); |
| 991 | 1016 | connect(entities.data(), &EntityScriptingInterface::leaveEntity, this, makeSingleEntityHandler("leaveEntity")); |
| 992 | 1017 | |
| @@ -2147,7 +2172,7 @@ void ScriptEngine::loadEntityScript(const EntityItemID& entityID, const QString& · 1154 unmodified lines | ||
| 2147 | 2172 | } |
| 2148 | 2173 | |
| 2149 | 2174 | /**jsdoc |
| 2150 | − * Triggered when the script starts for a user. | |
| 2175 | + * Triggered when the script starts for a user. See also, {@link Script.entityScriptPreloadFinished}. | |
| 2151 | 2176 | * <p>Note: Can only be connected to via <code>this.preload = function (...) { ... }</code> in the entity script.</p> |
| 2152 | 2177 | * <table><tr><th>Available in:</th><td>Client Entity Scripts</td><td>Server Entity Scripts</td></tr></table> |
| 2153 | 2178 | * @function Entities.preload |
| @@ -2161,7 +2186,7 @@ void ScriptEngine::loadEntityScript(const EntityItemID& entityID, const QString& · 7 unmodified lines | ||
| 2161 | 2186 | * this.entityID = entityID; |
| 2162 | 2187 | * print("Entity ID: " + this.entityID); |
| 2163 | 2188 | * }; |
| 2164 | − * ); | |
| 2189 | + * }); | |
| 2165 | 2190 | * |
| 2166 | 2191 | * var entityID = Entities.addEntity({ |
| 2167 | 2192 | * type: "Box", |