Implemented basic buying functions

- Renamed more scripts
- Switched license to Artistic 2.0
This commit is contained in:
Tony Bark 2021-05-20 00:58:17 -04:00
parent 8435cab605
commit 0b60335591
17 changed files with 330 additions and 428 deletions

63
.gitignore vendored
View file

@ -1,10 +1,41 @@
### Audio ### # File created using '.gitignore Generator' for Visual Studio Code: https://bit.ly/vscode-gig
*.wav # Created by https://www.toptal.com/developers/gitignore/api/windows,visualstudiocode,monodevelop,macos,linux,godot,executable,dotnetcore,backup,archives
*.ogg # Edit at https://www.toptal.com/developers/gitignore?templates=windows,visualstudiocode,monodevelop,macos,linux,godot,executable,dotnetcore,backup,archives
# Created by https://www.gitignore.io/api/linux,godot,macos,backup,windows,dotnetcore,executable,monodevelop,visualstudiocode ### Archives ###
# Edit at https://www.gitignore.io/?templates=linux,godot,macos,backup,windows,dotnetcore,executable,monodevelop,visualstudiocode # It's better to unpack these files and commit the raw source because
# git has its own built in compression methods.
*.7z
*.jar
*.rar
*.zip
*.gz
*.gzip
*.tgz
*.bzip
*.bzip2
*.bz2
*.xz
*.lzma
*.cab
*.xar
# Packing-only formats
*.iso
*.tar
# Package management formats
*.dmg
*.xpi
*.gem
*.egg
*.deb
*.rpm
*.msi
*.msm
*.msp
*.txz
### Backup ### ### Backup ###
*.bak *.bak
@ -15,14 +46,13 @@
### DotnetCore ### ### DotnetCore ###
# .NET Core build folders # .NET Core build folders
/bin bin/
/obj obj/
# Common node modules locations # Common node modules locations
/node_modules /node_modules
/wwwroot/node_modules /wwwroot/node_modules
### Executable ### ### Executable ###
*.app *.app
*.bat *.bat
@ -30,7 +60,6 @@
*.com *.com
*.exe *.exe
*.gadget *.gadget
*.jar
*.pif *.pif
*.vb *.vb
*.wsf *.wsf
@ -42,8 +71,12 @@
export.cfg export.cfg
export_presets.cfg export_presets.cfg
# Imported translations (automatically generated from CSV files)
*.translation
# Mono-specific ignores # Mono-specific ignores
.mono/ .mono/
data_*/
### Linux ### ### Linux ###
*~ *~
@ -69,6 +102,7 @@ export_presets.cfg
# Icon must end with two \r # Icon must end with two \r
Icon Icon
# Thumbnails # Thumbnails
._* ._*
@ -104,10 +138,12 @@ test-results/
!.vscode/tasks.json !.vscode/tasks.json
!.vscode/launch.json !.vscode/launch.json
!.vscode/extensions.json !.vscode/extensions.json
*.code-workspace
### VisualStudioCode Patch ### ### VisualStudioCode Patch ###
# Ignore all local history of files # Ignore all local history of files
.history .history
.ionide
### Windows ### ### Windows ###
# Windows thumbnail cache files # Windows thumbnail cache files
@ -126,13 +162,12 @@ ehthumbs_vista.db
$RECYCLE.BIN/ $RECYCLE.BIN/
# Windows Installer files # Windows Installer files
*.cab
*.msi
*.msix *.msix
*.msm
*.msp
# Windows shortcuts # Windows shortcuts
*.lnk *.lnk
# End of https://www.gitignore.io/api/linux,godot,macos,backup,windows,dotnetcore,executable,monodevelop,visualstudiocode # End of https://www.toptal.com/developers/gitignore/api/windows,visualstudiocode,monodevelop,macos,linux,godot,executable,dotnetcore,backup,archives
# Custom rules (everything added below won't be overriden by 'Generate .gitignore File' if you use 'Update' option)

518
LICENSE
View file

@ -1,373 +1,201 @@
Mozilla Public License Version 2.0 The Artistic License 2.0
==================================
1. Definitions Copyright (c) 2000-2006, The Perl Foundation.
--------------
1.1. "Contributor" Everyone is permitted to copy and distribute verbatim copies
means each individual or legal entity that creates, contributes to of this license document, but changing it is not allowed.
the creation of, or owns Covered Software.
1.2. "Contributor Version" Preamble
means the combination of the Contributions of others (if any) used
by a Contributor and that particular Contributor's Contribution.
1.3. "Contribution" This license establishes the terms under which a given free software
means Covered Software of a particular Contributor. Package may be copied, modified, distributed, and/or redistributed.
The intent is that the Copyright Holder maintains some artistic
control over the development of that Package while still keeping the
Package available as open source and free software.
1.4. "Covered Software" You are always permitted to make arrangements wholly outside of this
means Source Code Form to which the initial Contributor has attached license directly with the Copyright Holder of a given Package. If the
the notice in Exhibit A, the Executable Form of such Source Code terms of this license do not permit the full use that you propose to
Form, and Modifications of such Source Code Form, in each case make of the Package, you should contact the Copyright Holder and seek
including portions thereof. a different licensing arrangement.
1.5. "Incompatible With Secondary Licenses" Definitions
means
(a) that the initial Contributor has attached the notice described "Copyright Holder" means the individual(s) or organization(s)
in Exhibit B to the Covered Software; or named in the copyright notice for the entire Package.
(b) that the Covered Software was made available under the terms of "Contributor" means any party that has contributed code or other
version 1.1 or earlier of the License, but not also under the material to the Package, in accordance with the Copyright Holder's
terms of a Secondary License. procedures.
1.6. "Executable Form" "You" and "your" means any person who would like to copy,
means any form of the work other than Source Code Form. distribute, or modify the Package.
1.7. "Larger Work" "Package" means the collection of files distributed by the
means a work that combines Covered Software with other material, in Copyright Holder, and derivatives of that collection and/or of
a separate file or files, that is not Covered Software. those files. A given Package may consist of either the Standard
Version, or a Modified Version.
1.8. "License" "Distribute" means providing a copy of the Package or making it
means this document. accessible to anyone else, or in the case of a company or
organization, to others outside of your company or organization.
1.9. "Licensable" "Distributor Fee" means any fee that you charge for Distributing
means having the right to grant, to the maximum extent possible, this Package or providing support for this Package to another
whether at the time of the initial grant or subsequently, any and party. It does not mean licensing fees.
all of the rights conveyed by this License.
1.10. "Modifications" "Standard Version" refers to the Package if it has not been
means any of the following: modified, or has been modified only in ways explicitly requested
by the Copyright Holder.
(a) any file in Source Code Form that results from an addition to, "Modified Version" means the Package, if it has been changed, and
deletion from, or modification of the contents of Covered such changes were not explicitly requested by the Copyright
Software; or Holder.
(b) any new file in Source Code Form that contains any Covered "Original License" means this Artistic License as Distributed with
Software. the Standard Version of the Package, in its current version or as
it may be modified by The Perl Foundation in the future.
1.11. "Patent Claims" of a Contributor "Source" form means the source code, documentation source, and
means any patent claim(s), including without limitation, method, configuration files for the Package.
process, and apparatus claims, in any patent Licensable by such
Contributor that would be infringed, but for the grant of the
License, by the making, using, selling, offering for sale, having
made, import, or transfer of either its Contributions or its
Contributor Version.
1.12. "Secondary License" "Compiled" form means the compiled bytecode, object code, binary,
means either the GNU General Public License, Version 2.0, the GNU or any other form resulting from mechanical transformation or
Lesser General Public License, Version 2.1, the GNU Affero General translation of the Source form.
Public License, Version 3.0, or any later versions of those
licenses.
1.13. "Source Code Form"
means the form of the work preferred for making modifications.
1.14. "You" (or "Your") Permission for Use and Modification Without Distribution
means an individual or a legal entity exercising rights under this
License. For legal entities, "You" includes any entity that
controls, is controlled by, or is under common control with You. For
purposes of this definition, "control" means (a) the power, direct
or indirect, to cause the direction or management of such entity,
whether by contract or otherwise, or (b) ownership of more than
fifty percent (50%) of the outstanding shares or beneficial
ownership of such entity.
2. License Grants and Conditions (1) You are permitted to use the Standard Version and create and use
-------------------------------- Modified Versions for any purpose without restriction, provided that
you do not Distribute the Modified Version.
2.1. Grants
Each Contributor hereby grants You a world-wide, royalty-free, Permissions for Redistribution of the Standard Version
non-exclusive license:
(a) under intellectual property rights (other than patent or trademark) (2) You may Distribute verbatim copies of the Source form of the
Licensable by such Contributor to use, reproduce, make available, Standard Version of this Package in any medium without restriction,
modify, display, perform, distribute, and otherwise exploit its either gratis or for a Distributor Fee, provided that you duplicate
Contributions, either on an unmodified basis, with Modifications, or all of the original copyright notices and associated disclaimers. At
as part of a Larger Work; and your discretion, such verbatim copies may or may not include a
Compiled form of the Package.
(b) under Patent Claims of such Contributor to make, use, sell, offer (3) You may apply any bug fixes, portability changes, and other
for sale, have made, import, and otherwise transfer either its modifications made available from the Copyright Holder. The resulting
Contributions or its Contributor Version. Package will still be considered the Standard Version, and as such
will be subject to the Original License.
2.2. Effective Date
The licenses granted in Section 2.1 with respect to any Contribution Distribution of Modified Versions of the Package as Source
become effective for each Contribution on the date the Contributor first
distributes such Contribution.
2.3. Limitations on Grant Scope (4) You may Distribute your Modified Version as Source (either gratis
or for a Distributor Fee, and with or without a Compiled form of the
Modified Version) provided that you clearly document how it differs
from the Standard Version, including, but not limited to, documenting
any non-standard features, executables, or modules, and provided that
you do at least ONE of the following:
The licenses granted in this Section 2 are the only rights granted under (a) make the Modified Version available to the Copyright Holder
this License. No additional rights or licenses will be implied from the of the Standard Version, under the Original License, so that the
distribution or licensing of Covered Software under this License. Copyright Holder may include your modifications in the Standard
Notwithstanding Section 2.1(b) above, no patent license is granted by a Version.
Contributor:
(b) ensure that installation of your Modified Version does not
(a) for any code that a Contributor has removed from Covered Software; prevent the user installing or running the Standard Version. In
or addition, the Modified Version must bear a name that is different
from the name of the Standard Version.
(b) for infringements caused by: (i) Your and any other third party's
modifications of Covered Software, or (ii) the combination of its (c) allow anyone who receives a copy of the Modified Version to
Contributions with other software (except as part of its Contributor make the Source form of the Modified Version available to others
Version); or under
(c) under Patent Claims infringed by Covered Software in the absence of (i) the Original License or
its Contributions.
(ii) a license that permits the licensee to freely copy,
This License does not grant any rights in the trademarks, service marks, modify and redistribute the Modified Version using the same
or logos of any Contributor (except as may be necessary to comply with licensing terms that apply to the copy that the licensee
the notice requirements in Section 3.4). received, and requires that the Source form of the Modified
Version, and of any works derived from it, be made freely
2.4. Subsequent Licenses available in that license fees are prohibited but Distributor
Fees are allowed.
No Contributor makes additional grants as a result of Your choice to
distribute the Covered Software under a subsequent version of this
License (see Section 10.2) or under the terms of a Secondary License (if Distribution of Compiled Forms of the Standard Version
permitted under the terms of Section 3.3). or Modified Versions without the Source
2.5. Representation (5) You may Distribute Compiled forms of the Standard Version without
the Source, provided that you include complete instructions on how to
Each Contributor represents that the Contributor believes its get the Source of the Standard Version. Such instructions must be
Contributions are its original creation(s) or it has sufficient rights valid at the time of your distribution. If these instructions, at any
to grant the rights to its Contributions conveyed by this License. time while you are carrying out such distribution, become invalid, you
must provide new instructions on demand or cease further distribution.
2.6. Fair Use If you provide valid instructions or cease distribution within thirty
days after you become aware that the instructions are invalid, then
This License is not intended to limit any rights You have under you do not forfeit any of your rights under this license.
applicable copyright doctrines of fair use, fair dealing, or other
equivalents. (6) You may Distribute a Modified Version in Compiled form without
the Source, provided that you comply with Section 4 with respect to
2.7. Conditions the Source of the Modified Version.
Sections 3.1, 3.2, 3.3, and 3.4 are conditions of the licenses granted
in Section 2.1. Aggregating or Linking the Package
3. Responsibilities (7) You may aggregate the Package (either the Standard Version or
------------------- Modified Version) with other packages and Distribute the resulting
aggregation provided that you do not charge a licensing fee for the
3.1. Distribution of Source Form Package. Distributor Fees are permitted, and licensing fees for other
components in the aggregation are permitted. The terms of this license
All distribution of Covered Software in Source Code Form, including any apply to the use and Distribution of the Standard or Modified Versions
Modifications that You create or to which You contribute, must be under as included in the aggregation.
the terms of this License. You must inform recipients that the Source
Code Form of the Covered Software is governed by the terms of this (8) You are permitted to link Modified and Standard Versions with
License, and how they can obtain a copy of this License. You may not other works, to embed the Package in a larger work of your own, or to
attempt to alter or restrict the recipients' rights in the Source Code build stand-alone binary or bytecode versions of applications that
Form. include the Package, and Distribute the result without restriction,
provided the result does not expose a direct interface to the Package.
3.2. Distribution of Executable Form
If You distribute Covered Software in Executable Form then: Items That are Not Considered Part of a Modified Version
(a) such Covered Software must also be made available in Source Code (9) Works (including, but not limited to, modules and scripts) that
Form, as described in Section 3.1, and You must inform recipients of merely extend or make use of the Package, do not, by themselves, cause
the Executable Form how they can obtain a copy of such Source Code the Package to be a Modified Version. In addition, such works are not
Form by reasonable means in a timely manner, at a charge no more considered parts of the Package itself, and are not subject to the
than the cost of distribution to the recipient; and terms of this license.
(b) You may distribute such Executable Form under the terms of this
License, or sublicense it under different terms, provided that the General Provisions
license for the Executable Form does not attempt to limit or alter
the recipients' rights in the Source Code Form under this License. (10) Any use, modification, and distribution of the Standard or
Modified Versions is governed by this Artistic License. By using,
3.3. Distribution of a Larger Work modifying or distributing the Package, you accept this license. Do not
use, modify, or distribute the Package, if you do not accept this
You may create and distribute a Larger Work under terms of Your choice, license.
provided that You also comply with the requirements of this License for
the Covered Software. If the Larger Work is a combination of Covered (11) If your Modified Version has been derived from a Modified
Software with a work governed by one or more Secondary Licenses, and the Version made by someone other than you, you are nevertheless required
Covered Software is not Incompatible With Secondary Licenses, this to ensure that your Modified Version complies with the requirements of
License permits You to additionally distribute such Covered Software this license.
under the terms of such Secondary License(s), so that the recipient of
the Larger Work may, at their option, further distribute the Covered (12) This license does not grant you the right to use any trademark,
Software under the terms of either this License or such Secondary service mark, tradename, or logo of the Copyright Holder.
License(s).
(13) This license includes the non-exclusive, worldwide,
3.4. Notices free-of-charge patent license to make, have made, use, offer to sell,
sell, import and otherwise transfer the Package with respect to any
You may not remove or alter the substance of any license notices patent claims licensable by the Copyright Holder that are necessarily
(including copyright notices, patent notices, disclaimers of warranty, infringed by the Package. If you institute patent litigation
or limitations of liability) contained within the Source Code Form of (including a cross-claim or counterclaim) against any party alleging
the Covered Software, except that You may alter any license notices to that the Package constitutes direct or contributory patent
the extent required to remedy known factual inaccuracies. infringement, then this Artistic License to you shall terminate on the
date that such litigation is filed.
3.5. Application of Additional Terms
(14) Disclaimer of Warranty:
You may choose to offer, and to charge a fee for, warranty, support, THE PACKAGE IS PROVIDED BY THE COPYRIGHT HOLDER AND CONTRIBUTORS "AS
indemnity or liability obligations to one or more recipients of Covered IS" AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES. THE IMPLIED
Software. However, You may do so only on Your own behalf, and not on WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR
behalf of any Contributor. You must make it absolutely clear that any NON-INFRINGEMENT ARE DISCLAIMED TO THE EXTENT PERMITTED BY YOUR LOCAL
such warranty, support, indemnity, or liability obligation is offered by LAW. UNLESS REQUIRED BY LAW, NO COPYRIGHT HOLDER OR CONTRIBUTOR WILL
You alone, and You hereby agree to indemnify every Contributor for any BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
liability incurred by such Contributor as a result of warranty, support, DAMAGES ARISING IN ANY WAY OUT OF THE USE OF THE PACKAGE, EVEN IF
indemnity or liability terms You offer. You may include additional ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
disclaimers of warranty and limitations of liability specific to any
jurisdiction.
4. Inability to Comply Due to Statute or Regulation
---------------------------------------------------
If it is impossible for You to comply with any of the terms of this
License with respect to some or all of the Covered Software due to
statute, judicial order, or regulation then You must: (a) comply with
the terms of this License to the maximum extent possible; and (b)
describe the limitations and the code they affect. Such description must
be placed in a text file included with all distributions of the Covered
Software under this License. Except to the extent prohibited by statute
or regulation, such description must be sufficiently detailed for a
recipient of ordinary skill to be able to understand it.
5. Termination
--------------
5.1. The rights granted under this License will terminate automatically
if You fail to comply with any of its terms. However, if You become
compliant, then the rights granted under this License from a particular
Contributor are reinstated (a) provisionally, unless and until such
Contributor explicitly and finally terminates Your grants, and (b) on an
ongoing basis, if such Contributor fails to notify You of the
non-compliance by some reasonable means prior to 60 days after You have
come back into compliance. Moreover, Your grants from a particular
Contributor are reinstated on an ongoing basis if such Contributor
notifies You of the non-compliance by some reasonable means, this is the
first time You have received notice of non-compliance with this License
from such Contributor, and You become compliant prior to 30 days after
Your receipt of the notice.
5.2. If You initiate litigation against any entity by asserting a patent
infringement claim (excluding declaratory judgment actions,
counter-claims, and cross-claims) alleging that a Contributor Version
directly or indirectly infringes any patent, then the rights granted to
You by any and all Contributors for the Covered Software under Section
2.1 of this License shall terminate.
5.3. In the event of termination under Sections 5.1 or 5.2 above, all
end user license agreements (excluding distributors and resellers) which
have been validly granted by You or Your distributors under this License
prior to termination shall survive termination.
************************************************************************
* *
* 6. Disclaimer of Warranty *
* ------------------------- *
* *
* Covered Software is provided under this License on an "as is" *
* basis, without warranty of any kind, either expressed, implied, or *
* statutory, including, without limitation, warranties that the *
* Covered Software is free of defects, merchantable, fit for a *
* particular purpose or non-infringing. The entire risk as to the *
* quality and performance of the Covered Software is with You. *
* Should any Covered Software prove defective in any respect, You *
* (not any Contributor) assume the cost of any necessary servicing, *
* repair, or correction. This disclaimer of warranty constitutes an *
* essential part of this License. No use of any Covered Software is *
* authorized under this License except under this disclaimer. *
* *
************************************************************************
************************************************************************
* *
* 7. Limitation of Liability *
* -------------------------- *
* *
* Under no circumstances and under no legal theory, whether tort *
* (including negligence), contract, or otherwise, shall any *
* Contributor, or anyone who distributes Covered Software as *
* permitted above, be liable to You for any direct, indirect, *
* special, incidental, or consequential damages of any character *
* including, without limitation, damages for lost profits, loss of *
* goodwill, work stoppage, computer failure or malfunction, or any *
* and all other commercial damages or losses, even if such party *
* shall have been informed of the possibility of such damages. This *
* limitation of liability shall not apply to liability for death or *
* personal injury resulting from such party's negligence to the *
* extent applicable law prohibits such limitation. Some *
* jurisdictions do not allow the exclusion or limitation of *
* incidental or consequential damages, so this exclusion and *
* limitation may not apply to You. *
* *
************************************************************************
8. Litigation
-------------
Any litigation relating to this License may be brought only in the
courts of a jurisdiction where the defendant maintains its principal
place of business and such litigation shall be governed by laws of that
jurisdiction, without reference to its conflict-of-law provisions.
Nothing in this Section shall prevent a party's ability to bring
cross-claims or counter-claims.
9. Miscellaneous
----------------
This License represents the complete agreement concerning the subject
matter hereof. If any provision of this License is held to be
unenforceable, such provision shall be reformed only to the extent
necessary to make it enforceable. Any law or regulation which provides
that the language of a contract shall be construed against the drafter
shall not be used to construe this License against a Contributor.
10. Versions of the License
---------------------------
10.1. New Versions
Mozilla Foundation is the license steward. Except as provided in Section
10.3, no one other than the license steward has the right to modify or
publish new versions of this License. Each version will be given a
distinguishing version number.
10.2. Effect of New Versions
You may distribute the Covered Software under the terms of the version
of the License under which You originally received the Covered Software,
or under the terms of any subsequent version published by the license
steward.
10.3. Modified Versions
If you create software not governed by this License, and you want to
create a new license for such software, you may create and use a
modified version of this License if you rename the license and remove
any references to the name of the license steward (except to note that
such modified license differs from this License).
10.4. Distributing Source Code Form that is Incompatible With Secondary
Licenses
If You choose to distribute Source Code Form that is Incompatible With
Secondary Licenses under the terms of this version of the License, the
notice described in Exhibit B of this License must be attached.
Exhibit A - Source Code Form License Notice
-------------------------------------------
This Source Code Form is subject to the terms of the Mozilla Public
License, v. 2.0. If a copy of the MPL was not distributed with this
file, You can obtain one at http://mozilla.org/MPL/2.0/.
If it is not possible or desirable to put the notice in a particular
file, then You may include the notice in a location (such as a LICENSE
file in a relevant directory) where a recipient would be likely to look
for such a notice.
You may add additional accurate notices of copyright ownership.
Exhibit B - "Incompatible With Secondary Licenses" Notice
---------------------------------------------------------
This Source Code Form is "Incompatible With Secondary Licenses", as
defined by the Mozilla Public License, v. 2.0.

View file

@ -28,4 +28,4 @@ Note: this is subject to change in the future.
## License ## License
This project is licensed under the MPL 2.0 License - see the [LICENSE](LICENSE) file for details This project is licensed under the Artistic-2.0 License - see the [LICENSE](LICENSE) file for details

View file

@ -15,15 +15,15 @@ _global_script_class_icons={
[application] [application]
config/name="City Limits" config/name="City Limits"
run/main_scene="res://scenes/Start.tscn" run/main_scene="res://scenes/Game.tscn"
config/icon="res://icon.png" config/icon="res://icon.png"
config/windows_native_icon="res://icon.ico" config/windows_native_icon="res://icon.ico"
[autoload] [autoload]
CityData="*res://scripts/autoload/SimData.gd" CityData="*res://scripts/autoload/sim_data.gd"
SimData="*res://scripts/autoload/SimData.gd" SimData="*res://scripts/autoload/sim_data.gd"
SimEvents="*res://scripts/autoload/SimEvents.gd" SimEvents="*res://scripts/autoload/sim_events.gd"
[display] [display]

View file

@ -1,22 +1,22 @@
[gd_scene load_steps=5 format=2] [gd_scene load_steps=5 format=2]
[ext_resource path="res://sprites/water.tres" type="TileSet" id=1] [ext_resource path="res://sprites/water.tres" type="TileSet" id=1]
[ext_resource path="res://scripts/Map.gd" type="Script" id=2] [ext_resource path="res://scripts/map_generator.gd" type="Script" id=2]
[ext_resource path="res://sprites/terrian.tres" type="TileSet" id=4] [ext_resource path="res://sprites/terrian.tres" type="TileSet" id=4]
[ext_resource path="res://scripts/CameraMove.gd" type="Script" id=5] [ext_resource path="res://scripts/camera_move.gd" type="Script" id=5]
[node name="world" type="Node2D"] [node name="World" type="Node2D"]
script = ExtResource( 2 ) script = ExtResource( 2 )
__meta__ = { __meta__ = {
"_edit_lock_": true "_edit_lock_": true
} }
[node name="water" type="TileMap" parent="."] [node name="Water" type="TileMap" parent="."]
tile_set = ExtResource( 1 ) tile_set = ExtResource( 1 )
cell_size = Vector2( 16, 16 ) cell_size = Vector2( 16, 16 )
format = 1 format = 1
[node name="terrian" type="TileMap" parent="."] [node name="Terrian" type="TileMap" parent="."]
tile_set = ExtResource( 4 ) tile_set = ExtResource( 4 )
cell_size = Vector2( 16, 16 ) cell_size = Vector2( 16, 16 )
format = 1 format = 1

View file

@ -1,6 +1,6 @@
[gd_scene load_steps=3 format=2] [gd_scene load_steps=3 format=2]
[ext_resource path="res://scripts/StartGame.gd" type="Script" id=1] [ext_resource path="res://scripts/start_game.gd" type="Script" id=1]
[ext_resource path="res://scenes/Map.tscn" type="PackedScene" id=2] [ext_resource path="res://scenes/Map.tscn" type="PackedScene" id=2]
[node name="SartMenu" type="Node"] [node name="SartMenu" type="Node"]

View file

@ -29,7 +29,6 @@ script = ExtResource( 1 )
[node name="Quarters" type="Timer" parent="."] [node name="Quarters" type="Timer" parent="."]
wait_time = 10.0 wait_time = 10.0
autostart = true
[node name="Sprite" type="Sprite" parent="."] [node name="Sprite" type="Sprite" parent="."]
texture = ExtResource( 2 ) texture = ExtResource( 2 )

View file

@ -2,8 +2,8 @@
[ext_resource path="res://scenes/Map.tscn" type="PackedScene" id=1] [ext_resource path="res://scenes/Map.tscn" type="PackedScene" id=1]
[ext_resource path="res://scenes/Advise.tscn" type="PackedScene" id=2] [ext_resource path="res://scenes/Advise.tscn" type="PackedScene" id=2]
[ext_resource path="res://scripts/Status.gd" type="Script" id=3] [ext_resource path="res://scripts/city_status.gd" type="Script" id=3]
[ext_resource path="res://scripts/Game.gd" type="Script" id=4] [ext_resource path="res://scripts/gameplay.gd" type="Script" id=4]
[ext_resource path="res://sprites/police.png" type="Texture" id=5] [ext_resource path="res://sprites/police.png" type="Texture" id=5]
[ext_resource path="res://sprites/firestation.png" type="Texture" id=6] [ext_resource path="res://sprites/firestation.png" type="Texture" id=6]
@ -42,7 +42,7 @@ __meta__ = {
[node name="Status" type="VBoxContainer" parent="Controls/GUI/Status/Toolbar"] [node name="Status" type="VBoxContainer" parent="Controls/GUI/Status/Toolbar"]
margin_right = 93.0 margin_right = 93.0
margin_bottom = 66.0 margin_bottom = 65.0
script = ExtResource( 3 ) script = ExtResource( 3 )
__meta__ = { __meta__ = {
"_edit_use_anchors_": true "_edit_use_anchors_": true
@ -86,11 +86,13 @@ text = "#"
[node name="PoliceBtn" type="TextureButton" parent="Controls/GUI/Status/Toolbar"] [node name="PoliceBtn" type="TextureButton" parent="Controls/GUI/Status/Toolbar"]
margin_left = 97.0 margin_left = 97.0
margin_right = 145.0 margin_right = 145.0
margin_bottom = 66.0 margin_bottom = 65.0
texture_normal = ExtResource( 5 ) texture_normal = ExtResource( 5 )
[node name="FireBtn" type="TextureButton" parent="Controls/GUI/Status/Toolbar"] [node name="FireBtn" type="TextureButton" parent="Controls/GUI/Status/Toolbar"]
margin_left = 149.0 margin_left = 149.0
margin_right = 197.0 margin_right = 197.0
margin_bottom = 66.0 margin_bottom = 65.0
texture_normal = ExtResource( 6 ) texture_normal = ExtResource( 6 )
[connection signal="pressed" from="Controls/GUI/Status/Toolbar/PoliceBtn" to="Map" method="_on_PoliceBtn_pressed"]

View file

@ -1,33 +0,0 @@
extends Node2D
var noise: OpenSimplexNoise
var map_size = Vector2(80, 60)
var terrian_cap = 0.3
func _ready():
randomize()
noise = OpenSimplexNoise.new()
noise.seed = randi()
noise.octaves = 1.5
noise.period = 12
make_terrian_map()
make_water()
func make_terrian_map():
for x in map_size.x:
for y in map_size.y:
var a = noise.get_noise_2d(x, y)
if a < terrian_cap:
$terrian.set_cell(x, y, 0)
$terrian.update_bitmask_region(Vector2(0.0, 0.0), Vector2(map_size.x, map_size.y))
func make_water():
for x in map_size.x:
for y in map_size.y:
if $terrian.get_cell(x, y):
$water.set_cell(x, y, 0)
$water.update_bitmask_region(Vector2(0.0, 0.0), Vector2(map_size.x, map_size.y))

View file

@ -1,5 +1,8 @@
extends KinematicBody2D extends KinematicBody2D
signal grabbed
signal power
export var cost: int = 10000 export var cost: int = 10000
export var income: int export var income: int
export var expense: int export var expense: int
@ -9,38 +12,52 @@ onready var quarters = $Quarters
onready var player = $AnimationPlayer onready var player = $AnimationPlayer
var can_grab = false var can_grab = false
var is_powered = false
var grabbed_offset = Vector2() var grabbed_offset = Vector2()
func _ready(): func _ready():
SimEvents.connect("pay_expense", self, "_get_expense") SimEvents.connect("pay_expense", self, "_get_expense")
connect("grabbed", self, "_grab_zone")
# Once placed in-world, it'll substract from your budget connect("power", self, "_power_zone")
if SimData.budget >= cost:
SimData.budget -= cost
func _input(event): func _input(event):
if event is InputEventMouseButton: if event is InputEventMouseButton and can_grab:
can_grab = event.pressed # Disable grabbing
can_grab = false
grabbed_offset = position - get_global_mouse_position() grabbed_offset = position - get_global_mouse_position()
func _process(delta):
player.play("Animante")
if SimData.budget >= expense:
SimData.budget -= expense
if SimData.budget >= income: # Substract from the player's budget
SimData.budget += income if SimData.budget >= cost:
SimData.budget -= cost
if Input.is_mouse_button_pressed(BUTTON_LEFT) and can_grab:
func _process(delta):
if can_grab:
position = get_global_mouse_position() + grabbed_offset position = get_global_mouse_position() + grabbed_offset
if not is_powered:
quarters.stop()
else:
quarters.start()
func _grab_zone():
can_grab = true
func _power_zone():
quarters.start()
player.play("Animante")
func _on_Quarters_timeout(): func _on_Quarters_timeout():
if SimData.prev_quarter == 4: if SimData.prev_quarter == 4:
if SimData.budget >= expense:
SimData.budget -= expense
if SimData.budget >= income:
SimData.budget += income
SimData.year += 1 SimData.year += 1
SimData.emit_signal("one_time_zone") SimData.emit_signal("one_time_zone")
SimData.emit_signal("pay_expense") SimData.emit_signal("pay_expense")
SimData.prev_quarter = SimData.quarter SimData.prev_quarter = SimData.quarter
quarters.start() quarters.start()

View file

@ -7,7 +7,7 @@ var quarter: int = 1
var population: int = 0 var population: int = 0
var news_ticker: String var news_ticker: String
var budget: int var budget: int = 10000000
var prev_budget: int var prev_budget: int
var res_tax: int var res_tax: int

51
scripts/map_generator.gd Normal file
View file

@ -0,0 +1,51 @@
extends Node2D
var noise: OpenSimplexNoise
var map_size = Vector2(80, 60)
var terrian_cap = 0.3
onready var terrian = $Terrian
onready var water = $Water
func _ready():
randomize()
noise = OpenSimplexNoise.new()
noise.seed = randi()
noise.octaves = 1.5
noise.period = 12
make_terrian_map()
make_water()
func make_terrian_map():
for x in map_size.x:
for y in map_size.y:
var a = noise.get_noise_2d(x, y)
if a < terrian_cap:
terrian.set_cell(x, y, 0)
terrian.update_bitmask_region(Vector2(0.0, 0.0), Vector2(map_size.x, map_size.y))
func make_water():
for x in map_size.x:
for y in map_size.y:
if terrian.get_cell(x, y):
water.set_cell(x, y, 0)
water.update_bitmask_region(Vector2(0.0, 0.0), Vector2(map_size.x, map_size.y))
func fake_click(flags=0):
var ev = InputEvent
ev.type = InputEvent.MOUSE_BUTTON
ev.button_index=BUTTON_LEFT
ev.pressed = true
ev.global_pos = get_global_mouse_position()
ev.meta = flags
get_tree().input_event(ev)
func _on_PoliceBtn_pressed():
var police = preload("res://scenes/Zone.tscn")
var instance = police.instance()
add_child(instance)
instance.emit_signal("grabbed")

View file

@ -1,8 +1,11 @@
extends Panel extends Panel
onready var city_name = $Container/CityNameEdit.text onready var city_name = $Container/CityNameEdit.text
onready var budget = $Container/BudgetMenu
func _on_CreateBtn_pressed(): func _on_CreateBtn_pressed():
SimData.city_name = city_name SimData.city_name = city_name
get_tree().change_scene("res://scenes/Game.tscn") get_tree().change_scene("res://scenes/Game.tscn")