@@ -426,63 +426,65 @@ Give Initial Stuff API
426
426
^ Adds items to the list of items to be given
427
427
428
428
429
- Players API
430
- -----------
429
+ Player API
430
+ ----------
431
431
432
432
The player API can register player models and update the player's appearance.
433
433
434
434
* `player_api.register_model(name, def)`
435
435
* Register a new model to be used by players
436
- * name: model filename such as "character.x", "foo.b3d", etc.
437
- * def: See [#Model definition]
438
- * saved to player_api.registered_models
436
+ * ` name` : model filename such as "character.x", "foo.b3d", etc.
437
+ * ` def`: see [#Model definition]
438
+ * Saved to player_api.registered_models
439
439
440
- * `player_api.registered_player_models[name]`
441
- * Get a model's definition
442
- * see [#Model definition]
440
+ * `player_api.registered_models[name]`
441
+ * Get a model's definition
442
+ * `name`: model filename
443
+ * See [#Model definition]
443
444
444
445
* `player_api.set_model(player, model_name)`
445
446
* Change a player's model
446
447
* `player`: PlayerRef
447
448
* `model_name`: model registered with player_api.register_model()
448
449
449
- * `player_api.set_animation(player, anim_name [ , speed] )`
450
+ * `player_api.set_animation(player, anim_name, speed)`
450
451
* Applies an animation to a player
451
- * anim_name: name of the animation.
452
- * speed: frames per second. If nil, default from the model is used
452
+ * `player`: PlayerRef
453
+ * `anim_name`: name of the animation
454
+ * `speed`: frames per second. If nil, the default from the model def is used
453
455
454
456
* `player_api.set_textures(player, textures)`
455
457
* Sets player textures
456
458
* `player`: PlayerRef
457
- * `textures`: array of textures, If `textures` is nil the default
458
- textures from the model def are used
459
+ * `textures`: array of textures. If nil, the default from the model def is used
459
460
460
461
* `player_api.get_animation(player)`
461
- * Returns a table containing fields `model`, `textures` and `animation`.
462
- * Any of the fields of the returned table may be nil.
463
- * player: PlayerRef
462
+ * Returns a table containing fields `model`, `textures` and `animation`
463
+ * Any of the fields of the returned table may be nil
464
+ * ` player` : PlayerRef
464
465
465
466
* `player_api.player_attached`
466
- * A table that maps a player name to a boolean.
467
- * If the value for a given player is set to true, the default player
468
- animations (walking, digging, ...) will no longer be updated.
469
- Knockback from damage is also prevented for that player.
467
+ * A table that maps a player name to a boolean
468
+ * If the value for a given player is set to true, the default player animations
469
+ (walking, digging, ...) will no longer be updated, and knockback from damage is
470
+ prevented for that player
471
+ * Example of usage: A mod sets a player's value to true when attached to a vehicle
470
472
471
473
### Model Definition
472
474
473
475
{
474
- animation_speed = 30, -- Default animation speed, in FPS.
475
- textures = {"character.png", }, -- Default array of textures.
476
- visual_size = {x = 1, y = 1}, -- Used to scale the model.
476
+ animation_speed = 30, -- Default animation speed, in FPS
477
+ textures = {"character.png", }, -- Default array of textures
478
+ visual_size = {x = 1, y = 1}, -- Used to scale the model
477
479
animations = {
478
480
-- <anim_name> = {x = <start_frame>, y = <end_frame>},
479
481
foo = {x = 0, y = 19},
480
482
bar = {x = 20, y = 39},
481
483
-- ...
482
484
},
483
485
collisionbox = {-0.3, 0.0, -0.3, 0.3, 1.7, 0.3}, -- In nodes from feet position
484
- stepheight = 0.6, -- In nodes
485
- eye_height = 1.47, -- In nodes above feet position
486
+ stepheight = 0.6, -- In nodes
487
+ eye_height = 1.47, -- In nodes above feet position
486
488
}
487
489
488
490
0 commit comments