## utils.core module

This file contains core utilities used by the redmew scenario.

### Dependencies

utils.game
resources.color_presets

### Functions

Module.distance(pos1, pos2) | Measures distance between pos1 and pos2
Module.print_except(msg, player, color) | Takes msg and prints it to all players except provided player
Module.print_admins(msg, source) | Prints a message to all online admins
Module.get_actor() | Returns a valid string with the name of the actor of a command.
Module.format_time(ticks) | Takes a time in ticks and returns a string with the time in format "x hour(s) x minute(s)"
Module.cant_run(name) | Prints a message letting the player know they cannot run a command
Module.log_command(actor, command, parameters) | Logs the use of a command and its user
Module.verify_mult_types(arg, arg_types) | Asserts the argument is one of type arg_types
Module.random_RGB() | Returns a random RGB color as a table
Module.set_and_return(tbl, key, value) | Sets a table element to value while also returning value.

### Fields

Module.move_position | Moves a position according to the parameters given Notice: only accepts cardinal directions as direction
Module.opposite_direction | Takes a direction and gives you the opposite
Module.is_module_available | Takes the string of a module and returns whether is it available or not

### Dependencies

# utils.game
# resources.color_presets

### Functions

# Module.distance(pos1, pos2)

  Measures distance between pos1 and pos2

  Parameters:
  - pos1
  - pos2
# Module.print_except(msg, player, color)

  Takes msg and prints it to all players except provided player

  Parameters:
  - msg : table if locale is used
  - player : the player not to send the message to
  - color :

    the color to use for the message, defaults to white

# Module.print_admins(msg, source)

  Prints a message to all online admins

  Parameters:
  - msg : table if locale is used
  - source : string must be the name of a player, nil for server.
# Module.get_actor()

  Returns a valid string with the name of the actor of a command.

# Module.format_time(ticks)

  Takes a time in ticks and returns a string with the time in format "x hour(s) x minute(s)"

  Parameters:
  - ticks
# Module.cant_run(name)

  Prints a message letting the player know they cannot run a command

  Parameters:
  - name : string name of the command
# Module.log_command(actor, command, parameters)

  Logs the use of a command and its user

  Parameters:
  - actor : string with the actor's name (usually acquired by calling get_actor)
  - command : the command's name as table element
  - parameters : the command's parameters as a table (optional)
# Module.verify_mult_types(arg, arg_types)

  Asserts the argument is one of type arg_types

  Parameters:
  - arg : the variable to check
  - arg_types : the type as a table of sings
  Returns:
  - boolean
# Module.random_RGB()

  Returns a random RGB color as a table

# Module.set_and_return(tbl, key, value)

  Sets a table element to value while also returning value.

  Parameters:
  - tbl : table to change the element of
  - key : string
  - value : nil|boolean|number|string|table to set the element to
  Returns:
  - value

### Fields

# Module.move_position

  Moves a position according to the parameters given Notice: only accepts cardinal directions as direction

  - position :

    table containing a map position

  - direction : north, east, south, west
  - distance :
# Module.opposite_direction

  Takes a direction and gives you the opposite

  - direction : north, east, south, west, northeast, northwest, southeast, southwest
# Module.is_module_available

  Takes the string of a module and returns whether is it available or not

  - name : the name of the module (ex. 'utils.core')