Objects and Entities: Improve object property and entity table descriptions
This commit is contained in:
parent
02658835b4
commit
390eec68ac
81
.gitignore
vendored
81
.gitignore
vendored
@ -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 ###
|
### Jekyll ###
|
||||||
_site/
|
_site/
|
||||||
.sass-cache/
|
.sass-cache/
|
||||||
|
.jekyll-cache/
|
||||||
.jekyll-metadata
|
.jekyll-metadata
|
||||||
|
|
||||||
### Linux ###
|
### Linux ###
|
||||||
@ -23,67 +30,6 @@ _site/
|
|||||||
# .nfs files are created when an open file is removed but is still being accessed
|
# .nfs files are created when an open file is removed but is still being accessed
|
||||||
.nfs*
|
.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 ###
|
### Ruby ###
|
||||||
*.gem
|
*.gem
|
||||||
*.rbc
|
*.rbc
|
||||||
@ -96,11 +42,13 @@ typings/
|
|||||||
/test/tmp/
|
/test/tmp/
|
||||||
/test/version_tmp/
|
/test/version_tmp/
|
||||||
/tmp/
|
/tmp/
|
||||||
package-lock.json
|
|
||||||
|
|
||||||
# Used by dotenv library to load environment variables.
|
# Used by dotenv library to load environment variables.
|
||||||
# .env
|
# .env
|
||||||
|
|
||||||
|
# Ignore Byebug command history file.
|
||||||
|
.byebug_history
|
||||||
|
|
||||||
## Specific to RubyMotion:
|
## Specific to RubyMotion:
|
||||||
.dat*
|
.dat*
|
||||||
.repl_history
|
.repl_history
|
||||||
@ -114,7 +62,6 @@ build-iPhoneSimulator/
|
|||||||
# We recommend against adding the Pods directory to your .gitignore. However
|
# We recommend against adding the Pods directory to your .gitignore. However
|
||||||
# you should judge for yourself, the pros and cons are mentioned at:
|
# 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
|
# https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control
|
||||||
#
|
|
||||||
# vendor/Pods/
|
# vendor/Pods/
|
||||||
|
|
||||||
## Documentation cache and generated files:
|
## Documentation cache and generated files:
|
||||||
@ -137,4 +84,4 @@ build-iPhoneSimulator/
|
|||||||
# unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
|
# unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
|
||||||
.rvmrc
|
.rvmrc
|
||||||
|
|
||||||
# End of https://www.gitignore.io/api/node,ruby,linux,jekyll
|
# End of https://www.gitignore.io/api/ruby,code,linux,jekyll
|
||||||
|
10
.vscode/settings.json
vendored
Normal file
10
.vscode/settings.json
vendored
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
{
|
||||||
|
"spellright.language": [
|
||||||
|
"en_GB"
|
||||||
|
],
|
||||||
|
"spellright.documentTypes": [
|
||||||
|
"latex",
|
||||||
|
"plaintext",
|
||||||
|
"markdown"
|
||||||
|
]
|
||||||
|
}
|
@ -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.
|
will just be saved and become inactive.
|
||||||
|
|
||||||
This distinction is muddied by the fact that Entities are controlled using a table
|
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
|
## Position and Velocity
|
||||||
|
|
||||||
@ -70,6 +70,10 @@ you need to be aware of.
|
|||||||
|
|
||||||
## Object Properties
|
## 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.
|
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
|
You can change how an object looks, among other things, at any time by updating
|
||||||
its properties.
|
its properties.
|
||||||
@ -95,8 +99,31 @@ joined players.
|
|||||||
|
|
||||||
## Entities
|
## Entities
|
||||||
|
|
||||||
An Entity has a type table much like an item does.
|
An Entity has a definition table that resembles an item definition table.
|
||||||
This table can contain callback methods, default object properties, and custom elements.
|
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.
|
||||||
|
|
||||||
|
<!--table A is a metatable of table B, then table
|
||||||
|
B will have all the properties and methods of table A if the derived table doesn't
|
||||||
|
have any itself.-->
|
||||||
|
|
||||||
```lua
|
```lua
|
||||||
local MyEntity = {
|
local MyEntity = {
|
||||||
|
Loading…
Reference in New Issue
Block a user