Skip to content
EvilEngine.Api.Agents

IAgent interface

public interface IAgent

A body a brain thinks for: what it is, where it is and where it’s going. Distances are metres, angles degrees, times seconds. A goal, facing or command that isn’t finite throws ArgumentOutOfRangeException, and so do a move’s distance or speed below 0 and buttons that aren’t AgentButtons; a move with no gait throws ArgumentException. Either drops the brain that asked, as any throw does.

Assembly
EvilEngine.Api
Commit
4ff877b1

Members

Record property

ContentId Record { get; }

The agent record the body attached, with its base and the engine’s evil:agent/default merged under it.

Class property

ContentId? Class { get; }

The NPC class the body spawned as, or null for any other body.

Hull property

ContentId? Hull { get; }

The hull record its navigation and its body’s size come from, or null when the record names none.

Time property

double Time { get; }

The session’s time now.

Interval property

double Interval { get; }

How often it thinks.

Alive property

bool Alive { get; }

Whether the body is alive. A body that dies lets go of its agent.

Health property

int Health { get; }

The body’s health.

Feet property

MapVector Feet { get; }

Where the body’s feet are.

Velocity property

MapVector Velocity { get; }

How fast the body is moving.

OnGround property

bool OnGround { get; }

Whether the body stands on the ground.

Yaw property

double Yaw { get; }

Which way the body faces, turning towards where it moves or was asked to face at the record’s turn rate.

Motion property

AgentMotion Motion { get; }

How its last MoveTo is going, as an AgentMotion.

Goal property

MapVector? Goal { get; }

Where it’s going, or null when it was never sent or was stopped.

Gait property

string Gait { get; }

The gait its body plays: the move’s while it’s moving, idle otherwise.

Route property

IReadOnlyList<MapVector> Route { get; }

The corners of its route still ahead.

MoveTo method

void MoveTo(MapVector goal, AgentMove? move = null)

Sends it to a point at the move’s gait: a route over the map’s navigation for its hull, followed every tick, slowing to arrive, turning, stepping round other bodies, and ending Arrived, Unreachable or Stuck. Sending it again replaces the goal.

Stop method

void Stop()

Stops where it is.

Face method

void Face(double? yaw)

Turns it to face a yaw, even while it moves, or back to facing where it moves with null.

Command method

void Command(AgentCommand? command)

Drives the body with a raw command every tick, as a player’s input does, while locomotion stands aside, or hands it back to locomotion with null.