<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">package include;

use strict;
use warnings;

use Exporter;
our @ISA = ("Exporter");
our @EXPORT = qw(
  &amp;new_pqueue &amp;debug &amp;debugga &amp;GAME &amp;CONFIG &amp;PC &amp;STOP &amp;args &amp;inform
);

use include::pqueue;
use include::config;

use Data::Dumper;

my $game;

# An interface to the pqueue.
sub new_pqueue {
  return include::pqueue-&gt;queueify;
}

# Data::Dumpers everything it gets to STDERR.
sub debug {
  print STDERR Dumper(@_);
}

# Debugs with complete code-deparsing.
sub debugga {
  $Data::Dumper::Deparse = 1;
  debug(@_);
  $Data::Dumper::Deparse = 0;
}

# Returns an interface to the master game object.
sub GAME {
  return $game;
}

# Returns an interface to the config system.
sub CONFIG {
  return $game-&gt;{Config}
}

# Returns an interface to the player.
sub PC {
  return $game-&gt;{Player};
}

$game = {};
GAME-&gt;{Config} = include::config-&gt;configurate;
# Every game has a player! Likewise an event DB.
GAME-&gt;{Player} = 42;  # *Somebody* will initialize this.
GAME-&gt;{Events} = {};

# The action flow needs to halt!
# TODO: namespace pollution... :(
sub STOP {
  return -1;
}

# Get the arguments from an action bit
sub args {
  my $self = shift;
  @{ $self-&gt;{Args} } = @_ if @_;
  return @{ $self-&gt;{Args} };
}

# Print status messages.
sub inform {
  my $msg = shift;
  return unless GAME-&gt;{UI}{Msg};
  GAME-&gt;{UI}{Msg}-&gt;msg($msg);
  GAME-&gt;{UI}{Msg}-&gt;draw;
}

42;
</pre></body></html>