Skip to content

Class: CALifeMonsterBrain

Offline ALife brain for monster server objects.

Source

C++ class CALifeMonsterBrain

Custom Constructor

CALifeMonsterBrain

Remarks

Belongs to an offline monster server object. Do not use it with client-side game_object instances.

Extended by

Constructors

Constructor

ts
new CALifeMonsterBrain(object: cse_alife_monster_abstract): CALifeMonsterBrain;

Create a brain for a monster server object.

Parameters

ParameterTypeDescription
objectcse_alife_monster_abstractMonster server object.

Returns

CALifeMonsterBrain

Methods

action_type()

ts
action_type(
   object: IXR_cse_alife_schedulable, 
   index: number, 
   mutual_detection: boolean): number;

Get the meet action type for another ALife object.

Parameters

ParameterTypeDescription
objectIXR_cse_alife_schedulableOther ALife schedulable object.
indexnumberRelation index.
mutual_detectionbooleanWhether both objects detected each other.

Returns

number

Meet action type id.


can_choose_alife_tasks()

Call Signature

ts
can_choose_alife_tasks(): boolean;
Returns

boolean

Whether this brain may choose ALife tasks.

Call Signature

ts
can_choose_alife_tasks(value: boolean): void;

Enable or disable ALife task selection.

Parameters
ParameterTypeDescription
valuebooleanNew task-selection state.
Returns

void


default_behaviour()

ts
default_behaviour(): void;

Reset the brain to default no-path behavior.

Returns

void


movement()

ts
movement(): CALifeMonsterMovementManager;

Returns

CALifeMonsterMovementManager

Offline movement manager.


object()

ts
object(): cse_alife_monster_abstract;

Returns

cse_alife_monster_abstract

Owning monster server object.


on_location_change()

ts
on_location_change(): void;

Called when the owning monster changes graph location.

Returns

void


on_register()

ts
on_register(): void;

Called when the owning monster is registered.

Returns

void

Remarks

Follows the owning server object's on_register lifecycle. It can run during savegame load or ALife update setup, so treat it as repeatable.


on_state_read()

ts
on_state_read(packet: net_packet): void;

Read brain state from a network packet.

Parameters

ParameterTypeDescription
packetnet_packetSource network packet.

Returns

void


on_state_write()

ts
on_state_write(packet: net_packet): void;

Write brain state to a network packet.

Parameters

ParameterTypeDescription
packetnet_packetTarget network packet.

Returns

void


on_switch_offline()

ts
on_switch_offline(): void;

Called when the owning monster switches offline.

Returns

void


on_switch_online()

ts
on_switch_online(): void;

Called when the owning monster switches online.

Returns

void


on_unregister()

ts
on_unregister(): void;

Called when the owning monster is unregistered.

Returns

void

Remarks

Pair cleanup here with state installed from on_register.


perform_attack()

ts
perform_attack(): boolean;

Try to perform an offline attack.

Returns

boolean

Whether an attack was performed.


process_task()

ts
process_task(): void;

Process the currently selected ALife task.

Returns

void


select_task()

ts
select_task(forced?: boolean): void;

Select the next ALife task.

Parameters

ParameterTypeDescription
forced?booleanWhether task selection should ignore regular throttling.

Returns

void


smart_terrain()

ts
smart_terrain(): cse_alife_smart_zone;

Returns

cse_alife_smart_zone

Smart terrain assigned to the owner.


update()

ts
update(forced?: boolean): void;

Update offline planning.

Parameters

ParameterTypeDescription
forced?booleanWhether the update should ignore regular throttling.

Returns

void


update_script()

ts
update_script(): void;

Script-facing update hook.

Returns

void