Skip to content

Commit

Permalink
docs(agent): Documentation for agent component source files
Browse files Browse the repository at this point in the history
  • Loading branch information
jcowman2 committed Nov 11, 2018
1 parent f56d2b6 commit 455e94c
Show file tree
Hide file tree
Showing 8 changed files with 54 additions and 9 deletions.
12 changes: 10 additions & 2 deletions src/agents/func/recycle-instance-agents.ts
@@ -1,3 +1,11 @@
/**
* Contains the `recycleInstanceAgents` function, which generates
* a cleaned `InstanceAgents` for a new game cycle.
*
* Copyright (c) 2018 Joseph R Cowman
* Licensed under MIT License (see https://github.com/regal/regal)
*/

import { GameInstance } from "../../state";
import { AgentReference, isAgentReference } from "../agent-reference";
import { buildInstanceAgents } from "../impl";
Expand All @@ -8,8 +16,8 @@ import { StaticAgentRegistry } from "../static-agent-registry";
* Creates an `InstanceAgents` for the new game cycle, keeping only
* the final properties of every agent from before.
*
* @param oldAgents The `InstanceAgents` to recycle data from.
* @param newInstance The new `GameInstance` that will own this `InstanceAgents`.
* @param oldAgents The `InstanceAgents` to recycle data from.
* @param newInstance The new `GameInstance` that will own this `InstanceAgents`.
*/
export const recycleInstanceAgents = (
oldAgents: InstanceAgents,
Expand Down
7 changes: 7 additions & 0 deletions src/agents/impl/active-agent-proxy.ts
@@ -1,3 +1,10 @@
/**
* Contains constructors for active agent proxies.
*
* Copyright (c) 2018 Joseph R Cowman
* Licensed under MIT License (see https://github.com/regal/regal)
*/

import { GameInstance } from "../../state";
import { Agent } from "../agent";

Expand Down
7 changes: 7 additions & 0 deletions src/agents/impl/agent-manager-impl.ts
@@ -1,3 +1,10 @@
/**
* Contains the current implementation of `AgentManager`.
*
* Copyright (c) 2018 Joseph R Cowman
* Licensed under MIT License (see https://github.com/regal/regal)
*/

import { RegalError } from "../../error";
import { DEFAULT_EVENT_ID, EventRecord } from "../../events";
import { GameInstance } from "../../state";
Expand Down
7 changes: 7 additions & 0 deletions src/agents/impl/inactive-agent-proxy.ts
@@ -1,3 +1,10 @@
/**
* Contains the constructor for inactive agent proxies.
*
* Copyright (c) 2018 Joseph R Cowman
* Licensed under MIT License (see https://github.com/regal/regal)
*/

import { RegalError } from "../../error";
import { ContextManager } from "../../state";
import { Agent } from "../agent";
Expand Down
8 changes: 8 additions & 0 deletions src/agents/impl/index.ts
@@ -1,3 +1,11 @@
/**
* The purpose of this file is to abstract all agent-related implementations
* by re-exporting their constructors from a single file.
*
* Copyright (c) 2018 Joseph R Cowman
* Licensed under MIT License (see https://github.com/regal/regal)
*/

export {
buildActiveAgentProxy,
buildActiveAgentArrayProxy
Expand Down
7 changes: 7 additions & 0 deletions src/agents/impl/instance-agents-impl.ts
@@ -1,3 +1,10 @@
/**
* Contains implementation of `InstanceAgents`.
*
* Copyright (c) 2018 Joseph R Cowman
* Licensed under MIT License (see https://github.com/regal/regal)
*/

import { RegalError } from "../../error";
import { GameInstance } from "../../state";
import { isAgent } from "../agent";
Expand Down
2 changes: 1 addition & 1 deletion src/agents/index.ts
@@ -1,5 +1,5 @@
/**
* Component for controlling tracked game objects called Agents within the Regal Game Library.
* Component for controlling tracked game objects (called Agents) within the Regal Game Library.
*
* Copyright (c) 2018 Joseph R Cowman
* Licensed under MIT License (see https://github.com/regal/regal)
Expand Down
13 changes: 7 additions & 6 deletions src/agents/static-agent-registry.ts
Expand Up @@ -24,8 +24,9 @@ export class StaticAgentRegistry {
/**
* Returns whether the registry contains a static agent with the given id
* and that agent has the given property.
* @param id The agent's id.
* @param property The agent's property.
*
* @param id The agent's id.
* @param property The agent's property.
*/
public static hasAgentProperty(id: number, property: PropertyKey): boolean {
return this.hasAgent(id) && this[id].hasOwnProperty(property);
Expand All @@ -34,9 +35,9 @@ export class StaticAgentRegistry {
/**
* Gets a property of a static agent.
*
* @param agentId The agent's id.
* @param propertyKey The name of the property.
* @returns The value of the property.
* @param agentId The agent's id.
* @param propertyKey The name of the property.
* @returns The value of the property.
*/
public static getAgentProperty(id: number, property: PropertyKey): any {
if (!this.hasAgent(id)) {
Expand All @@ -56,7 +57,7 @@ export class StaticAgentRegistry {
/**
* Adds an agent to the registry. Will error if the agent's id doesn't
* equal the registry's next available id.
* @param agent The agent to be added.
* @param agent The agent to be added.
*/
public static addAgent(agent: Agent): void {
const id = agent.id;
Expand Down

0 comments on commit 455e94c

Please sign in to comment.