From 390eec68ac7ba1e822117b4e60f17b45e88c1ed7 Mon Sep 17 00:00:00 2001 From: rubenwardy Date: Sat, 28 Mar 2020 19:59:39 +0000 Subject: [PATCH] Objects and Entities: Improve object property and entity table descriptions --- .gitignore | 81 ++++++++----------------------------------- .vscode/settings.json | 10 ++++++ _en/map/objects.md | 33 ++++++++++++++++-- 3 files changed, 54 insertions(+), 70 deletions(-) create mode 100644 .vscode/settings.json diff --git a/.gitignore b/.gitignore index 3650a90..388d860 100644 --- a/.gitignore +++ b/.gitignore @@ -1,11 +1,18 @@ -*.zip -vendor -# Created by https://www.gitignore.io/api/node,ruby,linux,jekyll +# Created by https://www.gitignore.io/api/ruby,code,linux,jekyll +# Edit at https://www.gitignore.io/?templates=ruby,code,linux,jekyll + +### Code ### +.vscode/* +!.vscode/settings.json +!.vscode/tasks.json +!.vscode/launch.json +!.vscode/extensions.json ### Jekyll ### _site/ .sass-cache/ +.jekyll-cache/ .jekyll-metadata ### Linux ### @@ -23,67 +30,6 @@ _site/ # .nfs files are created when an open file is removed but is still being accessed .nfs* -### Node ### -# Logs -logs -*.log -npm-debug.log* -yarn-debug.log* -yarn-error.log* - -# Runtime data -pids -*.pid -*.seed -*.pid.lock - -# Directory for instrumented libs generated by jscoverage/JSCover -lib-cov - -# Coverage directory used by tools like istanbul -coverage - -# nyc test coverage -.nyc_output - -# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) -.grunt - -# Bower dependency directory (https://bower.io/) -bower_components - -# node-waf configuration -.lock-wscript - -# Compiled binary addons (http://nodejs.org/api/addons.html) -build/Release - -# Dependency directories -node_modules/ -jspm_packages/ - -# Typescript v1 declaration files -typings/ - -# Optional npm cache directory -.npm - -# Optional eslint cache -.eslintcache - -# Optional REPL history -.node_repl_history - -# Output of 'npm pack' -*.tgz - -# Yarn Integrity file -.yarn-integrity - -# dotenv environment variables file -.env - - ### Ruby ### *.gem *.rbc @@ -96,11 +42,13 @@ typings/ /test/tmp/ /test/version_tmp/ /tmp/ -package-lock.json # Used by dotenv library to load environment variables. # .env +# Ignore Byebug command history file. +.byebug_history + ## Specific to RubyMotion: .dat* .repl_history @@ -114,7 +62,6 @@ build-iPhoneSimulator/ # We recommend against adding the Pods directory to your .gitignore. However # you should judge for yourself, the pros and cons are mentioned at: # https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control -# # vendor/Pods/ ## Documentation cache and generated files: @@ -137,4 +84,4 @@ build-iPhoneSimulator/ # unless supporting rvm < 1.11.0 or doing something fancy, ignore this: .rvmrc -# End of https://www.gitignore.io/api/node,ruby,linux,jekyll +# End of https://www.gitignore.io/api/ruby,code,linux,jekyll diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..3c19226 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,10 @@ +{ + "spellright.language": [ + "en_GB" + ], + "spellright.documentTypes": [ + "latex", + "plaintext", + "markdown" + ] +} \ No newline at end of file diff --git a/_en/map/objects.md b/_en/map/objects.md index c24c7cd..b9fe91f 100644 --- a/_en/map/objects.md +++ b/_en/map/objects.md @@ -37,7 +37,7 @@ Another difference is that Players will cause map blocks to be loaded, whereas E will just be saved and become inactive. This distinction is muddied by the fact that Entities are controlled using a table -which is referred to as a luaentity, as discussed later. +which is referred to as a Lua entity, as discussed later. ## Position and Velocity @@ -70,6 +70,10 @@ you need to be aware of. ## Object Properties +Object properties are used to tell the client how to render and deal with an +object. It's not possible to define custom properties, because the properties are +for the engine to use, by definition. + Unlike nodes, objects have a dynamic rather than set appearance. You can change how an object looks, among other things, at any time by updating its properties. @@ -95,8 +99,31 @@ joined players. ## Entities -An Entity has a type table much like an item does. -This table can contain callback methods, default object properties, and custom elements. +An Entity has a definition table that resembles an item definition table. +This table can contain callback methods, initial object properties, and custom +members. + +However, entities differ in one very important way from items. When an entity is +emerged (ie: loaded or created), a new table is created for that entity that +*inherits* from the definition table using metatables. +This new table is commonly referred to as a Lua Entity table. + +Metatables are an important Lua feature that you will need +to be aware of, as it is an essential part of the Lua language. + +In layman's terms, a metatable allows you to control how the table behaves when +using certain Lua syntax. The most common use of metatables is the ability to use +another table as a prototype, defaulting to the other table's properties and methods when +they do not exist in the current table. + +Say you want to access member X on table A. If table A has that member, then +it will be returned as normal. However, if the table doesn't have that member but +it does have a metatable could table B, then table B will be checked to see if it +has that member. + + ```lua local MyEntity = {