Compare commits
No commits in common. "00996bc5f1e0d744a0325372e6d0a27ac61743ff" and "cc0312b357efe24c8ce8165913a1ff03b8302937" have entirely different histories.
00996bc5f1
...
cc0312b357
|
@ -1,48 +0,0 @@
|
||||||
{
|
|
||||||
"extends": "eslint:recommended",
|
|
||||||
"env": {
|
|
||||||
"browser": true,
|
|
||||||
"node": true,
|
|
||||||
"es6": true
|
|
||||||
},
|
|
||||||
"parserOptions": {
|
|
||||||
"ecmaVersion": 11
|
|
||||||
},
|
|
||||||
"rules": {
|
|
||||||
// "brace-style": ["error", "stroustrup", { "allowSingleLine": true }],
|
|
||||||
// "comma-dangle": ["error", "always-multiline"],
|
|
||||||
"sourceType": "module",
|
|
||||||
"comma-spacing": "error",
|
|
||||||
"comma-style": "error",
|
|
||||||
"curly": ["error", "multi-line", "consistent"],
|
|
||||||
"dot-location": ["error", "property"],
|
|
||||||
"handle-callback-err": "off",
|
|
||||||
"max-nested-callbacks": ["error", { "max": 4 }],
|
|
||||||
"max-statements-per-line": ["error", { "max": 2 }],
|
|
||||||
"no-console": "off",
|
|
||||||
"no-empty-function": "error",
|
|
||||||
"no-floating-decimal": "error",
|
|
||||||
// "no-inline-comments": "error",
|
|
||||||
"no-lonely-if": "error",
|
|
||||||
// "no-multi-spaces": "error",
|
|
||||||
"no-multiple-empty-lines": ["error", { "max": 2, "maxEOF": 1, "maxBOF": 0 }],
|
|
||||||
"no-shadow": ["error", { "allow": ["err", "resolve", "reject"] }],
|
|
||||||
"no-trailing-spaces": ["error"],
|
|
||||||
"no-var": "error",
|
|
||||||
"no-unreachable": "off",
|
|
||||||
"object-curly-spacing": ["error", "always"],
|
|
||||||
"prefer-const": "error",
|
|
||||||
"semi": ["error", "always"],
|
|
||||||
"space-before-blocks": "error",
|
|
||||||
"space-before-function-paren": ["error", {
|
|
||||||
"anonymous": "never",
|
|
||||||
"named": "never",
|
|
||||||
"asyncArrow": "always"
|
|
||||||
}],
|
|
||||||
"space-in-parens": "error",
|
|
||||||
"space-infix-ops": "error",
|
|
||||||
"space-unary-ops": "error",
|
|
||||||
"spaced-comment": "error",
|
|
||||||
"yoda": "error"
|
|
||||||
}
|
|
||||||
}
|
|
4
.gitignore
vendored
|
@ -1,3 +1 @@
|
||||||
*node_modules*
|
*node_modules/*
|
||||||
*dist*
|
|
||||||
*.sass-cache*
|
|
||||||
|
|
BIN
Assets/Capitol - Copy.png
Normal file
After Width: | Height: | Size: 307 B |
BIN
Assets/Capitol.png
Normal file
After Width: | Height: | Size: 307 B |
BIN
Assets/City.png
Normal file
After Width: | Height: | Size: 296 B |
BIN
Assets/Rock.png
Normal file
After Width: | Height: | Size: 285 B |
BIN
Assets/Rockboarder.png
Normal file
After Width: | Height: | Size: 292 B |
BIN
Assets/Sheet.xcf
Normal file
BIN
Assets/dynamite.png
Normal file
After Width: | Height: | Size: 334 B |
BIN
Assets/factory.png
Normal file
After Width: | Height: | Size: 405 B |
BIN
Assets/flagBlue.png
Normal file
After Width: | Height: | Size: 264 B |
BIN
Assets/flagGreen.png
Normal file
After Width: | Height: | Size: 264 B |
BIN
Assets/flagOrange.png
Normal file
After Width: | Height: | Size: 264 B |
BIN
Assets/flagRed.png
Normal file
After Width: | Height: | Size: 264 B |
BIN
Assets/grass.png
Normal file
After Width: | Height: | Size: 264 B |
BIN
Assets/hills.png
Normal file
After Width: | Height: | Size: 358 B |
BIN
Assets/sea.png
Normal file
After Width: | Height: | Size: 285 B |
BIN
Assets/swall.png
Normal file
After Width: | Height: | Size: 207 B |
BIN
Assets/swallcorner.png
Normal file
After Width: | Height: | Size: 240 B |
BIN
Assets/town.png
Normal file
After Width: | Height: | Size: 413 B |
BIN
Assets/wwall.png
Normal file
After Width: | Height: | Size: 179 B |
BIN
Assets/wwallcorner.png
Normal file
After Width: | Height: | Size: 218 B |
675
LICENSE.txt
|
@ -1,675 +0,0 @@
|
||||||
GNU GENERAL PUBLIC LICENSE
|
|
||||||
Version 3, 29 June 2007
|
|
||||||
|
|
||||||
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
|
|
||||||
Everyone is permitted to copy and distribute verbatim copies
|
|
||||||
of this license document, but changing it is not allowed.
|
|
||||||
|
|
||||||
Preamble
|
|
||||||
|
|
||||||
The GNU General Public License is a free, copyleft license for
|
|
||||||
software and other kinds of works.
|
|
||||||
|
|
||||||
The licenses for most software and other practical works are designed
|
|
||||||
to take away your freedom to share and change the works. By contrast,
|
|
||||||
the GNU General Public License is intended to guarantee your freedom to
|
|
||||||
share and change all versions of a program--to make sure it remains free
|
|
||||||
software for all its users. We, the Free Software Foundation, use the
|
|
||||||
GNU General Public License for most of our software; it applies also to
|
|
||||||
any other work released this way by its authors. You can apply it to
|
|
||||||
your programs, too.
|
|
||||||
|
|
||||||
When we speak of free software, we are referring to freedom, not
|
|
||||||
price. Our General Public Licenses are designed to make sure that you
|
|
||||||
have the freedom to distribute copies of free software (and charge for
|
|
||||||
them if you wish), that you receive source code or can get it if you
|
|
||||||
want it, that you can change the software or use pieces of it in new
|
|
||||||
free programs, and that you know you can do these things.
|
|
||||||
|
|
||||||
To protect your rights, we need to prevent others from denying you
|
|
||||||
these rights or asking you to surrender the rights. Therefore, you have
|
|
||||||
certain responsibilities if you distribute copies of the software, or if
|
|
||||||
you modify it: responsibilities to respect the freedom of others.
|
|
||||||
|
|
||||||
For example, if you distribute copies of such a program, whether
|
|
||||||
gratis or for a fee, you must pass on to the recipients the same
|
|
||||||
freedoms that you received. You must make sure that they, too, receive
|
|
||||||
or can get the source code. And you must show them these terms so they
|
|
||||||
know their rights.
|
|
||||||
|
|
||||||
Developers that use the GNU GPL protect your rights with two steps:
|
|
||||||
(1) assert copyright on the software, and (2) offer you this License
|
|
||||||
giving you legal permission to copy, distribute and/or modify it.
|
|
||||||
|
|
||||||
For the developers' and authors' protection, the GPL clearly explains
|
|
||||||
that there is no warranty for this free software. For both users' and
|
|
||||||
authors' sake, the GPL requires that modified versions be marked as
|
|
||||||
changed, so that their problems will not be attributed erroneously to
|
|
||||||
authors of previous versions.
|
|
||||||
|
|
||||||
Some devices are designed to deny users access to install or run
|
|
||||||
modified versions of the software inside them, although the manufacturer
|
|
||||||
can do so. This is fundamentally incompatible with the aim of
|
|
||||||
protecting users' freedom to change the software. The systematic
|
|
||||||
pattern of such abuse occurs in the area of products for individuals to
|
|
||||||
use, which is precisely where it is most unacceptable. Therefore, we
|
|
||||||
have designed this version of the GPL to prohibit the practice for those
|
|
||||||
products. If such problems arise substantially in other domains, we
|
|
||||||
stand ready to extend this provision to those domains in future versions
|
|
||||||
of the GPL, as needed to protect the freedom of users.
|
|
||||||
|
|
||||||
Finally, every program is threatened constantly by software patents.
|
|
||||||
States should not allow patents to restrict development and use of
|
|
||||||
software on general-purpose computers, but in those that do, we wish to
|
|
||||||
avoid the special danger that patents applied to a free program could
|
|
||||||
make it effectively proprietary. To prevent this, the GPL assures that
|
|
||||||
patents cannot be used to render the program non-free.
|
|
||||||
|
|
||||||
The precise terms and conditions for copying, distribution and
|
|
||||||
modification follow.
|
|
||||||
|
|
||||||
TERMS AND CONDITIONS
|
|
||||||
|
|
||||||
0. Definitions.
|
|
||||||
|
|
||||||
"This License" refers to version 3 of the GNU General Public License.
|
|
||||||
|
|
||||||
"Copyright" also means copyright-like laws that apply to other kinds of
|
|
||||||
works, such as semiconductor masks.
|
|
||||||
|
|
||||||
"The Program" refers to any copyrightable work licensed under this
|
|
||||||
License. Each licensee is addressed as "you". "Licensees" and
|
|
||||||
"recipients" may be individuals or organizations.
|
|
||||||
|
|
||||||
To "modify" a work means to copy from or adapt all or part of the work
|
|
||||||
in a fashion requiring copyright permission, other than the making of an
|
|
||||||
exact copy. The resulting work is called a "modified version" of the
|
|
||||||
earlier work or a work "based on" the earlier work.
|
|
||||||
|
|
||||||
A "covered work" means either the unmodified Program or a work based
|
|
||||||
on the Program.
|
|
||||||
|
|
||||||
To "propagate" a work means to do anything with it that, without
|
|
||||||
permission, would make you directly or secondarily liable for
|
|
||||||
infringement under applicable copyright law, except executing it on a
|
|
||||||
computer or modifying a private copy. Propagation includes copying,
|
|
||||||
distribution (with or without modification), making available to the
|
|
||||||
public, and in some countries other activities as well.
|
|
||||||
|
|
||||||
To "convey" a work means any kind of propagation that enables other
|
|
||||||
parties to make or receive copies. Mere interaction with a user through
|
|
||||||
a computer network, with no transfer of a copy, is not conveying.
|
|
||||||
|
|
||||||
An interactive user interface displays "Appropriate Legal Notices"
|
|
||||||
to the extent that it includes a convenient and prominently visible
|
|
||||||
feature that (1) displays an appropriate copyright notice, and (2)
|
|
||||||
tells the user that there is no warranty for the work (except to the
|
|
||||||
extent that warranties are provided), that licensees may convey the
|
|
||||||
work under this License, and how to view a copy of this License. If
|
|
||||||
the interface presents a list of user commands or options, such as a
|
|
||||||
menu, a prominent item in the list meets this criterion.
|
|
||||||
|
|
||||||
1. Source Code.
|
|
||||||
|
|
||||||
The "source code" for a work means the preferred form of the work
|
|
||||||
for making modifications to it. "Object code" means any non-source
|
|
||||||
form of a work.
|
|
||||||
|
|
||||||
A "Standard Interface" means an interface that either is an official
|
|
||||||
standard defined by a recognized standards body, or, in the case of
|
|
||||||
interfaces specified for a particular programming language, one that
|
|
||||||
is widely used among developers working in that language.
|
|
||||||
|
|
||||||
The "System Libraries" of an executable work include anything, other
|
|
||||||
than the work as a whole, that (a) is included in the normal form of
|
|
||||||
packaging a Major Component, but which is not part of that Major
|
|
||||||
Component, and (b) serves only to enable use of the work with that
|
|
||||||
Major Component, or to implement a Standard Interface for which an
|
|
||||||
implementation is available to the public in source code form. A
|
|
||||||
"Major Component", in this context, means a major essential component
|
|
||||||
(kernel, window system, and so on) of the specific operating system
|
|
||||||
(if any) on which the executable work runs, or a compiler used to
|
|
||||||
produce the work, or an object code interpreter used to run it.
|
|
||||||
|
|
||||||
The "Corresponding Source" for a work in object code form means all
|
|
||||||
the source code needed to generate, install, and (for an executable
|
|
||||||
work) run the object code and to modify the work, including scripts to
|
|
||||||
control those activities. However, it does not include the work's
|
|
||||||
System Libraries, or general-purpose tools or generally available free
|
|
||||||
programs which are used unmodified in performing those activities but
|
|
||||||
which are not part of the work. For example, Corresponding Source
|
|
||||||
includes interface definition files associated with source files for
|
|
||||||
the work, and the source code for shared libraries and dynamically
|
|
||||||
linked subprograms that the work is specifically designed to require,
|
|
||||||
such as by intimate data communication or control flow between those
|
|
||||||
subprograms and other parts of the work.
|
|
||||||
|
|
||||||
The Corresponding Source need not include anything that users
|
|
||||||
can regenerate automatically from other parts of the Corresponding
|
|
||||||
Source.
|
|
||||||
|
|
||||||
The Corresponding Source for a work in source code form is that
|
|
||||||
same work.
|
|
||||||
|
|
||||||
2. Basic Permissions.
|
|
||||||
|
|
||||||
All rights granted under this License are granted for the term of
|
|
||||||
copyright on the Program, and are irrevocable provided the stated
|
|
||||||
conditions are met. This License explicitly affirms your unlimited
|
|
||||||
permission to run the unmodified Program. The output from running a
|
|
||||||
covered work is covered by this License only if the output, given its
|
|
||||||
content, constitutes a covered work. This License acknowledges your
|
|
||||||
rights of fair use or other equivalent, as provided by copyright law.
|
|
||||||
|
|
||||||
You may make, run and propagate covered works that you do not
|
|
||||||
convey, without conditions so long as your license otherwise remains
|
|
||||||
in force. You may convey covered works to others for the sole purpose
|
|
||||||
of having them make modifications exclusively for you, or provide you
|
|
||||||
with facilities for running those works, provided that you comply with
|
|
||||||
the terms of this License in conveying all material for which you do
|
|
||||||
not control copyright. Those thus making or running the covered works
|
|
||||||
for you must do so exclusively on your behalf, under your direction
|
|
||||||
and control, on terms that prohibit them from making any copies of
|
|
||||||
your copyrighted material outside their relationship with you.
|
|
||||||
|
|
||||||
Conveying under any other circumstances is permitted solely under
|
|
||||||
the conditions stated below. Sublicensing is not allowed; section 10
|
|
||||||
makes it unnecessary.
|
|
||||||
|
|
||||||
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
|
|
||||||
|
|
||||||
No covered work shall be deemed part of an effective technological
|
|
||||||
measure under any applicable law fulfilling obligations under article
|
|
||||||
11 of the WIPO copyright treaty adopted on 20 December 1996, or
|
|
||||||
similar laws prohibiting or restricting circumvention of such
|
|
||||||
measures.
|
|
||||||
|
|
||||||
When you convey a covered work, you waive any legal power to forbid
|
|
||||||
circumvention of technological measures to the extent such circumvention
|
|
||||||
is effected by exercising rights under this License with respect to
|
|
||||||
the covered work, and you disclaim any intention to limit operation or
|
|
||||||
modification of the work as a means of enforcing, against the work's
|
|
||||||
users, your or third parties' legal rights to forbid circumvention of
|
|
||||||
technological measures.
|
|
||||||
|
|
||||||
4. Conveying Verbatim Copies.
|
|
||||||
|
|
||||||
You may convey verbatim copies of the Program's source code as you
|
|
||||||
receive it, in any medium, provided that you conspicuously and
|
|
||||||
appropriately publish on each copy an appropriate copyright notice;
|
|
||||||
keep intact all notices stating that this License and any
|
|
||||||
non-permissive terms added in accord with section 7 apply to the code;
|
|
||||||
keep intact all notices of the absence of any warranty; and give all
|
|
||||||
recipients a copy of this License along with the Program.
|
|
||||||
|
|
||||||
You may charge any price or no price for each copy that you convey,
|
|
||||||
and you may offer support or warranty protection for a fee.
|
|
||||||
|
|
||||||
5. Conveying Modified Source Versions.
|
|
||||||
|
|
||||||
You may convey a work based on the Program, or the modifications to
|
|
||||||
produce it from the Program, in the form of source code under the
|
|
||||||
terms of section 4, provided that you also meet all of these conditions:
|
|
||||||
|
|
||||||
a) The work must carry prominent notices stating that you modified
|
|
||||||
it, and giving a relevant date.
|
|
||||||
|
|
||||||
b) The work must carry prominent notices stating that it is
|
|
||||||
released under this License and any conditions added under section
|
|
||||||
7. This requirement modifies the requirement in section 4 to
|
|
||||||
"keep intact all notices".
|
|
||||||
|
|
||||||
c) You must license the entire work, as a whole, under this
|
|
||||||
License to anyone who comes into possession of a copy. This
|
|
||||||
License will therefore apply, along with any applicable section 7
|
|
||||||
additional terms, to the whole of the work, and all its parts,
|
|
||||||
regardless of how they are packaged. This License gives no
|
|
||||||
permission to license the work in any other way, but it does not
|
|
||||||
invalidate such permission if you have separately received it.
|
|
||||||
|
|
||||||
d) If the work has interactive user interfaces, each must display
|
|
||||||
Appropriate Legal Notices; however, if the Program has interactive
|
|
||||||
interfaces that do not display Appropriate Legal Notices, your
|
|
||||||
work need not make them do so.
|
|
||||||
|
|
||||||
A compilation of a covered work with other separate and independent
|
|
||||||
works, which are not by their nature extensions of the covered work,
|
|
||||||
and which are not combined with it such as to form a larger program,
|
|
||||||
in or on a volume of a storage or distribution medium, is called an
|
|
||||||
"aggregate" if the compilation and its resulting copyright are not
|
|
||||||
used to limit the access or legal rights of the compilation's users
|
|
||||||
beyond what the individual works permit. Inclusion of a covered work
|
|
||||||
in an aggregate does not cause this License to apply to the other
|
|
||||||
parts of the aggregate.
|
|
||||||
|
|
||||||
6. Conveying Non-Source Forms.
|
|
||||||
|
|
||||||
You may convey a covered work in object code form under the terms
|
|
||||||
of sections 4 and 5, provided that you also convey the
|
|
||||||
machine-readable Corresponding Source under the terms of this License,
|
|
||||||
in one of these ways:
|
|
||||||
|
|
||||||
a) Convey the object code in, or embodied in, a physical product
|
|
||||||
(including a physical distribution medium), accompanied by the
|
|
||||||
Corresponding Source fixed on a durable physical medium
|
|
||||||
customarily used for software interchange.
|
|
||||||
|
|
||||||
b) Convey the object code in, or embodied in, a physical product
|
|
||||||
(including a physical distribution medium), accompanied by a
|
|
||||||
written offer, valid for at least three years and valid for as
|
|
||||||
long as you offer spare parts or customer support for that product
|
|
||||||
model, to give anyone who possesses the object code either (1) a
|
|
||||||
copy of the Corresponding Source for all the software in the
|
|
||||||
product that is covered by this License, on a durable physical
|
|
||||||
medium customarily used for software interchange, for a price no
|
|
||||||
more than your reasonable cost of physically performing this
|
|
||||||
conveying of source, or (2) access to copy the
|
|
||||||
Corresponding Source from a network server at no charge.
|
|
||||||
|
|
||||||
c) Convey individual copies of the object code with a copy of the
|
|
||||||
written offer to provide the Corresponding Source. This
|
|
||||||
alternative is allowed only occasionally and noncommercially, and
|
|
||||||
only if you received the object code with such an offer, in accord
|
|
||||||
with subsection 6b.
|
|
||||||
|
|
||||||
d) Convey the object code by offering access from a designated
|
|
||||||
place (gratis or for a charge), and offer equivalent access to the
|
|
||||||
Corresponding Source in the same way through the same place at no
|
|
||||||
further charge. You need not require recipients to copy the
|
|
||||||
Corresponding Source along with the object code. If the place to
|
|
||||||
copy the object code is a network server, the Corresponding Source
|
|
||||||
may be on a different server (operated by you or a third party)
|
|
||||||
that supports equivalent copying facilities, provided you maintain
|
|
||||||
clear directions next to the object code saying where to find the
|
|
||||||
Corresponding Source. Regardless of what server hosts the
|
|
||||||
Corresponding Source, you remain obligated to ensure that it is
|
|
||||||
available for as long as needed to satisfy these requirements.
|
|
||||||
|
|
||||||
e) Convey the object code using peer-to-peer transmission, provided
|
|
||||||
you inform other peers where the object code and Corresponding
|
|
||||||
Source of the work are being offered to the general public at no
|
|
||||||
charge under subsection 6d.
|
|
||||||
|
|
||||||
A separable portion of the object code, whose source code is excluded
|
|
||||||
from the Corresponding Source as a System Library, need not be
|
|
||||||
included in conveying the object code work.
|
|
||||||
|
|
||||||
A "User Product" is either (1) a "consumer product", which means any
|
|
||||||
tangible personal property which is normally used for personal, family,
|
|
||||||
or household purposes, or (2) anything designed or sold for incorporation
|
|
||||||
into a dwelling. In determining whether a product is a consumer product,
|
|
||||||
doubtful cases shall be resolved in favor of coverage. For a particular
|
|
||||||
product received by a particular user, "normally used" refers to a
|
|
||||||
typical or common use of that class of product, regardless of the status
|
|
||||||
of the particular user or of the way in which the particular user
|
|
||||||
actually uses, or expects or is expected to use, the product. A product
|
|
||||||
is a consumer product regardless of whether the product has substantial
|
|
||||||
commercial, industrial or non-consumer uses, unless such uses represent
|
|
||||||
the only significant mode of use of the product.
|
|
||||||
|
|
||||||
"Installation Information" for a User Product means any methods,
|
|
||||||
procedures, authorization keys, or other information required to install
|
|
||||||
and execute modified versions of a covered work in that User Product from
|
|
||||||
a modified version of its Corresponding Source. The information must
|
|
||||||
suffice to ensure that the continued functioning of the modified object
|
|
||||||
code is in no case prevented or interfered with solely because
|
|
||||||
modification has been made.
|
|
||||||
|
|
||||||
If you convey an object code work under this section in, or with, or
|
|
||||||
specifically for use in, a User Product, and the conveying occurs as
|
|
||||||
part of a transaction in which the right of possession and use of the
|
|
||||||
User Product is transferred to the recipient in perpetuity or for a
|
|
||||||
fixed term (regardless of how the transaction is characterized), the
|
|
||||||
Corresponding Source conveyed under this section must be accompanied
|
|
||||||
by the Installation Information. But this requirement does not apply
|
|
||||||
if neither you nor any third party retains the ability to install
|
|
||||||
modified object code on the User Product (for example, the work has
|
|
||||||
been installed in ROM).
|
|
||||||
|
|
||||||
The requirement to provide Installation Information does not include a
|
|
||||||
requirement to continue to provide support service, warranty, or updates
|
|
||||||
for a work that has been modified or installed by the recipient, or for
|
|
||||||
the User Product in which it has been modified or installed. Access to a
|
|
||||||
network may be denied when the modification itself materially and
|
|
||||||
adversely affects the operation of the network or violates the rules and
|
|
||||||
protocols for communication across the network.
|
|
||||||
|
|
||||||
Corresponding Source conveyed, and Installation Information provided,
|
|
||||||
in accord with this section must be in a format that is publicly
|
|
||||||
documented (and with an implementation available to the public in
|
|
||||||
source code form), and must require no special password or key for
|
|
||||||
unpacking, reading or copying.
|
|
||||||
|
|
||||||
7. Additional Terms.
|
|
||||||
|
|
||||||
"Additional permissions" are terms that supplement the terms of this
|
|
||||||
License by making exceptions from one or more of its conditions.
|
|
||||||
Additional permissions that are applicable to the entire Program shall
|
|
||||||
be treated as though they were included in this License, to the extent
|
|
||||||
that they are valid under applicable law. If additional permissions
|
|
||||||
apply only to part of the Program, that part may be used separately
|
|
||||||
under those permissions, but the entire Program remains governed by
|
|
||||||
this License without regard to the additional permissions.
|
|
||||||
|
|
||||||
When you convey a copy of a covered work, you may at your option
|
|
||||||
remove any additional permissions from that copy, or from any part of
|
|
||||||
it. (Additional permissions may be written to require their own
|
|
||||||
removal in certain cases when you modify the work.) You may place
|
|
||||||
additional permissions on material, added by you to a covered work,
|
|
||||||
for which you have or can give appropriate copyright permission.
|
|
||||||
|
|
||||||
Notwithstanding any other provision of this License, for material you
|
|
||||||
add to a covered work, you may (if authorized by the copyright holders of
|
|
||||||
that material) supplement the terms of this License with terms:
|
|
||||||
|
|
||||||
a) Disclaiming warranty or limiting liability differently from the
|
|
||||||
terms of sections 15 and 16 of this License; or
|
|
||||||
|
|
||||||
b) Requiring preservation of specified reasonable legal notices or
|
|
||||||
author attributions in that material or in the Appropriate Legal
|
|
||||||
Notices displayed by works containing it; or
|
|
||||||
|
|
||||||
c) Prohibiting misrepresentation of the origin of that material, or
|
|
||||||
requiring that modified versions of such material be marked in
|
|
||||||
reasonable ways as different from the original version; or
|
|
||||||
|
|
||||||
d) Limiting the use for publicity purposes of names of licensors or
|
|
||||||
authors of the material; or
|
|
||||||
|
|
||||||
e) Declining to grant rights under trademark law for use of some
|
|
||||||
trade names, trademarks, or service marks; or
|
|
||||||
|
|
||||||
f) Requiring indemnification of licensors and authors of that
|
|
||||||
material by anyone who conveys the material (or modified versions of
|
|
||||||
it) with contractual assumptions of liability to the recipient, for
|
|
||||||
any liability that these contractual assumptions directly impose on
|
|
||||||
those licensors and authors.
|
|
||||||
|
|
||||||
All other non-permissive additional terms are considered "further
|
|
||||||
restrictions" within the meaning of section 10. If the Program as you
|
|
||||||
received it, or any part of it, contains a notice stating that it is
|
|
||||||
governed by this License along with a term that is a further
|
|
||||||
restriction, you may remove that term. If a license document contains
|
|
||||||
a further restriction but permits relicensing or conveying under this
|
|
||||||
License, you may add to a covered work material governed by the terms
|
|
||||||
of that license document, provided that the further restriction does
|
|
||||||
not survive such relicensing or conveying.
|
|
||||||
|
|
||||||
If you add terms to a covered work in accord with this section, you
|
|
||||||
must place, in the relevant source files, a statement of the
|
|
||||||
additional terms that apply to those files, or a notice indicating
|
|
||||||
where to find the applicable terms.
|
|
||||||
|
|
||||||
Additional terms, permissive or non-permissive, may be stated in the
|
|
||||||
form of a separately written license, or stated as exceptions;
|
|
||||||
the above requirements apply either way.
|
|
||||||
|
|
||||||
8. Termination.
|
|
||||||
|
|
||||||
You may not propagate or modify a covered work except as expressly
|
|
||||||
provided under this License. Any attempt otherwise to propagate or
|
|
||||||
modify it is void, and will automatically terminate your rights under
|
|
||||||
this License (including any patent licenses granted under the third
|
|
||||||
paragraph of section 11).
|
|
||||||
|
|
||||||
However, if you cease all violation of this License, then your
|
|
||||||
license from a particular copyright holder is reinstated (a)
|
|
||||||
provisionally, unless and until the copyright holder explicitly and
|
|
||||||
finally terminates your license, and (b) permanently, if the copyright
|
|
||||||
holder fails to notify you of the violation by some reasonable means
|
|
||||||
prior to 60 days after the cessation.
|
|
||||||
|
|
||||||
Moreover, your license from a particular copyright holder is
|
|
||||||
reinstated permanently if the copyright holder notifies you of the
|
|
||||||
violation by some reasonable means, this is the first time you have
|
|
||||||
received notice of violation of this License (for any work) from that
|
|
||||||
copyright holder, and you cure the violation prior to 30 days after
|
|
||||||
your receipt of the notice.
|
|
||||||
|
|
||||||
Termination of your rights under this section does not terminate the
|
|
||||||
licenses of parties who have received copies or rights from you under
|
|
||||||
this License. If your rights have been terminated and not permanently
|
|
||||||
reinstated, you do not qualify to receive new licenses for the same
|
|
||||||
material under section 10.
|
|
||||||
|
|
||||||
9. Acceptance Not Required for Having Copies.
|
|
||||||
|
|
||||||
You are not required to accept this License in order to receive or
|
|
||||||
run a copy of the Program. Ancillary propagation of a covered work
|
|
||||||
occurring solely as a consequence of using peer-to-peer transmission
|
|
||||||
to receive a copy likewise does not require acceptance. However,
|
|
||||||
nothing other than this License grants you permission to propagate or
|
|
||||||
modify any covered work. These actions infringe copyright if you do
|
|
||||||
not accept this License. Therefore, by modifying or propagating a
|
|
||||||
covered work, you indicate your acceptance of this License to do so.
|
|
||||||
|
|
||||||
10. Automatic Licensing of Downstream Recipients.
|
|
||||||
|
|
||||||
Each time you convey a covered work, the recipient automatically
|
|
||||||
receives a license from the original licensors, to run, modify and
|
|
||||||
propagate that work, subject to this License. You are not responsible
|
|
||||||
for enforcing compliance by third parties with this License.
|
|
||||||
|
|
||||||
An "entity transaction" is a transaction transferring control of an
|
|
||||||
organization, or substantially all assets of one, or subdividing an
|
|
||||||
organization, or merging organizations. If propagation of a covered
|
|
||||||
work results from an entity transaction, each party to that
|
|
||||||
transaction who receives a copy of the work also receives whatever
|
|
||||||
licenses to the work the party's predecessor in interest had or could
|
|
||||||
give under the previous paragraph, plus a right to possession of the
|
|
||||||
Corresponding Source of the work from the predecessor in interest, if
|
|
||||||
the predecessor has it or can get it with reasonable efforts.
|
|
||||||
|
|
||||||
You may not impose any further restrictions on the exercise of the
|
|
||||||
rights granted or affirmed under this License. For example, you may
|
|
||||||
not impose a license fee, royalty, or other charge for exercise of
|
|
||||||
rights granted under this License, and you may not initiate litigation
|
|
||||||
(including a cross-claim or counterclaim in a lawsuit) alleging that
|
|
||||||
any patent claim is infringed by making, using, selling, offering for
|
|
||||||
sale, or importing the Program or any portion of it.
|
|
||||||
|
|
||||||
11. Patents.
|
|
||||||
|
|
||||||
A "contributor" is a copyright holder who authorizes use under this
|
|
||||||
License of the Program or a work on which the Program is based. The
|
|
||||||
work thus licensed is called the contributor's "contributor version".
|
|
||||||
|
|
||||||
A contributor's "essential patent claims" are all patent claims
|
|
||||||
owned or controlled by the contributor, whether already acquired or
|
|
||||||
hereafter acquired, that would be infringed by some manner, permitted
|
|
||||||
by this License, of making, using, or selling its contributor version,
|
|
||||||
but do not include claims that would be infringed only as a
|
|
||||||
consequence of further modification of the contributor version. For
|
|
||||||
purposes of this definition, "control" includes the right to grant
|
|
||||||
patent sublicenses in a manner consistent with the requirements of
|
|
||||||
this License.
|
|
||||||
|
|
||||||
Each contributor grants you a non-exclusive, worldwide, royalty-free
|
|
||||||
patent license under the contributor's essential patent claims, to
|
|
||||||
make, use, sell, offer for sale, import and otherwise run, modify and
|
|
||||||
propagate the contents of its contributor version.
|
|
||||||
|
|
||||||
In the following three paragraphs, a "patent license" is any express
|
|
||||||
agreement or commitment, however denominated, not to enforce a patent
|
|
||||||
(such as an express permission to practice a patent or covenant not to
|
|
||||||
sue for patent infringement). To "grant" such a patent license to a
|
|
||||||
party means to make such an agreement or commitment not to enforce a
|
|
||||||
patent against the party.
|
|
||||||
|
|
||||||
If you convey a covered work, knowingly relying on a patent license,
|
|
||||||
and the Corresponding Source of the work is not available for anyone
|
|
||||||
to copy, free of charge and under the terms of this License, through a
|
|
||||||
publicly available network server or other readily accessible means,
|
|
||||||
then you must either (1) cause the Corresponding Source to be so
|
|
||||||
available, or (2) arrange to deprive yourself of the benefit of the
|
|
||||||
patent license for this particular work, or (3) arrange, in a manner
|
|
||||||
consistent with the requirements of this License, to extend the patent
|
|
||||||
license to downstream recipients. "Knowingly relying" means you have
|
|
||||||
actual knowledge that, but for the patent license, your conveying the
|
|
||||||
covered work in a country, or your recipient's use of the covered work
|
|
||||||
in a country, would infringe one or more identifiable patents in that
|
|
||||||
country that you have reason to believe are valid.
|
|
||||||
|
|
||||||
If, pursuant to or in connection with a single transaction or
|
|
||||||
arrangement, you convey, or propagate by procuring conveyance of, a
|
|
||||||
covered work, and grant a patent license to some of the parties
|
|
||||||
receiving the covered work authorizing them to use, propagate, modify
|
|
||||||
or convey a specific copy of the covered work, then the patent license
|
|
||||||
you grant is automatically extended to all recipients of the covered
|
|
||||||
work and works based on it.
|
|
||||||
|
|
||||||
A patent license is "discriminatory" if it does not include within
|
|
||||||
the scope of its coverage, prohibits the exercise of, or is
|
|
||||||
conditioned on the non-exercise of one or more of the rights that are
|
|
||||||
specifically granted under this License. You may not convey a covered
|
|
||||||
work if you are a party to an arrangement with a third party that is
|
|
||||||
in the business of distributing software, under which you make payment
|
|
||||||
to the third party based on the extent of your activity of conveying
|
|
||||||
the work, and under which the third party grants, to any of the
|
|
||||||
parties who would receive the covered work from you, a discriminatory
|
|
||||||
patent license (a) in connection with copies of the covered work
|
|
||||||
conveyed by you (or copies made from those copies), or (b) primarily
|
|
||||||
for and in connection with specific products or compilations that
|
|
||||||
contain the covered work, unless you entered into that arrangement,
|
|
||||||
or that patent license was granted, prior to 28 March 2007.
|
|
||||||
|
|
||||||
Nothing in this License shall be construed as excluding or limiting
|
|
||||||
any implied license or other defenses to infringement that may
|
|
||||||
otherwise be available to you under applicable patent law.
|
|
||||||
|
|
||||||
12. No Surrender of Others' Freedom.
|
|
||||||
|
|
||||||
If conditions are imposed on you (whether by court order, agreement or
|
|
||||||
otherwise) that contradict the conditions of this License, they do not
|
|
||||||
excuse you from the conditions of this License. If you cannot convey a
|
|
||||||
covered work so as to satisfy simultaneously your obligations under this
|
|
||||||
License and any other pertinent obligations, then as a consequence you may
|
|
||||||
not convey it at all. For example, if you agree to terms that obligate you
|
|
||||||
to collect a royalty for further conveying from those to whom you convey
|
|
||||||
the Program, the only way you could satisfy both those terms and this
|
|
||||||
License would be to refrain entirely from conveying the Program.
|
|
||||||
|
|
||||||
13. Use with the GNU Affero General Public License.
|
|
||||||
|
|
||||||
Notwithstanding any other provision of this License, you have
|
|
||||||
permission to link or combine any covered work with a work licensed
|
|
||||||
under version 3 of the GNU Affero General Public License into a single
|
|
||||||
combined work, and to convey the resulting work. The terms of this
|
|
||||||
License will continue to apply to the part which is the covered work,
|
|
||||||
but the special requirements of the GNU Affero General Public License,
|
|
||||||
section 13, concerning interaction through a network will apply to the
|
|
||||||
combination as such.
|
|
||||||
|
|
||||||
14. Revised Versions of this License.
|
|
||||||
|
|
||||||
The Free Software Foundation may publish revised and/or new versions of
|
|
||||||
the GNU General Public License from time to time. Such new versions will
|
|
||||||
be similar in spirit to the present version, but may differ in detail to
|
|
||||||
address new problems or concerns.
|
|
||||||
|
|
||||||
Each version is given a distinguishing version number. If the
|
|
||||||
Program specifies that a certain numbered version of the GNU General
|
|
||||||
Public License "or any later version" applies to it, you have the
|
|
||||||
option of following the terms and conditions either of that numbered
|
|
||||||
version or of any later version published by the Free Software
|
|
||||||
Foundation. If the Program does not specify a version number of the
|
|
||||||
GNU General Public License, you may choose any version ever published
|
|
||||||
by the Free Software Foundation.
|
|
||||||
|
|
||||||
If the Program specifies that a proxy can decide which future
|
|
||||||
versions of the GNU General Public License can be used, that proxy's
|
|
||||||
public statement of acceptance of a version permanently authorizes you
|
|
||||||
to choose that version for the Program.
|
|
||||||
|
|
||||||
Later license versions may give you additional or different
|
|
||||||
permissions. However, no additional obligations are imposed on any
|
|
||||||
author or copyright holder as a result of your choosing to follow a
|
|
||||||
later version.
|
|
||||||
|
|
||||||
15. Disclaimer of Warranty.
|
|
||||||
|
|
||||||
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
|
|
||||||
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
|
|
||||||
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
|
|
||||||
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
|
|
||||||
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
|
||||||
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
|
|
||||||
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
|
|
||||||
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
|
||||||
|
|
||||||
16. Limitation of Liability.
|
|
||||||
|
|
||||||
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
|
||||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
|
|
||||||
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
|
|
||||||
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
|
|
||||||
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
|
|
||||||
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
|
|
||||||
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
|
|
||||||
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
|
|
||||||
SUCH DAMAGES.
|
|
||||||
|
|
||||||
17. Interpretation of Sections 15 and 16.
|
|
||||||
|
|
||||||
If the disclaimer of warranty and limitation of liability provided
|
|
||||||
above cannot be given local legal effect according to their terms,
|
|
||||||
reviewing courts shall apply local law that most closely approximates
|
|
||||||
an absolute waiver of all civil liability in connection with the
|
|
||||||
Program, unless a warranty or assumption of liability accompanies a
|
|
||||||
copy of the Program in return for a fee.
|
|
||||||
|
|
||||||
END OF TERMS AND CONDITIONS
|
|
||||||
|
|
||||||
How to Apply These Terms to Your New Programs
|
|
||||||
|
|
||||||
If you develop a new program, and you want it to be of the greatest
|
|
||||||
possible use to the public, the best way to achieve this is to make it
|
|
||||||
free software which everyone can redistribute and change under these terms.
|
|
||||||
|
|
||||||
To do so, attach the following notices to the program. It is safest
|
|
||||||
to attach them to the start of each source file to most effectively
|
|
||||||
state the exclusion of warranty; and each file should have at least
|
|
||||||
the "copyright" line and a pointer to where the full notice is found.
|
|
||||||
|
|
||||||
<one line to give the program's name and a brief idea of what it does.>
|
|
||||||
Copyright (C) <year> <name of author>
|
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify
|
|
||||||
it under the terms of the GNU General Public License as published by
|
|
||||||
the Free Software Foundation, either version 3 of the License, or
|
|
||||||
(at your option) any later version.
|
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
GNU General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
|
||||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
Also add information on how to contact you by electronic and paper mail.
|
|
||||||
|
|
||||||
If the program does terminal interaction, make it output a short
|
|
||||||
notice like this when it starts in an interactive mode:
|
|
||||||
|
|
||||||
<program> Copyright (C) <year> <name of author>
|
|
||||||
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
|
||||||
This is free software, and you are welcome to redistribute it
|
|
||||||
under certain conditions; type `show c' for details.
|
|
||||||
|
|
||||||
The hypothetical commands `show w' and `show c' should show the appropriate
|
|
||||||
parts of the General Public License. Of course, your program's commands
|
|
||||||
might be different; for a GUI interface, you would use an "about box".
|
|
||||||
|
|
||||||
You should also get your employer (if you work as a programmer) or school,
|
|
||||||
if any, to sign a "copyright disclaimer" for the program, if necessary.
|
|
||||||
For more information on this, and how to apply and follow the GNU GPL, see
|
|
||||||
<https://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
The GNU General Public License does not permit incorporating your program
|
|
||||||
into proprietary programs. If your program is a subroutine library, you
|
|
||||||
may consider it more useful to permit linking proprietary applications with
|
|
||||||
the library. If this is what you want to do, use the GNU Lesser General
|
|
||||||
Public License instead of this License. But first, please read
|
|
||||||
<https://www.gnu.org/licenses/why-not-lgpl.html>.
|
|
||||||
|
|
21
README.md
|
@ -1,21 +0,0 @@
|
||||||
# Unfinished Multiplayer Minesweeper Prototype
|
|
||||||
Back in early 2022, I wanted to make a multiplayer version of minesweeper.
|
|
||||||
The prototype is built with TypeScript, JavaScript, Spaghetti (only partly joking about that one), HTML Canvas, and Socket.io.
|
|
||||||
|
|
||||||
to run, simply run the `build.sh` script:
|
|
||||||
```Bash
|
|
||||||
./build.sh
|
|
||||||
```
|
|
||||||
and go to `localhost:8082` in your browser.
|
|
||||||
|
|
||||||
Only a husk of the required features for this to be considered polished are implemented, but the basic outline of the game is there.
|
|
||||||
|
|
||||||
I tried building the frontend without any framework — just vanilla javascript — but got bogged down and lost interest.
|
|
||||||
|
|
||||||
Though I did not finish this project, it was a great learning experience for making a client server application.
|
|
||||||
|
|
||||||
Anyhow, instead of having to run my code on your computer, here are some screenshots showcasing the features
|
|
||||||
|
|
||||||
![Screenshot of game's main menu](screenshots/1.png)
|
|
||||||
![Screenshot of game creation screen](screenshots/2.png)
|
|
||||||
![Screenshot in game](screenshots/3.png)
|
|
14
build.sh
|
@ -1,14 +0,0 @@
|
||||||
rm -rf dist
|
|
||||||
mkdir -p dist/server
|
|
||||||
mkdir -p dist/www/
|
|
||||||
echo "Compiling SCSS......."
|
|
||||||
scss client/scss/main.scss dist/www/style.css
|
|
||||||
rm -rf .sass-cache
|
|
||||||
echo "Moving Static Webpage object to www......"
|
|
||||||
cp -r client/www/* dist/www
|
|
||||||
echo "Rolling up ES6 Modules into bundle......"
|
|
||||||
npx rollup -c
|
|
||||||
echo "Compiling TypeScript"
|
|
||||||
npx tsc
|
|
||||||
echo "Starting server on port 8082."
|
|
||||||
node dist/server/main.js
|
|
|
@ -1 +0,0 @@
|
||||||
export const IP_ADDRESS = 'http://localhost:8082/';
|
|
|
@ -1,5 +0,0 @@
|
||||||
import './display/draw.js';
|
|
||||||
import './game/game.js'
|
|
||||||
import './interface/mainmenu/menu.js'
|
|
||||||
import './net/netcode.js'
|
|
||||||
import './interface/game/mouse.js'
|
|
|
@ -1,12 +0,0 @@
|
||||||
import * as net from "../../net/netcode.js"
|
|
||||||
import {Picker} from "./picker.js"
|
|
||||||
import {tileArray, menuArray} from "../../display/tileRenderer.js"
|
|
||||||
import * as util from "../../util.js"
|
|
||||||
import {ID} from "../../util.js"
|
|
||||||
import * as status from "../../net/status.js"
|
|
||||||
|
|
||||||
var colorPicker;
|
|
||||||
|
|
||||||
export function init(){
|
|
||||||
colorPicker = new Picker("joinGameSelectColorBar", tileArray, [8, 16], null, 0, null)
|
|
||||||
}
|
|
|
@ -1,47 +0,0 @@
|
||||||
import { ID } from "../../util.js";
|
|
||||||
export class Picker {
|
|
||||||
constructor(parentID, spriteSheet, ranges, style, selected = null, clickEvent) {
|
|
||||||
this.parentID = parentID;
|
|
||||||
this.selected = selected;
|
|
||||||
this.buttons = [];
|
|
||||||
const buttonBar = ID(parentID);
|
|
||||||
|
|
||||||
for (let i = 0; i < ranges[1] - ranges[0]; i++) {
|
|
||||||
let span = document.createElement('span');
|
|
||||||
span.className = `button ${style}`;
|
|
||||||
const n = i + ranges[0];
|
|
||||||
span.appendChild(spriteSheet[n]);
|
|
||||||
buttonBar.appendChild(span);
|
|
||||||
span.no = i;
|
|
||||||
|
|
||||||
span.addEventListener('click', e => {
|
|
||||||
this.select(e.target.no);
|
|
||||||
if (clickEvent instanceof Function) {
|
|
||||||
clickEvent();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
this.buttons.push(span);
|
|
||||||
}
|
|
||||||
if (typeof selected === "number") {
|
|
||||||
this.select(selected);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
select(number) {
|
|
||||||
const target = this.buttons[number];
|
|
||||||
this.selected = number;
|
|
||||||
ID(this.parentID).querySelectorAll('.button').forEach(item => {
|
|
||||||
item.style = "";
|
|
||||||
item.active = "false";
|
|
||||||
});
|
|
||||||
target.style = "background: #4CAF50;";
|
|
||||||
target.active = "true";
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
export function destroy(parentID) {
|
|
||||||
const buttonBar = ID(parentID);
|
|
||||||
while (buttonBar.lastChild) {
|
|
||||||
buttonBar.removeChild(buttonBar.lastChild);
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,33 +0,0 @@
|
||||||
import {ID} from "../util.js"
|
|
||||||
import * as createMenu from "./mainmenu/create.js"
|
|
||||||
import * as joinMenu from "./mainmenu/join.js"
|
|
||||||
const menu = ID('menu')
|
|
||||||
const game = ID('game')
|
|
||||||
const joinType = ID("joinType")
|
|
||||||
const joinGameMenu = ID("joinGame")
|
|
||||||
const createGameMenu = ID("createGame")
|
|
||||||
|
|
||||||
|
|
||||||
export function changeScene(scene) {
|
|
||||||
console.log(`Changing scene to ${scene}`)
|
|
||||||
switch (scene) {
|
|
||||||
case "game":
|
|
||||||
menu.style = "display: none;"
|
|
||||||
game.style = ""
|
|
||||||
break;
|
|
||||||
case "mainmenu":
|
|
||||||
menu.style = ""
|
|
||||||
game.style = "display: none;"
|
|
||||||
break;
|
|
||||||
case "newgame":
|
|
||||||
joinType.style.display = "none";
|
|
||||||
createGameMenu.style.display = "";
|
|
||||||
createMenu.init();
|
|
||||||
break;
|
|
||||||
case "joingame":
|
|
||||||
joinType.style.display = "none";
|
|
||||||
joinGameMenu.style.display = "";
|
|
||||||
joinMenu.init();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
};
|
|
|
@ -1,11 +0,0 @@
|
||||||
canvas {
|
|
||||||
-webkit-user-select: none; /* Chrome all / Safari all */
|
|
||||||
-moz-user-select: none; /* Firefox all */
|
|
||||||
-ms-user-select: none; /* IE 10+ */
|
|
||||||
-o-user-select: none;
|
|
||||||
user-select: none;
|
|
||||||
image-rendering: -moz-crisp-edges;
|
|
||||||
image-rendering: -webkit-crisp-edges;
|
|
||||||
image-rendering: pixelated;
|
|
||||||
image-rendering: crisp-edges;
|
|
||||||
}
|
|
|
@ -1,42 +0,0 @@
|
||||||
|
|
||||||
span.button > img {
|
|
||||||
pointer-events: none;
|
|
||||||
image-rendering: optimizeSpeed; /* STOP SMOOTHING, GIVE ME SPEED */
|
|
||||||
image-rendering: -moz-crisp-edges; /* Firefox */
|
|
||||||
image-rendering: -o-crisp-edges; /* Opera */
|
|
||||||
image-rendering: -webkit-optimize-contrast; /* Chrome (and eventually Safari) */
|
|
||||||
image-rendering: pixelated; /* Chrome */
|
|
||||||
width: 70px;
|
|
||||||
height: 70px;
|
|
||||||
transform: translate(0, 10px);
|
|
||||||
background: lightgray;
|
|
||||||
}
|
|
||||||
|
|
||||||
span.button.wide {
|
|
||||||
width: 128px;
|
|
||||||
height: 128px;
|
|
||||||
}
|
|
||||||
|
|
||||||
span.button.wide > img {
|
|
||||||
width: 108px;
|
|
||||||
height: 108px;
|
|
||||||
}
|
|
||||||
|
|
||||||
span.button {
|
|
||||||
-webkit-user-select: none;
|
|
||||||
-moz-user-select: none;
|
|
||||||
-ms-user-select: none;
|
|
||||||
user-select: none;
|
|
||||||
display: inline-block;
|
|
||||||
background: lightgray;
|
|
||||||
width:90px;
|
|
||||||
height:90px;
|
|
||||||
margin: 5px 5px 5px 5px;
|
|
||||||
border-radius: 1px;
|
|
||||||
cursor: pointer;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
span.button:hover {
|
|
||||||
background: gray;
|
|
||||||
}
|
|
|
@ -1,9 +0,0 @@
|
||||||
@font-face {
|
|
||||||
font-family: "moderndos";
|
|
||||||
src: url('fonts/moderndos.woff2') format('woff2'),
|
|
||||||
url('fonts/moderndos.ttf') format('truetype');
|
|
||||||
}
|
|
||||||
|
|
||||||
* {
|
|
||||||
font-family: moderndos;
|
|
||||||
}
|
|
|
@ -1,14 +0,0 @@
|
||||||
input.codeInput {
|
|
||||||
width: inherit !important;
|
|
||||||
text-align: center;
|
|
||||||
padding-top: 20px !important;
|
|
||||||
padding-bottom: 20px !important;
|
|
||||||
border-radius: 2px;
|
|
||||||
outline: solid gray 2px;
|
|
||||||
font-size: 4.8em;
|
|
||||||
}
|
|
||||||
|
|
||||||
.codeContainer > button {
|
|
||||||
max-width: auto !important;
|
|
||||||
width: inherit !important;
|
|
||||||
}
|
|
|
@ -1,135 +0,0 @@
|
||||||
@import "createGame.scss";
|
|
||||||
@import "font.scss";
|
|
||||||
@import "canvas.scss";
|
|
||||||
@import "slider.scss";
|
|
||||||
@import "joinGame.scss";
|
|
||||||
|
|
||||||
|
|
||||||
h1, h2, h3 {
|
|
||||||
margin: 0px;
|
|
||||||
}
|
|
||||||
|
|
||||||
h1 {
|
|
||||||
font-size: 3em;
|
|
||||||
}
|
|
||||||
|
|
||||||
h2 {
|
|
||||||
font-size: 2.5em;
|
|
||||||
}
|
|
||||||
h3 {
|
|
||||||
font-size: 2em;
|
|
||||||
}
|
|
||||||
|
|
||||||
p, span, input, button, u {
|
|
||||||
font-size: 1.7em;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
hr {
|
|
||||||
border-color: white;
|
|
||||||
/* height: 3px; */
|
|
||||||
border: none;
|
|
||||||
height: 3px;
|
|
||||||
background: white;
|
|
||||||
margin: 0px;
|
|
||||||
padding: 0px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.row {
|
|
||||||
padding: 20px;
|
|
||||||
display: flex;
|
|
||||||
justify-content:space-between;
|
|
||||||
align-items: center;
|
|
||||||
}
|
|
||||||
|
|
||||||
.row > span {
|
|
||||||
margin-left: 20px;
|
|
||||||
margin-right: 20px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.leftRight {
|
|
||||||
display: flex;
|
|
||||||
justify-content: center;
|
|
||||||
flex-wrap: wrap;
|
|
||||||
}
|
|
||||||
|
|
||||||
.centerBar {
|
|
||||||
width: 3px;
|
|
||||||
height: inherit;
|
|
||||||
background: white
|
|
||||||
}
|
|
||||||
|
|
||||||
.right {
|
|
||||||
display: inline;
|
|
||||||
margin: 40px;
|
|
||||||
/* background: orange; */
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
.left {
|
|
||||||
display: inline;
|
|
||||||
margin: 40px;
|
|
||||||
/* background: red; */
|
|
||||||
}
|
|
||||||
|
|
||||||
.codeContainer {
|
|
||||||
margin-right: auto;
|
|
||||||
margin-left: auto;
|
|
||||||
margin-top: 20px;
|
|
||||||
margin-bottom: 20px;
|
|
||||||
display: block;
|
|
||||||
position: relative;
|
|
||||||
/* background: red; */
|
|
||||||
width: 700px;
|
|
||||||
}
|
|
||||||
|
|
||||||
input {
|
|
||||||
text-align: center;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
input[type=button], button, .buttonLink {
|
|
||||||
width: 50%;
|
|
||||||
background-color: #4CAF50;
|
|
||||||
color: white;
|
|
||||||
padding: 14px 20px;
|
|
||||||
margin: 8px 0;
|
|
||||||
border: none;
|
|
||||||
cursor: pointer; }
|
|
||||||
|
|
||||||
input[type=number], input[type=text] {
|
|
||||||
/* width: 100%; */
|
|
||||||
width: 300px;
|
|
||||||
display: inline-block;
|
|
||||||
padding: 12px 20px;
|
|
||||||
margin: 3px 0;
|
|
||||||
border: none;
|
|
||||||
box-sizing: border-box;
|
|
||||||
background-color: lightgray; }
|
|
||||||
|
|
||||||
|
|
||||||
.canvasStack {
|
|
||||||
background: darkslategray;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
main {
|
|
||||||
margin-left: auto;
|
|
||||||
margin-right: auto;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
.hidden {
|
|
||||||
display: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
body {
|
|
||||||
text-align: center;
|
|
||||||
background-color: #2c2f33;
|
|
||||||
color: white;
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,40 +0,0 @@
|
||||||
.sliderNumber {
|
|
||||||
position: absolute;
|
|
||||||
-webkit-user-select: none;
|
|
||||||
-moz-user-select: none;
|
|
||||||
-ms-user-select: none;
|
|
||||||
user-select: none;
|
|
||||||
color: black;
|
|
||||||
font-size: 1.7em;
|
|
||||||
pointer-events: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
.sliderContainer {
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
justify-content: center;
|
|
||||||
}
|
|
||||||
|
|
||||||
.slider {
|
|
||||||
-webkit-appearance: none;
|
|
||||||
appearance: none;
|
|
||||||
height: 55px;
|
|
||||||
width: 300px;
|
|
||||||
background-color: lightgray;
|
|
||||||
}
|
|
||||||
|
|
||||||
.slider::-webkit-slider-thumb {
|
|
||||||
-webkit-appearance: none;
|
|
||||||
appearance: none;
|
|
||||||
width: 20px;
|
|
||||||
height: 60px;
|
|
||||||
background: #f1f8t6;
|
|
||||||
cursor: pointer;
|
|
||||||
}
|
|
||||||
.slider::-moz-range-thumb {
|
|
||||||
width: 20px;
|
|
||||||
height: 60px;
|
|
||||||
border-radius: 0px;
|
|
||||||
background: #f1f8t6;
|
|
||||||
cursor: pointer;
|
|
||||||
}
|
|
BIN
client/www/fonts/pixerif.woff2
Normal file
BIN
client/www/fonts/pixserif.ttf
Normal file
|
@ -2,9 +2,10 @@
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<title></title>
|
<title></title>
|
||||||
|
<script src="http://localhost:35729/livereload.js" charset="utf-8"></script>
|
||||||
<script type="text/javascript" src="socket.io.min.js"></script>
|
<script type="text/javascript" src="socket.io.min.js"></script>
|
||||||
<link rel="stylesheet" href="style.css">
|
<link rel="stylesheet" href="style.css">
|
||||||
<script src='index.js' type="module"></script>
|
<script src='scripts/script.js' type="module"></script>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<!-- Canvas used to generate individual sprites off one sprite atlas -->
|
<!-- Canvas used to generate individual sprites off one sprite atlas -->
|
||||||
|
@ -44,8 +45,6 @@
|
||||||
</div>
|
</div>
|
||||||
<div id="joinGame" style="display: none;">
|
<div id="joinGame" style="display: none;">
|
||||||
<input type="text" id="joinGameCode" value="">
|
<input type="text" id="joinGameCode" value="">
|
||||||
<u>Color</u>
|
|
||||||
<div id="joinGameSelectColorBar"></div>
|
|
||||||
<input type="text" id="joinGameUsername" value="">
|
<input type="text" id="joinGameUsername" value="">
|
||||||
<button type="button" id="joinGameButton">Join</button>
|
<button type="button" id="joinGameButton">Join</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
import {tileArray} from './tileRenderer.js';
|
import {tileArray} from './tileRenderer.js';
|
||||||
|
import { cursor } from '../interface/game/mouse.js'
|
||||||
import { ctx} from './html.js';
|
import { ctx} from './html.js';
|
||||||
import { game } from '../game/game.js'
|
import { game } from '../game/game.js'
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
import {game} from "../game/game.js"
|
||||||
|
|
||||||
export var canvas = document.getElementById('canvas');
|
export var canvas = document.getElementById('canvas');
|
||||||
export var ctx = canvas.getContext('2d');
|
export var ctx = canvas.getContext('2d');
|
||||||
export var wrapper = document.getElementById('game');
|
export var wrapper = document.getElementById('game');
|
|
@ -1,4 +1,4 @@
|
||||||
import {game} from "../game/game.js"
|
import {game} from "/scripts/game/game.js"
|
||||||
|
|
||||||
export const tileArray = loadSprites('/img/mine.png', game.tileSize);
|
export const tileArray = loadSprites('/img/mine.png', game.tileSize);
|
||||||
var counter = 0;
|
var counter = 0;
|
1
client/www/scripts/env.js
Normal file
|
@ -0,0 +1 @@
|
||||||
|
export const IP_ADDRESS = 'http://localhost:8082/'
|
|
@ -18,7 +18,7 @@ export function illegalAction(data) {
|
||||||
action = "Invalid Placement location."
|
action = "Invalid Placement location."
|
||||||
break;
|
break;
|
||||||
case 100:
|
case 100:
|
||||||
action = "Malformed Socket Request"
|
action = "Malformed Packet"
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
action = "Unknown action."
|
action = "Unknown action."
|
|
@ -1,5 +1,5 @@
|
||||||
import {game} from "../../game/game.js";
|
import {game} from "../../game/game.js";
|
||||||
import * as net from "../../net/netcode.js";
|
import { clickCanvas } from "/scripts/net/netcode.js";
|
||||||
import { canvas } from "../../display/html.js"
|
import { canvas } from "../../display/html.js"
|
||||||
|
|
||||||
class Cursor {
|
class Cursor {
|
||||||
|
@ -17,8 +17,9 @@ canvas.addEventListener('mousemove', e => {
|
||||||
mouseMoved(e)
|
mouseMoved(e)
|
||||||
});
|
});
|
||||||
|
|
||||||
canvas.addEventListener("mousedown", e => {
|
canvas.addEventListener("mousedown", function(e)
|
||||||
getMousePosition(e);
|
{
|
||||||
|
getMousePosition(canvas, e);
|
||||||
});
|
});
|
||||||
|
|
||||||
function mouseMoved(event) {
|
function mouseMoved(event) {
|
||||||
|
@ -34,7 +35,7 @@ function mouseMoved(event) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function getMousePosition(event) {
|
function getMousePosition(canvas, event) {
|
||||||
const tileSize = game.tileSize
|
const tileSize = game.tileSize
|
||||||
// Get mouse position on canvas
|
// Get mouse position on canvas
|
||||||
const rect = canvas.getBoundingClientRect();
|
const rect = canvas.getBoundingClientRect();
|
||||||
|
@ -47,6 +48,6 @@ function getMousePosition(event) {
|
||||||
|
|
||||||
console.log("Click!")
|
console.log("Click!")
|
||||||
console.log(xu,yu)
|
console.log(xu,yu)
|
||||||
net.clickCanvas({tilePosition: [xu,yu], mode: button})
|
clickCanvas({tilePosition: [xu,yu], mode: button})
|
||||||
|
|
||||||
}
|
}
|
|
@ -1,9 +1,10 @@
|
||||||
import * as net from "../../net/netcode.js"
|
import {joinGame, createGame} from "/scripts/net/netcode.js"
|
||||||
|
import { changeScene } from "/scripts/interface/scene.js"
|
||||||
import {Picker} from "./picker.js"
|
import {Picker} from "./picker.js"
|
||||||
import {tileArray, menuArray} from "../../display/tileRenderer.js"
|
import {tileArray, menuArray} from "/scripts/display/tileRenderer.js"
|
||||||
import * as util from "../../util.js"
|
import * as util from "/scripts/util.js"
|
||||||
import {ID} from "../../util.js"
|
import {ID} from "/scripts/util.js"
|
||||||
import * as status from "../../net/status.js"
|
import * as status from "/scripts/net/status.js"
|
||||||
|
|
||||||
var menuPicker, colorPicker;
|
var menuPicker, colorPicker;
|
||||||
|
|
||||||
|
@ -14,7 +15,7 @@ export function init(){
|
||||||
}
|
}
|
||||||
|
|
||||||
ID("createRoomButton").addEventListener("click", e => {
|
ID("createRoomButton").addEventListener("click", e => {
|
||||||
createGameClick(e)
|
create(e)
|
||||||
});
|
});
|
||||||
|
|
||||||
const mineSlider = ID("createGameOptionsMinePercent")
|
const mineSlider = ID("createGameOptionsMinePercent")
|
||||||
|
@ -119,16 +120,16 @@ function updateCount(mode) {
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (mode === 2) {
|
else if (mode === 2) {
|
||||||
if (mines > max) {
|
if (mines > max) {
|
||||||
mines = max
|
mines = max
|
||||||
}
|
}
|
||||||
if (mines < min) {
|
if (mines < min) {
|
||||||
mines = min
|
mines = min
|
||||||
}
|
}
|
||||||
percentage = Math.floor((mines / (width * height)) * 1000)/ 10
|
percentage = Math.floor((mines / (width * height)) * 1000)/ 10
|
||||||
mineBox.value = mines;
|
mineBox.value = mines;
|
||||||
mineSlider.value = percentage * 10
|
mineSlider.value = percentage * 10
|
||||||
updatePercentageLabel(percentage)
|
updatePercentageLabel(percentage)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -149,14 +150,25 @@ function updatePercentageLabel(percentage) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function createGameClick(event) {
|
function create(event) {
|
||||||
const name = ID("createGameUsername").value
|
const name = ID("createGameUsername").value
|
||||||
const width = Number(widthBox.value);
|
const mines = ID("createGameOptionsMines").value
|
||||||
const height = Number(heightBox.value);
|
const width = widthBox.value;
|
||||||
const color = Number(colorPicker.selected + 1);
|
const height = heightBox.value;
|
||||||
|
const color = colorPicker.selected
|
||||||
if (name == '' || mines == '' || width == '' || height == '' || status.get() == 'disconnected') return
|
if (name == '' || mines == '' || width == '' || height == '' || status.get() == 'disconnected') return
|
||||||
const options = { mines: mines, width: width, height: height};
|
const options = {
|
||||||
const data = {name: name, color: color, options: options};
|
mines: mines,
|
||||||
net.createGame(data)
|
width: width,
|
||||||
|
height: height
|
||||||
|
}
|
||||||
|
const data =
|
||||||
|
{
|
||||||
|
name: name,
|
||||||
|
color: color,
|
||||||
|
options: options
|
||||||
|
}
|
||||||
|
console.log(data)
|
||||||
|
createGame(data)
|
||||||
|
|
||||||
}
|
}
|
|
@ -1,9 +1,15 @@
|
||||||
import * as status from "../../net/status.js"
|
import * as status from "../../net/status.js"
|
||||||
import {joinGame, initJoin} from "../../net/netcode.js"
|
import {joinGame, createGame} from "/scripts/net/netcode.js"
|
||||||
import { changeScene } from "../scene.js"
|
import { changeScene } from "/scripts/interface/scene.js"
|
||||||
|
import * as createMenu from "./create.js"
|
||||||
|
|
||||||
import {ID} from "../../util.js"
|
function ID(id) {
|
||||||
|
return document.getElementById(id)
|
||||||
|
}
|
||||||
|
|
||||||
|
const joinType = ID("joinType")
|
||||||
|
const joinGameMenu = ID("joinGame")
|
||||||
|
const createGameMenu = ID("createGame")
|
||||||
const codeInput = ID("joinGameCode")
|
const codeInput = ID("joinGameCode")
|
||||||
|
|
||||||
codeInput.addEventListener("input", e => {
|
codeInput.addEventListener("input", e => {
|
||||||
|
@ -12,12 +18,14 @@ codeInput.addEventListener("input", e => {
|
||||||
|
|
||||||
|
|
||||||
ID("gotoCreate").addEventListener("click", e => {
|
ID("gotoCreate").addEventListener("click", e => {
|
||||||
changeScene("newgame")
|
joinType.style.display = "none"
|
||||||
|
createGameMenu.style.display = ""
|
||||||
|
createMenu.init()
|
||||||
})
|
})
|
||||||
|
|
||||||
ID("gotoJoin").addEventListener("click", e => {
|
ID("gotoJoin").addEventListener("click", e => {
|
||||||
if (codeInput.value.length !== 6) return console.log("error")
|
joinType.style.display = "none"
|
||||||
initJoin(codeInput.value)
|
joinGameMenu.style.display = "";
|
||||||
})
|
})
|
||||||
|
|
||||||
ID("joinGameButton").addEventListener("click", e => {
|
ID("joinGameButton").addEventListener("click", e => {
|
46
client/www/scripts/interface/mainmenu/picker.js
Normal file
|
@ -0,0 +1,46 @@
|
||||||
|
export class Picker {
|
||||||
|
constructor(parentID, spriteSheet, ranges, style, selected = null, clickEvent){
|
||||||
|
this.parentID = parentID
|
||||||
|
this.selected = selected;
|
||||||
|
this.buttons = []
|
||||||
|
const buttonBar = document.getElementById(parentID);
|
||||||
|
|
||||||
|
for(let i=0;i < ranges[1]-ranges[0];i++) {
|
||||||
|
let span = document.createElement('span')
|
||||||
|
span.className = `button ${style}`
|
||||||
|
const n = i + ranges[0]
|
||||||
|
span.appendChild(spriteSheet[n]);
|
||||||
|
buttonBar.appendChild(span);
|
||||||
|
span.no = i;
|
||||||
|
|
||||||
|
span.addEventListener('click', e => {
|
||||||
|
this.select(e.target.no);
|
||||||
|
if (clickEvent instanceof Function) {
|
||||||
|
clickEvent()
|
||||||
|
}
|
||||||
|
});
|
||||||
|
this.buttons.push(span)
|
||||||
|
};
|
||||||
|
if (typeof selected ==="number") {
|
||||||
|
this.select(selected)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
select(number) {
|
||||||
|
const target = this.buttons[number]
|
||||||
|
this.selected = number
|
||||||
|
document.getElementById(this.parentID).querySelectorAll('.button').forEach(item => {
|
||||||
|
item.style ="";
|
||||||
|
item.active ="false";
|
||||||
|
})
|
||||||
|
target.style = "background: #4CAF50;"
|
||||||
|
target.active = "true"
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
export function destroy(parentID) {
|
||||||
|
const buttonBar = document.getElementById(parentID);
|
||||||
|
while (buttonBar.lastChild) {
|
||||||
|
buttonBar.removeChild(buttonBar.lastChild)
|
||||||
|
}
|
||||||
|
}
|
13
client/www/scripts/interface/scene.js
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
|
||||||
|
export function changeScene(scene) {
|
||||||
|
if (scene == "game") {
|
||||||
|
document.getElementById('menu').style = "display: none;"
|
||||||
|
document.getElementById('game').style = ""
|
||||||
|
// picker.create();
|
||||||
|
}
|
||||||
|
if (scene == "mainmenu") {
|
||||||
|
document.getElementById('menu').style = ""
|
||||||
|
document.getElementById('game').style = "display: none;"
|
||||||
|
// picker.destroy();
|
||||||
|
}
|
||||||
|
};
|
|
@ -1,9 +1,9 @@
|
||||||
import * as env from "../env.js"
|
import * as env from "/scripts/env.js"
|
||||||
import * as status from "./status.js"
|
import * as status from "/scripts/net/status.js"
|
||||||
import {game} from "../game/game.js"
|
import {game} from "/scripts/game/game.js"
|
||||||
import {render} from "../display/draw.js"
|
import {render} from "/scripts/display/draw.js"
|
||||||
import { changeScene } from "../interface/scene.js"
|
import { changeScene } from "/scripts/interface/scene.js"
|
||||||
import { illegalAction } from "../illegalaction.js"
|
import { illegalAction } from "/scripts/interface/common/illegalaction.js"
|
||||||
|
|
||||||
export var socket = io.connect(env.IP_ADDRESS);
|
export var socket = io.connect(env.IP_ADDRESS);
|
||||||
|
|
||||||
|
@ -11,10 +11,6 @@ export function joinGame(data){
|
||||||
socket.emit('joinGame', data);
|
socket.emit('joinGame', data);
|
||||||
}
|
}
|
||||||
|
|
||||||
export function initJoin(code){
|
|
||||||
socket.emit('initJoin', code)
|
|
||||||
}
|
|
||||||
|
|
||||||
export function createGame(data){
|
export function createGame(data){
|
||||||
socket.emit('createGame', data);
|
socket.emit('createGame', data);
|
||||||
}
|
}
|
||||||
|
@ -68,5 +64,6 @@ socket.on('inGame', function(data){
|
||||||
|
|
||||||
socket.on('sync', function (sync){
|
socket.on('sync', function (sync){
|
||||||
game.world = sync.world;
|
game.world = sync.world;
|
||||||
|
console.log(game.world)
|
||||||
render()
|
render()
|
||||||
})
|
})
|
|
@ -1,4 +1,4 @@
|
||||||
import {updateConnectionStatus} from "../interface/game/connection.js"
|
import {updateConnectionStatus} from "/scripts/interface/game/connection.js"
|
||||||
|
|
||||||
var SERVER_CONNECTION = "disconnected"
|
var SERVER_CONNECTION = "disconnected"
|
||||||
|
|
4
client/www/scripts/script.js
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
import '/scripts/display/draw.js';
|
||||||
|
import '/scripts/game/game.js'
|
||||||
|
import '/scripts/interface/mainmenu/menu.js'
|
||||||
|
import "/scripts/net/netcode.js"
|
258
client/www/style.css
Normal file
|
@ -0,0 +1,258 @@
|
||||||
|
@font-face {
|
||||||
|
/* font-weight: 500; */
|
||||||
|
font-family: "moderndos";
|
||||||
|
src: url('fonts/moderndos.woff2') format('woff2'),
|
||||||
|
url('fonts/moderndos.ttf') format('truetype');
|
||||||
|
}
|
||||||
|
|
||||||
|
* {
|
||||||
|
font-family: moderndos;
|
||||||
|
}
|
||||||
|
|
||||||
|
h1, h2, h3 {
|
||||||
|
margin: 0px;
|
||||||
|
}
|
||||||
|
|
||||||
|
h1 {
|
||||||
|
font-size: 3em;
|
||||||
|
}
|
||||||
|
|
||||||
|
h2 {
|
||||||
|
font-size: 2.5em;
|
||||||
|
}
|
||||||
|
h3 {
|
||||||
|
font-size: 2em;
|
||||||
|
}
|
||||||
|
|
||||||
|
p, span, input, button, u {
|
||||||
|
font-size: 1.7em;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
hr {
|
||||||
|
border-color: white;
|
||||||
|
/* height: 3px; */
|
||||||
|
border: none;
|
||||||
|
height: 3px;
|
||||||
|
background: white;
|
||||||
|
margin: 0px;
|
||||||
|
padding: 0px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.row {
|
||||||
|
padding: 20px;
|
||||||
|
display: flex;
|
||||||
|
justify-content:space-between;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.row > span {
|
||||||
|
margin-left: 20px;
|
||||||
|
margin-right: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.leftRight {
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
}
|
||||||
|
|
||||||
|
.centerBar {
|
||||||
|
width: 3px;
|
||||||
|
height: inherit;
|
||||||
|
background: white
|
||||||
|
}
|
||||||
|
|
||||||
|
.right {
|
||||||
|
display: inline;
|
||||||
|
margin: 40px;
|
||||||
|
/* background: orange; */
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
.left {
|
||||||
|
display: inline;
|
||||||
|
margin: 40px;
|
||||||
|
/* background: red; */
|
||||||
|
}
|
||||||
|
|
||||||
|
.codeContainer {
|
||||||
|
margin-right: auto;
|
||||||
|
margin-left: auto;
|
||||||
|
margin-top: 20px;
|
||||||
|
margin-bottom: 20px;
|
||||||
|
display: block;
|
||||||
|
position: relative;
|
||||||
|
/* background: red; */
|
||||||
|
width: 700px;
|
||||||
|
}
|
||||||
|
|
||||||
|
input {
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
input.codeInput {
|
||||||
|
width: inherit !important;
|
||||||
|
text-align: center;
|
||||||
|
padding-top: 20px !important;
|
||||||
|
padding-bottom: 20px !important;
|
||||||
|
border-radius: 2px;
|
||||||
|
outline: solid gray 2px;
|
||||||
|
font-size: 4.8em;
|
||||||
|
}
|
||||||
|
|
||||||
|
.codeContainer > button {
|
||||||
|
max-width: auto !important;
|
||||||
|
width: inherit !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sliderNumber {
|
||||||
|
position: absolute;
|
||||||
|
-webkit-user-select: none;
|
||||||
|
-moz-user-select: none;
|
||||||
|
-ms-user-select: none;
|
||||||
|
user-select: none;
|
||||||
|
color: black;
|
||||||
|
font-size: 1.7em;
|
||||||
|
pointer-events: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sliderContainer {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.slider {
|
||||||
|
-webkit-appearance: none;
|
||||||
|
appearance: none;
|
||||||
|
height: 55px;
|
||||||
|
width: 300px;
|
||||||
|
background-color: lightgray;
|
||||||
|
}
|
||||||
|
|
||||||
|
.slider::-webkit-slider-thumb {
|
||||||
|
-webkit-appearance: none;
|
||||||
|
appearance: none;
|
||||||
|
width: 20px;
|
||||||
|
height: 60px;
|
||||||
|
background: #f1f8t6;
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
.slider::-moz-range-thumb {
|
||||||
|
width: 20px;
|
||||||
|
height: 60px;
|
||||||
|
border-radius: 0px;
|
||||||
|
background: #f1f8t6;
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
|
||||||
|
input[type=button], button, .buttonLink {
|
||||||
|
width: 50%;
|
||||||
|
background-color: #4CAF50;
|
||||||
|
color: white;
|
||||||
|
padding: 14px 20px;
|
||||||
|
margin: 8px 0;
|
||||||
|
border: none;
|
||||||
|
cursor: pointer; }
|
||||||
|
|
||||||
|
input[type=number], input[type=text] {
|
||||||
|
/* width: 100%; */
|
||||||
|
width: 300px;
|
||||||
|
display: inline-block;
|
||||||
|
padding: 12px 20px;
|
||||||
|
margin: 3px 0;
|
||||||
|
border: none;
|
||||||
|
box-sizing: border-box;
|
||||||
|
background-color: lightgray; }
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
span.button > img {
|
||||||
|
pointer-events: none;
|
||||||
|
image-rendering: optimizeSpeed; /* STOP SMOOTHING, GIVE ME SPEED */
|
||||||
|
image-rendering: -moz-crisp-edges; /* Firefox */
|
||||||
|
image-rendering: -o-crisp-edges; /* Opera */
|
||||||
|
image-rendering: -webkit-optimize-contrast; /* Chrome (and eventually Safari) */
|
||||||
|
image-rendering: pixelated; /* Chrome */
|
||||||
|
width: 70px;
|
||||||
|
height: 70px;
|
||||||
|
transform: translate(0, 10px);
|
||||||
|
background: lightgray;
|
||||||
|
}
|
||||||
|
|
||||||
|
span.button.wide {
|
||||||
|
width: 128px;
|
||||||
|
height: 128px;
|
||||||
|
}
|
||||||
|
|
||||||
|
span.button.wide > img {
|
||||||
|
width: 108px;
|
||||||
|
height: 108px;
|
||||||
|
}
|
||||||
|
|
||||||
|
span.button {
|
||||||
|
-webkit-user-select: none;
|
||||||
|
-moz-user-select: none;
|
||||||
|
-ms-user-select: none;
|
||||||
|
user-select: none;
|
||||||
|
display: inline-block;
|
||||||
|
background: lightgray;
|
||||||
|
width:90px;
|
||||||
|
height:90px;
|
||||||
|
margin: 5px 5px 5px 5px;
|
||||||
|
border-radius: 1px;
|
||||||
|
cursor: pointer;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
span.button:hover {
|
||||||
|
background: gray;
|
||||||
|
}
|
||||||
|
|
||||||
|
.canvas1{
|
||||||
|
z-index: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.canvas3 {
|
||||||
|
z-index: 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
.canvasStack {
|
||||||
|
|
||||||
|
/* top: 50px; */
|
||||||
|
|
||||||
|
background: darkslategray;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
main {
|
||||||
|
|
||||||
|
margin-left: auto;
|
||||||
|
margin-right: auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
canvas {
|
||||||
|
-webkit-user-select: none; /* Chrome all / Safari all */
|
||||||
|
-moz-user-select: none; /* Firefox all */
|
||||||
|
-ms-user-select: none; /* IE 10+ */
|
||||||
|
-o-user-select: none;
|
||||||
|
user-select: none;
|
||||||
|
image-rendering: -moz-crisp-edges;
|
||||||
|
image-rendering: -webkit-crisp-edges;
|
||||||
|
image-rendering: pixelated;
|
||||||
|
image-rendering: crisp-edges;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
.hidden {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
body {
|
||||||
|
text-align: center;
|
||||||
|
background-color: #2c2f33;
|
||||||
|
color: white;
|
||||||
|
|
||||||
|
}
|
213
client/www/styleold.css
Normal file
|
@ -0,0 +1,213 @@
|
||||||
|
|
||||||
|
/* #mydiv {
|
||||||
|
position: absolute;
|
||||||
|
cursor: move;
|
||||||
|
z-index: 10;
|
||||||
|
background: coral;
|
||||||
|
width: 30px;
|
||||||
|
height: 30px;
|
||||||
|
border: 1px solid #d3d3d3;
|
||||||
|
} */
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
span.button > img {
|
||||||
|
pointer-events: none;
|
||||||
|
image-rendering: optimizeSpeed; /* STOP SMOOTHING, GIVE ME SPEED */
|
||||||
|
image-rendering: -moz-crisp-edges; /* Firefox */
|
||||||
|
image-rendering: -o-crisp-edges; /* Opera */
|
||||||
|
image-rendering: -webkit-optimize-contrast; /* Chrome (and eventually Safari) */
|
||||||
|
image-rendering: pixelated; /* Chrome */
|
||||||
|
-ms-interpolation-mode: nearest-neighbor; /* IE8+ */
|
||||||
|
width: 70px;
|
||||||
|
height: 70px;
|
||||||
|
transform: translate(0, 8px);
|
||||||
|
border: 2px solid darkgray;
|
||||||
|
border-radius: 4px;
|
||||||
|
background: lightgray;
|
||||||
|
}
|
||||||
|
|
||||||
|
span.button {
|
||||||
|
-webkit-user-select: none;
|
||||||
|
-moz-user-select: none;
|
||||||
|
-ms-user-select: none;
|
||||||
|
user-select: none;
|
||||||
|
display: inline-block;
|
||||||
|
background: tan;
|
||||||
|
width:90px;
|
||||||
|
height:90px;
|
||||||
|
margin: 5px 5px 5px 5px;
|
||||||
|
vertical-align: middle;
|
||||||
|
border-radius: 3px;
|
||||||
|
white-space: normal;
|
||||||
|
align-items: center;
|
||||||
|
cursor: pointer;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
span.button:hover {
|
||||||
|
background: gray;
|
||||||
|
}
|
||||||
|
|
||||||
|
.canvas1{
|
||||||
|
z-index: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.canvas3 {
|
||||||
|
z-index: 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
.canvasStack {
|
||||||
|
|
||||||
|
/* top: 50px; */
|
||||||
|
|
||||||
|
background: darkslategray;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#wrapper {
|
||||||
|
|
||||||
|
/* display: flex; */
|
||||||
|
/* justify-content: right; */
|
||||||
|
/* left: 50%; */
|
||||||
|
/* transform: translate(-50%, 0); */
|
||||||
|
/* position: absolute; */
|
||||||
|
background: khaki;
|
||||||
|
width: 750px;
|
||||||
|
height: 750px;
|
||||||
|
}
|
||||||
|
|
||||||
|
#wrapwrap {
|
||||||
|
display: block;
|
||||||
|
margin: 0 auto;
|
||||||
|
margin-left: auto;
|
||||||
|
margin-right: auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
main {
|
||||||
|
|
||||||
|
margin-left: auto;
|
||||||
|
margin-right: auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
canvas {
|
||||||
|
-webkit-user-select: none; /* Chrome all / Safari all */
|
||||||
|
-moz-user-select: none; /* Firefox all */
|
||||||
|
-ms-user-select: none; /* IE 10+ */
|
||||||
|
-o-user-select: none;
|
||||||
|
user-select: none;
|
||||||
|
image-rendering: -moz-crisp-edges;
|
||||||
|
image-rendering: -webkit-crisp-edges;
|
||||||
|
image-rendering: pixelated;
|
||||||
|
image-rendering: crisp-edges;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
.hidden {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
body {
|
||||||
|
text-align: center;
|
||||||
|
background-color: #2c2f33;
|
||||||
|
color: white;
|
||||||
|
font-variant: normal;
|
||||||
|
font-family: verdana;
|
||||||
|
}
|
||||||
|
|
||||||
|
h1 {
|
||||||
|
font-size: 25pt;
|
||||||
|
|
||||||
|
}
|
||||||
|
h2 {
|
||||||
|
font-size: 20pt;
|
||||||
|
}
|
||||||
|
p{
|
||||||
|
/* font-size: 12pt; */
|
||||||
|
/* text-align: left; */
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
h4 {
|
||||||
|
font-size: 12pt;
|
||||||
|
padding: 0;
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.startButton {
|
||||||
|
width: 100.5%;
|
||||||
|
background-color: #4CAF50;
|
||||||
|
color: white;
|
||||||
|
padding-top: 14px;
|
||||||
|
padding-bottom: 14px;
|
||||||
|
margin-top: 4px;
|
||||||
|
margin-bottom: 4px;
|
||||||
|
border: none;
|
||||||
|
border-radius: 4px;
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
|
||||||
|
.subSection {
|
||||||
|
width: 100%;
|
||||||
|
text-align: center;
|
||||||
|
font-size: 12pt;
|
||||||
|
color: white;
|
||||||
|
padding: 0;
|
||||||
|
background-color: #4d5259;
|
||||||
|
border-style: solid;
|
||||||
|
border: solid white;
|
||||||
|
border-radius: 6px;
|
||||||
|
padding-bottom: 2px;
|
||||||
|
padding-top: 2px;
|
||||||
|
margin-top: 3px;
|
||||||
|
margin-bottom: 3px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.slider {
|
||||||
|
-webkit-appearance: none;
|
||||||
|
width: 98%;
|
||||||
|
background: none;
|
||||||
|
outline: none;
|
||||||
|
margin-top: 10px;
|
||||||
|
margin-bottom: 10px;
|
||||||
|
height: 1px;
|
||||||
|
border: 2px solid #white;
|
||||||
|
background-color: #fff;
|
||||||
|
}
|
||||||
|
|
||||||
|
.slider::-webkit-slider-thumb {
|
||||||
|
-webkit-appearance: none;
|
||||||
|
border: 1px solid #bdc3c7;
|
||||||
|
width: 20px;
|
||||||
|
height: 20px;
|
||||||
|
background: #4CAF50;
|
||||||
|
border-radius: 3px;
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
|
||||||
|
.slider::-moz-range-thumb {
|
||||||
|
border: 1px solid #bdc3c7;
|
||||||
|
width: 20px;
|
||||||
|
height: 20px;
|
||||||
|
background: #4CAF50;
|
||||||
|
border-radius: 3px;
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
|
||||||
|
.slider::-moz-range-track {
|
||||||
|
width: 100%;
|
||||||
|
height: 5px;
|
||||||
|
background-color: #fff;
|
||||||
|
}
|
||||||
|
|
||||||
|
span.spacer{
|
||||||
|
display:inline-block;
|
||||||
|
width: 1px;
|
||||||
|
height: 25px;
|
||||||
|
color: #fff;
|
||||||
|
background-color: #fff;
|
||||||
|
border: 1px solid #fff;
|
||||||
|
border-radius: 6px;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
2
dist/env.js
vendored
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
export const port = 8082;
|
||||||
|
//# sourceMappingURL=env.js.map
|
1
dist/env.js.map
vendored
Normal file
|
@ -0,0 +1 @@
|
||||||
|
{"version":3,"file":"env.js","sourceRoot":"","sources":["../server/src/env.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,IAAI,GAAG,IAAI,CAAC"}
|
37
dist/game.js
vendored
Normal file
|
@ -0,0 +1,37 @@
|
||||||
|
import { Player } from "./player.js";
|
||||||
|
import { roomManager } from "./roomManager.js";
|
||||||
|
import { World } from "./world/world.js";
|
||||||
|
export class Game {
|
||||||
|
constructor(id, options) {
|
||||||
|
this.id = id;
|
||||||
|
this.players = [];
|
||||||
|
this.world = new World(options);
|
||||||
|
}
|
||||||
|
addPlayer(id, name, color) {
|
||||||
|
// if (this.getAllNames().includes(name)) return false
|
||||||
|
const player = new Player(id, name, color);
|
||||||
|
this.players.push(player);
|
||||||
|
return player;
|
||||||
|
}
|
||||||
|
removePlayerByID(id) {
|
||||||
|
this.players = this.players.filter(obj => obj.id != id);
|
||||||
|
if (this.players.length < 1) {
|
||||||
|
roomManager.removeGameByID(this.id);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
getAllIDs() {
|
||||||
|
let ids = [];
|
||||||
|
for (let i = 0; i < this.players.length; i++) {
|
||||||
|
ids.push(this.players[i].id);
|
||||||
|
}
|
||||||
|
return ids;
|
||||||
|
}
|
||||||
|
getAllNames() {
|
||||||
|
let names = [];
|
||||||
|
for (let i = 0; i < this.players.length; i++) {
|
||||||
|
names.push(this.players[i].name);
|
||||||
|
}
|
||||||
|
return names;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//# sourceMappingURL=game.js.map
|
1
dist/game.js.map
vendored
Normal file
|
@ -0,0 +1 @@
|
||||||
|
{"version":3,"file":"game.js","sourceRoot":"","sources":["../server/src/game.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,MAAM,EAAC,MAAM,aAAa,CAAA;AAClC,OAAO,EAAC,WAAW,EAAC,MAAM,kBAAkB,CAAA;AAC5C,OAAO,EAAE,KAAK,EAAC,MAAM,kBAAkB,CAAA;AAEvC,MAAM,OAAO,IAAI;IAIf,YAAY,EAAS,EAAE,OAAW;QAChC,IAAI,CAAC,EAAE,GAAG,EAAE,CAAC;QACb,IAAI,CAAC,OAAO,GAAG,EAAE,CAAC;QAClB,IAAI,CAAC,KAAK,GAAG,IAAI,KAAK,CAAC,OAAO,CAAC,CAAA;IACjC,CAAC;IAED,SAAS,CAAC,EAAS,EAAE,IAAW,EAAE,KAAY;QAC5C,sDAAsD;QACtD,MAAM,MAAM,GAAG,IAAI,MAAM,CAAC,EAAE,EAAE,IAAI,EAAE,KAAK,CAAC,CAAC;QAC3C,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QAC1B,OAAO,MAAM,CAAA;IACf,CAAC;IAED,gBAAgB,CAAC,EAAS;QACxB,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC;QACxD,IAAI,IAAI,CAAC,OAAO,CAAC,MAAM,GAAG,CAAC,EAAE;YAC3B,WAAW,CAAC,cAAc,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;SACrC;IACH,CAAC;IAED,SAAS;QACP,IAAI,GAAG,GAAG,EAAE,CAAA;QACZ,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;YAC5C,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAA;SAC7B;QACD,OAAO,GAAG,CAAA;IACZ,CAAC;IACD,WAAW;QACT,IAAI,KAAK,GAAG,EAAE,CAAA;QACd,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;YAC5C,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAA;SACjC;QACD,OAAO,KAAK,CAAA;IACd,CAAC;CACF"}
|
7
dist/main.js
vendored
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
import "./roomManager.js";
|
||||||
|
import "./server/netcode.js";
|
||||||
|
setInterval(function () { updateInfo(); }, 5000);
|
||||||
|
function updateInfo() {
|
||||||
|
console.log("running...");
|
||||||
|
}
|
||||||
|
//# sourceMappingURL=main.js.map
|
1
dist/main.js.map
vendored
Normal file
|
@ -0,0 +1 @@
|
||||||
|
{"version":3,"file":"main.js","sourceRoot":"","sources":["../server/src/main.ts"],"names":[],"mappings":"AAAA,OAAO,kBAAkB,CAAA;AACzB,OAAO,qBAAqB,CAAA;AAG5B,WAAW,CAAC,cAAY,UAAU,EAAE,CAAA,CAAA,CAAC,EAAC,IAAI,CAAC,CAAA;AAC3C,SAAS,UAAU;IACjB,OAAO,CAAC,GAAG,CAAC,YAAY,CAAC,CAAA;AAC3B,CAAC"}
|
8
dist/player.js
vendored
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
export class Player {
|
||||||
|
constructor(id, name, color) {
|
||||||
|
this.id = id;
|
||||||
|
this.name = name;
|
||||||
|
this.color = color;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//# sourceMappingURL=player.js.map
|
1
dist/player.js.map
vendored
Normal file
|
@ -0,0 +1 @@
|
||||||
|
{"version":3,"file":"player.js","sourceRoot":"","sources":["../server/src/player.ts"],"names":[],"mappings":"AAAA,MAAM,OAAO,MAAM;IAIjB,YAAY,EAAS,EAAE,IAAW,EAAE,KAAY;QAC9C,IAAI,CAAC,EAAE,GAAG,EAAE,CAAC;QACb,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;IACrB,CAAC;CACF"}
|
61
dist/roomManager.js
vendored
Normal file
|
@ -0,0 +1,61 @@
|
||||||
|
import { Game } from "./game.js";
|
||||||
|
import * as util from "./util.js";
|
||||||
|
class RoomManager {
|
||||||
|
constructor() {
|
||||||
|
this.games = [];
|
||||||
|
}
|
||||||
|
getGameByID(id) {
|
||||||
|
const game = this.games.filter(obj => obj.id == id)[0];
|
||||||
|
return game;
|
||||||
|
}
|
||||||
|
addGame(id, options) {
|
||||||
|
const game = new Game(id, options);
|
||||||
|
this.games.push(game);
|
||||||
|
return game;
|
||||||
|
}
|
||||||
|
removeGameByID(id) {
|
||||||
|
this.games = this.games.filter(obj => obj.id != id);
|
||||||
|
}
|
||||||
|
getAllPlayerIDs() {
|
||||||
|
let ids = [];
|
||||||
|
for (let i = 0; i < this.games.length; i++) {
|
||||||
|
for (let j = 0; j < this.games[i].players.length; j++) {
|
||||||
|
ids.push(this.games[i].players[j].id);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return ids;
|
||||||
|
}
|
||||||
|
getAllGameIDs() {
|
||||||
|
let ids = [];
|
||||||
|
for (let i = 0; i < this.games.length; i++) {
|
||||||
|
ids.push(this.games[i].id);
|
||||||
|
}
|
||||||
|
return ids;
|
||||||
|
}
|
||||||
|
playerJoinGame(roomCode, playerName, playerColor, playerID) {
|
||||||
|
// See if the client is already in a game
|
||||||
|
if (this.getAllPlayerIDs().includes(playerID)) {
|
||||||
|
}
|
||||||
|
if (!this.getAllGameIDs().includes(roomCode)) {
|
||||||
|
}
|
||||||
|
const game = this.getGameByID(roomCode);
|
||||||
|
const player = game.addPlayer(playerID, playerName, playerColor);
|
||||||
|
// See if player name is taken already
|
||||||
|
// if (player === false) {
|
||||||
|
// this.removeGameByID(game.id)
|
||||||
|
// }
|
||||||
|
return [game, player];
|
||||||
|
}
|
||||||
|
playerCreateGame(options, playerName, playerColor, playerID) {
|
||||||
|
if (this.getAllPlayerIDs().includes(playerID)) {
|
||||||
|
// return new IllegalAction(playerID, 22)
|
||||||
|
}
|
||||||
|
console.log(options);
|
||||||
|
const id = util.createCode();
|
||||||
|
const game = this.addGame(id, options);
|
||||||
|
const player = game.addPlayer(playerID, playerName, playerColor);
|
||||||
|
return [game, player];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
export var roomManager = new RoomManager();
|
||||||
|
//# sourceMappingURL=roomManager.js.map
|
1
dist/roomManager.js.map
vendored
Normal file
|
@ -0,0 +1 @@
|
||||||
|
{"version":3,"file":"roomManager.js","sourceRoot":"","sources":["../server/src/roomManager.ts"],"names":[],"mappings":"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"}
|
12
dist/server/illegalAction.js
vendored
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
import { io } from "./io.js";
|
||||||
|
export class IllegalAction {
|
||||||
|
constructor(id, action) {
|
||||||
|
this.action = action;
|
||||||
|
this.id = id;
|
||||||
|
this.sendIllegalAction();
|
||||||
|
}
|
||||||
|
sendIllegalAction() {
|
||||||
|
io.to(this.id).emit('illegalAction', this.action);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//# sourceMappingURL=illegalAction.js.map
|
1
dist/server/illegalAction.js.map
vendored
Normal file
|
@ -0,0 +1 @@
|
||||||
|
{"version":3,"file":"illegalAction.js","sourceRoot":"","sources":["../../server/src/server/illegalAction.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,EAAE,EAAC,MAAM,SAAS,CAAA;AAC1B,MAAM,OAAO,aAAa;IAGxB,YAAY,EAAS,EAAE,MAAa;QAClC,IAAI,CAAC,MAAM,GAAG,MAAM,CAAA;QACpB,IAAI,CAAC,EAAE,GAAG,EAAE,CAAA;QACZ,IAAI,CAAC,iBAAiB,EAAE,CAAC;IAC3B,CAAC;IACD,iBAAiB;QACf,EAAE,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,IAAI,CAAC,eAAe,EAAE,IAAI,CAAC,MAAM,CAAC,CAAA;IACnD,CAAC;CACF"}
|
4
dist/server/io.js
vendored
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
import { webServer } from "./server.js";
|
||||||
|
import { Server } from "socket.io";
|
||||||
|
export const io = new Server(webServer, {});
|
||||||
|
//# sourceMappingURL=io.js.map
|
1
dist/server/io.js.map
vendored
Normal file
|
@ -0,0 +1 @@
|
||||||
|
{"version":3,"file":"io.js","sourceRoot":"","sources":["../../server/src/server/io.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,SAAS,EAAC,MAAM,aAAa,CAAA;AACrC,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAEnC,MAAM,CAAC,MAAM,EAAE,GAAG,IAAI,MAAM,CAAC,SAAS,EAAE,EAAE,CAAC,CAAC"}
|
56
dist/server/netcode.js
vendored
Normal file
|
@ -0,0 +1,56 @@
|
||||||
|
import { IllegalAction } from "./illegalAction.js";
|
||||||
|
import { roomManager } from "../roomManager.js";
|
||||||
|
import { io } from "./io.js";
|
||||||
|
io.on('connection', function (client) {
|
||||||
|
connected(client);
|
||||||
|
});
|
||||||
|
function connected(client) {
|
||||||
|
client.sync = function () {
|
||||||
|
const tempWorld = client.game.world.obfuscate();
|
||||||
|
io.to(client.game.id).emit('sync', { world: tempWorld });
|
||||||
|
};
|
||||||
|
client.sendMeta = function () {
|
||||||
|
const roomID = client.game.id;
|
||||||
|
const roomPlayers = client.game.players; // Dont send client id's to everyone, TODO
|
||||||
|
const metadata = { players: roomPlayers, roomID: roomID };
|
||||||
|
io.to(client.game.id).emit('metadata', metadata);
|
||||||
|
const id = client.game.id;
|
||||||
|
client.emit('message', id);
|
||||||
|
};
|
||||||
|
client.game = "";
|
||||||
|
client.player = "";
|
||||||
|
client.on('disconnect', function () {
|
||||||
|
if (!roomManager.getAllPlayerIDs().includes(client.id))
|
||||||
|
return new IllegalAction(client.id, 22);
|
||||||
|
client.game.removePlayerByID(client.id);
|
||||||
|
client.sendMeta();
|
||||||
|
});
|
||||||
|
client.on('joinGame', function (data) {
|
||||||
|
const info = roomManager.playerJoinGame(data.room, data.name, data.color, client.id);
|
||||||
|
client.join(info[0].id);
|
||||||
|
client.game = info[0];
|
||||||
|
client.player = info[1];
|
||||||
|
client.sync();
|
||||||
|
client.emit('inGame', true);
|
||||||
|
client.sendMeta();
|
||||||
|
});
|
||||||
|
client.on('createGame', function (data) {
|
||||||
|
const info = roomManager.playerCreateGame(data.options, data.name, data.color, client.id);
|
||||||
|
client.join(info[0].id);
|
||||||
|
client.game = info[0];
|
||||||
|
client.player = info[1];
|
||||||
|
client.emit('inGame', true);
|
||||||
|
client.sync();
|
||||||
|
client.sendMeta();
|
||||||
|
});
|
||||||
|
client.on('leaveGame', function (data) {
|
||||||
|
client.game.removePlayerByID(client.id);
|
||||||
|
});
|
||||||
|
client.on('clickCanvas', function (data) {
|
||||||
|
if (!roomManager.getAllPlayerIDs().includes(client.id))
|
||||||
|
return new IllegalAction(client.id, 1);
|
||||||
|
client.game.world.click(data.tilePosition[0], data.tilePosition[1], data.mode, client.player);
|
||||||
|
client.sync();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
//# sourceMappingURL=netcode.js.map
|
1
dist/server/netcode.js.map
vendored
Normal file
|
@ -0,0 +1 @@
|
||||||
|
{"version":3,"file":"netcode.js","sourceRoot":"","sources":["../../server/src/server/netcode.ts"],"names":[],"mappings":"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"}
|
9
dist/server/server.js
vendored
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
import path from 'path';
|
||||||
|
import express from "express";
|
||||||
|
import { port } from "../env.js";
|
||||||
|
var app = express();
|
||||||
|
const __dirname = path.resolve(path.dirname(''));
|
||||||
|
app.use(express.static(__dirname + '/www/'));
|
||||||
|
export var webServer = app.listen(port, function () {
|
||||||
|
});
|
||||||
|
//# sourceMappingURL=server.js.map
|
1
dist/server/server.js.map
vendored
Normal file
|
@ -0,0 +1 @@
|
||||||
|
{"version":3,"file":"server.js","sourceRoot":"","sources":["../../server/src/server/server.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,OAAO,MAAM,SAAS,CAAA;AAC7B,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAA;AAChC,IAAI,GAAG,GAAG,OAAO,EAAE,CAAA;AAEnB,MAAM,SAAS,GAAG,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC,CAAC;AACjD,GAAG,CAAC,GAAG,CAAC,OAAO,CAAC,MAAM,CAAC,SAAS,GAAG,OAAO,CAAC,CAAC,CAAC;AAC7C,MAAM,CAAC,IAAI,SAAS,GAAG,GAAG,CAAC,MAAM,CAAC,IAAI,EAAE;AACxC,CAAC,CAAC,CAAC"}
|
12
dist/util.js
vendored
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
import crypto from "crypto";
|
||||||
|
export function randomNumber(min, max) {
|
||||||
|
return Math.floor(Math.random() * (max - min) + min);
|
||||||
|
}
|
||||||
|
export function clamp(number, min, max) {
|
||||||
|
return Math.max(min, Math.min(number, max));
|
||||||
|
}
|
||||||
|
export function createCode() {
|
||||||
|
const randomString = crypto.randomBytes(3).toString("hex").toUpperCase();
|
||||||
|
return randomString;
|
||||||
|
}
|
||||||
|
//# sourceMappingURL=util.js.map
|
1
dist/util.js.map
vendored
Normal file
|
@ -0,0 +1 @@
|
||||||
|
{"version":3,"file":"util.js","sourceRoot":"","sources":["../server/src/util.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,QAAQ,CAAC;AAC5B,MAAM,UAAU,YAAY,CAAC,GAAU,EAAE,GAAU;IAC/C,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,GAAG,GAAG,CAAC,GAAG,GAAG,CAAC,CAAC;AACzD,CAAC;AACD,MAAM,UAAU,KAAK,CAAC,MAAa,EAAE,GAAU,EAAE,GAAU;IACzD,OAAO,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,IAAI,CAAC,GAAG,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,CAAC;AAC9C,CAAC;AAED,MAAM,UAAU,UAAU;IACxB,MAAM,YAAY,GAAG,MAAM,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,WAAW,EAAE,CAAA;IACxE,OAAO,YAAY,CAAA;AACrB,CAAC"}
|
21
dist/world/flagger.js
vendored
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
export function flag(x, y, data, player) {
|
||||||
|
let tile = data[x][y];
|
||||||
|
if (!tile.mask || tile.flag === 0)
|
||||||
|
return data;
|
||||||
|
const color = +player.color;
|
||||||
|
console.log(player);
|
||||||
|
switch (tile.flag) {
|
||||||
|
case (0):
|
||||||
|
tile.flag = color;
|
||||||
|
break;
|
||||||
|
case (color):
|
||||||
|
tile.flag = color + 16;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
tile.flag = 0;
|
||||||
|
}
|
||||||
|
console.log(tile.flag);
|
||||||
|
data[x][y] = tile;
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
//# sourceMappingURL=flagger.js.map
|
1
dist/world/flagger.js.map
vendored
Normal file
|
@ -0,0 +1 @@
|
||||||
|
{"version":3,"file":"flagger.js","sourceRoot":"","sources":["../../server/src/world/flagger.ts"],"names":[],"mappings":"AAGA,MAAM,UAAU,IAAI,CAAC,CAAQ,EAAE,CAAQ,EAAE,IAAc,EAAE,MAAa;IACpE,IAAI,IAAI,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA;IAErB,IAAI,CAAC,IAAI,CAAC,IAAI,IAAI,IAAI,CAAC,IAAI,KAAK,CAAC;QAAE,OAAO,IAAI,CAAA;IAC9C,MAAM,KAAK,GAAU,CAAC,MAAM,CAAC,KAAK,CAAA;IAClC,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,CAAA;IAEnB,QAAQ,IAAI,CAAC,IAAI,EAAE;QACjB,KAAK,CAAC,CAAC,CAAC;YACJ,IAAI,CAAC,IAAI,GAAG,KAAK,CAAC;YACpB,MAAM;QACR,KAAK,CAAC,KAAK,CAAC;YACR,IAAI,CAAC,IAAI,GAAG,KAAK,GAAG,EAAE,CAAC;YACzB,MAAM;QACR;YACI,IAAI,CAAC,IAAI,GAAG,CAAC,CAAC;KACnB;IACC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;IACxB,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,IAAI,CAAA;IACjB,OAAO,IAAI,CAAC;AACd,CAAC"}
|
34
dist/world/generator.js
vendored
Normal file
|
@ -0,0 +1,34 @@
|
||||||
|
import * as util from "../util.js";
|
||||||
|
const searchLoc = [
|
||||||
|
[-1, 1], [0, 1], [1, 1],
|
||||||
|
[-1, 0], [1, 0],
|
||||||
|
[-1, -1], [0, -1], [1, -1]
|
||||||
|
];
|
||||||
|
export function generate(avoidX, avoidY, world) {
|
||||||
|
var minesPlanted = 0;
|
||||||
|
while (minesPlanted < world.mines || !(minesPlanted <= world.width * world.height - 15)) {
|
||||||
|
const x = util.randomNumber(0, world.width);
|
||||||
|
const y = util.randomNumber(0, world.height);
|
||||||
|
var suitable = true;
|
||||||
|
searchLoc.forEach(loc => {
|
||||||
|
const tempx = x + loc[0];
|
||||||
|
const tempy = y + loc[1];
|
||||||
|
if (tempx === avoidX && tempy === avoidX) {
|
||||||
|
suitable = false;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
if (x == avoidX && y == avoidY) {
|
||||||
|
suitable = false;
|
||||||
|
}
|
||||||
|
if (world.data[x][y].type == 5) {
|
||||||
|
suitable = false;
|
||||||
|
}
|
||||||
|
if (suitable) {
|
||||||
|
world.data[x][y].type = 5;
|
||||||
|
minesPlanted++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
world.isGenerated = true;
|
||||||
|
return world;
|
||||||
|
}
|
||||||
|
//# sourceMappingURL=generator.js.map
|
1
dist/world/generator.js.map
vendored
Normal file
|
@ -0,0 +1 @@
|
||||||
|
{"version":3,"file":"generator.js","sourceRoot":"","sources":["../../server/src/world/generator.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,IAAI,MAAM,YAAY,CAAA;AAGlC,MAAM,SAAS,GACf;IACE,CAAC,CAAC,CAAC,EAAC,CAAC,CAAC,EAAE,CAAC,CAAC,EAAC,CAAC,CAAC,EAAE,CAAC,CAAC,EAAC,CAAC,CAAC;IACpB,CAAC,CAAC,CAAC,EAAC,CAAC,CAAC,EAAS,CAAC,CAAC,EAAC,CAAC,CAAC;IACpB,CAAC,CAAC,CAAC,EAAC,CAAC,CAAC,CAAC,EAAC,CAAC,CAAC,EAAC,CAAC,CAAC,CAAC,EAAC,CAAC,CAAC,EAAC,CAAC,CAAC,CAAC;CACtB,CAAA;AAED,MAAM,UAAU,QAAQ,CAAC,MAAa,EAAE,MAAa,EAAE,KAAW;IAChE,IAAI,YAAY,GAAG,CAAC,CAAC;IACrB,OAAO,YAAY,GAAG,KAAK,CAAC,KAAK,IAAI,CAAC,CAAC,YAAY,IAAI,KAAK,CAAC,KAAK,GAAC,KAAK,CAAC,MAAM,GAAC,EAAE,CAAC,EAAE;QACnF,MAAM,CAAC,GAAG,IAAI,CAAC,YAAY,CAAC,CAAC,EAAC,KAAK,CAAC,KAAK,CAAC,CAAA;QAC1C,MAAM,CAAC,GAAG,IAAI,CAAC,YAAY,CAAC,CAAC,EAAC,KAAK,CAAC,MAAM,CAAC,CAAA;QAC3C,IAAI,QAAQ,GAAG,IAAI,CAAC;QACpB,SAAS,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE;YACtB,MAAM,KAAK,GAAG,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC,CAAA;YACxB,MAAM,KAAK,GAAG,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC,CAAA;YACxB,IAAI,KAAK,KAAK,MAAM,IAAI,KAAK,KAAK,MAAM,EAAE;gBACtC,QAAQ,GAAG,KAAK,CAAC;aACpB;QACH,CAAC,CAAC,CAAA;QAEF,IAAI,CAAC,IAAI,MAAM,IAAI,CAAC,IAAI,MAAM,EAAI;YAAE,QAAQ,GAAG,KAAK,CAAA;SAAE;QACtD,IAAI,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC,EAAI;YAAE,QAAQ,GAAG,KAAK,CAAA;SAAE;QAEtD,IAAI,QAAQ,EAAE;YACZ,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,GAAG,CAAC,CAAA;YACzB,YAAY,EAAE,CAAC;SAChB;KACF;IAED,KAAK,CAAC,WAAW,GAAG,IAAI,CAAC;IACzB,OAAO,KAAK,CAAC;AACf,CAAC"}
|
30
dist/world/marker.js
vendored
Normal file
|
@ -0,0 +1,30 @@
|
||||||
|
const searchLoc = [
|
||||||
|
[-1, 1], [0, 1], [1, 1],
|
||||||
|
[-1, 0], [1, 0],
|
||||||
|
[-1, -1], [0, -1], [1, -1]
|
||||||
|
];
|
||||||
|
// Place Numbers
|
||||||
|
export function mark(world) {
|
||||||
|
for (let x = 0; x < world.width; x++) {
|
||||||
|
for (let y = 0; y < world.height; y++) {
|
||||||
|
if (world.data[x][y].type === 1) {
|
||||||
|
var counter = 0;
|
||||||
|
searchLoc.forEach(location => {
|
||||||
|
const tempx = x + location[0];
|
||||||
|
const tempy = y + location[1];
|
||||||
|
if (tempx >= 0 && tempy >= 0 && tempx < world.width && tempy < world.height) {
|
||||||
|
if (world.data[tempx][tempy].type === 5) {
|
||||||
|
counter++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
if (counter !== 0) {
|
||||||
|
world.data[x][y].type = 15 + counter;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
world.isMarked = true;
|
||||||
|
return world;
|
||||||
|
}
|
||||||
|
//# sourceMappingURL=marker.js.map
|
1
dist/world/marker.js.map
vendored
Normal file
|
@ -0,0 +1 @@
|
||||||
|
{"version":3,"file":"marker.js","sourceRoot":"","sources":["../../server/src/world/marker.ts"],"names":[],"mappings":"AAEA,MAAM,SAAS,GACf;IACE,CAAC,CAAC,CAAC,EAAC,CAAC,CAAC,EAAE,CAAC,CAAC,EAAC,CAAC,CAAC,EAAE,CAAC,CAAC,EAAC,CAAC,CAAC;IACpB,CAAC,CAAC,CAAC,EAAC,CAAC,CAAC,EAAS,CAAC,CAAC,EAAC,CAAC,CAAC;IACpB,CAAC,CAAC,CAAC,EAAC,CAAC,CAAC,CAAC,EAAC,CAAC,CAAC,EAAC,CAAC,CAAC,CAAC,EAAC,CAAC,CAAC,EAAC,CAAC,CAAC,CAAC;CACtB,CAAA;AACD,gBAAgB;AAChB,MAAM,UAAU,IAAI,CAAC,KAAW;IAEhC,KAAI,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,KAAK,CAAC,KAAK,EAAE,CAAC,EAAE,EAAC;QAClC,KAAI,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC,EAAE,EAAC;YACnC,IAAI,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,KAAK,CAAC,EAAE;gBACjC,IAAI,OAAO,GAAG,CAAC,CAAC;gBAChB,SAAS,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE;oBAC3B,MAAM,KAAK,GAAG,CAAC,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAA;oBAC7B,MAAM,KAAK,GAAG,CAAC,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAA;oBAC7B,IAAI,KAAK,IAAI,CAAC,IAAI,KAAK,IAAI,CAAC,IAAI,KAAK,GAAG,KAAK,CAAC,KAAK,IAAI,KAAK,GAAG,KAAK,CAAC,MAAM,EAAE;wBAC3E,IAAI,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,KAAK,CAAC,CAAC,IAAI,KAAK,CAAC,EAAE;4BACvC,OAAO,EAAE,CAAC;yBACX;qBACF;gBACH,CAAC,CAAC,CAAC;gBACH,IAAI,OAAO,KAAK,CAAC,EAAE;oBACnB,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,GAAG,EAAE,GAAG,OAAO,CAAA;iBACnC;aACA;SACF;KACF;IACC,KAAK,CAAC,QAAQ,GAAG,IAAI,CAAC;IACtB,OAAO,KAAK,CAAC;AAEf,CAAC"}
|
14
dist/world/obfuscator.js
vendored
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
export function obfuscate(world) {
|
||||||
|
let tempWorld = world;
|
||||||
|
for (let x = 0; x < tempWorld.width; x++) {
|
||||||
|
for (let y = 0; y < tempWorld.height; y++) {
|
||||||
|
if (tempWorld.data[x][y].mask === true) {
|
||||||
|
tempWorld.data[x][y].type = 0;
|
||||||
|
}
|
||||||
|
;
|
||||||
|
tempWorld.isObfuscated = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return tempWorld;
|
||||||
|
}
|
||||||
|
//# sourceMappingURL=obfuscator.js.map
|
1
dist/world/obfuscator.js.map
vendored
Normal file
|
@ -0,0 +1 @@
|
||||||
|
{"version":3,"file":"obfuscator.js","sourceRoot":"","sources":["../../server/src/world/obfuscator.ts"],"names":[],"mappings":"AACA,MAAM,UAAU,SAAS,CAAC,KAAW;IACnC,IAAI,SAAS,GAAG,KAAK,CAAC;IACtB,KAAI,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,SAAS,CAAC,KAAK,EAAE,CAAC,EAAE,EAAC;QACtC,KAAI,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,SAAS,CAAC,MAAM,EAAE,CAAC,EAAE,EAAC;YAEvC,IAAI,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,KAAK,IAAI,EAAE;gBAEtC,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,GAAG,CAAC,CAAC;aAC/B;YAAA,CAAC;YACF,SAAS,CAAC,YAAY,GAAG,IAAI,CAAC;SAE/B;KACF;IACG,OAAO,SAAS,CAAC;AACvB,CAAC"}
|
13
dist/world/placer.js
vendored
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
import * as revealer from "./revealer.js";
|
||||||
|
export function place(x, y, data) {
|
||||||
|
let tile = data[x][y];
|
||||||
|
if (tile.mask === true) {
|
||||||
|
if (tile.mask && tile.flag === 0) {
|
||||||
|
tile.mask = false;
|
||||||
|
}
|
||||||
|
data[x][y] = tile;
|
||||||
|
revealer.reveal(x, y, data);
|
||||||
|
}
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
//# sourceMappingURL=placer.js.map
|
1
dist/world/placer.js.map
vendored
Normal file
|
@ -0,0 +1 @@
|
||||||
|
{"version":3,"file":"placer.js","sourceRoot":"","sources":["../../server/src/world/placer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,QAAQ,MAAM,eAAe,CAAA;AAGzC,MAAM,UAAU,KAAK,CAAC,CAAQ,EAAE,CAAQ,EAAE,IAAc;IACtD,IAAI,IAAI,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IACtB,IAAI,IAAI,CAAC,IAAI,KAAK,IAAI,EAAE;QACxB,IAAI,IAAI,CAAC,IAAI,IAAI,IAAI,CAAC,IAAI,KAAK,CAAC,EAAE;YAChC,IAAI,CAAC,IAAI,GAAG,KAAK,CAAC;SACnB;QAED,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC;QAClB,QAAQ,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,EAAE,IAAI,CAAC,CAAA;KAC1B;IACD,OAAO,IAAI,CAAC;AACd,CAAC"}
|
36
dist/world/revealer.js
vendored
Normal file
|
@ -0,0 +1,36 @@
|
||||||
|
const searchLoc = [
|
||||||
|
[-1, 1], [0, 1], [1, 1],
|
||||||
|
[-1, 0], [1, 0],
|
||||||
|
[-1, -1], [0, -1], [1, -1]
|
||||||
|
];
|
||||||
|
export function reveal(x, y, data) {
|
||||||
|
if (data[x][y].type === 5)
|
||||||
|
return data;
|
||||||
|
var toSearch = [];
|
||||||
|
var searchedLocations = [];
|
||||||
|
toSearch.push([x, y]);
|
||||||
|
if (data[x][y].type === 1) {
|
||||||
|
while (toSearch.length > 0) {
|
||||||
|
const x = toSearch[0][0];
|
||||||
|
const y = toSearch[0][1];
|
||||||
|
searchedLocations.push(toSearch[0]);
|
||||||
|
toSearch.shift();
|
||||||
|
searchLoc.forEach(loc => {
|
||||||
|
const tempx = x + loc[0];
|
||||||
|
const tempy = y + loc[1];
|
||||||
|
if (tempx >= 0 && tempy >= 0 && tempx < data.length && tempy < data[0].length) {
|
||||||
|
if (data[tempx][tempy].type === 1 && data[tempx][tempy].mask === true) {
|
||||||
|
if (!toSearch.includes([tempx, tempy]) && !searchedLocations.includes([tempx, tempy])) {
|
||||||
|
toSearch.push([tempx, tempy]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (data[tempx][tempy].type !== 5) {
|
||||||
|
data[tempx][tempy].mask = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
//# sourceMappingURL=revealer.js.map
|
1
dist/world/revealer.js.map
vendored
Normal file
|
@ -0,0 +1 @@
|
||||||
|
{"version":3,"file":"revealer.js","sourceRoot":"","sources":["../../server/src/world/revealer.ts"],"names":[],"mappings":"AAEA,MAAM,SAAS,GACf;IACE,CAAC,CAAC,CAAC,EAAC,CAAC,CAAC,EAAE,CAAC,CAAC,EAAC,CAAC,CAAC,EAAE,CAAC,CAAC,EAAC,CAAC,CAAC;IACpB,CAAC,CAAC,CAAC,EAAC,CAAC,CAAC,EAAS,CAAC,CAAC,EAAC,CAAC,CAAC;IACpB,CAAC,CAAC,CAAC,EAAC,CAAC,CAAC,CAAC,EAAC,CAAC,CAAC,EAAC,CAAC,CAAC,CAAC,EAAC,CAAC,CAAC,EAAC,CAAC,CAAC,CAAC;CACtB,CAAA;AAED,MAAM,UAAU,MAAM,CAAC,CAAQ,EAAE,CAAQ,EAAE,IAAc;IACvD,IAAI,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,KAAK,CAAC;QAAE,OAAO,IAAI,CAAC;IAEvC,IAAI,QAAQ,GAAS,EAAE,CAAC;IACxB,IAAI,iBAAiB,GAAS,EAAE,CAAC;IACjC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAA;IAErB,IAAI,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,KAAK,CAAC,EAAE;QAC3B,OAAO,QAAQ,CAAC,MAAM,GAAG,CAAC,EAAE;YACpB,MAAM,CAAC,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA;YACxB,MAAM,CAAC,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA;YACxB,iBAAiB,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAA;YACnC,QAAQ,CAAC,KAAK,EAAE,CAAA;YAChB,SAAS,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE;gBACxB,MAAM,KAAK,GAAG,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC,CAAA;gBACxB,MAAM,KAAK,GAAG,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC,CAAA;gBACxB,IAAI,KAAK,IAAI,CAAC,IAAI,KAAK,IAAI,CAAC,IAAI,KAAK,GAAG,IAAI,CAAC,MAAM,IAAI,KAAK,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC,MAAM,EAAE;oBAE7E,IAAI,IAAI,CAAC,KAAK,CAAC,CAAC,KAAK,CAAC,CAAC,IAAI,KAAK,CAAC,IAAI,IAAI,CAAC,KAAK,CAAC,CAAC,KAAK,CAAC,CAAC,IAAI,KAAK,IAAI,EAAE;wBAErE,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC,KAAK,EAAC,KAAK,CAAC,CAAC,IAAI,CAAC,iBAAiB,CAAC,QAAQ,CAAC,CAAC,KAAK,EAAC,KAAK,CAAC,CAAC,EAAE;4BACnF,QAAQ,CAAC,IAAI,CAAC,CAAC,KAAK,EAAC,KAAK,CAAC,CAAC,CAAA;yBAC7B;qBACF;oBACH,IAAI,IAAI,CAAC,KAAK,CAAC,CAAC,KAAK,CAAC,CAAC,IAAI,KAAK,CAAC,EAAE;wBACjC,IAAI,CAAC,KAAK,CAAC,CAAC,KAAK,CAAC,CAAC,IAAI,GAAG,KAAK,CAAC;qBACjC;iBACF;YACD,CAAC,CAAC,CAAA;SACL;KACF;IACD,OAAO,IAAI,CAAA;AACb,CAAC"}
|
53
dist/world/world.js
vendored
Normal file
|
@ -0,0 +1,53 @@
|
||||||
|
import * as obfuscater from "./obfuscator.js";
|
||||||
|
import * as generator from "./generator.js";
|
||||||
|
import * as marker from "./marker.js";
|
||||||
|
import * as flagger from "./flagger.js";
|
||||||
|
import * as placer from "./placer.js";
|
||||||
|
export class World {
|
||||||
|
constructor(options) {
|
||||||
|
this.mines = options.mines;
|
||||||
|
this.width = options.width * 1;
|
||||||
|
this.height = options.height * 1;
|
||||||
|
this.isGenerated = false;
|
||||||
|
this.isObfuscated = false;
|
||||||
|
this.isMarked = false;
|
||||||
|
this.data = Array.from(Array(this.width), () => new Array(this.height));
|
||||||
|
for (let x = 0; x < this.width; x++) {
|
||||||
|
for (let y = 0; y < this.height; y++) {
|
||||||
|
this.data[x][y] = { type: 1, flag: 0, mask: true };
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
click(x, y, mode, player) {
|
||||||
|
if (this.isGenerated) {
|
||||||
|
if (mode === 2) {
|
||||||
|
this.data = flagger.flag(x, y, this.data, player);
|
||||||
|
}
|
||||||
|
if (mode === 0) {
|
||||||
|
this.data = placer.place(x, y, this.data);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
this.generate(x, y).mark();
|
||||||
|
this.data = placer.place(x, y, this.data);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
generate(x, y) {
|
||||||
|
if (this.isGenerated)
|
||||||
|
return console.log("Already Generated");
|
||||||
|
return generator.generate(x, y, this);
|
||||||
|
}
|
||||||
|
mark() {
|
||||||
|
if (this.isMarked)
|
||||||
|
return console.log("Already Marked!");
|
||||||
|
return marker.mark(this);
|
||||||
|
}
|
||||||
|
obfuscate() {
|
||||||
|
if (this.isObfuscated)
|
||||||
|
return console.log("already done");
|
||||||
|
const tempWorld = JSON.parse(JSON.stringify(this));
|
||||||
|
;
|
||||||
|
return obfuscater.obfuscate(tempWorld);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//# sourceMappingURL=world.js.map
|
1
dist/world/world.js.map
vendored
Normal file
|
@ -0,0 +1 @@
|
||||||
|
{"version":3,"file":"world.js","sourceRoot":"","sources":["../../server/src/world/world.ts"],"names":[],"mappings":"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"}
|
2729
package-lock.json
generated
22
package.json
|
@ -1,32 +1,30 @@
|
||||||
{
|
{
|
||||||
"name": "multiplayer_minesweeper",
|
"name": "MultiplayerMinesweeper",
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"description": "",
|
"description": "",
|
||||||
"main": "",
|
"main": "",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"test": "echo \"Error: no test specified\" && exit 1"
|
"test": "echo \"Error: no test specified\" && exit 1",
|
||||||
|
"build": ""
|
||||||
},
|
},
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "empires"
|
"url": "empires"
|
||||||
},
|
},
|
||||||
"author": "Alexander Bass",
|
"author": "Alexander Bass",
|
||||||
"license": "GPLv3",
|
"license": "UNLICENSED",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"express": "^4.18.1",
|
"express": "^4.18.1",
|
||||||
"sass": "^1.52.3",
|
"sass": "^1.52.3",
|
||||||
"socket.io": "^4.5.1",
|
"socket.io": "^4.5.0",
|
||||||
"ts-node": "^10.8.1"
|
"socket.js": "^0.1.4",
|
||||||
|
"ts-node": "^10.8.1",
|
||||||
|
"typescript": "^4.7.4"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@tsconfig/node16": "^1.0.3",
|
"@tsconfig/node16": "^1.0.3",
|
||||||
"@types/express": "^4.17.13",
|
"@types/express": "^4.17.13",
|
||||||
"@types/node": "^18.0.0",
|
"@types/node": "^18.0.0"
|
||||||
"@typescript-eslint/eslint-plugin": "^5.31.0",
|
|
||||||
"@typescript-eslint/parser": "^5.31.0",
|
|
||||||
"eslint": "^8.20.0",
|
|
||||||
"rollup": "^2.75.7",
|
|
||||||
"typescript": "^4.7.4"
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,9 +0,0 @@
|
||||||
export default {
|
|
||||||
input: 'client/scripts/index.js',
|
|
||||||
output: [
|
|
||||||
{
|
|
||||||
file: 'dist/www/index.js',
|
|
||||||
format: 'iife'
|
|
||||||
}
|
|
||||||
]
|
|
||||||
};
|
|
Before Width: | Height: | Size: 23 KiB |
Before Width: | Height: | Size: 28 KiB |
Before Width: | Height: | Size: 17 KiB |
|
@ -1,2 +1,8 @@
|
||||||
import "./roomManager.js"
|
import "./roomManager.js"
|
||||||
import "./server/netcode.js"
|
import "./server/netcode.js"
|
||||||
|
import {roomManager} from "./roomManager.js"
|
||||||
|
|
||||||
|
setInterval(function(){ updateInfo()},5000)
|
||||||
|
function updateInfo() {
|
||||||
|
console.log("running...")
|
||||||
|
}
|
||||||
|
|
|
@ -6,7 +6,6 @@ class RoomManager {
|
||||||
constructor(){
|
constructor(){
|
||||||
this.games = [];
|
this.games = [];
|
||||||
}
|
}
|
||||||
|
|
||||||
getGameByID(id:string) {
|
getGameByID(id:string) {
|
||||||
const game = this.games.filter(obj => obj.id == id)[0]
|
const game = this.games.filter(obj => obj.id == id)[0]
|
||||||
return game
|
return game
|
||||||
|
@ -17,9 +16,9 @@ class RoomManager {
|
||||||
this.games.push(game);
|
this.games.push(game);
|
||||||
return game
|
return game
|
||||||
}
|
}
|
||||||
|
|
||||||
removeGameByID(id:string) {
|
removeGameByID(id:string) {
|
||||||
this.games = this.games.filter(obj => obj.id != id);
|
this.games = this.games.filter(obj => obj.id != id);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
getAllPlayerIDs() {
|
getAllPlayerIDs() {
|
||||||
|
@ -59,6 +58,7 @@ class RoomManager {
|
||||||
if (this.getAllPlayerIDs().includes(playerID)) {
|
if (this.getAllPlayerIDs().includes(playerID)) {
|
||||||
// return new IllegalAction(playerID, 22)
|
// return new IllegalAction(playerID, 22)
|
||||||
}
|
}
|
||||||
|
console.log(options)
|
||||||
const id = util.createCode()
|
const id = util.createCode()
|
||||||
const game = this.addGame(id, options)
|
const game = this.addGame(id, options)
|
||||||
const player = game.addPlayer(playerID, playerName, playerColor);
|
const player = game.addPlayer(playerID, playerName, playerColor);
|
||||||
|
|
|
@ -1,8 +1,6 @@
|
||||||
import {IllegalAction} from "./illegalAction.js"
|
import {IllegalAction} from "./illegalAction.js"
|
||||||
import {roomManager} from "../roomManager.js"
|
import {roomManager} from "../roomManager.js"
|
||||||
import {io} from "./io.js"
|
import {io} from "./io.js"
|
||||||
import {Player} from "../player.js"
|
|
||||||
import {Game} from "../game.js"
|
|
||||||
|
|
||||||
io.on('connection', function(client:any){
|
io.on('connection', function(client:any){
|
||||||
connected(client)
|
connected(client)
|
||||||
|
@ -23,19 +21,14 @@ function connected(client:any) {
|
||||||
const id = client.game.id
|
const id = client.game.id
|
||||||
client.emit('message', id)
|
client.emit('message', id)
|
||||||
}
|
}
|
||||||
client.game = null;
|
|
||||||
client.player = null;
|
client.game = "";
|
||||||
|
client.player = "";
|
||||||
|
|
||||||
client.on('disconnect', function(){
|
client.on('disconnect', function(){
|
||||||
if (!roomManager.getAllPlayerIDs().includes(client.id)) return new IllegalAction(client.id, 22)
|
if (!roomManager.getAllPlayerIDs().includes(client.id)) return new IllegalAction(client.id, 22)
|
||||||
client.game.removePlayerByID(client.id)
|
client.game.removePlayerByID(client.id)
|
||||||
client.sendMeta();
|
client.sendMeta();
|
||||||
client.game = null
|
|
||||||
client.player = null
|
|
||||||
})
|
|
||||||
|
|
||||||
client.on('initJoin', function(code:string){
|
|
||||||
if (roomManager.getGameByID(code).players.length >= 8) return new IllegalAction(client.id, 28)
|
|
||||||
})
|
})
|
||||||
|
|
||||||
client.on('joinGame', function(data:any){
|
client.on('joinGame', function(data:any){
|
||||||
|
@ -47,31 +40,9 @@ function connected(client:any) {
|
||||||
client.emit('inGame', true)
|
client.emit('inGame', true)
|
||||||
client.sendMeta()
|
client.sendMeta()
|
||||||
})
|
})
|
||||||
type CreateGameOptions = {width: number, height: number, mines: number}
|
|
||||||
type CreateGameData = {options: CreateGameOptions, name: string, color: number}
|
|
||||||
|
|
||||||
client.on('createGame', function(data:any){
|
client.on('createGame', function(data:any){
|
||||||
if (
|
const info = roomManager.playerCreateGame(data.options, data.name, data.color, client.id)
|
||||||
typeof data.name === "string" &&
|
|
||||||
typeof data.color === "number" &&
|
|
||||||
typeof data.options.width === "number" &&
|
|
||||||
typeof data.options.height === "number" &&
|
|
||||||
typeof data.options.mines === "number"
|
|
||||||
) {
|
|
||||||
console.log("good 2")
|
|
||||||
} else {return false}
|
|
||||||
if (
|
|
||||||
data.name.length < 9 &&
|
|
||||||
data.color > 0 && data.color < 9 &&
|
|
||||||
data.options.width > 8 && data.options.width < 500 &&
|
|
||||||
data.options.height > 8 && data.options.height < 500 &&
|
|
||||||
data.options.mines > 6 && data.options.mines < (data.options.height * data.options.width)
|
|
||||||
) {
|
|
||||||
console.log("good 3")
|
|
||||||
} else {return false}
|
|
||||||
const createGameData: CreateGameData = data as CreateGameData;
|
|
||||||
console.log(createGameData)
|
|
||||||
const info = roomManager.playerCreateGame(createGameData.options, createGameData.name, createGameData.color, client.id)
|
|
||||||
client.join(info[0].id)
|
client.join(info[0].id)
|
||||||
client.game = info[0];
|
client.game = info[0];
|
||||||
client.player = info[1]
|
client.player = info[1]
|
||||||
|
@ -86,7 +57,7 @@ function connected(client:any) {
|
||||||
|
|
||||||
client.on('clickCanvas', function(data:any){
|
client.on('clickCanvas', function(data:any){
|
||||||
if (!roomManager.getAllPlayerIDs().includes(client.id)) return new IllegalAction(client.id, 1)
|
if (!roomManager.getAllPlayerIDs().includes(client.id)) return new IllegalAction(client.id, 1)
|
||||||
client.game.world.click(data.tilePosition[0],data.tilePosition[1], data.mode, client.player.color)
|
client.game.world.click(data.tilePosition[0],data.tilePosition[1], data.mode, client.player)
|
||||||
client.sync()
|
client.sync()
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|