Skip to content

Latest commit

 

History

History
126 lines (58 loc) · 2.48 KB

File metadata and controls

126 lines (58 loc) · 2.48 KB

Home > server > BaseEntityController

BaseEntityController class

A base class for entity controller implementations.

Signature:

export default abstract class BaseEntityController extends EventRouter 

Extends: EventRouter

Remarks

The BaseEntityController should be extended by a more specific entity controller that you or a plugin implements. Entity controllers are intended to be used as one controller instance per entity, but are flexible enough for edge cases such as if you want to create niche behavior of one controller for many entities that behave in unison.

Events

This class is an EventRouter, and instances of it emit events with payloads listed under BaseEntityControllerEventPayloads

Methods

Method

Modifiers

Description

attach(entity)

Override this method to handle the attachment of an entity to your entity controller.

despawn(entity)

Override this method to handle the despawn of an entity from your entity controller.

detach(entity)

Override this method to handle the detachment of an entity from your entity controller.

spawn(entity)

Override this method to handle the spawning of an entity to your entity controller.

tick(entity, deltaTimeMs)

Override this method to handle entity movements based on your entity controller.

tickWithPlayerInput(entity, input, cameraOrientation, deltaTimeMs)

Override this method to handle entity movements based on player input for your entity controller. This is called every tick by a PlayerEntity with a entity controller.