DOCS: add info about built-in entity custom fields in bullets
This commit is contained in:
parent
ae250a2f2a
commit
d3f70edd15
43
DOCS.md
43
DOCS.md
@ -137,22 +137,33 @@ TODO: physics_override con zoom al momento prob dà problemi
|
||||
TODO: `explosion`
|
||||
|
||||
#### 1.3.1.1 Bullets structure
|
||||
* `entity`: (table) the luaentity representing the bullet
|
||||
* every field declared in the table will be maintained (i.e. `initial_properties`, custom fields)
|
||||
* the value of some `initial_properties` is limited:
|
||||
* `static_save` is always set to `false`
|
||||
* `automatic_face_movement_max_rotation_per_sec` is always set to `360`
|
||||
* `automatic_face_movement_dir` is either `0` or any number specified in the declaration
|
||||
* if the builtin functions `on_activate` and `on_step` are present, they'll be run after the default behaviour (e.g. collisions check)
|
||||
* `speed`: (int) the speed of the bullet. Default is `30`
|
||||
* `lifetime`: (float) how much the bullet should last in case it doesn't disappear first. Default is `5`
|
||||
* `bounciness`: (float) whether and how much the bullet should bounce when hitting a surface. It goes from `0` (no bounce at all) to `1` (perfect elastic bounce). Default is `0`
|
||||
* `has_gravity`: (bool) whether the bullet is subject to gravity. Default is `false`
|
||||
* `weight`: (int) the weight of the bullet, in case `has_gravity` is `true`. Default is `80`
|
||||
* `friction`: (float) the amount of friction the bullet is subject to when sliding, from `0` (no friction at all) to `1`. It requires `has_gravity`. Default is `0.05`
|
||||
* `remove_on_contact`: (boolean) whether the bullet should cause an explosion when hitting something. It needs `explosion` -- TODO: perché deve esplodere per forza? `explode_on_contact`?
|
||||
* `explosion`: (table) TODO
|
||||
* `on_impact`: (function(shooter, bullet, coll)) TODO
|
||||
Bullets are a built-in entity with some extra parameters, like speed and lifetime.
|
||||
|
||||
* `entity`: (table) the luaentity representing the bullet
|
||||
* every field declared in the table will be maintained (i.e. `initial_properties`, custom fields) unless it's a weapons_lib special parameter (see next section below)
|
||||
* the value of some `initial_properties` is limited:
|
||||
* `static_save` is always set to `false`
|
||||
* `automatic_face_movement_max_rotation_per_sec` is always set to `360`
|
||||
* `automatic_face_movement_dir` is either `0` or any number specified in the declaration
|
||||
* if the builtin functions `on_activate` and `on_step` are present, they'll be run after the default behaviour (e.g. collisions check)
|
||||
* `speed`: (int) the speed of the bullet. Default is `30`
|
||||
* `lifetime`: (float) how much the bullet should last in case it doesn't disappear first. Default is `5`
|
||||
* `bounciness`: (float) whether and how much the bullet should bounce when hitting a surface. It goes from `0` (no bounce at all) to `1` (perfect elastic bounce). Default is `0`
|
||||
* `has_gravity`: (bool) whether the bullet is subject to gravity. Default is `false`
|
||||
* `weight`: (int) the weight of the bullet, in case `has_gravity` is `true`. Default is `80`
|
||||
* `friction`: (float) the amount of friction the bullet is subject to when sliding, from `0` (no friction at all) to `1`. It requires `has_gravity`. Default is `0.05`
|
||||
* `remove_on_contact`: (boolean) whether the bullet should cause an explosion when hitting something. It needs `explosion` -- TODO: perché deve esplodere per forza? `explode_on_contact`?
|
||||
* `explosion`: (table) TODO
|
||||
* `on_impact`: (function(shooter, bullet, coll)) TODO
|
||||
|
||||
##### 1.3.1.1.1 Builtin-in bullet entity parameters
|
||||
After the registration, weapons_lib will assign some special parameters to the entity (so don't use these names, as they will be overridden). This allows the mod to run all the operations it needs, but also modders to know more about the entity:
|
||||
* `_p_name`: (string) the name of the shooter
|
||||
* `_action`: (table) the action the entity belongs to
|
||||
* `_w_name`: (string) the technical name of the weapon it belongs to
|
||||
* `_is_bullet`: (boolean) always `true`
|
||||
* `_is_sliding`: (boolean) used for gravity checks
|
||||
|
||||
|
||||
### 1.3.2 Metadata
|
||||
Weapons communicate their state through players metadata:
|
||||
|
Loading…
x
Reference in New Issue
Block a user