with this program. If not, see <http://www.gnu.org/licenses/>.
#
package Games::Construder;
use JSON;
use common::sense;
use Time::HiRes qw/time/;
use Games::Construder::Logging;
require Exporter;
# show_region_sectors
my %sectors;
my $wg = JSON->new->relaxed->decode (_get_file ("res/world_gen.json"));
for my $type (keys %{$wg->{sector_types}}) {
ion_sector <sector type>
my ($type) = @arg;
my $wg = JSON->new->relaxed->decode (_get_file ("res/world_gen.json"));
my $s = $wg->{sector_types}->{$type};
my $r = $s
s, $entity, $type, $dt) = @_;
$entity->{rest_time} -= $dt;
#d# warn "ENTITIY MAT DONE: " . JSON->new->pretty->encode ($entity) . "\n";
return unless $entity->{rest_time} <= 0;
my $handl
pattern (@$POS, 0);
if ($a) {
ctr_log (devel => "construction pad pattern at @$POS: %s", JSON->new->encode ($a));
my $obj = $Games::Construder::Server::RES->get_object_by_pattern ($a);
tity->{fail_chance}) {
ctr_log (debug => "Jumper (failed) values: %s",
JSON->new->encode ($entity));
$pl->msg (1, "Jumper malfunction. Please retry.");
struder::Server;
use common::sense;
use AnyEvent;
use AnyEvent::Handle;
use AnyEvent::Socket;
use JSON;
use Games::Construder::Protocol;
use Games::Construder::Server::Resources;
use Games::Construde
construder"
: File::Spec->tmpdir . "/construder";
our $CLCONFIG = "construder_client.json";
sub new {
my $this = shift;
my $class = ref ($this) || $this;
my $self = { @_ };
sub load_config {
my ($self) = @_;
if (-e "$VARDIR/$CLCONFIG") {
$self->{config} = JSON->new->pretty->utf8->decode (_get_file ("$VARDIR/$CLCONFIG"));
} else {
$self->{config}
ambient_light => 0.2,
};
}
}
sub save_config {
my ($self) = @_;
my $cfg = JSON->new->pretty->utf8->encode ($self->{config} ||= {});
my $file = $VARDIR . "/" . $CLCONFIG;
see <http://www.gnu.org/licenses/>.
#
package Games::Construder::Protocol;
use common::sense;
use JSON;
require Exporter;
use POSIX qw/floor/;
our @ISA = qw/Exporter/;
our @EXPORT = qw/
packet2dat
Games::Construder::Protocol - Client-Server Protocol Utility Functions
=over 4
=cut
my $JS = JSON->new;
sub packet2data {
my ($header, $body) = @_;
my $hdr_data = $JS->encode ($header);
common::sense;
use SDL;
use SDL::Surface;
use SDL::Video;
use SDL::TTF;
use OpenGL qw(:all);
use JSON;
use Games::Construder::Vector;
use Games::Construder;
use File::ShareDir::PAR;
use Games::Constr
ntries} = [];
if ($gui_desc && $gui_desc->{layout}) {
$self->{layout} = decode_json (encode_json ($gui_desc->{layout}));
}
my $layout = $self->{layout};
$self->{active_elements
r;
use Time::HiRes qw/time/;
use Carp qw/confess/;
use Compress::LZF qw/decompress compress/;
use JSON;
use Storable qw/dclone/;
use Games::Construder::Logging;
require Exporter;
our @ISA = qw/Export
n bytes, but only got ".length ($data)."!");
return -1;
}
my $meta = eval { JSON->new->relaxed->utf8->decode ($metadata) };
if ($@) {
ctr_log (error => "map sector
->{tmp} = {}; # don't store entity temporary data (might contain objects)
}
my $meta_data = JSON->new->utf8->pretty->encode ($meta || {});
my $data = join "", @chunks;
my $filedata = comp
/licenses/>.
#
package Games::Construder::Server::Resources;
use common::sense;
use AnyEvent;
use JSON;
use Digest::MD5 qw/md5_base64/;
use Games::Construder::Server::Objects;
use File::ShareDir::PAR;
} =
JSON->new->relaxed->utf8->decode (my $f = _get_shared_file ("content.json"));
my $stypes = $self->{content}->{sector_types}
or die "No sector types defined in content.json!\n";
f
ry {
my ($self) = @_;
my $shpdb = $self->{txt_db}->{ship};
#d#print "TEXT TREE FROM: " . JSON->new->pretty->encode ($shpdb) . "\n";
my %nodes;
for (keys %$shpdb) {
my $con = del
/$self->{name}.json";
return unless -e "$file";
if (open my $plf, "<", $file) {
binmode $plf, ":raw";
my $cont = do { local $/; <$plf> };
my $data = eval { JSON->new->relaxed-
elf) = @_;
my $cont = JSON->new->pretty->utf8->encode ($self->{data});
my $pld = $Games::Construder::Server::Resources::PLAYERDIR;
my $file = "$pld/$self->{name}.json";
if (open my $plf,
::RES->get_assignment_for_score ($self->{data}->{score});
#print "ASSIGNMENT BASE VALUES: " . JSON->new->pretty->encode ([
# $desc, $size, $material_map, $distance, $time, $score
#]) . "\n
ave_config;
} elsif ($hdr->{cmd} eq 'transfer_end') {
$self->{front}->msg;
#print JSON->new->pretty->encode ($self->{front}->{res}->{resource});
$self->{res}->post_proc;
ct