diff --git a/js-src/components/game.tsx b/js-src/components/game.tsx
index aab50d3..360924e 100644
--- a/js-src/components/game.tsx
+++ b/js-src/components/game.tsx
@@ -42,6 +42,7 @@ export default function Game (props: GameProps): JSX.Element {
const [error, setError] = React.useState(null)
const [scrollLog, setScrollLog] = React.useState(null)
const [movingTo, setMovingTo] = React.useState(null)
+ const [remainingFrames, setRemainingFrames] = React.useState(null)
const logPresentationRef = React.useRef(null)
window.setTimeout(() => {
setWebsocket((websocket): WebSocket | null => {
@@ -66,7 +67,7 @@ export default function Game (props: GameProps): JSX.Element {
const inputPackets = new InputPackets(setTeamPJs,
setCurrentLocation, setConnectedLocations,
logLines, setLogLines, setError, setScrollLog,
- logPresentationRef, setMovingTo)
+ logPresentationRef, setMovingTo, setRemainingFrames)
webSocket.onmessage = (event) => {
const packet = JSON.parse(event.data)
inputPackets.handle(packet)
@@ -91,7 +92,8 @@ export default function Game (props: GameProps): JSX.Element {
logLines={logLines}
websocket={websocket}
logPresentationRef={logPresentationRef}
- movingTo={movingTo}/>
+ movingTo={movingTo}
+ remainingFrames={remainingFrames}/>
>
)
diff --git a/js-src/components/upper-panel.tsx b/js-src/components/upper-panel.tsx
index d19b3d3..8136786 100644
--- a/js-src/components/upper-panel.tsx
+++ b/js-src/components/upper-panel.tsx
@@ -16,6 +16,7 @@ interface UpperPanelProps {
websocket: WebSocket | null
logPresentationRef: React.RefObject
movingTo: Location | null
+ remainingFrames: number | null
}
export default function UpperPanel (props: UpperPanelProps): JSX.Element {
@@ -64,6 +65,7 @@ export default function UpperPanel (props: UpperPanelProps): JSX.Element {
>
)
}
+
function showLocationMenuHeaderText (): JSX.Element {
if (currentLocation === null) {
return <>>
@@ -80,6 +82,18 @@ export default function UpperPanel (props: UpperPanelProps): JSX.Element {
}
+ function showRemainingFrames (): JSX.Element {
+ if (props.movingTo === null) {
+ return <>>
+ }
+ if (props.remainingFrames === null) {
+ return <>>
+ }
+ return (
+ Te quedan {props.remainingFrames} frames para terminar la acción.
+ )
+ }
+
return (
@@ -96,6 +110,9 @@ export default function UpperPanel (props: UpperPanelProps): JSX.Element {
{
showLocationMenuHeaderText()
}
+ {
+ showRemainingFrames()
+ }
{
availableLocationsToMove()
}
diff --git a/js-src/input-packets.ts b/js-src/input-packets.ts
index 7381bc5..0b89121 100644
--- a/js-src/input-packets.ts
+++ b/js-src/input-packets.ts
@@ -16,6 +16,7 @@ type SetScrollLogCallback = (set: number | null) => number | null
type SetScrollLog = (set: number | null | SetScrollLogCallback) => void
type LogPresentationRef = React.RefObject
type SetMovingTo = (set: Location | null) => void
+type SetRemainingFrames = (set: number | null) => void
interface Packet {
command: string
@@ -35,6 +36,7 @@ export default class InputPackets {
setScrollLog: SetScrollLog
logPresentationRef: LogPresentationRef
setMovingTo: SetMovingTo
+ setRemainingFrames: SetRemainingFrames
constructor (setTeamPJs: SetTeamPJs,
setCurrentLocation: SetCurrentLocation,
setConnectedLocations: SetConnectedLocations,
@@ -43,7 +45,8 @@ export default class InputPackets {
setError: SetError,
setScrollLog: SetScrollLog,
logPresentationRef: LogPresentationRef,
- setMovingTo: SetMovingTo) {
+ setMovingTo: SetMovingTo,
+ setRemainingFrames: SetRemainingFrames) {
this.setTeamPJs = setTeamPJs
this.setCurrentLocation = setCurrentLocation
this.setConnectedLocations = setConnectedLocations
@@ -53,6 +56,7 @@ export default class InputPackets {
this.setScrollLog = setScrollLog
this.logPresentationRef = logPresentationRef
this.setMovingTo = setMovingTo
+ this.setRemainingFrames = setRemainingFrames
}
handle (packet: Packet): void {
@@ -121,6 +125,9 @@ export default class InputPackets {
this.setMovingTo(null)
}
}
+ if (data.remaining_frames !== undefined) {
+ this.setRemainingFrames(data.remaining_frames)
+ }
if (data.set_log !== undefined) {
saveScroll()
this.setLogLines(data.set_log)
diff --git a/lib/LasTres/Controller/Websocket/InputPacket/Init.pm b/lib/LasTres/Controller/Websocket/InputPacket/Init.pm
index 849160d..e0c6a69 100644
--- a/lib/LasTres/Controller/Websocket/InputPacket/Init.pm
+++ b/lib/LasTres/Controller/Websocket/InputPacket/Init.pm
@@ -129,6 +129,16 @@ sub _on_redis_event ( $self, $ws, $session, $message, $topic, $topics ) {
$info_packet_to_send->send($ws);
return;
}
+ if ($data->{command} eq 'show-frame') {
+ my $current_frame = $pj->team->action_frame;
+ if ($pj->team->is_moving) {
+ my $last_frame = $pj->team->location->parent->frames_to_move;
+ LasTres::Controller::Websocket::OutputPacket::Info->new(
+ remaining_frames => $last_frame - $current_frame
+ )->send($ws);
+ }
+ return;
+ }
}
sub _get_connected_places ( $self, $pj ) {
diff --git a/lib/LasTres/Controller/Websocket/OutputPacket/Info.pm b/lib/LasTres/Controller/Websocket/OutputPacket/Info.pm
index 0e2638d..9c4f343 100644
--- a/lib/LasTres/Controller/Websocket/OutputPacket/Info.pm
+++ b/lib/LasTres/Controller/Websocket/OutputPacket/Info.pm
@@ -22,16 +22,19 @@ has location_data => ( is => 'rw', );
has set_log => ( is => 'rw', );
has append_log => ( is => 'rw' );
+has remaining_frames => ( is => 'rw' );
+
sub identifier {
return 'info';
}
sub data ($self) {
- my $clear = $self->clear;
- my $team_pjs = $self->team_pjs;
- my $location_data = $self->location_data;
- my $set_log = $self->set_log;
- my $append_log = $self->append_log;
+ my $clear = $self->clear;
+ my $team_pjs = $self->team_pjs;
+ my $location_data = $self->location_data;
+ my $set_log = $self->set_log;
+ my $append_log = $self->append_log;
+ my $remaining_frames = $self->remaining_frames;
return {
(
( defined $clear ) ? ( clear => $clear )
@@ -50,8 +53,12 @@ sub data ($self) {
: ()
),
(
- ( defined $append_log )
- ? ( append_log => $append_log )
+ ( defined $append_log ) ? ( append_log => $append_log )
+ : ()
+ ),
+ (
+ ( defined $remaining_frames )
+ ? ( remaining_frames => $remaining_frames )
: ()
)
};
diff --git a/lib/LasTres/EventLoop.pm b/lib/LasTres/EventLoop.pm
index 3ae187e..3e5bdec 100644
--- a/lib/LasTres/EventLoop.pm
+++ b/lib/LasTres/EventLoop.pm
@@ -10,17 +10,11 @@ use feature 'signatures';
use Moo;
use JSON qw/to_json from_json/;
-has _app => (
- is => 'lazy'
-);
+has _app => ( is => 'lazy' );
-has _schema => (
- is => 'lazy'
-);
+has _schema => ( is => 'lazy' );
-has _redis => (
- is => 'lazy'
-);
+has _redis => ( is => 'lazy' );
sub _build__app {
require LasTres;
@@ -42,56 +36,59 @@ sub _exit_the_program {
}
$SIG{CHLD} = 'IGNORE';
-$SIG{INT} = \&_exit_the_program;
+$SIG{INT} = \&_exit_the_program;
$SIG{QUIT} = \&_exit_the_program;
$SIG{TERM} = \&_exit_the_program;
-sub loop($self) {
+sub loop ($self) {
my $child_pid = fork;
- if (!$child_pid) {
+ if ( !$child_pid ) {
$self->_real_loop;
}
}
-sub _work_frame($self) {
+sub _work_frame ($self) {
$self->_increment_frame_for_movers();
}
-sub _increment_frame_for_movers($self) {
- my $schema = $self->_schema;
+sub _increment_frame_for_movers ($self) {
+ my $schema = $self->_schema;
my $result_set_teams = $schema->resultset('Team');
- my @teams = $result_set_teams->search({-bool => 'is_moving'});
+ my @teams = $result_set_teams->search( { -bool => 'is_moving' } );
for my $team (@teams) {
$self->_increment_frame_for_mover($team);
}
}
-sub _increment_frame_for_mover($self, $team) {
+sub _increment_frame_for_mover ( $self, $team ) {
$team = $team->get_from_storage;
my $frame = $team->action_frame;
- $team->action_frame(++$frame);
+ $team->action_frame( ++$frame );
$team->update;
my $location = $team->location;
- my $target_location = LasTres::Location::get(from_json($team->moving_to)->@*);
- if ($frame >= $location->parent->frames_to_move) {
+ my $target_location =
+ LasTres::Location::get( from_json( $team->moving_to )->@* );
+ if ( $frame >= $location->parent->frames_to_move ) {
$team->action_frame(0);
$team->is_moving(0);
$team->moving_to('null');
$team->update;
$target_location->place_team($team);
+ return;
}
+ $team->send_frame_to_members;
}
-sub _real_loop($self) {
+sub _real_loop ($self) {
eval {
my $redis = $self->_redis;
while (1) {
- if (!defined $redis->db->get($redis->executing_frame_key)) {
- $redis->db->setex($redis->executing_frame_key, 10, 1);
+ if ( !defined $redis->db->get( $redis->executing_frame_key ) ) {
+ $redis->db->setex( $redis->executing_frame_key, 10, 1 );
$self->_work_frame;
}
- my $ttl = $redis->db->ttl($redis->executing_frame_key);
- if ($ttl > 0) {
+ my $ttl = $redis->db->ttl( $redis->executing_frame_key );
+ if ( $ttl > 0 ) {
sleep $ttl;
}
}
diff --git a/lib/LasTres/Location.pm b/lib/LasTres/Location.pm
index 027110f..bd65820 100644
--- a/lib/LasTres/Location.pm
+++ b/lib/LasTres/Location.pm
@@ -91,6 +91,7 @@ sub move ( $self, $team ) {
}
my $schema;
$team->is_moving(1);
+ $team->action_frame(0);
$team->moving_to( $self->to_json_array );
$team->update;
$self->on_team_moving($team);
@@ -102,6 +103,7 @@ sub on_team_moving ( $self, $team ) {
for my $pj ( $team->members ) {
$self->on_pj_moving($pj);
}
+ $team->send_frame_to_members;
}
sub on_pj_moving ( $self, $pj ) {
diff --git a/lib/LasTres/Planet/Bahdder/BosqueDelHeroe/TribuDeLaLima.pm b/lib/LasTres/Planet/Bahdder/BosqueDelHeroe/TribuDeLaLima.pm
index 9202dff..6dbd154 100644
--- a/lib/LasTres/Planet/Bahdder/BosqueDelHeroe/TribuDeLaLima.pm
+++ b/lib/LasTres/Planet/Bahdder/BosqueDelHeroe/TribuDeLaLima.pm
@@ -27,7 +27,7 @@ sub get_auto_discover($self) {
}
sub frames_to_move {
- return 0;
+ return 3;
}
sub identifier {
diff --git a/lib/LasTres/Schema/Result/Team.pm b/lib/LasTres/Schema/Result/Team.pm
index e1ba547..14e3dc3 100644
--- a/lib/LasTres/Schema/Result/Team.pm
+++ b/lib/LasTres/Schema/Result/Team.pm
@@ -8,90 +8,102 @@ use warnings;
use parent 'DBIx::Class::Core';
use LasTres::Location;
+use JSON qw/to_json from_json/;
__PACKAGE__->table('teams');
__PACKAGE__->add_columns(
uuid => {
- data_type => 'uuid',
+ data_type => 'uuid',
is_nullable => 0,
},
is_exploring => {
- data_type => 'boolean',
+ data_type => 'boolean',
is_nullable => 0,
default_value => \'false',
},
action_frame => {
- data_type => 'integer',
+ data_type => 'integer',
is_nullable => 0,
default_value => \'0',
},
is_moving => {
- data_type => 'boolean',
- is_nullable => 0,
+ data_type => 'boolean',
+ is_nullable => 0,
default_value => \'false',
},
moving_to => {
- data_type => 'jsonb',
- is_nullable => 0,
+ data_type => 'jsonb',
+ is_nullable => 0,
default_value => \'\'null\'',
},
leader => {
- data_type => 'uuid',
- is_nullable => 1,
+ data_type => 'uuid',
+ is_nullable => 1,
is_foreign_key => 1,
},
name => {
- data_type => 'text',
+ data_type => 'text',
is_nullable => 0,
},
planet => {
- data_type => 'text',
+ data_type => 'text',
is_nullable => 0,
- accessor => '_planet',
+ accessor => '_planet',
},
super_area => {
- data_type => 'text',
+ data_type => 'text',
is_nullable => 0,
- accessor => '_super_area',
+ accessor => '_super_area',
},
area => {
- data_type => 'text',
+ data_type => 'text',
is_nullable => 0,
- accessor => '_area',
+ accessor => '_area',
},
location => {
- data_type => 'text',
+ data_type => 'text',
is_nullable => 0,
- accessor => '_location',
+ accessor => '_location',
},
);
# May throw error, it is needed to handle.
sub location {
- my $self = shift;
+ my $self = shift;
my $location = shift;
my $planet;
my $super_area;
my $area;
- if (defined $location) {
- $self->_location($location->identifier);
+ if ( defined $location ) {
+ $self->_location( $location->identifier );
$area = $location->parent;
- $self->_area($area->identifier);
+ $self->_area( $area->identifier );
$super_area = $area->parent;
- $self->_super_area($super_area->identifier);
+ $self->_super_area( $super_area->identifier );
$planet = $super_area->parent;
- $self->_planet($planet->identifier);
+ $self->_planet( $planet->identifier );
}
- $location = $self->_location;
- $area = $self->_area;
+ $location = $self->_location;
+ $area = $self->_area;
$super_area = $self->_super_area;
- $planet = $self->_planet;
- $location = LasTres::Location::get($planet, $super_area, $area, $location);
+ $planet = $self->_planet;
+ $location =
+ LasTres::Location::get( $planet, $super_area, $area, $location );
return $location;
}
+
+sub send_frame_to_members ($self) {
+ require LasTres::Redis;
+ my $redis = LasTres::Redis->new;
+ $self = $self->get_from_storage;
+ for my $pj ( $self->members ) {
+ $redis->publish( $redis->pj_subscription($pj),
+ to_json( { command => 'show-frame' } ) );
+ }
+}
__PACKAGE__->set_primary_key('uuid');
-__PACKAGE__->add_unique_constraint(u_name => ['name']);
-__PACKAGE__->has_many('members', 'LasTres::Schema::Result::PJ', 'team');
-__PACKAGE__->belongs_to('leader', 'LasTres::Schema::Result::PJ');
+__PACKAGE__->add_unique_constraint( u_name => ['name'] );
+__PACKAGE__->has_many( 'members', 'LasTres::Schema::Result::PJ', 'team' );
+__PACKAGE__->belongs_to( 'leader', 'LasTres::Schema::Result::PJ' );
1;
diff --git a/public/js/bundle.js b/public/js/bundle.js
index de3e59c..57218e7 100644
--- a/public/js/bundle.js
+++ b/public/js/bundle.js
@@ -96,7 +96,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpac
\************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
-eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (/* binding */ Game)\n/* harmony export */ });\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ \"./node_modules/react/index.js\");\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var _lastres_components_upper_panel__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @lastres/components/upper-panel */ \"./js-src/components/upper-panel.tsx\");\n/* harmony import */ var _lastres_components_bottom_panel__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @lastres/components/bottom-panel */ \"./js-src/components/bottom-panel.tsx\");\n/* harmony import */ var _lastres_components_pj_selection_menu__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @lastres/components/pj-selection-menu */ \"./js-src/components/pj-selection-menu.tsx\");\n/* harmony import */ var _lastres_output_packet_init__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @lastres/output-packet/init */ \"./js-src/output-packet/init.ts\");\n/* harmony import */ var _lastres_output_packet_ping__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @lastres/output-packet/ping */ \"./js-src/output-packet/ping.ts\");\n/* harmony import */ var _lastres_input_packets__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! @lastres/input-packets */ \"./js-src/input-packets.ts\");\n\n\n\n\n\n\n\nfunction Game(props) {\n const selectedPJ = props.selectedPJ;\n if (selectedPJ === null) {\n return (react__WEBPACK_IMPORTED_MODULE_0__.createElement(react__WEBPACK_IMPORTED_MODULE_0__.Fragment, null,\n react__WEBPACK_IMPORTED_MODULE_0__.createElement(_lastres_components_pj_selection_menu__WEBPACK_IMPORTED_MODULE_3__[\"default\"], { setSelectedPJ: props.setSelectedPJ, userWantsToCreatePJ: props.userWantsToCreatePJ, setUserWantsToCreatePJ: props.setUserWantsToCreatePJ, error: props.error, setError: props.setError })));\n }\n const [websocket, setWebsocket] = react__WEBPACK_IMPORTED_MODULE_0__.useState(null);\n const [teamPJs, setTeamPJs] = react__WEBPACK_IMPORTED_MODULE_0__.useState(null);\n const [currentLocation, setCurrentLocation] = react__WEBPACK_IMPORTED_MODULE_0__.useState(null);\n const [connectedLocations, setConnectedLocations] = react__WEBPACK_IMPORTED_MODULE_0__.useState(null);\n const [logLines, setLogLines] = react__WEBPACK_IMPORTED_MODULE_0__.useState(null);\n const [error, setError] = react__WEBPACK_IMPORTED_MODULE_0__.useState(null);\n const [scrollLog, setScrollLog] = react__WEBPACK_IMPORTED_MODULE_0__.useState(null);\n const [movingTo, setMovingTo] = react__WEBPACK_IMPORTED_MODULE_0__.useState(null);\n const logPresentationRef = react__WEBPACK_IMPORTED_MODULE_0__.useRef(null);\n window.setTimeout(() => {\n setWebsocket((websocket) => {\n if (websocket === null) {\n const locationProtocol = window.location.protocol;\n if (locationProtocol == null) {\n return null;\n }\n const protocol = locationProtocol.match(/https:/) != null ? 'wss' : 'ws';\n const webSocket = new WebSocket(`${protocol}://${window.location.host}/ws`);\n webSocket.onopen = () => {\n new _lastres_output_packet_init__WEBPACK_IMPORTED_MODULE_4__[\"default\"](selectedPJ.uuid).send(webSocket);\n let interval = 0;\n interval = window.setInterval(() => {\n if (webSocket.readyState === WebSocket.OPEN) {\n new _lastres_output_packet_ping__WEBPACK_IMPORTED_MODULE_5__[\"default\"]().send(webSocket);\n return;\n }\n window.clearInterval(interval);\n }, 250000);\n };\n const inputPackets = new _lastres_input_packets__WEBPACK_IMPORTED_MODULE_6__[\"default\"](setTeamPJs, setCurrentLocation, setConnectedLocations, logLines, setLogLines, setError, setScrollLog, logPresentationRef, setMovingTo);\n webSocket.onmessage = (event) => {\n const packet = JSON.parse(event.data);\n inputPackets.handle(packet);\n };\n webSocket.onerror = (event) => {\n console.log(event);\n };\n webSocket.onclose = (event) => {\n console.log('Websocket closed');\n setWebsocket(null);\n };\n return webSocket;\n }\n return websocket;\n });\n }, 100);\n return (react__WEBPACK_IMPORTED_MODULE_0__.createElement(react__WEBPACK_IMPORTED_MODULE_0__.Fragment, null,\n react__WEBPACK_IMPORTED_MODULE_0__.createElement(_lastres_components_upper_panel__WEBPACK_IMPORTED_MODULE_1__[\"default\"], { teamPJs: teamPJs, currentLocation: currentLocation, connectedLocations: connectedLocations, logLines: logLines, websocket: websocket, logPresentationRef: logPresentationRef, movingTo: movingTo }),\n react__WEBPACK_IMPORTED_MODULE_0__.createElement(_lastres_components_bottom_panel__WEBPACK_IMPORTED_MODULE_2__[\"default\"], null)));\n}\n\n\n//# sourceURL=webpack://LasTres/./js-src/components/game.tsx?");
+eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (/* binding */ Game)\n/* harmony export */ });\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ \"./node_modules/react/index.js\");\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var _lastres_components_upper_panel__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @lastres/components/upper-panel */ \"./js-src/components/upper-panel.tsx\");\n/* harmony import */ var _lastres_components_bottom_panel__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @lastres/components/bottom-panel */ \"./js-src/components/bottom-panel.tsx\");\n/* harmony import */ var _lastres_components_pj_selection_menu__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @lastres/components/pj-selection-menu */ \"./js-src/components/pj-selection-menu.tsx\");\n/* harmony import */ var _lastres_output_packet_init__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @lastres/output-packet/init */ \"./js-src/output-packet/init.ts\");\n/* harmony import */ var _lastres_output_packet_ping__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @lastres/output-packet/ping */ \"./js-src/output-packet/ping.ts\");\n/* harmony import */ var _lastres_input_packets__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! @lastres/input-packets */ \"./js-src/input-packets.ts\");\n\n\n\n\n\n\n\nfunction Game(props) {\n const selectedPJ = props.selectedPJ;\n if (selectedPJ === null) {\n return (react__WEBPACK_IMPORTED_MODULE_0__.createElement(react__WEBPACK_IMPORTED_MODULE_0__.Fragment, null,\n react__WEBPACK_IMPORTED_MODULE_0__.createElement(_lastres_components_pj_selection_menu__WEBPACK_IMPORTED_MODULE_3__[\"default\"], { setSelectedPJ: props.setSelectedPJ, userWantsToCreatePJ: props.userWantsToCreatePJ, setUserWantsToCreatePJ: props.setUserWantsToCreatePJ, error: props.error, setError: props.setError })));\n }\n const [websocket, setWebsocket] = react__WEBPACK_IMPORTED_MODULE_0__.useState(null);\n const [teamPJs, setTeamPJs] = react__WEBPACK_IMPORTED_MODULE_0__.useState(null);\n const [currentLocation, setCurrentLocation] = react__WEBPACK_IMPORTED_MODULE_0__.useState(null);\n const [connectedLocations, setConnectedLocations] = react__WEBPACK_IMPORTED_MODULE_0__.useState(null);\n const [logLines, setLogLines] = react__WEBPACK_IMPORTED_MODULE_0__.useState(null);\n const [error, setError] = react__WEBPACK_IMPORTED_MODULE_0__.useState(null);\n const [scrollLog, setScrollLog] = react__WEBPACK_IMPORTED_MODULE_0__.useState(null);\n const [movingTo, setMovingTo] = react__WEBPACK_IMPORTED_MODULE_0__.useState(null);\n const [remainingFrames, setRemainingFrames] = react__WEBPACK_IMPORTED_MODULE_0__.useState(null);\n const logPresentationRef = react__WEBPACK_IMPORTED_MODULE_0__.useRef(null);\n window.setTimeout(() => {\n setWebsocket((websocket) => {\n if (websocket === null) {\n const locationProtocol = window.location.protocol;\n if (locationProtocol == null) {\n return null;\n }\n const protocol = locationProtocol.match(/https:/) != null ? 'wss' : 'ws';\n const webSocket = new WebSocket(`${protocol}://${window.location.host}/ws`);\n webSocket.onopen = () => {\n new _lastres_output_packet_init__WEBPACK_IMPORTED_MODULE_4__[\"default\"](selectedPJ.uuid).send(webSocket);\n let interval = 0;\n interval = window.setInterval(() => {\n if (webSocket.readyState === WebSocket.OPEN) {\n new _lastres_output_packet_ping__WEBPACK_IMPORTED_MODULE_5__[\"default\"]().send(webSocket);\n return;\n }\n window.clearInterval(interval);\n }, 250000);\n };\n const inputPackets = new _lastres_input_packets__WEBPACK_IMPORTED_MODULE_6__[\"default\"](setTeamPJs, setCurrentLocation, setConnectedLocations, logLines, setLogLines, setError, setScrollLog, logPresentationRef, setMovingTo, setRemainingFrames);\n webSocket.onmessage = (event) => {\n const packet = JSON.parse(event.data);\n inputPackets.handle(packet);\n };\n webSocket.onerror = (event) => {\n console.log(event);\n };\n webSocket.onclose = (event) => {\n console.log('Websocket closed');\n setWebsocket(null);\n };\n return webSocket;\n }\n return websocket;\n });\n }, 100);\n return (react__WEBPACK_IMPORTED_MODULE_0__.createElement(react__WEBPACK_IMPORTED_MODULE_0__.Fragment, null,\n react__WEBPACK_IMPORTED_MODULE_0__.createElement(_lastres_components_upper_panel__WEBPACK_IMPORTED_MODULE_1__[\"default\"], { teamPJs: teamPJs, currentLocation: currentLocation, connectedLocations: connectedLocations, logLines: logLines, websocket: websocket, logPresentationRef: logPresentationRef, movingTo: movingTo, remainingFrames: remainingFrames }),\n react__WEBPACK_IMPORTED_MODULE_0__.createElement(_lastres_components_bottom_panel__WEBPACK_IMPORTED_MODULE_2__[\"default\"], null)));\n}\n\n\n//# sourceURL=webpack://LasTres/./js-src/components/game.tsx?");
/***/ }),
@@ -216,7 +216,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpac
\*******************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
-eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (/* binding */ UpperPanel)\n/* harmony export */ });\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ \"./node_modules/react/index.js\");\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var _lastres_components_pj_list_item__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @lastres/components/pj-list-item */ \"./js-src/components/pj-list-item.tsx\");\n/* harmony import */ var _lastres_components_presentation_item__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @lastres/components/presentation-item */ \"./js-src/components/presentation-item.tsx\");\n/* harmony import */ var _lastres_components_presentation__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @lastres/components/presentation */ \"./js-src/components/presentation.tsx\");\n/* harmony import */ var _lastres_components_log_panel__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @lastres/components/log-panel */ \"./js-src/components/log-panel.tsx\");\n/* harmony import */ var _lastres_output_packet_move_to__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @lastres/output-packet/move-to */ \"./js-src/output-packet/move-to.ts\");\n\n\n\n\n\n\nfunction UpperPanel(props) {\n const connectedLocations = props.connectedLocations;\n const teamPJs = props.teamPJs;\n const currentLocation = props.currentLocation;\n const logLines = props.logLines;\n const websocket = props.websocket;\n const logPresentationRef = props.logPresentationRef;\n if (!(teamPJs !== null && currentLocation !== null && connectedLocations !== null)) {\n return (react__WEBPACK_IMPORTED_MODULE_0__.createElement(react__WEBPACK_IMPORTED_MODULE_0__.Fragment, null,\n react__WEBPACK_IMPORTED_MODULE_0__.createElement(\"p\", null, \"Esperando datos...\")));\n }\n function onClickLocation(item) {\n const moveToPacket = new _lastres_output_packet_move_to__WEBPACK_IMPORTED_MODULE_5__[\"default\"](item);\n if (websocket !== null) {\n moveToPacket.send(websocket);\n }\n }\n function availableLocationsToMove() {\n if (connectedLocations === null || connectedLocations.length === 0) {\n return (react__WEBPACK_IMPORTED_MODULE_0__.createElement(react__WEBPACK_IMPORTED_MODULE_0__.Fragment, null));\n }\n return (react__WEBPACK_IMPORTED_MODULE_0__.createElement(react__WEBPACK_IMPORTED_MODULE_0__.Fragment, null,\n react__WEBPACK_IMPORTED_MODULE_0__.createElement(\"p\", null, \"Puedes ir a:\"),\n react__WEBPACK_IMPORTED_MODULE_0__.createElement(\"ul\", null, connectedLocations.map((item, i) => {\n return react__WEBPACK_IMPORTED_MODULE_0__.createElement(\"li\", { key: i },\n react__WEBPACK_IMPORTED_MODULE_0__.createElement(\"a\", { href: \"#\", onClick: () => {\n onClickLocation(item);\n } },\n item.area.name,\n \"/\",\n item.location.name));\n }))));\n }\n function showLocationMenuHeaderText() {\n if (currentLocation === null) {\n return react__WEBPACK_IMPORTED_MODULE_0__.createElement(react__WEBPACK_IMPORTED_MODULE_0__.Fragment, null);\n }\n if (props.movingTo === null) {\n return react__WEBPACK_IMPORTED_MODULE_0__.createElement(\"p\", null,\n \"Est\\u00E1s en \",\n react__WEBPACK_IMPORTED_MODULE_0__.createElement(\"span\", { style: { color: 'red' } }, currentLocation.area.name),\n \"/\",\n react__WEBPACK_IMPORTED_MODULE_0__.createElement(\"span\", { style: { color: 'green' } }, currentLocation.location.name),\n \".\");\n }\n return react__WEBPACK_IMPORTED_MODULE_0__.createElement(\"p\", null,\n \"Est\\u00E1s yendo a \",\n react__WEBPACK_IMPORTED_MODULE_0__.createElement(\"span\", { style: { color: 'red' } }, props.movingTo.area.name),\n \"/\",\n react__WEBPACK_IMPORTED_MODULE_0__.createElement(\"span\", { style: { color: 'green' } }, props.movingTo.location.name),\n \".\");\n }\n return (react__WEBPACK_IMPORTED_MODULE_0__.createElement(_lastres_components_presentation__WEBPACK_IMPORTED_MODULE_3__[\"default\"], null,\n react__WEBPACK_IMPORTED_MODULE_0__.createElement(_lastres_components_presentation_item__WEBPACK_IMPORTED_MODULE_2__[\"default\"], null, teamPJs.map((item, i) => {\n return react__WEBPACK_IMPORTED_MODULE_0__.createElement(_lastres_components_pj_list_item__WEBPACK_IMPORTED_MODULE_1__[\"default\"], { key: i, pj: item });\n })),\n react__WEBPACK_IMPORTED_MODULE_0__.createElement(_lastres_components_presentation_item__WEBPACK_IMPORTED_MODULE_2__[\"default\"], { presentationItemRef: logPresentationRef },\n react__WEBPACK_IMPORTED_MODULE_0__.createElement(_lastres_components_log_panel__WEBPACK_IMPORTED_MODULE_4__[\"default\"], { logLines: logLines })),\n react__WEBPACK_IMPORTED_MODULE_0__.createElement(_lastres_components_presentation_item__WEBPACK_IMPORTED_MODULE_2__[\"default\"], null,\n showLocationMenuHeaderText(),\n availableLocationsToMove())));\n}\n\n\n//# sourceURL=webpack://LasTres/./js-src/components/upper-panel.tsx?");
+eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (/* binding */ UpperPanel)\n/* harmony export */ });\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ \"./node_modules/react/index.js\");\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var _lastres_components_pj_list_item__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @lastres/components/pj-list-item */ \"./js-src/components/pj-list-item.tsx\");\n/* harmony import */ var _lastres_components_presentation_item__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @lastres/components/presentation-item */ \"./js-src/components/presentation-item.tsx\");\n/* harmony import */ var _lastres_components_presentation__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @lastres/components/presentation */ \"./js-src/components/presentation.tsx\");\n/* harmony import */ var _lastres_components_log_panel__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @lastres/components/log-panel */ \"./js-src/components/log-panel.tsx\");\n/* harmony import */ var _lastres_output_packet_move_to__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @lastres/output-packet/move-to */ \"./js-src/output-packet/move-to.ts\");\n\n\n\n\n\n\nfunction UpperPanel(props) {\n const connectedLocations = props.connectedLocations;\n const teamPJs = props.teamPJs;\n const currentLocation = props.currentLocation;\n const logLines = props.logLines;\n const websocket = props.websocket;\n const logPresentationRef = props.logPresentationRef;\n if (!(teamPJs !== null && currentLocation !== null && connectedLocations !== null)) {\n return (react__WEBPACK_IMPORTED_MODULE_0__.createElement(react__WEBPACK_IMPORTED_MODULE_0__.Fragment, null,\n react__WEBPACK_IMPORTED_MODULE_0__.createElement(\"p\", null, \"Esperando datos...\")));\n }\n function onClickLocation(item) {\n const moveToPacket = new _lastres_output_packet_move_to__WEBPACK_IMPORTED_MODULE_5__[\"default\"](item);\n if (websocket !== null) {\n moveToPacket.send(websocket);\n }\n }\n function availableLocationsToMove() {\n if (connectedLocations === null || connectedLocations.length === 0) {\n return (react__WEBPACK_IMPORTED_MODULE_0__.createElement(react__WEBPACK_IMPORTED_MODULE_0__.Fragment, null));\n }\n return (react__WEBPACK_IMPORTED_MODULE_0__.createElement(react__WEBPACK_IMPORTED_MODULE_0__.Fragment, null,\n react__WEBPACK_IMPORTED_MODULE_0__.createElement(\"p\", null, \"Puedes ir a:\"),\n react__WEBPACK_IMPORTED_MODULE_0__.createElement(\"ul\", null, connectedLocations.map((item, i) => {\n return react__WEBPACK_IMPORTED_MODULE_0__.createElement(\"li\", { key: i },\n react__WEBPACK_IMPORTED_MODULE_0__.createElement(\"a\", { href: \"#\", onClick: () => {\n onClickLocation(item);\n } },\n item.area.name,\n \"/\",\n item.location.name));\n }))));\n }\n function showLocationMenuHeaderText() {\n if (currentLocation === null) {\n return react__WEBPACK_IMPORTED_MODULE_0__.createElement(react__WEBPACK_IMPORTED_MODULE_0__.Fragment, null);\n }\n if (props.movingTo === null) {\n return react__WEBPACK_IMPORTED_MODULE_0__.createElement(\"p\", null,\n \"Est\\u00E1s en \",\n react__WEBPACK_IMPORTED_MODULE_0__.createElement(\"span\", { style: { color: 'red' } }, currentLocation.area.name),\n \"/\",\n react__WEBPACK_IMPORTED_MODULE_0__.createElement(\"span\", { style: { color: 'green' } }, currentLocation.location.name),\n \".\");\n }\n return react__WEBPACK_IMPORTED_MODULE_0__.createElement(\"p\", null,\n \"Est\\u00E1s yendo a \",\n react__WEBPACK_IMPORTED_MODULE_0__.createElement(\"span\", { style: { color: 'red' } }, props.movingTo.area.name),\n \"/\",\n react__WEBPACK_IMPORTED_MODULE_0__.createElement(\"span\", { style: { color: 'green' } }, props.movingTo.location.name),\n \".\");\n }\n function showRemainingFrames() {\n if (props.movingTo === null) {\n return react__WEBPACK_IMPORTED_MODULE_0__.createElement(react__WEBPACK_IMPORTED_MODULE_0__.Fragment, null);\n }\n if (props.remainingFrames === null) {\n return react__WEBPACK_IMPORTED_MODULE_0__.createElement(react__WEBPACK_IMPORTED_MODULE_0__.Fragment, null);\n }\n return (react__WEBPACK_IMPORTED_MODULE_0__.createElement(\"p\", null,\n \"Te quedan \",\n react__WEBPACK_IMPORTED_MODULE_0__.createElement(\"b\", null, props.remainingFrames),\n \" frames para terminar la acci\\u00F3n.\"));\n }\n return (react__WEBPACK_IMPORTED_MODULE_0__.createElement(_lastres_components_presentation__WEBPACK_IMPORTED_MODULE_3__[\"default\"], null,\n react__WEBPACK_IMPORTED_MODULE_0__.createElement(_lastres_components_presentation_item__WEBPACK_IMPORTED_MODULE_2__[\"default\"], null, teamPJs.map((item, i) => {\n return react__WEBPACK_IMPORTED_MODULE_0__.createElement(_lastres_components_pj_list_item__WEBPACK_IMPORTED_MODULE_1__[\"default\"], { key: i, pj: item });\n })),\n react__WEBPACK_IMPORTED_MODULE_0__.createElement(_lastres_components_presentation_item__WEBPACK_IMPORTED_MODULE_2__[\"default\"], { presentationItemRef: logPresentationRef },\n react__WEBPACK_IMPORTED_MODULE_0__.createElement(_lastres_components_log_panel__WEBPACK_IMPORTED_MODULE_4__[\"default\"], { logLines: logLines })),\n react__WEBPACK_IMPORTED_MODULE_0__.createElement(_lastres_components_presentation_item__WEBPACK_IMPORTED_MODULE_2__[\"default\"], null,\n showLocationMenuHeaderText(),\n showRemainingFrames(),\n availableLocationsToMove())));\n}\n\n\n//# sourceURL=webpack://LasTres/./js-src/components/upper-panel.tsx?");
/***/ }),
@@ -266,7 +266,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpac
\*********************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
-eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (/* binding */ InputPackets)\n/* harmony export */ });\n/* harmony import */ var _lastres_input_packet_info__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @lastres/input-packet/info */ \"./js-src/input-packet/info.ts\");\n/* harmony import */ var _lastres_input_packet_pong__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @lastres/input-packet/pong */ \"./js-src/input-packet/pong.ts\");\n\n\nclass InputPackets {\n constructor(setTeamPJs, setCurrentLocation, setConnectedLocations, logLines, setLogLines, setError, setScrollLog, logPresentationRef, setMovingTo) {\n this.cachedHash = null;\n this.cachedArray = null;\n this.setTeamPJs = setTeamPJs;\n this.setCurrentLocation = setCurrentLocation;\n this.setConnectedLocations = setConnectedLocations;\n this.logLines = logLines;\n this.setLogLines = setLogLines;\n this.setError = setError;\n this.setScrollLog = setScrollLog;\n this.logPresentationRef = logPresentationRef;\n this.setMovingTo = setMovingTo;\n }\n handle(packet) {\n const hash = this.hashAvailablePackets();\n const identifier = packet.command;\n const inputPacket = hash[identifier];\n inputPacket.recv(packet);\n }\n listAvailablePackets() {\n let firstTime = true;\n if (this.cachedArray === null) {\n const infoPacket = new _lastres_input_packet_info__WEBPACK_IMPORTED_MODULE_0__[\"default\"]();\n const pongPacket = new _lastres_input_packet_pong__WEBPACK_IMPORTED_MODULE_1__[\"default\"]();\n infoPacket.onReceive((data) => {\n const logPresentationRef = this.logPresentationRef;\n let scrollData = [];\n function saveScroll() {\n if (logPresentationRef.current === null) {\n return;\n }\n scrollData = [logPresentationRef.current.scrollHeight, logPresentationRef.current.scrollTop, logPresentationRef.current.offsetHeight];\n }\n function applyScroll() {\n if (scrollData.length < 3) {\n return;\n }\n if (logPresentationRef.current === null) {\n console.log('Not defined');\n return;\n }\n const logPresentation = logPresentationRef.current;\n const [scrollHeight, scrollTop, offsetHeight] = scrollData;\n if (firstTime) {\n firstTime = false;\n console.log(scrollHeight, logPresentation.scrollHeight);\n logPresentation.scrollTo(0, logPresentation.scrollHeight);\n return;\n }\n if (scrollHeight === offsetHeight) {\n logPresentation.scrollTo(0, logPresentation.scrollHeight);\n return;\n }\n if (scrollHeight <= scrollTop + offsetHeight) {\n logPresentation.scrollTo(0, logPresentation.scrollHeight);\n }\n }\n if (data.error !== undefined) {\n this.setError(data.error);\n return;\n }\n if (data.team_pjs !== undefined) {\n this.setTeamPJs(data.team_pjs);\n }\n if (data.location_data !== undefined) {\n console.log(data.location_data);\n if (data.location_data.connected_places !== undefined) {\n this.setConnectedLocations(data.location_data.connected_places);\n }\n if (data.location_data.current !== undefined) {\n this.setCurrentLocation(data.location_data.current);\n }\n if (data.location_data.moving_to !== undefined) {\n this.setMovingTo(data.location_data.moving_to);\n }\n else {\n this.setMovingTo(null);\n }\n }\n if (data.set_log !== undefined) {\n saveScroll();\n this.setLogLines(data.set_log);\n window.setTimeout(() => {\n applyScroll();\n }, 10);\n }\n if (data.append_log !== undefined) {\n const logHash = {};\n saveScroll();\n this.setLogLines((logLines) => {\n if (logLines !== null) {\n for (const item of logLines) {\n logHash[item.uuid] = item;\n }\n logHash[data.append_log.uuid] = data.append_log;\n const outputLog = Object.keys(logHash).map((item, i) => {\n return logHash[item];\n });\n return outputLog;\n }\n return [];\n });\n window.setTimeout(() => {\n applyScroll();\n }, 10);\n }\n });\n this.cachedArray = [infoPacket, pongPacket];\n }\n return this.cachedArray;\n }\n hashAvailablePackets() {\n if (this.cachedHash === null) {\n this.cachedHash = {};\n for (const inputPacket of this.listAvailablePackets()) {\n this.cachedHash[inputPacket.identifier()] = inputPacket;\n }\n }\n return this.cachedHash;\n }\n}\n\n\n//# sourceURL=webpack://LasTres/./js-src/input-packets.ts?");
+eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (/* binding */ InputPackets)\n/* harmony export */ });\n/* harmony import */ var _lastres_input_packet_info__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @lastres/input-packet/info */ \"./js-src/input-packet/info.ts\");\n/* harmony import */ var _lastres_input_packet_pong__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @lastres/input-packet/pong */ \"./js-src/input-packet/pong.ts\");\n\n\nclass InputPackets {\n constructor(setTeamPJs, setCurrentLocation, setConnectedLocations, logLines, setLogLines, setError, setScrollLog, logPresentationRef, setMovingTo, setRemainingFrames) {\n this.cachedHash = null;\n this.cachedArray = null;\n this.setTeamPJs = setTeamPJs;\n this.setCurrentLocation = setCurrentLocation;\n this.setConnectedLocations = setConnectedLocations;\n this.logLines = logLines;\n this.setLogLines = setLogLines;\n this.setError = setError;\n this.setScrollLog = setScrollLog;\n this.logPresentationRef = logPresentationRef;\n this.setMovingTo = setMovingTo;\n this.setRemainingFrames = setRemainingFrames;\n }\n handle(packet) {\n const hash = this.hashAvailablePackets();\n const identifier = packet.command;\n const inputPacket = hash[identifier];\n inputPacket.recv(packet);\n }\n listAvailablePackets() {\n let firstTime = true;\n if (this.cachedArray === null) {\n const infoPacket = new _lastres_input_packet_info__WEBPACK_IMPORTED_MODULE_0__[\"default\"]();\n const pongPacket = new _lastres_input_packet_pong__WEBPACK_IMPORTED_MODULE_1__[\"default\"]();\n infoPacket.onReceive((data) => {\n const logPresentationRef = this.logPresentationRef;\n let scrollData = [];\n function saveScroll() {\n if (logPresentationRef.current === null) {\n return;\n }\n scrollData = [logPresentationRef.current.scrollHeight, logPresentationRef.current.scrollTop, logPresentationRef.current.offsetHeight];\n }\n function applyScroll() {\n if (scrollData.length < 3) {\n return;\n }\n if (logPresentationRef.current === null) {\n console.log('Not defined');\n return;\n }\n const logPresentation = logPresentationRef.current;\n const [scrollHeight, scrollTop, offsetHeight] = scrollData;\n if (firstTime) {\n firstTime = false;\n console.log(scrollHeight, logPresentation.scrollHeight);\n logPresentation.scrollTo(0, logPresentation.scrollHeight);\n return;\n }\n if (scrollHeight === offsetHeight) {\n logPresentation.scrollTo(0, logPresentation.scrollHeight);\n return;\n }\n if (scrollHeight <= scrollTop + offsetHeight) {\n logPresentation.scrollTo(0, logPresentation.scrollHeight);\n }\n }\n if (data.error !== undefined) {\n this.setError(data.error);\n return;\n }\n if (data.team_pjs !== undefined) {\n this.setTeamPJs(data.team_pjs);\n }\n if (data.location_data !== undefined) {\n console.log(data.location_data);\n if (data.location_data.connected_places !== undefined) {\n this.setConnectedLocations(data.location_data.connected_places);\n }\n if (data.location_data.current !== undefined) {\n this.setCurrentLocation(data.location_data.current);\n }\n if (data.location_data.moving_to !== undefined) {\n this.setMovingTo(data.location_data.moving_to);\n }\n else {\n this.setMovingTo(null);\n }\n }\n if (data.remaining_frames !== undefined) {\n this.setRemainingFrames(data.remaining_frames);\n }\n if (data.set_log !== undefined) {\n saveScroll();\n this.setLogLines(data.set_log);\n window.setTimeout(() => {\n applyScroll();\n }, 10);\n }\n if (data.append_log !== undefined) {\n const logHash = {};\n saveScroll();\n this.setLogLines((logLines) => {\n if (logLines !== null) {\n for (const item of logLines) {\n logHash[item.uuid] = item;\n }\n logHash[data.append_log.uuid] = data.append_log;\n const outputLog = Object.keys(logHash).map((item, i) => {\n return logHash[item];\n });\n return outputLog;\n }\n return [];\n });\n window.setTimeout(() => {\n applyScroll();\n }, 10);\n }\n });\n this.cachedArray = [infoPacket, pongPacket];\n }\n return this.cachedArray;\n }\n hashAvailablePackets() {\n if (this.cachedHash === null) {\n this.cachedHash = {};\n for (const inputPacket of this.listAvailablePackets()) {\n this.cachedHash[inputPacket.identifier()] = inputPacket;\n }\n }\n return this.cachedHash;\n }\n}\n\n\n//# sourceURL=webpack://LasTres/./js-src/input-packets.ts?");
/***/ }),