BattleCity.Context (battle_city v0.1.3) View Source

Context

Link to this section Summary

Link to this section Types

Specs

callback_fn() :: (t() -> t())

Specs

object_struct() ::
  BattleCity.PowerUp.t() | BattleCity.Tank.t() | BattleCity.Bullet.t() | nil

Specs

t() :: %BattleCity.Context{
  __counters__: map(),
  __events__: [BattleCity.Event.t()],
  __global_callbacks__: [callback_fn()],
  __opts__: map(),
  bot_loop_interval: integer(),
  bullets: %{required(BattleCity.id()) => BattleCity.Bullet.t()},
  enable_bot: boolean(),
  level: BattleCity.level(),
  loop_interval: integer(),
  mock: boolean(),
  objects: %{
    required(BattleCity.Position.coordinate()) => %{
      required(Object.t()) => Object.value()
    }
  },
  power_ups: %{required(BattleCity.id()) => BattleCity.PowerUp.t()},
  rest_enemies: integer(),
  shovel?: boolean(),
  slug: term(),
  stage: BattleCity.Stage.t(),
  state: state(),
  tanks: %{required(BattleCity.id()) => BattleCity.Tank.t()},
  timeout_interval: integer()
}

Link to this section Functions

Link to this function

all_path_object(ctx, position)

View Source

Specs

all_path_object(t(), BattleCity.Position.t()) :: [
  {Object.kv(), BattleCity.Position.direction()}
]

Specs

bot_loop(t()) :: boolean()

Specs

bullet_grids(t()) :: [Html.t()]

Specs

camp?(Object.kv(), boolean()) :: boolean()

Specs

camp_direction?({Object.kv(), BattleCity.Position.direction()}, boolean()) ::
  boolean()
Link to this function

delete_object(ctx, key, id)

View Source

Specs

delete_object(t(), BattleCity.object_keys(), BattleCity.id()) :: t()
Link to this function

fetch_object(ctx, key, id)

View Source
Link to this function

fetch_object!(ctx, key, id)

View Source

Specs

grids(t()) :: [Html.t()]
Link to this function

handle_actions(ctx, o, list)

View Source

Specs

handle_actions(t(), object_struct(), [BattleCity.Callback.t()]) :: t()

Specs

handle_callbacks(t()) :: t()
Link to this function

handle_object(ctx, tank)

View Source

Specs

handle_object(t(), object_struct()) :: t()

Specs

initial_objects(t()) :: t()

Specs

map_grids(t()) :: [Html.t()]
Link to this function

non_empty_objects(context)

View Source
Link to this function

object_grids(ctx, types \\ nil)

View Source

Specs

object_grids(t(), nil | [BattleCity.short_type()]) :: [Html.t()]
Link to this function

path_object(context, position, direction \\ nil)

View Source

Specs

Link to this function

put_changed_object(ctx, o)

View Source

Specs

put_changed_object(t(), object_struct()) :: t()

Specs

put_object({t(), object_struct()}) :: t()

Specs

put_object(t(), object_struct() | [object_struct()]) :: t()

Specs

tank_grids(t()) :: [Html.t()]
Link to this function

update_object_raw(ctx, key, id, f)

View Source

Specs

update_object_raw(
  t(),
  BattleCity.object_keys(),
  BattleCity.id(),
  update_raw_fun()
) :: t()
Link to this function

update_object_raw!(ctx, key, id, f)

View Source

Specs

update_object_raw!(
  t(),
  BattleCity.object_keys(),
  BattleCity.id(),
  update_raw_fun()
) :: t()