diff --git a/ASSET-LICENSE.md b/ASSET-LICENSE.md index 50933b5..9519836 100644 --- a/ASSET-LICENSE.md +++ b/ASSET-LICENSE.md @@ -1,14 +1,15 @@ -# NETfishing Asset License 1.0 +# straywild Asset License 1.1 Copyright © 2026 Woofmeow. All rights reserved except for the permissions expressly granted below. ## 1. Scope -This license applies to original NETfishing artwork, graphics, textures, +This license applies to original straywild artwork, graphics, textures, models, animations, music, sound recordings, narrative content, visual -designs, characters, and other creative assets owned by the NETfishing owners, -publishing as Woofmeow (the **“NETfishing Assets”**). +designs, characters, and other creative assets owned by the straywild owners +or licensed to them with authority to sublicense, publishing as Woofmeow (the +**“straywild Assets”**). It does not apply to: @@ -16,118 +17,171 @@ It does not apply to: - third-party material identified in the source repository's `docs/ATTRIBUTION.md` or the packaged `ATTRIBUTION.md` notice; - material accompanied by a different license; or -- the NETfishing and Woofmeow names and logos, which are addressed in +- the straywild and Woofmeow names and logos, which are addressed in `TRADEMARKS.md`. Repository location alone does not change third-party ownership or licensing. ## 2. Definitions -**Official NETfishing Software** means: +**Official straywild Software** means: -- an unmodified binary release published by the NETfishing owners through an - official NETfishing distribution channel; or -- a build made from an unmodified official NETfishing source release or tagged +- an unmodified binary release published by the straywild owners through an + official straywild distribution channel; or +- a build made from an unmodified official straywild source release or tagged revision. **Mod** means a non-standalone add-on created to operate with Official -NETfishing Software. A Mod may add, replace, or alter content loaded by the -Official NETfishing Software, but it may not redistribute a replacement copy +straywild Software. A Mod may add, replace, or alter content loaded by the +Official straywild Software, but it may not redistribute a replacement copy of the game or represent a fork, clone, sequel, or separate game. +**Contribution Fork** means a source-control fork or clone of an official +straywild source repository that is created and maintained in good faith +primarily to prepare, test, review, or submit changes for possible inclusion +in Official straywild Software. It does not include a fork presented or +developed as an independent game, community edition, replacement distribution, +or ongoing product separate from the official straywild project. + ## 3. Permission to use the official game -You may reproduce NETfishing Assets as technically necessary to install, run, -back up, and privately modify a lawfully obtained copy of Official NETfishing +You may reproduce straywild Assets as technically necessary to install, run, +back up, and privately modify a lawfully obtained copy of Official straywild Software. You may capture, publish, and monetize screenshots, gameplay videos, livestreams, reviews, tutorials, and similar commentary showing a lawfully -obtained copy of NETfishing. This permission does not authorize redistribution +obtained copy of straywild. This permission does not authorize redistribution of the source asset files or imply endorsement. ## 4. Community Mod license -Subject to this license, you may create, modify, and distribute NETfishing -Assets solely as part of a Mod for Official NETfishing Software. +Subject to this license, you may create, modify, and distribute straywild +Assets solely as part of a Mod for Official straywild Software. This permission is worldwide, nonexclusive, royalty-free, and available for as long as you comply with this license. It permits only the copies of -NETfishing Assets reasonably necessary for the Mod to function. It does not +straywild Assets reasonably necessary for the Mod to function. It does not permit distributing the original game, a substantially complete collection of its assets, or a general-purpose asset pack. A distributed Mod must: -1. require a separately obtained copy of Official NETfishing Software; +1. require a separately obtained copy of Official straywild Software; 2. be presented as unofficial community content; 3. include the following notice in its documentation or distribution page: - > Contains or adapts NETfishing assets © 2026 Woofmeow, used under the - > NETfishing Asset License 1.0. This Mod is unofficial and is not endorsed + > Contains or adapts straywild assets © 2026 Woofmeow, used under the + > straywild Asset License 1.1. This Mod is unofficial and is not endorsed > by Woofmeow. -4. identify material created by the Mod author separately from NETfishing +4. identify material created by the Mod author separately from straywild Assets; and 5. comply with `TRADEMARKS.md`. Mods may be shared without charge and may accept voluntary donations that do not purchase access, features, or preferential treatment. Selling a Mod, -charging for access to it, licensing it commercially, or using NETfishing +charging for access to it, licensing it commercially, or using straywild Assets in paid products requires separate written permission from both -NETfishing owners. +straywild owners. -## 5. Uses not permitted +## 5. Contribution Fork license -Except with separate written permission from both NETfishing owners, you may -not use or distribute NETfishing Assets: +Subject to this license, you may reproduce, modify, and distribute straywild +Assets within a Contribution Fork. You may also make the nonpublic builds +reasonably necessary to develop, test, and review its proposed contribution. -- in a fork, clone, remake, sequel, or standalone game; -- with a modified distribution of the GPL-covered NETfishing code that is not - Official NETfishing Software; +This permission is worldwide, nonexclusive, royalty-free, and available for +as long as you comply with this license. Public source-control hosting of the +Contribution Fork and the repository history technically necessary for that +fork are permitted distributions. + +A Contribution Fork must: + +1. remain primarily directed toward preparing changes for possible inclusion + in the official straywild project; +2. preserve this license and the official straywild project's applicable + attribution, third-party license, and copyright notices; +3. remain visibly linked to or identified as a fork of the official source + repository and not be presented as official or endorsed; +4. limit test-build access to the owners, maintainers, contributors, and + testers directly participating in development or review of the proposed + contribution; +5. not publish general-audience binaries, releases, packages, or downloads, + operate a persistent public alternative service, or monetize access; +6. not distribute the straywild Assets as a standalone extraction, archive, + or general-purpose asset pack; and +7. comply with `TRADEMARKS.md`. + +Temporary access-controlled servers may be operated when reasonably necessary +to test a proposed contribution. They may not be promoted or maintained as a +public alternative to Official straywild Software or its services. + +Submitting work from a Contribution Fork is governed separately by +`CONTRIBUTOR-TERMS.md` and does not require the straywild owners to accept the +work. Declining or closing a proposed contribution does not retroactively +invalidate good-faith use under this section. A compliant Contribution Fork +may remain publicly accessible as an archival development record, but it may +not be repurposed for continued development or distribution of a separate +product containing straywild Assets. + +## 6. Uses not permitted + +Except as expressly permitted by Sections 3, 4, and 5 or by separate written +permission from both straywild owners, you may not use or distribute +straywild Assets: + +- in a fork, clone, remake, sequel, or standalone game that is not a qualifying + Contribution Fork; +- with a modified distribution of the GPL-covered straywild code that is not + Official straywild Software, except for nonpublic contribution-testing + builds permitted by Section 5; - in another game, application, asset library, template, or merchandise; - as a substantially complete asset extraction or archive; - in a way that implies sponsorship, endorsement, or official status; - to register a confusingly similar trademark, domain, account, or product identity; or -- under terms that claim ownership of the NETfishing Assets themselves. +- under terms that claim ownership of the straywild Assets themselves. -The GPL permits forks and redistribution of the GPL-covered code. This asset -license does not permit those forks to carry NETfishing Assets. A code fork -must remove or replace the NETfishing Assets and reserved branding unless both -owners grant separate written permission. +The GPL permits forks and redistribution of the GPL-covered code. Except for a +qualifying Contribution Fork under Section 5, this asset license does not +permit those forks to carry straywild Assets. A code fork that is not a +Contribution Fork must remove or replace the straywild Assets and reserved +branding unless both owners grant separate written permission. -## 6. Ownership of Mods +## 7. Ownership of Mods and contribution work -You retain ownership of your original Mod material. The NETfishing owners -retain ownership of the NETfishing Assets and adaptations of those assets to -the extent provided by applicable law. +You retain ownership of your original Mod material and original material +created in a Contribution Fork. The straywild owners retain ownership of the +straywild Assets and adaptations of those assets to the extent provided by +applicable law. -This license does not require you to assign your original Mod material to the -NETfishing owners. It also does not grant you ownership of the underlying -NETfishing Assets. +This license does not require you to assign or submit your original material. +It also does not grant you ownership of the underlying straywild Assets. If +you intentionally submit material for inclusion in straywild, +`CONTRIBUTOR-TERMS.md` applies separately. -## 7. Termination and cure +## 8. Termination and cure Your permissions under this license terminate automatically if you violate its terms. They are reinstated provisionally when you stop the violation and -permanently if both NETfishing owners do not notify you of the violation +permanently if both straywild owners do not notify you of the violation within sixty days after it has been cured. Termination does not limit remedies available for activity outside this license. -## 8. No warranty +## 9. No warranty -THE NETFISHING ASSETS ARE PROVIDED “AS IS,” WITHOUT WARRANTY OF ANY KIND, +THE straywild ASSETS ARE PROVIDED “AS IS,” WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE, OR NON-INFRINGEMENT. TO THE MAXIMUM EXTENT PERMITTED BY LAW, THE OWNERS WILL NOT BE LIABLE FOR ANY CLAIM, DAMAGES, OR -OTHER LIABILITY ARISING FROM THIS LICENSE OR USE OF THE NETFISHING ASSETS. +OTHER LIABILITY ARISING FROM THIS LICENSE OR USE OF THE straywild ASSETS. -## 9. Additional permission +## 10. Additional permission -Uses not granted here require written permission from both NETfishing owners. +Uses not granted here require written permission from both straywild owners. A permission granted to one person or project does not amend this license for others. diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 62c7813..2dc5724 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,14 +1,32 @@ -# Contributing +# Contribution policy -NETfishing is currently developed through focused changes on the repository's -active development branch. Coordinate scope with the project owner before -starting substantial work. +straywild is an owner-directed Woofmeow project and is not accepting +unsolicited contributions. Please do not submit pull requests, patches, code, +artwork, models, audio, writing, documentation, translations, designs, or +other implementation work. Pull requests are disabled for the official +repositories. -By intentionally submitting material for inclusion, contributors agree to the -applicable grants and representations in -[`CONTRIBUTOR-TERMS.md`](CONTRIBUTOR-TERMS.md). Maintainers must preserve an -affirmative record of that agreement. Contact the owners before submitting if -separate written terms are needed. +Issues remain available for reproducible bug reports and player feedback. An +Issue is not a request for contributed implementation, and attaching or +linking unsolicited work does not make it an accepted Project contribution. + +The owners may occasionally invite specific work in writing before it is +created or submitted. [`CONTRIBUTOR-TERMS.md`](CONTRIBUTOR-TERMS.md) is retained +to document previously accepted contributions and govern expressly invited +work; it is not a standing invitation to contribute. + +## Contribution forks + +The [straywild Asset License](ASSET-LICENSE.md) contains limited permissions +for qualifying Contribution Forks. Those permissions do not promise review or +acceptance and do not override the policy above. Keep the hosting platform's +fork relationship visible, preserve all license and attribution notices, and +do not publish general-audience builds or use the fork as an independent game +or distribution. + +Private test builds and temporary access-controlled test servers may be shared +only as allowed by that license. Permission to maintain a Contribution Fork +does not authorize unsolicited submission or obligate the owners to review it. ## Change discipline @@ -21,13 +39,15 @@ separate written terms are needed. - Keep presentation-only systems out of save files and network messages. - Store runtime assets under repository-owned paths; never reference a workstation sync or temporary directory. -- Record the source and license of newly imported assets in - [`docs/ATTRIBUTION.md`](docs/ATTRIBUTION.md). +- Retain source, permission, and license evidence for newly imported assets. + Update [`docs/ATTRIBUTION.md`](docs/ATTRIBUTION.md) when the accepted work + adds or changes a distributed credit or third-party notice; do not add a + file-by-file inventory of ordinary project-owned assets. - Do not assume the GPL code license applies to project assets; observe [`ASSET-LICENSE.md`](ASSET-LICENSE.md) and third-party terms. - Do not commit `.godot/`, test data, logs, captures, or build outputs. -## Before requesting review +## Before committing a maintainer change ```sh git diff --check @@ -48,7 +68,7 @@ tests are supporting evidence, not a replacement. - Do not mix generated build artifacts with source changes. - Do not rewrite published release tags. - Describe behavior, compatibility impact, validation, and asset provenance in - the review or release record. + the internal review or release record. ## Style @@ -59,4 +79,4 @@ using display strings as persistent identifiers. New standalone source files should use `SPDX-License-Identifier: GPL-3.0-or-later` where the file format permits comments. Do not add that -identifier to asset files governed by the NETfishing Asset License. +identifier to asset files governed by the straywild Asset License. diff --git a/CONTRIBUTOR-TERMS.md b/CONTRIBUTOR-TERMS.md index 8ef207e..261de60 100644 --- a/CONTRIBUTOR-TERMS.md +++ b/CONTRIBUTOR-TERMS.md @@ -1,12 +1,17 @@ -# NETfishing contributor terms +# straywild contributor terms -These terms apply to contributions intentionally submitted for inclusion in -NETfishing after these terms are published. They do not retroactively change -ownership of earlier work or replace a separately signed agreement. +straywild does not accept unsolicited contributions. These terms are retained +as the governing record for contributions previously accepted after their +publication and for specific future work that both Owners expressly invite in +writing before submission. They are not a request or standing invitation for +patches, pull requests, assets, or other material. -“Owners” means the two NETfishing co-owners who publish the Project as +These terms do not retroactively change ownership of earlier work or replace a +separately signed agreement. + +“Owners” means the two straywild co-owners who publish the Project as Woofmeow and are publicly credited as Voyager and Endeavour. “Project” means -the official NETfishing game, its servers, tools, documentation, websites, +the official straywild game, its servers, tools, documentation, websites, ports, updates, and promotional materials. ## 1. Your ownership and authority @@ -51,8 +56,8 @@ royalty-free, transferable, and sublicensable license to: - license it to Project users under `ASSET-LICENSE.md` or a later Project asset license jointly approved by the Owners. -This grant is limited to NETfishing, its promotion, and official successor or -derived NETfishing products. It does not transfer your copyright or authorize +This grant is limited to straywild, its promotion, and official successor or +derived straywild products. It does not transfer your copyright or authorize the Owners to sell your contribution as an unrelated standalone asset. ## 4. Documentation accompanying code @@ -73,22 +78,23 @@ or release. ## 6. No automatic ownership, employment, or payment -Submitting a contribution does not provide ownership of NETfishing, create an +Submitting a contribution does not provide ownership of straywild, create an employment, agency, partnership, or fiduciary relationship, or create a right to compensation. Any payment, ownership, or employment arrangement requires a separate written agreement signed by the appropriate parties. ## 7. Acceptance -A contribution is not accepted merely because it was posted, uploaded, or -discussed. The Owners or their authorized maintainers may accept, modify, -decline, or later remove it. +A contribution is not accepted merely because it was posted, uploaded, linked, +emailed, or discussed. Unsolicited material will not be reviewed or accepted. +The Owners or their authorized maintainers may modify, decline, or later +remove previously accepted or expressly invited work. -By intentionally submitting a patch, pull request, asset, or other material -for Project inclusion after receiving notice of these terms, you agree to the -applicable grants above. Maintainers should record the contributor’s -affirmative agreement in the pull request, issue, email, or another durable -written record. +For work expressly invited in writing, intentionally delivering the requested +material for Project inclusion after receiving notice of these terms records +agreement to the applicable grants above. Maintainers must retain both the +written invitation and the contributor's affirmative agreement in a durable +Project record. -If you cannot agree to these terms, do not submit the contribution; contact -the Owners to discuss a separate written arrangement. +Do not send unsolicited work. An owner invitation may instead specify a +separate written arrangement signed by the appropriate parties. diff --git a/README.md b/README.md index 47caefa..e228e7b 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ -# NETfishing +# straywild -NETfishing is a multiplayer-first fishing game built with Godot 4.7. The +straywild is a multiplayer-first fishing game built with Godot 4.7. The current pre-alpha includes host-authoritative fishing and economy flows, freshwater and saltwater habitats, persistent player data, social features, customization, jobs, and a controller-aware interface. @@ -8,23 +8,39 @@ customization, jobs, and a controller-aware interface. The project is under active development. Interfaces, balance, content, and save migrations may continue to change before a stable release. -NETfishing is developed and published by **Woofmeow**, the independent team of +straywild is developed and published by **Woofmeow**, the independent team of co-owners publicly credited as Voyager and Endeavour. +## Links +Patreon: https://www.patreon.com/cw/woofmeowgames + +Steam: https://store.steampowered.com/app/5068950/straywild/ + +Itch.io: https://sol6-vi.itch.io/straywild + +Discord: https://discord.gg/5gP22447kc + +Matrix: https://matrix.to/#/#straywild:matrix.makearmy.io + +Repo: https://forge.makearmy.io/woofmeow/straywild + +Releases: https://forge.makearmy.io/woofmeow/straywild/releases + + ## Installing release builds Download and extract the archive for your platform from the official release -page, then run NETfishing from the extracted platform folder. +page, then run straywild from the extracted platform folder. ### macOS Current macOS builds are not signed or notarized. macOS may block the first -launch because it cannot verify the developer. Control-click the NETfishing +launch because it cannot verify the developer. Control-click the straywild application, choose **Open**, then confirm **Open**. If that option is not available, attempt to open the application once, then use **System Settings → Privacy & Security → Open Anyway**. -Only bypass this warning for a NETfishing build downloaded from an official +Only bypass this warning for a straywild build downloaded from an official project release. ## Requirements @@ -48,7 +64,7 @@ godot --path . ## Validation The validation scripts isolate Godot's settings and application-data roots. -Run the fast, deterministic suite before submitting a change: +Run the fast, deterministic suite before committing a change: ```sh scripts/run_validations.sh quick @@ -94,14 +110,16 @@ world and UI authoring, and testing are consolidated in - Project-owned software code is licensed under [GPL-3.0-or-later](LICENSE). - Project-owned artwork, models, music, and other creative assets are covered - by the [NETfishing Asset License](ASSET-LICENSE.md). It permits community - Mods for official NETfishing software, but not use in forks, clones, or - unrelated products. -- The NETfishing and Woofmeow names and branding are reserved as described in + by the [straywild Asset License](ASSET-LICENSE.md). It permits community + Mods for official straywild software and narrowly scoped contribution forks, + but not independent forks, clones, or unrelated products. +- The straywild and Woofmeow names and branding are reserved as described in [TRADEMARKS.md](TRADEMARKS.md). - Third-party materials retain their own terms; see the consolidated [credits, notices, and provenance record](docs/ATTRIBUTION.md). -- Contributions are accepted under [CONTRIBUTOR-TERMS.md](CONTRIBUTOR-TERMS.md). +- Unsolicited contributions are not accepted. See + [CONTRIBUTING.md](CONTRIBUTING.md). Historical and expressly invited work is + governed by [CONTRIBUTOR-TERMS.md](CONTRIBUTOR-TERMS.md). Material boundaries and binary-release requirements are recorded in that same [`docs/ATTRIBUTION.md`](docs/ATTRIBUTION.md) reference. diff --git a/TRADEMARKS.md b/TRADEMARKS.md index 6848f47..fbf49d5 100644 --- a/TRADEMARKS.md +++ b/TRADEMARKS.md @@ -1,7 +1,7 @@ -# NETfishing and Woofmeow branding +# straywild and Woofmeow branding -The NETfishing and Woofmeow names, logos, icons, trade dress, and other source -identifiers are reserved by the NETfishing owners, publishing as Woofmeow. +The straywild and Woofmeow names, logos, icons, trade dress, and other source +identifiers are reserved by the straywild owners, publishing as Woofmeow. Their presence in a GPL-licensed repository does not grant trademark rights or imply permission to represent another product as official. @@ -10,27 +10,41 @@ exist through use and other law. ## Permitted references -You may use the names NETfishing and Woofmeow truthfully to: +You may use the names straywild and Woofmeow truthfully to: - refer to the official game or development team; -- state that software interoperates with or is a Mod for NETfishing; +- state that software interoperates with or is a Mod for straywild; - link to an official repository or distribution page; and - discuss, review, criticize, or report on the Project. Use only the amount of branding reasonably necessary to identify the Project. Do not imply sponsorship, certification, endorsement, or official status. -An unofficial Mod may use wording such as “Example Mod for NETfishing” if its +An unofficial Mod may use wording such as “Example Mod for straywild” if its name and presentation remain clearly distinct and it displays an unofficial notice. -## Forks and redistributed code +## Contribution forks + +A qualifying Contribution Fork under `ASSET-LICENSE.md` may retain the +straywild and Woofmeow names, logos, icons, and trade dress already present in +the official source repository solely as necessary to reproduce, modify, and +test the Project while preparing a proposed contribution. The source-control +host's visible fork relationship or an equivalent repository notice must make +its unofficial contribution purpose clear. + +This permission does not allow a Contribution Fork to use straywild or +Woofmeow branding to advertise a public build, release, service, community +edition, or independent product. It does not imply acceptance, sponsorship, +endorsement, or official status. + +## Other forks and redistributed code The GNU GPL permits forks and redistribution of covered code. A fork or -modified distribution must: +modified distribution that is not a qualifying Contribution Fork must: - use a distinct product name; -- remove NETfishing and Woofmeow logos, icons, and official trade dress; +- remove straywild and Woofmeow logos, icons, and official trade dress; - avoid confusingly similar names, domains, package identifiers, and account names; and - clearly identify itself as independent and unofficial. @@ -39,4 +53,4 @@ These branding terms do not limit rights granted by the GPL to the software code or lawful nominative, descriptive, comparative, or fair use. Permission for broader branding use must be obtained in writing from both -NETfishing owners. +straywild owners. diff --git a/addons/netfishing_shoreline_baker/plugin.cfg b/addons/straywild_shoreline_baker/plugin.cfg similarity index 81% rename from addons/netfishing_shoreline_baker/plugin.cfg rename to addons/straywild_shoreline_baker/plugin.cfg index c8c4d06..c3f4e47 100644 --- a/addons/netfishing_shoreline_baker/plugin.cfg +++ b/addons/straywild_shoreline_baker/plugin.cfg @@ -1,6 +1,6 @@ [plugin] -name="NETfishing Shoreline Auto-Baker" +name="straywild Shoreline Auto-Baker" description="Rebuilds configured static shoreline ribbons after authored terrain reimports." author="woofmeow" version="1.0.0" diff --git a/addons/netfishing_shoreline_baker/shoreline_auto_baker.gd b/addons/straywild_shoreline_baker/shoreline_auto_baker.gd similarity index 100% rename from addons/netfishing_shoreline_baker/shoreline_auto_baker.gd rename to addons/straywild_shoreline_baker/shoreline_auto_baker.gd diff --git a/addons/netfishing_shoreline_baker/shoreline_auto_baker.gd.uid b/addons/straywild_shoreline_baker/shoreline_auto_baker.gd.uid similarity index 100% rename from addons/netfishing_shoreline_baker/shoreline_auto_baker.gd.uid rename to addons/straywild_shoreline_baker/shoreline_auto_baker.gd.uid diff --git a/art/exported/characters/base/netfishing_base_character.glb b/art/exported/characters/base/netfishing_base_character.glb deleted file mode 100644 index b7bc2f7..0000000 Binary files a/art/exported/characters/base/netfishing_base_character.glb and /dev/null differ diff --git a/art/exported/characters/base/straywild_base_character.glb b/art/exported/characters/base/straywild_base_character.glb new file mode 100644 index 0000000..58eb7cd Binary files /dev/null and b/art/exported/characters/base/straywild_base_character.glb differ diff --git a/art/exported/characters/base/netfishing_base_character.glb.import b/art/exported/characters/base/straywild_base_character.glb.import similarity index 77% rename from art/exported/characters/base/netfishing_base_character.glb.import rename to art/exported/characters/base/straywild_base_character.glb.import index b1409e1..96925de 100644 --- a/art/exported/characters/base/netfishing_base_character.glb.import +++ b/art/exported/characters/base/straywild_base_character.glb.import @@ -4,12 +4,12 @@ importer="scene" importer_version=1 type="PackedScene" uid="uid://w7n4gjqq1juc" -path="res://.godot/imported/netfishing_base_character.glb-0167c087f16181d405afb962dc877d2c.scn" +path="res://.godot/imported/straywild_base_character.glb-65021653e51a906d3b4a3494f170317f.scn" [deps] -source_file="res://art/exported/characters/base/netfishing_base_character.glb" -dest_files=["res://.godot/imported/netfishing_base_character.glb-0167c087f16181d405afb962dc877d2c.scn"] +source_file="res://art/exported/characters/base/straywild_base_character.glb" +dest_files=["res://.godot/imported/straywild_base_character.glb-65021653e51a906d3b4a3494f170317f.scn"] [params] diff --git a/art/exported/characters/base/netfishing_base_character_eyes_simple_shine.png b/art/exported/characters/base/straywild_base_character_eyes_simple_shine.png similarity index 100% rename from art/exported/characters/base/netfishing_base_character_eyes_simple_shine.png rename to art/exported/characters/base/straywild_base_character_eyes_simple_shine.png diff --git a/art/exported/characters/base/netfishing_base_character_eyes_simple_shine.png.import b/art/exported/characters/base/straywild_base_character_eyes_simple_shine.png.import similarity index 58% rename from art/exported/characters/base/netfishing_base_character_eyes_simple_shine.png.import rename to art/exported/characters/base/straywild_base_character_eyes_simple_shine.png.import index 4141bca..ddf8bb7 100644 --- a/art/exported/characters/base/netfishing_base_character_eyes_simple_shine.png.import +++ b/art/exported/characters/base/straywild_base_character_eyes_simple_shine.png.import @@ -3,8 +3,8 @@ importer="texture" type="CompressedTexture2D" uid="uid://dyjwgkgw0syo8" -path.s3tc="res://.godot/imported/netfishing_base_character_eyes_simple_shine.png-140bfa3aa0b6f662e8ff9e5721213a61.s3tc.ctex" -path.etc2="res://.godot/imported/netfishing_base_character_eyes_simple_shine.png-140bfa3aa0b6f662e8ff9e5721213a61.etc2.ctex" +path.s3tc="res://.godot/imported/straywild_base_character_eyes_simple_shine.png-200a946ddace2078bbe44addb4e4524c.s3tc.ctex" +path.etc2="res://.godot/imported/straywild_base_character_eyes_simple_shine.png-200a946ddace2078bbe44addb4e4524c.etc2.ctex" metadata={ "imported_formats": ["s3tc_bptc", "etc2_astc"], "vram_texture": true @@ -15,8 +15,8 @@ generator_parameters={ [deps] -source_file="res://art/exported/characters/base/netfishing_base_character_eyes_simple_shine.png" -dest_files=["res://.godot/imported/netfishing_base_character_eyes_simple_shine.png-140bfa3aa0b6f662e8ff9e5721213a61.s3tc.ctex", "res://.godot/imported/netfishing_base_character_eyes_simple_shine.png-140bfa3aa0b6f662e8ff9e5721213a61.etc2.ctex"] +source_file="res://art/exported/characters/base/straywild_base_character_eyes_simple_shine.png" +dest_files=["res://.godot/imported/straywild_base_character_eyes_simple_shine.png-200a946ddace2078bbe44addb4e4524c.s3tc.ctex", "res://.godot/imported/straywild_base_character_eyes_simple_shine.png-200a946ddace2078bbe44addb4e4524c.etc2.ctex"] [params] diff --git a/art/exported/characters/base/netfishing_base_character_mouth_three.png b/art/exported/characters/base/straywild_base_character_mouth_three.png similarity index 100% rename from art/exported/characters/base/netfishing_base_character_mouth_three.png rename to art/exported/characters/base/straywild_base_character_mouth_three.png diff --git a/art/exported/characters/base/netfishing_base_character_mouth_three.png.import b/art/exported/characters/base/straywild_base_character_mouth_three.png.import similarity index 59% rename from art/exported/characters/base/netfishing_base_character_mouth_three.png.import rename to art/exported/characters/base/straywild_base_character_mouth_three.png.import index 10d0721..ba0ec2c 100644 --- a/art/exported/characters/base/netfishing_base_character_mouth_three.png.import +++ b/art/exported/characters/base/straywild_base_character_mouth_three.png.import @@ -3,8 +3,8 @@ importer="texture" type="CompressedTexture2D" uid="uid://dt5gitdtjdvcd" -path.s3tc="res://.godot/imported/netfishing_base_character_mouth_three.png-90b4a98403d2a291a56a8ed42aaa8473.s3tc.ctex" -path.etc2="res://.godot/imported/netfishing_base_character_mouth_three.png-90b4a98403d2a291a56a8ed42aaa8473.etc2.ctex" +path.s3tc="res://.godot/imported/straywild_base_character_mouth_three.png-5bcf329b31a11eff496760a63e62d0e2.s3tc.ctex" +path.etc2="res://.godot/imported/straywild_base_character_mouth_three.png-5bcf329b31a11eff496760a63e62d0e2.etc2.ctex" metadata={ "imported_formats": ["s3tc_bptc", "etc2_astc"], "vram_texture": true @@ -15,8 +15,8 @@ generator_parameters={ [deps] -source_file="res://art/exported/characters/base/netfishing_base_character_mouth_three.png" -dest_files=["res://.godot/imported/netfishing_base_character_mouth_three.png-90b4a98403d2a291a56a8ed42aaa8473.s3tc.ctex", "res://.godot/imported/netfishing_base_character_mouth_three.png-90b4a98403d2a291a56a8ed42aaa8473.etc2.ctex"] +source_file="res://art/exported/characters/base/straywild_base_character_mouth_three.png" +dest_files=["res://.godot/imported/straywild_base_character_mouth_three.png-5bcf329b31a11eff496760a63e62d0e2.s3tc.ctex", "res://.godot/imported/straywild_base_character_mouth_three.png-5bcf329b31a11eff496760a63e62d0e2.etc2.ctex"] [params] diff --git a/art/exported/characters/base/netfishing_base_character_nose_dog_round.png b/art/exported/characters/base/straywild_base_character_nose_dog_round.png similarity index 100% rename from art/exported/characters/base/netfishing_base_character_nose_dog_round.png rename to art/exported/characters/base/straywild_base_character_nose_dog_round.png diff --git a/art/exported/characters/base/netfishing_base_character_nose_dog_round.png.import b/art/exported/characters/base/straywild_base_character_nose_dog_round.png.import similarity index 59% rename from art/exported/characters/base/netfishing_base_character_nose_dog_round.png.import rename to art/exported/characters/base/straywild_base_character_nose_dog_round.png.import index 71d25b6..cb2c573 100644 --- a/art/exported/characters/base/netfishing_base_character_nose_dog_round.png.import +++ b/art/exported/characters/base/straywild_base_character_nose_dog_round.png.import @@ -3,8 +3,8 @@ importer="texture" type="CompressedTexture2D" uid="uid://bmho1ryst3smt" -path.s3tc="res://.godot/imported/netfishing_base_character_nose_dog_round.png-0008adff5271dd0403e610ef13dd52cf.s3tc.ctex" -path.etc2="res://.godot/imported/netfishing_base_character_nose_dog_round.png-0008adff5271dd0403e610ef13dd52cf.etc2.ctex" +path.s3tc="res://.godot/imported/straywild_base_character_nose_dog_round.png-e6909a2c139cf4a2748c2b79d1e12d92.s3tc.ctex" +path.etc2="res://.godot/imported/straywild_base_character_nose_dog_round.png-e6909a2c139cf4a2748c2b79d1e12d92.etc2.ctex" metadata={ "imported_formats": ["s3tc_bptc", "etc2_astc"], "vram_texture": true @@ -15,8 +15,8 @@ generator_parameters={ [deps] -source_file="res://art/exported/characters/base/netfishing_base_character_nose_dog_round.png" -dest_files=["res://.godot/imported/netfishing_base_character_nose_dog_round.png-0008adff5271dd0403e610ef13dd52cf.s3tc.ctex", "res://.godot/imported/netfishing_base_character_nose_dog_round.png-0008adff5271dd0403e610ef13dd52cf.etc2.ctex"] +source_file="res://art/exported/characters/base/straywild_base_character_nose_dog_round.png" +dest_files=["res://.godot/imported/straywild_base_character_nose_dog_round.png-e6909a2c139cf4a2748c2b79d1e12d92.s3tc.ctex", "res://.godot/imported/straywild_base_character_nose_dog_round.png-e6909a2c139cf4a2748c2b79d1e12d92.etc2.ctex"] [params] diff --git a/art/exported/creatures/101.png b/art/exported/creatures/101.png new file mode 100644 index 0000000..e6e431c Binary files /dev/null and b/art/exported/creatures/101.png differ diff --git a/art/exported/creatures/101.png.import b/art/exported/creatures/101.png.import new file mode 100644 index 0000000..3dc8865 --- /dev/null +++ b/art/exported/creatures/101.png.import @@ -0,0 +1,42 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://x5e744k11k70" +path.s3tc="res://.godot/imported/101.png-81f7f90e29292575c1a9727aa6060fa0.s3tc.ctex" +path.etc2="res://.godot/imported/101.png-81f7f90e29292575c1a9727aa6060fa0.etc2.ctex" +metadata={ +"imported_formats": ["s3tc_bptc", "etc2_astc"], +"vram_texture": true +} + +[deps] + +source_file="res://art/exported/creatures/101.png" +dest_files=["res://.godot/imported/101.png-81f7f90e29292575c1a9727aa6060fa0.s3tc.ctex", "res://.godot/imported/101.png-81f7f90e29292575c1a9727aa6060fa0.etc2.ctex"] + +[params] + +compress/mode=2 +compress/high_quality=false +compress/lossy_quality=0.7 +compress/uastc_level=0 +compress/rdo_quality_loss=0.0 +compress/hdr_compression=1 +compress/normal_map=0 +compress/channel_pack=0 +mipmaps/generate=false +mipmaps/limit=-1 +roughness/mode=0 +roughness/src_normal="" +process/channel_remap/red=0 +process/channel_remap/green=1 +process/channel_remap/blue=2 +process/channel_remap/alpha=3 +process/fix_alpha_border=true +process/premult_alpha=false +process/normal_map_invert_y=false +process/hdr_as_srgb=false +process/hdr_clamp_exposure=false +process/size_limit=0 +detect_3d/compress_to=0 diff --git a/art/exported/creatures/102.png b/art/exported/creatures/102.png new file mode 100644 index 0000000..b1b66a6 Binary files /dev/null and b/art/exported/creatures/102.png differ diff --git a/art/exported/creatures/102.png.import b/art/exported/creatures/102.png.import new file mode 100644 index 0000000..c958e5f --- /dev/null +++ b/art/exported/creatures/102.png.import @@ -0,0 +1,42 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://1kla4jewitot" +path.s3tc="res://.godot/imported/102.png-2ab8ac9408a482b1042b6ba3cd3bd718.s3tc.ctex" +path.etc2="res://.godot/imported/102.png-2ab8ac9408a482b1042b6ba3cd3bd718.etc2.ctex" +metadata={ +"imported_formats": ["s3tc_bptc", "etc2_astc"], +"vram_texture": true +} + +[deps] + +source_file="res://art/exported/creatures/102.png" +dest_files=["res://.godot/imported/102.png-2ab8ac9408a482b1042b6ba3cd3bd718.s3tc.ctex", "res://.godot/imported/102.png-2ab8ac9408a482b1042b6ba3cd3bd718.etc2.ctex"] + +[params] + +compress/mode=2 +compress/high_quality=false +compress/lossy_quality=0.7 +compress/uastc_level=0 +compress/rdo_quality_loss=0.0 +compress/hdr_compression=1 +compress/normal_map=0 +compress/channel_pack=0 +mipmaps/generate=false +mipmaps/limit=-1 +roughness/mode=0 +roughness/src_normal="" +process/channel_remap/red=0 +process/channel_remap/green=1 +process/channel_remap/blue=2 +process/channel_remap/alpha=3 +process/fix_alpha_border=true +process/premult_alpha=false +process/normal_map_invert_y=false +process/hdr_as_srgb=false +process/hdr_clamp_exposure=false +process/size_limit=0 +detect_3d/compress_to=0 diff --git a/art/exported/creatures/103.png b/art/exported/creatures/103.png new file mode 100644 index 0000000..98dd618 Binary files /dev/null and b/art/exported/creatures/103.png differ diff --git a/art/exported/creatures/103.png.import b/art/exported/creatures/103.png.import new file mode 100644 index 0000000..2972cde --- /dev/null +++ b/art/exported/creatures/103.png.import @@ -0,0 +1,42 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://cfdsg4tevv0jm" +path.s3tc="res://.godot/imported/103.png-f8985f10e04b19499cd6f5ffbadc83c9.s3tc.ctex" +path.etc2="res://.godot/imported/103.png-f8985f10e04b19499cd6f5ffbadc83c9.etc2.ctex" +metadata={ +"imported_formats": ["s3tc_bptc", "etc2_astc"], +"vram_texture": true +} + +[deps] + +source_file="res://art/exported/creatures/103.png" +dest_files=["res://.godot/imported/103.png-f8985f10e04b19499cd6f5ffbadc83c9.s3tc.ctex", "res://.godot/imported/103.png-f8985f10e04b19499cd6f5ffbadc83c9.etc2.ctex"] + +[params] + +compress/mode=2 +compress/high_quality=false +compress/lossy_quality=0.7 +compress/uastc_level=0 +compress/rdo_quality_loss=0.0 +compress/hdr_compression=1 +compress/normal_map=0 +compress/channel_pack=0 +mipmaps/generate=false +mipmaps/limit=-1 +roughness/mode=0 +roughness/src_normal="" +process/channel_remap/red=0 +process/channel_remap/green=1 +process/channel_remap/blue=2 +process/channel_remap/alpha=3 +process/fix_alpha_border=true +process/premult_alpha=false +process/normal_map_invert_y=false +process/hdr_as_srgb=false +process/hdr_clamp_exposure=false +process/size_limit=0 +detect_3d/compress_to=0 diff --git a/art/exported/creatures/104.png b/art/exported/creatures/104.png new file mode 100644 index 0000000..09eec3c Binary files /dev/null and b/art/exported/creatures/104.png differ diff --git a/art/exported/creatures/104.png.import b/art/exported/creatures/104.png.import new file mode 100644 index 0000000..01a9393 --- /dev/null +++ b/art/exported/creatures/104.png.import @@ -0,0 +1,42 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://pgm364g5qlgs" +path.s3tc="res://.godot/imported/104.png-e164f67032648af2cc0a545d2a861c7d.s3tc.ctex" +path.etc2="res://.godot/imported/104.png-e164f67032648af2cc0a545d2a861c7d.etc2.ctex" +metadata={ +"imported_formats": ["s3tc_bptc", "etc2_astc"], +"vram_texture": true +} + +[deps] + +source_file="res://art/exported/creatures/104.png" +dest_files=["res://.godot/imported/104.png-e164f67032648af2cc0a545d2a861c7d.s3tc.ctex", "res://.godot/imported/104.png-e164f67032648af2cc0a545d2a861c7d.etc2.ctex"] + +[params] + +compress/mode=2 +compress/high_quality=false +compress/lossy_quality=0.7 +compress/uastc_level=0 +compress/rdo_quality_loss=0.0 +compress/hdr_compression=1 +compress/normal_map=0 +compress/channel_pack=0 +mipmaps/generate=false +mipmaps/limit=-1 +roughness/mode=0 +roughness/src_normal="" +process/channel_remap/red=0 +process/channel_remap/green=1 +process/channel_remap/blue=2 +process/channel_remap/alpha=3 +process/fix_alpha_border=true +process/premult_alpha=false +process/normal_map_invert_y=false +process/hdr_as_srgb=false +process/hdr_clamp_exposure=false +process/size_limit=0 +detect_3d/compress_to=0 diff --git a/art/exported/creatures/105.png b/art/exported/creatures/105.png new file mode 100644 index 0000000..3ba1000 Binary files /dev/null and b/art/exported/creatures/105.png differ diff --git a/art/exported/creatures/105.png.import b/art/exported/creatures/105.png.import new file mode 100644 index 0000000..de797a7 --- /dev/null +++ b/art/exported/creatures/105.png.import @@ -0,0 +1,42 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://dwanip2j561n7" +path.s3tc="res://.godot/imported/105.png-a2b440912e59b3375c6e61e17d08287b.s3tc.ctex" +path.etc2="res://.godot/imported/105.png-a2b440912e59b3375c6e61e17d08287b.etc2.ctex" +metadata={ +"imported_formats": ["s3tc_bptc", "etc2_astc"], +"vram_texture": true +} + +[deps] + +source_file="res://art/exported/creatures/105.png" +dest_files=["res://.godot/imported/105.png-a2b440912e59b3375c6e61e17d08287b.s3tc.ctex", "res://.godot/imported/105.png-a2b440912e59b3375c6e61e17d08287b.etc2.ctex"] + +[params] + +compress/mode=2 +compress/high_quality=false +compress/lossy_quality=0.7 +compress/uastc_level=0 +compress/rdo_quality_loss=0.0 +compress/hdr_compression=1 +compress/normal_map=0 +compress/channel_pack=0 +mipmaps/generate=false +mipmaps/limit=-1 +roughness/mode=0 +roughness/src_normal="" +process/channel_remap/red=0 +process/channel_remap/green=1 +process/channel_remap/blue=2 +process/channel_remap/alpha=3 +process/fix_alpha_border=true +process/premult_alpha=false +process/normal_map_invert_y=false +process/hdr_as_srgb=false +process/hdr_clamp_exposure=false +process/size_limit=0 +detect_3d/compress_to=0 diff --git a/art/exported/creatures/106.png b/art/exported/creatures/106.png new file mode 100644 index 0000000..4227b44 Binary files /dev/null and b/art/exported/creatures/106.png differ diff --git a/art/exported/creatures/106.png.import b/art/exported/creatures/106.png.import new file mode 100644 index 0000000..3032c38 --- /dev/null +++ b/art/exported/creatures/106.png.import @@ -0,0 +1,42 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://cr7tc11ievso5" +path.s3tc="res://.godot/imported/106.png-306ce449448588714e5a0e883ae441ac.s3tc.ctex" +path.etc2="res://.godot/imported/106.png-306ce449448588714e5a0e883ae441ac.etc2.ctex" +metadata={ +"imported_formats": ["s3tc_bptc", "etc2_astc"], +"vram_texture": true +} + +[deps] + +source_file="res://art/exported/creatures/106.png" +dest_files=["res://.godot/imported/106.png-306ce449448588714e5a0e883ae441ac.s3tc.ctex", "res://.godot/imported/106.png-306ce449448588714e5a0e883ae441ac.etc2.ctex"] + +[params] + +compress/mode=2 +compress/high_quality=false +compress/lossy_quality=0.7 +compress/uastc_level=0 +compress/rdo_quality_loss=0.0 +compress/hdr_compression=1 +compress/normal_map=0 +compress/channel_pack=0 +mipmaps/generate=false +mipmaps/limit=-1 +roughness/mode=0 +roughness/src_normal="" +process/channel_remap/red=0 +process/channel_remap/green=1 +process/channel_remap/blue=2 +process/channel_remap/alpha=3 +process/fix_alpha_border=true +process/premult_alpha=false +process/normal_map_invert_y=false +process/hdr_as_srgb=false +process/hdr_clamp_exposure=false +process/size_limit=0 +detect_3d/compress_to=0 diff --git a/art/exported/creatures/107.png b/art/exported/creatures/107.png new file mode 100644 index 0000000..c843bbe Binary files /dev/null and b/art/exported/creatures/107.png differ diff --git a/art/exported/creatures/107.png.import b/art/exported/creatures/107.png.import new file mode 100644 index 0000000..c4d28e8 --- /dev/null +++ b/art/exported/creatures/107.png.import @@ -0,0 +1,42 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://c8rf4tnxx8mov" +path.s3tc="res://.godot/imported/107.png-062740d0bdad6e3ac4ecc1cf92ee6b9d.s3tc.ctex" +path.etc2="res://.godot/imported/107.png-062740d0bdad6e3ac4ecc1cf92ee6b9d.etc2.ctex" +metadata={ +"imported_formats": ["s3tc_bptc", "etc2_astc"], +"vram_texture": true +} + +[deps] + +source_file="res://art/exported/creatures/107.png" +dest_files=["res://.godot/imported/107.png-062740d0bdad6e3ac4ecc1cf92ee6b9d.s3tc.ctex", "res://.godot/imported/107.png-062740d0bdad6e3ac4ecc1cf92ee6b9d.etc2.ctex"] + +[params] + +compress/mode=2 +compress/high_quality=false +compress/lossy_quality=0.7 +compress/uastc_level=0 +compress/rdo_quality_loss=0.0 +compress/hdr_compression=1 +compress/normal_map=0 +compress/channel_pack=0 +mipmaps/generate=false +mipmaps/limit=-1 +roughness/mode=0 +roughness/src_normal="" +process/channel_remap/red=0 +process/channel_remap/green=1 +process/channel_remap/blue=2 +process/channel_remap/alpha=3 +process/fix_alpha_border=true +process/premult_alpha=false +process/normal_map_invert_y=false +process/hdr_as_srgb=false +process/hdr_clamp_exposure=false +process/size_limit=0 +detect_3d/compress_to=0 diff --git a/art/exported/creatures/201.png b/art/exported/creatures/201.png new file mode 100644 index 0000000..3994912 Binary files /dev/null and b/art/exported/creatures/201.png differ diff --git a/art/exported/creatures/201.png.import b/art/exported/creatures/201.png.import new file mode 100644 index 0000000..9d5decf --- /dev/null +++ b/art/exported/creatures/201.png.import @@ -0,0 +1,42 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://c0q8o1sc8hlv0" +path.s3tc="res://.godot/imported/201.png-1b2063c63e42271e8f3910da8e3f1277.s3tc.ctex" +path.etc2="res://.godot/imported/201.png-1b2063c63e42271e8f3910da8e3f1277.etc2.ctex" +metadata={ +"imported_formats": ["s3tc_bptc", "etc2_astc"], +"vram_texture": true +} + +[deps] + +source_file="res://art/exported/creatures/201.png" +dest_files=["res://.godot/imported/201.png-1b2063c63e42271e8f3910da8e3f1277.s3tc.ctex", "res://.godot/imported/201.png-1b2063c63e42271e8f3910da8e3f1277.etc2.ctex"] + +[params] + +compress/mode=2 +compress/high_quality=false +compress/lossy_quality=0.7 +compress/uastc_level=0 +compress/rdo_quality_loss=0.0 +compress/hdr_compression=1 +compress/normal_map=0 +compress/channel_pack=0 +mipmaps/generate=false +mipmaps/limit=-1 +roughness/mode=0 +roughness/src_normal="" +process/channel_remap/red=0 +process/channel_remap/green=1 +process/channel_remap/blue=2 +process/channel_remap/alpha=3 +process/fix_alpha_border=true +process/premult_alpha=false +process/normal_map_invert_y=false +process/hdr_as_srgb=false +process/hdr_clamp_exposure=false +process/size_limit=0 +detect_3d/compress_to=0 diff --git a/art/exported/creatures/3906.png b/art/exported/creatures/3906.png new file mode 100644 index 0000000..6cc1d1b Binary files /dev/null and b/art/exported/creatures/3906.png differ diff --git a/art/exported/creatures/3906.png.import b/art/exported/creatures/3906.png.import new file mode 100644 index 0000000..9bce5e4 --- /dev/null +++ b/art/exported/creatures/3906.png.import @@ -0,0 +1,42 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://bdmm1jfod7gq0" +path.s3tc="res://.godot/imported/3906.png-39cc349a6d3e716822bc9e12bd0ac7a2.s3tc.ctex" +path.etc2="res://.godot/imported/3906.png-39cc349a6d3e716822bc9e12bd0ac7a2.etc2.ctex" +metadata={ +"imported_formats": ["s3tc_bptc", "etc2_astc"], +"vram_texture": true +} + +[deps] + +source_file="res://art/exported/creatures/3906.png" +dest_files=["res://.godot/imported/3906.png-39cc349a6d3e716822bc9e12bd0ac7a2.s3tc.ctex", "res://.godot/imported/3906.png-39cc349a6d3e716822bc9e12bd0ac7a2.etc2.ctex"] + +[params] + +compress/mode=2 +compress/high_quality=false +compress/lossy_quality=0.7 +compress/uastc_level=0 +compress/rdo_quality_loss=0.0 +compress/hdr_compression=1 +compress/normal_map=0 +compress/channel_pack=0 +mipmaps/generate=false +mipmaps/limit=-1 +roughness/mode=0 +roughness/src_normal="" +process/channel_remap/red=0 +process/channel_remap/green=1 +process/channel_remap/blue=2 +process/channel_remap/alpha=3 +process/fix_alpha_border=true +process/premult_alpha=false +process/normal_map_invert_y=false +process/hdr_as_srgb=false +process/hdr_clamp_exposure=false +process/size_limit=0 +detect_3d/compress_to=0 diff --git a/art/exported/creatures/403.png b/art/exported/creatures/403.png new file mode 100644 index 0000000..a1eb283 Binary files /dev/null and b/art/exported/creatures/403.png differ diff --git a/art/exported/creatures/403.png.import b/art/exported/creatures/403.png.import new file mode 100644 index 0000000..da790e8 --- /dev/null +++ b/art/exported/creatures/403.png.import @@ -0,0 +1,42 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://bypagdb0ollh0" +path.s3tc="res://.godot/imported/403.png-57b9dd64545d97bbd63b86e7f3d61562.s3tc.ctex" +path.etc2="res://.godot/imported/403.png-57b9dd64545d97bbd63b86e7f3d61562.etc2.ctex" +metadata={ +"imported_formats": ["s3tc_bptc", "etc2_astc"], +"vram_texture": true +} + +[deps] + +source_file="res://art/exported/creatures/403.png" +dest_files=["res://.godot/imported/403.png-57b9dd64545d97bbd63b86e7f3d61562.s3tc.ctex", "res://.godot/imported/403.png-57b9dd64545d97bbd63b86e7f3d61562.etc2.ctex"] + +[params] + +compress/mode=2 +compress/high_quality=false +compress/lossy_quality=0.7 +compress/uastc_level=0 +compress/rdo_quality_loss=0.0 +compress/hdr_compression=1 +compress/normal_map=0 +compress/channel_pack=0 +mipmaps/generate=false +mipmaps/limit=-1 +roughness/mode=0 +roughness/src_normal="" +process/channel_remap/red=0 +process/channel_remap/green=1 +process/channel_remap/blue=2 +process/channel_remap/alpha=3 +process/fix_alpha_border=true +process/premult_alpha=false +process/normal_map_invert_y=false +process/hdr_as_srgb=false +process/hdr_clamp_exposure=false +process/size_limit=0 +detect_3d/compress_to=0 diff --git a/art/exported/creatures/4401.png b/art/exported/creatures/4401.png new file mode 100644 index 0000000..d043f4c Binary files /dev/null and b/art/exported/creatures/4401.png differ diff --git a/art/exported/creatures/4401.png.import b/art/exported/creatures/4401.png.import new file mode 100644 index 0000000..809a146 --- /dev/null +++ b/art/exported/creatures/4401.png.import @@ -0,0 +1,42 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://7dbcbicxwvlo" +path.s3tc="res://.godot/imported/4401.png-0fd242cb090b49614af9b4d07503b2db.s3tc.ctex" +path.etc2="res://.godot/imported/4401.png-0fd242cb090b49614af9b4d07503b2db.etc2.ctex" +metadata={ +"imported_formats": ["s3tc_bptc", "etc2_astc"], +"vram_texture": true +} + +[deps] + +source_file="res://art/exported/creatures/4401.png" +dest_files=["res://.godot/imported/4401.png-0fd242cb090b49614af9b4d07503b2db.s3tc.ctex", "res://.godot/imported/4401.png-0fd242cb090b49614af9b4d07503b2db.etc2.ctex"] + +[params] + +compress/mode=2 +compress/high_quality=false +compress/lossy_quality=0.7 +compress/uastc_level=0 +compress/rdo_quality_loss=0.0 +compress/hdr_compression=1 +compress/normal_map=0 +compress/channel_pack=0 +mipmaps/generate=false +mipmaps/limit=-1 +roughness/mode=0 +roughness/src_normal="" +process/channel_remap/red=0 +process/channel_remap/green=1 +process/channel_remap/blue=2 +process/channel_remap/alpha=3 +process/fix_alpha_border=true +process/premult_alpha=false +process/normal_map_invert_y=false +process/hdr_as_srgb=false +process/hdr_clamp_exposure=false +process/size_limit=0 +detect_3d/compress_to=0 diff --git a/art/exported/creatures/4701.png b/art/exported/creatures/4701.png new file mode 100644 index 0000000..afd6a85 Binary files /dev/null and b/art/exported/creatures/4701.png differ diff --git a/art/exported/creatures/4701.png.import b/art/exported/creatures/4701.png.import new file mode 100644 index 0000000..5f4ed32 --- /dev/null +++ b/art/exported/creatures/4701.png.import @@ -0,0 +1,42 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://do6hcv3omivv5" +path.s3tc="res://.godot/imported/4701.png-dcb44d4ce6dfdc812a2e185e7f9511be.s3tc.ctex" +path.etc2="res://.godot/imported/4701.png-dcb44d4ce6dfdc812a2e185e7f9511be.etc2.ctex" +metadata={ +"imported_formats": ["s3tc_bptc", "etc2_astc"], +"vram_texture": true +} + +[deps] + +source_file="res://art/exported/creatures/4701.png" +dest_files=["res://.godot/imported/4701.png-dcb44d4ce6dfdc812a2e185e7f9511be.s3tc.ctex", "res://.godot/imported/4701.png-dcb44d4ce6dfdc812a2e185e7f9511be.etc2.ctex"] + +[params] + +compress/mode=2 +compress/high_quality=false +compress/lossy_quality=0.7 +compress/uastc_level=0 +compress/rdo_quality_loss=0.0 +compress/hdr_compression=1 +compress/normal_map=0 +compress/channel_pack=0 +mipmaps/generate=false +mipmaps/limit=-1 +roughness/mode=0 +roughness/src_normal="" +process/channel_remap/red=0 +process/channel_remap/green=1 +process/channel_remap/blue=2 +process/channel_remap/alpha=3 +process/fix_alpha_border=true +process/premult_alpha=false +process/normal_map_invert_y=false +process/hdr_as_srgb=false +process/hdr_clamp_exposure=false +process/size_limit=0 +detect_3d/compress_to=0 diff --git a/art/exported/creatures/5702.png b/art/exported/creatures/5702.png new file mode 100644 index 0000000..aba6b80 Binary files /dev/null and b/art/exported/creatures/5702.png differ diff --git a/art/exported/creatures/5702.png.import b/art/exported/creatures/5702.png.import new file mode 100644 index 0000000..527c367 --- /dev/null +++ b/art/exported/creatures/5702.png.import @@ -0,0 +1,42 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://dxwr7yv5h30s" +path.s3tc="res://.godot/imported/5702.png-b0cead42bd9a5851c3f6775a7d0e469e.s3tc.ctex" +path.etc2="res://.godot/imported/5702.png-b0cead42bd9a5851c3f6775a7d0e469e.etc2.ctex" +metadata={ +"imported_formats": ["s3tc_bptc", "etc2_astc"], +"vram_texture": true +} + +[deps] + +source_file="res://art/exported/creatures/5702.png" +dest_files=["res://.godot/imported/5702.png-b0cead42bd9a5851c3f6775a7d0e469e.s3tc.ctex", "res://.godot/imported/5702.png-b0cead42bd9a5851c3f6775a7d0e469e.etc2.ctex"] + +[params] + +compress/mode=2 +compress/high_quality=false +compress/lossy_quality=0.7 +compress/uastc_level=0 +compress/rdo_quality_loss=0.0 +compress/hdr_compression=1 +compress/normal_map=0 +compress/channel_pack=0 +mipmaps/generate=false +mipmaps/limit=-1 +roughness/mode=0 +roughness/src_normal="" +process/channel_remap/red=0 +process/channel_remap/green=1 +process/channel_remap/blue=2 +process/channel_remap/alpha=3 +process/fix_alpha_border=true +process/premult_alpha=false +process/normal_map_invert_y=false +process/hdr_as_srgb=false +process/hdr_clamp_exposure=false +process/size_limit=0 +detect_3d/compress_to=0 diff --git a/art/exported/creatures/5901.png b/art/exported/creatures/5901.png new file mode 100644 index 0000000..a75039f Binary files /dev/null and b/art/exported/creatures/5901.png differ diff --git a/art/exported/creatures/5901.png.import b/art/exported/creatures/5901.png.import new file mode 100644 index 0000000..e52ad8c --- /dev/null +++ b/art/exported/creatures/5901.png.import @@ -0,0 +1,42 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://dovitajskavmi" +path.s3tc="res://.godot/imported/5901.png-10c9e77992ad31ce54d34b95a6db6f61.s3tc.ctex" +path.etc2="res://.godot/imported/5901.png-10c9e77992ad31ce54d34b95a6db6f61.etc2.ctex" +metadata={ +"imported_formats": ["s3tc_bptc", "etc2_astc"], +"vram_texture": true +} + +[deps] + +source_file="res://art/exported/creatures/5901.png" +dest_files=["res://.godot/imported/5901.png-10c9e77992ad31ce54d34b95a6db6f61.s3tc.ctex", "res://.godot/imported/5901.png-10c9e77992ad31ce54d34b95a6db6f61.etc2.ctex"] + +[params] + +compress/mode=2 +compress/high_quality=false +compress/lossy_quality=0.7 +compress/uastc_level=0 +compress/rdo_quality_loss=0.0 +compress/hdr_compression=1 +compress/normal_map=0 +compress/channel_pack=0 +mipmaps/generate=false +mipmaps/limit=-1 +roughness/mode=0 +roughness/src_normal="" +process/channel_remap/red=0 +process/channel_remap/green=1 +process/channel_remap/blue=2 +process/channel_remap/alpha=3 +process/fix_alpha_border=true +process/premult_alpha=false +process/normal_map_invert_y=false +process/hdr_as_srgb=false +process/hdr_clamp_exposure=false +process/size_limit=0 +detect_3d/compress_to=0 diff --git a/art/exported/creatures/6103.png b/art/exported/creatures/6103.png new file mode 100644 index 0000000..f45e607 Binary files /dev/null and b/art/exported/creatures/6103.png differ diff --git a/art/exported/creatures/6103.png.import b/art/exported/creatures/6103.png.import new file mode 100644 index 0000000..ac97dac --- /dev/null +++ b/art/exported/creatures/6103.png.import @@ -0,0 +1,42 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://k3ser2dy6wj7" +path.s3tc="res://.godot/imported/6103.png-5fc95bf908f801d5397114bde5081f55.s3tc.ctex" +path.etc2="res://.godot/imported/6103.png-5fc95bf908f801d5397114bde5081f55.etc2.ctex" +metadata={ +"imported_formats": ["s3tc_bptc", "etc2_astc"], +"vram_texture": true +} + +[deps] + +source_file="res://art/exported/creatures/6103.png" +dest_files=["res://.godot/imported/6103.png-5fc95bf908f801d5397114bde5081f55.s3tc.ctex", "res://.godot/imported/6103.png-5fc95bf908f801d5397114bde5081f55.etc2.ctex"] + +[params] + +compress/mode=2 +compress/high_quality=false +compress/lossy_quality=0.7 +compress/uastc_level=0 +compress/rdo_quality_loss=0.0 +compress/hdr_compression=1 +compress/normal_map=0 +compress/channel_pack=0 +mipmaps/generate=false +mipmaps/limit=-1 +roughness/mode=0 +roughness/src_normal="" +process/channel_remap/red=0 +process/channel_remap/green=1 +process/channel_remap/blue=2 +process/channel_remap/alpha=3 +process/fix_alpha_border=true +process/premult_alpha=false +process/normal_map_invert_y=false +process/hdr_as_srgb=false +process/hdr_clamp_exposure=false +process/size_limit=0 +detect_3d/compress_to=0 diff --git a/art/exported/creatures/6804.png b/art/exported/creatures/6804.png new file mode 100644 index 0000000..14cc738 Binary files /dev/null and b/art/exported/creatures/6804.png differ diff --git a/art/exported/creatures/6804.png.import b/art/exported/creatures/6804.png.import new file mode 100644 index 0000000..12be7af --- /dev/null +++ b/art/exported/creatures/6804.png.import @@ -0,0 +1,42 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://b5ejex5wtfoun" +path.s3tc="res://.godot/imported/6804.png-28bcc10060d656f6d7f080ea81e2d1d3.s3tc.ctex" +path.etc2="res://.godot/imported/6804.png-28bcc10060d656f6d7f080ea81e2d1d3.etc2.ctex" +metadata={ +"imported_formats": ["s3tc_bptc", "etc2_astc"], +"vram_texture": true +} + +[deps] + +source_file="res://art/exported/creatures/6804.png" +dest_files=["res://.godot/imported/6804.png-28bcc10060d656f6d7f080ea81e2d1d3.s3tc.ctex", "res://.godot/imported/6804.png-28bcc10060d656f6d7f080ea81e2d1d3.etc2.ctex"] + +[params] + +compress/mode=2 +compress/high_quality=false +compress/lossy_quality=0.7 +compress/uastc_level=0 +compress/rdo_quality_loss=0.0 +compress/hdr_compression=1 +compress/normal_map=0 +compress/channel_pack=0 +mipmaps/generate=false +mipmaps/limit=-1 +roughness/mode=0 +roughness/src_normal="" +process/channel_remap/red=0 +process/channel_remap/green=1 +process/channel_remap/blue=2 +process/channel_remap/alpha=3 +process/fix_alpha_border=true +process/premult_alpha=false +process/normal_map_invert_y=false +process/hdr_as_srgb=false +process/hdr_clamp_exposure=false +process/size_limit=0 +detect_3d/compress_to=0 diff --git a/art/exported/creatures/6905.png b/art/exported/creatures/6905.png new file mode 100644 index 0000000..296848e Binary files /dev/null and b/art/exported/creatures/6905.png differ diff --git a/art/exported/creatures/6905.png.import b/art/exported/creatures/6905.png.import new file mode 100644 index 0000000..f267dc2 --- /dev/null +++ b/art/exported/creatures/6905.png.import @@ -0,0 +1,42 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://c4d8x6qyhahvn" +path.s3tc="res://.godot/imported/6905.png-a52c1647421059618698e17d7a3f8f98.s3tc.ctex" +path.etc2="res://.godot/imported/6905.png-a52c1647421059618698e17d7a3f8f98.etc2.ctex" +metadata={ +"imported_formats": ["s3tc_bptc", "etc2_astc"], +"vram_texture": true +} + +[deps] + +source_file="res://art/exported/creatures/6905.png" +dest_files=["res://.godot/imported/6905.png-a52c1647421059618698e17d7a3f8f98.s3tc.ctex", "res://.godot/imported/6905.png-a52c1647421059618698e17d7a3f8f98.etc2.ctex"] + +[params] + +compress/mode=2 +compress/high_quality=false +compress/lossy_quality=0.7 +compress/uastc_level=0 +compress/rdo_quality_loss=0.0 +compress/hdr_compression=1 +compress/normal_map=0 +compress/channel_pack=0 +mipmaps/generate=false +mipmaps/limit=-1 +roughness/mode=0 +roughness/src_normal="" +process/channel_remap/red=0 +process/channel_remap/green=1 +process/channel_remap/blue=2 +process/channel_remap/alpha=3 +process/fix_alpha_border=true +process/premult_alpha=false +process/normal_map_invert_y=false +process/hdr_as_srgb=false +process/hdr_clamp_exposure=false +process/size_limit=0 +detect_3d/compress_to=0 diff --git a/art/exported/creatures/701.png b/art/exported/creatures/701.png new file mode 100644 index 0000000..4f7d8f8 Binary files /dev/null and b/art/exported/creatures/701.png differ diff --git a/art/exported/creatures/701.png.import b/art/exported/creatures/701.png.import new file mode 100644 index 0000000..7598ee8 --- /dev/null +++ b/art/exported/creatures/701.png.import @@ -0,0 +1,42 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://jw5xt0cfjn1d" +path.s3tc="res://.godot/imported/701.png-8a66c28a9f49fa465ce3b5342fa08dbc.s3tc.ctex" +path.etc2="res://.godot/imported/701.png-8a66c28a9f49fa465ce3b5342fa08dbc.etc2.ctex" +metadata={ +"imported_formats": ["s3tc_bptc", "etc2_astc"], +"vram_texture": true +} + +[deps] + +source_file="res://art/exported/creatures/701.png" +dest_files=["res://.godot/imported/701.png-8a66c28a9f49fa465ce3b5342fa08dbc.s3tc.ctex", "res://.godot/imported/701.png-8a66c28a9f49fa465ce3b5342fa08dbc.etc2.ctex"] + +[params] + +compress/mode=2 +compress/high_quality=false +compress/lossy_quality=0.7 +compress/uastc_level=0 +compress/rdo_quality_loss=0.0 +compress/hdr_compression=1 +compress/normal_map=0 +compress/channel_pack=0 +mipmaps/generate=false +mipmaps/limit=-1 +roughness/mode=0 +roughness/src_normal="" +process/channel_remap/red=0 +process/channel_remap/green=1 +process/channel_remap/blue=2 +process/channel_remap/alpha=3 +process/fix_alpha_border=true +process/premult_alpha=false +process/normal_map_invert_y=false +process/hdr_as_srgb=false +process/hdr_clamp_exposure=false +process/size_limit=0 +detect_3d/compress_to=0 diff --git a/art/exported/creatures/704.png b/art/exported/creatures/704.png new file mode 100644 index 0000000..526d090 Binary files /dev/null and b/art/exported/creatures/704.png differ diff --git a/art/exported/creatures/704.png.import b/art/exported/creatures/704.png.import new file mode 100644 index 0000000..e80e19e --- /dev/null +++ b/art/exported/creatures/704.png.import @@ -0,0 +1,42 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://bonpxkp6uwxq6" +path.s3tc="res://.godot/imported/704.png-649669246217a14c9609a7e929841827.s3tc.ctex" +path.etc2="res://.godot/imported/704.png-649669246217a14c9609a7e929841827.etc2.ctex" +metadata={ +"imported_formats": ["s3tc_bptc", "etc2_astc"], +"vram_texture": true +} + +[deps] + +source_file="res://art/exported/creatures/704.png" +dest_files=["res://.godot/imported/704.png-649669246217a14c9609a7e929841827.s3tc.ctex", "res://.godot/imported/704.png-649669246217a14c9609a7e929841827.etc2.ctex"] + +[params] + +compress/mode=2 +compress/high_quality=false +compress/lossy_quality=0.7 +compress/uastc_level=0 +compress/rdo_quality_loss=0.0 +compress/hdr_compression=1 +compress/normal_map=0 +compress/channel_pack=0 +mipmaps/generate=false +mipmaps/limit=-1 +roughness/mode=0 +roughness/src_normal="" +process/channel_remap/red=0 +process/channel_remap/green=1 +process/channel_remap/blue=2 +process/channel_remap/alpha=3 +process/fix_alpha_border=true +process/premult_alpha=false +process/normal_map_invert_y=false +process/hdr_as_srgb=false +process/hdr_clamp_exposure=false +process/size_limit=0 +detect_3d/compress_to=0 diff --git a/art/exported/creatures/7101.png b/art/exported/creatures/7101.png new file mode 100644 index 0000000..93a13af Binary files /dev/null and b/art/exported/creatures/7101.png differ diff --git a/art/exported/creatures/7101.png.import b/art/exported/creatures/7101.png.import new file mode 100644 index 0000000..2d312b3 --- /dev/null +++ b/art/exported/creatures/7101.png.import @@ -0,0 +1,42 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://dd5lpjei8ix4d" +path.s3tc="res://.godot/imported/7101.png-9be787a05b48075222e923e556de87ac.s3tc.ctex" +path.etc2="res://.godot/imported/7101.png-9be787a05b48075222e923e556de87ac.etc2.ctex" +metadata={ +"imported_formats": ["s3tc_bptc", "etc2_astc"], +"vram_texture": true +} + +[deps] + +source_file="res://art/exported/creatures/7101.png" +dest_files=["res://.godot/imported/7101.png-9be787a05b48075222e923e556de87ac.s3tc.ctex", "res://.godot/imported/7101.png-9be787a05b48075222e923e556de87ac.etc2.ctex"] + +[params] + +compress/mode=2 +compress/high_quality=false +compress/lossy_quality=0.7 +compress/uastc_level=0 +compress/rdo_quality_loss=0.0 +compress/hdr_compression=1 +compress/normal_map=0 +compress/channel_pack=0 +mipmaps/generate=false +mipmaps/limit=-1 +roughness/mode=0 +roughness/src_normal="" +process/channel_remap/red=0 +process/channel_remap/green=1 +process/channel_remap/blue=2 +process/channel_remap/alpha=3 +process/fix_alpha_border=true +process/premult_alpha=false +process/normal_map_invert_y=false +process/hdr_as_srgb=false +process/hdr_clamp_exposure=false +process/size_limit=0 +detect_3d/compress_to=0 diff --git a/art/exported/creatures/7403.png b/art/exported/creatures/7403.png new file mode 100644 index 0000000..ad73c17 Binary files /dev/null and b/art/exported/creatures/7403.png differ diff --git a/art/exported/creatures/7403.png.import b/art/exported/creatures/7403.png.import new file mode 100644 index 0000000..bef32c4 --- /dev/null +++ b/art/exported/creatures/7403.png.import @@ -0,0 +1,42 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://bl7ru6gm5xnpb" +path.s3tc="res://.godot/imported/7403.png-54b51089a6ff5c2091372d659ba4bdc7.s3tc.ctex" +path.etc2="res://.godot/imported/7403.png-54b51089a6ff5c2091372d659ba4bdc7.etc2.ctex" +metadata={ +"imported_formats": ["s3tc_bptc", "etc2_astc"], +"vram_texture": true +} + +[deps] + +source_file="res://art/exported/creatures/7403.png" +dest_files=["res://.godot/imported/7403.png-54b51089a6ff5c2091372d659ba4bdc7.s3tc.ctex", "res://.godot/imported/7403.png-54b51089a6ff5c2091372d659ba4bdc7.etc2.ctex"] + +[params] + +compress/mode=2 +compress/high_quality=false +compress/lossy_quality=0.7 +compress/uastc_level=0 +compress/rdo_quality_loss=0.0 +compress/hdr_compression=1 +compress/normal_map=0 +compress/channel_pack=0 +mipmaps/generate=false +mipmaps/limit=-1 +roughness/mode=0 +roughness/src_normal="" +process/channel_remap/red=0 +process/channel_remap/green=1 +process/channel_remap/blue=2 +process/channel_remap/alpha=3 +process/fix_alpha_border=true +process/premult_alpha=false +process/normal_map_invert_y=false +process/hdr_as_srgb=false +process/hdr_clamp_exposure=false +process/size_limit=0 +detect_3d/compress_to=0 diff --git a/art/exported/creatures/7506.png b/art/exported/creatures/7506.png new file mode 100644 index 0000000..7e8c5b2 Binary files /dev/null and b/art/exported/creatures/7506.png differ diff --git a/art/exported/creatures/7506.png.import b/art/exported/creatures/7506.png.import new file mode 100644 index 0000000..c2c99a0 --- /dev/null +++ b/art/exported/creatures/7506.png.import @@ -0,0 +1,42 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://c6qm3sujp8xvg" +path.s3tc="res://.godot/imported/7506.png-5c0f871c623e61a890015626ea315de9.s3tc.ctex" +path.etc2="res://.godot/imported/7506.png-5c0f871c623e61a890015626ea315de9.etc2.ctex" +metadata={ +"imported_formats": ["s3tc_bptc", "etc2_astc"], +"vram_texture": true +} + +[deps] + +source_file="res://art/exported/creatures/7506.png" +dest_files=["res://.godot/imported/7506.png-5c0f871c623e61a890015626ea315de9.s3tc.ctex", "res://.godot/imported/7506.png-5c0f871c623e61a890015626ea315de9.etc2.ctex"] + +[params] + +compress/mode=2 +compress/high_quality=false +compress/lossy_quality=0.7 +compress/uastc_level=0 +compress/rdo_quality_loss=0.0 +compress/hdr_compression=1 +compress/normal_map=0 +compress/channel_pack=0 +mipmaps/generate=false +mipmaps/limit=-1 +roughness/mode=0 +roughness/src_normal="" +process/channel_remap/red=0 +process/channel_remap/green=1 +process/channel_remap/blue=2 +process/channel_remap/alpha=3 +process/fix_alpha_border=true +process/premult_alpha=false +process/normal_map_invert_y=false +process/hdr_as_srgb=false +process/hdr_clamp_exposure=false +process/size_limit=0 +detect_3d/compress_to=0 diff --git a/art/exported/creatures/7508.png b/art/exported/creatures/7508.png new file mode 100644 index 0000000..27f1a59 Binary files /dev/null and b/art/exported/creatures/7508.png differ diff --git a/art/exported/creatures/7508.png.import b/art/exported/creatures/7508.png.import new file mode 100644 index 0000000..a14d42f --- /dev/null +++ b/art/exported/creatures/7508.png.import @@ -0,0 +1,42 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://bnw0dw14iyxbh" +path.s3tc="res://.godot/imported/7508.png-555eff33a2cb66622ccca9d7f063522e.s3tc.ctex" +path.etc2="res://.godot/imported/7508.png-555eff33a2cb66622ccca9d7f063522e.etc2.ctex" +metadata={ +"imported_formats": ["s3tc_bptc", "etc2_astc"], +"vram_texture": true +} + +[deps] + +source_file="res://art/exported/creatures/7508.png" +dest_files=["res://.godot/imported/7508.png-555eff33a2cb66622ccca9d7f063522e.s3tc.ctex", "res://.godot/imported/7508.png-555eff33a2cb66622ccca9d7f063522e.etc2.ctex"] + +[params] + +compress/mode=2 +compress/high_quality=false +compress/lossy_quality=0.7 +compress/uastc_level=0 +compress/rdo_quality_loss=0.0 +compress/hdr_compression=1 +compress/normal_map=0 +compress/channel_pack=0 +mipmaps/generate=false +mipmaps/limit=-1 +roughness/mode=0 +roughness/src_normal="" +process/channel_remap/red=0 +process/channel_remap/green=1 +process/channel_remap/blue=2 +process/channel_remap/alpha=3 +process/fix_alpha_border=true +process/premult_alpha=false +process/normal_map_invert_y=false +process/hdr_as_srgb=false +process/hdr_clamp_exposure=false +process/size_limit=0 +detect_3d/compress_to=0 diff --git a/art/exported/creatures/801.png b/art/exported/creatures/801.png new file mode 100644 index 0000000..f2e6390 Binary files /dev/null and b/art/exported/creatures/801.png differ diff --git a/art/exported/creatures/801.png.import b/art/exported/creatures/801.png.import new file mode 100644 index 0000000..3721440 --- /dev/null +++ b/art/exported/creatures/801.png.import @@ -0,0 +1,42 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://dkocdkoyy2udh" +path.s3tc="res://.godot/imported/801.png-b0324ef8c10934464b8be69cb9eca981.s3tc.ctex" +path.etc2="res://.godot/imported/801.png-b0324ef8c10934464b8be69cb9eca981.etc2.ctex" +metadata={ +"imported_formats": ["s3tc_bptc", "etc2_astc"], +"vram_texture": true +} + +[deps] + +source_file="res://art/exported/creatures/801.png" +dest_files=["res://.godot/imported/801.png-b0324ef8c10934464b8be69cb9eca981.s3tc.ctex", "res://.godot/imported/801.png-b0324ef8c10934464b8be69cb9eca981.etc2.ctex"] + +[params] + +compress/mode=2 +compress/high_quality=false +compress/lossy_quality=0.7 +compress/uastc_level=0 +compress/rdo_quality_loss=0.0 +compress/hdr_compression=1 +compress/normal_map=0 +compress/channel_pack=0 +mipmaps/generate=false +mipmaps/limit=-1 +roughness/mode=0 +roughness/src_normal="" +process/channel_remap/red=0 +process/channel_remap/green=1 +process/channel_remap/blue=2 +process/channel_remap/alpha=3 +process/fix_alpha_border=true +process/premult_alpha=false +process/normal_map_invert_y=false +process/hdr_as_srgb=false +process/hdr_clamp_exposure=false +process/size_limit=0 +detect_3d/compress_to=0 diff --git a/art/exported/creatures/802.png b/art/exported/creatures/802.png new file mode 100644 index 0000000..f786031 Binary files /dev/null and b/art/exported/creatures/802.png differ diff --git a/art/exported/creatures/802.png.import b/art/exported/creatures/802.png.import new file mode 100644 index 0000000..f7e4cc6 --- /dev/null +++ b/art/exported/creatures/802.png.import @@ -0,0 +1,42 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://b6pkx1koopl7p" +path.s3tc="res://.godot/imported/802.png-1e79f95b56c444a9c7183dada8a14dc3.s3tc.ctex" +path.etc2="res://.godot/imported/802.png-1e79f95b56c444a9c7183dada8a14dc3.etc2.ctex" +metadata={ +"imported_formats": ["s3tc_bptc", "etc2_astc"], +"vram_texture": true +} + +[deps] + +source_file="res://art/exported/creatures/802.png" +dest_files=["res://.godot/imported/802.png-1e79f95b56c444a9c7183dada8a14dc3.s3tc.ctex", "res://.godot/imported/802.png-1e79f95b56c444a9c7183dada8a14dc3.etc2.ctex"] + +[params] + +compress/mode=2 +compress/high_quality=false +compress/lossy_quality=0.7 +compress/uastc_level=0 +compress/rdo_quality_loss=0.0 +compress/hdr_compression=1 +compress/normal_map=0 +compress/channel_pack=0 +mipmaps/generate=false +mipmaps/limit=-1 +roughness/mode=0 +roughness/src_normal="" +process/channel_remap/red=0 +process/channel_remap/green=1 +process/channel_remap/blue=2 +process/channel_remap/alpha=3 +process/fix_alpha_border=true +process/premult_alpha=false +process/normal_map_invert_y=false +process/hdr_as_srgb=false +process/hdr_clamp_exposure=false +process/size_limit=0 +detect_3d/compress_to=0 diff --git a/art/exported/creatures/805.png b/art/exported/creatures/805.png new file mode 100644 index 0000000..727793c Binary files /dev/null and b/art/exported/creatures/805.png differ diff --git a/art/exported/creatures/805.png.import b/art/exported/creatures/805.png.import new file mode 100644 index 0000000..db359af --- /dev/null +++ b/art/exported/creatures/805.png.import @@ -0,0 +1,42 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://cyo0ihvopej4" +path.s3tc="res://.godot/imported/805.png-f508211dd3f15d8b9090675eef9939f7.s3tc.ctex" +path.etc2="res://.godot/imported/805.png-f508211dd3f15d8b9090675eef9939f7.etc2.ctex" +metadata={ +"imported_formats": ["s3tc_bptc", "etc2_astc"], +"vram_texture": true +} + +[deps] + +source_file="res://art/exported/creatures/805.png" +dest_files=["res://.godot/imported/805.png-f508211dd3f15d8b9090675eef9939f7.s3tc.ctex", "res://.godot/imported/805.png-f508211dd3f15d8b9090675eef9939f7.etc2.ctex"] + +[params] + +compress/mode=2 +compress/high_quality=false +compress/lossy_quality=0.7 +compress/uastc_level=0 +compress/rdo_quality_loss=0.0 +compress/hdr_compression=1 +compress/normal_map=0 +compress/channel_pack=0 +mipmaps/generate=false +mipmaps/limit=-1 +roughness/mode=0 +roughness/src_normal="" +process/channel_remap/red=0 +process/channel_remap/green=1 +process/channel_remap/blue=2 +process/channel_remap/alpha=3 +process/fix_alpha_border=true +process/premult_alpha=false +process/normal_map_invert_y=false +process/hdr_as_srgb=false +process/hdr_clamp_exposure=false +process/size_limit=0 +detect_3d/compress_to=0 diff --git a/art/exported/creatures/806.png b/art/exported/creatures/806.png new file mode 100644 index 0000000..a8acdb1 Binary files /dev/null and b/art/exported/creatures/806.png differ diff --git a/art/exported/creatures/806.png.import b/art/exported/creatures/806.png.import new file mode 100644 index 0000000..8078cb6 --- /dev/null +++ b/art/exported/creatures/806.png.import @@ -0,0 +1,42 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://c31dw2wqjat40" +path.s3tc="res://.godot/imported/806.png-640099ab90a2d2daf3c4e7229634452c.s3tc.ctex" +path.etc2="res://.godot/imported/806.png-640099ab90a2d2daf3c4e7229634452c.etc2.ctex" +metadata={ +"imported_formats": ["s3tc_bptc", "etc2_astc"], +"vram_texture": true +} + +[deps] + +source_file="res://art/exported/creatures/806.png" +dest_files=["res://.godot/imported/806.png-640099ab90a2d2daf3c4e7229634452c.s3tc.ctex", "res://.godot/imported/806.png-640099ab90a2d2daf3c4e7229634452c.etc2.ctex"] + +[params] + +compress/mode=2 +compress/high_quality=false +compress/lossy_quality=0.7 +compress/uastc_level=0 +compress/rdo_quality_loss=0.0 +compress/hdr_compression=1 +compress/normal_map=0 +compress/channel_pack=0 +mipmaps/generate=false +mipmaps/limit=-1 +roughness/mode=0 +roughness/src_normal="" +process/channel_remap/red=0 +process/channel_remap/green=1 +process/channel_remap/blue=2 +process/channel_remap/alpha=3 +process/fix_alpha_border=true +process/premult_alpha=false +process/normal_map_invert_y=false +process/hdr_as_srgb=false +process/hdr_clamp_exposure=false +process/size_limit=0 +detect_3d/compress_to=0 diff --git a/art/exported/creatures/808.png b/art/exported/creatures/808.png new file mode 100644 index 0000000..e218b8e Binary files /dev/null and b/art/exported/creatures/808.png differ diff --git a/art/exported/creatures/808.png.import b/art/exported/creatures/808.png.import new file mode 100644 index 0000000..1126876 --- /dev/null +++ b/art/exported/creatures/808.png.import @@ -0,0 +1,42 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://x2d4nglo0rlk" +path.s3tc="res://.godot/imported/808.png-bc683347c2e3b627379b7eb047e12a89.s3tc.ctex" +path.etc2="res://.godot/imported/808.png-bc683347c2e3b627379b7eb047e12a89.etc2.ctex" +metadata={ +"imported_formats": ["s3tc_bptc", "etc2_astc"], +"vram_texture": true +} + +[deps] + +source_file="res://art/exported/creatures/808.png" +dest_files=["res://.godot/imported/808.png-bc683347c2e3b627379b7eb047e12a89.s3tc.ctex", "res://.godot/imported/808.png-bc683347c2e3b627379b7eb047e12a89.etc2.ctex"] + +[params] + +compress/mode=2 +compress/high_quality=false +compress/lossy_quality=0.7 +compress/uastc_level=0 +compress/rdo_quality_loss=0.0 +compress/hdr_compression=1 +compress/normal_map=0 +compress/channel_pack=0 +mipmaps/generate=false +mipmaps/limit=-1 +roughness/mode=0 +roughness/src_normal="" +process/channel_remap/red=0 +process/channel_remap/green=1 +process/channel_remap/blue=2 +process/channel_remap/alpha=3 +process/fix_alpha_border=true +process/premult_alpha=false +process/normal_map_invert_y=false +process/hdr_as_srgb=false +process/hdr_clamp_exposure=false +process/size_limit=0 +detect_3d/compress_to=0 diff --git a/art/exported/creatures/fish_placeholder.png b/art/exported/creatures/fish_placeholder.png new file mode 100644 index 0000000..de69afb Binary files /dev/null and b/art/exported/creatures/fish_placeholder.png differ diff --git a/art/exported/creatures/fish_placeholder.png.import b/art/exported/creatures/fish_placeholder.png.import new file mode 100644 index 0000000..87111f4 --- /dev/null +++ b/art/exported/creatures/fish_placeholder.png.import @@ -0,0 +1,42 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://d08ce7q8vmlfs" +path.s3tc="res://.godot/imported/fish_placeholder.png-41ecfc07b87417338ce888ac1e2c2362.s3tc.ctex" +path.etc2="res://.godot/imported/fish_placeholder.png-41ecfc07b87417338ce888ac1e2c2362.etc2.ctex" +metadata={ +"imported_formats": ["s3tc_bptc", "etc2_astc"], +"vram_texture": true +} + +[deps] + +source_file="res://art/exported/creatures/fish_placeholder.png" +dest_files=["res://.godot/imported/fish_placeholder.png-41ecfc07b87417338ce888ac1e2c2362.s3tc.ctex", "res://.godot/imported/fish_placeholder.png-41ecfc07b87417338ce888ac1e2c2362.etc2.ctex"] + +[params] + +compress/mode=2 +compress/high_quality=false +compress/lossy_quality=0.7 +compress/uastc_level=0 +compress/rdo_quality_loss=0.0 +compress/hdr_compression=1 +compress/normal_map=0 +compress/channel_pack=0 +mipmaps/generate=false +mipmaps/limit=-1 +roughness/mode=0 +roughness/src_normal="" +process/channel_remap/red=0 +process/channel_remap/green=1 +process/channel_remap/blue=2 +process/channel_remap/alpha=3 +process/fix_alpha_border=true +process/premult_alpha=false +process/normal_map_invert_y=false +process/hdr_as_srgb=false +process/hdr_clamp_exposure=false +process/size_limit=0 +detect_3d/compress_to=0 diff --git a/art/exported/items/equipment/net.glb b/art/exported/items/equipment/net.glb new file mode 100644 index 0000000..db4fa34 Binary files /dev/null and b/art/exported/items/equipment/net.glb differ diff --git a/art/exported/items/equipment/net.glb.import b/art/exported/items/equipment/net.glb.import new file mode 100644 index 0000000..28667d6 --- /dev/null +++ b/art/exported/items/equipment/net.glb.import @@ -0,0 +1,45 @@ +[remap] + +importer="scene" +importer_version=1 +type="PackedScene" +uid="uid://dsa6yss1sxfcy" +path="res://.godot/imported/net.glb-cbbc53905aec6a50c4a3322ca7a93b1e.scn" + +[deps] + +source_file="res://art/exported/items/equipment/net.glb" +dest_files=["res://.godot/imported/net.glb-cbbc53905aec6a50c4a3322ca7a93b1e.scn"] + +[params] + +nodes/root_type="" +nodes/root_name="" +nodes/root_script=null +mesh_library/use_node_names_as_mesh_names=false +array_mesh/deduplicate_surfaces=true +nodes/apply_root_scale=true +nodes/root_scale=1.0 +nodes/import_as_skeleton_bones=false +nodes/use_name_suffixes=true +nodes/use_node_type_suffixes=true +meshes/ensure_tangents=true +meshes/generate_lods=true +meshes/create_shadow_meshes=true +meshes/light_baking=1 +meshes/lightmap_texel_size=0.2 +meshes/force_disable_compression=false +skins/use_named_skins=true +animation/import=true +animation/fps=30 +animation/trimming=false +animation/remove_immutable_tracks=true +animation/import_rest_as_RESET=false +import_script/path="" +materials/extract=0 +materials/extract_format=0 +materials/extract_path="" +_subresources={} +gltf/naming_version=2 +gltf/embedded_image_handling=1 +gltf/texture_map_mode=1 diff --git a/art/exported/items/equipment/net_Material.png b/art/exported/items/equipment/net_Material.png new file mode 100644 index 0000000..bd5eff2 Binary files /dev/null and b/art/exported/items/equipment/net_Material.png differ diff --git a/art/exported/items/equipment/net_Material.png.import b/art/exported/items/equipment/net_Material.png.import new file mode 100644 index 0000000..0723973 --- /dev/null +++ b/art/exported/items/equipment/net_Material.png.import @@ -0,0 +1,45 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://binoqhg45vgbs" +path.s3tc="res://.godot/imported/net_Material.png-f4c4b0400561bc2751fe719b6b1a1e1a.s3tc.ctex" +path.etc2="res://.godot/imported/net_Material.png-f4c4b0400561bc2751fe719b6b1a1e1a.etc2.ctex" +metadata={ +"imported_formats": ["s3tc_bptc", "etc2_astc"], +"vram_texture": true +} +generator_parameters={ +"md5": "ef2c2ae657c9460c90eb808ba5217f39" +} + +[deps] + +source_file="res://art/exported/items/equipment/net_Material.png" +dest_files=["res://.godot/imported/net_Material.png-f4c4b0400561bc2751fe719b6b1a1e1a.s3tc.ctex", "res://.godot/imported/net_Material.png-f4c4b0400561bc2751fe719b6b1a1e1a.etc2.ctex"] + +[params] + +compress/mode=2 +compress/high_quality=false +compress/lossy_quality=0.7 +compress/uastc_level=0 +compress/rdo_quality_loss=0.0 +compress/hdr_compression=1 +compress/normal_map=0 +compress/channel_pack=0 +mipmaps/generate=false +mipmaps/limit=-1 +roughness/mode=0 +roughness/src_normal="" +process/channel_remap/red=0 +process/channel_remap/green=1 +process/channel_remap/blue=2 +process/channel_remap/alpha=3 +process/fix_alpha_border=true +process/premult_alpha=false +process/normal_map_invert_y=false +process/hdr_as_srgb=false +process/hdr_clamp_exposure=false +process/size_limit=0 +detect_3d/compress_to=0 diff --git a/art/exported/items/equipment/net_Plane Base Color.png b/art/exported/items/equipment/net_Plane Base Color.png new file mode 100644 index 0000000..795d0a3 Binary files /dev/null and b/art/exported/items/equipment/net_Plane Base Color.png differ diff --git a/art/exported/items/equipment/net_Plane Base Color.png.import b/art/exported/items/equipment/net_Plane Base Color.png.import new file mode 100644 index 0000000..61077be --- /dev/null +++ b/art/exported/items/equipment/net_Plane Base Color.png.import @@ -0,0 +1,45 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://cdsabucjy5rpk" +path.s3tc="res://.godot/imported/net_Plane Base Color.png-3875ae3dd186ddf319c55aabb13e663f.s3tc.ctex" +path.etc2="res://.godot/imported/net_Plane Base Color.png-3875ae3dd186ddf319c55aabb13e663f.etc2.ctex" +metadata={ +"imported_formats": ["s3tc_bptc", "etc2_astc"], +"vram_texture": true +} +generator_parameters={ +"md5": "a6001c381d4c8e16bd2d64ea74ccff82" +} + +[deps] + +source_file="res://art/exported/items/equipment/net_Plane Base Color.png" +dest_files=["res://.godot/imported/net_Plane Base Color.png-3875ae3dd186ddf319c55aabb13e663f.s3tc.ctex", "res://.godot/imported/net_Plane Base Color.png-3875ae3dd186ddf319c55aabb13e663f.etc2.ctex"] + +[params] + +compress/mode=2 +compress/high_quality=false +compress/lossy_quality=0.7 +compress/uastc_level=0 +compress/rdo_quality_loss=0.0 +compress/hdr_compression=1 +compress/normal_map=0 +compress/channel_pack=0 +mipmaps/generate=false +mipmaps/limit=-1 +roughness/mode=0 +roughness/src_normal="" +process/channel_remap/red=0 +process/channel_remap/green=1 +process/channel_remap/blue=2 +process/channel_remap/alpha=3 +process/fix_alpha_border=true +process/premult_alpha=false +process/normal_map_invert_y=false +process/hdr_as_srgb=false +process/hdr_clamp_exposure=false +process/size_limit=0 +detect_3d/compress_to=0 diff --git a/art/exported/system_icons/netfishing.ico b/art/exported/system_icons/netfishing.ico deleted file mode 100644 index dc5bdae..0000000 Binary files a/art/exported/system_icons/netfishing.ico and /dev/null differ diff --git a/art/exported/system_icons/netfishing_1024.png b/art/exported/system_icons/netfishing_1024.png deleted file mode 100644 index a433e80..0000000 Binary files a/art/exported/system_icons/netfishing_1024.png and /dev/null differ diff --git a/art/exported/system_icons/netfishing_256.png b/art/exported/system_icons/netfishing_256.png deleted file mode 100644 index 1e7be72..0000000 Binary files a/art/exported/system_icons/netfishing_256.png and /dev/null differ diff --git a/art/exported/system_icons/straywild.ico b/art/exported/system_icons/straywild.ico new file mode 100644 index 0000000..c03de8e Binary files /dev/null and b/art/exported/system_icons/straywild.ico differ diff --git a/art/exported/system_icons/straywild_1024.png b/art/exported/system_icons/straywild_1024.png new file mode 100644 index 0000000..2a3b204 Binary files /dev/null and b/art/exported/system_icons/straywild_1024.png differ diff --git a/art/exported/system_icons/netfishing_1024.png.import b/art/exported/system_icons/straywild_1024.png.import similarity index 74% rename from art/exported/system_icons/netfishing_1024.png.import rename to art/exported/system_icons/straywild_1024.png.import index 08aa925..dea156a 100644 --- a/art/exported/system_icons/netfishing_1024.png.import +++ b/art/exported/system_icons/straywild_1024.png.import @@ -3,15 +3,15 @@ importer="texture" type="CompressedTexture2D" uid="uid://bkh5hw8wwu8pc" -path="res://.godot/imported/netfishing_1024.png-7c53a099ed2743b4a623c258641b1d29.ctex" +path="res://.godot/imported/straywild_1024.png-b9b5c159c9fcecc21b04324370d4522f.ctex" metadata={ "vram_texture": false } [deps] -source_file="res://art/exported/system_icons/netfishing_1024.png" -dest_files=["res://.godot/imported/netfishing_1024.png-7c53a099ed2743b4a623c258641b1d29.ctex"] +source_file="res://art/exported/system_icons/straywild_1024.png" +dest_files=["res://.godot/imported/straywild_1024.png-b9b5c159c9fcecc21b04324370d4522f.ctex"] [params] diff --git a/art/exported/system_icons/straywild_256.png b/art/exported/system_icons/straywild_256.png new file mode 100644 index 0000000..98275eb Binary files /dev/null and b/art/exported/system_icons/straywild_256.png differ diff --git a/art/exported/system_icons/netfishing_256.png.import b/art/exported/system_icons/straywild_256.png.import similarity index 74% rename from art/exported/system_icons/netfishing_256.png.import rename to art/exported/system_icons/straywild_256.png.import index 34d5d27..5726347 100644 --- a/art/exported/system_icons/netfishing_256.png.import +++ b/art/exported/system_icons/straywild_256.png.import @@ -3,15 +3,15 @@ importer="texture" type="CompressedTexture2D" uid="uid://cty16m8ydla06" -path="res://.godot/imported/netfishing_256.png-d9dfc9c7871ac38bc73d09d00df679be.ctex" +path="res://.godot/imported/straywild_256.png-87b7e62e710eae4d3e3ed24a8454ca6d.ctex" metadata={ "vram_texture": false } [deps] -source_file="res://art/exported/system_icons/netfishing_256.png" -dest_files=["res://.godot/imported/netfishing_256.png-d9dfc9c7871ac38bc73d09d00df679be.ctex"] +source_file="res://art/exported/system_icons/straywild_256.png" +dest_files=["res://.godot/imported/straywild_256.png-87b7e62e710eae4d3e3ed24a8454ca6d.ctex"] [params] diff --git a/art/source/characters/base/netfishing_character_source.blend b/art/source/characters/base/netfishing_character_source.blend deleted file mode 100644 index e75f254..0000000 Binary files a/art/source/characters/base/netfishing_character_source.blend and /dev/null differ diff --git a/art/source/characters/base/netfishing_base_character.blend b/art/source/characters/base/straywild_base_character.blend similarity index 100% rename from art/source/characters/base/netfishing_base_character.blend rename to art/source/characters/base/straywild_base_character.blend diff --git a/art/source/characters/base/netfishing_base_character.blend.import b/art/source/characters/base/straywild_base_character.blend.import similarity index 84% rename from art/source/characters/base/netfishing_base_character.blend.import rename to art/source/characters/base/straywild_base_character.blend.import index f6df489..2cab53c 100644 --- a/art/source/characters/base/netfishing_base_character.blend.import +++ b/art/source/characters/base/straywild_base_character.blend.import @@ -4,12 +4,12 @@ importer="scene" importer_version=1 type="PackedScene" uid="uid://cb4bcakhoprm8" -path="res://.godot/imported/netfishing_base_character.blend-65bf3bc5b77cc1a37fa3f81ebd808d37.scn" +path="res://.godot/imported/straywild_base_character.blend-02abbfdb9b1d393f1bd3cfface615e27.scn" [deps] -source_file="res://art/source/characters/base/netfishing_base_character.blend" -dest_files=["res://.godot/imported/netfishing_base_character.blend-65bf3bc5b77cc1a37fa3f81ebd808d37.scn"] +source_file="res://art/source/characters/base/straywild_base_character.blend" +dest_files=["res://.godot/imported/straywild_base_character.blend-02abbfdb9b1d393f1bd3cfface615e27.scn"] [params] diff --git a/art/source/characters/base/netfishing_base_character.glb.import b/art/source/characters/base/straywild_base_character.glb.import similarity index 77% rename from art/source/characters/base/netfishing_base_character.glb.import rename to art/source/characters/base/straywild_base_character.glb.import index 5a38b76..bda93c0 100644 --- a/art/source/characters/base/netfishing_base_character.glb.import +++ b/art/source/characters/base/straywild_base_character.glb.import @@ -4,12 +4,12 @@ importer="scene" importer_version=1 type="PackedScene" uid="uid://bfhnup14638r7" -path="res://.godot/imported/netfishing_base_character.glb-cbdc33eaa4fcd1d2d2a8f4a463b228d6.scn" +path="res://.godot/imported/straywild_base_character.glb-c9650c715a1b5b9ae0d8541191f7d7a9.scn" [deps] -source_file="res://art/source/characters/base/netfishing_base_character.glb" -dest_files=["res://.godot/imported/netfishing_base_character.glb-cbdc33eaa4fcd1d2d2a8f4a463b228d6.scn"] +source_file="res://art/source/characters/base/straywild_base_character.glb" +dest_files=["res://.godot/imported/straywild_base_character.glb-c9650c715a1b5b9ae0d8541191f7d7a9.scn"] [params] diff --git a/art/source/characters/base/straywild_character_source.blend b/art/source/characters/base/straywild_character_source.blend new file mode 100644 index 0000000..17a1b4d Binary files /dev/null and b/art/source/characters/base/straywild_character_source.blend differ diff --git a/art/source/characters/base/netfishing_character_source.blend.import b/art/source/characters/base/straywild_character_source.blend.import similarity index 84% rename from art/source/characters/base/netfishing_character_source.blend.import rename to art/source/characters/base/straywild_character_source.blend.import index 8288280..741c389 100644 --- a/art/source/characters/base/netfishing_character_source.blend.import +++ b/art/source/characters/base/straywild_character_source.blend.import @@ -4,12 +4,12 @@ importer="scene" importer_version=1 type="PackedScene" uid="uid://d38y8blk2w5c5" -path="res://.godot/imported/netfishing_character_source.blend-1d18c95606937d4c8bcb87e334e02ee5.scn" +path="res://.godot/imported/straywild_character_source.blend-0e7b8a87008f88e309ad73a63561ef5b.scn" [deps] -source_file="res://art/source/characters/base/netfishing_character_source.blend" -dest_files=["res://.godot/imported/netfishing_character_source.blend-1d18c95606937d4c8bcb87e334e02ee5.scn"] +source_file="res://art/source/characters/base/straywild_character_source.blend" +dest_files=["res://.godot/imported/straywild_character_source.blend-0e7b8a87008f88e309ad73a63561ef5b.scn"] [params] diff --git a/art/source/characters/base/netfishing_character_source.glb.import b/art/source/characters/base/straywild_character_source.glb.import similarity index 76% rename from art/source/characters/base/netfishing_character_source.glb.import rename to art/source/characters/base/straywild_character_source.glb.import index 61158c5..bbcee6a 100644 --- a/art/source/characters/base/netfishing_character_source.glb.import +++ b/art/source/characters/base/straywild_character_source.glb.import @@ -4,12 +4,12 @@ importer="scene" importer_version=1 type="PackedScene" uid="uid://3uq4cxiomttt" -path="res://.godot/imported/netfishing_character_source.glb-9c98ee44b142c5b3d06f0838b7d2c9c4.scn" +path="res://.godot/imported/straywild_character_source.glb-3a8ccc55dbe60da1b70b62110b206353.scn" [deps] -source_file="res://art/source/characters/base/netfishing_character_source.glb" -dest_files=["res://.godot/imported/netfishing_character_source.glb-9c98ee44b142c5b3d06f0838b7d2c9c4.scn"] +source_file="res://art/source/characters/base/straywild_character_source.glb" +dest_files=["res://.godot/imported/straywild_character_source.glb-3a8ccc55dbe60da1b70b62110b206353.scn"] [params] diff --git a/art/source/characters/base/netfishing_character_source_eyes1_eyebrows1.png b/art/source/characters/base/straywild_character_source_eyes1_eyebrows1.png similarity index 100% rename from art/source/characters/base/netfishing_character_source_eyes1_eyebrows1.png rename to art/source/characters/base/straywild_character_source_eyes1_eyebrows1.png diff --git a/art/source/characters/base/netfishing_character_source_eyes1_eyebrows1.png.import b/art/source/characters/base/straywild_character_source_eyes1_eyebrows1.png.import similarity index 58% rename from art/source/characters/base/netfishing_character_source_eyes1_eyebrows1.png.import rename to art/source/characters/base/straywild_character_source_eyes1_eyebrows1.png.import index e7aade1..dba5a5f 100644 --- a/art/source/characters/base/netfishing_character_source_eyes1_eyebrows1.png.import +++ b/art/source/characters/base/straywild_character_source_eyes1_eyebrows1.png.import @@ -3,8 +3,8 @@ importer="texture" type="CompressedTexture2D" uid="uid://bdomsntfeovnc" -path.s3tc="res://.godot/imported/netfishing_character_source_eyes1_eyebrows1.png-a0b9f287e407afd9688e141dc5f2b801.s3tc.ctex" -path.etc2="res://.godot/imported/netfishing_character_source_eyes1_eyebrows1.png-a0b9f287e407afd9688e141dc5f2b801.etc2.ctex" +path.s3tc="res://.godot/imported/straywild_character_source_eyes1_eyebrows1.png-3c638377e631a94b998336d0ca1d8b8e.s3tc.ctex" +path.etc2="res://.godot/imported/straywild_character_source_eyes1_eyebrows1.png-3c638377e631a94b998336d0ca1d8b8e.etc2.ctex" metadata={ "imported_formats": ["s3tc_bptc", "etc2_astc"], "vram_texture": true @@ -15,8 +15,8 @@ generator_parameters={ [deps] -source_file="res://art/source/characters/base/netfishing_character_source_eyes1_eyebrows1.png" -dest_files=["res://.godot/imported/netfishing_character_source_eyes1_eyebrows1.png-a0b9f287e407afd9688e141dc5f2b801.s3tc.ctex", "res://.godot/imported/netfishing_character_source_eyes1_eyebrows1.png-a0b9f287e407afd9688e141dc5f2b801.etc2.ctex"] +source_file="res://art/source/characters/base/straywild_character_source_eyes1_eyebrows1.png" +dest_files=["res://.godot/imported/straywild_character_source_eyes1_eyebrows1.png-3c638377e631a94b998336d0ca1d8b8e.s3tc.ctex", "res://.godot/imported/straywild_character_source_eyes1_eyebrows1.png-3c638377e631a94b998336d0ca1d8b8e.etc2.ctex"] [params] diff --git a/art/source/characters/base/netfishing_character_source_eyes_simple_shine.png b/art/source/characters/base/straywild_character_source_eyes_simple_shine.png similarity index 100% rename from art/source/characters/base/netfishing_character_source_eyes_simple_shine.png rename to art/source/characters/base/straywild_character_source_eyes_simple_shine.png diff --git a/art/source/characters/base/netfishing_character_source_eyes_simple_shine.png.import b/art/source/characters/base/straywild_character_source_eyes_simple_shine.png.import similarity index 58% rename from art/source/characters/base/netfishing_character_source_eyes_simple_shine.png.import rename to art/source/characters/base/straywild_character_source_eyes_simple_shine.png.import index e49d401..8b99f72 100644 --- a/art/source/characters/base/netfishing_character_source_eyes_simple_shine.png.import +++ b/art/source/characters/base/straywild_character_source_eyes_simple_shine.png.import @@ -3,8 +3,8 @@ importer="texture" type="CompressedTexture2D" uid="uid://du4u6meapay05" -path.s3tc="res://.godot/imported/netfishing_character_source_eyes_simple_shine.png-965743f3716320bbc385096956ffef2d.s3tc.ctex" -path.etc2="res://.godot/imported/netfishing_character_source_eyes_simple_shine.png-965743f3716320bbc385096956ffef2d.etc2.ctex" +path.s3tc="res://.godot/imported/straywild_character_source_eyes_simple_shine.png-97500ad873e0da3aaf0e9e3c3198e38a.s3tc.ctex" +path.etc2="res://.godot/imported/straywild_character_source_eyes_simple_shine.png-97500ad873e0da3aaf0e9e3c3198e38a.etc2.ctex" metadata={ "imported_formats": ["s3tc_bptc", "etc2_astc"], "vram_texture": true @@ -15,8 +15,8 @@ generator_parameters={ [deps] -source_file="res://art/source/characters/base/netfishing_character_source_eyes_simple_shine.png" -dest_files=["res://.godot/imported/netfishing_character_source_eyes_simple_shine.png-965743f3716320bbc385096956ffef2d.s3tc.ctex", "res://.godot/imported/netfishing_character_source_eyes_simple_shine.png-965743f3716320bbc385096956ffef2d.etc2.ctex"] +source_file="res://art/source/characters/base/straywild_character_source_eyes_simple_shine.png" +dest_files=["res://.godot/imported/straywild_character_source_eyes_simple_shine.png-97500ad873e0da3aaf0e9e3c3198e38a.s3tc.ctex", "res://.godot/imported/straywild_character_source_eyes_simple_shine.png-97500ad873e0da3aaf0e9e3c3198e38a.etc2.ctex"] [params] diff --git a/art/source/characters/base/netfishing_character_source_mouth1.png b/art/source/characters/base/straywild_character_source_mouth1.png similarity index 100% rename from art/source/characters/base/netfishing_character_source_mouth1.png rename to art/source/characters/base/straywild_character_source_mouth1.png diff --git a/art/source/characters/base/netfishing_character_source_mouth1.png.import b/art/source/characters/base/straywild_character_source_mouth1.png.import similarity index 60% rename from art/source/characters/base/netfishing_character_source_mouth1.png.import rename to art/source/characters/base/straywild_character_source_mouth1.png.import index 8ff49a4..5dd84f4 100644 --- a/art/source/characters/base/netfishing_character_source_mouth1.png.import +++ b/art/source/characters/base/straywild_character_source_mouth1.png.import @@ -3,8 +3,8 @@ importer="texture" type="CompressedTexture2D" uid="uid://css0k0virgoph" -path.s3tc="res://.godot/imported/netfishing_character_source_mouth1.png-b323b9153acd3f552f35c1d1108567c8.s3tc.ctex" -path.etc2="res://.godot/imported/netfishing_character_source_mouth1.png-b323b9153acd3f552f35c1d1108567c8.etc2.ctex" +path.s3tc="res://.godot/imported/straywild_character_source_mouth1.png-ff2ed280ca7e84bdd0749ed5b5b16f54.s3tc.ctex" +path.etc2="res://.godot/imported/straywild_character_source_mouth1.png-ff2ed280ca7e84bdd0749ed5b5b16f54.etc2.ctex" metadata={ "imported_formats": ["s3tc_bptc", "etc2_astc"], "vram_texture": true @@ -15,8 +15,8 @@ generator_parameters={ [deps] -source_file="res://art/source/characters/base/netfishing_character_source_mouth1.png" -dest_files=["res://.godot/imported/netfishing_character_source_mouth1.png-b323b9153acd3f552f35c1d1108567c8.s3tc.ctex", "res://.godot/imported/netfishing_character_source_mouth1.png-b323b9153acd3f552f35c1d1108567c8.etc2.ctex"] +source_file="res://art/source/characters/base/straywild_character_source_mouth1.png" +dest_files=["res://.godot/imported/straywild_character_source_mouth1.png-ff2ed280ca7e84bdd0749ed5b5b16f54.s3tc.ctex", "res://.godot/imported/straywild_character_source_mouth1.png-ff2ed280ca7e84bdd0749ed5b5b16f54.etc2.ctex"] [params] diff --git a/art/source/characters/base/netfishing_character_source_mouth_three.png b/art/source/characters/base/straywild_character_source_mouth_three.png similarity index 100% rename from art/source/characters/base/netfishing_character_source_mouth_three.png rename to art/source/characters/base/straywild_character_source_mouth_three.png diff --git a/art/source/characters/base/netfishing_character_source_mouth_three.png.import b/art/source/characters/base/straywild_character_source_mouth_three.png.import similarity index 59% rename from art/source/characters/base/netfishing_character_source_mouth_three.png.import rename to art/source/characters/base/straywild_character_source_mouth_three.png.import index 6abae09..4b2413d 100644 --- a/art/source/characters/base/netfishing_character_source_mouth_three.png.import +++ b/art/source/characters/base/straywild_character_source_mouth_three.png.import @@ -3,8 +3,8 @@ importer="texture" type="CompressedTexture2D" uid="uid://di20c1x8vksi1" -path.s3tc="res://.godot/imported/netfishing_character_source_mouth_three.png-6bf79d4c9c660d30fb7fc365f0039313.s3tc.ctex" -path.etc2="res://.godot/imported/netfishing_character_source_mouth_three.png-6bf79d4c9c660d30fb7fc365f0039313.etc2.ctex" +path.s3tc="res://.godot/imported/straywild_character_source_mouth_three.png-adf40ee30e725bafadf6a8fa4dbd8abf.s3tc.ctex" +path.etc2="res://.godot/imported/straywild_character_source_mouth_three.png-adf40ee30e725bafadf6a8fa4dbd8abf.etc2.ctex" metadata={ "imported_formats": ["s3tc_bptc", "etc2_astc"], "vram_texture": true @@ -15,8 +15,8 @@ generator_parameters={ [deps] -source_file="res://art/source/characters/base/netfishing_character_source_mouth_three.png" -dest_files=["res://.godot/imported/netfishing_character_source_mouth_three.png-6bf79d4c9c660d30fb7fc365f0039313.s3tc.ctex", "res://.godot/imported/netfishing_character_source_mouth_three.png-6bf79d4c9c660d30fb7fc365f0039313.etc2.ctex"] +source_file="res://art/source/characters/base/straywild_character_source_mouth_three.png" +dest_files=["res://.godot/imported/straywild_character_source_mouth_three.png-adf40ee30e725bafadf6a8fa4dbd8abf.s3tc.ctex", "res://.godot/imported/straywild_character_source_mouth_three.png-adf40ee30e725bafadf6a8fa4dbd8abf.etc2.ctex"] [params] diff --git a/art/source/characters/base/netfishing_character_source_nose1.2.png b/art/source/characters/base/straywild_character_source_nose1.2.png similarity index 100% rename from art/source/characters/base/netfishing_character_source_nose1.2.png rename to art/source/characters/base/straywild_character_source_nose1.2.png diff --git a/art/source/characters/base/netfishing_character_source_nose1.2.png.import b/art/source/characters/base/straywild_character_source_nose1.2.png.import similarity index 60% rename from art/source/characters/base/netfishing_character_source_nose1.2.png.import rename to art/source/characters/base/straywild_character_source_nose1.2.png.import index 2fbb165..e0c3667 100644 --- a/art/source/characters/base/netfishing_character_source_nose1.2.png.import +++ b/art/source/characters/base/straywild_character_source_nose1.2.png.import @@ -3,8 +3,8 @@ importer="texture" type="CompressedTexture2D" uid="uid://7dwa0bfev1rk" -path.s3tc="res://.godot/imported/netfishing_character_source_nose1.2.png-ef4dd456c5b0f0db73b3dc063bfba941.s3tc.ctex" -path.etc2="res://.godot/imported/netfishing_character_source_nose1.2.png-ef4dd456c5b0f0db73b3dc063bfba941.etc2.ctex" +path.s3tc="res://.godot/imported/straywild_character_source_nose1.2.png-0a8355472731651768eaa5fc2ee168d4.s3tc.ctex" +path.etc2="res://.godot/imported/straywild_character_source_nose1.2.png-0a8355472731651768eaa5fc2ee168d4.etc2.ctex" metadata={ "imported_formats": ["s3tc_bptc", "etc2_astc"], "vram_texture": true @@ -15,8 +15,8 @@ generator_parameters={ [deps] -source_file="res://art/source/characters/base/netfishing_character_source_nose1.2.png" -dest_files=["res://.godot/imported/netfishing_character_source_nose1.2.png-ef4dd456c5b0f0db73b3dc063bfba941.s3tc.ctex", "res://.godot/imported/netfishing_character_source_nose1.2.png-ef4dd456c5b0f0db73b3dc063bfba941.etc2.ctex"] +source_file="res://art/source/characters/base/straywild_character_source_nose1.2.png" +dest_files=["res://.godot/imported/straywild_character_source_nose1.2.png-0a8355472731651768eaa5fc2ee168d4.s3tc.ctex", "res://.godot/imported/straywild_character_source_nose1.2.png-0a8355472731651768eaa5fc2ee168d4.etc2.ctex"] [params] diff --git a/art/source/characters/base/netfishing_character_source_nose_dog_round.png b/art/source/characters/base/straywild_character_source_nose_dog_round.png similarity index 100% rename from art/source/characters/base/netfishing_character_source_nose_dog_round.png rename to art/source/characters/base/straywild_character_source_nose_dog_round.png diff --git a/art/source/characters/base/netfishing_character_source_nose_dog_round.png.import b/art/source/characters/base/straywild_character_source_nose_dog_round.png.import similarity index 59% rename from art/source/characters/base/netfishing_character_source_nose_dog_round.png.import rename to art/source/characters/base/straywild_character_source_nose_dog_round.png.import index 12333e8..5fe079e 100644 --- a/art/source/characters/base/netfishing_character_source_nose_dog_round.png.import +++ b/art/source/characters/base/straywild_character_source_nose_dog_round.png.import @@ -3,8 +3,8 @@ importer="texture" type="CompressedTexture2D" uid="uid://b0p55hwdry2cr" -path.s3tc="res://.godot/imported/netfishing_character_source_nose_dog_round.png-1c89150861ebff3f930698c1747a0369.s3tc.ctex" -path.etc2="res://.godot/imported/netfishing_character_source_nose_dog_round.png-1c89150861ebff3f930698c1747a0369.etc2.ctex" +path.s3tc="res://.godot/imported/straywild_character_source_nose_dog_round.png-d1ea0db61e41dfeeed3b599286ffb82c.s3tc.ctex" +path.etc2="res://.godot/imported/straywild_character_source_nose_dog_round.png-d1ea0db61e41dfeeed3b599286ffb82c.etc2.ctex" metadata={ "imported_formats": ["s3tc_bptc", "etc2_astc"], "vram_texture": true @@ -15,8 +15,8 @@ generator_parameters={ [deps] -source_file="res://art/source/characters/base/netfishing_character_source_nose_dog_round.png" -dest_files=["res://.godot/imported/netfishing_character_source_nose_dog_round.png-1c89150861ebff3f930698c1747a0369.s3tc.ctex", "res://.godot/imported/netfishing_character_source_nose_dog_round.png-1c89150861ebff3f930698c1747a0369.etc2.ctex"] +source_file="res://art/source/characters/base/straywild_character_source_nose_dog_round.png" +dest_files=["res://.godot/imported/straywild_character_source_nose_dog_round.png-d1ea0db61e41dfeeed3b599286ffb82c.s3tc.ctex", "res://.godot/imported/straywild_character_source_nose_dog_round.png-d1ea0db61e41dfeeed3b599286ffb82c.etc2.ctex"] [params] diff --git a/art/source/items/equipment/.gdignore b/art/source/items/equipment/.gdignore new file mode 100644 index 0000000..e69de29 diff --git a/art/source/items/equipment/net.blend b/art/source/items/equipment/net.blend new file mode 100644 index 0000000..0a7ba4c Binary files /dev/null and b/art/source/items/equipment/net.blend differ diff --git a/audio/music/world/tulips.wav b/audio/music/world/tulips.wav new file mode 100644 index 0000000..9cd4605 Binary files /dev/null and b/audio/music/world/tulips.wav differ diff --git a/sound/dialogue/animalese/placeholder/k.wav.import b/audio/music/world/tulips.wav.import similarity index 50% rename from sound/dialogue/animalese/placeholder/k.wav.import rename to audio/music/world/tulips.wav.import index 4af149c..0f8cce1 100644 --- a/sound/dialogue/animalese/placeholder/k.wav.import +++ b/audio/music/world/tulips.wav.import @@ -2,13 +2,13 @@ importer="wav" type="AudioStreamWAV" -uid="uid://eypaqf1iaq5" -path="res://.godot/imported/k.wav-b85d045dc022b9055c25a650b2e3af2a.sample" +uid="uid://5hgmht4bq1my" +path="res://.godot/imported/tulips.wav-7c18a300a62f25396913efb28c2ba3f6.sample" [deps] -source_file="res://sound/dialogue/animalese/placeholder/k.wav" -dest_files=["res://.godot/imported/k.wav-b85d045dc022b9055c25a650b2e3af2a.sample"] +source_file="res://audio/music/world/tulips.wav" +dest_files=["res://.godot/imported/tulips.wav-7c18a300a62f25396913efb28c2ba3f6.sample"] [params] diff --git a/collection/collection_log.gd b/collection/collection_log.gd index da36eb8..59d33d1 100644 --- a/collection/collection_log.gd +++ b/collection/collection_log.gd @@ -6,9 +6,11 @@ signal fish_quality_discovered(fish_id: StringName, quality: int) signal collection_changed const FishQualityType = preload("res://fish/fish_quality.gd") +const MAX_CATCH_COUNT: int = 1000000000 var _discovered: Dictionary[StringName, bool] = {} var _quality_masks: Dictionary[StringName, int] = {} +var _catch_counts: Dictionary[StringName, int] = {} func has_discovered(fish_id: StringName) -> bool: @@ -41,6 +43,26 @@ func mark_quality_discovered(fish_id: StringName, quality: int) -> void: collection_changed.emit() +func record_catch(fish_id: StringName, quality: int) -> void: + if fish_id.is_empty() or not FishQualityType.is_valid(quality): + return + var species_was_discovered: bool = has_discovered(fish_id) + if not species_was_discovered: + _discovered[fish_id] = true + var previous_mask: int = _quality_masks.get(fish_id, 0) + var next_mask: int = previous_mask | FishQualityType.bit_for(quality) + _quality_masks[fish_id] = next_mask + _catch_counts[fish_id] = mini( + int(_catch_counts.get(fish_id, 0)) + 1, + MAX_CATCH_COUNT, + ) + if not species_was_discovered: + fish_discovered.emit(fish_id) + if next_mask != previous_mask: + fish_quality_discovered.emit(fish_id, quality) + collection_changed.emit() + + func get_discovered_ids() -> Array[StringName]: var discovered_ids: Array[StringName] = [] for fish_id: StringName in _discovered: @@ -65,6 +87,14 @@ func get_discovered_quality_masks() -> Dictionary[StringName, int]: return _quality_masks.duplicate() +func get_catch_count(fish_id: StringName) -> int: + return _catch_counts.get(fish_id, 0) if has_discovered(fish_id) else 0 + + +func get_catch_counts() -> Dictionary[StringName, int]: + return _catch_counts.duplicate() + + func has_mastered(fish_id: StringName) -> bool: return get_quality_mask(fish_id) == FishQualityType.ALL_TIERS_MASK @@ -77,6 +107,22 @@ func replace_discovered_ids(fish_ids: Array[StringName]) -> bool: func replace_discovery_state( fish_ids: Array[StringName], quality_masks: Dictionary[StringName, int], +) -> bool: + var preserved_counts: Dictionary[StringName, int] = {} + for fish_id: StringName in fish_ids: + if _catch_counts.has(fish_id): + preserved_counts[fish_id] = _catch_counts[fish_id] + return replace_collection_state( + fish_ids, + quality_masks, + preserved_counts, + ) + + +func replace_collection_state( + fish_ids: Array[StringName], + quality_masks: Dictionary[StringName, int], + catch_counts: Dictionary[StringName, int], ) -> bool: var replacement: Dictionary[StringName, bool] = {} for fish_id: StringName in fish_ids: @@ -95,7 +141,19 @@ func replace_discovery_state( return false if mask != 0: replacement_masks[fish_id] = mask + var replacement_counts: Dictionary[StringName, int] = {} + for fish_id: StringName in catch_counts: + var count: int = catch_counts[fish_id] + if ( + fish_id.is_empty() + or not replacement.has(fish_id) + or count <= 0 + or count > MAX_CATCH_COUNT + ): + return false + replacement_counts[fish_id] = count _discovered = replacement _quality_masks = replacement_masks + _catch_counts = replacement_counts collection_changed.emit() return true diff --git a/docs/ATTRIBUTION.md b/docs/ATTRIBUTION.md index 0f5f410..d8676f0 100644 --- a/docs/ATTRIBUTION.md +++ b/docs/ATTRIBUTION.md @@ -7,26 +7,31 @@ prove authorship or licensing. ## Ownership and credits -NETfishing is jointly owned, developed, and published by its creators, +straywild is jointly owned, developed, and published by its creators, publicly credited as Voyager and Endeavour and operating collectively as the independent team Woofmeow. -- Voyager: co-owner, developer, project director, creator of the game's 3D - art, and composer of the original title/ambient track - `audio/music/title/as_in_four_wolves.ogg`, world track - `audio/music/world/craft.mp3`, and animalese placeholder tones. -- Endeavour: co-owner, developer, and creator of the game's 2D art, including - the original fish, environment, UI, and other artwork. +- Voyager: co-owner, developer, project director, creator of the game's + provisional fish placeholder artwork and original 3D work except where + another creator is credited, and composer of the original title track + `audio/music/title/as_in_four_wolves.ogg`, dusk/world track + `audio/music/world/craft.mp3`, and the synthesized robot animalese tones. +- Endeavour: co-owner, developer, and 2D artist. Her incorporated work includes + character pattern/channel-map art, environment and UI art, item art, and + finished fish and creature artwork. Planned work is not described as + incorporated until its files enter the project. - chillnfill: contributor of original 3D models for the character bodies and arms, ears and tails, and multiple world props and decorative assets, including trees and bridges. The contributor requested to be credited as `chillnfill`. -- Tekgator: creator of the cooler-capacity, reel-speed, and barrier-power shop - icons. +- kat: supplied the original source voice recording for the kat animalese set. + Voyager created the sliced, normalized runtime derivatives. +- kim: supplied the original source voice recording for the kim animalese set. + Voyager created the sliced, normalized runtime derivatives. Voyager is also the original catalog porter credit in PortMaster metadata. Third-party creators are credited with their individual records below. Those -credits do not imply endorsement of NETfishing, Woofmeow, or its owners. +credits do not imply endorsement of straywild, Woofmeow, or its owners. ## License map @@ -36,30 +41,31 @@ Do not describe the complete repository as covered only by the GPL. | --- | --- | | Project-owned software code, shaders, code-oriented scene/resource configuration, tests, build tooling, and server software | GPL-3.0-or-later; source-root `LICENSE` and packaged `GPL-3.0-or-later.txt` | | Project-owned artwork, textures, models, animation, music, audio, narrative content, characters, and other creative assets | Source-root or packaged `ASSET-LICENSE.md` | -| NETfishing and Woofmeow names, logos, icons, and official identity | Source-root or packaged `TRADEMARKS.md` | +| straywild and Woofmeow names, logos, icons, and official identity | Source-root or packaged `TRADEMARKS.md` | | Third-party engines, fonts, sounds, and other external material | Their original terms, recorded below and in adjacent license texts where applicable | -| New outside contributions | Source-root `CONTRIBUTOR-TERMS.md` plus any separately signed agreement | +| Previously accepted or expressly invited outside contributions | Source-root `CONTRIBUTOR-TERMS.md` plus any separately signed agreement | Generated Godot import metadata and deterministic generated resources follow the terms of their source material or generating code. Repository location alone does not relicense third-party material. The GPL permits study, modification, redistribution, and forks of covered -code. It does not grant rights to NETfishing creative assets or branding. The -NETfishing Asset License separately permits qualifying noncommercial add-on -Mods for official NETfishing software; it does not permit those assets to -accompany code forks, clones, standalone games, unrelated products, or -general-purpose asset packs. A GPL fork must replace NETfishing assets and -reserved branding with independently licensed material and a distinct -identity. +code. It does not grant rights to straywild creative assets or branding. The +straywild Asset License separately permits qualifying noncommercial add-on +Mods for official straywild software and narrowly scoped Contribution Forks +used to prepare changes for possible upstream inclusion. It does not permit +those assets to accompany independent code forks, clones, standalone games, +unrelated products, or general-purpose asset packs. A GPL fork that is not a +qualifying Contribution Fork must replace straywild assets and reserved +branding with independently licensed material and a distinct identity. Project-wide code, asset, branding, or contributor-license changes require -written approval from both NETfishing owners under their private joint +written approval from both straywild owners under their private joint ownership agreement. ## Godot Engine notice -NETfishing uses Godot Engine under the MIT License: +straywild uses Godot Engine under the MIT License: > Copyright (c) 2014-present Godot Engine contributors. > Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. @@ -97,46 +103,68 @@ FreeType for font rendering; portions are copyright The FreeType Project Runtime file: `ui/fonts/seattle_avenue.otf`; source, hash, and original notice: `ui/fonts/Seattle-Avenue-LICENSE.txt`. -Public-domain fonts are not governed by the NETfishing Asset License. +Public-domain fonts are not governed by the straywild Asset License. ## Intake policy -For every new external or supplied asset, record: +For every new external or supplied asset, retain a durable intake record with: - creator or supplying party; - original source location or delivery channel; -- source filename and repository destination; +- source filename and, when useful, its initial repository destination; - source and destination SHA-256 when copied without modification; - license or explicit permission; - any permitted transformations; - the importing commit or release. -Maintainers must also obtain affirmative agreement to the source-root -`CONTRIBUTOR-TERMS.md` before accepting an outside contribution and retain -that agreement in a durable pull request, issue, email, or signed document. +The intake record may live in the accepted pull request, issue, email, or the +owners' private project records. This public document should contain the +credits and license notices needed by recipients; it should not duplicate a +changing file inventory that can be derived from the repository itself. + +straywild does not accept unsolicited contributions. For work expressly +invited by both Owners, maintainers must obtain affirmative agreement to the +source-root `CONTRIBUTOR-TERMS.md` and retain the written invitation and +agreement in a durable Project record. Runtime resources must use `res://` paths. Workstation Sync folders are intake locations only and must never appear in scenes or resources. -## Asset inventory and provenance +## Project-created artwork and music -| Asset family | Repository location | Recorded provenance | +Fish entries without finished replacement artwork use provisional placeholder +artwork by Voyager. Incorporated finished fish and creature artwork is by +Endeavour; work that has not entered this repository is not presented here as +part of the game or attributed as a shipped asset. + +Endeavour's incorporated 2D contributions include the inventory notepad, +environment and UI artwork, item artwork, finished fish and creature artwork, +and character customization pattern and channel-map artwork. Voyager's +incorporated original work includes 3D assets, the provisional fish +placeholder artwork, the title and dusk music identified above, and the robot +animalese tones. The current starter motorcoach exterior was supplied by a +contributing artist who released its copyright to the project; the original +and cleaned source files are retained in the owners' source-work archive. +Specific contributor exceptions are recorded below and in the in-game credits. + +These credits intentionally describe work by creator and contribution family +instead of maintaining a second file-by-file asset catalog. Runtime resources +and Git history identify the files present in a particular revision. A path, +directory name, commit author, or supplying party is not by itself evidence of +authorship. + +## Third-party and contributor runtime material + +The following paths identify distributed material whose external license or +individual contributor credit must remain easy to find. They were checked +against the repository when this record was revised. + +| Material | Runtime location | Credit or terms | | --- | --- | --- | -| Fish art and portraits | `fish/species/`, `art/exported/fish/` | Original 2D artwork by co-owner Endeavour. | -| Item icons | `items/icons/` | Original 2D artwork by co-owner Endeavour except where separately credited below. | -| Cooler-capacity shop icon | `items/icons/equipment/64_cooler_plus.png` | Original artwork by Tekgator. Repository SHA-256: `b63705be5b78915753c068170323781a90e22b555b57a5b2ca9466e2726539f7`. | -| Reel-speed shop icon | `items/icons/shop/64_speed_plus.png` | Original artwork by Tekgator. Repository SHA-256: `938452798f2be505e06ce3fbef178f52459331fd3bced8763fbc2a80157125ca`. | -| Barrier-power shop icon | `items/icons/shop/64_power_plus.png` | Original artwork by Tekgator. Repository SHA-256: `164d34ce152aa6d75de79b69f0be2d9074f7891057de9636678889028ff98ae7`. | -| Inventory notepad | `art/ui/ui_notepad.png` | Original 2D artwork by co-owner Endeavour; integrated without a runtime external path. | -| Environment textures | `art/exported/environment/textures/` | Original 2D artwork by co-owner Endeavour. | -| UI patterns | `art/patterns/` | Original 2D artwork by co-owner Endeavour. | -| Fur customization channel maps | `art/exported/characters/patterns/` | Original 2D channel-map artwork by co-owner Endeavour. Exact file hashes are recorded below. | -| Character base meshes and appendages | `art/source/characters/base/`, `art/exported/characters/base/`, and derived character resources | Original body and arm models and original ear and tail models by chillnfill. Any embedded original 2D artwork is by Endeavour. | -| World and decorative prop models | `art/source/environment/`, `art/exported/environment/`, and derived world resources | Original prop and decorative models by chillnfill, including trees and bridges. Any embedded original 2D artwork is by Endeavour. | +| Kat animalese alphabet and number sounds | `sound/dialogue/animalese/alphanumeric/` | Project-processed derivatives of the original source voice recording supplied by straywild community member kat. | +| Kim animalese alphabet and number sounds | `sound/dialogue/animalese/kim/` | Project-processed derivatives of the original source voice recording supplied by straywild community member kim. | | Tuffy font | `ui/fonts/Tuffy_Bold.otf` | Public-domain dedication in `ui/fonts/Tuffy-LICENSE.txt`. | -| Seattle Avenue font | `ui/fonts/seattle_avenue.otf` | Public-domain font by JLH Fonts; source record and hash in `ui/fonts/Seattle-Avenue-LICENSE.txt`. | -| Title music | `audio/music/title/as_in_four_wolves.ogg` | Original music composed and owned by co-owner Voyager. | -| Dusk music | `audio/music/world/craft.mp3` | Original music composed and owned by co-owner Voyager. | +| Seattle Avenue font | `ui/fonts/seattle_avenue.otf` | Public-domain font by JLH Fonts; notice in `ui/fonts/Seattle-Avenue-LICENSE.txt`. | | Fishing fight loop | `audio/sfx/fishing/fighting.wav` | Edited from “Spinning reel.wav” by Freesound user tosha73, sound 509902, CC0. | | Manual-reeling loop | `audio/sfx/fishing/reeling.wav` | Edited from the same CC0 “Spinning reel.wav” source. | | Saltwater wave ambience | `audio/ambience/waves.wav` | “Gentle Ocean Waves Loop” by Freesound user kkenny101, sound 852826, CC0. | @@ -144,7 +172,6 @@ locations only and must never appear in scenes or resources. | Rain ambience | `audio/ambience/rain_loop_ontario.ogg` | Converted from “Rain Loop Ontario” by Freesound user Ayton, sound 212799, CC BY 3.0. | | Character bark call | `sound/dialogue/calls/bark.wav` | Edited from `Dog_Bark.wav` by Freesound user ivolipa, sound 328729, CC0. | | Character meow call | `sound/dialogue/calls/meow.wav` | Edited from `Cat meow.m4a` by Freesound user Christyboy100, sound 495694, Attribution 3.0. | -| Animalese placeholder tones | `sound/dialogue/animalese/placeholder/` | Original tones composed and owned by co-owner Voyager without third-party samples. | Creative Commons Zero information: https://creativecommons.org/publicdomain/zero/1.0/. Creative Commons @@ -157,54 +184,26 @@ https://creativecommons.org/licenses/by/3.0/legalcode. - Original contribution families: character bodies and arms; character ears and tails; and multiple world props and decorative assets, including trees and bridges. -- Repository mapping: character contributions are incorporated into the - character source/export families identified above. Prop contributions may - be incorporated into combined environment source and export files rather - than retained as one file per originally supplied model. +- Repository mapping: these contributions may be incorporated into combined + character or environment resources rather than retained as one file per + originally supplied model. Git history is the revision-specific file map. - Permission record: because these historical contributions predate the current `CONTRIBUTOR-TERMS.md`, retain the original permission record or a later written confirmation covering Project use, modification, distribution, commercial release, and applicable sublicensing. -### Fur customization channel-map record +### Endeavour 2D contribution record -Original channel-map artwork by Endeavour. Repository paths preserve the -authored `mesh_style.png` filenames. +Endeavour created the incorporated character customization patterns and +channel maps as well as additional UI, environment, item, fish, and creature +artwork. Voyager's provisional fish placeholder is not part of this credit. +New or replacement art is added to this record only after it is accepted into +the repository. -| Style and mesh | Source filename | Repository file | SHA-256 | -| --- | --- | --- | --- | -| Bengal spots, body and arms | `body_arms_bengal.png` | `art/exported/characters/patterns/bengal/body_arms_bengal.png` | `fa90bd4e74b0b770ce97bf69d069676f5d4bd1f5d649f89e09638a66b61a8470` | -| Bengal spots, main body | `body_main_bengal.png` | `art/exported/characters/patterns/bengal/body_main_bengal.png` | `8662fa198220cfdbe0aa83bdeeef7b855e20124d74f8481467f750d32b67ee8b` | -| Bengal spots, round head | `head_round_bengal.png` | `art/exported/characters/patterns/bengal/head_round_bengal.png` | `f397ed8d152e3fda8181757a2bbd01925b7b8c2c4362f515d91c7f0fbf3ddfb6` | -| Calico, main body | `body_main_calico.png` | `art/exported/characters/patterns/calico/body_main_calico.png` | `25b2389ee729a6bafafbe6b5440541b18f3c5db2808ca8d49c2d5c4d012d390c` | -| Fox, body and arms | `body_arms_fox.png` | `art/exported/characters/patterns/fox/body_arms_fox.png` | `9930808718f31d84b415902f1ba55ac2a508bb2ac127300e793d73a8a013022d` | -| Fox, main body | `body_main_fox.png` | `art/exported/characters/patterns/fox/body_main_fox.png` | `c65e4390173b8c31c9396edd053f940f0f809e47e01d18042cd7babc712dde9d` | -| Fox, short pointy ears | `ears_pointy_short_fox.png` | `art/exported/characters/patterns/fox/ears_pointy_short_fox.png` | `13cb35192d25c0136df287434fa056ce990698fc47dc50445c941f92a4ff42fb` | -| Fox, pointy head | `head_pointy_fox.png` | `art/exported/characters/patterns/fox/head_pointy_fox.png` | `71a9d2383e62884dbd3981460fcd985b18805fa907f61ffb16dce08ff9418ddf` | -| Fox, round head | `head_round_fox.png` | `art/exported/characters/patterns/fox/head_round_fox.png` | `1ac3d503bc1e47a5ae3c1a8af719c9d1be06aab2d6d4d30c179c2a021fe7d34d` | -| Fox tail | `tails_fox_fox.png` | `art/exported/characters/patterns/fox/tails_fox_fox.png` | `72da9673f038e2c3bb8aca19ed99932085fa3b162cab95366901c4e97153dd3e` | -| Paws, body and arms | `body_arms_paws.png` | `art/exported/characters/patterns/paws/body_arms_paws.png` | `38f31ecf7045510501bdd08cbc243065c2fadec481462671dd22b13e8a196e66` | -| Paws, main body | `body_main_paws.png` | `art/exported/characters/patterns/paws/body_main_paws.png` | `d52012d4a1ea3ed544582be714469ed8fec148ccd59417dda21e89c18509321b` | -| Stripes, main body | `body_main_stripes.png` | `art/exported/characters/patterns/stripes/body_main_stripes.png` | `4b1e5b412a7af3e6acd0a5bfb1b6ffd6e0814850a311fc8cc3061419a8f23555` | -| Tiger, main body | `body_main_tiger.png` | `art/exported/characters/patterns/tiger/body_main_tiger.png` | `64b6f47871802e72ba6fe15577f14949a760c6d44bb962bfbbdcddc991b2105b` | -| Tiger, round head | `head_round_tiger.png` | `art/exported/characters/patterns/tiger/head_round_tiger.png` | `6af27056b9827391a73b4ea6f3736b308fa93a03127570f90cc4d3701afd3d80` | -| Tummy, main body | `body_main_tummy.png` | `art/exported/characters/patterns/tummy/body_main_tummy.png` | `dad404614c3feae4082537c02556781ea46c664327e0dc4528804f76619af86a` | +The exact current filenames and bytes are intentionally not copied into this +document. The character appearance resources and Git history are the +revision-specific inventory. -### Tekgator shop icon contribution record - -- Requested credit: `Tekgator`. -- Original contributions: cooler-capacity, reel-speed, and barrier-power shop - icons. -- Repository files and SHA-256: - - `items/icons/equipment/64_cooler_plus.png`: - `b63705be5b78915753c068170323781a90e22b555b57a5b2ca9466e2726539f7` - - `items/icons/shop/64_speed_plus.png`: - `938452798f2be505e06ce3fbef178f52459331fd3bced8763fbc2a80157125ca` - - `items/icons/shop/64_power_plus.png`: - `164d34ce152aa6d75de79b69f0be2d9074f7891057de9636678889028ff98ae7` -- Permission record: retain the original permission record or a later written - confirmation covering Project use, modification, distribution, commercial - release, and applicable sublicensing. ### Fishing fight loop source record diff --git a/docs/DEVELOPMENT.md b/docs/DEVELOPMENT.md index 0b7a65c..76ed032 100644 --- a/docs/DEVELOPMENT.md +++ b/docs/DEVELOPMENT.md @@ -1,6 +1,6 @@ # Development reference -This is the authoritative reference for NETfishing architecture, engineering +This is the authoritative reference for straywild architecture, engineering decisions, content policy, authoring, and validation. ## Architecture @@ -43,9 +43,19 @@ open host may publish a short-lived room lease, and the shared Join Game page may browse compatible leases before handing the selected address back to the existing direct ENet connection flow. The directory does not carry gameplay traffic or become a gameplay authority. Its base URL comes from -`network/discovery/base_url`, with `NETFISHING_DISCOVERY_URL` available as a +`network/discovery/base_url`, with `straywild_DISCOVERY_URL` available as a development/deployment override. +Friendships are local identity relationships shared across save slots. A live, +authenticated gameplay session is required to exchange the directional +capabilities that establish a friendship. Blocking an identity removes that +friendship; unblocking does not recreate it. Discovery may publish opt-in, +short-lived friend presence and deliver invitations only while both games are +online. It stores hashed capability identifiers rather than identity +fingerprints or a complete friend graph, keeps no durable social records, and +provides no offline delivery. Direct joins still use the existing verified +public-room and ENet connection path. + The host is authoritative. Clients submit requests or evidence; the host derives trusted context from registered peers, authoritative regions, and server-owned state before mutating inventory, wallet, progression, or shared @@ -68,8 +78,12 @@ release version is not a reason to change the protocol number. `PlayerDataRoot` selects and validates a portable data root. Stores receive paths from that owner rather than inventing unrelated locations. Progression is -written by `PlayerSaveManager`; device settings and social/identity stores have -separate formats and lifecycles. +written by `PlayerSaveManager` and indexed as named slots by +`PlayerSaveSlotCatalog`. Existing single-save installations are adopted as the +first slot in place. Device settings, appearance, and social/identity stores +remain shared across slots and have separate formats and lifecycles. +Progression archive import and export belong to the title-screen Play page: +imports create a new slot, while exports copy only the selected progression. Save migrations are sequential and explicit. Existing catches and ownership are keyed by stable IDs so authored metadata can evolve without rewriting @@ -89,9 +103,8 @@ presented through a uniformly scaled SubViewport. Shared UI components and palette resources prevent page-specific geometry and style drift. World presentation systems (time/weather visuals, procedural sky and water, -shoreline ribbons, player blob shadows) do not own gameplay collision or -network authority. Generated shoreline meshes are deterministic presentation -resources baked from explicitly configured static terrain. +shoreline treatment, player blob shadows) do not own gameplay collision or +network authority. ### Engineering consequences @@ -129,9 +142,9 @@ remain authoritative in `.tres` resources and typed scripts. wallet exactly once. - Reserved assets are rejected atomically; mixed valid and reserved batches must not partially succeed. -- Item effects, shop prices, cooler capacity, fishing upgrades, jobs, and - experience are separate balance axes. Avoid changing several in an - unrelated presentation pass. +- Item effects, shop prices, inventory and storage capacity, fishing upgrades, + jobs, and experience are separate balance axes. Avoid changing several in + an unrelated presentation pass. Record affected stable IDs and resource paths, old and new values, intended player-facing outcome, interactions with quality/availability/economy, @@ -143,70 +156,57 @@ authored number changed. ### World composition -The active test world uses the canonical starter island through -`world/regions/starter_island_region.tscn`. +`world/test_world.tscn` is the shared gameplay stage. It owns the environment, +sun, world bounds, and below-world failsafe, then hosts exactly one active +`WorldRegion`. Two canonical region implementations are supported: -`world/test_world.tscn` owns the gameplay-wide environment, sun, world bounds, -and below-world failsafe. `StarterIslandRegion` owns the placed island content: +- the generated world, which is the default for new games and is rebuilt from + the saved seed; and +- the starter island, which remains an authored selectable layout and a useful + compatibility/reference scene. + +The stable layout IDs live in `world/world_layout.gd`. Do not infer a layout +from a scene filename, display label, or region node name. Both implementations +must satisfy the shared `WorldRegion` contract for player spawn, safe respawns, +water regions, recovery, gathering, digging, the shop, and player storage. + +A region owns the content that changes with the selected world: ```text -StarterIslandRegion +WorldRegion ├── Terrain -│ ├── Visual -│ └── Collision ├── WaterBodies -│ ├── Pond -│ │ ├── VisualWater -│ │ ├── FishingRegion -│ │ └── RecoveryRegion -│ └── Ocean -│ ├── VisualWater -│ ├── FishingRegions -│ └── RecoveryRegions ├── PlayerSpawn ├── SafeRespawns +├── DiggableAreas +├── GatherableAnchors └── Interactables ├── FishingShopWorld - └── PelicanCoolerPerch + └── PlayerStorageBox ``` -Move a meaningful feature root rather than one of its implementation children. -Child transforms are local offsets owned by that feature. +The generated region owns its chunk, biome, and prop catalogs and derives +terrain collision, water coverage, biome placement, and presentation reference +geometry from the generated result. The starter-island region owns its imported +terrain hierarchy and explicitly placed content. Code shared by both layouts +must depend on `WorldRegion`, not a starter-island child path. -Every fishable region authors its `water_type` explicitly. The starter pond is -`FRESH_WATER`; the starter coast is `SALT_WATER`. Fish species use the same -central type through an allowed-water-type bitmask. Do not infer habitat from -node names, pool filenames, coordinates, or water height. +Every fishable water body authors its water type explicitly. Fish species use +the same central type through an allowed-water-type bitmask. Do not infer +habitat from node names, pool filenames, coordinates, or water height. -Select `WaterBodies/Pond` to move or resize the pond. Its transform is the -authoritative surface position; surface size and fishing/recovery coverage are -owned together. Select `WaterBodies/Ocean` to move the surrounding water as one -feature. Its fishing coverage is derived from the visible water mesh and the -terrain collision determines the shoreline. New or revised land meshes do not -require hand-authored fishing exclusions. Recovery volumes remain explicit so -they can follow the playable world bounds rather than the horizon-sized visual -ocean. +In the generated layout, seed and layout ID are persistent data. Chunk IDs, +edge rules, biome definitions, and prop definitions are authored resources; +changing them can change the world produced by an existing seed and therefore +requires deliberate compatibility review. -Placed-feature ownership: +For the authored starter island, move a meaningful feature root rather than one +of its implementation children. Child transforms are local offsets owned by +that feature. Its imported GLB hierarchy is the starter region's terrain and +collision authority; this rule does not describe generated-world collision. -- `PlayerSpawn` defines the initial player transform and facing. -- `SafeRespawns` contains authoritative recovery destinations. Recovery - preserves current facing. -- `Interactables/FishingShopWorld` owns the shop visual, collision, interaction - area, prompt, and entrance marker. -- `Interactables/PelicanCoolerPerch` owns the Pelican landmark visual; selling - remains a Cooler action. -- `Terrain` owns imported visuals and generated collision. -- `BelowWorldFailsafe/Coverage` owns below-world recovery coverage. - -The starter-island GLB hierarchy is the terrain-collision authority. The -region rebuilds one concave collision shape from every imported -`MeshInstance3D` when it loads, so newly exported terrain and props participate -without a separate stale collision bake. Keep purely decorative meshes out of -that hierarchy if they should not block players. - -The active `Environment`, `Sun`, and starter-island grass material remain -Inspector-authored and are not recreated by runtime scripts. +The active `Environment` and `Sun` remain Inspector-authored on the shared +stage and are not recreated by either region. ### Reusable world props @@ -226,29 +226,14 @@ root scaling is acceptable when visual and collision scale together; avoid non-uniform root scaling. Make mutable per-instance shapes, meshes, and materials local to the scene. -### Shoreline tide ribbons +### Shoreline presentation -Maps using generated tide ribbons own a `ShorelineRibbonBaker` and one -`ShorelineRibbonConfig` per water body. Each configuration selects only its -static terrain source, water height, generation bounds, water-facing reference, -smoothing overrides, and generated `.tres` path. Props, players, bobbers, and -gameplay areas are not scanned unless selected explicitly. Only `SALT_WATER` -bodies generate ribbons. - -The editor automatically rebuilds configured shoreline resources when an -authored terrain GLB is reimported. Select the baker and press **Rebuild -Shoreline Ribbons** only when intentionally forcing a rebuild without a terrain -reimport. The equivalent headless fallback and validation command is: - -```sh -godot --headless --path . --script scripts/bake_shoreline_ribbons.gd -``` - -Use `debug_path_stage` only while comparing extraction stages and leave it Off -in committed scenes. A rebuild is required when saltwater terrain at the -waterline, water height, or generation bounds change; terrain reimports handle -the usual case automatically. Normal gameplay loads committed generated meshes -and never runs extraction. +The visible shoreline treatment is currently produced by the water materials. +The older smooth-ribbon baker and generated starter-island ribbon resource are +retained as development history/tooling, but the ribbon mesh is disabled and +is not part of the current rendered shoreline. Do not treat a ribbon rebuild +as a normal terrain-authoring requirement or re-enable the mesh as incidental +cleanup. ### Facial-feature textures @@ -276,9 +261,11 @@ copies of the entire customization catalog. ### Texture sampling -NETfishing artwork always uses nearest-neighbor sampling. Do not enable linear, -bilinear, trilinear, or anisotropic texture filtering, and do not generate -mipmaps. Shader samplers must declare `filter_nearest`. The +straywild artwork uses nearest-neighbor sampling. Do not enable linear, +bilinear, trilinear, or anisotropic texture filtering. Shader samplers must +declare `filter_nearest`. The three canonical repeating terrain textures are +the sole mipmap exception: their projected shader uses nearest-filtered +mipmaps to prevent distance aliasing without smoothing nearby pixels. The `TextureSamplingPolicy` autoload applies nearest sampling to 2D canvas items, Sprite3D presentations, imported 3D materials, and dynamically constructed mesh materials at runtime. @@ -292,6 +279,23 @@ godot --headless --path . --script scripts/normalize_texture_imports.gd \ godot --headless --path . --script tests/texture_sampling_validation.gd ``` +### Importing animalese voice sets + +Animalese clips use one deterministic runtime level and format: -18 dBFS RMS +with a -3 dBFS peak ceiling, mono, 48 kHz, 16-bit PCM. Import a supplied set +through the normalization script rather than copying its WAV files directly: + +```bash +scripts/import_animalese_voice.sh /path/to/source_clips +``` + +The source directory may contain lowercase letter, number, and underscore WAV +filenames. The script converts every top-level WAV and writes the results under +`sound/dialogue/animalese//`. Add a new runtime set to +`player/animalese_voice_profiles.gd` after import, then run the quick validation +suite. Keep the untouched submission and its original hashes in the private +intake record; repository files are normalized derivatives. + ### Bubble menus Instance `ui/components/bubble_menu/bubble_button.tscn` for each action, or @@ -347,8 +351,11 @@ godot --headless --path . --script tests/fish_catalog_content_validation.gd rm -rf -- "$test_root" ``` -Do not point `NETFISHING_DATA_DIR` at an arbitrary empty directory; it is an -explicit portable-data override and must identify a valid data root. +Do not point `straywild_DATA_DIR` at an arbitrary empty directory; it is an +explicit portable-data override and must identify a valid data root. The +PortMaster launcher is the narrow exception: it also sets +`straywild_CREATE_DATA_DIR=1`, allowing the game to initialize its known empty +external save directory on first launch. Headless tests cannot prove visual alignment, mouse routing, shader appearance, controller feel, or resize behavior. Presentation changes require graphical diff --git a/docs/PORTMASTER.md b/docs/PORTMASTER.md index 19144c0..803f72f 100644 --- a/docs/PORTMASTER.md +++ b/docs/PORTMASTER.md @@ -1,38 +1,62 @@ # PortMaster reference -NETfishing's PortMaster release is a canonical PortMaster package, not a +straywild's PortMaster release is a canonical PortMaster package, not a version-named generic ZIP. The installer-facing archive must be named -`netfishing.zip`, and its root must contain exactly: +`straywild.zip`, and its root must contain exactly: ```text -NETfishing.sh -netfishing/ -port.json +straywild.sh +straywild/ ``` +`port.json` belongs at `straywild/port.json` in the distributable archive. +The upstream source-submission layout keeps it beside the launcher and port +directory, but PortMaster's release builder relocates it into the declared +port directory. Do not copy the source-submission layout directly into a +release ZIP. + +HarbourMaster's installer also relocates recognized non-script files found at +an archive root into the detected port directory. That compatibility behavior +masked straywild's former root-level `port.json` during auto-install tests. +Directly extracting the same archive into `/ports` did not perform the repair. +Do not rely on installer relocation; build the distributable layout correctly. + Do not derive a release package from an older local `portmaster-stage` directory. The templates in `scripts/portmaster/` are authoritative. ## Release contract -- `port.json` uses schema version 4, names `netfishing.zip`, and marks the +- `port.json` uses schema version 4, names `straywild.zip`, and marks the self-contained package ready to run. -- `NETfishing.sh` starts with `# PORTMASTER: netfishing.zip, NETfishing.sh`. -- The executable is `netfishing/NETfishing.aarch64`. +- `straywild.sh` does not contain a `# PORTMASTER:` signature in the source or + distributable archive. HarbourMaster adds that installation marker when it + installs the port. +- The executable is `straywild/straywild.aarch64`. - The package declares AArch64, two analog sticks, GLIBC 2.28, and `weston_pkg_0.2.squashfs`. -- The launcher starts GPTOKEYB in exit-only mode without a `-c` mapping file. - PortMaster therefore owns only its device-specific force-quit chord while - Godot and NETfishing's controller mapping manager handle gameplay input. +- The launcher starts GPTOKEYB with the explicit `straywild.gptk` no-op map. + Every keyboard and mouse binding is disabled, leaving only GPTOKEYB's + device-specific force-quit chord while Godot and straywild's controller + mapping manager handle gameplay input. The explicit map also avoids the + anomalous controller behavior observed on ROCKNIX without a passthrough map. - The launcher calls `pm_platform_helper` for the game executable after starting GPTOKEYB and calls `pm_finish` after the game exits. -- Persistent device data remains under `netfishing/conf/data`, - `netfishing/conf/config`, and `netfishing/conf/cache`. +- straywild automatically creates player data for new installations under + `ports/saves/straywild/` and does not present the in-game folder picker. +- Existing installations with a selected data root keep that location when + upgraded. Device-local data, configuration, and cache remain under + `straywild/conf/data`, `straywild/conf/config`, and + `straywild/conf/cache`. +- A rebrand upgrade copies an existing `netfishing/conf/` tree into the new + `straywild/conf/` tree when the latter does not exist. It also reuses an + existing `ports/saves/netfishing/` data root rather than creating an empty + replacement. New installations use straywild paths exclusively. - The archive must not contain `conf/`, saves, identities, logs, source files, `.git`, or `.godot` content. -- Release downloads must publish `netfishing.zip`. A renamed versioned ZIP is - not a substitute because HarbourMaster identifies the canonical port by - archive name. +- Release downloads must publish only the canonical `straywild.zip` for this + platform. Do not also publish a byte-identical versioned PortMaster ZIP; + HarbourMaster identifies the port by its canonical archive name and the + Forgejo release tag already supplies the version. ## Build @@ -47,12 +71,24 @@ The script deletes and regenerates the Linux ARM64 export, stages the package, validates its structure, and writes: ```text -builds/v/netfishing.zip +builds/v/straywild.zip ``` `--package-only` is reserved for repackaging an already validated ARM64 export. It does not rebuild game content. +For a packaging-only correction to an already published game release, commit +only PortMaster launcher, packaging-script, or PortMaster documentation changes +after the immutable release tag, then run: + +```bash +bash scripts/build_portmaster.sh --package-only --hotfix +``` + +The hotfix keeps the game executable and PCK tied to the release tag while +recording the newer packaging commit separately in `BUILD-INFO.txt`. Replace +the release's existing `straywild.zip`; never move the game release tag. + ## Local muOS installation The muOS auto-install directory is: @@ -61,29 +97,31 @@ The muOS auto-install directory is: /mnt/mmc/MUOS/PortMaster/autoinstall/ ``` -For an explicit offline installation test, copy `netfishing.zip` to a temporary +For an explicit offline installation test, copy `straywild.zip` to a temporary device directory and run: ```bash /mnt/mmc/MUOS/PortMaster/harbourmaster \ - --offline --no-check install ./netfishing.zip + --offline --no-check install ./straywild.zip ``` -Before upgrading an existing installation, preserve -`/mnt/mmc/ports/netfishing/conf/` on the device. After installation: +Before upgrading an existing installation, preserve either the current +`/mnt/mmc/ports/straywild/` paths or the former `/mnt/mmc/ports/netfishing/` +paths on the device. After installation: 1. Confirm the installed executable and PCK hashes match the staged release. -2. Confirm the installed launcher contains the canonical PortMaster header, - starts GPTOKEYB without a `-c` mapping file, and calls - `pm_platform_helper` for the game executable. -3. Confirm `conf/` was not replaced or removed. +2. Confirm HarbourMaster added its `# PORTMASTER:` installation signature to + the installed launcher, then confirm the launcher starts GPTOKEYB with + `straywild.gptk` and calls `pm_platform_helper` for the game executable. +3. Confirm `conf/` and the external save directory were not replaced or + removed. 4. Launch the installed port through the normal muOS menu. 5. Verify the displayed game version and controller face-button mapping. -6. Verify PortMaster's force-quit chord exits the game. This is Start+Select on - most devices. +6. Verify GPTOKEYB's device-specific force-quit chord exits the game. This is + Start+Select on most devices. Installing the public PortMaster catalog entry can still install an older -catalog build until the upstream `netfishing.zip` is updated. A local release +catalog build until the upstream `straywild.zip` is updated. A local release test must install the generated local archive explicitly. ## Template provenance @@ -96,7 +134,7 @@ f24daae48f543b3a270a5aa46b5e73a31904bf0c7216d4c8a9e15a8dc48a5eed screenshot.png ``` The remaining catalog metadata assets were copied from the installed official -`netfishing.zip` package and are intentionally preserved byte-for-byte: +`straywild.zip` package and are intentionally preserved byte-for-byte: ```text e2a9d132744684c67865c01eca027a8c9946b4c5a19da57c82f1af0373dc83b7 gameinfo.xml @@ -126,18 +164,28 @@ The device-verified Godot mapping is: - left-stick click `b9`, left trigger `b10`, right trigger `b11`, right-stick click `b12` - D-pad `h0`; left and right sticks `a0..a3` -`scripts/portmaster/NETfishing.sh` must replace the incompatible SDL2 entry +`scripts/portmaster/straywild.sh` must replace the incompatible SDL2 entry with the Godot entry when that SDL2 GUID is selected. Do not append the two -entries with a newline: WestonPack evaluates launcher arguments through a -shell and treats the second line as a command. Pass the single selected mapping -as `SDL_GAMECONTROLLERCONFIG` in the game command after Weston initializes; -Weston sources PortMaster's control file internally and otherwise restores the -SDL2 value. +entries with a newline. WestonPack reconstructs the wrapped game command +through a shell, so raw mapping values passed in that command can be split into +unintended commands. Controller names may legally contain spaces, which caused +this failure with the `GO-Super Gamepad` mapping. The outer Weston environment +also does not reliably preserve the corrected muOS mapping for the game. -Do not pass a `.gptk` controller mapping to GPTOKEYB. Its exit-only process -must retain PortMaster's controller configuration, while the verified Godot -mapping remains scoped to the game command. This prevents duplicate or -translated gameplay events while preserving the system force-quit chord. +Write the exact selected mapping to `conf/cache/controller_mapping.txt` before +starting Weston. Weston must launch `launch-straywild.sh`, which reads that +file, exports `SDL_GAMECONTROLLERCONFIG`, and immediately replaces itself with +the game process. This applies the mapping at the same point as the working +0.10.1 launcher without passing its raw text through WestonPack's command +reconstruction. Do not move the mapping back to either side of +`westonwrap.sh`. + +Always pass `straywild.gptk`, which explicitly unassigns every direct and +hotkey binding with GPTOKEYB's `\"` value. This keeps GPTOKEYB from injecting +keyboard or mouse events on top of Godot's native controller input and retains +the device-specific kill chord. Supplying the explicit passthrough map also +avoids the anomalous controller behavior observed on ROCKNIX when no map is +provided. Do not add gameplay mappings to this file. Do not call `Input.add_joy_mapping(..., true)` for a recognized connected muOS controller. Updating this virtual controller after connection can stop Godot @@ -165,25 +213,42 @@ The light profile passes these Godot options: - `--max-fps 30` - `--audio-output-latency 40` -It also passes `NETFISHING_PERFORMANCE_PROFILE=light` and -`NETFISHING_LOW_END=1`. The game renders the 3D world at 50% linear resolution -with nearest-neighbor scaling, reducing 3D pixel work by 75% while the -separately rendered UI retains its canonical resolution. The light profile -also: +It also passes `straywild_PERFORMANCE_PROFILE=light` and +`straywild_LOW_END=1`. The game renders the 3D world at 37.5% linear +resolution with nearest-neighbor scaling, reducing 3D pixel work by about 86% +while the separately rendered UI retains its canonical resolution. The light +profile also: - disables the additional full-screen world-pixelation pass; - replaces animated depth-aware water shaders with opaque, per-vertex water; - disables ocean surface motion; - disables foliage wind; - keeps the title water and full-window menu patterns static; -- reduces rain to 128 particles simulated at 12 FPS; and +- replaces the animated cooler water and decorative bubbles with flat water; +- disables decorative title-screen fish and bubbles; +- retains title and dusk music while omitting rain and shoreline ambience; +- reduces rain to 48 particles simulated at 8 FPS; and - replaces procedural sky clouds and 81 moving local cloud patches with one flat cloud ceiling. -The normal profile retains the full visual presentation. +PortMaster exports are built in an isolated project copy with a dedicated +micro-texture profile. Every raster texture is capped at 128 pixels on its +longest side. High-volume gameplay catalogs, including fish, character parts, +environment art, equipment, gathering art, and item icons, are capped at 64 +pixels. All remaining raster textures use ETC2 VRAM compression. Short sound +effects, speech, and calls are imported as 22.05 kHz mono QOA samples. The +authoritative artwork and the desktop, Android, and macOS imports are not +modified. Source artwork, design documents, tests, platform-specific icons, +and ambience are omitted from the temporary export project. The original +compressed title and dusk music remain available in both runtime profiles. +This build-time profile is always present in the PortMaster package; selecting +the normal runtime profile restores visual effects, but does not restore +omitted ambience or replace the micro textures with desktop-resolution assets. + +The normal profile otherwise retains the full visual presentation. To opt a capable device into the normal profile, create the persistent file -`netfishing/conf/performance_profile` containing exactly: +`straywild/conf/performance_profile` containing exactly: ```text normal @@ -192,13 +257,13 @@ normal On a typical muOS installation, the full path is: ```text -/mnt/mmc/ports/netfishing/conf/performance_profile +/mnt/mmc/ports/straywild/conf/performance_profile ``` Set the file to `light`, or remove it, to restore the default. An externally -provided `NETFISHING_PERFORMANCE_PROFILE=normal` or `light` environment value +provided `straywild_PERFORMANCE_PROFILE=normal` or `light` environment value takes precedence over the persistent file. Invalid values safely fall back to -the light profile and are reported in `netfishing/log.txt`. +the light profile and are reported in `straywild/log.txt`. Do not use Godot's low processor mode for the light profile. It reduces idle CPU usage by sleeping between updates and is not a game-performance diff --git a/docs/README-PLAYTEST.txt b/docs/README-PLAYTEST.txt index 5e46dfd..f187182 100644 --- a/docs/README-PLAYTEST.txt +++ b/docs/README-PLAYTEST.txt @@ -1,10 +1,10 @@ -NETfishing -v0.10.0-alpha -Alpha 0.10.0 +straywild +v0.20.2-alpha +Alpha 0.20.2 -Thank you for trying this early private playtest. +Thank you for supporting this private testing release. -NETfishing is an early multiplayer fishing game. This alpha includes local +straywild is an early multiplayer fishing game. This alpha includes local progression, player-hosted and dedicated multiplayer sessions, public room discovery, and direct UDP connections. Expect rough edges and please keep a backup of any save or identity data you care about. @@ -12,31 +12,35 @@ backup of any save or identity data you care about. INSTALLATION 1. Extract the entire ZIP into a new folder. -2. Keep the executable and netfishing.pck together. -3. Launch netfishing.exe on Windows or netfishing on Linux. +2. Keep the executable and straywild.pck together. +3. Launch straywild.exe on Windows or straywild on Linux. Windows may show a warning for an unsigned application. This private build is not code signed. Only run a copy received from the playtest organizer. Linux users may need to allow execution: - chmod +x netfishing + chmod +x straywild CONTROLS Move W / A / S / D or left stick Jump Space Sprint Shift -Sneak Ctrl +Sneak Ctrl or click right stick Slow walk Alt Rotate camera Hold right mouse, or use right stick -Cycle active hotbar slot Mouse wheel +Cycle active hotbar slot Mouse wheel or D-pad left/right Select hotbar slot 1 through 9 Zoom camera Shift + mouse wheel -Cast / withdraw / reel Left mouse -Cooler, Bag, and Logbook Tab + (swap wheel controls in Settings > Controls) +Primary tool / fishing Left mouse or right trigger +Inventory and player pages Tab Game Menu / back Escape -Open Fishing Shop E while near the shop +Interact E +Chat T + +Keyboard and controller bindings can be reviewed and changed in Settings. FISHING @@ -48,12 +52,14 @@ FISHING - At barriers, use distinct left-click presses to damage the barrier. - Do not let the red chase meter catch the green meter. - Accessibility auto-click can be enabled in Settings. -- Approach the bright Fishing Shop booth and press E to open it. -- The Fishing Shop buys one Cooler fish at a time for full base value. -- Buy Coffee, Energy Drinks, Snacks, and Fish Finders as Bag supplies. -- Drag supplies from Bag to the hotbar and left-click in READY to use one. +- Approach the Fishing Shop and interact to open it. +- Move sellable inventory entries into the shop's sell tray, review the total, + and confirm the sale. +- Buy supplies, equipment, and persistent upgrades from their shop tabs. +- Move world-use items into the hotbar and select their slot to use or hold + them. - Coffee improves movement; other supplies temporarily improve fishing. -- The Cooler starts at 12 fish; buy permanent capacity expansions at the shop. +- Inventory and storage capacity can be expanded permanently at the shop. - Reel Speed upgrades increase authoritative green reeling progress. - Rod Power upgrades increase damage per valid barrier action. - Shop upgrades persist in the local progression save. @@ -64,35 +70,37 @@ FEATURES TO TRY - Hosting a private or public room and joining compatible online sessions - Direct-IP, saved-server, recent-server, and public-room connection flows - Text chat, player calls, player lists, relationships, and moderation tools +- Kat, Kim, and robot speech sample sets - Movement, jumping, camera rotation, and zoom -- Short, medium, and maximum-distance casts +- Short, medium, and maximum-distance casts, including far ocean casts - Valid water and invalid land casts - Manual withdrawal before a bite - Barrier-and-chase catching - Accessibility auto-click settings - Catch showcase and fish size variation -- Cooler, Bag, Logbook, favorites, and sorting -- Basic Fishing Rod equipment and the 1–9 hotbar -- Pelican selling and wallet updates -- Physical Fishing Shop sales and persistent fishing upgrades +- General inventory, separate tackle, hotbar storage, player storage, and the + Logbook +- Fishing, net gathering, and beach digging +- Equipment and consumable use from the hotbar +- Fishing Shop sell tray, wallet updates, and persistent upgrades +- Portable RV homes, multiplayer visits, RV storage, and the early decor + purchasing and placement prototype +- Seeded generated worlds and the authored starter-island layout +- Generated beaches, ponds, lakes, complete rivers, denser forests, varied + elevation, and closed coastal cliffs +- Collaborative Art Kit drawing, finalized artwork, PNG export, and stamps - Save, Continue, New Game, and Delete Save - Game Menu and persistent camera settings - Water-entry recovery from several shores SAVES AND SETTINGS -Progression and settings are stored in Godot's per-user application-data -directory, outside this extracted game folder. Delete Save removes progression -but preserves settings. - -Windows: - %APPDATA%\Godot\app_userdata\NETFISHING\ - -Linux: - ~/.local/share/godot/app_userdata/NETFISHING/ +Progression and settings are stored outside the extracted game folder. The +Data & Identity page shows the active player-data location. Delete Save removes +progression but preserves device settings. This is an early save format. Keep expectations modest and report any failure -to Continue, save, sell, favorite, or retain an individual fish. +to Continue, save, sell, move, favorite, or retain an inventory entry. FEEDBACK @@ -111,5 +119,6 @@ KNOWN ALPHA LIMITATIONS networks may prevent some players from joining. - Multiplayer, dedicated-server deployment, UI, and balance are still alpha. - Some fish and character artwork remains temporary. +- RV exteriors and decor use temporary prototype geometry and presentation. - There is no installer or automatic updater. - Windows builds are unsigned. diff --git a/docs/README.md b/docs/README.md index 49645b3..444ebc7 100644 --- a/docs/README.md +++ b/docs/README.md @@ -1,4 +1,4 @@ -# NETfishing documentation +# straywild documentation This directory is the single home for maintained project documentation. Start here instead of searching feature, asset, world, or script directories @@ -17,10 +17,10 @@ for local README files. ## Related repositories -- [Discovery service API](https://forge.makearmy.io/woofmeow/netfishing-discovery-server/src/branch/main/docs/API.md) +- [Discovery service API](https://forge.makearmy.io/woofmeow/straywild-discovery-server/src/branch/main/docs/API.md) stays with the service implementation and defines its versioned HTTP contract. -- [Dedicated-server packaging](https://forge.makearmy.io/woofmeow/netfishing-dedicated-server/src/branch/main/README.md) +- [Dedicated-server packaging](https://forge.makearmy.io/woofmeow/straywild-dedicated-server/src/branch/main/README.md) stays with its installer and update scripts. It consumes this repository's attribution and legal notices from the exact pinned game commit instead of maintaining copies. @@ -34,6 +34,12 @@ and resources. These documents describe boundaries, policy, and maintenance procedures; they should not duplicate changing constants or inventories that can be derived reliably from the project. +The same rule applies to credits. `ATTRIBUTION.md` records creators, licenses, +and durable contribution families. It does not attempt to mirror every current +asset filename or private intake-directory layout. Planned or unincorporated +work is not described as shipped, and repository paths are included only when +they help recipients locate a distributed third-party work or license. + ## Files intentionally kept at the repository root The following are entry points or governing legal documents rather than @@ -46,6 +52,10 @@ general project documentation, so they remain at conventional root paths: - `TRADEMARKS.md` - `CONTRIBUTOR-TERMS.md` +`CONTRIBUTING.md` records that unsolicited contributions are not accepted. +`CONTRIBUTOR-TERMS.md` remains a governing legal record for previously +accepted and expressly invited work, not an invitation for new submissions. + Third-party font license texts stay beside their font files under `ui/fonts/` so the licensed files and their original notices cannot drift apart. Build scripts collect those legal files and the authoritative attribution record @@ -58,3 +68,8 @@ update the appropriate reference above and link to its heading when source comments need more context. Player-facing package instructions belong only in `README-PLAYTEST.txt`; source and scripts remain authoritative for command-line usage. + +Before adding a literal project path to prose, verify that it exists in the +same revision and that readers actually need the path. Prefer a stable owner, +interface, or resource type over a directory listing. A path or Git author is +never evidence of creative authorship. diff --git a/docs/design/fish_catalog_proposal.csv b/docs/design/fish_catalog_proposal.csv index b583915..c427dc0 100644 --- a/docs/design/fish_catalog_proposal.csv +++ b/docs/design/fish_catalog_proposal.csv @@ -1,314 +1,314 @@ -catalog_number,display_name,collection_group,water_type,spawn_area,day_rule,rain_rule,fog_rule,rarity,base_catch_weight,weight_min_lb,weight_max_lb,sell_value_min,sell_value_max,sell_value_curve,required_bait_tags,required_event_tags,forbidden_event_tags,logbook_fact,active_status -101,bowfin,Ancient freshwater fish,Fresh Water,pond,Night,Any,Required,Rare,0.28,1,20,13,30,0.85,,,,bowfin can gulp air at the surface when warm backwaters run low on oxygen. a long dorsal fin ripples as they stalk prey.,inactive -102,lake sturgeon,Ancient freshwater fish,Fresh Water,lake,Night,Any,Any,Epic,0.09,10,180,36,82,0.8,,,,lake sturgeon sweep the bottom with four sensitive barbels before extending a tube-like mouth to feed. they can live for decades.,inactive -103,longnose gar,Ancient freshwater fish,Fresh Water,river,Day,Any,Any,Rare,0.24,2,35,14,34,0.85,,,,longnose gar wait near the surface before snapping sideways at passing fish. their narrow jaws carry rows of fine needle-like teeth.,inactive -104,paddlefish,Ancient freshwater fish,Fresh Water,river,Day,Required,Any,Epic,0.1,10,120,34,76,0.82,,,,"paddlefish cruise open rivers with their mouths wide, filtering tiny plankton from the water. the broad snout senses faint electrical signals.",inactive -105,shovelnose sturgeon,Ancient freshwater fish,Fresh Water,river,Night,Any,Any,Rare,0.22,1,8,12,25,0.9,,,,shovelnose sturgeon hug flowing river bottoms and probe for insect larvae. a flattened snout helps them hold position in strong current.,inactive -106,spotted gar,Ancient freshwater fish,Fresh Water,pond,Day,Any,Required,Rare,0.2,1,15,13,29,0.88,,,,spotted gar linger among vegetation where their mottled bodies break up their outline. they rise to gulp air as well as breathing through gills.,inactive -107,West African lungfish,Ancient freshwater fish,Fresh Water,pond,Night,Required,Any,Rare,0.3,1,10,12,28,0.86,,,,"west african lungfish breathe air with paired lungs. when floodplains dry, they seal themselves in a mud cocoon until water returns.",inactive -201,atlantic mudskipper,Brackish oddities,Salt Water,ocean,Day,Required,Any,Uncommon,1,0.03,0.5,5,11,0.95,,,,atlantic mudskippers use sturdy fins to hop and crawl across exposed mud. moist skin and mouth linings let them breathe out of water.,inactive -202,largescale foureyes,Brackish oddities,Fresh Water | Salt Water,river,Day,Any,Any,Rare,0.32,0.05,1,10,23,0.95,,,,largescale foureyes cruise with each eye divided across the waterline. one half watches above while the other scans below.,inactive -301,red mullet,Coastal bottom fish,Salt Water,ocean,Day,Any,Any,Uncommon,0.9,0.1,3,5,11,0.92,,,,red mullet comb sandy bottoms with two chin barbels that taste hidden prey. their foraging leaves winding trails in the sediment.,inactive -401,European plaice,Coastal flatfish,Salt Water,ocean,Day,Any,Any,Common,1.8,0.2,10,4,10,0.9,,,,european plaice lie flat on the seafloor with both eyes on the same side. orange spots help distinguish them from neighboring flatfish.,inactive -402,summer flounder,Coastal flatfish,Salt Water,ocean,Day,Any,Any,Uncommon,0.9,0.3,15,6,16,0.88,,,,summer flounder bury themselves in sand with only their eyes exposed. a sudden burst carries them upward to seize passing prey.,inactive -403,winter flounder,Coastal flatfish,Salt Water,ocean,Day,Forbidden,Any,Common,1.8,0.2,8,4,9,0.9,,,,winter flounder favor cool bays and estuaries where they rest on muddy bottoms. their eyes sit on the right side of the body.,inactive -501,dugong,Coastal marine mammals,Salt Water,ocean,Day,Any,Forbidden,Legendary,0.011,500,1100,72,165,0.77,,,,"dugongs graze seagrass meadows with a downturned, bristled snout. they are the only fully marine members of the sirenian family.",inactive -502,harbor seal,Coastal marine mammals,Salt Water,ocean,Day,Any,Required,Legendary,0.018,120,370,60,140,0.79,,,,harbor seals rest on rocky shores and sandbars between hunting trips. sensitive whiskers can trace the water trails left by moving fish.,inactive -503,sea otter,Coastal marine mammals,Salt Water,ocean,Day,Any,Any,Legendary,0.02,30,100,55,125,0.84,,,,sea otters float on their backs while opening shellfish with stones. dense fur traps insulating air because they lack a thick blubber layer.,inactive -504,walrus,Coastal marine mammals,Salt Water,ocean,Day,Any,Required,Legendary,0.012,800,3700,74,170,0.76,,,,walruses sweep the seafloor for clams and other soft-bodied prey. long tusks help them haul onto ice and settle disputes.,inactive -505,West Indian manatee,Coastal marine mammals,Salt Water,ocean,Day,Any,Forbidden,Legendary,0.012,440,1300,70,160,0.77,,,,west indian manatees graze aquatic plants in warm coastal water and rivers. they surface regularly to breathe through nostrils atop the snout.,inactive -601,bay pipefish,Coastal oddities,Salt Water,ocean,Day,Any,Any,Uncommon,0.9,0.005,0.04,4,9,1,,,,"bay pipefish hide upright among seagrass, matching the blades with their slender bodies. males carry developing eggs in a brood pouch.",inactive -602,lined seahorse,Coastal oddities,Salt Water,ocean,Day,Forbidden,Any,Rare,0.28,0.005,0.05,9,20,1,,,,lined seahorses anchor to grass and coral with curling tails. the male broods eggs in a pouch and releases fully formed young.,inactive -603,monkfish,Coastal oddities,Salt Water,ocean,Night,Any,Required,Rare,0.25,2,55,14,35,0.84,,,,monkfish hide against the bottom and wave a fleshy lure above a cavernous mouth. a sudden gulp draws fish and crustaceans inward.,inactive -604,tripletail,Coastal oddities,Salt Water,ocean,Day,Any,Required,Rare,0.28,1,30,13,31,0.85,,,,"tripletail often drift sideways near floating debris, resembling a loose leaf. rounded rear fins create the three-tailed silhouette.",inactive -701,atlantic mackerel,Coastal pelagic fish,Salt Water,ocean,Any,Any,Any,Common,0.5,0.5,5,4,9,0.9,,,,atlantic mackerel travel in fast schools across the north atlantic and feed on plankton and small schooling fish.,active -702,bluefish,Coastal pelagic fish,Salt Water,ocean,Day,Any,Any,Uncommon,0.85,0.5,25,7,19,0.85,,,,bluefish race in coordinated schools while pursuing smaller fish. sharp teeth and powerful jaws make their feeding bursts especially fierce.,inactive -703,cero mackerel,Coastal pelagic fish,Salt Water,ocean,Any,Any,Any,Uncommon,0.35,1,15,7,15,0.9,,,,cero mackerel are streamlined coastal hunters. sharp teeth help them slash through schools of smaller fish.,active -704,chub mackerel,Coastal pelagic fish,Salt Water,ocean,Any,Any,Any,Common,0.5,0.5,4,4,9,0.9,,,,chub mackerel school near the surface and follow plankton blooms. their dark wavy bars help identify them at a glance.,active -705,crevalle jack,Coastal pelagic fish,Salt Water,ocean,Day,Required,Any,Uncommon,0.8,1,35,7,20,0.84,,,,"crevalle jacks patrol warm coasts in fast-moving schools. their deep bodies and forked tails deliver long, powerful runs.",inactive -706,king mackerel,Coastal pelagic fish,Salt Water,ocean,Any,Any,Any,Uncommon,0.3,3,40,10,24,0.9,,,,king mackerel are swift coastal predators. their pointed teeth and long body are built for sudden bursts of speed.,active -707,spanish mackerel,Coastal pelagic fish,Salt Water,ocean,Any,Any,Any,Uncommon,0.35,1,15,8,18,0.9,,,,spanish mackerel hunt in warm coastal waters and often travel in loose schools while chasing baitfish.,active -708,talang queenfish,Coastal pelagic fish,Salt Water,ocean,Day,Any,Any,Uncommon,0.8,0.5,20,7,18,0.86,,,,talang queenfish chase schooling prey near warm coasts and estuaries. hooked teeth and a deeply forked tail suit their rapid attacks.,inactive -801,American sand lance,Coastal schooling fish,Salt Water,ocean,Day,Any,Any,Common,3,0.02,0.4,1,3,1,,,,american sand lance dive headfirst into loose sand when danger approaches. immense schools carry energy from plankton to larger predators.,inactive -802,atlantic menhaden,Coastal schooling fish,Salt Water,ocean,Day,Any,Any,Common,3,0.1,1.5,2,5,0.98,,,,"atlantic menhaden strain plankton from coastal water with fine gill rakers. dense schools feed whales, seabirds, and predatory fish.",inactive -803,black pomfret,Coastal schooling fish,Salt Water,ocean,Any,Any,Any,Uncommon,0.3,1,15,8,18,0.9,,,,"black pomfret have a deep, laterally compressed body that lets them maneuver neatly through open water.",active -804,chinese pomfret,Coastal schooling fish,Salt Water,ocean,Any,Any,Any,Uncommon,0.3,1,20,9,20,0.9,,,,"chinese pomfret are silvery schooling fish with a tall, flattened body and long sickle-shaped fins.",active -805,european anchovy,Coastal schooling fish,Salt Water,ocean,Any,Any,Any,Common,0.5,0.05,0.25,2,4,0.9,,,,european anchovies form dense schools and feed by filtering tiny plankton from coastal water.,active -806,European pilchard,Coastal schooling fish,Salt Water,ocean,Any,Any,Any,Common,3.5,0.05,0.6,2,4,1,,,,european pilchards form shimmering schools along atlantic and mediterranean coasts. they feed mainly on plankton near the surface.,inactive -807,golden pomfret,Coastal schooling fish,Salt Water,ocean,Any,Any,Any,Rare,0.18,2,25,14,30,0.9,,,,golden pomfret are warm-water swimmers whose golden sheen is most noticeable along the fins and flanks.,active -808,northern anchovy,Coastal schooling fish,Salt Water,ocean,Any,Any,Any,Common,0.5,0.05,0.35,2,4,0.9,,,,northern anchovies gather in huge schools along the pacific coast and filter plankton with their fine gill rakers.,active -809,Pacific sardine,Coastal schooling fish,Salt Water,ocean,Any,Any,Any,Common,3.5,0.05,0.5,2,4,1,,,,"pacific sardines follow cool, productive water in enormous schools. their movements shift as currents and plankton supplies change.",inactive -810,white pomfret,Coastal schooling fish,Salt Water,ocean,Any,Any,Any,Common,0.45,0.5,10,5,12,0.9,,,,"white pomfret gather over coastal grounds and use their compact, deep bodies to turn quickly while feeding.",active -901,blacktip shark,Coastal sharks,Salt Water,ocean,Day,Required,Any,Epic,0.1,15,150,32,75,0.8,,,,blacktip sharks are named for the dark markings on their fins. they hunt schooling fish in warm shallows and sometimes leap clear of the water.,inactive -902,great hammerhead shark,Coastal sharks,Salt Water,ocean,Day,Any,Forbidden,Legendary,0.035,50,1000,62,145,0.78,,,,great hammerheads sweep their wide heads over the bottom while searching for rays. widely spaced senses help pinpoint hidden prey.,inactive -903,great white shark,Coastal sharks,Salt Water,ocean,Day,Any,Any,Legendary,0.025,100,1000,70,150,0.76,,,,great white sharks conserve heat in their swimming muscles while crossing cool seas. rows of serrated teeth are replaced throughout life.,inactive -904,tiger shark,Coastal sharks,Salt Water,ocean,Night,Required,Any,Epic,0.06,50,1000,50,120,0.8,,,,tiger sharks carry dark vertical bars that fade as they mature. broad jaws let them investigate an unusually varied range of prey.,inactive -905,whale shark,Coastal sharks,Salt Water,ocean,Day,Any,Forbidden,Legendary,0.025,500,45000,70,160,0.76,,,,whale sharks are enormous filter feeders covered in unique spot patterns. they cruise with open mouths to collect plankton and tiny fish.,inactive -1001,burbot,Cold freshwater fish,Fresh Water,lake,Night,Any,Required,Rare,0.24,0.5,18,12,28,0.86,,,,burbot are the only freshwater members of the cod family. they become most active in cold darkness and may spawn beneath winter ice.,inactive -1002,cisco,Cold freshwater fish,Fresh Water,lake,Day,Any,Any,Common,2.2,0.1,3,3,7,0.95,,,,cisco school in the cool open water of northern lakes. these slim relatives of salmon feed on plankton and become prey for larger fish.,inactive -1003,lake whitefish,Cold freshwater fish,Fresh Water,lake,Any,Any,Any,Common,1.5,0.5,12,4,11,0.9,,,,"lake whitefish browse deep, cold bottoms with small downward-pointing mouths. large schools move toward shallows to spawn in autumn.",inactive -1101,arctic char,Cold freshwater salmonids,Fresh Water | Salt Water,lake,Any,Forbidden,Any,Rare,0.3,1,25,14,32,0.86,,,,arctic char thrive farther north than any other freshwater fish. some remain in lakes while others migrate between rivers and the sea.,inactive -1102,arctic grayling,Cold freshwater salmonids,Fresh Water,river,Day,Any,Forbidden,Uncommon,0.75,0.3,6,6,14,0.9,,,,"arctic grayling carry a tall, colorful dorsal fin like a sail. they feed on drifting insects in cold, clear rivers and lakes.",inactive -1103,brown trout,Cold freshwater salmonids,Fresh Water,river,Night,Any,Any,Uncommon,0.8,0.5,25,7,20,0.86,,,,"brown trout often shelter by day and hunt more freely after dark. adaptable populations occupy streams, lakes, and even coastal water.",inactive -1104,cutthroat trout,Cold freshwater salmonids,Fresh Water,river,Any,Any,Any,Uncommon,0.4,0.25,10,5,12,0.9,,,,"cutthroat trout take their name from the red slash beneath the jaw. many populations rely on cold, well-oxygenated streams.",active -1105,golden trout,Cold freshwater salmonids,Fresh Water,lake,Any,Any,Any,Rare,0.2,0.2,3,8,16,0.9,,,,"golden trout evolved in clear, high-elevation california streams. their bright flanks stand out against rocky alpine water.",active -1106,rainbow trout,Cold freshwater salmonids,Fresh Water,river,Any,Any,Any,Uncommon,0.45,0.5,20,5,11,0.9,,,,rainbow trout are adaptable stream hunters. the pink lateral stripe is especially vivid when the fish is in breeding condition.,active -1201,atlantic wolffish,Cold reef fish,Salt Water,ocean,Any,Forbidden,Any,Rare,0.25,2,40,14,34,0.84,,,,atlantic wolffish use heavy jaws and blunt teeth to crush shellfish and urchins. natural antifreeze proteins help them endure icy water.,inactive -1202,cusk,Cold reef fish,Salt Water,ocean,Night,Any,Any,Uncommon,0.75,0.5,30,7,19,0.85,,,,"cusk move slowly across cold rocky bottoms, sheltering in cracks and caves. a single long fin runs around much of the rear body.",inactive -1203,spotted wolffish,Cold reef fish,Salt Water,ocean,Any,Any,Required,Epic,0.11,3,50,26,60,0.84,,,,spotted wolffish crush hard-shelled prey with broad molar-like teeth. their pale spots stand out against a dark cold-water body.,inactive -1301,atlantic herring,Cold schooling fish,Salt Water,ocean,Any,Any,Any,Common,3,0.1,1.5,2,5,0.98,,,,atlantic herring gather in immense schools that move between feeding and spawning grounds. they filter plankton with fine gill rakers.,inactive -1302,capelin,Cold schooling fish,Salt Water,ocean,Any,Any,Required,Uncommon,1,0.03,0.2,4,8,1,,,,"capelin are small polar fish that feed whales, seabirds, and larger fish. many schools roll onto beaches or shallows to release their eggs.",inactive -1303,European sprat,Cold schooling fish,Salt Water,ocean,Any,Any,Any,Common,3.2,0.03,0.3,1,3,1,,,,european sprat form compact schools in northern coastal seas. these tiny herring relatives feed on plankton near the surface.,inactive -1304,pacific herring,Cold schooling fish,Salt Water,ocean,Any,Required,Any,Common,2.8,0.1,1.5,2,5,0.98,,,,pacific herring return to coastal shallows to coat plants and rocks with eggs. their oily schools support entire marine food webs.,inactive -1401,Alaska pollock,Cold shelf fish,Salt Water,ocean,Any,Any,Any,Common,2.5,0.3,8,3,8,0.92,,,,alaska pollock form vast schools over cold northern shelves. they feed on plankton and fish while supporting many larger predators.,inactive -1402,atlantic cod,Cold shelf fish,Salt Water,ocean,Any,Any,Any,Common,1.8,1,55,5,18,0.85,,,,"atlantic cod carry a pale lateral line and one chin barbel. they search cold seafloors for crustaceans, mollusks, and smaller fish.",inactive -1403,Atlantic pollock,Cold shelf fish,Salt Water,ocean,Day,Any,Forbidden,Uncommon,0.9,1,35,7,18,0.86,,,,atlantic pollock are swift relatives of cod with dark backs and pale lateral lines. adults gather around rocky banks and wrecks.,inactive -1404,Dover sole,Cold shelf fish,Salt Water,ocean,Night,Any,Any,Uncommon,0.8,0.2,8,6,14,0.9,,,,dover sole glide over deep muddy bottoms of the eastern pacific. both eyes migrate to the right side as the young fish becomes flat.,inactive -1405,haddock,Cold shelf fish,Salt Water,ocean,Day,Any,Any,Common,2,0.5,20,4,11,0.9,,,,haddock are recognized by a dark shoulder mark and black lateral line. schools forage over cold seafloors for small bottom animals.,inactive -1406,pacific cod,Cold shelf fish,Salt Water,ocean,Any,Any,Any,Common,1.8,1,45,5,17,0.85,,,,pacific cod use a chin barbel to investigate cold shelf bottoms. seasonal schools follow prey between deeper water and coastal spawning grounds.,inactive -1407,pacific hake,Cold shelf fish,Salt Water,ocean,Night,Any,Any,Common,1.7,0.3,8,3,9,0.92,,,,pacific hake rise from deep water at night to feed on krill and fish. large schools migrate along the west coast with changing seasons.,inactive -1408,silver hake,Cold shelf fish,Salt Water,ocean,Night,Any,Any,Common,1.7,0.2,5,3,8,0.92,,,,silver hake hunt fish and crustaceans over sandy atlantic shelves. they move upward after dark and return toward the bottom by day.,inactive -1501,chambered nautilus,Cuttlefish and nautiluses,Salt Water,ocean,Night,Any,Required,Legendary,0.05,0.5,3,34,76,0.92,,,,chambered nautiluses regulate buoyancy with gas-filled shell chambers. dozens of small tentacles feel for food in dark reef slopes.,inactive -1502,common cuttlefish,Cuttlefish and nautiluses,Salt Water,ocean,Day,Any,Any,Uncommon,0.55,0.2,12,7,17,0.9,,,,common cuttlefish flash changing colors and patterns through specialized skin cells. an internal cuttlebone controls buoyancy.,inactive -1503,flamboyant cuttlefish,Cuttlefish and nautiluses,Salt Water,ocean,Day,Required,Any,Epic,0.1,0.05,0.4,26,58,0.96,,,,flamboyant cuttlefish walk along the seafloor on their arms and fins. vivid displays warn predators of potent toxins.,inactive -1601,blueline tilefish,Deep shelf fish,Salt Water,ocean,Day,Any,Any,Uncommon,0.7,1,20,7,18,0.86,,,,blueline tilefish shelter in burrows and rocky openings along deep shelves. a narrow blue stripe traces the edge of the dorsal fin.,inactive -1602,golden tilefish,Deep shelf fish,Salt Water,ocean,Day,Any,Any,Rare,0.22,2,50,15,37,0.84,,,,golden tilefish excavate burrows in soft clay along deep ocean slopes. their bright yellow spots contrast with blue-green backs.,inactive -1603,Pacific ocean perch,Deep shelf fish,Salt Water,ocean,Any,Any,Any,Uncommon,0.8,0.3,12,7,17,0.88,,,,pacific ocean perch hover around deep rocky reefs in the north pacific. these slow-growing fish give birth to live young.,inactive -1604,Patagonian toothfish,Deep shelf fish,Salt Water,ocean,Night,Any,Any,Epic,0.09,10,220,32,78,0.8,,,,"patagonian toothfish patrol cold, deep southern water with large canine teeth. natural antifreeze proteins protect their blood from freezing.",inactive -1605,sablefish,Deep shelf fish,Salt Water,ocean,Night,Any,Any,Rare,0.22,2,40,15,36,0.84,,,,"sablefish roam deep north pacific slopes and can live for many decades. soft dark bodies conceal rich, oil-filled flesh.",inactive -1606,wreckfish,Deep shelf fish,Salt Water,ocean,Any,Any,Required,Epic,0.1,10,180,31,76,0.8,,,,"wreckfish gather around caves, ledges, and shipwrecks in deep water. powerful jaws let them ambush fish and large crustaceans.",inactive -1701,giant oarfish,Deep-sea legends,Salt Water,ocean,Night,Any,Required,Legendary,0.035,20,600,60,140,0.78,,,,"giant oarfish drift vertically through deep open water, rowing with a crimson dorsal fin. their ribbon-like bodies can reach remarkable lengths.",inactive -1702,West Indian Ocean coelacanth,Deep-sea legends,Salt Water,ocean,Night,Any,Required,Legendary,0.03,20,200,65,145,0.8,,,,"west indian ocean coelacanths shelter in deep volcanic caves by day. fleshy lobed fins move in an alternating, limb-like rhythm.",inactive -1801,black seadevil,Deep-sea oddities,Salt Water,ocean,Night,Any,Any,Legendary,0.05,0.1,2,48,105,0.92,,,,black seadevils lure prey with a glowing organ suspended above the mouth. tiny males permanently attach to much larger females.,inactive -1802,common fangtooth,Deep-sea oddities,Salt Water,ocean,Night,Any,Any,Epic,0.1,0.05,0.5,25,56,0.96,,,,common fangtooths carry outsized teeth that fit into pockets in the roof of the mouth. they migrate upward from deep water after dark.,inactive -1803,gulper eel,Deep-sea oddities,Salt Water,ocean,Night,Any,Required,Legendary,0.04,0.5,18,44,92,0.86,,,,gulper eels unfold enormous mouths to engulf prey in the deep sea. a whip-like tail ends in a small light-producing organ.,inactive -1804,Pacific barreleye,Deep-sea oddities,Salt Water,ocean,Night,Any,Required,Legendary,0.045,0.2,2.5,42,88,0.9,,,,pacific barreleyes peer upward through transparent shields covering the head. tubular eyes rotate forward when the fish turns to feed.,inactive -1805,smooth-head blobfish,Deep-sea oddities,Salt Water,ocean,Night,Any,Required,Legendary,0.04,0.5,5,42,90,0.86,,,,smooth-head blobfish rest on deep slopes where pressure supports their soft bodies. they conserve energy by waiting for edible matter nearby.,inactive -1806,spotted lanternfish,Deep-sea oddities,Salt Water,ocean,Night,Any,Any,Rare,0.24,0.05,0.5,14,30,0.95,,,,spotted lanternfish carry rows of light-producing organs along their bodies. immense schools rise toward the surface each night.,inactive -1901,crown-of-thorns sea star,Echinoderms,Salt Water,ocean,Night,Required,Any,Epic,0.1,0.5,7,23,52,0.91,,,,crown-of-thorns sea stars crawl over reefs and digest coral tissue outside the body. venomous spines discourage many predators.,inactive -1902,giant California sea cucumber,Echinoderms,Salt Water,ocean,Night,Any,Required,Rare,0.24,0.5,5,13,29,0.93,,,,giant california sea cucumbers sweep organic particles from the seafloor with branching tentacles. soft tube feet anchor their long bodies.,inactive -1903,purple sea urchin,Echinoderms,Salt Water,ocean,Day,Any,Any,Uncommon,0.75,0.05,1,5,12,0.96,,,,purple sea urchins scrape algae from rocks with a five-toothed feeding structure. dense groups can clear kelp from entire reefs.,inactive -1904,sand dollar,Echinoderms,Salt Water,ocean,Day,Any,Forbidden,Uncommon,0.8,0.01,0.2,4,10,0.98,,,,sand dollars burrow just beneath sandy seafloors and filter tiny food particles. the familiar star pattern marks their five-part body plan.,inactive -1905,sunflower sea star,Echinoderms,Salt Water,ocean,Day,Any,Required,Rare,0.25,0.5,13,14,32,0.89,,,,"sunflower sea stars move quickly on thousands of tube feet and may carry many arms. they hunt urchins, clams, and other bottom animals.",inactive -2001,axolotl,Freshwater amphibians,Fresh Water,lake,Night,Any,Required,Legendary,0.04,0.1,0.7,36,78,0.96,,,,axolotls remain aquatic and keep feathery external gills throughout adulthood. lost limbs and parts of several organs can regenerate.,inactive -2002,hellbender,Freshwater amphibians,Fresh Water,river,Night,Required,Any,Epic,0.1,0.5,5.5,24,54,0.91,,,,"hellbenders hide beneath large rocks in cool, clean rivers. folds of loose skin absorb oxygen while the flattened body grips the current.",inactive -2101,guppy,Freshwater aquarium fish,Fresh Water,pond,Day,Any,Any,Common,1.5,0.01,0.15,2,5,0.98,,,,"guppies are livebearers whose young arrive ready to swim. males display bright colors while females often favor larger, less flashy bodies.",inactive -2102,neon tetra,Freshwater aquarium fish,Fresh Water,pond,Night,Any,Any,Uncommon,0.9,0.01,0.08,4,8,0.98,,,,"neon tetras school through shaded forest streams. an iridescent blue stripe remains visible in the dim, tannin-stained water.",inactive -2103,zebrafish,Freshwater aquarium fish,Fresh Water,pond,Day,Any,Any,Common,1.35,0.01,0.12,2,5,0.98,,,,"zebrafish carry horizontal blue stripes from gill to tail. hardy schools thrive in shallow streams, flooded fields, and quiet pools.",inactive -2201,largemouth bass,Freshwater bass,Fresh Water,pond,Any,Any,Any,Common,2.5,0.5,18,4,12,0.9,,,,largemouth bass wait among weeds and timber before lunging at prey. the upper jaw extends beyond the eye when the mouth is closed.,inactive -2202,smallmouth bass,Freshwater bass,Fresh Water,river,Day,Any,Any,Uncommon,1.2,0.5,12,6,15,0.9,,,,smallmouth bass favor clear water with rock and moving current. bronze flanks and dark vertical bars distinguish them from largemouth bass.,inactive -2301,bigmouth buffalo,Freshwater bottom fish,Fresh Water,river,Any,Any,Required,Epic,0.12,8,80,28,63,0.82,,,,bigmouth buffalo filter plankton with fine gill rakers instead of rooting for prey. some individuals survive for more than a century.,inactive -2302,golden redhorse,Freshwater bottom fish,Fresh Water,river,Day,Any,Any,Uncommon,0.9,0.5,8,6,14,0.9,,,,"golden redhorses probe flowing river bottoms with fleshy, downward-facing mouths. coppery scales and reddish fins give them a warm glow.",inactive -2303,quillback,Freshwater bottom fish,Fresh Water,river,Day,Any,Any,Uncommon,0.8,0.5,15,6,16,0.88,,,,quillbacks carry a long first dorsal ray that rises like a quill. small mouths gather insect larvae and other food from river and lake bottoms.,inactive -2304,smallmouth buffalo,Freshwater bottom fish,Fresh Water,river,Any,Any,Any,Rare,0.3,3,45,14,34,0.84,,,,"smallmouth buffalo use thick lips to graze bottom-dwelling food in warm rivers. their deep, heavy bodies form a pronounced arch behind the head.",inactive -2305,white sucker,Freshwater bottom fish,Fresh Water,river,Any,Any,Any,Common,2,0.3,8,3,8,0.9,,,,white suckers vacuum insects and organic matter from cool freshwater bottoms. spring runs carry large groups into shallow streams.,inactive -2401,black bullhead,Freshwater catfish,Fresh Water,pond,Night,Any,Any,Uncommon,1,0.3,6,5,11,0.92,,,,"black bullheads tolerate warm, cloudy water with little oxygen. stout spines protect the dorsal and pectoral fins from predators.",inactive -2402,blue catfish,Freshwater catfish,Fresh Water,river,Night,Any,Any,Uncommon,1.25,3,12,6,9,0.9,,,,a deep fork in the tail inspired the blue catfish's scientific name. it rests deep by daylight and becomes more active after dark.,active -2403,brown bullhead,Freshwater catfish,Fresh Water,pond,Night,Any,Any,Common,2.3,0.2,4,3,7,0.95,,,,brown bullheads search muddy bottoms with eight sensitive barbels. males guard nests and herd newly hatched young in a dark moving ball.,inactive -2404,channel catfish,Freshwater catfish,Fresh Water,pond,Night,Any,Any,Common,2,1.5,7,4,7,1,,,,"a channel catfish can taste through skin all over its body, especially near its gills and whiskers. the male watches the eggs.",active -2405,flathead catfish,Freshwater catfish,Fresh Water,river,Night,Any,Any,Uncommon,1,3,14,7,10,0.9,,,,"flatheads favor hideouts made by logs, rocks, ledges, and other underwater structure. as they grow, fish dominate their menu.",active -2406,tadpole madtom,Freshwater catfish,Fresh Water,river,Night,Any,Any,Rare,0.35,0.02,0.15,8,16,0.95,,,,tadpole madtoms are tiny nocturnal catfish that shelter beneath vegetation and debris. venomous fin spines discourage larger predators.,inactive -2407,white catfish,Freshwater catfish,Fresh Water,pond,Night,Any,Any,Common,2,1,5,4,6,1,,,,white catfish began along the atlantic coast between new york and florida. people later carried them far beyond that home range.,active -2408,yellow bullhead,Freshwater catfish,Fresh Water,pond,Night,Required,Any,Common,2,0.2,3.5,3,7,0.95,,,,yellow bullheads use pale chin barbels to distinguish food in murky shallows. both parents may guard the nest and schooling young.,inactive -2501,common barbel,Freshwater coarse fish,Fresh Water,river,Night,Required,Any,Rare,0.28,1,25,13,31,0.85,,,,common barbels hold close to fast river bottoms with streamlined bodies and broad fins. four mouth barbels locate food among stones.,inactive -2502,common bream,Freshwater coarse fish,Fresh Water,lake,Any,Any,Any,Common,1.8,0.3,15,4,12,0.88,,,,"common bream gather in slow rivers and lakes with silvery, deep-sided bodies. protruding mouths sift insect larvae from soft bottoms.",inactive -2503,common carp,Freshwater coarse fish,Fresh Water,pond,Any,Any,Any,Rare,1.5,3,18,10,10,0.85,,,,whisker-like barbels help a common carp investigate the bottom. nosing through sediment can cloud the water and loosen plants.,active -2504,common roach,Freshwater coarse fish,Fresh Water,pond,Any,Any,Any,Common,2.8,0.1,4,2,6,0.95,,,,"common roach thrive in many lakes and rivers, often schooling near vegetation. red fins and a red-orange eye brighten their silver bodies.",inactive -2505,european chub,Freshwater coarse fish,Fresh Water,river,Any,Any,Any,Common,0.55,0.2,6,2,4,0.9,,,,"european chub are adaptable river fish. adults often patrol shallows and feed on insects, small fish, and fruit.",active -2506,fallfish,Freshwater coarse fish,Fresh Water,river,Day,Required,Any,Uncommon,0.9,0.2,3.5,5,10,0.92,,,,fallfish are large minnows that build broad stone nests in flowing water. other stream fish often reuse the gravel mounds for spawning.,inactive -2507,ide,Freshwater coarse fish,Fresh Water,river,Day,Any,Any,Uncommon,0.8,0.3,9,6,14,0.9,,,,"ide move between rivers, lakes, and brackish coastal water in loose schools. adults eat insects, crustaceans, plants, and small fish.",inactive -2508,rudd,Freshwater coarse fish,Fresh Water,pond,Day,Any,Any,Common,2.4,0.1,4.5,3,7,0.95,,,,"rudd feed near the surface with an upturned mouth and red fins. golden-green bodies disappear easily among warm, weedy shallows.",inactive -2509,tench,Freshwater coarse fish,Fresh Water,pond,Night,Any,Required,Uncommon,0.75,0.5,12,7,17,0.88,,,,"tench browse quiet, muddy bottoms with two small mouth barbels. a thick coat of slime protects their olive-green scales.",inactive -2601,red swamp crayfish,Freshwater crustaceans,Fresh Water,pond,Night,Required,Any,Common,1.1,0.03,0.25,3,7,0.98,,,,"red swamp crayfish burrow into wet ground when water recedes. adaptable populations feed on plants, carrion, and small aquatic animals.",inactive -2701,alligator gar,Freshwater giants,Fresh Water,river,Night,Any,Any,Legendary,0.055,20,300,55,125,0.8,,,,alligator gar combine a broad tooth-filled snout with heavy armor-like scales. a vascular swim bladder lets them breathe air at the surface.,inactive -2702,arapaima,Freshwater giants,Fresh Water,river,Day,Any,Any,Legendary,0.04,40,400,60,140,0.78,,,,arapaima must surface frequently to gulp air through a specialized swim bladder. large armored scales protect their long river-going bodies.,inactive -2703,goliath tigerfish,Freshwater giants,Fresh Water,river,Day,Any,Any,Legendary,0.035,20,150,58,132,0.8,,,,goliath tigerfish patrol powerful african rivers with interlocking dagger-like teeth. a muscular forked tail drives sudden attacks.,inactive -2704,muskellunge,Freshwater giants,Fresh Water,lake,Day,Any,Required,Epic,0.11,8,60,32,72,0.82,,,,muskellunge wait motionless among weeds before exploding toward prey. pale bodies carry bars or spots that fade into broken underwater light.,inactive -2801,common shiner,Freshwater minnows,Fresh Water,river,Day,Any,Any,Common,4,0.03,0.3,1,3,1,,,,common shiners flash silver in clear streams and small rivers. breeding males develop rosy fins and a blue-violet sheen.,inactive -2802,creek chub,Freshwater minnows,Fresh Water,river,Day,Any,Any,Common,3.2,0.05,0.8,2,4,1,,,,creek chubs gather around pools and undercut banks in small streams. males build gravel ridges where several fish may spawn.,inactive -2803,emerald shiner,Freshwater minnows,Fresh Water,lake,Any,Any,Any,Common,3.5,0.03,0.25,1,3,1,,,,emerald shiners form bright surface schools in large lakes and rivers. slender bodies feed on plankton and drifting insects.,inactive -2804,fathead minnow,Freshwater minnows,Fresh Water,pond,Day,Any,Any,Common,4.5,0.02,0.2,1,2,1,,,,"fathead minnows tolerate warm, muddy ponds where many fish struggle. males guard eggs laid beneath rocks, logs, and other cover.",inactive -2805,flame chub,Freshwater minnows,Fresh Water,river,Any,Any,Any,Uncommon,0.4,0.05,0.15,3,6,0.9,,,,"flame chubs prefer cool, clear streams. their bright breeding colors make a small fish easy to spot in spring water.",active -2806,golden shiner,Freshwater minnows,Fresh Water,pond,Day,Any,Any,Common,3.8,0.05,1,2,4,1,,,,golden shiners school around dense vegetation in warm water. an upturned mouth takes insects and plankton from near the surface.,inactive -2807,lake chub,Freshwater minnows,Fresh Water,lake,Any,Any,Any,Common,0.55,0.05,0.5,2,4,0.9,,,,lake chubs school in cold northern water and use their small mouths to pick insects and other tiny prey from the current.,active -2901,electric eel,Freshwater oddities,Fresh Water,river,Night,Required,Any,Epic,0.1,1,44,25,60,0.82,,,,electric eels navigate and hunt with electrical pulses produced along most of the body. they must surface regularly to breathe air.,inactive -2902,freshwater drum,Freshwater oddities,Fresh Water,river,Night,Required,Any,Uncommon,0.7,1,35,7,20,0.85,,,,freshwater drum crush snails and mussels with powerful throat teeth. muscles vibrating against the swim bladder produce a low drumming sound.,inactive -2903,goldeye,Freshwater oddities,Fresh Water,river,Night,Any,Required,Rare,0.3,0.3,6,12,25,0.9,,,,goldeye patrol turbid rivers with large light-sensitive eyes and a toothed tongue. they rise toward the surface to hunt insects and small fish.,inactive -2904,mooneye,Freshwater oddities,Fresh Water,river,Night,Any,Any,Uncommon,0.85,0.2,4,5,11,0.92,,,,mooneyes flash silver in clear rivers and lakes while feeding near the surface. their large eyes suit evening hunts for insects and small fish.,inactive -2905,weather loach,Freshwater oddities,Fresh Water,pond,Any,Required,Any,Uncommon,0.85,0.05,0.7,5,11,0.95,,,,weather loaches gulp air and pass it through the intestine when oxygen runs low. restless activity often increases as air pressure falls.,inactive -3001,bubble-eye goldfish,Freshwater ornamental,Fresh Water,pond,Any,Any,Any,Uncommon,0.35,0.1,0.35,3,7,0.9,,,,"bubble-eye goldfish have delicate fluid-filled sacs beneath their eyes, making careful handling especially important.",active -3002,goldfish,Freshwater ornamental,Fresh Water,pond,Any,Any,Any,Common,0.5,0.1,4,1,3,0.9,,,,"goldfish can tolerate a surprisingly wide range of conditions. their wild relatives often live in slow, weedy water.",active -3003,koi,Freshwater ornamental,Fresh Water,pond,Day,Any,Forbidden,Rare,0.28,0.5,35,14,34,0.87,,,,koi are colorful domesticated forms of common carp selected over many generations. each fish carries a distinctive arrangement of patches and scales.,inactive -3101,black crappie,Freshwater panfish,Fresh Water,pond,Any,Any,Required,Uncommon,1,0.2,4,5,11,0.9,,,,black crappie gather around submerged wood and vegetation in clear water. irregular dark speckles scatter across their deep silver bodies.,inactive -3102,bluegill,Freshwater panfish,Fresh Water,pond,Day,Any,Any,Common,10,0.3,2,3,3,1,,,,"bluegill fathers sweep shallow bowls into the bottom for nests, then stand guard. whole neighborhoods of nests can crowd together.",active -3103,green sunfish,Freshwater panfish,Fresh Water,pond,Day,Any,Any,Common,3.2,0.1,1.5,2,5,1,,,,"green sunfish tolerate small, warm, cloudy pools better than many relatives. a large mouth lets them tackle insects, crayfish, and fish.",inactive -3104,pumpkinseed,Freshwater panfish,Fresh Water,pond,Day,Any,Any,Common,3,0.1,1.3,2,5,1,,,,pumpkinseeds use compact teeth to crush snails and other hard prey. blue facial lines and an orange gill spot brighten their round bodies.,inactive -3105,redear sunfish,Freshwater panfish,Fresh Water,pond,Day,Any,Any,Uncommon,1.1,0.2,3,4,9,0.95,,,,"redear sunfish specialize in snails, crushing shells with strong throat teeth. a red or orange margin marks the dark flap behind the gill.",inactive -3106,warmouth,Freshwater panfish,Fresh Water,pond,Night,Required,Any,Uncommon,0.8,0.2,2,5,10,0.95,,,,"warmouth hide in weeds, roots, and murky backwaters before ambushing prey. red eyes and dark cheek stripes frame a notably large mouth.",inactive -3107,white crappie,Freshwater panfish,Fresh Water,lake,Night,Any,Any,Common,1.7,0.2,4.5,4,9,0.9,,,,"white crappie favor warm, cloudy water and gather around structure. vertical bars cross their silver sides instead of scattered speckles.",inactive -3201,yellow perch,Freshwater perch,Fresh Water,lake,Day,Any,Any,Common,2.2,0.2,4,3,8,0.9,,,,yellow perch travel in schools through cool lakes and slow rivers. dark vertical bars and orange lower fins make them easy to recognize.,inactive -3301,chain pickerel,Freshwater predators,Fresh Water,pond,Day,Required,Any,Uncommon,0.8,0.5,9,6,15,0.9,,,,chain pickerel hover among vegetation before darting at fish and frogs. a chain-like pattern breaks up their green flanks.,inactive -3302,grass pickerel,Freshwater predators,Fresh Water,pond,Day,Any,Any,Common,2.1,0.1,1.5,2,6,0.95,,,,"grass pickerel remain small enough to hunt in narrow, weedy creeks and marshes. dark bars camouflage their slim bodies among stems.",inactive -3303,northern pike,Freshwater predators,Fresh Water,lake,Day,Any,Any,Uncommon,0.75,1,30,8,24,0.85,,,,northern pike are solitary ambush hunters built for sudden acceleration. pale bean-shaped spots cover their long green bodies.,inactive -3304,sauger,Freshwater predators,Fresh Water,river,Any,Any,Any,Uncommon,0.35,0.5,8,6,12,0.9,,,,"sauger favor turbid rivers and reservoirs. their mottled backs blend into the dim, shifting light near the bottom.",active -3305,saugeye,Freshwater predators,Fresh Water,lake,Any,Any,Any,Rare,0.2,0.5,12,9,18,0.9,,,,saugeye are a fertile hybrid of sauger and walleye. they combine traits from both parent species and often grow quickly.,active -3306,walleye,Freshwater predators,Fresh Water,lake,Any,Any,Any,Uncommon,0.4,0.5,15,7,15,0.9,,,,walleye have light-sensitive eyes that help them hunt in murky water and around dusk. their reflective layer gives the eyes a pale glow.,active -3401,round goby,Freshwater small fish,Fresh Water,lake,Any,Any,Any,Common,8,0.1,0.6,2,3,1,,,,round gobies use fused pelvic fins like a suction cup to hold onto rocks. they are small fish with a famously large appetite.,active -3501,crystal jelly,Jellies,Salt Water,ocean,Night,Any,Forbidden,Rare,0.24,0.05,4,15,34,0.93,,,,crystal jellies are nearly transparent except for glowing points around the bell. their green fluorescent protein transformed biological research.,inactive -3502,lion's mane jelly,Jellies,Salt Water,ocean,Night,Any,Required,Epic,0.11,1,200,24,58,0.82,,,,lion's mane jellies trail dense curtains of tentacles through cold seas. the bell darkens from yellow to deep red as the animal grows.,inactive -3503,moon jelly,Jellies,Salt Water,ocean,Night,Any,Any,Uncommon,0.7,0.05,5,6,14,0.94,,,,moon jellies pulse gently with four horseshoe-shaped organs visible through the bell. short tentacles sweep plankton toward the mouth.,inactive -3504,Pacific sea nettle,Jellies,Salt Water,ocean,Day,Any,Forbidden,Rare,0.28,0.2,12,14,32,0.9,,,,pacific sea nettles carry rust-colored stripes across pale bells. long tentacles and frilled mouth arms capture plankton and small fish.,inactive -3505,sea wasp,Jellies,Salt Water,ocean,Day,Required,Any,Legendary,0.035,0.2,6,42,90,0.9,,,,sea wasps have box-shaped bells and clusters of eyes along the lower edge. their long tentacles deliver exceptionally potent venom.,inactive -3601,African pompano,Large coastal predators,Salt Water,ocean,Any,Any,Any,Rare,0.26,2,50,14,35,0.84,,,,african pompano develop long streaming fin rays while young. adults become deep-bodied silver hunters around reefs and offshore structure.,inactive -3602,cobia,Large coastal predators,Salt Water,ocean,Day,Any,Any,Rare,0.24,5,80,15,40,0.82,,,,"cobia often follow sharks, rays, and floating structures in warm seas. a broad dark stripe runs along their long, powerful bodies.",inactive -3603,giant trevally,Large coastal predators,Salt Water,ocean,Day,Any,Any,Epic,0.1,10,150,32,78,0.8,,,,giant trevally hunt reef edges with bursts of speed and force. large individuals sometimes charge prey from surf and shallow lagoons.,inactive -3604,greater amberjack,Large coastal predators,Salt Water,ocean,Any,Any,Any,Rare,0.25,5,90,15,42,0.82,,,,"greater amberjacks circle reefs, wrecks, and offshore platforms. a dark stripe crosses the eye of their sturdy torpedo-shaped bodies.",inactive -3605,lesser amberjack,Large coastal predators,Salt Water,ocean,Any,Any,Any,Uncommon,0.75,1,20,7,18,0.86,,,,lesser amberjacks school around deep reefs and floating objects. an enlarged eye suits their preference for dimmer water.,inactive -3701,atlantic halibut,Large flatfish,Salt Water,ocean,Any,Any,Any,Epic,0.1,10,300,32,82,0.8,,,,atlantic halibut are immense right-eyed flatfish of cold northern seas. adults ambush fish and squid from deep rocky or sandy bottoms.,inactive -3702,pacific halibut,Large flatfish,Salt Water,ocean,Any,Any,Any,Epic,0.1,10,350,34,86,0.8,,,,pacific halibut lie camouflaged on cold continental shelves. powerful flat bodies can travel long distances between feeding and spawning grounds.,inactive -3703,turbot,Large flatfish,Salt Water,ocean,Any,Any,Required,Rare,0.24,1,35,14,34,0.85,,,,"turbot have broad, nearly circular bodies covered with bony bumps instead of scales. they bury into sand before ambushing fish and crustaceans.",inactive -3801,American lobster,Lobsters and shrimp,Salt Water,ocean,Night,Any,Required,Rare,0.28,0.5,44,16,42,0.86,,,,american lobsters shelter in rocky crevices and emerge to forage along the bottom. one claw crushes while the other cuts and grips.,inactive -3802,Antarctic krill,Lobsters and shrimp,Salt Water,ocean,Night,Any,Any,Rare,0.3,0.001,0.01,10,22,0.99,,,,"antarctic krill form enormous swarms beneath southern seas and ice. these small crustaceans feed whales, seals, penguins, and fish.",inactive -3803,Caribbean spiny lobster,Lobsters and shrimp,Salt Water,ocean,Night,Any,Forbidden,Rare,0.25,0.5,26,15,38,0.87,,,,caribbean spiny lobsters rely on long antennae and a thorny shell instead of large claws. groups march together across the seafloor.,inactive -3804,peacock mantis shrimp,Lobsters and shrimp,Salt Water,ocean,Day,Required,Any,Epic,0.1,0.05,0.4,22,50,0.96,,,,peacock mantis shrimp strike hard-shelled prey with club-like limbs. complex eyes move independently and detect colors beyond human vision.,inactive -3805,skunk cleaner shrimp,Lobsters and shrimp,Salt Water,ocean,Day,Any,Forbidden,Uncommon,0.75,0.01,0.15,5,11,0.98,,,,skunk cleaner shrimp advertise at reef cleaning stations with bright white antennae. visiting fish pause while parasites are picked away.,inactive -3901,Atlantic ghost crab,Marine crabs,Salt Water,ocean,Night,Any,Forbidden,Rare,0.28,0.02,0.5,11,24,0.97,,,,atlantic ghost crabs dash across beaches on long pale legs and retreat into deep burrows. raised eyes scan nearly every direction.,inactive -3902,blue crab,Marine crabs,Salt Water,ocean,Day,Any,Any,Common,1.15,0.1,1.1,3,8,0.95,,,,"blue crabs swim with flattened rear legs shaped like paddles. bright blue claws and an olive shell conceal a quick, defensive temperament.",inactive -3903,Dungeness crab,Marine crabs,Salt Water,ocean,Day,Any,Required,Uncommon,0.65,0.5,3,6,14,0.92,,,,dungeness crabs bury beneath sand with only their eyes and antennae exposed. broad toothed shells protect them along cool pacific coasts.,inactive -3904,Japanese spider crab,Marine crabs,Salt Water,ocean,Night,Any,Any,Legendary,0.045,5,44,38,88,0.84,,,,japanese spider crabs carry the longest leg span of any living arthropod. adults roam deep seafloors around japan.,inactive -3905,red king crab,Marine crabs,Salt Water,ocean,Night,Any,Required,Epic,0.11,2,24,24,58,0.85,,,,"red king crabs stride over cold northern bottoms on long armored legs. despite the name, they are closer to hermit crabs than true crabs.",inactive -4001,american eel,Migratory eels,Fresh Water | Salt Water,river,Night,Required,Any,Rare,0.25,0.3,8,12,27,0.88,,,,american eels hatch far out in the sargasso sea before entering freshwater rivers. adults later reverse the journey to spawn once.,inactive -4002,european eel,Migratory eels,Fresh Water | Salt Water,river,Night,Any,Required,Rare,0.2,0.3,10,13,30,0.88,,,,european eels cross the atlantic as transparent larvae before entering rivers and lakes. mature silver eels return to sea to reproduce.,inactive -4101,rainbow smelt,Migratory forage fish,Fresh Water | Salt Water,lake,Night,Any,Any,Common,2.5,0.05,0.8,2,5,1,,,,"rainbow smelt move between coastal water and rivers, though some remain landlocked. cucumber-like aromas cling to freshly caught fish.",inactive -4201,eulachon,Ocean-run forage fish,Fresh Water | Salt Water,river,Night,Required,Any,Uncommon,0.9,0.05,0.5,4,9,0.98,,,,eulachon return from the pacific to spawn in coastal rivers. their oil-rich bodies once served as candles when dried and fitted with wicks.,inactive -4301,white sturgeon,Ocean-run giants,Fresh Water | Salt Water,river,Night,Any,Any,Legendary,0.045,20,500,58,135,0.78,,,,white sturgeon are the largest freshwater fish in north america. armored plates line bodies built for long lives in rivers and estuaries.,inactive -4401,atlantic salmon,Ocean-run salmon,Salt Water,ocean,Any,Any,Any,Epic,0.65,8,40,20,42,0.85,,,,"atlantic salmon can return from the ocean to the river where they hatched. unlike many salmon, some survive to make the trip again.",active -4402,chum salmon,Ocean-run salmon,Salt Water,ocean,Any,Any,Any,Uncommon,2.5,6,25,10,22,0.9,,,,chum salmon travel immense distances and develop striking bars when they return to fresh water to spawn.,active -4403,coho salmon,Ocean-run salmon,Salt Water,ocean,Any,Any,Any,Rare,1.4,5,30,14,28,0.88,,,,coho salmon are agile hunters known for powerful leaps. young coho may spend more than a year growing in streams.,active -4404,pink salmon,Ocean-run salmon,Salt Water,ocean,Any,Any,Any,Uncommon,3,3,12,8,15,0.92,,,,pink salmon usually follow a strict two-year life cycle. spawning males develop the hump that inspired their nickname.,active -4405,sockeye salmon,Ocean-run salmon,Salt Water,ocean,Any,Any,Any,Rare,1.6,4,15,12,24,0.9,,,,sockeye salmon feed heavily on plankton at sea. adults turn vivid red as they return inland to spawn.,active -4501,steelhead trout,Ocean-run salmonids,Fresh Water,river,Any,Any,Any,Rare,0.2,2,35,10,20,0.9,,,,steelhead are the ocean-going form of rainbow trout. adults can leave fresh water and later return to spawn.,active -4601,black marlin,Oceanic billfish,Salt Water,ocean,Any,Any,Any,Epic,0.08,80,700,45,90,0.9,,,,black marlin are powerful billfish that spend much of their lives in warm open ocean and can make blistering runs.,active -4602,blue marlin,Oceanic billfish,Salt Water,ocean,Any,Any,Any,Legendary,0.05,100,1000,60,120,0.9,,,,blue marlin are highly migratory open-ocean hunters. their long bill helps them stun prey before turning back to feed.,active -4603,sailfish,Oceanic billfish,Salt Water,ocean,Any,Any,Any,Epic,0.1,30,200,38,78,0.9,,,,sailfish raise their enormous dorsal fin while herding baitfish. they are among the fastest fish in the sea.,active -4604,swordfish,Oceanic billfish,Salt Water,ocean,Any,Any,Any,Legendary,0.06,50,1000,55,110,0.9,,,,"swordfish are fast, wide-ranging predators with a flattened bill. they can cross deep water and warm surface layers in one day.",active -4605,white marlin,Oceanic billfish,Salt Water,ocean,Any,Any,Any,Epic,0.1,30,180,35,70,0.9,,,,white marlin favor warm offshore water and use their rounded dorsal fin and bill to weave through schools of prey.,active -4701,mahi-mahi,Oceanic pelagic fish,Salt Water,ocean,Day,Any,Forbidden,Rare,0.28,2,50,15,38,0.84,,,,"mahi-mahi flash brilliant blue, green, and gold while chasing prey near the surface. they grow quickly and gather around floating objects.",inactive -4702,opah,Oceanic pelagic fish,Salt Water,ocean,Day,Any,Forbidden,Epic,0.09,20,600,36,88,0.8,,,,"opah circulate warm blood through much of the body, an unusual trait among fish. round silver flanks glow with red fins and pale spots.",inactive -4703,wahoo,Oceanic pelagic fish,Salt Water,ocean,Day,Any,Any,Epic,0.11,10,100,30,70,0.82,,,,wahoo are streamlined open-ocean hunters with rows of sharp teeth. blue vertical bars flicker across their sides during fast pursuits.,inactive -4801,albacore tuna,Oceanic tuna,Salt Water,ocean,Any,Any,Any,Rare,1.5,10,45,12,24,0.85,,,,albacore have unusually long pectoral fins. their warm muscles help them cruise across wide stretches of open ocean.,active -4802,bigeye tuna,Oceanic tuna,Salt Water,ocean,Any,Any,Any,Epic,0.55,20,120,22,48,0.8,,,,"bigeye tuna make daily trips between deep, cool water and warmer surface layers. their large eyes suit those dim depths.",active -4803,bluefin tuna,Oceanic tuna,Salt Water,ocean,Any,Any,Any,Legendary,0.18,30,250,35,90,0.78,,,,bluefin tuna are powerful ocean travelers. heat retained in their swimming muscles lets them thrive in surprisingly cold seas.,active -4804,skipjack tuna,Oceanic tuna,Salt Water,ocean,Any,Any,Any,Uncommon,3,5,25,8,16,0.9,,,,skipjack travel in fast-moving schools and have dark stripes along their lower sides. they rarely stop swimming.,active -4805,yellowfin tuna,Oceanic tuna,Salt Water,ocean,Any,Any,Any,Rare,1,15,80,16,36,0.82,,,,yellowfin are named for their bright yellow fins and finlets. large schools often gather with other open-ocean hunters.,active -4901,common octopus,Octopuses,Salt Water,ocean,Night,Any,Any,Uncommon,0.65,0.2,22,7,18,0.87,,,,common octopuses squeeze through narrow cracks and solve problems while hunting reefs. skin cells rapidly change color and texture.,inactive -4902,day octopus,Octopuses,Salt Water,ocean,Day,Any,Forbidden,Rare,0.24,0.2,15,15,36,0.88,,,,"day octopuses forage across tropical reefs while the sun is high. shifting bars and spots communicate alarm, camouflage, and threat.",inactive -4903,giant Pacific octopus,Octopuses,Salt Water,ocean,Night,Any,Required,Epic,0.1,5,200,28,70,0.81,,,,giant pacific octopuses explore cold rocky dens with thousands of arm suckers. females guard their eggs without feeding until they hatch.,inactive -4904,greater blue-ringed octopus,Octopuses,Salt Water,ocean,Day,Required,Any,Legendary,0.04,0.05,0.3,38,82,0.96,,,,greater blue-ringed octopuses reveal vivid rings when threatened. a tiny beak can deliver venom strong enough to stop breathing.,inactive -5001,sunfish,Open-ocean giants,Salt Water,ocean,Day,Any,Any,Common,7,0.4,2.5,3,3,1,,,,ocean sunfish are built more like enormous swimming heads than ordinary fish. they visit the surface and turn sideways to warm up.,active -5101,barndoor skate,Rays and skates,Salt Water,ocean,Any,Any,Required,Epic,0.1,5,150,28,68,0.8,,,,barndoor skates glide over cold atlantic bottoms with broad wing-like fins. rows of thorny spines protect the back and tail.,inactive -5102,giant manta ray,Rays and skates,Salt Water,ocean,Day,Any,Forbidden,Legendary,0.025,100,1000,65,150,0.76,,,,giant manta rays funnel plankton into wide mouths with two flexible head fins. each belly carries a unique pattern of dark spots.,inactive -5103,largetooth sawfish,Rays and skates,Salt Water,ocean,Night,Required,Any,Legendary,0.035,25,1300,58,135,0.78,,,,largetooth sawfish detect hidden prey with a long sensory rostrum. a swift sideways sweep stuns fish and exposes animals buried in mud.,inactive -5104,ocellate river stingray,Rays and skates,Fresh Water,river,Day,Required,Any,Epic,0.09,2,35,28,65,0.82,,,,ocellate river stingrays carry bright eye-like spots across a round disc. they hide beneath sand in south american rivers.,inactive -5105,southern stingray,Rays and skates,Salt Water,ocean,Day,Any,Any,Rare,0.23,2,80,15,40,0.82,,,,southern stingrays bury in warm sand with only their eyes and spiracles visible. crushing plates break open clams and crustaceans.,inactive -5201,red lionfish,Reef ambush fish,Salt Water,ocean,Night,Any,Any,Rare,0.3,0.2,3,11,25,0.92,,,,red lionfish spread ornate venomous spines when threatened. broad fins herd smaller fish into corners before a rapid gulp.,inactive -5202,red scorpionfish,Reef ambush fish,Salt Water,ocean,Night,Any,Any,Rare,0.3,0.2,7,11,25,0.9,,,,red scorpionfish vanish against rocky reefs through mottled color and skin flaps. venomous dorsal spines punish careless predators.,inactive -5301,green moray,Reef eels,Salt Water,ocean,Night,Any,Any,Rare,0.28,1,30,13,32,0.86,,,,green morays appear green because yellow mucus coats blue-gray skin. a second set of jaws pulls captured prey deeper into the throat.,inactive -5401,peacock flounder,Reef flatfish,Salt Water,ocean,Day,Any,Any,Rare,0.3,0.2,5,11,24,0.9,,,,peacock flounders change their spots and colors to match tropical sand. both eyes scan above while the flat body remains concealed.,inactive -5501,blue tang,Reef grazers,Salt Water,ocean,Day,Any,Any,Uncommon,0.9,0.05,1.5,5,11,0.95,,,,blue tangs graze algae from coral reefs with small close-set teeth. sharp folding spines near the tail give surgeonfish their name.,inactive -5502,rainbow parrotfish,Reef grazers,Salt Water,ocean,Day,Any,Any,Epic,0.12,2,40,25,58,0.84,,,,rainbow parrotfish scrape algae from reefs with fused beak-like teeth. crushed coral passes through them and returns to the reef as sand.,inactive -5503,stoplight parrotfish,Reef grazers,Salt Water,ocean,Day,Any,Any,Rare,0.28,0.5,15,12,29,0.88,,,,stoplight parrotfish change color dramatically as they mature. powerful dental plates bite algae from hard reef surfaces.,inactive -5504,yellow tang,Reef grazers,Salt Water,ocean,Day,Forbidden,Any,Rare,0.35,0.05,0.8,9,20,0.96,,,,yellow tangs browse algae across hawaiian reefs during daylight. at night their bright bodies darken and show a pale horizontal stripe.,inactive -5601,atlantic trumpetfish,Reef oddities,Salt Water,ocean,Day,Any,Any,Rare,0.3,0.1,2,10,24,0.94,,,,atlantic trumpetfish hover head-down among corals and sea fans. long tubular snouts expand suddenly to draw in small fish.,inactive -5602,gray triggerfish,Reef oddities,Salt Water,ocean,Day,Any,Any,Uncommon,0.8,0.3,12,7,17,0.88,,,,"gray triggerfish lock a stout dorsal spine upright when wedged into shelter. strong teeth crack barnacles, crabs, and shellfish.",inactive -5603,guineafowl puffer,Reef oddities,Salt Water,ocean,Day,Any,Any,Rare,0.3,0.2,5,11,26,0.9,,,,guineafowl puffers swallow water to inflate when threatened. adults may shift from a spotted dark pattern to a vivid yellow form.,inactive -5604,longhorn cowfish,Reef oddities,Salt Water,ocean,Day,Any,Required,Epic,0.13,0.1,2,23,52,0.94,,,,longhorn cowfish wear a rigid box of fused scales with horns above the eyes. small fins steer the angular body with surprising precision.,inactive -5605,queen triggerfish,Reef oddities,Salt Water,ocean,Day,Any,Forbidden,Rare,0.25,0.5,15,14,32,0.88,,,,queen triggerfish blow jets of water to uncover buried prey and flip sea urchins. vivid blue lines radiate across the face.,inactive -5606,red cornetfish,Reef oddities,Salt Water,ocean,Day,Any,Required,Epic,0.11,0.2,4,24,55,0.92,,,,red cornetfish stalk reefs with extremely long bodies and tubular snouts. a trailing filament extends from the center of the tail.,inactive -5607,spotted porcupinefish,Reef oddities,Salt Water,ocean,Night,Any,Required,Epic,0.12,0.5,7,24,54,0.9,,,,spotted porcupinefish inflate until long spines stand outward. fused teeth form a strong beak for crushing shelled prey.,inactive -5608,yellow boxfish,Reef oddities,Salt Water,ocean,Day,Any,Any,Rare,0.32,0.03,0.8,10,22,0.96,,,,yellow boxfish juveniles are bright cubes covered in black spots. rigid body armor leaves small fins to provide careful steering.,inactive -5701,copperband butterflyfish,Reef ornamentals,Salt Water,ocean,Day,Any,Forbidden,Rare,0.32,0.03,0.4,9,21,0.98,,,,copperband butterflyfish probe reef cracks with long narrow snouts. bold orange bands and a false eyespot confuse predators.,inactive -5702,ocellaris clownfish,Reef ornamentals,Salt Water,ocean,Day,Any,Any,Uncommon,1,0.01,0.15,5,10,1,,,,ocellaris clownfish shelter safely among stinging anemone tentacles. each group is led by a female that develops from the largest male.,inactive -5703,queen angelfish,Reef ornamentals,Salt Water,ocean,Day,Any,Any,Rare,0.3,0.1,2,11,25,0.94,,,,queen angelfish graze sponges from warm atlantic reefs. a blue-ringed spot on the forehead resembles a tiny crown.,inactive -5801,Atlantic goliath grouper,Reef predators,Salt Water,ocean,Any,Any,Required,Legendary,0.05,20,800,50,125,0.78,,,,"atlantic goliath groupers occupy reefs, wrecks, and mangrove roots. enormous mouths pull prey inward with a sudden pressure drop.",inactive -5802,bluefin trevally,Reef predators,Salt Water,ocean,Day,Any,Forbidden,Rare,0.3,1,25,14,32,0.86,,,,bluefin trevally hunt reef fish in coordinated groups. electric blue fins and scattered blue spots contrast with a golden body.,inactive -5803,giant grouper,Reef predators,Salt Water,ocean,Any,Any,Required,Legendary,0.045,20,880,52,128,0.78,,,,giant groupers become massive ambush predators around indo-pacific reefs. juveniles carry bold black-and-yellow markings.,inactive -5804,great barracuda,Reef predators,Salt Water,ocean,Day,Any,Required,Epic,0.12,5,80,28,65,0.82,,,,great barracudas hover motionless before accelerating toward prey. long jaws carry two distinct rows of sharp teeth.,inactive -5805,gulf grouper,Reef predators,Salt Water,ocean,Any,Any,Any,Uncommon,0.3,2,40,10,24,0.9,,,,gulf grouper are ambush predators that use a sudden gulp to pull prey into their cavernous mouths.,active -5806,Nassau grouper,Reef predators,Salt Water,ocean,Any,Any,Forbidden,Epic,0.12,2,55,25,62,0.82,,,,nassau groupers shift their bars and colors with mood and surroundings. adults gather at traditional reef sites to spawn.,inactive -5807,red grouper,Reef predators,Salt Water,ocean,Any,Any,Any,Rare,0.2,2,30,16,36,0.9,,,,red grouper excavate shelters in reef rubble. the hollows they make can become hiding places for many smaller animals.,active -5901,blue-green chromis,Reef schooling fish,Salt Water,ocean,Day,Any,Any,Common,2.8,0.01,0.25,2,4,1,,,,blue-green chromis form loose clouds above branching coral. the school dives into narrow shelter whenever a predator approaches.,inactive -5902,bluestriped grunt,Reef schooling fish,Salt Water,ocean,Day,Any,Any,Common,2,0.1,3,3,7,0.94,,,,bluestriped grunts shelter on reefs by day and spread over seagrass to feed at night. grinding throat teeth produce audible grunts.,inactive -5903,French grunt,Reef schooling fish,Salt Water,ocean,Day,Any,Any,Common,2,0.1,3.5,3,7,0.94,,,,french grunts gather in yellow-striped schools around reefs and wrecks. they travel into nearby sand and grass beds after dark.,inactive -5904,sergeant major,Reef schooling fish,Salt Water,ocean,Day,Any,Any,Common,2.5,0.02,0.5,2,5,0.98,,,,sergeant majors guard purple egg patches on hard reef surfaces. five dark bars cross their yellow and silver bodies.,inactive -6001,lane snapper,Reef snapper,Salt Water,ocean,Any,Any,Any,Common,0.45,0.5,5,5,11,0.9,,,,lane snapper use reef structure for cover and hunt small crustaceans and fish when the light begins to fade.,active -6002,mangrove snapper,Reef snapper,Salt Water,ocean,Any,Any,Any,Uncommon,0.35,0.5,12,7,16,0.9,,,,"mangrove snapper shelter among roots and docks when young, then move toward reefs as they grow.",active -6003,mutton snapper,Reef snapper,Salt Water,ocean,Any,Any,Any,Rare,0.2,2,30,12,28,0.9,,,,"mutton snapper have canine teeth that help them pick crabs, shrimp, and other hard-shelled prey from the reef.",active -6004,red snapper,Reef snapper,Salt Water,ocean,Any,Any,Any,Uncommon,0.35,1,25,8,19,0.9,,,,"red snapper gather around reefs, wrecks, and ledges. their diet includes small fish, shrimp, and squid.",active -6101,ballan wrasse,Reef wrasses,Salt Water,ocean,Day,Any,Any,Uncommon,0.8,0.2,10,6,15,0.9,,,,ballan wrasse crush shellfish and sea urchins with strong throat teeth. thick lips and mottled colors suit rocky european reefs.,inactive -6102,cleaner wrasse,Reef wrasses,Salt Water,ocean,Day,Any,Forbidden,Rare,0.35,0.01,0.2,9,20,1,,,,cleaner wrasses advertise with a bright stripe and dance at reef stations. larger fish wait while parasites are picked from skin and gills.,inactive -6103,hogfish,Reef wrasses,Salt Water,ocean,Day,Any,Any,Rare,0.3,0.5,20,12,30,0.86,,,,hogfish root through sand with long pig-like snouts in search of shellfish. adults can change from female to male as social groups shift.,inactive -6201,green sea turtle,Sea turtles,Salt Water,ocean,Day,Any,Forbidden,Legendary,0.018,65,500,62,145,0.78,,,,green sea turtles graze seagrass meadows with finely serrated jaws. adults migrate long distances between feeding and nesting grounds.,inactive -6202,hawksbill sea turtle,Sea turtles,Salt Water,ocean,Day,Required,Any,Legendary,0.014,75,250,66,150,0.8,,,,hawksbill sea turtles reach into reef crevices with narrow hooked beaks. a diet rich in sponges helps shape coral communities.,inactive -6203,leatherback sea turtle,Sea turtles,Salt Water,ocean,Night,Any,Required,Legendary,0.012,500,2000,75,175,0.76,,,,leatherback sea turtles cross entire oceans while hunting jellies. a flexible ridged shell and internal heat help them enter cold water.,inactive -6204,loggerhead sea turtle,Sea turtles,Salt Water,ocean,Day,Any,Any,Legendary,0.016,150,1200,68,155,0.77,,,,loggerhead sea turtles crush crabs and mollusks with massive jaws. females often return near their birth beaches to nest.,inactive -6301,leafy seadragon,Seahorses and seadragons,Salt Water,ocean,Day,Any,Forbidden,Epic,0.1,0.1,0.5,24,55,0.94,,,,leafy seadragons drift among seaweed with elaborate skin lobes that resemble leaves. males carry eggs beneath the tail.,inactive -6302,weedy seadragon,Seahorses and seadragons,Salt Water,ocean,Day,Any,Required,Rare,0.22,0.1,0.6,16,38,0.93,,,,weedy seadragons rely on slender bodies and small leaf-like lobes for camouflage. males brood rows of eggs on the underside of the tail.,inactive -6401,black-lip pearl oyster,Shellfish,Salt Water,ocean,Day,Any,Any,Rare,0.22,0.1,5,14,40,0.91,,,,black-lip pearl oysters line their shells with dark-edged nacre. a trapped irritant can become coated in the same pearly material.,inactive -6402,giant clam,Shellfish,Salt Water,ocean,Day,Any,Forbidden,Epic,0.1,5,500,28,72,0.8,,,,giant clams host photosynthetic algae inside brightly colored mantles. heavy shells remain anchored to one reef spot throughout adulthood.,inactive -6403,Pacific geoduck,Shellfish,Salt Water,ocean,Day,Any,Required,Rare,0.25,0.5,15,14,34,0.88,,,,pacific geoducks bury their shells deep while a long siphon reaches the seafloor. these clams can survive for well over a century.,inactive -6404,queen conch,Shellfish,Salt Water,ocean,Day,Any,Forbidden,Rare,0.24,1,5,15,36,0.91,,,,queen conchs graze algae with a long flexible snout. adults develop a broad flared shell lip and move by vaulting on one muscular foot.,inactive -6405,red abalone,Shellfish,Salt Water,ocean,Day,Any,Required,Epic,0.09,0.2,12,24,56,0.88,,,,red abalones cling to pacific rocks with broad muscular feet. rows of shell holes release water that has passed over the gills.,inactive -6501,bigfin reef squid,Squid,Salt Water,ocean,Day,Any,Forbidden,Rare,0.3,0.2,5,13,30,0.91,,,,bigfin reef squid hover in coordinated groups around warm reefs. shifting colors and body patterns signal to nearby squid.,inactive -6502,colossal squid,Squid,Salt Water,ocean,Night,Required,Any,Legendary,0.015,400,1100,82,190,0.76,,,,colossal squid carry swiveling hooks on their arms and tentacles. enormous eyes gather faint light in the deep southern ocean.,inactive -6503,giant squid,Squid,Salt Water,ocean,Night,Any,Required,Legendary,0.02,100,600,70,165,0.77,,,,giant squid hunt deep ocean prey with two long feeding tentacles. the largest eyes in the animal world watch for movement in darkness.,inactive -6504,Humboldt squid,Squid,Salt Water,ocean,Night,Any,Any,Epic,0.09,5,110,26,64,0.82,,,,humboldt squid flash red and white while hunting in large groups. powerful beaks and grasping suckers handle fish and other squid.,inactive -6601,ballyhoo,Surface ocean fish,Salt Water,ocean,Day,Any,Any,Common,2.5,0.05,1,2,5,0.98,,,,ballyhoo skim warm ocean surfaces with an extended lower jaw. tight schools scatter into quick leaps when predators strike.,inactive -6602,houndfish,Surface ocean fish,Salt Water,ocean,Day,Any,Any,Rare,0.3,0.5,10,11,25,0.88,,,,houndfish hunt near the surface with long jaws filled with fine teeth. powerful leaps can carry their narrow bodies far above the water.,inactive -6603,tropical flyingfish,Surface ocean fish,Salt Water,ocean,Day,Forbidden,Any,Rare,0.35,0.05,1.5,10,22,0.94,,,,tropical flyingfish accelerate underwater before spreading enlarged fins above the surface. glides help them escape pursuing predators.,inactive -6701,striped bass,Temperate coastal,Salt Water,ocean,Any,Any,Any,Uncommon,4,1.5,8,7,7,0.9,,,,"striped bass split their lives between salt and fresh water, returning upriver to spawn. a long-lived striper may see three decades.",active -6801,atlantic croaker,Temperate estuary,Salt Water,ocean,Night,Required,Any,Common,2.1,0.1,5,3,8,0.92,,,,atlantic croakers vibrate muscles against the swim bladder to make a croaking sound. chin barbels locate worms in sandy bays.,inactive -6802,black drum,Temperate estuary,Salt Water,ocean,Night,Any,Any,Uncommon,0.7,1,70,8,27,0.82,,,,black drum crush oysters and crabs with rounded throat teeth. large adults develop dark vertical bars that fade with age.,inactive -6803,red drum,Temperate estuary,Salt Water,ocean,Any,Required,Any,Uncommon,0.75,1,45,8,23,0.84,,,,red drum use powerful tails to patrol surf and estuaries. one or more black spots near the tail may confuse predators about which end is the head.,inactive -6804,striped mullet,Temperate estuary,Fresh Water | Salt Water,ocean,Day,Any,Any,Common,2.5,0.3,8,3,8,0.92,,,,striped mullet leap clear of the water and travel in coastal schools. they graze algae and detritus with specialized digestive systems.,inactive -6805,weakfish,Temperate estuary,Salt Water,ocean,Night,Any,Required,Rare,0.32,0.5,18,12,29,0.86,,,,weakfish are named for delicate mouth tissue that tears easily around a hook. iridescent spots scatter across their bronze backs.,inactive -6806,white perch,Temperate estuary,Fresh Water | Salt Water,river,Any,Any,Any,Uncommon,1.1,0.2,3.5,5,11,0.9,,,,white perch tolerate fresh and brackish water along the atlantic coast. deep silver bodies gather in schools around river mouths.,inactive -6807,yellowfin croaker,Temperate estuary,Salt Water,ocean,Any,Any,Any,Common,2,0.1,4,3,8,0.92,,,,yellowfin croakers search sandy surf zones with a small chin barbel. internal muscles produce croaks and drumming calls.,inactive -6901,black rockfish,Temperate reef fish,Salt Water,ocean,Any,Any,Any,Common,1.7,0.3,10,4,11,0.9,,,,"black rockfish gather above reefs and kelp along the north pacific coast. like other rockfish, they give birth to live young.",inactive -6902,black sea bass,Temperate reef fish,Salt Water,ocean,Day,Any,Any,Common,1.7,0.3,8,4,10,0.9,,,,"black sea bass shelter around reefs, piers, and wrecks. many begin life as female and later become male.",inactive -6903,canary rockfish,Temperate reef fish,Salt Water,ocean,Day,Any,Any,Uncommon,0.7,0.5,12,7,17,0.88,,,,canary rockfish glow orange-yellow over deep pacific reefs. these long-lived fish mature slowly and give birth to live young.,inactive -6904,scup,Temperate reef fish,Salt Water,ocean,Day,Any,Any,Common,2.2,0.1,5,3,8,0.92,,,,"scup use small strong teeth to crush shellfish and other bottom prey. deep silver bodies gather around piers, reefs, and eelgrass.",inactive -6905,sheepshead,Temperate reef fish,Salt Water,ocean,Day,Any,Any,Uncommon,0.75,0.5,20,7,18,0.86,,,,sheepshead carry flat human-like front teeth for biting barnacles and crabs. dark bars cross their high silver bodies.,inactive -6906,tautog,Temperate reef fish,Salt Water,ocean,Day,Any,Any,Uncommon,0.8,0.5,20,7,18,0.86,,,,tautog pry mussels and crabs from rocky structure with thick lips and strong teeth. adults return to familiar shelters year after year.,inactive -6907,yelloweye rockfish,Temperate reef fish,Salt Water,ocean,Any,Any,Required,Epic,0.09,2,35,28,64,0.84,,,,yelloweye rockfish can live for more than a century on deep pacific reefs. bright golden eyes stand out against orange-red bodies.,inactive -7001,lingcod,Temperate reef predators,Salt Water,ocean,Any,Any,Any,Rare,0.25,2,60,14,38,0.83,,,,"lingcod guard rocky dens and ambush fish with a huge tooth-lined mouth. despite the name, they are greenling relatives rather than cod.",inactive -7101,milkfish,Tropical coastal fish,Salt Water,ocean,Day,Any,Any,Common,1.8,0.5,25,4,12,0.88,,,,milkfish graze algae and tiny organisms in warm coastal shallows. deeply forked tails drive large schools through lagoons and estuaries.,inactive -7201,roosterfish,Tropical coastal predators,Salt Water,ocean,Day,Any,Any,Epic,0.11,5,100,30,70,0.82,,,,roosterfish raise seven long dorsal spines while chasing prey through tropical surf. dark bands cross their sleek silver bodies.,inactive -7301,atlantic tarpon,Tropical estuary,Fresh Water | Salt Water,ocean,Any,Required,Any,Epic,0.09,10,180,34,82,0.8,,,,atlantic tarpon gulp air with a lung-like swim bladder when coastal water runs low on oxygen. giant silver scales flash during leaps.,inactive -7302,barramundi,Tropical estuary,Fresh Water | Salt Water,river,Night,Required,Any,Rare,0.24,2,45,15,38,0.84,,,,barramundi move between rivers and coasts and can breathe in low-oxygen water. many mature first as males and later become females.,inactive -7303,common snook,Tropical estuary,Salt Water,ocean,Night,Required,Any,Rare,0.3,1,30,13,32,0.85,,,,common snook wait around mangrove roots and current seams to ambush prey. a bold black lateral line divides their silver flanks.,inactive -7401,bonefish,Tropical flats fish,Salt Water,ocean,Day,Any,Forbidden,Rare,0.25,0.5,15,13,31,0.86,,,,bonefish sweep tropical flats in silvery schools and root for buried prey. their speed and pale bodies make them difficult to follow in shallow water.,inactive -7402,Florida pompano,Tropical flats fish,Salt Water,ocean,Day,Any,Forbidden,Uncommon,0.85,0.5,9,7,16,0.88,,,,"florida pompano search warm surf for crabs, clams, and sand fleas. short blunt snouts lead into deep, silvery bodies.",inactive -7403,ladyfish,Tropical flats fish,Salt Water,ocean,Day,Required,Any,Common,1.7,0.2,8,4,10,0.9,,,,ladyfish race through warm shallows after schooling prey and often leap when pursued. a deeply forked tail powers their slender bodies.,inactive -7404,permit,Tropical flats fish,Salt Water,ocean,Day,Forbidden,Any,Epic,0.11,3,50,27,62,0.84,,,,permit browse tropical flats for crabs and shellfish with rubbery mouths. tall silver bodies carry long sickle-shaped dorsal and anal fins.,inactive -7501,clown knifefish,Tropical freshwater fish,Fresh Water,river,Night,Any,Required,Rare,0.25,1,25,16,38,0.86,,,,clown knifefish undulate one long belly fin to glide forward or backward. dark eye-like spots line their silver nocturnal bodies.,inactive -7502,clown loach,Tropical freshwater fish,Fresh Water,river,Day,Required,Any,Rare,0.32,0.1,2,10,22,0.9,,,,clown loaches rest in groups and make clicking sounds while feeding. orange bodies carry three broad black bands and small eye spines.,inactive -7503,discus,Tropical freshwater fish,Fresh Water,river,Day,Any,Required,Epic,0.12,0.1,1,24,52,0.92,,,,"discus move through quiet amazon backwaters with round, flattened bodies. parents feed newly hatched young with nutrient-rich skin mucus.",inactive -7504,freshwater angelfish,Tropical freshwater fish,Fresh Water,river,Day,Any,Any,Rare,0.3,0.05,0.5,10,22,0.95,,,,freshwater angelfish slip between tall plants on narrow triangular bodies. long fins and vertical bars resemble stems and shadows.,inactive -7505,giant gourami,Tropical freshwater fish,Fresh Water,lake,Day,Any,Any,Rare,0.25,2,20,13,31,0.86,,,,giant gouramis breathe surface air through a specialized labyrinth organ. adults graze plants but also investigate insects and small animals.,inactive -7506,Nile tilapia,Tropical freshwater fish,Fresh Water,lake,Day,Any,Any,Common,2.2,0.3,8,3,9,0.9,,,,nile tilapia thrive in warm lakes and rivers on a varied diet. females protect eggs and young inside their mouths.,inactive -7507,oscar,Tropical freshwater fish,Fresh Water,river,Day,Any,Any,Uncommon,0.8,0.3,4,6,14,0.9,,,,oscars are large south american cichlids that recognize routines and defend territories. a tail eyespot may redirect attacks away from the head.,inactive -7508,Siamese fighting fish,Tropical freshwater fish,Fresh Water,pond,Day,Required,Any,Uncommon,1,0.01,0.15,5,10,1,,,,siamese fighting fish breathe surface air with a labyrinth organ. males build bubble nests and guard the eggs beneath them.,inactive -7509,tambaqui,Tropical freshwater fish,Fresh Water,river,Day,Required,Any,Epic,0.1,8,80,30,68,0.82,,,,tambaqui follow seasonal floods into forests to feed on fruit and seeds. strong square teeth crack tough plant material.,inactive -7510,walking catfish,Tropical freshwater fish,Fresh Water,pond,Night,Required,Any,Rare,0.3,0.5,5,11,24,0.9,,,,walking catfish wriggle across wet ground using stiff pectoral spines for support. an air-breathing organ helps them survive the journey.,inactive -7601,giant snakehead,Tropical freshwater predators,Fresh Water,river,Night,Any,Required,Epic,0.1,3,45,28,64,0.84,,,,giant snakeheads breathe air and guard schools of young near the surface. long bodies launch sudden attacks from flooded vegetation.,inactive -7602,golden dorado,Tropical freshwater predators,Fresh Water,river,Day,Required,Any,Epic,0.1,5,55,29,66,0.82,,,,"golden dorado chase fish through powerful south american rivers. muscular tails, heavy jaws, and golden scales suit life in fast current.",inactive -7603,golden mahseer,Tropical freshwater predators,Fresh Water,river,Day,Required,Any,Epic,0.09,8,90,32,72,0.82,,,,golden mahseer migrate through swift mountain rivers to reach spawning grounds. large scales shine bronze beneath reddish fins.,inactive -7604,peacock bass,Tropical freshwater predators,Fresh Water,river,Day,Any,Any,Rare,0.25,1,25,15,36,0.84,,,,peacock bass are aggressive south american cichlids rather than true bass. adults guard nests and hunt fish in warm clear water.,inactive -7605,red-bellied piranha,Tropical freshwater predators,Fresh Water,river,Any,Required,Any,Rare,0.3,0.2,4,12,27,0.9,,,,"red-bellied piranhas communicate with barks and drum-like sounds. schools provide protection as they search for fish, insects, and carrion.",inactive -7606,silver arowana,Tropical freshwater predators,Fresh Water,river,Day,Any,Required,Epic,0.11,1,15,25,56,0.86,,,,silver arowanas patrol the surface with upturned mouths and long bodies. powerful jumps capture insects and small animals above the water.,inactive -7701,blue whale,Whales and dolphins,Salt Water,ocean,Day,Any,Forbidden,Legendary,0.005,100000,330000,120,300,0.72,,,,blue whales are the largest animals known to have lived. pleated throats expand around vast mouthfuls of water that baleen filters for krill.,inactive -7702,common bottlenose dolphin,Whales and dolphins,Salt Water,ocean,Day,Any,Forbidden,Legendary,0.012,330,1400,75,180,0.76,,,,"common bottlenose dolphins coordinate with whistles, clicks, and body signals. echolocation reveals prey hidden in dark or cloudy water.",inactive -7703,humpback whale,Whales and dolphins,Salt Water,ocean,Day,Any,Required,Legendary,0.008,40000,90000,105,260,0.73,,,,humpback whales use long pectoral fins while turning and feeding. males produce layered songs that change across breeding seasons.,inactive -7704,killer whale,Whales and dolphins,Salt Water,ocean,Day,Required,Any,Legendary,0.008,3000,12000,95,230,0.74,,,,killer whales live in close family groups with distinct calls and hunting traditions. different populations specialize in different prey.,inactive -7705,sperm whale,Whales and dolphins,Salt Water,ocean,Night,Any,Required,Legendary,0.006,15000,125000,115,280,0.72,,,,sperm whales make deep dives to hunt squid with powerful echolocation clicks. their enormous square heads contain a waxy spermaceti organ.,inactive +catalog_number,display_name,collection_group,water_type,spawn_area,seasons,day_rule,rain_rule,fog_rule,rarity,base_catch_weight,weight_min_lb,weight_max_lb,sell_value_min,sell_value_max,sell_value_curve,required_bait_tags,required_event_tags,forbidden_event_tags,logbook_fact,active_status +101,bowfin,Ancient freshwater fish,Fresh Water,pond,Spring | Summer | Fall,Night,Any,Required,Rare,0.28,1,20,13,30,0.85,,,,bowfin can gulp air at the surface when warm backwaters run low on oxygen. a long dorsal fin ripples as they stalk prey.,inactive +102,lake sturgeon,Ancient freshwater fish,Fresh Water,lake,Spring | Summer | Fall | Winter,Night,Any,Any,Epic,0.09,10,180,36,82,0.8,,,,lake sturgeon sweep the bottom with four sensitive barbels before extending a tube-like mouth to feed. they can live for decades.,inactive +103,longnose gar,Ancient freshwater fish,Fresh Water,river,Spring | Summer | Fall,Day,Any,Any,Rare,0.24,2,35,14,34,0.85,,,,longnose gar wait near the surface before snapping sideways at passing fish. their narrow jaws carry rows of fine needle-like teeth.,inactive +104,paddlefish,Ancient freshwater fish,Fresh Water,river,Spring | Summer,Day,Required,Any,Epic,0.1,10,120,34,76,0.82,,,,"paddlefish cruise open rivers with their mouths wide, filtering tiny plankton from the water. the broad snout senses faint electrical signals.",inactive +105,shovelnose sturgeon,Ancient freshwater fish,Fresh Water,river,Spring | Summer | Fall | Winter,Night,Any,Any,Rare,0.22,1,8,12,25,0.9,,,,shovelnose sturgeon hug flowing river bottoms and probe for insect larvae. a flattened snout helps them hold position in strong current.,inactive +106,spotted gar,Ancient freshwater fish,Fresh Water,pond,Spring | Summer | Fall,Day,Any,Required,Rare,0.2,1,15,13,29,0.88,,,,spotted gar linger among vegetation where their mottled bodies break up their outline. they rise to gulp air as well as breathing through gills.,inactive +107,West African lungfish,Ancient freshwater fish,Fresh Water,pond,Summer | Fall,Night,Required,Any,Rare,0.3,1,10,12,28,0.86,,,,"west african lungfish breathe air with paired lungs. when floodplains dry, they seal themselves in a mud cocoon until water returns.",inactive +201,atlantic mudskipper,Brackish oddities,Salt Water,ocean,Spring | Summer | Fall | Winter,Day,Required,Any,Uncommon,1,0.03,0.5,5,11,0.95,,,,atlantic mudskippers use sturdy fins to hop and crawl across exposed mud. moist skin and mouth linings let them breathe out of water.,inactive +202,largescale foureyes,Brackish oddities,Fresh Water | Salt Water,river,Spring | Summer | Fall | Winter,Day,Any,Any,Rare,0.32,0.05,1,10,23,0.95,,,,largescale foureyes cruise with each eye divided across the waterline. one half watches above while the other scans below.,inactive +301,red mullet,Coastal bottom fish,Salt Water,ocean,Spring | Summer | Fall,Day,Any,Any,Uncommon,0.9,0.1,3,5,11,0.92,,,,red mullet comb sandy bottoms with two chin barbels that taste hidden prey. their foraging leaves winding trails in the sediment.,inactive +401,European plaice,Coastal flatfish,Salt Water,ocean,Spring | Fall | Winter,Day,Any,Any,Common,1.8,0.2,10,4,10,0.9,,,,european plaice lie flat on the seafloor with both eyes on the same side. orange spots help distinguish them from neighboring flatfish.,inactive +402,summer flounder,Coastal flatfish,Salt Water,ocean,Spring | Summer | Fall,Day,Any,Any,Uncommon,0.9,0.3,15,6,16,0.88,,,,summer flounder bury themselves in sand with only their eyes exposed. a sudden burst carries them upward to seize passing prey.,inactive +403,winter flounder,Coastal flatfish,Salt Water,ocean,Spring | Fall | Winter,Day,Forbidden,Any,Common,1.8,0.2,8,4,9,0.9,,,,winter flounder favor cool bays and estuaries where they rest on muddy bottoms. their eyes sit on the right side of the body.,inactive +501,dugong,Coastal marine mammals,Salt Water,ocean,Spring | Summer | Fall | Winter,Day,Any,Forbidden,Legendary,0.011,500,1100,72,165,0.77,,,,"dugongs graze seagrass meadows with a downturned, bristled snout. they are the only fully marine members of the sirenian family.",inactive +502,harbor seal,Coastal marine mammals,Salt Water,ocean,Spring | Summer | Fall | Winter,Day,Any,Required,Legendary,0.018,120,370,60,140,0.79,,,,harbor seals rest on rocky shores and sandbars between hunting trips. sensitive whiskers can trace the water trails left by moving fish.,inactive +503,sea otter,Coastal marine mammals,Salt Water,ocean,Spring | Summer | Fall | Winter,Day,Any,Any,Legendary,0.02,30,100,55,125,0.84,,,,sea otters float on their backs while opening shellfish with stones. dense fur traps insulating air because they lack a thick blubber layer.,inactive +504,walrus,Coastal marine mammals,Salt Water,ocean,Spring | Winter,Day,Any,Required,Legendary,0.012,800,3700,74,170,0.76,,,,walruses sweep the seafloor for clams and other soft-bodied prey. long tusks help them haul onto ice and settle disputes.,inactive +505,West Indian manatee,Coastal marine mammals,Salt Water,ocean,Spring | Summer | Fall | Winter,Day,Any,Forbidden,Legendary,0.012,440,1300,70,160,0.77,,,,west indian manatees graze aquatic plants in warm coastal water and rivers. they surface regularly to breathe through nostrils atop the snout.,inactive +601,bay pipefish,Coastal oddities,Salt Water,ocean,Spring | Summer | Fall | Winter,Day,Any,Any,Uncommon,0.9,0.005,0.04,4,9,1,,,,"bay pipefish hide upright among seagrass, matching the blades with their slender bodies. males carry developing eggs in a brood pouch.",inactive +602,lined seahorse,Coastal oddities,Salt Water,ocean,Spring | Summer | Fall | Winter,Day,Forbidden,Any,Rare,0.28,0.005,0.05,9,20,1,,,,lined seahorses anchor to grass and coral with curling tails. the male broods eggs in a pouch and releases fully formed young.,inactive +603,monkfish,Coastal oddities,Salt Water,ocean,Spring | Fall | Winter,Night,Any,Required,Rare,0.25,2,55,14,35,0.84,,,,monkfish hide against the bottom and wave a fleshy lure above a cavernous mouth. a sudden gulp draws fish and crustaceans inward.,inactive +604,tripletail,Coastal oddities,Salt Water,ocean,Summer | Fall,Day,Any,Required,Rare,0.28,1,30,13,31,0.85,,,,"tripletail often drift sideways near floating debris, resembling a loose leaf. rounded rear fins create the three-tailed silhouette.",inactive +701,atlantic mackerel,Coastal pelagic fish,Salt Water,ocean,Spring | Summer | Fall,Any,Any,Any,Common,0.5,0.5,5,4,9,0.9,,,,atlantic mackerel travel in fast schools across the north atlantic and feed on plankton and small schooling fish.,active +702,bluefish,Coastal pelagic fish,Salt Water,ocean,Spring | Summer | Fall,Day,Any,Any,Uncommon,0.85,0.5,25,7,19,0.85,,,,bluefish race in coordinated schools while pursuing smaller fish. sharp teeth and powerful jaws make their feeding bursts especially fierce.,inactive +703,cero mackerel,Coastal pelagic fish,Salt Water,ocean,Spring | Summer | Fall | Winter,Any,Any,Any,Uncommon,0.35,1,15,7,15,0.9,,,,cero mackerel are streamlined coastal hunters. sharp teeth help them slash through schools of smaller fish.,active +704,chub mackerel,Coastal pelagic fish,Salt Water,ocean,Spring | Summer | Fall,Any,Any,Any,Common,0.5,0.5,4,4,9,0.9,,,,chub mackerel school near the surface and follow plankton blooms. their dark wavy bars help identify them at a glance.,active +705,crevalle jack,Coastal pelagic fish,Salt Water,ocean,Summer | Fall,Day,Required,Any,Uncommon,0.8,1,35,7,20,0.84,,,,"crevalle jacks patrol warm coasts in fast-moving schools. their deep bodies and forked tails deliver long, powerful runs.",inactive +706,king mackerel,Coastal pelagic fish,Salt Water,ocean,Summer | Fall,Any,Any,Any,Uncommon,0.3,3,40,10,24,0.9,,,,king mackerel are swift coastal predators. their pointed teeth and long body are built for sudden bursts of speed.,active +707,spanish mackerel,Coastal pelagic fish,Salt Water,ocean,Summer | Fall,Any,Any,Any,Uncommon,0.35,1,15,8,18,0.9,,,,spanish mackerel hunt in warm coastal waters and often travel in loose schools while chasing baitfish.,active +708,talang queenfish,Coastal pelagic fish,Salt Water,ocean,Spring | Summer | Fall | Winter,Day,Any,Any,Uncommon,0.8,0.5,20,7,18,0.86,,,,talang queenfish chase schooling prey near warm coasts and estuaries. hooked teeth and a deeply forked tail suit their rapid attacks.,inactive +801,American sand lance,Coastal schooling fish,Salt Water,ocean,Spring | Fall | Winter,Day,Any,Any,Common,3,0.02,0.4,1,3,1,,,,american sand lance dive headfirst into loose sand when danger approaches. immense schools carry energy from plankton to larger predators.,inactive +802,atlantic menhaden,Coastal schooling fish,Salt Water,ocean,Spring | Summer | Fall,Day,Any,Any,Common,3,0.1,1.5,2,5,0.98,,,,"atlantic menhaden strain plankton from coastal water with fine gill rakers. dense schools feed whales, seabirds, and predatory fish.",inactive +803,black pomfret,Coastal schooling fish,Salt Water,ocean,Spring | Summer | Fall | Winter,Any,Any,Any,Uncommon,0.3,1,15,8,18,0.9,,,,"black pomfret have a deep, laterally compressed body that lets them maneuver neatly through open water.",active +804,chinese pomfret,Coastal schooling fish,Salt Water,ocean,Spring | Summer | Fall | Winter,Any,Any,Any,Uncommon,0.3,1,20,9,20,0.9,,,,"chinese pomfret are silvery schooling fish with a tall, flattened body and long sickle-shaped fins.",active +805,european anchovy,Coastal schooling fish,Salt Water,ocean,Spring | Summer | Fall,Any,Any,Any,Common,0.5,0.05,0.25,2,4,0.9,,,,european anchovies form dense schools and feed by filtering tiny plankton from coastal water.,active +806,European pilchard,Coastal schooling fish,Salt Water,ocean,Spring | Fall | Winter,Any,Any,Any,Common,3.5,0.05,0.6,2,4,1,,,,european pilchards form shimmering schools along atlantic and mediterranean coasts. they feed mainly on plankton near the surface.,inactive +807,golden pomfret,Coastal schooling fish,Salt Water,ocean,Spring | Summer | Fall | Winter,Any,Any,Any,Rare,0.18,2,25,14,30,0.9,,,,golden pomfret are warm-water swimmers whose golden sheen is most noticeable along the fins and flanks.,active +808,northern anchovy,Coastal schooling fish,Salt Water,ocean,Spring | Summer | Fall | Winter,Any,Any,Any,Common,0.5,0.05,0.35,2,4,0.9,,,,northern anchovies gather in huge schools along the pacific coast and filter plankton with their fine gill rakers.,active +809,Pacific sardine,Coastal schooling fish,Salt Water,ocean,Spring | Summer | Fall | Winter,Any,Any,Any,Common,3.5,0.05,0.5,2,4,1,,,,"pacific sardines follow cool, productive water in enormous schools. their movements shift as currents and plankton supplies change.",inactive +810,white pomfret,Coastal schooling fish,Salt Water,ocean,Spring | Summer | Fall | Winter,Any,Any,Any,Common,0.45,0.5,10,5,12,0.9,,,,"white pomfret gather over coastal grounds and use their compact, deep bodies to turn quickly while feeding.",active +901,blacktip shark,Coastal sharks,Salt Water,ocean,Summer | Fall,Day,Required,Any,Epic,0.1,15,150,32,75,0.8,,,,blacktip sharks are named for the dark markings on their fins. they hunt schooling fish in warm shallows and sometimes leap clear of the water.,inactive +902,great hammerhead shark,Coastal sharks,Salt Water,ocean,Summer | Fall,Day,Any,Forbidden,Legendary,0.035,50,1000,62,145,0.78,,,,great hammerheads sweep their wide heads over the bottom while searching for rays. widely spaced senses help pinpoint hidden prey.,inactive +903,great white shark,Coastal sharks,Salt Water,ocean,Spring | Summer | Fall | Winter,Day,Any,Any,Legendary,0.025,100,1000,70,150,0.76,,,,great white sharks conserve heat in their swimming muscles while crossing cool seas. rows of serrated teeth are replaced throughout life.,inactive +904,tiger shark,Coastal sharks,Salt Water,ocean,Spring | Summer | Fall | Winter,Night,Required,Any,Epic,0.06,50,1000,50,120,0.8,,,,tiger sharks carry dark vertical bars that fade as they mature. broad jaws let them investigate an unusually varied range of prey.,inactive +905,whale shark,Coastal sharks,Salt Water,ocean,Summer | Fall,Day,Any,Forbidden,Legendary,0.025,500,45000,70,160,0.76,,,,whale sharks are enormous filter feeders covered in unique spot patterns. they cruise with open mouths to collect plankton and tiny fish.,inactive +1001,burbot,Cold freshwater fish,Fresh Water,lake,Spring | Fall | Winter,Night,Any,Required,Rare,0.24,0.5,18,12,28,0.86,,,,burbot are the only freshwater members of the cod family. they become most active in cold darkness and may spawn beneath winter ice.,inactive +1002,cisco,Cold freshwater fish,Fresh Water,lake,Spring | Fall | Winter,Day,Any,Any,Common,2.2,0.1,3,3,7,0.95,,,,cisco school in the cool open water of northern lakes. these slim relatives of salmon feed on plankton and become prey for larger fish.,inactive +1003,lake whitefish,Cold freshwater fish,Fresh Water,lake,Spring | Fall | Winter,Any,Any,Any,Common,1.5,0.5,12,4,11,0.9,,,,"lake whitefish browse deep, cold bottoms with small downward-pointing mouths. large schools move toward shallows to spawn in autumn.",inactive +1101,arctic char,Cold freshwater salmonids,Fresh Water | Salt Water,lake,Spring | Fall | Winter,Any,Forbidden,Any,Rare,0.3,1,25,14,32,0.86,,,,arctic char thrive farther north than any other freshwater fish. some remain in lakes while others migrate between rivers and the sea.,inactive +1102,arctic grayling,Cold freshwater salmonids,Fresh Water,river,Spring | Fall | Winter,Day,Any,Forbidden,Uncommon,0.75,0.3,6,6,14,0.9,,,,"arctic grayling carry a tall, colorful dorsal fin like a sail. they feed on drifting insects in cold, clear rivers and lakes.",inactive +1103,brown trout,Cold freshwater salmonids,Fresh Water,river,Spring | Summer | Fall | Winter,Night,Any,Any,Uncommon,0.8,0.5,25,7,20,0.86,,,,"brown trout often shelter by day and hunt more freely after dark. adaptable populations occupy streams, lakes, and even coastal water.",inactive +1104,cutthroat trout,Cold freshwater salmonids,Fresh Water,river,Spring | Fall | Winter,Any,Any,Any,Uncommon,0.4,0.25,10,5,12,0.9,,,,"cutthroat trout take their name from the red slash beneath the jaw. many populations rely on cold, well-oxygenated streams.",active +1105,golden trout,Cold freshwater salmonids,Fresh Water,lake,Spring | Summer | Fall,Any,Any,Any,Rare,0.2,0.2,3,8,16,0.9,,,,"golden trout evolved in clear, high-elevation california streams. their bright flanks stand out against rocky alpine water.",active +1106,rainbow trout,Cold freshwater salmonids,Fresh Water,river,Spring | Summer | Fall | Winter,Any,Any,Any,Uncommon,0.45,0.5,20,5,11,0.9,,,,rainbow trout are adaptable stream hunters. the pink lateral stripe is especially vivid when the fish is in breeding condition.,active +1201,atlantic wolffish,Cold reef fish,Salt Water,ocean,Spring | Fall | Winter,Any,Forbidden,Any,Rare,0.25,2,40,14,34,0.84,,,,atlantic wolffish use heavy jaws and blunt teeth to crush shellfish and urchins. natural antifreeze proteins help them endure icy water.,inactive +1202,cusk,Cold reef fish,Salt Water,ocean,Spring | Fall | Winter,Night,Any,Any,Uncommon,0.75,0.5,30,7,19,0.85,,,,"cusk move slowly across cold rocky bottoms, sheltering in cracks and caves. a single long fin runs around much of the rear body.",inactive +1203,spotted wolffish,Cold reef fish,Salt Water,ocean,Spring | Fall | Winter,Any,Any,Required,Epic,0.11,3,50,26,60,0.84,,,,spotted wolffish crush hard-shelled prey with broad molar-like teeth. their pale spots stand out against a dark cold-water body.,inactive +1301,atlantic herring,Cold schooling fish,Salt Water,ocean,Spring | Fall | Winter,Any,Any,Any,Common,3,0.1,1.5,2,5,0.98,,,,atlantic herring gather in immense schools that move between feeding and spawning grounds. they filter plankton with fine gill rakers.,inactive +1302,capelin,Cold schooling fish,Salt Water,ocean,Spring | Fall | Winter,Any,Any,Required,Uncommon,1,0.03,0.2,4,8,1,,,,"capelin are small polar fish that feed whales, seabirds, and larger fish. many schools roll onto beaches or shallows to release their eggs.",inactive +1303,European sprat,Cold schooling fish,Salt Water,ocean,Spring | Fall | Winter,Any,Any,Any,Common,3.2,0.03,0.3,1,3,1,,,,european sprat form compact schools in northern coastal seas. these tiny herring relatives feed on plankton near the surface.,inactive +1304,pacific herring,Cold schooling fish,Salt Water,ocean,Spring | Fall | Winter,Any,Required,Any,Common,2.8,0.1,1.5,2,5,0.98,,,,pacific herring return to coastal shallows to coat plants and rocks with eggs. their oily schools support entire marine food webs.,inactive +1401,Alaska pollock,Cold shelf fish,Salt Water,ocean,Spring | Fall | Winter,Any,Any,Any,Common,2.5,0.3,8,3,8,0.92,,,,alaska pollock form vast schools over cold northern shelves. they feed on plankton and fish while supporting many larger predators.,inactive +1402,atlantic cod,Cold shelf fish,Salt Water,ocean,Spring | Fall | Winter,Any,Any,Any,Common,1.8,1,55,5,18,0.85,,,,"atlantic cod carry a pale lateral line and one chin barbel. they search cold seafloors for crustaceans, mollusks, and smaller fish.",inactive +1403,Atlantic pollock,Cold shelf fish,Salt Water,ocean,Spring | Fall | Winter,Day,Any,Forbidden,Uncommon,0.9,1,35,7,18,0.86,,,,atlantic pollock are swift relatives of cod with dark backs and pale lateral lines. adults gather around rocky banks and wrecks.,inactive +1404,Dover sole,Cold shelf fish,Salt Water,ocean,Spring | Fall | Winter,Night,Any,Any,Uncommon,0.8,0.2,8,6,14,0.9,,,,dover sole glide over deep muddy bottoms of the eastern pacific. both eyes migrate to the right side as the young fish becomes flat.,inactive +1405,haddock,Cold shelf fish,Salt Water,ocean,Spring | Fall | Winter,Day,Any,Any,Common,2,0.5,20,4,11,0.9,,,,haddock are recognized by a dark shoulder mark and black lateral line. schools forage over cold seafloors for small bottom animals.,inactive +1406,pacific cod,Cold shelf fish,Salt Water,ocean,Spring | Fall | Winter,Any,Any,Any,Common,1.8,1,45,5,17,0.85,,,,pacific cod use a chin barbel to investigate cold shelf bottoms. seasonal schools follow prey between deeper water and coastal spawning grounds.,inactive +1407,pacific hake,Cold shelf fish,Salt Water,ocean,Spring | Fall | Winter,Night,Any,Any,Common,1.7,0.3,8,3,9,0.92,,,,pacific hake rise from deep water at night to feed on krill and fish. large schools migrate along the west coast with changing seasons.,inactive +1408,silver hake,Cold shelf fish,Salt Water,ocean,Spring | Fall | Winter,Night,Any,Any,Common,1.7,0.2,5,3,8,0.92,,,,silver hake hunt fish and crustaceans over sandy atlantic shelves. they move upward after dark and return toward the bottom by day.,inactive +1501,chambered nautilus,Cuttlefish and nautiluses,Salt Water,ocean,Spring | Summer | Fall | Winter,Night,Any,Required,Legendary,0.05,0.5,3,34,76,0.92,,,,chambered nautiluses regulate buoyancy with gas-filled shell chambers. dozens of small tentacles feel for food in dark reef slopes.,inactive +1502,common cuttlefish,Cuttlefish and nautiluses,Salt Water,ocean,Spring | Summer | Fall | Winter,Day,Any,Any,Uncommon,0.55,0.2,12,7,17,0.9,,,,common cuttlefish flash changing colors and patterns through specialized skin cells. an internal cuttlebone controls buoyancy.,inactive +1503,flamboyant cuttlefish,Cuttlefish and nautiluses,Salt Water,ocean,Spring | Summer | Fall | Winter,Day,Required,Any,Epic,0.1,0.05,0.4,26,58,0.96,,,,flamboyant cuttlefish walk along the seafloor on their arms and fins. vivid displays warn predators of potent toxins.,inactive +1601,blueline tilefish,Deep shelf fish,Salt Water,ocean,Spring | Summer | Fall | Winter,Day,Any,Any,Uncommon,0.7,1,20,7,18,0.86,,,,blueline tilefish shelter in burrows and rocky openings along deep shelves. a narrow blue stripe traces the edge of the dorsal fin.,inactive +1602,golden tilefish,Deep shelf fish,Salt Water,ocean,Spring | Summer | Fall | Winter,Day,Any,Any,Rare,0.22,2,50,15,37,0.84,,,,golden tilefish excavate burrows in soft clay along deep ocean slopes. their bright yellow spots contrast with blue-green backs.,inactive +1603,Pacific ocean perch,Deep shelf fish,Salt Water,ocean,Spring | Summer | Fall | Winter,Any,Any,Any,Uncommon,0.8,0.3,12,7,17,0.88,,,,pacific ocean perch hover around deep rocky reefs in the north pacific. these slow-growing fish give birth to live young.,inactive +1604,Patagonian toothfish,Deep shelf fish,Salt Water,ocean,Spring | Summer | Fall | Winter,Night,Any,Any,Epic,0.09,10,220,32,78,0.8,,,,"patagonian toothfish patrol cold, deep southern water with large canine teeth. natural antifreeze proteins protect their blood from freezing.",inactive +1605,sablefish,Deep shelf fish,Salt Water,ocean,Spring | Summer | Fall | Winter,Night,Any,Any,Rare,0.22,2,40,15,36,0.84,,,,"sablefish roam deep north pacific slopes and can live for many decades. soft dark bodies conceal rich, oil-filled flesh.",inactive +1606,wreckfish,Deep shelf fish,Salt Water,ocean,Spring | Summer | Fall | Winter,Any,Any,Required,Epic,0.1,10,180,31,76,0.8,,,,"wreckfish gather around caves, ledges, and shipwrecks in deep water. powerful jaws let them ambush fish and large crustaceans.",inactive +1701,giant oarfish,Deep-sea legends,Salt Water,ocean,Spring | Summer | Fall | Winter,Night,Any,Required,Legendary,0.035,20,600,60,140,0.78,,,,"giant oarfish drift vertically through deep open water, rowing with a crimson dorsal fin. their ribbon-like bodies can reach remarkable lengths.",inactive +1702,West Indian Ocean coelacanth,Deep-sea legends,Salt Water,ocean,Spring | Summer | Fall | Winter,Night,Any,Required,Legendary,0.03,20,200,65,145,0.8,,,,"west indian ocean coelacanths shelter in deep volcanic caves by day. fleshy lobed fins move in an alternating, limb-like rhythm.",inactive +1801,black seadevil,Deep-sea oddities,Salt Water,ocean,Spring | Summer | Fall | Winter,Night,Any,Any,Legendary,0.05,0.1,2,48,105,0.92,,,,black seadevils lure prey with a glowing organ suspended above the mouth. tiny males permanently attach to much larger females.,inactive +1802,common fangtooth,Deep-sea oddities,Salt Water,ocean,Spring | Summer | Fall | Winter,Night,Any,Any,Epic,0.1,0.05,0.5,25,56,0.96,,,,common fangtooths carry outsized teeth that fit into pockets in the roof of the mouth. they migrate upward from deep water after dark.,inactive +1803,gulper eel,Deep-sea oddities,Salt Water,ocean,Spring | Summer | Fall | Winter,Night,Any,Required,Legendary,0.04,0.5,18,44,92,0.86,,,,gulper eels unfold enormous mouths to engulf prey in the deep sea. a whip-like tail ends in a small light-producing organ.,inactive +1804,Pacific barreleye,Deep-sea oddities,Salt Water,ocean,Spring | Summer | Fall | Winter,Night,Any,Required,Legendary,0.045,0.2,2.5,42,88,0.9,,,,pacific barreleyes peer upward through transparent shields covering the head. tubular eyes rotate forward when the fish turns to feed.,inactive +1805,smooth-head blobfish,Deep-sea oddities,Salt Water,ocean,Spring | Summer | Fall | Winter,Night,Any,Required,Legendary,0.04,0.5,5,42,90,0.86,,,,smooth-head blobfish rest on deep slopes where pressure supports their soft bodies. they conserve energy by waiting for edible matter nearby.,inactive +1806,spotted lanternfish,Deep-sea oddities,Salt Water,ocean,Spring | Summer | Fall | Winter,Night,Any,Any,Rare,0.24,0.05,0.5,14,30,0.95,,,,spotted lanternfish carry rows of light-producing organs along their bodies. immense schools rise toward the surface each night.,inactive +1901,crown-of-thorns sea star,Echinoderms,Salt Water,ocean,Spring | Summer | Fall | Winter,Night,Required,Any,Epic,0.1,0.5,7,23,52,0.91,,,,crown-of-thorns sea stars crawl over reefs and digest coral tissue outside the body. venomous spines discourage many predators.,inactive +1902,giant California sea cucumber,Echinoderms,Salt Water,ocean,Spring | Summer | Fall | Winter,Night,Any,Required,Rare,0.24,0.5,5,13,29,0.93,,,,giant california sea cucumbers sweep organic particles from the seafloor with branching tentacles. soft tube feet anchor their long bodies.,inactive +1903,purple sea urchin,Echinoderms,Salt Water,ocean,Spring | Summer | Fall | Winter,Day,Any,Any,Uncommon,0.75,0.05,1,5,12,0.96,,,,purple sea urchins scrape algae from rocks with a five-toothed feeding structure. dense groups can clear kelp from entire reefs.,inactive +1904,sand dollar,Echinoderms,Salt Water,ocean,Spring | Summer | Fall | Winter,Day,Any,Forbidden,Uncommon,0.8,0.01,0.2,4,10,0.98,,,,sand dollars burrow just beneath sandy seafloors and filter tiny food particles. the familiar star pattern marks their five-part body plan.,inactive +1905,sunflower sea star,Echinoderms,Salt Water,ocean,Spring | Summer | Fall | Winter,Day,Any,Required,Rare,0.25,0.5,13,14,32,0.89,,,,"sunflower sea stars move quickly on thousands of tube feet and may carry many arms. they hunt urchins, clams, and other bottom animals.",inactive +2001,axolotl,Freshwater amphibians,Fresh Water,lake,Spring | Summer | Fall,Night,Any,Required,Legendary,0.04,0.1,0.7,36,78,0.96,,,,axolotls remain aquatic and keep feathery external gills throughout adulthood. lost limbs and parts of several organs can regenerate.,inactive +2002,hellbender,Freshwater amphibians,Fresh Water,river,Spring | Summer | Fall,Night,Required,Any,Epic,0.1,0.5,5.5,24,54,0.91,,,,"hellbenders hide beneath large rocks in cool, clean rivers. folds of loose skin absorb oxygen while the flattened body grips the current.",inactive +2101,guppy,Freshwater aquarium fish,Fresh Water,pond,Spring | Summer | Fall | Winter,Day,Any,Any,Common,1.5,0.01,0.15,2,5,0.98,,,,"guppies are livebearers whose young arrive ready to swim. males display bright colors while females often favor larger, less flashy bodies.",inactive +2102,neon tetra,Freshwater aquarium fish,Fresh Water,pond,Spring | Summer | Fall | Winter,Night,Any,Any,Uncommon,0.9,0.01,0.08,4,8,0.98,,,,"neon tetras school through shaded forest streams. an iridescent blue stripe remains visible in the dim, tannin-stained water.",inactive +2103,zebrafish,Freshwater aquarium fish,Fresh Water,pond,Spring | Summer | Fall | Winter,Day,Any,Any,Common,1.35,0.01,0.12,2,5,0.98,,,,"zebrafish carry horizontal blue stripes from gill to tail. hardy schools thrive in shallow streams, flooded fields, and quiet pools.",inactive +2201,largemouth bass,Freshwater bass,Fresh Water,pond,Spring | Summer | Fall,Any,Any,Any,Common,2.5,0.5,18,4,12,0.9,,,,largemouth bass wait among weeds and timber before lunging at prey. the upper jaw extends beyond the eye when the mouth is closed.,inactive +2202,smallmouth bass,Freshwater bass,Fresh Water,river,Spring | Summer | Fall,Day,Any,Any,Uncommon,1.2,0.5,12,6,15,0.9,,,,smallmouth bass favor clear water with rock and moving current. bronze flanks and dark vertical bars distinguish them from largemouth bass.,inactive +2301,bigmouth buffalo,Freshwater bottom fish,Fresh Water,river,Spring | Summer | Fall,Any,Any,Required,Epic,0.12,8,80,28,63,0.82,,,,bigmouth buffalo filter plankton with fine gill rakers instead of rooting for prey. some individuals survive for more than a century.,inactive +2302,golden redhorse,Freshwater bottom fish,Fresh Water,river,Spring | Summer | Fall,Day,Any,Any,Uncommon,0.9,0.5,8,6,14,0.9,,,,"golden redhorses probe flowing river bottoms with fleshy, downward-facing mouths. coppery scales and reddish fins give them a warm glow.",inactive +2303,quillback,Freshwater bottom fish,Fresh Water,river,Spring | Summer | Fall,Day,Any,Any,Uncommon,0.8,0.5,15,6,16,0.88,,,,quillbacks carry a long first dorsal ray that rises like a quill. small mouths gather insect larvae and other food from river and lake bottoms.,inactive +2304,smallmouth buffalo,Freshwater bottom fish,Fresh Water,river,Spring | Summer | Fall,Any,Any,Any,Rare,0.3,3,45,14,34,0.84,,,,"smallmouth buffalo use thick lips to graze bottom-dwelling food in warm rivers. their deep, heavy bodies form a pronounced arch behind the head.",inactive +2305,white sucker,Freshwater bottom fish,Fresh Water,river,Spring | Summer | Fall,Any,Any,Any,Common,2,0.3,8,3,8,0.9,,,,white suckers vacuum insects and organic matter from cool freshwater bottoms. spring runs carry large groups into shallow streams.,inactive +2401,black bullhead,Freshwater catfish,Fresh Water,pond,Spring | Summer | Fall,Night,Any,Any,Uncommon,1,0.3,6,5,11,0.92,,,,"black bullheads tolerate warm, cloudy water with little oxygen. stout spines protect the dorsal and pectoral fins from predators.",inactive +2402,blue catfish,Freshwater catfish,Fresh Water,river,Spring | Summer | Fall,Night,Any,Any,Uncommon,1.25,3,12,6,9,0.9,,,,a deep fork in the tail inspired the blue catfish's scientific name. it rests deep by daylight and becomes more active after dark.,active +2403,brown bullhead,Freshwater catfish,Fresh Water,pond,Spring | Summer | Fall,Night,Any,Any,Common,2.3,0.2,4,3,7,0.95,,,,brown bullheads search muddy bottoms with eight sensitive barbels. males guard nests and herd newly hatched young in a dark moving ball.,inactive +2404,channel catfish,Freshwater catfish,Fresh Water,pond,Spring | Summer | Fall,Night,Any,Any,Common,2,1.5,7,4,7,1,,,,"a channel catfish can taste through skin all over its body, especially near its gills and whiskers. the male watches the eggs.",active +2405,flathead catfish,Freshwater catfish,Fresh Water,river,Spring | Summer | Fall,Night,Any,Any,Uncommon,1,3,14,7,10,0.9,,,,"flatheads favor hideouts made by logs, rocks, ledges, and other underwater structure. as they grow, fish dominate their menu.",active +2406,tadpole madtom,Freshwater catfish,Fresh Water,river,Spring | Summer | Fall,Night,Any,Any,Rare,0.35,0.02,0.15,8,16,0.95,,,,tadpole madtoms are tiny nocturnal catfish that shelter beneath vegetation and debris. venomous fin spines discourage larger predators.,inactive +2407,white catfish,Freshwater catfish,Fresh Water,pond,Spring | Summer | Fall,Night,Any,Any,Common,2,1,5,4,6,1,,,,white catfish began along the atlantic coast between new york and florida. people later carried them far beyond that home range.,active +2408,yellow bullhead,Freshwater catfish,Fresh Water,pond,Spring | Summer | Fall,Night,Required,Any,Common,2,0.2,3.5,3,7,0.95,,,,yellow bullheads use pale chin barbels to distinguish food in murky shallows. both parents may guard the nest and schooling young.,inactive +2501,common barbel,Freshwater coarse fish,Fresh Water,river,Spring | Summer | Fall,Night,Required,Any,Rare,0.28,1,25,13,31,0.85,,,,common barbels hold close to fast river bottoms with streamlined bodies and broad fins. four mouth barbels locate food among stones.,inactive +2502,common bream,Freshwater coarse fish,Fresh Water,lake,Spring | Fall | Winter,Any,Any,Any,Common,1.8,0.3,15,4,12,0.88,,,,"common bream gather in slow rivers and lakes with silvery, deep-sided bodies. protruding mouths sift insect larvae from soft bottoms.",inactive +2503,common carp,Freshwater coarse fish,Fresh Water,pond,Spring | Summer | Fall | Winter,Any,Any,Any,Rare,1.5,3,18,10,10,0.85,,,,whisker-like barbels help a common carp investigate the bottom. nosing through sediment can cloud the water and loosen plants.,active +2504,common roach,Freshwater coarse fish,Fresh Water,pond,Spring | Summer | Fall | Winter,Any,Any,Any,Common,2.8,0.1,4,2,6,0.95,,,,"common roach thrive in many lakes and rivers, often schooling near vegetation. red fins and a red-orange eye brighten their silver bodies.",inactive +2505,european chub,Freshwater coarse fish,Fresh Water,river,Spring | Summer | Fall | Winter,Any,Any,Any,Common,0.55,0.2,6,2,4,0.9,,,,"european chub are adaptable river fish. adults often patrol shallows and feed on insects, small fish, and fruit.",active +2506,fallfish,Freshwater coarse fish,Fresh Water,river,Spring | Summer | Fall,Day,Required,Any,Uncommon,0.9,0.2,3.5,5,10,0.92,,,,fallfish are large minnows that build broad stone nests in flowing water. other stream fish often reuse the gravel mounds for spawning.,inactive +2507,ide,Freshwater coarse fish,Fresh Water,river,Spring | Summer | Fall,Day,Any,Any,Uncommon,0.8,0.3,9,6,14,0.9,,,,"ide move between rivers, lakes, and brackish coastal water in loose schools. adults eat insects, crustaceans, plants, and small fish.",inactive +2508,rudd,Freshwater coarse fish,Fresh Water,pond,Spring | Summer | Fall,Day,Any,Any,Common,2.4,0.1,4.5,3,7,0.95,,,,"rudd feed near the surface with an upturned mouth and red fins. golden-green bodies disappear easily among warm, weedy shallows.",inactive +2509,tench,Freshwater coarse fish,Fresh Water,pond,Spring | Summer | Fall,Night,Any,Required,Uncommon,0.75,0.5,12,7,17,0.88,,,,"tench browse quiet, muddy bottoms with two small mouth barbels. a thick coat of slime protects their olive-green scales.",inactive +2601,red swamp crayfish,Freshwater crustaceans,Fresh Water,pond,Spring | Summer | Fall,Night,Required,Any,Common,1.1,0.03,0.25,3,7,0.98,,,,"red swamp crayfish burrow into wet ground when water recedes. adaptable populations feed on plants, carrion, and small aquatic animals.",inactive +2701,alligator gar,Freshwater giants,Fresh Water,river,Spring | Summer | Fall,Night,Any,Any,Legendary,0.055,20,300,55,125,0.8,,,,alligator gar combine a broad tooth-filled snout with heavy armor-like scales. a vascular swim bladder lets them breathe air at the surface.,inactive +2702,arapaima,Freshwater giants,Fresh Water,river,Spring | Summer | Fall | Winter,Day,Any,Any,Legendary,0.04,40,400,60,140,0.78,,,,arapaima must surface frequently to gulp air through a specialized swim bladder. large armored scales protect their long river-going bodies.,inactive +2703,goliath tigerfish,Freshwater giants,Fresh Water,river,Spring | Summer | Fall | Winter,Day,Any,Any,Legendary,0.035,20,150,58,132,0.8,,,,goliath tigerfish patrol powerful african rivers with interlocking dagger-like teeth. a muscular forked tail drives sudden attacks.,inactive +2704,muskellunge,Freshwater giants,Fresh Water,lake,Spring | Fall | Winter,Day,Any,Required,Epic,0.11,8,60,32,72,0.82,,,,muskellunge wait motionless among weeds before exploding toward prey. pale bodies carry bars or spots that fade into broken underwater light.,inactive +2801,common shiner,Freshwater minnows,Fresh Water,river,Spring | Summer | Fall,Day,Any,Any,Common,4,0.03,0.3,1,3,1,,,,common shiners flash silver in clear streams and small rivers. breeding males develop rosy fins and a blue-violet sheen.,inactive +2802,creek chub,Freshwater minnows,Fresh Water,river,Spring | Summer | Fall,Day,Any,Any,Common,3.2,0.05,0.8,2,4,1,,,,creek chubs gather around pools and undercut banks in small streams. males build gravel ridges where several fish may spawn.,inactive +2803,emerald shiner,Freshwater minnows,Fresh Water,lake,Spring | Summer | Fall,Any,Any,Any,Common,3.5,0.03,0.25,1,3,1,,,,emerald shiners form bright surface schools in large lakes and rivers. slender bodies feed on plankton and drifting insects.,inactive +2804,fathead minnow,Freshwater minnows,Fresh Water,pond,Spring | Summer | Fall,Day,Any,Any,Common,4.5,0.02,0.2,1,2,1,,,,"fathead minnows tolerate warm, muddy ponds where many fish struggle. males guard eggs laid beneath rocks, logs, and other cover.",inactive +2805,flame chub,Freshwater minnows,Fresh Water,river,Spring | Summer | Fall,Any,Any,Any,Uncommon,0.4,0.05,0.15,3,6,0.9,,,,"flame chubs prefer cool, clear streams. their bright breeding colors make a small fish easy to spot in spring water.",active +2806,golden shiner,Freshwater minnows,Fresh Water,pond,Spring | Summer | Fall,Day,Any,Any,Common,3.8,0.05,1,2,4,1,,,,golden shiners school around dense vegetation in warm water. an upturned mouth takes insects and plankton from near the surface.,inactive +2807,lake chub,Freshwater minnows,Fresh Water,lake,Spring | Fall | Winter,Any,Any,Any,Common,0.55,0.05,0.5,2,4,0.9,,,,lake chubs school in cold northern water and use their small mouths to pick insects and other tiny prey from the current.,active +2901,electric eel,Freshwater oddities,Fresh Water,river,Spring | Summer | Fall | Winter,Night,Required,Any,Epic,0.1,1,44,25,60,0.82,,,,electric eels navigate and hunt with electrical pulses produced along most of the body. they must surface regularly to breathe air.,inactive +2902,freshwater drum,Freshwater oddities,Fresh Water,river,Spring | Summer | Fall,Night,Required,Any,Uncommon,0.7,1,35,7,20,0.85,,,,freshwater drum crush snails and mussels with powerful throat teeth. muscles vibrating against the swim bladder produce a low drumming sound.,inactive +2903,goldeye,Freshwater oddities,Fresh Water,river,Spring | Fall | Winter,Night,Any,Required,Rare,0.3,0.3,6,12,25,0.9,,,,goldeye patrol turbid rivers with large light-sensitive eyes and a toothed tongue. they rise toward the surface to hunt insects and small fish.,inactive +2904,mooneye,Freshwater oddities,Fresh Water,river,Spring | Fall | Winter,Night,Any,Any,Uncommon,0.85,0.2,4,5,11,0.92,,,,mooneyes flash silver in clear rivers and lakes while feeding near the surface. their large eyes suit evening hunts for insects and small fish.,inactive +2905,weather loach,Freshwater oddities,Fresh Water,pond,Spring | Summer | Fall | Winter,Any,Required,Any,Uncommon,0.85,0.05,0.7,5,11,0.95,,,,weather loaches gulp air and pass it through the intestine when oxygen runs low. restless activity often increases as air pressure falls.,inactive +3001,bubble-eye goldfish,Freshwater ornamental,Fresh Water,pond,Spring | Summer | Fall | Winter,Any,Any,Any,Uncommon,0.35,0.1,0.35,3,7,0.9,,,,"bubble-eye goldfish have delicate fluid-filled sacs beneath their eyes, making careful handling especially important.",active +3002,goldfish,Freshwater ornamental,Fresh Water,pond,Spring | Summer | Fall | Winter,Any,Any,Any,Common,0.5,0.1,4,1,3,0.9,,,,"goldfish can tolerate a surprisingly wide range of conditions. their wild relatives often live in slow, weedy water.",active +3003,koi,Freshwater ornamental,Fresh Water,pond,Spring | Summer | Fall | Winter,Day,Any,Forbidden,Rare,0.28,0.5,35,14,34,0.87,,,,koi are colorful domesticated forms of common carp selected over many generations. each fish carries a distinctive arrangement of patches and scales.,inactive +3101,black crappie,Freshwater panfish,Fresh Water,pond,Spring | Fall | Winter,Any,Any,Required,Uncommon,1,0.2,4,5,11,0.9,,,,black crappie gather around submerged wood and vegetation in clear water. irregular dark speckles scatter across their deep silver bodies.,inactive +3102,bluegill,Freshwater panfish,Fresh Water,pond,Spring | Summer | Fall,Day,Any,Any,Common,10,0.3,2,3,3,1,,,,"bluegill fathers sweep shallow bowls into the bottom for nests, then stand guard. whole neighborhoods of nests can crowd together.",active +3103,green sunfish,Freshwater panfish,Fresh Water,pond,Spring | Summer | Fall,Day,Any,Any,Common,3.2,0.1,1.5,2,5,1,,,,"green sunfish tolerate small, warm, cloudy pools better than many relatives. a large mouth lets them tackle insects, crayfish, and fish.",inactive +3104,pumpkinseed,Freshwater panfish,Fresh Water,pond,Spring | Summer | Fall,Day,Any,Any,Common,3,0.1,1.3,2,5,1,,,,pumpkinseeds use compact teeth to crush snails and other hard prey. blue facial lines and an orange gill spot brighten their round bodies.,inactive +3105,redear sunfish,Freshwater panfish,Fresh Water,pond,Spring | Summer | Fall,Day,Any,Any,Uncommon,1.1,0.2,3,4,9,0.95,,,,"redear sunfish specialize in snails, crushing shells with strong throat teeth. a red or orange margin marks the dark flap behind the gill.",inactive +3106,warmouth,Freshwater panfish,Fresh Water,pond,Spring | Summer | Fall,Night,Required,Any,Uncommon,0.8,0.2,2,5,10,0.95,,,,"warmouth hide in weeds, roots, and murky backwaters before ambushing prey. red eyes and dark cheek stripes frame a notably large mouth.",inactive +3107,white crappie,Freshwater panfish,Fresh Water,lake,Spring | Fall | Winter,Night,Any,Any,Common,1.7,0.2,4.5,4,9,0.9,,,,"white crappie favor warm, cloudy water and gather around structure. vertical bars cross their silver sides instead of scattered speckles.",inactive +3201,yellow perch,Freshwater perch,Fresh Water,lake,Spring | Fall | Winter,Day,Any,Any,Common,2.2,0.2,4,3,8,0.9,,,,yellow perch travel in schools through cool lakes and slow rivers. dark vertical bars and orange lower fins make them easy to recognize.,inactive +3301,chain pickerel,Freshwater predators,Fresh Water,pond,Spring | Fall | Winter,Day,Required,Any,Uncommon,0.8,0.5,9,6,15,0.9,,,,chain pickerel hover among vegetation before darting at fish and frogs. a chain-like pattern breaks up their green flanks.,inactive +3302,grass pickerel,Freshwater predators,Fresh Water,pond,Spring | Fall | Winter,Day,Any,Any,Common,2.1,0.1,1.5,2,6,0.95,,,,"grass pickerel remain small enough to hunt in narrow, weedy creeks and marshes. dark bars camouflage their slim bodies among stems.",inactive +3303,northern pike,Freshwater predators,Fresh Water,lake,Spring | Fall | Winter,Day,Any,Any,Uncommon,0.75,1,30,8,24,0.85,,,,northern pike are solitary ambush hunters built for sudden acceleration. pale bean-shaped spots cover their long green bodies.,inactive +3304,sauger,Freshwater predators,Fresh Water,river,Spring | Fall | Winter,Any,Any,Any,Uncommon,0.35,0.5,8,6,12,0.9,,,,"sauger favor turbid rivers and reservoirs. their mottled backs blend into the dim, shifting light near the bottom.",active +3305,saugeye,Freshwater predators,Fresh Water,lake,Spring | Fall | Winter,Any,Any,Any,Rare,0.2,0.5,12,9,18,0.9,,,,saugeye are a fertile hybrid of sauger and walleye. they combine traits from both parent species and often grow quickly.,active +3306,walleye,Freshwater predators,Fresh Water,lake,Spring | Fall | Winter,Any,Any,Any,Uncommon,0.4,0.5,15,7,15,0.9,,,,walleye have light-sensitive eyes that help them hunt in murky water and around dusk. their reflective layer gives the eyes a pale glow.,active +3401,round goby,Freshwater small fish,Fresh Water,lake,Spring | Summer | Fall | Winter,Any,Any,Any,Common,8,0.1,0.6,2,3,1,,,,round gobies use fused pelvic fins like a suction cup to hold onto rocks. they are small fish with a famously large appetite.,active +3501,crystal jelly,Jellies,Salt Water,ocean,Spring | Winter,Night,Any,Forbidden,Rare,0.24,0.05,4,15,34,0.93,,,,crystal jellies are nearly transparent except for glowing points around the bell. their green fluorescent protein transformed biological research.,inactive +3502,lion's mane jelly,Jellies,Salt Water,ocean,Spring | Fall | Winter,Night,Any,Required,Epic,0.11,1,200,24,58,0.82,,,,lion's mane jellies trail dense curtains of tentacles through cold seas. the bell darkens from yellow to deep red as the animal grows.,inactive +3503,moon jelly,Jellies,Salt Water,ocean,Spring | Summer | Fall | Winter,Night,Any,Any,Uncommon,0.7,0.05,5,6,14,0.94,,,,moon jellies pulse gently with four horseshoe-shaped organs visible through the bell. short tentacles sweep plankton toward the mouth.,inactive +3504,Pacific sea nettle,Jellies,Salt Water,ocean,Summer | Fall,Day,Any,Forbidden,Rare,0.28,0.2,12,14,32,0.9,,,,pacific sea nettles carry rust-colored stripes across pale bells. long tentacles and frilled mouth arms capture plankton and small fish.,inactive +3505,sea wasp,Jellies,Salt Water,ocean,Spring | Summer | Fall | Winter,Day,Required,Any,Legendary,0.035,0.2,6,42,90,0.9,,,,sea wasps have box-shaped bells and clusters of eyes along the lower edge. their long tentacles deliver exceptionally potent venom.,inactive +3601,African pompano,Large coastal predators,Salt Water,ocean,Summer | Fall,Any,Any,Any,Rare,0.26,2,50,14,35,0.84,,,,african pompano develop long streaming fin rays while young. adults become deep-bodied silver hunters around reefs and offshore structure.,inactive +3602,cobia,Large coastal predators,Salt Water,ocean,Summer | Fall,Day,Any,Any,Rare,0.24,5,80,15,40,0.82,,,,"cobia often follow sharks, rays, and floating structures in warm seas. a broad dark stripe runs along their long, powerful bodies.",inactive +3603,giant trevally,Large coastal predators,Salt Water,ocean,Summer | Fall,Day,Any,Any,Epic,0.1,10,150,32,78,0.8,,,,giant trevally hunt reef edges with bursts of speed and force. large individuals sometimes charge prey from surf and shallow lagoons.,inactive +3604,greater amberjack,Large coastal predators,Salt Water,ocean,Summer | Fall,Any,Any,Any,Rare,0.25,5,90,15,42,0.82,,,,"greater amberjacks circle reefs, wrecks, and offshore platforms. a dark stripe crosses the eye of their sturdy torpedo-shaped bodies.",inactive +3605,lesser amberjack,Large coastal predators,Salt Water,ocean,Summer | Fall,Any,Any,Any,Uncommon,0.75,1,20,7,18,0.86,,,,lesser amberjacks school around deep reefs and floating objects. an enlarged eye suits their preference for dimmer water.,inactive +3701,atlantic halibut,Large flatfish,Salt Water,ocean,Spring | Fall | Winter,Any,Any,Any,Epic,0.1,10,300,32,82,0.8,,,,atlantic halibut are immense right-eyed flatfish of cold northern seas. adults ambush fish and squid from deep rocky or sandy bottoms.,inactive +3702,pacific halibut,Large flatfish,Salt Water,ocean,Spring | Fall | Winter,Any,Any,Any,Epic,0.1,10,350,34,86,0.8,,,,pacific halibut lie camouflaged on cold continental shelves. powerful flat bodies can travel long distances between feeding and spawning grounds.,inactive +3703,turbot,Large flatfish,Salt Water,ocean,Spring | Fall | Winter,Any,Any,Required,Rare,0.24,1,35,14,34,0.85,,,,"turbot have broad, nearly circular bodies covered with bony bumps instead of scales. they bury into sand before ambushing fish and crustaceans.",inactive +3801,American lobster,Lobsters and shrimp,Salt Water,ocean,Spring | Summer | Fall | Winter,Night,Any,Required,Rare,0.28,0.5,44,16,42,0.86,,,,american lobsters shelter in rocky crevices and emerge to forage along the bottom. one claw crushes while the other cuts and grips.,inactive +3802,Antarctic krill,Lobsters and shrimp,Salt Water,ocean,Spring | Summer | Fall | Winter,Night,Any,Any,Rare,0.3,0.001,0.01,10,22,0.99,,,,"antarctic krill form enormous swarms beneath southern seas and ice. these small crustaceans feed whales, seals, penguins, and fish.",inactive +3803,Caribbean spiny lobster,Lobsters and shrimp,Salt Water,ocean,Spring | Summer | Fall | Winter,Night,Any,Forbidden,Rare,0.25,0.5,26,15,38,0.87,,,,caribbean spiny lobsters rely on long antennae and a thorny shell instead of large claws. groups march together across the seafloor.,inactive +3804,peacock mantis shrimp,Lobsters and shrimp,Salt Water,ocean,Spring | Summer | Fall | Winter,Day,Required,Any,Epic,0.1,0.05,0.4,22,50,0.96,,,,peacock mantis shrimp strike hard-shelled prey with club-like limbs. complex eyes move independently and detect colors beyond human vision.,inactive +3805,skunk cleaner shrimp,Lobsters and shrimp,Salt Water,ocean,Spring | Summer | Fall | Winter,Day,Any,Forbidden,Uncommon,0.75,0.01,0.15,5,11,0.98,,,,skunk cleaner shrimp advertise at reef cleaning stations with bright white antennae. visiting fish pause while parasites are picked away.,inactive +3901,Atlantic ghost crab,Marine crabs,Salt Water,ocean,Summer | Fall,Night,Any,Forbidden,Rare,0.28,0.02,0.5,11,24,0.97,,,,atlantic ghost crabs dash across beaches on long pale legs and retreat into deep burrows. raised eyes scan nearly every direction.,inactive +3902,blue crab,Marine crabs,Salt Water,ocean,Summer | Fall,Day,Any,Any,Common,1.15,0.1,1.1,3,8,0.95,,,,"blue crabs swim with flattened rear legs shaped like paddles. bright blue claws and an olive shell conceal a quick, defensive temperament.",inactive +3903,Dungeness crab,Marine crabs,Salt Water,ocean,Spring | Fall | Winter,Day,Any,Required,Uncommon,0.65,0.5,3,6,14,0.92,,,,dungeness crabs bury beneath sand with only their eyes and antennae exposed. broad toothed shells protect them along cool pacific coasts.,inactive +3904,Japanese spider crab,Marine crabs,Salt Water,ocean,Spring | Fall | Winter,Night,Any,Any,Legendary,0.045,5,44,38,88,0.84,,,,japanese spider crabs carry the longest leg span of any living arthropod. adults roam deep seafloors around japan.,inactive +3905,red king crab,Marine crabs,Salt Water,ocean,Spring | Fall | Winter,Night,Any,Required,Epic,0.11,2,24,24,58,0.85,,,,"red king crabs stride over cold northern bottoms on long armored legs. despite the name, they are closer to hermit crabs than true crabs.",inactive +4001,american eel,Migratory eels,Fresh Water | Salt Water,river,Fall | Winter,Night,Required,Any,Rare,0.25,0.3,8,12,27,0.88,,,,american eels hatch far out in the sargasso sea before entering freshwater rivers. adults later reverse the journey to spawn once.,inactive +4002,european eel,Migratory eels,Fresh Water | Salt Water,river,Fall | Winter,Night,Any,Required,Rare,0.2,0.3,10,13,30,0.88,,,,european eels cross the atlantic as transparent larvae before entering rivers and lakes. mature silver eels return to sea to reproduce.,inactive +4101,rainbow smelt,Migratory forage fish,Fresh Water | Salt Water,lake,Spring | Winter,Night,Any,Any,Common,2.5,0.05,0.8,2,5,1,,,,"rainbow smelt move between coastal water and rivers, though some remain landlocked. cucumber-like aromas cling to freshly caught fish.",inactive +4201,eulachon,Ocean-run forage fish,Fresh Water | Salt Water,river,Spring,Night,Required,Any,Uncommon,0.9,0.05,0.5,4,9,0.98,,,,eulachon return from the pacific to spawn in coastal rivers. their oil-rich bodies once served as candles when dried and fitted with wicks.,inactive +4301,white sturgeon,Ocean-run giants,Fresh Water | Salt Water,river,Spring | Fall,Night,Any,Any,Legendary,0.045,20,500,58,135,0.78,,,,white sturgeon are the largest freshwater fish in north america. armored plates line bodies built for long lives in rivers and estuaries.,inactive +4401,atlantic salmon,Ocean-run salmon,Salt Water,ocean,Spring | Fall,Any,Any,Any,Epic,0.65,8,40,20,42,0.85,,,,"atlantic salmon can return from the ocean to the river where they hatched. unlike many salmon, some survive to make the trip again.",active +4402,chum salmon,Ocean-run salmon,Salt Water,ocean,Fall,Any,Any,Any,Uncommon,2.5,6,25,10,22,0.9,,,,chum salmon travel immense distances and develop striking bars when they return to fresh water to spawn.,active +4403,coho salmon,Ocean-run salmon,Salt Water,ocean,Fall | Winter,Any,Any,Any,Rare,1.4,5,30,14,28,0.88,,,,coho salmon are agile hunters known for powerful leaps. young coho may spend more than a year growing in streams.,active +4404,pink salmon,Ocean-run salmon,Salt Water,ocean,Summer | Fall,Any,Any,Any,Uncommon,3,3,12,8,15,0.92,,,,pink salmon usually follow a strict two-year life cycle. spawning males develop the hump that inspired their nickname.,active +4405,sockeye salmon,Ocean-run salmon,Salt Water,ocean,Summer | Fall,Any,Any,Any,Rare,1.6,4,15,12,24,0.9,,,,sockeye salmon feed heavily on plankton at sea. adults turn vivid red as they return inland to spawn.,active +4501,steelhead trout,Ocean-run salmonids,Fresh Water,river,Spring | Fall | Winter,Any,Any,Any,Rare,0.2,2,35,10,20,0.9,,,,steelhead are the ocean-going form of rainbow trout. adults can leave fresh water and later return to spawn.,active +4601,black marlin,Oceanic billfish,Salt Water,ocean,Summer | Fall,Any,Any,Any,Epic,0.08,80,700,45,90,0.9,,,,black marlin are powerful billfish that spend much of their lives in warm open ocean and can make blistering runs.,active +4602,blue marlin,Oceanic billfish,Salt Water,ocean,Summer | Fall,Any,Any,Any,Legendary,0.05,100,1000,60,120,0.9,,,,blue marlin are highly migratory open-ocean hunters. their long bill helps them stun prey before turning back to feed.,active +4603,sailfish,Oceanic billfish,Salt Water,ocean,Spring | Summer | Fall | Winter,Any,Any,Any,Epic,0.1,30,200,38,78,0.9,,,,sailfish raise their enormous dorsal fin while herding baitfish. they are among the fastest fish in the sea.,active +4604,swordfish,Oceanic billfish,Salt Water,ocean,Spring | Summer | Fall | Winter,Any,Any,Any,Legendary,0.06,50,1000,55,110,0.9,,,,"swordfish are fast, wide-ranging predators with a flattened bill. they can cross deep water and warm surface layers in one day.",active +4605,white marlin,Oceanic billfish,Salt Water,ocean,Summer | Fall,Any,Any,Any,Epic,0.1,30,180,35,70,0.9,,,,white marlin favor warm offshore water and use their rounded dorsal fin and bill to weave through schools of prey.,active +4701,mahi-mahi,Oceanic pelagic fish,Salt Water,ocean,Summer | Fall,Day,Any,Forbidden,Rare,0.28,2,50,15,38,0.84,,,,"mahi-mahi flash brilliant blue, green, and gold while chasing prey near the surface. they grow quickly and gather around floating objects.",inactive +4702,opah,Oceanic pelagic fish,Salt Water,ocean,Summer | Fall,Day,Any,Forbidden,Epic,0.09,20,600,36,88,0.8,,,,"opah circulate warm blood through much of the body, an unusual trait among fish. round silver flanks glow with red fins and pale spots.",inactive +4703,wahoo,Oceanic pelagic fish,Salt Water,ocean,Summer | Fall,Day,Any,Any,Epic,0.11,10,100,30,70,0.82,,,,wahoo are streamlined open-ocean hunters with rows of sharp teeth. blue vertical bars flicker across their sides during fast pursuits.,inactive +4801,albacore tuna,Oceanic tuna,Salt Water,ocean,Spring | Summer | Fall,Any,Any,Any,Rare,1.5,10,45,12,24,0.85,,,,albacore have unusually long pectoral fins. their warm muscles help them cruise across wide stretches of open ocean.,active +4802,bigeye tuna,Oceanic tuna,Salt Water,ocean,Spring | Summer | Fall | Winter,Any,Any,Any,Epic,0.55,20,120,22,48,0.8,,,,"bigeye tuna make daily trips between deep, cool water and warmer surface layers. their large eyes suit those dim depths.",active +4803,bluefin tuna,Oceanic tuna,Salt Water,ocean,Spring | Fall,Any,Any,Any,Legendary,0.18,30,250,35,90,0.78,,,,bluefin tuna are powerful ocean travelers. heat retained in their swimming muscles lets them thrive in surprisingly cold seas.,active +4804,skipjack tuna,Oceanic tuna,Salt Water,ocean,Spring | Summer | Fall | Winter,Any,Any,Any,Uncommon,3,5,25,8,16,0.9,,,,skipjack travel in fast-moving schools and have dark stripes along their lower sides. they rarely stop swimming.,active +4805,yellowfin tuna,Oceanic tuna,Salt Water,ocean,Spring | Summer | Fall | Winter,Any,Any,Any,Rare,1,15,80,16,36,0.82,,,,yellowfin are named for their bright yellow fins and finlets. large schools often gather with other open-ocean hunters.,active +4901,common octopus,Octopuses,Salt Water,ocean,Spring | Summer | Fall | Winter,Night,Any,Any,Uncommon,0.65,0.2,22,7,18,0.87,,,,common octopuses squeeze through narrow cracks and solve problems while hunting reefs. skin cells rapidly change color and texture.,inactive +4902,day octopus,Octopuses,Salt Water,ocean,Spring | Summer | Fall | Winter,Day,Any,Forbidden,Rare,0.24,0.2,15,15,36,0.88,,,,"day octopuses forage across tropical reefs while the sun is high. shifting bars and spots communicate alarm, camouflage, and threat.",inactive +4903,giant Pacific octopus,Octopuses,Salt Water,ocean,Spring | Summer | Fall | Winter,Night,Any,Required,Epic,0.1,5,200,28,70,0.81,,,,giant pacific octopuses explore cold rocky dens with thousands of arm suckers. females guard their eggs without feeding until they hatch.,inactive +4904,greater blue-ringed octopus,Octopuses,Salt Water,ocean,Spring | Summer | Fall | Winter,Day,Required,Any,Legendary,0.04,0.05,0.3,38,82,0.96,,,,greater blue-ringed octopuses reveal vivid rings when threatened. a tiny beak can deliver venom strong enough to stop breathing.,inactive +5001,sunfish,Open-ocean giants,Salt Water,ocean,Spring | Summer | Fall,Day,Any,Any,Common,7,0.4,2.5,3,3,1,,,,ocean sunfish are built more like enormous swimming heads than ordinary fish. they visit the surface and turn sideways to warm up.,active +5101,barndoor skate,Rays and skates,Salt Water,ocean,Spring | Fall | Winter,Any,Any,Required,Epic,0.1,5,150,28,68,0.8,,,,barndoor skates glide over cold atlantic bottoms with broad wing-like fins. rows of thorny spines protect the back and tail.,inactive +5102,giant manta ray,Rays and skates,Salt Water,ocean,Spring | Summer | Fall | Winter,Day,Any,Forbidden,Legendary,0.025,100,1000,65,150,0.76,,,,giant manta rays funnel plankton into wide mouths with two flexible head fins. each belly carries a unique pattern of dark spots.,inactive +5103,largetooth sawfish,Rays and skates,Salt Water,ocean,Spring | Summer | Fall | Winter,Night,Required,Any,Legendary,0.035,25,1300,58,135,0.78,,,,largetooth sawfish detect hidden prey with a long sensory rostrum. a swift sideways sweep stuns fish and exposes animals buried in mud.,inactive +5104,ocellate river stingray,Rays and skates,Fresh Water,river,Spring | Summer | Fall | Winter,Day,Required,Any,Epic,0.09,2,35,28,65,0.82,,,,ocellate river stingrays carry bright eye-like spots across a round disc. they hide beneath sand in south american rivers.,inactive +5105,southern stingray,Rays and skates,Salt Water,ocean,Spring | Summer | Fall | Winter,Day,Any,Any,Rare,0.23,2,80,15,40,0.82,,,,southern stingrays bury in warm sand with only their eyes and spiracles visible. crushing plates break open clams and crustaceans.,inactive +5201,red lionfish,Reef ambush fish,Salt Water,ocean,Spring | Summer | Fall | Winter,Night,Any,Any,Rare,0.3,0.2,3,11,25,0.92,,,,red lionfish spread ornate venomous spines when threatened. broad fins herd smaller fish into corners before a rapid gulp.,inactive +5202,red scorpionfish,Reef ambush fish,Salt Water,ocean,Spring | Summer | Fall | Winter,Night,Any,Any,Rare,0.3,0.2,7,11,25,0.9,,,,red scorpionfish vanish against rocky reefs through mottled color and skin flaps. venomous dorsal spines punish careless predators.,inactive +5301,green moray,Reef eels,Salt Water,ocean,Spring | Summer | Fall | Winter,Night,Any,Any,Rare,0.28,1,30,13,32,0.86,,,,green morays appear green because yellow mucus coats blue-gray skin. a second set of jaws pulls captured prey deeper into the throat.,inactive +5401,peacock flounder,Reef flatfish,Salt Water,ocean,Spring | Summer | Fall | Winter,Day,Any,Any,Rare,0.3,0.2,5,11,24,0.9,,,,peacock flounders change their spots and colors to match tropical sand. both eyes scan above while the flat body remains concealed.,inactive +5501,blue tang,Reef grazers,Salt Water,ocean,Spring | Summer | Fall | Winter,Day,Any,Any,Uncommon,0.9,0.05,1.5,5,11,0.95,,,,blue tangs graze algae from coral reefs with small close-set teeth. sharp folding spines near the tail give surgeonfish their name.,inactive +5502,rainbow parrotfish,Reef grazers,Salt Water,ocean,Spring | Summer | Fall | Winter,Day,Any,Any,Epic,0.12,2,40,25,58,0.84,,,,rainbow parrotfish scrape algae from reefs with fused beak-like teeth. crushed coral passes through them and returns to the reef as sand.,inactive +5503,stoplight parrotfish,Reef grazers,Salt Water,ocean,Spring | Summer | Fall | Winter,Day,Any,Any,Rare,0.28,0.5,15,12,29,0.88,,,,stoplight parrotfish change color dramatically as they mature. powerful dental plates bite algae from hard reef surfaces.,inactive +5504,yellow tang,Reef grazers,Salt Water,ocean,Spring | Summer | Fall | Winter,Day,Forbidden,Any,Rare,0.35,0.05,0.8,9,20,0.96,,,,yellow tangs browse algae across hawaiian reefs during daylight. at night their bright bodies darken and show a pale horizontal stripe.,inactive +5601,atlantic trumpetfish,Reef oddities,Salt Water,ocean,Spring | Summer | Fall | Winter,Day,Any,Any,Rare,0.3,0.1,2,10,24,0.94,,,,atlantic trumpetfish hover head-down among corals and sea fans. long tubular snouts expand suddenly to draw in small fish.,inactive +5602,gray triggerfish,Reef oddities,Salt Water,ocean,Spring | Summer | Fall | Winter,Day,Any,Any,Uncommon,0.8,0.3,12,7,17,0.88,,,,"gray triggerfish lock a stout dorsal spine upright when wedged into shelter. strong teeth crack barnacles, crabs, and shellfish.",inactive +5603,guineafowl puffer,Reef oddities,Salt Water,ocean,Spring | Summer | Fall | Winter,Day,Any,Any,Rare,0.3,0.2,5,11,26,0.9,,,,guineafowl puffers swallow water to inflate when threatened. adults may shift from a spotted dark pattern to a vivid yellow form.,inactive +5604,longhorn cowfish,Reef oddities,Salt Water,ocean,Spring | Summer | Fall | Winter,Day,Any,Required,Epic,0.13,0.1,2,23,52,0.94,,,,longhorn cowfish wear a rigid box of fused scales with horns above the eyes. small fins steer the angular body with surprising precision.,inactive +5605,queen triggerfish,Reef oddities,Salt Water,ocean,Spring | Summer | Fall | Winter,Day,Any,Forbidden,Rare,0.25,0.5,15,14,32,0.88,,,,queen triggerfish blow jets of water to uncover buried prey and flip sea urchins. vivid blue lines radiate across the face.,inactive +5606,red cornetfish,Reef oddities,Salt Water,ocean,Spring | Summer | Fall | Winter,Day,Any,Required,Epic,0.11,0.2,4,24,55,0.92,,,,red cornetfish stalk reefs with extremely long bodies and tubular snouts. a trailing filament extends from the center of the tail.,inactive +5607,spotted porcupinefish,Reef oddities,Salt Water,ocean,Spring | Summer | Fall | Winter,Night,Any,Required,Epic,0.12,0.5,7,24,54,0.9,,,,spotted porcupinefish inflate until long spines stand outward. fused teeth form a strong beak for crushing shelled prey.,inactive +5608,yellow boxfish,Reef oddities,Salt Water,ocean,Spring | Summer | Fall | Winter,Day,Any,Any,Rare,0.32,0.03,0.8,10,22,0.96,,,,yellow boxfish juveniles are bright cubes covered in black spots. rigid body armor leaves small fins to provide careful steering.,inactive +5701,copperband butterflyfish,Reef ornamentals,Salt Water,ocean,Spring | Summer | Fall | Winter,Day,Any,Forbidden,Rare,0.32,0.03,0.4,9,21,0.98,,,,copperband butterflyfish probe reef cracks with long narrow snouts. bold orange bands and a false eyespot confuse predators.,inactive +5702,ocellaris clownfish,Reef ornamentals,Salt Water,ocean,Spring | Summer | Fall | Winter,Day,Any,Any,Uncommon,1,0.01,0.15,5,10,1,,,,ocellaris clownfish shelter safely among stinging anemone tentacles. each group is led by a female that develops from the largest male.,inactive +5703,queen angelfish,Reef ornamentals,Salt Water,ocean,Spring | Summer | Fall | Winter,Day,Any,Any,Rare,0.3,0.1,2,11,25,0.94,,,,queen angelfish graze sponges from warm atlantic reefs. a blue-ringed spot on the forehead resembles a tiny crown.,inactive +5801,Atlantic goliath grouper,Reef predators,Salt Water,ocean,Spring | Summer | Fall | Winter,Any,Any,Required,Legendary,0.05,20,800,50,125,0.78,,,,"atlantic goliath groupers occupy reefs, wrecks, and mangrove roots. enormous mouths pull prey inward with a sudden pressure drop.",inactive +5802,bluefin trevally,Reef predators,Salt Water,ocean,Spring | Summer | Fall | Winter,Day,Any,Forbidden,Rare,0.3,1,25,14,32,0.86,,,,bluefin trevally hunt reef fish in coordinated groups. electric blue fins and scattered blue spots contrast with a golden body.,inactive +5803,giant grouper,Reef predators,Salt Water,ocean,Spring | Summer | Fall | Winter,Any,Any,Required,Legendary,0.045,20,880,52,128,0.78,,,,giant groupers become massive ambush predators around indo-pacific reefs. juveniles carry bold black-and-yellow markings.,inactive +5804,great barracuda,Reef predators,Salt Water,ocean,Spring | Summer | Fall | Winter,Day,Any,Required,Epic,0.12,5,80,28,65,0.82,,,,great barracudas hover motionless before accelerating toward prey. long jaws carry two distinct rows of sharp teeth.,inactive +5805,gulf grouper,Reef predators,Salt Water,ocean,Spring | Summer | Fall | Winter,Any,Any,Any,Uncommon,0.3,2,40,10,24,0.9,,,,gulf grouper are ambush predators that use a sudden gulp to pull prey into their cavernous mouths.,active +5806,Nassau grouper,Reef predators,Salt Water,ocean,Spring | Summer | Fall | Winter,Any,Any,Forbidden,Epic,0.12,2,55,25,62,0.82,,,,nassau groupers shift their bars and colors with mood and surroundings. adults gather at traditional reef sites to spawn.,inactive +5807,red grouper,Reef predators,Salt Water,ocean,Spring | Summer | Fall | Winter,Any,Any,Any,Rare,0.2,2,30,16,36,0.9,,,,red grouper excavate shelters in reef rubble. the hollows they make can become hiding places for many smaller animals.,active +5901,blue-green chromis,Reef schooling fish,Salt Water,ocean,Spring | Summer | Fall | Winter,Day,Any,Any,Common,2.8,0.01,0.25,2,4,1,,,,blue-green chromis form loose clouds above branching coral. the school dives into narrow shelter whenever a predator approaches.,inactive +5902,bluestriped grunt,Reef schooling fish,Salt Water,ocean,Spring | Summer | Fall | Winter,Day,Any,Any,Common,2,0.1,3,3,7,0.94,,,,bluestriped grunts shelter on reefs by day and spread over seagrass to feed at night. grinding throat teeth produce audible grunts.,inactive +5903,French grunt,Reef schooling fish,Salt Water,ocean,Spring | Summer | Fall | Winter,Day,Any,Any,Common,2,0.1,3.5,3,7,0.94,,,,french grunts gather in yellow-striped schools around reefs and wrecks. they travel into nearby sand and grass beds after dark.,inactive +5904,sergeant major,Reef schooling fish,Salt Water,ocean,Spring | Summer | Fall | Winter,Day,Any,Any,Common,2.5,0.02,0.5,2,5,0.98,,,,sergeant majors guard purple egg patches on hard reef surfaces. five dark bars cross their yellow and silver bodies.,inactive +6001,lane snapper,Reef snapper,Salt Water,ocean,Spring | Summer | Fall | Winter,Any,Any,Any,Common,0.45,0.5,5,5,11,0.9,,,,lane snapper use reef structure for cover and hunt small crustaceans and fish when the light begins to fade.,active +6002,mangrove snapper,Reef snapper,Salt Water,ocean,Spring | Summer | Fall | Winter,Any,Any,Any,Uncommon,0.35,0.5,12,7,16,0.9,,,,"mangrove snapper shelter among roots and docks when young, then move toward reefs as they grow.",active +6003,mutton snapper,Reef snapper,Salt Water,ocean,Spring | Summer | Fall | Winter,Any,Any,Any,Rare,0.2,2,30,12,28,0.9,,,,"mutton snapper have canine teeth that help them pick crabs, shrimp, and other hard-shelled prey from the reef.",active +6004,red snapper,Reef snapper,Salt Water,ocean,Spring | Summer | Fall | Winter,Any,Any,Any,Uncommon,0.35,1,25,8,19,0.9,,,,"red snapper gather around reefs, wrecks, and ledges. their diet includes small fish, shrimp, and squid.",active +6101,ballan wrasse,Reef wrasses,Salt Water,ocean,Spring | Summer | Fall | Winter,Day,Any,Any,Uncommon,0.8,0.2,10,6,15,0.9,,,,ballan wrasse crush shellfish and sea urchins with strong throat teeth. thick lips and mottled colors suit rocky european reefs.,inactive +6102,cleaner wrasse,Reef wrasses,Salt Water,ocean,Spring | Summer | Fall | Winter,Day,Any,Forbidden,Rare,0.35,0.01,0.2,9,20,1,,,,cleaner wrasses advertise with a bright stripe and dance at reef stations. larger fish wait while parasites are picked from skin and gills.,inactive +6103,hogfish,Reef wrasses,Salt Water,ocean,Spring | Summer | Fall | Winter,Day,Any,Any,Rare,0.3,0.5,20,12,30,0.86,,,,hogfish root through sand with long pig-like snouts in search of shellfish. adults can change from female to male as social groups shift.,inactive +6201,green sea turtle,Sea turtles,Salt Water,ocean,Summer | Fall,Day,Any,Forbidden,Legendary,0.018,65,500,62,145,0.78,,,,green sea turtles graze seagrass meadows with finely serrated jaws. adults migrate long distances between feeding and nesting grounds.,inactive +6202,hawksbill sea turtle,Sea turtles,Salt Water,ocean,Summer | Fall,Day,Required,Any,Legendary,0.014,75,250,66,150,0.8,,,,hawksbill sea turtles reach into reef crevices with narrow hooked beaks. a diet rich in sponges helps shape coral communities.,inactive +6203,leatherback sea turtle,Sea turtles,Salt Water,ocean,Spring | Summer | Fall | Winter,Night,Any,Required,Legendary,0.012,500,2000,75,175,0.76,,,,leatherback sea turtles cross entire oceans while hunting jellies. a flexible ridged shell and internal heat help them enter cold water.,inactive +6204,loggerhead sea turtle,Sea turtles,Salt Water,ocean,Summer | Fall,Day,Any,Any,Legendary,0.016,150,1200,68,155,0.77,,,,loggerhead sea turtles crush crabs and mollusks with massive jaws. females often return near their birth beaches to nest.,inactive +6301,leafy seadragon,Seahorses and seadragons,Salt Water,ocean,Spring | Summer | Fall | Winter,Day,Any,Forbidden,Epic,0.1,0.1,0.5,24,55,0.94,,,,leafy seadragons drift among seaweed with elaborate skin lobes that resemble leaves. males carry eggs beneath the tail.,inactive +6302,weedy seadragon,Seahorses and seadragons,Salt Water,ocean,Spring | Summer | Fall | Winter,Day,Any,Required,Rare,0.22,0.1,0.6,16,38,0.93,,,,weedy seadragons rely on slender bodies and small leaf-like lobes for camouflage. males brood rows of eggs on the underside of the tail.,inactive +6401,black-lip pearl oyster,Shellfish,Salt Water,ocean,Spring | Summer | Fall | Winter,Day,Any,Any,Rare,0.22,0.1,5,14,40,0.91,,,,black-lip pearl oysters line their shells with dark-edged nacre. a trapped irritant can become coated in the same pearly material.,inactive +6402,giant clam,Shellfish,Salt Water,ocean,Spring | Summer | Fall | Winter,Day,Any,Forbidden,Epic,0.1,5,500,28,72,0.8,,,,giant clams host photosynthetic algae inside brightly colored mantles. heavy shells remain anchored to one reef spot throughout adulthood.,inactive +6403,Pacific geoduck,Shellfish,Salt Water,ocean,Spring | Summer | Fall | Winter,Day,Any,Required,Rare,0.25,0.5,15,14,34,0.88,,,,pacific geoducks bury their shells deep while a long siphon reaches the seafloor. these clams can survive for well over a century.,inactive +6404,queen conch,Shellfish,Salt Water,ocean,Spring | Summer | Fall | Winter,Day,Any,Forbidden,Rare,0.24,1,5,15,36,0.91,,,,queen conchs graze algae with a long flexible snout. adults develop a broad flared shell lip and move by vaulting on one muscular foot.,inactive +6405,red abalone,Shellfish,Salt Water,ocean,Spring | Summer | Fall | Winter,Day,Any,Required,Epic,0.09,0.2,12,24,56,0.88,,,,red abalones cling to pacific rocks with broad muscular feet. rows of shell holes release water that has passed over the gills.,inactive +6501,bigfin reef squid,Squid,Salt Water,ocean,Spring | Summer | Fall | Winter,Day,Any,Forbidden,Rare,0.3,0.2,5,13,30,0.91,,,,bigfin reef squid hover in coordinated groups around warm reefs. shifting colors and body patterns signal to nearby squid.,inactive +6502,colossal squid,Squid,Salt Water,ocean,Spring | Summer | Fall | Winter,Night,Required,Any,Legendary,0.015,400,1100,82,190,0.76,,,,colossal squid carry swiveling hooks on their arms and tentacles. enormous eyes gather faint light in the deep southern ocean.,inactive +6503,giant squid,Squid,Salt Water,ocean,Spring | Summer | Fall | Winter,Night,Any,Required,Legendary,0.02,100,600,70,165,0.77,,,,giant squid hunt deep ocean prey with two long feeding tentacles. the largest eyes in the animal world watch for movement in darkness.,inactive +6504,Humboldt squid,Squid,Salt Water,ocean,Spring | Summer | Fall | Winter,Night,Any,Any,Epic,0.09,5,110,26,64,0.82,,,,humboldt squid flash red and white while hunting in large groups. powerful beaks and grasping suckers handle fish and other squid.,inactive +6601,ballyhoo,Surface ocean fish,Salt Water,ocean,Spring | Summer | Fall | Winter,Day,Any,Any,Common,2.5,0.05,1,2,5,0.98,,,,ballyhoo skim warm ocean surfaces with an extended lower jaw. tight schools scatter into quick leaps when predators strike.,inactive +6602,houndfish,Surface ocean fish,Salt Water,ocean,Spring | Summer | Fall | Winter,Day,Any,Any,Rare,0.3,0.5,10,11,25,0.88,,,,houndfish hunt near the surface with long jaws filled with fine teeth. powerful leaps can carry their narrow bodies far above the water.,inactive +6603,tropical flyingfish,Surface ocean fish,Salt Water,ocean,Spring | Summer | Fall | Winter,Day,Forbidden,Any,Rare,0.35,0.05,1.5,10,22,0.94,,,,tropical flyingfish accelerate underwater before spreading enlarged fins above the surface. glides help them escape pursuing predators.,inactive +6701,striped bass,Temperate coastal,Salt Water,ocean,Spring | Fall,Any,Any,Any,Uncommon,4,1.5,8,7,7,0.9,,,,"striped bass split their lives between salt and fresh water, returning upriver to spawn. a long-lived striper may see three decades.",active +6801,atlantic croaker,Temperate estuary,Salt Water,ocean,Spring | Summer | Fall,Night,Required,Any,Common,2.1,0.1,5,3,8,0.92,,,,atlantic croakers vibrate muscles against the swim bladder to make a croaking sound. chin barbels locate worms in sandy bays.,inactive +6802,black drum,Temperate estuary,Salt Water,ocean,Spring | Summer | Fall,Night,Any,Any,Uncommon,0.7,1,70,8,27,0.82,,,,black drum crush oysters and crabs with rounded throat teeth. large adults develop dark vertical bars that fade with age.,inactive +6803,red drum,Temperate estuary,Salt Water,ocean,Spring | Summer | Fall,Any,Required,Any,Uncommon,0.75,1,45,8,23,0.84,,,,red drum use powerful tails to patrol surf and estuaries. one or more black spots near the tail may confuse predators about which end is the head.,inactive +6804,striped mullet,Temperate estuary,Fresh Water | Salt Water,ocean,Spring | Summer | Fall,Day,Any,Any,Common,2.5,0.3,8,3,8,0.92,,,,striped mullet leap clear of the water and travel in coastal schools. they graze algae and detritus with specialized digestive systems.,inactive +6805,weakfish,Temperate estuary,Salt Water,ocean,Spring | Summer | Fall,Night,Any,Required,Rare,0.32,0.5,18,12,29,0.86,,,,weakfish are named for delicate mouth tissue that tears easily around a hook. iridescent spots scatter across their bronze backs.,inactive +6806,white perch,Temperate estuary,Fresh Water | Salt Water,river,Spring | Summer | Fall,Any,Any,Any,Uncommon,1.1,0.2,3.5,5,11,0.9,,,,white perch tolerate fresh and brackish water along the atlantic coast. deep silver bodies gather in schools around river mouths.,inactive +6807,yellowfin croaker,Temperate estuary,Salt Water,ocean,Spring | Summer | Fall,Any,Any,Any,Common,2,0.1,4,3,8,0.92,,,,yellowfin croakers search sandy surf zones with a small chin barbel. internal muscles produce croaks and drumming calls.,inactive +6901,black rockfish,Temperate reef fish,Salt Water,ocean,Spring | Fall | Winter,Any,Any,Any,Common,1.7,0.3,10,4,11,0.9,,,,"black rockfish gather above reefs and kelp along the north pacific coast. like other rockfish, they give birth to live young.",inactive +6902,black sea bass,Temperate reef fish,Salt Water,ocean,Spring | Fall | Winter,Day,Any,Any,Common,1.7,0.3,8,4,10,0.9,,,,"black sea bass shelter around reefs, piers, and wrecks. many begin life as female and later become male.",inactive +6903,canary rockfish,Temperate reef fish,Salt Water,ocean,Spring | Fall | Winter,Day,Any,Any,Uncommon,0.7,0.5,12,7,17,0.88,,,,canary rockfish glow orange-yellow over deep pacific reefs. these long-lived fish mature slowly and give birth to live young.,inactive +6904,scup,Temperate reef fish,Salt Water,ocean,Spring | Fall | Winter,Day,Any,Any,Common,2.2,0.1,5,3,8,0.92,,,,"scup use small strong teeth to crush shellfish and other bottom prey. deep silver bodies gather around piers, reefs, and eelgrass.",inactive +6905,sheepshead,Temperate reef fish,Salt Water,ocean,Spring | Fall | Winter,Day,Any,Any,Uncommon,0.75,0.5,20,7,18,0.86,,,,sheepshead carry flat human-like front teeth for biting barnacles and crabs. dark bars cross their high silver bodies.,inactive +6906,tautog,Temperate reef fish,Salt Water,ocean,Spring | Fall | Winter,Day,Any,Any,Uncommon,0.8,0.5,20,7,18,0.86,,,,tautog pry mussels and crabs from rocky structure with thick lips and strong teeth. adults return to familiar shelters year after year.,inactive +6907,yelloweye rockfish,Temperate reef fish,Salt Water,ocean,Spring | Fall | Winter,Any,Any,Required,Epic,0.09,2,35,28,64,0.84,,,,yelloweye rockfish can live for more than a century on deep pacific reefs. bright golden eyes stand out against orange-red bodies.,inactive +7001,lingcod,Temperate reef predators,Salt Water,ocean,Spring | Fall | Winter,Any,Any,Any,Rare,0.25,2,60,14,38,0.83,,,,"lingcod guard rocky dens and ambush fish with a huge tooth-lined mouth. despite the name, they are greenling relatives rather than cod.",inactive +7101,milkfish,Tropical coastal fish,Salt Water,ocean,Spring | Summer | Fall | Winter,Day,Any,Any,Common,1.8,0.5,25,4,12,0.88,,,,milkfish graze algae and tiny organisms in warm coastal shallows. deeply forked tails drive large schools through lagoons and estuaries.,inactive +7201,roosterfish,Tropical coastal predators,Salt Water,ocean,Spring | Summer | Fall | Winter,Day,Any,Any,Epic,0.11,5,100,30,70,0.82,,,,roosterfish raise seven long dorsal spines while chasing prey through tropical surf. dark bands cross their sleek silver bodies.,inactive +7301,atlantic tarpon,Tropical estuary,Fresh Water | Salt Water,ocean,Spring | Summer | Fall | Winter,Any,Required,Any,Epic,0.09,10,180,34,82,0.8,,,,atlantic tarpon gulp air with a lung-like swim bladder when coastal water runs low on oxygen. giant silver scales flash during leaps.,inactive +7302,barramundi,Tropical estuary,Fresh Water | Salt Water,river,Spring | Summer | Fall | Winter,Night,Required,Any,Rare,0.24,2,45,15,38,0.84,,,,barramundi move between rivers and coasts and can breathe in low-oxygen water. many mature first as males and later become females.,inactive +7303,common snook,Tropical estuary,Salt Water,ocean,Spring | Summer | Fall | Winter,Night,Required,Any,Rare,0.3,1,30,13,32,0.85,,,,common snook wait around mangrove roots and current seams to ambush prey. a bold black lateral line divides their silver flanks.,inactive +7401,bonefish,Tropical flats fish,Salt Water,ocean,Spring | Summer | Fall | Winter,Day,Any,Forbidden,Rare,0.25,0.5,15,13,31,0.86,,,,bonefish sweep tropical flats in silvery schools and root for buried prey. their speed and pale bodies make them difficult to follow in shallow water.,inactive +7402,Florida pompano,Tropical flats fish,Salt Water,ocean,Spring | Summer | Fall | Winter,Day,Any,Forbidden,Uncommon,0.85,0.5,9,7,16,0.88,,,,"florida pompano search warm surf for crabs, clams, and sand fleas. short blunt snouts lead into deep, silvery bodies.",inactive +7403,ladyfish,Tropical flats fish,Salt Water,ocean,Spring | Summer | Fall | Winter,Day,Required,Any,Common,1.7,0.2,8,4,10,0.9,,,,ladyfish race through warm shallows after schooling prey and often leap when pursued. a deeply forked tail powers their slender bodies.,inactive +7404,permit,Tropical flats fish,Salt Water,ocean,Spring | Summer | Fall | Winter,Day,Forbidden,Any,Epic,0.11,3,50,27,62,0.84,,,,permit browse tropical flats for crabs and shellfish with rubbery mouths. tall silver bodies carry long sickle-shaped dorsal and anal fins.,inactive +7501,clown knifefish,Tropical freshwater fish,Fresh Water,river,Spring | Summer | Fall | Winter,Night,Any,Required,Rare,0.25,1,25,16,38,0.86,,,,clown knifefish undulate one long belly fin to glide forward or backward. dark eye-like spots line their silver nocturnal bodies.,inactive +7502,clown loach,Tropical freshwater fish,Fresh Water,river,Spring | Summer | Fall | Winter,Day,Required,Any,Rare,0.32,0.1,2,10,22,0.9,,,,clown loaches rest in groups and make clicking sounds while feeding. orange bodies carry three broad black bands and small eye spines.,inactive +7503,discus,Tropical freshwater fish,Fresh Water,river,Spring | Summer | Fall | Winter,Day,Any,Required,Epic,0.12,0.1,1,24,52,0.92,,,,"discus move through quiet amazon backwaters with round, flattened bodies. parents feed newly hatched young with nutrient-rich skin mucus.",inactive +7504,freshwater angelfish,Tropical freshwater fish,Fresh Water,river,Spring | Summer | Fall | Winter,Day,Any,Any,Rare,0.3,0.05,0.5,10,22,0.95,,,,freshwater angelfish slip between tall plants on narrow triangular bodies. long fins and vertical bars resemble stems and shadows.,inactive +7505,giant gourami,Tropical freshwater fish,Fresh Water,lake,Spring | Summer | Fall | Winter,Day,Any,Any,Rare,0.25,2,20,13,31,0.86,,,,giant gouramis breathe surface air through a specialized labyrinth organ. adults graze plants but also investigate insects and small animals.,inactive +7506,Nile tilapia,Tropical freshwater fish,Fresh Water,lake,Spring | Summer | Fall | Winter,Day,Any,Any,Common,2.2,0.3,8,3,9,0.9,,,,nile tilapia thrive in warm lakes and rivers on a varied diet. females protect eggs and young inside their mouths.,inactive +7507,oscar,Tropical freshwater fish,Fresh Water,river,Spring | Summer | Fall | Winter,Day,Any,Any,Uncommon,0.8,0.3,4,6,14,0.9,,,,oscars are large south american cichlids that recognize routines and defend territories. a tail eyespot may redirect attacks away from the head.,inactive +7508,Siamese fighting fish,Tropical freshwater fish,Fresh Water,pond,Spring | Summer | Fall | Winter,Day,Required,Any,Uncommon,1,0.01,0.15,5,10,1,,,,siamese fighting fish breathe surface air with a labyrinth organ. males build bubble nests and guard the eggs beneath them.,inactive +7509,tambaqui,Tropical freshwater fish,Fresh Water,river,Spring | Summer | Fall | Winter,Day,Required,Any,Epic,0.1,8,80,30,68,0.82,,,,tambaqui follow seasonal floods into forests to feed on fruit and seeds. strong square teeth crack tough plant material.,inactive +7510,walking catfish,Tropical freshwater fish,Fresh Water,pond,Spring | Summer | Fall | Winter,Night,Required,Any,Rare,0.3,0.5,5,11,24,0.9,,,,walking catfish wriggle across wet ground using stiff pectoral spines for support. an air-breathing organ helps them survive the journey.,inactive +7601,giant snakehead,Tropical freshwater predators,Fresh Water,river,Spring | Summer | Fall | Winter,Night,Any,Required,Epic,0.1,3,45,28,64,0.84,,,,giant snakeheads breathe air and guard schools of young near the surface. long bodies launch sudden attacks from flooded vegetation.,inactive +7602,golden dorado,Tropical freshwater predators,Fresh Water,river,Spring | Summer | Fall | Winter,Day,Required,Any,Epic,0.1,5,55,29,66,0.82,,,,"golden dorado chase fish through powerful south american rivers. muscular tails, heavy jaws, and golden scales suit life in fast current.",inactive +7603,golden mahseer,Tropical freshwater predators,Fresh Water,river,Spring | Summer | Fall | Winter,Day,Required,Any,Epic,0.09,8,90,32,72,0.82,,,,golden mahseer migrate through swift mountain rivers to reach spawning grounds. large scales shine bronze beneath reddish fins.,inactive +7604,peacock bass,Tropical freshwater predators,Fresh Water,river,Spring | Summer | Fall | Winter,Day,Any,Any,Rare,0.25,1,25,15,36,0.84,,,,peacock bass are aggressive south american cichlids rather than true bass. adults guard nests and hunt fish in warm clear water.,inactive +7605,red-bellied piranha,Tropical freshwater predators,Fresh Water,river,Spring | Summer | Fall | Winter,Any,Required,Any,Rare,0.3,0.2,4,12,27,0.9,,,,"red-bellied piranhas communicate with barks and drum-like sounds. schools provide protection as they search for fish, insects, and carrion.",inactive +7606,silver arowana,Tropical freshwater predators,Fresh Water,river,Spring | Summer | Fall | Winter,Day,Any,Required,Epic,0.11,1,15,25,56,0.86,,,,silver arowanas patrol the surface with upturned mouths and long bodies. powerful jumps capture insects and small animals above the water.,inactive +7701,blue whale,Whales and dolphins,Salt Water,ocean,Spring | Summer | Fall | Winter,Day,Any,Forbidden,Legendary,0.005,100000,330000,120,300,0.72,,,,blue whales are the largest animals known to have lived. pleated throats expand around vast mouthfuls of water that baleen filters for krill.,inactive +7702,common bottlenose dolphin,Whales and dolphins,Salt Water,ocean,Spring | Summer | Fall | Winter,Day,Any,Forbidden,Legendary,0.012,330,1400,75,180,0.76,,,,"common bottlenose dolphins coordinate with whistles, clicks, and body signals. echolocation reveals prey hidden in dark or cloudy water.",inactive +7703,humpback whale,Whales and dolphins,Salt Water,ocean,Spring | Fall | Winter,Day,Any,Required,Legendary,0.008,40000,90000,105,260,0.73,,,,humpback whales use long pectoral fins while turning and feeding. males produce layered songs that change across breeding seasons.,inactive +7704,killer whale,Whales and dolphins,Salt Water,ocean,Spring | Fall | Winter,Day,Required,Any,Legendary,0.008,3000,12000,95,230,0.74,,,,killer whales live in close family groups with distinct calls and hunting traditions. different populations specialize in different prey.,inactive +7705,sperm whale,Whales and dolphins,Salt Water,ocean,Spring | Summer | Fall | Winter,Night,Any,Required,Legendary,0.006,15000,125000,115,280,0.72,,,,sperm whales make deep dives to hunt squid with powerful echolocation clicks. their enormous square heads contain a waxy spermaceti organ.,inactive diff --git a/drawing/surface_drawing_canvas.gd b/drawing/surface_drawing_canvas.gd index f6ceb94..01d34d7 100644 --- a/drawing/surface_drawing_canvas.gd +++ b/drawing/surface_drawing_canvas.gd @@ -2,7 +2,6 @@ class_name SurfaceDrawingCanvas extends Node3D const GUIDED_PIXEL_FILL: float = 0.88 -const FINISHED_PIXEL_FILL: float = 1.0 const SURFACE_OFFSET: float = 0.012 const LAYER_OFFSET_STEP: float = 0.0002 const SURFACE_SAMPLE_DEPTH: float = 0.45 @@ -13,13 +12,17 @@ var grid_height: int = 0 var cell_size: float = 0.0 var revision: int = -1 var creator_fingerprint: String = "" +var participant_fingerprints: Array[String] = [] var _surface_origin: Vector3 var _surface_normal: Vector3 var _surface_tangent: Vector3 var _surface_bitangent: Vector3 var _cells: Dictionary[int, Dictionary] = {} -var _color_meshes: Dictionary[StringName, MultiMeshInstance3D] = {} +var _cell_surface_transforms: Array[Transform3D] = [] +var _pixel_image: Image +var _pixel_texture: ImageTexture +var _pixel_instance: MeshInstance3D var _grid_instance: MeshInstance3D var _guide_visible: bool = true var _finalized: bool = false @@ -42,6 +45,7 @@ func setup( cell_size = float(data["cell_size"]) revision = int(data["revision"]) creator_fingerprint = str(data["creator_fingerprint"]) + participant_fingerprints = _participants_from_state(data) _finalized = bool(data.get("finalized", false)) _guide_visible = bool(data.get("guide_visible", true)) and not _finalized _layer = int(data.get("layer", 0)) @@ -65,7 +69,7 @@ func setup( var cell: Dictionary = cell_value _cells[_cell_key(int(cell["x"]), int(cell["y"]))] = cell.duplicate(true) _build_grid() - _rebuild_pixels() + _build_pixel_renderer() return true @@ -83,8 +87,15 @@ func apply_update(data: Dictionary) -> bool: _cells.erase(key) else: _cells[key] = edit.duplicate(true) + participant_fingerprints = _participants_from_update( + data, participant_fingerprints + ) revision = int(data["revision"]) - _rebuild_pixels() + if is_hidden_by_relationship(): + _rebuild_pixel_image() + else: + _apply_pixel_edits(data["edits"]) + _refresh_grid_visibility() return true @@ -96,15 +107,32 @@ func apply_guide_update(data: Dictionary) -> bool: ): return false revision = int(data["revision"]) + participant_fingerprints = _participants_from_update( + data, participant_fingerprints + ) _finalized = bool(data["finalized"]) _guide_visible = bool(data["guide_visible"]) and not _finalized - _refresh_grid_visibility() - _rebuild_pixels() + if _finalized: + _destroy_grid() + else: + _refresh_grid_visibility() return true func refresh_relationship_visibility() -> void: - _rebuild_pixels() + _rebuild_pixel_image() + if _pixel_instance != null: + _pixel_instance.visible = not is_hidden_by_relationship() + _refresh_grid_visibility() + + +func is_hidden_by_relationship() -> bool: + if _relationships == null: + return false + for fingerprint: String in participant_fingerprints: + if _relationships.is_blocked(fingerprint): + return true + return false func set_stencil_visible(should_be_visible: bool) -> void: @@ -121,7 +149,27 @@ func is_finalized() -> bool: func get_rendered_pixel_size() -> float: - return cell_size * _pixel_fill() + return cell_size + + +func get_rendered_pixel_count() -> int: + if is_hidden_by_relationship(): + return 0 + var count: int = 0 + for cell: Dictionary in _cells.values(): + if not _visible_cell_color(cell).is_equal_approx(Color.TRANSPARENT): + count += 1 + return count + + +func get_export_image() -> Image: + if _pixel_image == null or _pixel_image.is_empty(): + return null + return _pixel_image.duplicate() as Image + + +func has_guide_geometry() -> bool: + return _grid_instance != null and is_instance_valid(_grid_instance) func contains_world_point(world_point: Vector3, tolerance: float = 0.3) -> bool: @@ -192,7 +240,18 @@ func get_cell_surface_transform( ) -> Transform3D: if x < 0 or x >= grid_width or y < 0 or y >= grid_height: return Transform3D.IDENTITY - return global_transform * _sample_cell_transform(x, y, fill) + var key: int = _cell_key(x, y) + var local_transform: Transform3D = ( + _cell_surface_transforms[key] + if key >= 0 and key < _cell_surface_transforms.size() + else _sample_cell_transform(x, y, 1.0) + ) + var scaled_basis: Basis = local_transform.basis + var resolved_fill: float = clampf(fill, 0.05, 1.0) + scaled_basis.x *= resolved_fill + scaled_basis.y *= resolved_fill + local_transform.basis = scaled_basis + return global_transform * local_transform func get_authoritative_cells() -> Array[Dictionary]: @@ -210,6 +269,9 @@ func get_authoritative_cells() -> Array[Dictionary]: func _build_grid() -> void: if _grid_instance != null: _grid_instance.queue_free() + _grid_instance = null + if _finalized: + return var immediate := ImmediateMesh.new() var material := StandardMaterial3D.new() material.shading_mode = BaseMaterial3D.SHADING_MODE_UNSHADED @@ -219,6 +281,7 @@ func _build_grid() -> void: immediate.surface_begin(Mesh.PRIMITIVE_LINES, material) var half_width: float = float(grid_width) * cell_size * 0.5 var half_height: float = float(grid_height) * cell_size * 0.5 + var sampled_vertices: Dictionary[Vector2i, Dictionary] = {} for x: int in range(grid_width + 1): var horizontal: float = -half_width + float(x) * cell_size for y_segment: int in range(grid_height): @@ -229,11 +292,15 @@ func _build_grid() -> void: immediate, _surface_origin + _surface_tangent * horizontal + _surface_bitangent * start_vertical, + Vector2i(x, y_segment), + sampled_vertices, ) _add_grid_vertex( immediate, _surface_origin + _surface_tangent * horizontal + _surface_bitangent * (start_vertical + cell_size), + Vector2i(x, y_segment + 1), + sampled_vertices, ) for y: int in range(grid_height + 1): var vertical: float = -half_height + float(y) * cell_size @@ -245,12 +312,16 @@ func _build_grid() -> void: immediate, _surface_origin + _surface_tangent * start_horizontal + _surface_bitangent * vertical, + Vector2i(x_segment, y), + sampled_vertices, ) _add_grid_vertex( immediate, _surface_origin + _surface_tangent * (start_horizontal + cell_size) + _surface_bitangent * vertical, + Vector2i(x_segment + 1, y), + sampled_vertices, ) immediate.surface_end() _grid_instance = MeshInstance3D.new() @@ -261,8 +332,16 @@ func _build_grid() -> void: _refresh_grid_visibility() -func _add_grid_vertex(immediate: ImmediateMesh, world_point: Vector3) -> void: - var sampled: Dictionary = _sample_surface(world_point) +func _add_grid_vertex( + immediate: ImmediateMesh, + world_point: Vector3, + grid_point: Vector2i, + sampled_vertices: Dictionary[Vector2i, Dictionary], +) -> void: + var sampled: Dictionary = sampled_vertices.get(grid_point, {}) + if sampled.is_empty(): + sampled = _sample_surface(world_point) + sampled_vertices[grid_point] = sampled var point: Vector3 = sampled["position"] var normal: Vector3 = sampled["normal"] immediate.surface_add_vertex( @@ -270,56 +349,130 @@ func _add_grid_vertex(immediate: ImmediateMesh, world_point: Vector3) -> void: ) -func _rebuild_pixels() -> void: - for instance: MultiMeshInstance3D in _color_meshes.values(): - instance.queue_free() - _color_meshes.clear() - var cells_by_color: Dictionary[StringName, Array] = {} - for cell: Dictionary in _cells.values(): - var author_fingerprint: String = str(cell.get("author_fingerprint", "")) - if ( - _relationships != null - and _relationships.is_blocked(author_fingerprint) - ): - continue - var color_id := StringName(str(cell.get("color_id", ""))) - if not SurfaceDrawingPalette.has_color(color_id): - continue - var color_cells: Array = cells_by_color.get(color_id, []) - color_cells.append(cell) - cells_by_color[color_id] = color_cells - for color_id: StringName in cells_by_color: - _create_color_mesh(color_id, cells_by_color[color_id]) - - -func _create_color_mesh(color_id: StringName, cells: Array) -> void: - if cells.is_empty(): - return - var quad := QuadMesh.new() - quad.size = Vector2.ONE +func _build_pixel_renderer() -> void: + if _pixel_instance != null: + _pixel_instance.queue_free() + _pixel_instance = null + var cell_count: int = grid_width * grid_height + var vertices := PackedVector3Array() + var texture_coordinates := PackedVector2Array() + var indices := PackedInt32Array() + vertices.resize(cell_count * 4) + texture_coordinates.resize(cell_count * 4) + indices.resize(cell_count * 6) + _cell_surface_transforms.clear() + _cell_surface_transforms.resize(cell_count) + for y: int in range(grid_height): + for x: int in range(grid_width): + var cell_index: int = _cell_key(x, y) + var surface_transform := _sample_cell_transform(x, y, 1.0) + _cell_surface_transforms[cell_index] = surface_transform + var center: Vector3 = surface_transform.origin + var horizontal: Vector3 = surface_transform.basis.x * 0.5 + var vertical: Vector3 = surface_transform.basis.y * 0.5 + var vertex_offset: int = cell_index * 4 + vertices[vertex_offset] = center - horizontal - vertical + vertices[vertex_offset + 1] = center + horizontal - vertical + vertices[vertex_offset + 2] = center + horizontal + vertical + vertices[vertex_offset + 3] = center - horizontal + vertical + var image_row: int = _image_y(y) + var u_min: float = float(x) / float(grid_width) + var u_max: float = float(x + 1) / float(grid_width) + var v_min: float = float(image_row) / float(grid_height) + var v_max: float = float(image_row + 1) / float(grid_height) + texture_coordinates[vertex_offset] = Vector2(u_min, v_max) + texture_coordinates[vertex_offset + 1] = Vector2(u_max, v_max) + texture_coordinates[vertex_offset + 2] = Vector2(u_max, v_min) + texture_coordinates[vertex_offset + 3] = Vector2(u_min, v_min) + var index_offset: int = cell_index * 6 + indices[index_offset] = vertex_offset + indices[index_offset + 1] = vertex_offset + 1 + indices[index_offset + 2] = vertex_offset + 2 + indices[index_offset + 3] = vertex_offset + indices[index_offset + 4] = vertex_offset + 2 + indices[index_offset + 5] = vertex_offset + 3 + _rebuild_pixel_image() + var arrays: Array = [] + arrays.resize(Mesh.ARRAY_MAX) + arrays[Mesh.ARRAY_VERTEX] = vertices + arrays[Mesh.ARRAY_TEX_UV] = texture_coordinates + arrays[Mesh.ARRAY_INDEX] = indices + var mesh := ArrayMesh.new() + mesh.add_surface_from_arrays(Mesh.PRIMITIVE_TRIANGLES, arrays) var material := StandardMaterial3D.new() material.shading_mode = BaseMaterial3D.SHADING_MODE_UNSHADED - material.albedo_color = SurfaceDrawingPalette.get_color(color_id) + material.albedo_color = Color.WHITE + material.albedo_texture = _pixel_texture + material.texture_filter = BaseMaterial3D.TEXTURE_FILTER_NEAREST + material.transparency = BaseMaterial3D.TRANSPARENCY_ALPHA_SCISSOR + material.alpha_scissor_threshold = 0.5 material.cull_mode = BaseMaterial3D.CULL_DISABLED - quad.material = material - var multimesh := MultiMesh.new() - multimesh.transform_format = MultiMesh.TRANSFORM_3D - multimesh.mesh = quad - multimesh.instance_count = cells.size() - for cell_index: int in range(cells.size()): - var cell: Dictionary = cells[cell_index] - multimesh.set_instance_transform( - cell_index, - _sample_cell_transform( - int(cell["x"]), int(cell["y"]), _pixel_fill() - ), + mesh.surface_set_material(0, material) + _pixel_instance = MeshInstance3D.new() + _pixel_instance.name = "ArtworkTexture" + _pixel_instance.mesh = mesh + _pixel_instance.cast_shadow = GeometryInstance3D.SHADOW_CASTING_SETTING_OFF + add_child(_pixel_instance) + _pixel_instance.visible = not is_hidden_by_relationship() + + +func _rebuild_pixel_image() -> void: + if ( + _pixel_image == null + or _pixel_image.get_width() != grid_width + or _pixel_image.get_height() != grid_height + ): + _pixel_image = Image.create( + grid_width, grid_height, false, Image.FORMAT_RGBA8 ) - var instance := MultiMeshInstance3D.new() - instance.name = "Pixels_%s" % color_id - instance.multimesh = multimesh - instance.cast_shadow = GeometryInstance3D.SHADOW_CASTING_SETTING_OFF - add_child(instance) - _color_meshes[color_id] = instance + _pixel_image.fill(Color.TRANSPARENT) + if not is_hidden_by_relationship(): + for cell: Dictionary in _cells.values(): + _set_image_cell(int(cell["x"]), int(cell["y"]), cell) + if _pixel_texture == null: + _pixel_texture = ImageTexture.create_from_image(_pixel_image) + else: + _pixel_texture.update(_pixel_image) + + +func _apply_pixel_edits(edits: Array) -> void: + if _pixel_image == null or _pixel_texture == null: + _rebuild_pixel_image() + return + for edit_value: Variant in edits: + var edit: Dictionary = edit_value + var x: int = int(edit["x"]) + var y: int = int(edit["y"]) + var cell: Dictionary = _cells.get(_cell_key(x, y), {}) + _set_image_cell(x, y, cell) + _pixel_texture.update(_pixel_image) + + +func _set_image_cell(x: int, y: int, cell: Dictionary) -> void: + if ( + _pixel_image == null + or x < 0 + or x >= grid_width + or y < 0 + or y >= grid_height + ): + return + _pixel_image.set_pixel(x, _image_y(y), _visible_cell_color(cell)) + + +func _visible_cell_color(cell: Dictionary) -> Color: + if cell.is_empty(): + return Color.TRANSPARENT + var color_id := StringName(str(cell.get("color_id", ""))) + return ( + SurfaceDrawingPalette.get_color(color_id) + if SurfaceDrawingPalette.has_color(color_id) + else Color.TRANSPARENT + ) + + +func _image_y(cell_y: int) -> int: + return grid_height - 1 - cell_y func _sample_cell_transform( @@ -376,17 +529,60 @@ func _sample_surface(expected: Vector3) -> Dictionary: return {"position": point, "normal": normal} -func _pixel_fill() -> float: - return GUIDED_PIXEL_FILL if _guide_visible else FINISHED_PIXEL_FILL - - func _surface_offset() -> float: return SURFACE_OFFSET + float(_layer) * LAYER_OFFSET_STEP +func _destroy_grid() -> void: + if _grid_instance == null: + return + _grid_instance.queue_free() + _grid_instance = null + + func _refresh_grid_visibility() -> void: if _grid_instance != null: - _grid_instance.visible = _stencil_requested_visible and _guide_visible + _grid_instance.visible = ( + _stencil_requested_visible + and _guide_visible + and not is_hidden_by_relationship() + ) + + +func _participants_from_state(data: Dictionary) -> Array[String]: + var result: Array[String] = [] + _append_participant(result, str(data.get("creator_fingerprint", ""))) + for value: Variant in data.get("participant_fingerprints", []): + _append_participant(result, str(value)) + for cell_value: Variant in data.get("cells", []): + var cell: Dictionary = cell_value + _append_participant( + result, str(cell.get("author_fingerprint", "")) + ) + return result + + +func _participants_from_update( + data: Dictionary, + fallback: Array[String], +) -> Array[String]: + var result: Array[String] = fallback.duplicate() + for value: Variant in data.get("participant_fingerprints", []): + _append_participant(result, str(value)) + for edit_value: Variant in data.get("edits", []): + var edit: Dictionary = edit_value + _append_participant( + result, str(edit.get("author_fingerprint", "")) + ) + return result + + +func _append_participant(result: Array[String], fingerprint: String) -> void: + if ( + NetworkIdentityCrypto.valid_fingerprint(fingerprint) + and fingerprint not in result + ): + result.append(fingerprint) func _cell_key(x: int, y: int) -> int: diff --git a/drawing/surface_drawing_protocol.gd b/drawing/surface_drawing_protocol.gd index 5ca4ae0..ff132f8 100644 --- a/drawing/surface_drawing_protocol.gd +++ b/drawing/surface_drawing_protocol.gd @@ -2,7 +2,7 @@ class_name SurfaceDrawingProtocol extends RefCounted const CAPABILITY: StringName = &"surface_drawing_v2" -const RELIABLE_CHANNEL: int = NetworkProtocol.ITEM_RELIABLE_CHANNEL +const RELIABLE_CHANNEL: int = NetworkProtocol.DRAWING_RELIABLE_CHANNEL const GRID_SIZES: Array[int] = [16, 32, 64, 128] const DEFAULT_GRID_SIZE: int = 16 const MAX_GRID_SIZE: int = 128 @@ -18,6 +18,9 @@ const MAX_CANVAS_ID_LENGTH: int = 64 const MAX_REQUEST_ID_LENGTH: int = 64 const MAX_STROKE_ID_LENGTH: int = 64 const MAX_SESSION_ID_LENGTH: int = 96 +# Sessions support up to 128 simultaneous players. Keep enough bounded history +# for a complete room turnover while never accepting unattributed edits. +const MAX_PARTICIPANTS: int = 256 const MAX_COORDINATE: float = 10000.0 @@ -64,6 +67,38 @@ static func validate_edit_request(data: Variant) -> bool: return true +static func validate_stamp_request(data: Variant) -> bool: + if typeof(data) != TYPE_DICTIONARY: + return false + var value: Dictionary = data + if ( + not _valid_common(value) + or not _valid_vector(value.get("origin")) + or not _valid_vector(value.get("normal")) + or not _valid_vector(value.get("tangent")) + or typeof(value.get("width")) != TYPE_INT + or int(value["width"]) not in GRID_SIZES + or typeof(value.get("height")) != TYPE_INT + or int(value["height"]) != int(value["width"]) + or typeof(value.get("cell_size")) not in [TYPE_FLOAT, TYPE_INT] + or not is_equal_approx(float(value["cell_size"]), CELL_SIZE) + or typeof(value.get("pixels")) != TYPE_PACKED_BYTE_ARRAY + ): + return false + var pixels: PackedByteArray = value["pixels"] + var expected_size: int = int(value["width"]) * int(value["height"]) + if pixels.size() != expected_size: + return false + var maximum_palette_index: int = SurfaceDrawingPalette.COLORS.size() + var painted_count: int = 0 + for palette_index: int in pixels: + if palette_index > maximum_palette_index: + return false + if palette_index > 0: + painted_count += 1 + return painted_count > 0 + + static func validate_guide_request(data: Variant) -> bool: if typeof(data) != TYPE_DICTIONARY: return false @@ -112,6 +147,9 @@ static func validate_canvas_state(data: Variant) -> bool: or not NetworkIdentityCrypto.valid_fingerprint( value.get("creator_fingerprint") ) + or not _valid_participant_fingerprints( + value.get("participant_fingerprints", []) + ) or typeof(value.get("cells")) != TYPE_ARRAY ): return false @@ -127,6 +165,13 @@ static func validate_canvas_state(data: Variant) -> bool: or int((cell_value as Dictionary)["y"]) >= grid_height ): return false + var participants: Array = value.get("participant_fingerprints", []) + if not participants.is_empty(): + if str(value["creator_fingerprint"]) not in participants: + return false + for cell_value: Variant in cells: + if str((cell_value as Dictionary)["author_fingerprint"]) not in participants: + return false return true @@ -143,6 +188,9 @@ static func validate_guide_update(data: Variant) -> bool: and int(value["revision"]) >= 1 and typeof(value.get("guide_visible")) == TYPE_BOOL and typeof(value.get("finalized")) == TYPE_BOOL + and _valid_participant_fingerprints( + value.get("participant_fingerprints", []) + ) ) @@ -160,6 +208,9 @@ static func validate_canvas_update(data: Variant) -> bool: or typeof(value.get("revision")) != TYPE_INT or int(value["revision"]) < 1 or typeof(value.get("edits")) != TYPE_ARRAY + or not _valid_participant_fingerprints( + value.get("participant_fingerprints", []) + ) ): return false var edits: Array = value["edits"] @@ -168,6 +219,18 @@ static func validate_canvas_update(data: Variant) -> bool: for edit_value: Variant in edits: if not validate_authoritative_cell(edit_value, true): return false + var participants: Array = value.get("participant_fingerprints", []) + if not participants.is_empty(): + for edit_value: Variant in edits: + var edit: Dictionary = edit_value + var author_fingerprint: String = str( + edit.get("author_fingerprint", "") + ) + if ( + not str(edit.get("color_id", "")).is_empty() + and author_fingerprint not in participants + ): + return false return true @@ -242,6 +305,26 @@ static func _valid_stroke_id(value: Variant) -> bool: ) +static func _valid_participant_fingerprints(value: Variant) -> bool: + if typeof(value) != TYPE_ARRAY: + return false + var fingerprints: Array = value + if fingerprints.size() > MAX_PARTICIPANTS: + return false + var seen: Dictionary[String, bool] = {} + for fingerprint_value: Variant in fingerprints: + if typeof(fingerprint_value) != TYPE_STRING: + return false + var fingerprint: String = str(fingerprint_value) + if ( + not NetworkIdentityCrypto.valid_fingerprint(fingerprint) + or seen.has(fingerprint) + ): + return false + seen[fingerprint] = true + return true + + static func _valid_vector(value: Variant) -> bool: if typeof(value) != TYPE_ARRAY: return false diff --git a/economy/art_shop_stock.gd b/economy/art_shop_stock.gd index ff84d09..ddd6f3c 100644 --- a/economy/art_shop_stock.gd +++ b/economy/art_shop_stock.gd @@ -24,6 +24,9 @@ const GRID_PRODUCTS: Array[StringName] = [ &"grid_64x", &"grid_128x", ] +const STAMP_PRODUCTS: Array[StringName] = [ + PlayerArtUnlocks.STAMP_PRODUCT_ID, +] static func get_price(product_id: StringName) -> int: @@ -44,6 +47,8 @@ static func get_display_name(product_id: StringName) -> String: var grid_size: int = PlayerArtUnlocks.grid_size_for_product(product_id) if grid_size > 0: return "%d×%d grid" % [grid_size, grid_size] + if product_id == PlayerArtUnlocks.STAMP_PRODUCT_ID: + return "Stamp tool" return "Unknown art supply" @@ -61,4 +66,6 @@ static func get_description(product_id: StringName) -> String: return "Unlocks the %d×%d grid in the Paint UI." % [ grid_size, grid_size, ] + if product_id == PlayerArtUnlocks.STAMP_PRODUCT_ID: + return "Unlocks saved artwork stamps in the Art Kit." return "" diff --git a/economy/fishing_shop_stock.gd b/economy/fishing_shop_stock.gd index e8104f4..b9d3eaf 100644 --- a/economy/fishing_shop_stock.gd +++ b/economy/fishing_shop_stock.gd @@ -11,6 +11,8 @@ const FISH_FINDER_ID: StringName = &"fish_finder" const MAGNET_ID: StringName = &"magnet" const BATTERIES_ID: StringName = &"batteries" const CRAB_NET_ID: StringName = &"crab_net" +const STANDARD_SHOVEL_ID: StringName = &"standard_shovel" +const FISHING_NET_ID: StringName = &"fishing_net" const ITEM_PRICES: Dictionary[StringName, int] = { &"worms": 1, @@ -28,6 +30,8 @@ const ITEM_PRICES: Dictionary[StringName, int] = { MAGNET_ID: 250, BATTERIES_ID: 15, CRAB_NET_ID: 50, + STANDARD_SHOVEL_ID: 75, + FISHING_NET_ID: 250, } const BAIT_UNLOCK_PRICES: Dictionary[StringName, int] = { &"snails": 400, @@ -49,6 +53,8 @@ const ITEM_ORDER: Array[StringName] = [ FISH_FINDER_ID, MAGNET_ID, CRAB_NET_ID, + STANDARD_SHOVEL_ID, + FISHING_NET_ID, &"coffee", &"energy_drink", &"snack", @@ -64,6 +70,10 @@ static func get_stock_item_ids() -> Array[StringName]: return ITEM_ORDER.duplicate() +static func get_stock_order_index(item_id: StringName) -> int: + return ITEM_ORDER.find(item_id) + + static func get_rod_stock( catalog: ItemCatalogType, ) -> Array[FishingRodDataType]: @@ -112,6 +122,8 @@ static func is_permanent_unlock( or item_id == FISH_FINDER_ID or item_id == MAGNET_ID or item_id == CRAB_NET_ID + or item_id == STANDARD_SHOVEL_ID + or item_id == FISHING_NET_ID or item is FishingRodDataType ) ) @@ -121,6 +133,10 @@ static func is_passive_supply(item_id: StringName) -> bool: return item_id == BATTERIES_ID +static func is_gathering_tool(item_id: StringName) -> bool: + return item_id == CRAB_NET_ID or item_id == STANDARD_SHOVEL_ID + + static func get_purchase_cost( item_id: StringName, quantity: int, diff --git a/economy/item_resale_policy.gd b/economy/item_resale_policy.gd new file mode 100644 index 0000000..299fc48 --- /dev/null +++ b/economy/item_resale_policy.gd @@ -0,0 +1,21 @@ +class_name ItemResalePolicy +extends RefCounted + +const FishingShopStockType = preload("res://economy/fishing_shop_stock.gd") +const ItemDataType = preload("res://items/item_data.gd") + + +static func is_sellable(item: ItemDataType) -> bool: + # Bait and lures live in their own tackle collection. Rods, tools, and + # utility gear are permanent equipment. The unified sell tray currently + # accepts ordinary consumable supplies only. + return item != null and item.is_available() and ( + item.category == ItemDataType.Category.CONSUMABLE + ) + + +static func get_unit_value(item: ItemDataType) -> int: + if not is_sellable(item): + return -1 + var purchase_price := FishingShopStockType.get_price(item.item_id) + return purchase_price / 2 if purchase_price >= 0 else -1 diff --git a/economy/item_resale_policy.gd.uid b/economy/item_resale_policy.gd.uid new file mode 100644 index 0000000..b8270b2 --- /dev/null +++ b/economy/item_resale_policy.gd.uid @@ -0,0 +1 @@ +uid://brsykj7darpyw diff --git a/export_presets.cfg b/export_presets.cfg index b887ab0..a49f01f 100644 --- a/export_presets.cfg +++ b/export_presets.cfg @@ -9,7 +9,7 @@ custom_features="" export_filter="all_resources" include_filter="LICENSE,ASSET-LICENSE.md,TRADEMARKS.md,docs/ATTRIBUTION.md,ui/fonts/*LICENSE.txt" exclude_filter="builds/*,scripts/*" -export_path="builds/v0.10.0-alpha/windows-x86_64/NETfishing.exe" +export_path="builds/v0.20.2-alpha/windows-x86_64/straywild.exe" patches=PackedStringArray() encryption_include_filters="" encryption_exclude_filters="" @@ -32,16 +32,16 @@ codesign/digest_algorithm=1 codesign/description="" codesign/custom_options=PackedStringArray() application/modify_resources=true -application/icon="res://art/exported/system_icons/netfishing.ico" +application/icon="res://art/exported/system_icons/straywild.ico" application/console_wrapper_icon="" -application/icon_interpolation=4 -application/file_version="0.10.0.0" -application/product_version="0.10.0.0" +application/icon_interpolation=0 +application/file_version="0.20.2.0" +application/product_version="0.20.2.0" application/company_name="Woofmeow" -application/product_name="NETfishing" -application/file_description="NETfishing v0.10.0-alpha" +application/product_name="straywild" +application/file_description="straywild v0.20.2-alpha" application/copyright="Copyright © 2026 Woofmeow" -application/trademarks="NETfishing and Woofmeow branding is reserved; see TRADEMARKS.md" +application/trademarks="straywild and Woofmeow branding is reserved; see TRADEMARKS.md" application/export_angle=0 ssh_remote_deploy/enabled=false ssh_remote_deploy/host="user@host_ip" @@ -62,7 +62,7 @@ custom_features="" export_filter="all_resources" include_filter="LICENSE,ASSET-LICENSE.md,TRADEMARKS.md,docs/ATTRIBUTION.md,ui/fonts/*LICENSE.txt" exclude_filter="builds/*,scripts/*" -export_path="builds/v0.10.0-alpha/linux-arm64/NETfishing.arm64" +export_path="builds/v0.20.2-alpha/linux-arm64/straywild.arm64" patches=PackedStringArray() encryption_include_filters="" encryption_exclude_filters="" @@ -92,7 +92,7 @@ custom_features="" export_filter="all_resources" include_filter="LICENSE,ASSET-LICENSE.md,TRADEMARKS.md,docs/ATTRIBUTION.md,ui/fonts/*LICENSE.txt" exclude_filter="builds/*,scripts/*" -export_path="builds/v0.10.0-alpha/macos/NETfishing.zip" +export_path="builds/v0.20.2-alpha/macos/straywild.zip" patches=PackedStringArray() encryption_include_filters="" encryption_exclude_filters="" @@ -106,10 +106,10 @@ script_export_mode=2 custom_template/debug="" custom_template/release="" application/bundle_identifier="io.woofmeow.netfishing" -application/icon="res://art/exported/system_icons/netfishing_1024.png" +application/icon="res://art/exported/system_icons/straywild_1024.png" application/icon_interpolation=0 -application/short_version="0.10.0" -application/version="0.10.0" +application/short_version="0.20.2" +application/version="0.20.2" application/architecture="universal" codesign/enable=false notarization/enable=false @@ -125,7 +125,7 @@ custom_features="" export_filter="all_resources" include_filter="LICENSE,ASSET-LICENSE.md,TRADEMARKS.md,docs/ATTRIBUTION.md,ui/fonts/*LICENSE.txt" exclude_filter="builds/*,scripts/*,tests/*" -export_path="builds/v0.10.0-alpha/server-linux-x86_64/NETfishingServer.x86_64" +export_path="builds/v0.20.2-alpha/server-linux-x86_64/straywildServer.x86_64" patches=PackedStringArray() encryption_include_filters="" encryption_exclude_filters="" @@ -155,7 +155,7 @@ custom_features="" export_filter="all_resources" include_filter="LICENSE,ASSET-LICENSE.md,TRADEMARKS.md,docs/ATTRIBUTION.md,ui/fonts/*LICENSE.txt" exclude_filter="builds/*,scripts/*" -export_path="builds/v0.10.0-alpha/android/NETfishing.apk" +export_path="builds/v0.20.2-alpha/android/straywild.apk" patches=PackedStringArray() encryption_include_filters="" encryption_exclude_filters="" @@ -176,10 +176,10 @@ architectures/armeabi-v7a=false architectures/arm64-v8a=true architectures/x86=false architectures/x86_64=false -version/code=100000 -version/name="v0.10.0-alpha" +version/code=200200 +version/name="v0.20.2-alpha" package/unique_name="io.woofmeow.netfishing" -package/name="NETfishing" +package/name="straywild" package/signed=true package/app_category=0 package/retain_data_on_uninstall=false @@ -187,7 +187,7 @@ package/exclude_from_recents=false package/show_in_android_tv=false package/show_in_app_library=true package/show_as_launcher_app=true -launcher_icons/main_192x192="res://art/exported/system_icons/netfishing_256.png" +launcher_icons/main_192x192="res://art/exported/system_icons/straywild_256.png" graphics/opengl_debug=false screen/immersive_mode=true screen/edge_to_edge=false @@ -214,7 +214,7 @@ custom_features="" export_filter="all_resources" include_filter="LICENSE,ASSET-LICENSE.md,TRADEMARKS.md,docs/ATTRIBUTION.md,ui/fonts/*LICENSE.txt" exclude_filter="builds/*,scripts/*" -export_path="builds/v0.10.0-alpha/linux-x86_64/NETfishing.x86_64" +export_path="builds/v0.20.2-alpha/linux-x86_64/straywild.x86_64" patches=PackedStringArray() encryption_include_filters="" encryption_exclude_filters="" diff --git a/fish/fish_data.gd b/fish/fish_data.gd index c34a953..46d4675 100644 --- a/fish/fish_data.gd +++ b/fish/fish_data.gd @@ -15,6 +15,7 @@ const CatchDifficultyProfileType = preload( "res://fishing/catch_difficulty_profile.gd" ) const FishAvailabilityType = preload("res://fish/fish_availability.gd") +const CalendarSeasonType = preload("res://world/calendar_season.gd") enum Rarity { COMMON, @@ -35,6 +36,12 @@ enum LogbookSection { SHELLFISH, } +enum CreatureGroup { + FISH, + INSECT, + SHELLFISH, +} + @export var id: StringName @export var display_name: String @export_category("Developer Catalog") @@ -46,6 +53,8 @@ enum LogbookSection { @export var collection_method: CollectionMethod = CollectionMethod.FISHING @export var logbook_section: LogbookSection = LogbookSection.AUTOMATIC @export var habitat_label: String = "" +@export_flags("Spring", "Summer", "Fall", "Winter") +var available_seasons: int = CalendarSeasonType.ALL_MASK @export_category("Fishing") @export_flags("Fresh Water", "Salt Water") var allowed_water_types: int = WaterType.ALL_FISHABLE_MASK @@ -83,6 +92,7 @@ func is_valid_catalog_entry() -> bool: and sell_value_min >= 0 and sell_value_max >= sell_value_min and sell_value_curve > 0.0 + and CalendarSeasonType.is_valid_mask(available_seasons) ) @@ -90,6 +100,14 @@ func is_fishable() -> bool: return is_selectable() and collection_method == CollectionMethod.FISHING +func get_creature_group() -> CreatureGroup: + if logbook_section == LogbookSection.SHELLFISH: + return CreatureGroup.SHELLFISH + if collection_method == CollectionMethod.FISHING: + return CreatureGroup.FISH + return CreatureGroup.INSECT + + func get_habitat_label() -> String: if not habitat_label.strip_edges().is_empty(): return habitat_label.strip_edges().to_lower() @@ -100,6 +118,14 @@ func is_allowed_in_water(type: WaterType.Type) -> bool: return (allowed_water_types & WaterType.mask_for(type)) != 0 +func is_available_in_season(season: int) -> bool: + return CalendarSeasonType.includes(available_seasons, season) + + +func get_season_text() -> String: + return CalendarSeasonType.format_mask(available_seasons) + + func get_primary_water_type() -> WaterType.Type: if allowed_water_types & WaterType.FRESH_WATER_MASK: return WaterType.Type.FRESH_WATER diff --git a/fish/fish_selector.gd b/fish/fish_selector.gd index de906f8..c2413bf 100644 --- a/fish/fish_selector.gd +++ b/fish/fish_selector.gd @@ -48,6 +48,8 @@ func select_fish( for fish: FishDataType in pool.candidates: if fish == null or not fish.is_fishable(): continue + if not fish.is_available_in_season(context.season): + continue if not fish.is_allowed_in_water(context.water_type): continue if fish.availability != null and not fish.availability.is_available(context): diff --git a/fish/pools/fish_catalog.tres b/fish/pools/fish_catalog.tres index e2f7385..0f27f15 100644 --- a/fish/pools/fish_catalog.tres +++ b/fish/pools/fish_catalog.tres @@ -1,4 +1,4 @@ -[gd_resource type="Resource" load_steps=315 format=3] +[gd_resource type="Resource" load_steps=317 format=3] [ext_resource type="Script" path="res://fish/fish_pool.gd" id="1_pool"] [ext_resource type="Resource" path="res://fish/species/bluegill/bluegill.tres" id="2_bluegill"] @@ -315,7 +315,9 @@ [ext_resource type="Resource" path="res://fish/species/whale_killer/whale_killer.tres" id="313_whale_killer"] [ext_resource type="Resource" path="res://fish/species/whale_sperm/whale_sperm.tres" id="314_whale_sperm"] [ext_resource type="Resource" path="res://fish/species/crab_brown/crab_brown.tres" id="315_crab_brown"] +[ext_resource type="Resource" path="res://fish/species/clam_manila/clam_manila.tres" id="316_clam_manila"] +[ext_resource type="Resource" path="res://fish/species/beetle_stag_common/beetle_stag_common.tres" id="317_beetle_stag_common"] [resource] script = ExtResource("1_pool") -candidates = [ExtResource("2_bluegill"), ExtResource("3_bass"), ExtResource("4_carp"), ExtResource("5_sunfish"), ExtResource("6_catfish_blue"), ExtResource("7_catfish_channel"), ExtResource("8_catfish_flathead"), ExtResource("9_catfish_white"), ExtResource("10_tuna_albacore"), ExtResource("11_tuna_bigeye"), ExtResource("12_tuna_bluefin"), ExtResource("13_tuna_skipjack"), ExtResource("14_tuna_yellowfin"), ExtResource("15_goby_round"), ExtResource("16_salmon_atlantic"), ExtResource("17_salmon_chum"), ExtResource("18_salmon_coho"), ExtResource("19_salmon_pink"), ExtResource("20_salmon_sockeye"), ExtResource("21_anchovy_european"), ExtResource("22_anchovy_northern"), ExtResource("23_chub_european"), ExtResource("24_chub_flame"), ExtResource("25_chub_lake"), ExtResource("26_goldfish"), ExtResource("27_goldfish_bubbleeye"), ExtResource("28_grouper_gulf"), ExtResource("29_grouper_red"), ExtResource("30_mackerel_atlantic"), ExtResource("31_mackerel_cero"), ExtResource("32_mackerel_chub"), ExtResource("33_mackerel_king"), ExtResource("34_mackerel_spanish"), ExtResource("35_marlin_black"), ExtResource("36_marlin_blue"), ExtResource("37_marlin_white"), ExtResource("38_pomfret_black"), ExtResource("39_pomfret_chinese"), ExtResource("40_pomfret_golden"), ExtResource("41_pomfret_white"), ExtResource("42_sailfish"), ExtResource("43_sauger"), ExtResource("44_saugeye"), ExtResource("45_snapper_lane"), ExtResource("46_snapper_mangrove"), ExtResource("47_snapper_mutton"), ExtResource("48_snapper_red"), ExtResource("49_swordfish"), ExtResource("50_trout_cutthroat"), ExtResource("51_trout_golden"), ExtResource("52_trout_rainbow"), ExtResource("53_trout_steelhead"), ExtResource("54_walleye"), ExtResource("55_bowfin"), ExtResource("56_sturgeon_lake"), ExtResource("57_gar_longnose"), ExtResource("58_paddlefish"), ExtResource("59_sturgeon_shovelnose"), ExtResource("60_gar_spotted"), ExtResource("61_lungfish_west_african"), ExtResource("62_mudskipper_atlantic"), ExtResource("63_foureyes_largescale"), ExtResource("64_mullet_red"), ExtResource("65_plaice_european"), ExtResource("66_flounder_summer"), ExtResource("67_flounder_winter"), ExtResource("68_dugong"), ExtResource("69_seal_harbor"), ExtResource("70_sea_otter"), ExtResource("71_walrus"), ExtResource("72_manatee_west_indian"), ExtResource("73_pipefish_bay"), ExtResource("74_seahorse_lined"), ExtResource("75_monkfish"), ExtResource("76_tripletail"), ExtResource("77_bluefish"), ExtResource("78_jack_crevalle"), ExtResource("79_queenfish_talang"), ExtResource("80_sand_lance_american"), ExtResource("81_menhaden_atlantic"), ExtResource("82_sardine_european"), ExtResource("83_sardine_pacific"), ExtResource("84_shark_blacktip"), ExtResource("85_shark_great_hammerhead"), ExtResource("86_shark_great_white"), ExtResource("87_shark_tiger"), ExtResource("88_shark_whale"), ExtResource("89_burbot"), ExtResource("90_cisco"), ExtResource("91_whitefish_lake"), ExtResource("92_char_arctic"), ExtResource("93_grayling_arctic"), ExtResource("94_trout_brown"), ExtResource("95_wolffish_atlantic"), ExtResource("96_cusk"), ExtResource("97_wolffish_spotted"), ExtResource("98_herring_atlantic"), ExtResource("99_capelin"), ExtResource("100_sprat_european"), ExtResource("101_herring_pacific"), ExtResource("102_pollock_alaska"), ExtResource("103_cod_atlantic"), ExtResource("104_pollock_atlantic"), ExtResource("105_sole_dover"), ExtResource("106_haddock"), ExtResource("107_cod_pacific"), ExtResource("108_hake_pacific"), ExtResource("109_hake_silver"), ExtResource("110_nautilus_chambered"), ExtResource("111_cuttlefish_common"), ExtResource("112_cuttlefish_flamboyant"), ExtResource("113_tilefish_blueline"), ExtResource("114_tilefish_golden"), ExtResource("115_ocean_perch_pacific"), ExtResource("116_sea_bass_chilean"), ExtResource("117_sablefish"), ExtResource("118_wreckfish"), ExtResource("119_oarfish_giant"), ExtResource("120_coelacanth_west_indian"), ExtResource("121_anglerfish_black_seadevil"), ExtResource("122_fangtooth_common"), ExtResource("123_gulper_eel"), ExtResource("124_barreleye_pacific"), ExtResource("125_blobfish_smooth_head"), ExtResource("126_lanternfish_spotted"), ExtResource("127_sea_star_crown_of_thorns"), ExtResource("128_sea_cucumber_giant_california"), ExtResource("129_urchin_purple"), ExtResource("130_sand_dollar"), ExtResource("131_sea_star_sunflower"), ExtResource("132_axolotl"), ExtResource("133_hellbender"), ExtResource("134_guppy"), ExtResource("135_tetra_neon"), ExtResource("136_danio_zebra"), ExtResource("137_largemouth_bass"), ExtResource("138_smallmouth_bass"), ExtResource("139_buffalo_bigmouth"), ExtResource("140_redhorse_golden"), ExtResource("141_quillback"), ExtResource("142_buffalo_smallmouth"), ExtResource("143_sucker_white"), ExtResource("144_bullhead_black"), ExtResource("145_bullhead_brown"), ExtResource("146_madtom_tadpole"), ExtResource("147_bullhead_yellow"), ExtResource("148_barbel_common"), ExtResource("149_bream_common"), ExtResource("150_roach_common"), ExtResource("151_fallfish"), ExtResource("152_ide"), ExtResource("153_rudd"), ExtResource("154_tench"), ExtResource("155_crayfish_red_swamp"), ExtResource("156_gar_alligator"), ExtResource("157_arapaima"), ExtResource("158_tigerfish_goliath"), ExtResource("159_muskellunge"), ExtResource("160_shiner_common"), ExtResource("161_chub_creek"), ExtResource("162_shiner_emerald"), ExtResource("163_minnow_fathead"), ExtResource("164_shiner_golden"), ExtResource("165_electric_eel"), ExtResource("166_freshwater_drum"), ExtResource("167_goldeye"), ExtResource("168_mooneye"), ExtResource("169_loach_weather"), ExtResource("170_koi"), ExtResource("171_crappie_black"), ExtResource("172_green_sunfish"), ExtResource("173_pumpkinseed"), ExtResource("174_redear_sunfish"), ExtResource("175_warmouth"), ExtResource("176_crappie_white"), ExtResource("177_yellow_perch"), ExtResource("178_pickerel_chain"), ExtResource("179_pickerel_grass"), ExtResource("180_pike_northern"), ExtResource("181_jelly_crystal"), ExtResource("182_jelly_lions_mane"), ExtResource("183_jelly_moon"), ExtResource("184_jelly_pacific_sea_nettle"), ExtResource("185_jelly_sea_wasp"), ExtResource("186_pompano_african"), ExtResource("187_cobia"), ExtResource("188_trevally_giant"), ExtResource("189_amberjack_greater"), ExtResource("190_amberjack_lesser"), ExtResource("191_halibut_atlantic"), ExtResource("192_halibut_pacific"), ExtResource("193_turbot"), ExtResource("194_lobster_american"), ExtResource("195_krill_antarctic"), ExtResource("196_lobster_caribbean_spiny"), ExtResource("197_shrimp_peacock_mantis"), ExtResource("198_shrimp_skunk_cleaner"), ExtResource("199_crab_ghost"), ExtResource("200_crab_blue"), ExtResource("201_crab_dungeness"), ExtResource("202_crab_japanese_spider"), ExtResource("203_crab_red_king"), ExtResource("204_eel_american"), ExtResource("205_eel_european"), ExtResource("206_smelt_rainbow"), ExtResource("207_smelt_eulachon"), ExtResource("208_sturgeon_white"), ExtResource("209_mahi_mahi"), ExtResource("210_opah"), ExtResource("211_wahoo"), ExtResource("212_octopus_common"), ExtResource("213_octopus_day"), ExtResource("214_octopus_giant_pacific"), ExtResource("215_octopus_greater_blue_ringed"), ExtResource("216_skate_barndoor"), ExtResource("217_manta_ray_giant"), ExtResource("218_sawfish_largetooth"), ExtResource("219_stingray_ocellate_river"), ExtResource("220_stingray_southern"), ExtResource("221_lionfish_red"), ExtResource("222_scorpionfish_red"), ExtResource("223_moray_green"), ExtResource("224_flounder_peacock"), ExtResource("225_surgeonfish_blue"), ExtResource("226_parrotfish_rainbow"), ExtResource("227_parrotfish_stoplight"), ExtResource("228_tang_yellow"), ExtResource("229_trumpetfish_atlantic"), ExtResource("230_triggerfish_gray"), ExtResource("231_pufferfish_guineafowl"), ExtResource("232_cowfish_longhorn"), ExtResource("233_triggerfish_queen"), ExtResource("234_cornetfish_red"), ExtResource("235_porcupinefish_spotted"), ExtResource("236_boxfish_yellow"), ExtResource("237_butterflyfish_copperband"), ExtResource("238_clownfish_ocellaris"), ExtResource("239_angelfish_queen"), ExtResource("240_grouper_atlantic_goliath"), ExtResource("241_trevally_bluefin"), ExtResource("242_grouper_giant"), ExtResource("243_barracuda_great"), ExtResource("244_grouper_nassau"), ExtResource("245_chromis_blue_green"), ExtResource("246_grunt_bluestriped"), ExtResource("247_grunt_french"), ExtResource("248_damselfish_sergeant_major"), ExtResource("249_wrasse_ballan"), ExtResource("250_wrasse_cleaner"), ExtResource("251_hogfish"), ExtResource("252_turtle_green"), ExtResource("253_turtle_hawksbill"), ExtResource("254_turtle_leatherback"), ExtResource("255_turtle_loggerhead"), ExtResource("256_seadragon_leafy"), ExtResource("257_seadragon_weedy"), ExtResource("258_oyster_black_lip_pearl"), ExtResource("259_clam_giant"), ExtResource("260_clam_geoduck"), ExtResource("261_conch_queen"), ExtResource("262_abalone_red"), ExtResource("263_squid_bigfin_reef"), ExtResource("264_squid_colossal"), ExtResource("265_squid_giant"), ExtResource("266_squid_humboldt"), ExtResource("267_halfbeak_ballyhoo"), ExtResource("268_needlefish_hound"), ExtResource("269_flyingfish_tropical"), ExtResource("270_croaker_atlantic"), ExtResource("271_black_drum"), ExtResource("272_red_drum"), ExtResource("273_mullet_striped"), ExtResource("274_weakfish"), ExtResource("275_white_perch"), ExtResource("276_croaker_yellowfin"), ExtResource("277_rockfish_black"), ExtResource("278_sea_bass_black"), ExtResource("279_rockfish_canary"), ExtResource("280_porgy_scup"), ExtResource("281_sheepshead"), ExtResource("282_tautog"), ExtResource("283_rockfish_yelloweye"), ExtResource("284_lingcod"), ExtResource("285_milkfish"), ExtResource("286_roosterfish"), ExtResource("287_tarpon_atlantic"), ExtResource("288_barramundi"), ExtResource("289_snook_common"), ExtResource("290_bonefish"), ExtResource("291_pompano_florida"), ExtResource("292_ladyfish"), ExtResource("293_permit"), ExtResource("294_knifefish_clown"), ExtResource("295_loach_clown"), ExtResource("296_discus"), ExtResource("297_angelfish_freshwater"), ExtResource("298_gourami_giant"), ExtResource("299_tilapia_nile"), ExtResource("300_oscar"), ExtResource("301_betta_siamese"), ExtResource("302_tambaqui"), ExtResource("303_catfish_walking"), ExtResource("304_snakehead_giant"), ExtResource("305_dorado_golden"), ExtResource("306_mahseer_golden"), ExtResource("307_peacock_bass"), ExtResource("308_piranha_red_bellied"), ExtResource("309_arowana_silver"), ExtResource("310_whale_blue"), ExtResource("311_dolphin_bottlenose"), ExtResource("312_whale_humpback"), ExtResource("313_whale_killer"), ExtResource("314_whale_sperm"), ExtResource("315_crab_brown")] +candidates = [ExtResource("2_bluegill"), ExtResource("3_bass"), ExtResource("4_carp"), ExtResource("5_sunfish"), ExtResource("6_catfish_blue"), ExtResource("7_catfish_channel"), ExtResource("8_catfish_flathead"), ExtResource("9_catfish_white"), ExtResource("10_tuna_albacore"), ExtResource("11_tuna_bigeye"), ExtResource("12_tuna_bluefin"), ExtResource("13_tuna_skipjack"), ExtResource("14_tuna_yellowfin"), ExtResource("15_goby_round"), ExtResource("16_salmon_atlantic"), ExtResource("17_salmon_chum"), ExtResource("18_salmon_coho"), ExtResource("19_salmon_pink"), ExtResource("20_salmon_sockeye"), ExtResource("21_anchovy_european"), ExtResource("22_anchovy_northern"), ExtResource("23_chub_european"), ExtResource("24_chub_flame"), ExtResource("25_chub_lake"), ExtResource("26_goldfish"), ExtResource("27_goldfish_bubbleeye"), ExtResource("28_grouper_gulf"), ExtResource("29_grouper_red"), ExtResource("30_mackerel_atlantic"), ExtResource("31_mackerel_cero"), ExtResource("32_mackerel_chub"), ExtResource("33_mackerel_king"), ExtResource("34_mackerel_spanish"), ExtResource("35_marlin_black"), ExtResource("36_marlin_blue"), ExtResource("37_marlin_white"), ExtResource("38_pomfret_black"), ExtResource("39_pomfret_chinese"), ExtResource("40_pomfret_golden"), ExtResource("41_pomfret_white"), ExtResource("42_sailfish"), ExtResource("43_sauger"), ExtResource("44_saugeye"), ExtResource("45_snapper_lane"), ExtResource("46_snapper_mangrove"), ExtResource("47_snapper_mutton"), ExtResource("48_snapper_red"), ExtResource("49_swordfish"), ExtResource("50_trout_cutthroat"), ExtResource("51_trout_golden"), ExtResource("52_trout_rainbow"), ExtResource("53_trout_steelhead"), ExtResource("54_walleye"), ExtResource("55_bowfin"), ExtResource("56_sturgeon_lake"), ExtResource("57_gar_longnose"), ExtResource("58_paddlefish"), ExtResource("59_sturgeon_shovelnose"), ExtResource("60_gar_spotted"), ExtResource("61_lungfish_west_african"), ExtResource("62_mudskipper_atlantic"), ExtResource("63_foureyes_largescale"), ExtResource("64_mullet_red"), ExtResource("65_plaice_european"), ExtResource("66_flounder_summer"), ExtResource("67_flounder_winter"), ExtResource("68_dugong"), ExtResource("69_seal_harbor"), ExtResource("70_sea_otter"), ExtResource("71_walrus"), ExtResource("72_manatee_west_indian"), ExtResource("73_pipefish_bay"), ExtResource("74_seahorse_lined"), ExtResource("75_monkfish"), ExtResource("76_tripletail"), ExtResource("77_bluefish"), ExtResource("78_jack_crevalle"), ExtResource("79_queenfish_talang"), ExtResource("80_sand_lance_american"), ExtResource("81_menhaden_atlantic"), ExtResource("82_sardine_european"), ExtResource("83_sardine_pacific"), ExtResource("84_shark_blacktip"), ExtResource("85_shark_great_hammerhead"), ExtResource("86_shark_great_white"), ExtResource("87_shark_tiger"), ExtResource("88_shark_whale"), ExtResource("89_burbot"), ExtResource("90_cisco"), ExtResource("91_whitefish_lake"), ExtResource("92_char_arctic"), ExtResource("93_grayling_arctic"), ExtResource("94_trout_brown"), ExtResource("95_wolffish_atlantic"), ExtResource("96_cusk"), ExtResource("97_wolffish_spotted"), ExtResource("98_herring_atlantic"), ExtResource("99_capelin"), ExtResource("100_sprat_european"), ExtResource("101_herring_pacific"), ExtResource("102_pollock_alaska"), ExtResource("103_cod_atlantic"), ExtResource("104_pollock_atlantic"), ExtResource("105_sole_dover"), ExtResource("106_haddock"), ExtResource("107_cod_pacific"), ExtResource("108_hake_pacific"), ExtResource("109_hake_silver"), ExtResource("110_nautilus_chambered"), ExtResource("111_cuttlefish_common"), ExtResource("112_cuttlefish_flamboyant"), ExtResource("113_tilefish_blueline"), ExtResource("114_tilefish_golden"), ExtResource("115_ocean_perch_pacific"), ExtResource("116_sea_bass_chilean"), ExtResource("117_sablefish"), ExtResource("118_wreckfish"), ExtResource("119_oarfish_giant"), ExtResource("120_coelacanth_west_indian"), ExtResource("121_anglerfish_black_seadevil"), ExtResource("122_fangtooth_common"), ExtResource("123_gulper_eel"), ExtResource("124_barreleye_pacific"), ExtResource("125_blobfish_smooth_head"), ExtResource("126_lanternfish_spotted"), ExtResource("127_sea_star_crown_of_thorns"), ExtResource("128_sea_cucumber_giant_california"), ExtResource("129_urchin_purple"), ExtResource("130_sand_dollar"), ExtResource("131_sea_star_sunflower"), ExtResource("132_axolotl"), ExtResource("133_hellbender"), ExtResource("134_guppy"), ExtResource("135_tetra_neon"), ExtResource("136_danio_zebra"), ExtResource("137_largemouth_bass"), ExtResource("138_smallmouth_bass"), ExtResource("139_buffalo_bigmouth"), ExtResource("140_redhorse_golden"), ExtResource("141_quillback"), ExtResource("142_buffalo_smallmouth"), ExtResource("143_sucker_white"), ExtResource("144_bullhead_black"), ExtResource("145_bullhead_brown"), ExtResource("146_madtom_tadpole"), ExtResource("147_bullhead_yellow"), ExtResource("148_barbel_common"), ExtResource("149_bream_common"), ExtResource("150_roach_common"), ExtResource("151_fallfish"), ExtResource("152_ide"), ExtResource("153_rudd"), ExtResource("154_tench"), ExtResource("155_crayfish_red_swamp"), ExtResource("156_gar_alligator"), ExtResource("157_arapaima"), ExtResource("158_tigerfish_goliath"), ExtResource("159_muskellunge"), ExtResource("160_shiner_common"), ExtResource("161_chub_creek"), ExtResource("162_shiner_emerald"), ExtResource("163_minnow_fathead"), ExtResource("164_shiner_golden"), ExtResource("165_electric_eel"), ExtResource("166_freshwater_drum"), ExtResource("167_goldeye"), ExtResource("168_mooneye"), ExtResource("169_loach_weather"), ExtResource("170_koi"), ExtResource("171_crappie_black"), ExtResource("172_green_sunfish"), ExtResource("173_pumpkinseed"), ExtResource("174_redear_sunfish"), ExtResource("175_warmouth"), ExtResource("176_crappie_white"), ExtResource("177_yellow_perch"), ExtResource("178_pickerel_chain"), ExtResource("179_pickerel_grass"), ExtResource("180_pike_northern"), ExtResource("181_jelly_crystal"), ExtResource("182_jelly_lions_mane"), ExtResource("183_jelly_moon"), ExtResource("184_jelly_pacific_sea_nettle"), ExtResource("185_jelly_sea_wasp"), ExtResource("186_pompano_african"), ExtResource("187_cobia"), ExtResource("188_trevally_giant"), ExtResource("189_amberjack_greater"), ExtResource("190_amberjack_lesser"), ExtResource("191_halibut_atlantic"), ExtResource("192_halibut_pacific"), ExtResource("193_turbot"), ExtResource("194_lobster_american"), ExtResource("195_krill_antarctic"), ExtResource("196_lobster_caribbean_spiny"), ExtResource("197_shrimp_peacock_mantis"), ExtResource("198_shrimp_skunk_cleaner"), ExtResource("199_crab_ghost"), ExtResource("200_crab_blue"), ExtResource("201_crab_dungeness"), ExtResource("202_crab_japanese_spider"), ExtResource("203_crab_red_king"), ExtResource("204_eel_american"), ExtResource("205_eel_european"), ExtResource("206_smelt_rainbow"), ExtResource("207_smelt_eulachon"), ExtResource("208_sturgeon_white"), ExtResource("209_mahi_mahi"), ExtResource("210_opah"), ExtResource("211_wahoo"), ExtResource("212_octopus_common"), ExtResource("213_octopus_day"), ExtResource("214_octopus_giant_pacific"), ExtResource("215_octopus_greater_blue_ringed"), ExtResource("216_skate_barndoor"), ExtResource("217_manta_ray_giant"), ExtResource("218_sawfish_largetooth"), ExtResource("219_stingray_ocellate_river"), ExtResource("220_stingray_southern"), ExtResource("221_lionfish_red"), ExtResource("222_scorpionfish_red"), ExtResource("223_moray_green"), ExtResource("224_flounder_peacock"), ExtResource("225_surgeonfish_blue"), ExtResource("226_parrotfish_rainbow"), ExtResource("227_parrotfish_stoplight"), ExtResource("228_tang_yellow"), ExtResource("229_trumpetfish_atlantic"), ExtResource("230_triggerfish_gray"), ExtResource("231_pufferfish_guineafowl"), ExtResource("232_cowfish_longhorn"), ExtResource("233_triggerfish_queen"), ExtResource("234_cornetfish_red"), ExtResource("235_porcupinefish_spotted"), ExtResource("236_boxfish_yellow"), ExtResource("237_butterflyfish_copperband"), ExtResource("238_clownfish_ocellaris"), ExtResource("239_angelfish_queen"), ExtResource("240_grouper_atlantic_goliath"), ExtResource("241_trevally_bluefin"), ExtResource("242_grouper_giant"), ExtResource("243_barracuda_great"), ExtResource("244_grouper_nassau"), ExtResource("245_chromis_blue_green"), ExtResource("246_grunt_bluestriped"), ExtResource("247_grunt_french"), ExtResource("248_damselfish_sergeant_major"), ExtResource("249_wrasse_ballan"), ExtResource("250_wrasse_cleaner"), ExtResource("251_hogfish"), ExtResource("252_turtle_green"), ExtResource("253_turtle_hawksbill"), ExtResource("254_turtle_leatherback"), ExtResource("255_turtle_loggerhead"), ExtResource("256_seadragon_leafy"), ExtResource("257_seadragon_weedy"), ExtResource("258_oyster_black_lip_pearl"), ExtResource("259_clam_giant"), ExtResource("260_clam_geoduck"), ExtResource("261_conch_queen"), ExtResource("262_abalone_red"), ExtResource("263_squid_bigfin_reef"), ExtResource("264_squid_colossal"), ExtResource("265_squid_giant"), ExtResource("266_squid_humboldt"), ExtResource("267_halfbeak_ballyhoo"), ExtResource("268_needlefish_hound"), ExtResource("269_flyingfish_tropical"), ExtResource("270_croaker_atlantic"), ExtResource("271_black_drum"), ExtResource("272_red_drum"), ExtResource("273_mullet_striped"), ExtResource("274_weakfish"), ExtResource("275_white_perch"), ExtResource("276_croaker_yellowfin"), ExtResource("277_rockfish_black"), ExtResource("278_sea_bass_black"), ExtResource("279_rockfish_canary"), ExtResource("280_porgy_scup"), ExtResource("281_sheepshead"), ExtResource("282_tautog"), ExtResource("283_rockfish_yelloweye"), ExtResource("284_lingcod"), ExtResource("285_milkfish"), ExtResource("286_roosterfish"), ExtResource("287_tarpon_atlantic"), ExtResource("288_barramundi"), ExtResource("289_snook_common"), ExtResource("290_bonefish"), ExtResource("291_pompano_florida"), ExtResource("292_ladyfish"), ExtResource("293_permit"), ExtResource("294_knifefish_clown"), ExtResource("295_loach_clown"), ExtResource("296_discus"), ExtResource("297_angelfish_freshwater"), ExtResource("298_gourami_giant"), ExtResource("299_tilapia_nile"), ExtResource("300_oscar"), ExtResource("301_betta_siamese"), ExtResource("302_tambaqui"), ExtResource("303_catfish_walking"), ExtResource("304_snakehead_giant"), ExtResource("305_dorado_golden"), ExtResource("306_mahseer_golden"), ExtResource("307_peacock_bass"), ExtResource("308_piranha_red_bellied"), ExtResource("309_arowana_silver"), ExtResource("310_whale_blue"), ExtResource("311_dolphin_bottlenose"), ExtResource("312_whale_humpback"), ExtResource("313_whale_killer"), ExtResource("314_whale_sperm"), ExtResource("315_crab_brown"), ExtResource("316_clam_manila"), ExtResource("317_beetle_stag_common")] diff --git a/fish/pools/generated_lake_pool.tres b/fish/pools/generated_lake_pool.tres new file mode 100644 index 0000000..c0ff343 --- /dev/null +++ b/fish/pools/generated_lake_pool.tres @@ -0,0 +1,27 @@ +[gd_resource type="Resource" load_steps=22 format=3] + +[ext_resource type="Script" path="res://fish/fish_pool.gd" id="1_pool"] +[ext_resource type="Resource" path="res://fish/species/sturgeon_lake/sturgeon_lake.tres" id="2_sturgeon_lake"] +[ext_resource type="Resource" path="res://fish/species/burbot/burbot.tres" id="3_burbot"] +[ext_resource type="Resource" path="res://fish/species/cisco/cisco.tres" id="4_cisco"] +[ext_resource type="Resource" path="res://fish/species/whitefish_lake/whitefish_lake.tres" id="5_whitefish_lake"] +[ext_resource type="Resource" path="res://fish/species/char_arctic/char_arctic.tres" id="6_char_arctic"] +[ext_resource type="Resource" path="res://fish/species/trout_golden/trout_golden.tres" id="7_trout_golden"] +[ext_resource type="Resource" path="res://fish/species/axolotl/axolotl.tres" id="8_axolotl"] +[ext_resource type="Resource" path="res://fish/species/bream_common/bream_common.tres" id="9_bream_common"] +[ext_resource type="Resource" path="res://fish/species/muskellunge/muskellunge.tres" id="10_muskellunge"] +[ext_resource type="Resource" path="res://fish/species/shiner_emerald/shiner_emerald.tres" id="11_shiner_emerald"] +[ext_resource type="Resource" path="res://fish/species/chub_lake/chub_lake.tres" id="12_chub_lake"] +[ext_resource type="Resource" path="res://fish/species/crappie_white/crappie_white.tres" id="13_crappie_white"] +[ext_resource type="Resource" path="res://fish/species/yellow_perch/yellow_perch.tres" id="14_yellow_perch"] +[ext_resource type="Resource" path="res://fish/species/pike_northern/pike_northern.tres" id="15_pike_northern"] +[ext_resource type="Resource" path="res://fish/species/saugeye/saugeye.tres" id="16_saugeye"] +[ext_resource type="Resource" path="res://fish/species/walleye/walleye.tres" id="17_walleye"] +[ext_resource type="Resource" path="res://fish/species/goby_round/goby_round.tres" id="18_goby_round"] +[ext_resource type="Resource" path="res://fish/species/smelt_rainbow/smelt_rainbow.tres" id="19_smelt_rainbow"] +[ext_resource type="Resource" path="res://fish/species/gourami_giant/gourami_giant.tres" id="20_gourami_giant"] +[ext_resource type="Resource" path="res://fish/species/tilapia_nile/tilapia_nile.tres" id="21_tilapia_nile"] + +[resource] +script = ExtResource("1_pool") +candidates = [ExtResource("2_sturgeon_lake"), ExtResource("3_burbot"), ExtResource("4_cisco"), ExtResource("5_whitefish_lake"), ExtResource("6_char_arctic"), ExtResource("7_trout_golden"), ExtResource("8_axolotl"), ExtResource("9_bream_common"), ExtResource("10_muskellunge"), ExtResource("11_shiner_emerald"), ExtResource("12_chub_lake"), ExtResource("13_crappie_white"), ExtResource("14_yellow_perch"), ExtResource("15_pike_northern"), ExtResource("16_saugeye"), ExtResource("17_walleye"), ExtResource("18_goby_round"), ExtResource("19_smelt_rainbow"), ExtResource("20_gourami_giant"), ExtResource("21_tilapia_nile")] diff --git a/fish/pools/generated_pond_pool.tres b/fish/pools/generated_pond_pool.tres new file mode 100644 index 0000000..9da4ed5 --- /dev/null +++ b/fish/pools/generated_pond_pool.tres @@ -0,0 +1,40 @@ +[gd_resource type="Resource" load_steps=35 format=3] + +[ext_resource type="Script" path="res://fish/fish_pool.gd" id="1_pool"] +[ext_resource type="Resource" path="res://fish/species/bowfin/bowfin.tres" id="2_bowfin"] +[ext_resource type="Resource" path="res://fish/species/gar_spotted/gar_spotted.tres" id="3_gar_spotted"] +[ext_resource type="Resource" path="res://fish/species/lungfish_west_african/lungfish_west_african.tres" id="4_lungfish_west_african"] +[ext_resource type="Resource" path="res://fish/species/guppy/guppy.tres" id="5_guppy"] +[ext_resource type="Resource" path="res://fish/species/tetra_neon/tetra_neon.tres" id="6_tetra_neon"] +[ext_resource type="Resource" path="res://fish/species/danio_zebra/danio_zebra.tres" id="7_danio_zebra"] +[ext_resource type="Resource" path="res://fish/species/largemouth_bass/largemouth_bass.tres" id="8_largemouth_bass"] +[ext_resource type="Resource" path="res://fish/species/bullhead_black/bullhead_black.tres" id="9_bullhead_black"] +[ext_resource type="Resource" path="res://fish/species/bullhead_brown/bullhead_brown.tres" id="10_bullhead_brown"] +[ext_resource type="Resource" path="res://fish/species/catfish_channel/catfish_channel.tres" id="11_catfish_channel"] +[ext_resource type="Resource" path="res://fish/species/catfish_white/catfish_white.tres" id="12_catfish_white"] +[ext_resource type="Resource" path="res://fish/species/bullhead_yellow/bullhead_yellow.tres" id="13_bullhead_yellow"] +[ext_resource type="Resource" path="res://fish/species/carp/carp.tres" id="14_carp"] +[ext_resource type="Resource" path="res://fish/species/roach_common/roach_common.tres" id="15_roach_common"] +[ext_resource type="Resource" path="res://fish/species/rudd/rudd.tres" id="16_rudd"] +[ext_resource type="Resource" path="res://fish/species/tench/tench.tres" id="17_tench"] +[ext_resource type="Resource" path="res://fish/species/crayfish_red_swamp/crayfish_red_swamp.tres" id="18_crayfish_red_swamp"] +[ext_resource type="Resource" path="res://fish/species/minnow_fathead/minnow_fathead.tres" id="19_minnow_fathead"] +[ext_resource type="Resource" path="res://fish/species/shiner_golden/shiner_golden.tres" id="20_shiner_golden"] +[ext_resource type="Resource" path="res://fish/species/loach_weather/loach_weather.tres" id="21_loach_weather"] +[ext_resource type="Resource" path="res://fish/species/goldfish_bubbleeye/goldfish_bubbleeye.tres" id="22_goldfish_bubbleeye"] +[ext_resource type="Resource" path="res://fish/species/goldfish/goldfish.tres" id="23_goldfish"] +[ext_resource type="Resource" path="res://fish/species/koi/koi.tres" id="24_koi"] +[ext_resource type="Resource" path="res://fish/species/crappie_black/crappie_black.tres" id="25_crappie_black"] +[ext_resource type="Resource" path="res://fish/species/bluegill/bluegill.tres" id="26_bluegill"] +[ext_resource type="Resource" path="res://fish/species/green_sunfish/green_sunfish.tres" id="27_green_sunfish"] +[ext_resource type="Resource" path="res://fish/species/pumpkinseed/pumpkinseed.tres" id="28_pumpkinseed"] +[ext_resource type="Resource" path="res://fish/species/redear_sunfish/redear_sunfish.tres" id="29_redear_sunfish"] +[ext_resource type="Resource" path="res://fish/species/warmouth/warmouth.tres" id="30_warmouth"] +[ext_resource type="Resource" path="res://fish/species/pickerel_chain/pickerel_chain.tres" id="31_pickerel_chain"] +[ext_resource type="Resource" path="res://fish/species/pickerel_grass/pickerel_grass.tres" id="32_pickerel_grass"] +[ext_resource type="Resource" path="res://fish/species/betta_siamese/betta_siamese.tres" id="33_betta_siamese"] +[ext_resource type="Resource" path="res://fish/species/catfish_walking/catfish_walking.tres" id="34_catfish_walking"] + +[resource] +script = ExtResource("1_pool") +candidates = [ExtResource("2_bowfin"), ExtResource("3_gar_spotted"), ExtResource("4_lungfish_west_african"), ExtResource("5_guppy"), ExtResource("6_tetra_neon"), ExtResource("7_danio_zebra"), ExtResource("8_largemouth_bass"), ExtResource("9_bullhead_black"), ExtResource("10_bullhead_brown"), ExtResource("11_catfish_channel"), ExtResource("12_catfish_white"), ExtResource("13_bullhead_yellow"), ExtResource("14_carp"), ExtResource("15_roach_common"), ExtResource("16_rudd"), ExtResource("17_tench"), ExtResource("18_crayfish_red_swamp"), ExtResource("19_minnow_fathead"), ExtResource("20_shiner_golden"), ExtResource("21_loach_weather"), ExtResource("22_goldfish_bubbleeye"), ExtResource("23_goldfish"), ExtResource("24_koi"), ExtResource("25_crappie_black"), ExtResource("26_bluegill"), ExtResource("27_green_sunfish"), ExtResource("28_pumpkinseed"), ExtResource("29_redear_sunfish"), ExtResource("30_warmouth"), ExtResource("31_pickerel_chain"), ExtResource("32_pickerel_grass"), ExtResource("33_betta_siamese"), ExtResource("34_catfish_walking")] diff --git a/fish/pools/generated_river_pool.tres b/fish/pools/generated_river_pool.tres new file mode 100644 index 0000000..66102ef --- /dev/null +++ b/fish/pools/generated_river_pool.tres @@ -0,0 +1,60 @@ +[gd_resource type="Resource" load_steps=55 format=3] + +[ext_resource type="Script" path="res://fish/fish_pool.gd" id="1_pool"] +[ext_resource type="Resource" path="res://fish/species/gar_longnose/gar_longnose.tres" id="2_gar_longnose"] +[ext_resource type="Resource" path="res://fish/species/paddlefish/paddlefish.tres" id="3_paddlefish"] +[ext_resource type="Resource" path="res://fish/species/sturgeon_shovelnose/sturgeon_shovelnose.tres" id="4_sturgeon_shovelnose"] +[ext_resource type="Resource" path="res://fish/species/foureyes_largescale/foureyes_largescale.tres" id="5_foureyes_largescale"] +[ext_resource type="Resource" path="res://fish/species/grayling_arctic/grayling_arctic.tres" id="6_grayling_arctic"] +[ext_resource type="Resource" path="res://fish/species/trout_brown/trout_brown.tres" id="7_trout_brown"] +[ext_resource type="Resource" path="res://fish/species/trout_cutthroat/trout_cutthroat.tres" id="8_trout_cutthroat"] +[ext_resource type="Resource" path="res://fish/species/trout_rainbow/trout_rainbow.tres" id="9_trout_rainbow"] +[ext_resource type="Resource" path="res://fish/species/hellbender/hellbender.tres" id="10_hellbender"] +[ext_resource type="Resource" path="res://fish/species/smallmouth_bass/smallmouth_bass.tres" id="11_smallmouth_bass"] +[ext_resource type="Resource" path="res://fish/species/buffalo_bigmouth/buffalo_bigmouth.tres" id="12_buffalo_bigmouth"] +[ext_resource type="Resource" path="res://fish/species/redhorse_golden/redhorse_golden.tres" id="13_redhorse_golden"] +[ext_resource type="Resource" path="res://fish/species/quillback/quillback.tres" id="14_quillback"] +[ext_resource type="Resource" path="res://fish/species/buffalo_smallmouth/buffalo_smallmouth.tres" id="15_buffalo_smallmouth"] +[ext_resource type="Resource" path="res://fish/species/sucker_white/sucker_white.tres" id="16_sucker_white"] +[ext_resource type="Resource" path="res://fish/species/catfish_blue/catfish_blue.tres" id="17_catfish_blue"] +[ext_resource type="Resource" path="res://fish/species/catfish_flathead/catfish_flathead.tres" id="18_catfish_flathead"] +[ext_resource type="Resource" path="res://fish/species/madtom_tadpole/madtom_tadpole.tres" id="19_madtom_tadpole"] +[ext_resource type="Resource" path="res://fish/species/barbel_common/barbel_common.tres" id="20_barbel_common"] +[ext_resource type="Resource" path="res://fish/species/chub_european/chub_european.tres" id="21_chub_european"] +[ext_resource type="Resource" path="res://fish/species/fallfish/fallfish.tres" id="22_fallfish"] +[ext_resource type="Resource" path="res://fish/species/ide/ide.tres" id="23_ide"] +[ext_resource type="Resource" path="res://fish/species/gar_alligator/gar_alligator.tres" id="24_gar_alligator"] +[ext_resource type="Resource" path="res://fish/species/arapaima/arapaima.tres" id="25_arapaima"] +[ext_resource type="Resource" path="res://fish/species/tigerfish_goliath/tigerfish_goliath.tres" id="26_tigerfish_goliath"] +[ext_resource type="Resource" path="res://fish/species/shiner_common/shiner_common.tres" id="27_shiner_common"] +[ext_resource type="Resource" path="res://fish/species/chub_creek/chub_creek.tres" id="28_chub_creek"] +[ext_resource type="Resource" path="res://fish/species/chub_flame/chub_flame.tres" id="29_chub_flame"] +[ext_resource type="Resource" path="res://fish/species/electric_eel/electric_eel.tres" id="30_electric_eel"] +[ext_resource type="Resource" path="res://fish/species/freshwater_drum/freshwater_drum.tres" id="31_freshwater_drum"] +[ext_resource type="Resource" path="res://fish/species/goldeye/goldeye.tres" id="32_goldeye"] +[ext_resource type="Resource" path="res://fish/species/mooneye/mooneye.tres" id="33_mooneye"] +[ext_resource type="Resource" path="res://fish/species/sauger/sauger.tres" id="34_sauger"] +[ext_resource type="Resource" path="res://fish/species/eel_american/eel_american.tres" id="35_eel_american"] +[ext_resource type="Resource" path="res://fish/species/eel_european/eel_european.tres" id="36_eel_european"] +[ext_resource type="Resource" path="res://fish/species/smelt_eulachon/smelt_eulachon.tres" id="37_smelt_eulachon"] +[ext_resource type="Resource" path="res://fish/species/sturgeon_white/sturgeon_white.tres" id="38_sturgeon_white"] +[ext_resource type="Resource" path="res://fish/species/trout_steelhead/trout_steelhead.tres" id="39_trout_steelhead"] +[ext_resource type="Resource" path="res://fish/species/stingray_ocellate_river/stingray_ocellate_river.tres" id="40_stingray_ocellate_river"] +[ext_resource type="Resource" path="res://fish/species/white_perch/white_perch.tres" id="41_white_perch"] +[ext_resource type="Resource" path="res://fish/species/barramundi/barramundi.tres" id="42_barramundi"] +[ext_resource type="Resource" path="res://fish/species/knifefish_clown/knifefish_clown.tres" id="43_knifefish_clown"] +[ext_resource type="Resource" path="res://fish/species/loach_clown/loach_clown.tres" id="44_loach_clown"] +[ext_resource type="Resource" path="res://fish/species/discus/discus.tres" id="45_discus"] +[ext_resource type="Resource" path="res://fish/species/angelfish_freshwater/angelfish_freshwater.tres" id="46_angelfish_freshwater"] +[ext_resource type="Resource" path="res://fish/species/oscar/oscar.tres" id="47_oscar"] +[ext_resource type="Resource" path="res://fish/species/tambaqui/tambaqui.tres" id="48_tambaqui"] +[ext_resource type="Resource" path="res://fish/species/snakehead_giant/snakehead_giant.tres" id="49_snakehead_giant"] +[ext_resource type="Resource" path="res://fish/species/dorado_golden/dorado_golden.tres" id="50_dorado_golden"] +[ext_resource type="Resource" path="res://fish/species/mahseer_golden/mahseer_golden.tres" id="51_mahseer_golden"] +[ext_resource type="Resource" path="res://fish/species/peacock_bass/peacock_bass.tres" id="52_peacock_bass"] +[ext_resource type="Resource" path="res://fish/species/piranha_red_bellied/piranha_red_bellied.tres" id="53_piranha_red_bellied"] +[ext_resource type="Resource" path="res://fish/species/arowana_silver/arowana_silver.tres" id="54_arowana_silver"] + +[resource] +script = ExtResource("1_pool") +candidates = [ExtResource("2_gar_longnose"), ExtResource("3_paddlefish"), ExtResource("4_sturgeon_shovelnose"), ExtResource("5_foureyes_largescale"), ExtResource("6_grayling_arctic"), ExtResource("7_trout_brown"), ExtResource("8_trout_cutthroat"), ExtResource("9_trout_rainbow"), ExtResource("10_hellbender"), ExtResource("11_smallmouth_bass"), ExtResource("12_buffalo_bigmouth"), ExtResource("13_redhorse_golden"), ExtResource("14_quillback"), ExtResource("15_buffalo_smallmouth"), ExtResource("16_sucker_white"), ExtResource("17_catfish_blue"), ExtResource("18_catfish_flathead"), ExtResource("19_madtom_tadpole"), ExtResource("20_barbel_common"), ExtResource("21_chub_european"), ExtResource("22_fallfish"), ExtResource("23_ide"), ExtResource("24_gar_alligator"), ExtResource("25_arapaima"), ExtResource("26_tigerfish_goliath"), ExtResource("27_shiner_common"), ExtResource("28_chub_creek"), ExtResource("29_chub_flame"), ExtResource("30_electric_eel"), ExtResource("31_freshwater_drum"), ExtResource("32_goldeye"), ExtResource("33_mooneye"), ExtResource("34_sauger"), ExtResource("35_eel_american"), ExtResource("36_eel_european"), ExtResource("37_smelt_eulachon"), ExtResource("38_sturgeon_white"), ExtResource("39_trout_steelhead"), ExtResource("40_stingray_ocellate_river"), ExtResource("41_white_perch"), ExtResource("42_barramundi"), ExtResource("43_knifefish_clown"), ExtResource("44_loach_clown"), ExtResource("45_discus"), ExtResource("46_angelfish_freshwater"), ExtResource("47_oscar"), ExtResource("48_tambaqui"), ExtResource("49_snakehead_giant"), ExtResource("50_dorado_golden"), ExtResource("51_mahseer_golden"), ExtResource("52_peacock_bass"), ExtResource("53_piranha_red_bellied"), ExtResource("54_arowana_silver")] diff --git a/fish/pools/starter_ocean_pool.tres b/fish/pools/starter_ocean_pool.tres index 1e47a2b..274b58d 100644 --- a/fish/pools/starter_ocean_pool.tres +++ b/fish/pools/starter_ocean_pool.tres @@ -1,41 +1,211 @@ -[gd_resource type="Resource" load_steps=36 format=3] +[gd_resource type="Resource" load_steps=206 format=3] [ext_resource type="Script" path="res://fish/fish_pool.gd" id="1_pool"] -[ext_resource type="Resource" path="res://fish/species/bass/bass.tres" id="2_bass"] -[ext_resource type="Resource" path="res://fish/species/sunfish/sunfish.tres" id="3_sunfish"] -[ext_resource type="Resource" path="res://fish/species/tuna_albacore/tuna_albacore.tres" id="4_tuna_albacore"] -[ext_resource type="Resource" path="res://fish/species/tuna_bigeye/tuna_bigeye.tres" id="5_tuna_bigeye"] -[ext_resource type="Resource" path="res://fish/species/tuna_bluefin/tuna_bluefin.tres" id="6_tuna_bluefin"] -[ext_resource type="Resource" path="res://fish/species/tuna_skipjack/tuna_skipjack.tres" id="7_tuna_skipjack"] -[ext_resource type="Resource" path="res://fish/species/tuna_yellowfin/tuna_yellowfin.tres" id="8_tuna_yellowfin"] -[ext_resource type="Resource" path="res://fish/species/salmon_atlantic/salmon_atlantic.tres" id="9_salmon_atlantic"] -[ext_resource type="Resource" path="res://fish/species/salmon_chum/salmon_chum.tres" id="10_salmon_chum"] -[ext_resource type="Resource" path="res://fish/species/salmon_coho/salmon_coho.tres" id="11_salmon_coho"] -[ext_resource type="Resource" path="res://fish/species/salmon_pink/salmon_pink.tres" id="12_salmon_pink"] -[ext_resource type="Resource" path="res://fish/species/salmon_sockeye/salmon_sockeye.tres" id="13_salmon_sockeye"] -[ext_resource type="Resource" path="res://fish/species/anchovy_european/anchovy_european.tres" id="14_anchovy_european"] -[ext_resource type="Resource" path="res://fish/species/anchovy_northern/anchovy_northern.tres" id="15_anchovy_northern"] -[ext_resource type="Resource" path="res://fish/species/grouper_gulf/grouper_gulf.tres" id="16_grouper_gulf"] -[ext_resource type="Resource" path="res://fish/species/grouper_red/grouper_red.tres" id="17_grouper_red"] -[ext_resource type="Resource" path="res://fish/species/mackerel_atlantic/mackerel_atlantic.tres" id="18_mackerel_atlantic"] -[ext_resource type="Resource" path="res://fish/species/mackerel_cero/mackerel_cero.tres" id="19_mackerel_cero"] -[ext_resource type="Resource" path="res://fish/species/mackerel_chub/mackerel_chub.tres" id="20_mackerel_chub"] +[ext_resource type="Resource" path="res://fish/species/mudskipper_atlantic/mudskipper_atlantic.tres" id="2_mudskipper_atlantic"] +[ext_resource type="Resource" path="res://fish/species/mullet_red/mullet_red.tres" id="3_mullet_red"] +[ext_resource type="Resource" path="res://fish/species/plaice_european/plaice_european.tres" id="4_plaice_european"] +[ext_resource type="Resource" path="res://fish/species/flounder_summer/flounder_summer.tres" id="5_flounder_summer"] +[ext_resource type="Resource" path="res://fish/species/flounder_winter/flounder_winter.tres" id="6_flounder_winter"] +[ext_resource type="Resource" path="res://fish/species/dugong/dugong.tres" id="7_dugong"] +[ext_resource type="Resource" path="res://fish/species/seal_harbor/seal_harbor.tres" id="8_seal_harbor"] +[ext_resource type="Resource" path="res://fish/species/sea_otter/sea_otter.tres" id="9_sea_otter"] +[ext_resource type="Resource" path="res://fish/species/walrus/walrus.tres" id="10_walrus"] +[ext_resource type="Resource" path="res://fish/species/manatee_west_indian/manatee_west_indian.tres" id="11_manatee_west_indian"] +[ext_resource type="Resource" path="res://fish/species/pipefish_bay/pipefish_bay.tres" id="12_pipefish_bay"] +[ext_resource type="Resource" path="res://fish/species/seahorse_lined/seahorse_lined.tres" id="13_seahorse_lined"] +[ext_resource type="Resource" path="res://fish/species/monkfish/monkfish.tres" id="14_monkfish"] +[ext_resource type="Resource" path="res://fish/species/tripletail/tripletail.tres" id="15_tripletail"] +[ext_resource type="Resource" path="res://fish/species/mackerel_atlantic/mackerel_atlantic.tres" id="16_mackerel_atlantic"] +[ext_resource type="Resource" path="res://fish/species/bluefish/bluefish.tres" id="17_bluefish"] +[ext_resource type="Resource" path="res://fish/species/mackerel_cero/mackerel_cero.tres" id="18_mackerel_cero"] +[ext_resource type="Resource" path="res://fish/species/mackerel_chub/mackerel_chub.tres" id="19_mackerel_chub"] +[ext_resource type="Resource" path="res://fish/species/jack_crevalle/jack_crevalle.tres" id="20_jack_crevalle"] [ext_resource type="Resource" path="res://fish/species/mackerel_king/mackerel_king.tres" id="21_mackerel_king"] [ext_resource type="Resource" path="res://fish/species/mackerel_spanish/mackerel_spanish.tres" id="22_mackerel_spanish"] -[ext_resource type="Resource" path="res://fish/species/marlin_black/marlin_black.tres" id="23_marlin_black"] -[ext_resource type="Resource" path="res://fish/species/marlin_blue/marlin_blue.tres" id="24_marlin_blue"] -[ext_resource type="Resource" path="res://fish/species/marlin_white/marlin_white.tres" id="25_marlin_white"] +[ext_resource type="Resource" path="res://fish/species/queenfish_talang/queenfish_talang.tres" id="23_queenfish_talang"] +[ext_resource type="Resource" path="res://fish/species/sand_lance_american/sand_lance_american.tres" id="24_sand_lance_american"] +[ext_resource type="Resource" path="res://fish/species/menhaden_atlantic/menhaden_atlantic.tres" id="25_menhaden_atlantic"] [ext_resource type="Resource" path="res://fish/species/pomfret_black/pomfret_black.tres" id="26_pomfret_black"] [ext_resource type="Resource" path="res://fish/species/pomfret_chinese/pomfret_chinese.tres" id="27_pomfret_chinese"] -[ext_resource type="Resource" path="res://fish/species/pomfret_golden/pomfret_golden.tres" id="28_pomfret_golden"] -[ext_resource type="Resource" path="res://fish/species/pomfret_white/pomfret_white.tres" id="29_pomfret_white"] -[ext_resource type="Resource" path="res://fish/species/sailfish/sailfish.tres" id="30_sailfish"] -[ext_resource type="Resource" path="res://fish/species/snapper_lane/snapper_lane.tres" id="31_snapper_lane"] -[ext_resource type="Resource" path="res://fish/species/snapper_mangrove/snapper_mangrove.tres" id="32_snapper_mangrove"] -[ext_resource type="Resource" path="res://fish/species/snapper_mutton/snapper_mutton.tres" id="33_snapper_mutton"] -[ext_resource type="Resource" path="res://fish/species/snapper_red/snapper_red.tres" id="34_snapper_red"] -[ext_resource type="Resource" path="res://fish/species/swordfish/swordfish.tres" id="35_swordfish"] +[ext_resource type="Resource" path="res://fish/species/anchovy_european/anchovy_european.tres" id="28_anchovy_european"] +[ext_resource type="Resource" path="res://fish/species/sardine_european/sardine_european.tres" id="29_sardine_european"] +[ext_resource type="Resource" path="res://fish/species/pomfret_golden/pomfret_golden.tres" id="30_pomfret_golden"] +[ext_resource type="Resource" path="res://fish/species/anchovy_northern/anchovy_northern.tres" id="31_anchovy_northern"] +[ext_resource type="Resource" path="res://fish/species/sardine_pacific/sardine_pacific.tres" id="32_sardine_pacific"] +[ext_resource type="Resource" path="res://fish/species/pomfret_white/pomfret_white.tres" id="33_pomfret_white"] +[ext_resource type="Resource" path="res://fish/species/shark_blacktip/shark_blacktip.tres" id="34_shark_blacktip"] +[ext_resource type="Resource" path="res://fish/species/shark_great_hammerhead/shark_great_hammerhead.tres" id="35_shark_great_hammerhead"] +[ext_resource type="Resource" path="res://fish/species/shark_great_white/shark_great_white.tres" id="36_shark_great_white"] +[ext_resource type="Resource" path="res://fish/species/shark_tiger/shark_tiger.tres" id="37_shark_tiger"] +[ext_resource type="Resource" path="res://fish/species/shark_whale/shark_whale.tres" id="38_shark_whale"] +[ext_resource type="Resource" path="res://fish/species/wolffish_atlantic/wolffish_atlantic.tres" id="39_wolffish_atlantic"] +[ext_resource type="Resource" path="res://fish/species/cusk/cusk.tres" id="40_cusk"] +[ext_resource type="Resource" path="res://fish/species/wolffish_spotted/wolffish_spotted.tres" id="41_wolffish_spotted"] +[ext_resource type="Resource" path="res://fish/species/herring_atlantic/herring_atlantic.tres" id="42_herring_atlantic"] +[ext_resource type="Resource" path="res://fish/species/capelin/capelin.tres" id="43_capelin"] +[ext_resource type="Resource" path="res://fish/species/sprat_european/sprat_european.tres" id="44_sprat_european"] +[ext_resource type="Resource" path="res://fish/species/herring_pacific/herring_pacific.tres" id="45_herring_pacific"] +[ext_resource type="Resource" path="res://fish/species/pollock_alaska/pollock_alaska.tres" id="46_pollock_alaska"] +[ext_resource type="Resource" path="res://fish/species/cod_atlantic/cod_atlantic.tres" id="47_cod_atlantic"] +[ext_resource type="Resource" path="res://fish/species/pollock_atlantic/pollock_atlantic.tres" id="48_pollock_atlantic"] +[ext_resource type="Resource" path="res://fish/species/sole_dover/sole_dover.tres" id="49_sole_dover"] +[ext_resource type="Resource" path="res://fish/species/haddock/haddock.tres" id="50_haddock"] +[ext_resource type="Resource" path="res://fish/species/cod_pacific/cod_pacific.tres" id="51_cod_pacific"] +[ext_resource type="Resource" path="res://fish/species/hake_pacific/hake_pacific.tres" id="52_hake_pacific"] +[ext_resource type="Resource" path="res://fish/species/hake_silver/hake_silver.tres" id="53_hake_silver"] +[ext_resource type="Resource" path="res://fish/species/nautilus_chambered/nautilus_chambered.tres" id="54_nautilus_chambered"] +[ext_resource type="Resource" path="res://fish/species/cuttlefish_common/cuttlefish_common.tres" id="55_cuttlefish_common"] +[ext_resource type="Resource" path="res://fish/species/cuttlefish_flamboyant/cuttlefish_flamboyant.tres" id="56_cuttlefish_flamboyant"] +[ext_resource type="Resource" path="res://fish/species/tilefish_blueline/tilefish_blueline.tres" id="57_tilefish_blueline"] +[ext_resource type="Resource" path="res://fish/species/tilefish_golden/tilefish_golden.tres" id="58_tilefish_golden"] +[ext_resource type="Resource" path="res://fish/species/ocean_perch_pacific/ocean_perch_pacific.tres" id="59_ocean_perch_pacific"] +[ext_resource type="Resource" path="res://fish/species/sea_bass_chilean/sea_bass_chilean.tres" id="60_sea_bass_chilean"] +[ext_resource type="Resource" path="res://fish/species/sablefish/sablefish.tres" id="61_sablefish"] +[ext_resource type="Resource" path="res://fish/species/wreckfish/wreckfish.tres" id="62_wreckfish"] +[ext_resource type="Resource" path="res://fish/species/oarfish_giant/oarfish_giant.tres" id="63_oarfish_giant"] +[ext_resource type="Resource" path="res://fish/species/coelacanth_west_indian/coelacanth_west_indian.tres" id="64_coelacanth_west_indian"] +[ext_resource type="Resource" path="res://fish/species/anglerfish_black_seadevil/anglerfish_black_seadevil.tres" id="65_anglerfish_black_seadevil"] +[ext_resource type="Resource" path="res://fish/species/fangtooth_common/fangtooth_common.tres" id="66_fangtooth_common"] +[ext_resource type="Resource" path="res://fish/species/gulper_eel/gulper_eel.tres" id="67_gulper_eel"] +[ext_resource type="Resource" path="res://fish/species/barreleye_pacific/barreleye_pacific.tres" id="68_barreleye_pacific"] +[ext_resource type="Resource" path="res://fish/species/blobfish_smooth_head/blobfish_smooth_head.tres" id="69_blobfish_smooth_head"] +[ext_resource type="Resource" path="res://fish/species/lanternfish_spotted/lanternfish_spotted.tres" id="70_lanternfish_spotted"] +[ext_resource type="Resource" path="res://fish/species/sea_star_crown_of_thorns/sea_star_crown_of_thorns.tres" id="71_sea_star_crown_of_thorns"] +[ext_resource type="Resource" path="res://fish/species/sea_cucumber_giant_california/sea_cucumber_giant_california.tres" id="72_sea_cucumber_giant_california"] +[ext_resource type="Resource" path="res://fish/species/urchin_purple/urchin_purple.tres" id="73_urchin_purple"] +[ext_resource type="Resource" path="res://fish/species/sand_dollar/sand_dollar.tres" id="74_sand_dollar"] +[ext_resource type="Resource" path="res://fish/species/sea_star_sunflower/sea_star_sunflower.tres" id="75_sea_star_sunflower"] +[ext_resource type="Resource" path="res://fish/species/jelly_crystal/jelly_crystal.tres" id="76_jelly_crystal"] +[ext_resource type="Resource" path="res://fish/species/jelly_lions_mane/jelly_lions_mane.tres" id="77_jelly_lions_mane"] +[ext_resource type="Resource" path="res://fish/species/jelly_moon/jelly_moon.tres" id="78_jelly_moon"] +[ext_resource type="Resource" path="res://fish/species/jelly_pacific_sea_nettle/jelly_pacific_sea_nettle.tres" id="79_jelly_pacific_sea_nettle"] +[ext_resource type="Resource" path="res://fish/species/jelly_sea_wasp/jelly_sea_wasp.tres" id="80_jelly_sea_wasp"] +[ext_resource type="Resource" path="res://fish/species/pompano_african/pompano_african.tres" id="81_pompano_african"] +[ext_resource type="Resource" path="res://fish/species/cobia/cobia.tres" id="82_cobia"] +[ext_resource type="Resource" path="res://fish/species/trevally_giant/trevally_giant.tres" id="83_trevally_giant"] +[ext_resource type="Resource" path="res://fish/species/amberjack_greater/amberjack_greater.tres" id="84_amberjack_greater"] +[ext_resource type="Resource" path="res://fish/species/amberjack_lesser/amberjack_lesser.tres" id="85_amberjack_lesser"] +[ext_resource type="Resource" path="res://fish/species/halibut_atlantic/halibut_atlantic.tres" id="86_halibut_atlantic"] +[ext_resource type="Resource" path="res://fish/species/halibut_pacific/halibut_pacific.tres" id="87_halibut_pacific"] +[ext_resource type="Resource" path="res://fish/species/turbot/turbot.tres" id="88_turbot"] +[ext_resource type="Resource" path="res://fish/species/lobster_american/lobster_american.tres" id="89_lobster_american"] +[ext_resource type="Resource" path="res://fish/species/krill_antarctic/krill_antarctic.tres" id="90_krill_antarctic"] +[ext_resource type="Resource" path="res://fish/species/lobster_caribbean_spiny/lobster_caribbean_spiny.tres" id="91_lobster_caribbean_spiny"] +[ext_resource type="Resource" path="res://fish/species/shrimp_peacock_mantis/shrimp_peacock_mantis.tres" id="92_shrimp_peacock_mantis"] +[ext_resource type="Resource" path="res://fish/species/shrimp_skunk_cleaner/shrimp_skunk_cleaner.tres" id="93_shrimp_skunk_cleaner"] +[ext_resource type="Resource" path="res://fish/species/crab_japanese_spider/crab_japanese_spider.tres" id="94_crab_japanese_spider"] +[ext_resource type="Resource" path="res://fish/species/crab_red_king/crab_red_king.tres" id="95_crab_red_king"] +[ext_resource type="Resource" path="res://fish/species/salmon_atlantic/salmon_atlantic.tres" id="96_salmon_atlantic"] +[ext_resource type="Resource" path="res://fish/species/salmon_chum/salmon_chum.tres" id="97_salmon_chum"] +[ext_resource type="Resource" path="res://fish/species/salmon_coho/salmon_coho.tres" id="98_salmon_coho"] +[ext_resource type="Resource" path="res://fish/species/salmon_pink/salmon_pink.tres" id="99_salmon_pink"] +[ext_resource type="Resource" path="res://fish/species/salmon_sockeye/salmon_sockeye.tres" id="100_salmon_sockeye"] +[ext_resource type="Resource" path="res://fish/species/marlin_black/marlin_black.tres" id="101_marlin_black"] +[ext_resource type="Resource" path="res://fish/species/marlin_blue/marlin_blue.tres" id="102_marlin_blue"] +[ext_resource type="Resource" path="res://fish/species/sailfish/sailfish.tres" id="103_sailfish"] +[ext_resource type="Resource" path="res://fish/species/swordfish/swordfish.tres" id="104_swordfish"] +[ext_resource type="Resource" path="res://fish/species/marlin_white/marlin_white.tres" id="105_marlin_white"] +[ext_resource type="Resource" path="res://fish/species/mahi_mahi/mahi_mahi.tres" id="106_mahi_mahi"] +[ext_resource type="Resource" path="res://fish/species/opah/opah.tres" id="107_opah"] +[ext_resource type="Resource" path="res://fish/species/wahoo/wahoo.tres" id="108_wahoo"] +[ext_resource type="Resource" path="res://fish/species/tuna_albacore/tuna_albacore.tres" id="109_tuna_albacore"] +[ext_resource type="Resource" path="res://fish/species/tuna_bigeye/tuna_bigeye.tres" id="110_tuna_bigeye"] +[ext_resource type="Resource" path="res://fish/species/tuna_bluefin/tuna_bluefin.tres" id="111_tuna_bluefin"] +[ext_resource type="Resource" path="res://fish/species/tuna_skipjack/tuna_skipjack.tres" id="112_tuna_skipjack"] +[ext_resource type="Resource" path="res://fish/species/tuna_yellowfin/tuna_yellowfin.tres" id="113_tuna_yellowfin"] +[ext_resource type="Resource" path="res://fish/species/octopus_common/octopus_common.tres" id="114_octopus_common"] +[ext_resource type="Resource" path="res://fish/species/octopus_day/octopus_day.tres" id="115_octopus_day"] +[ext_resource type="Resource" path="res://fish/species/octopus_giant_pacific/octopus_giant_pacific.tres" id="116_octopus_giant_pacific"] +[ext_resource type="Resource" path="res://fish/species/octopus_greater_blue_ringed/octopus_greater_blue_ringed.tres" id="117_octopus_greater_blue_ringed"] +[ext_resource type="Resource" path="res://fish/species/sunfish/sunfish.tres" id="118_sunfish"] +[ext_resource type="Resource" path="res://fish/species/skate_barndoor/skate_barndoor.tres" id="119_skate_barndoor"] +[ext_resource type="Resource" path="res://fish/species/manta_ray_giant/manta_ray_giant.tres" id="120_manta_ray_giant"] +[ext_resource type="Resource" path="res://fish/species/sawfish_largetooth/sawfish_largetooth.tres" id="121_sawfish_largetooth"] +[ext_resource type="Resource" path="res://fish/species/stingray_southern/stingray_southern.tres" id="122_stingray_southern"] +[ext_resource type="Resource" path="res://fish/species/lionfish_red/lionfish_red.tres" id="123_lionfish_red"] +[ext_resource type="Resource" path="res://fish/species/scorpionfish_red/scorpionfish_red.tres" id="124_scorpionfish_red"] +[ext_resource type="Resource" path="res://fish/species/moray_green/moray_green.tres" id="125_moray_green"] +[ext_resource type="Resource" path="res://fish/species/flounder_peacock/flounder_peacock.tres" id="126_flounder_peacock"] +[ext_resource type="Resource" path="res://fish/species/surgeonfish_blue/surgeonfish_blue.tres" id="127_surgeonfish_blue"] +[ext_resource type="Resource" path="res://fish/species/parrotfish_rainbow/parrotfish_rainbow.tres" id="128_parrotfish_rainbow"] +[ext_resource type="Resource" path="res://fish/species/parrotfish_stoplight/parrotfish_stoplight.tres" id="129_parrotfish_stoplight"] +[ext_resource type="Resource" path="res://fish/species/tang_yellow/tang_yellow.tres" id="130_tang_yellow"] +[ext_resource type="Resource" path="res://fish/species/trumpetfish_atlantic/trumpetfish_atlantic.tres" id="131_trumpetfish_atlantic"] +[ext_resource type="Resource" path="res://fish/species/triggerfish_gray/triggerfish_gray.tres" id="132_triggerfish_gray"] +[ext_resource type="Resource" path="res://fish/species/pufferfish_guineafowl/pufferfish_guineafowl.tres" id="133_pufferfish_guineafowl"] +[ext_resource type="Resource" path="res://fish/species/cowfish_longhorn/cowfish_longhorn.tres" id="134_cowfish_longhorn"] +[ext_resource type="Resource" path="res://fish/species/triggerfish_queen/triggerfish_queen.tres" id="135_triggerfish_queen"] +[ext_resource type="Resource" path="res://fish/species/cornetfish_red/cornetfish_red.tres" id="136_cornetfish_red"] +[ext_resource type="Resource" path="res://fish/species/porcupinefish_spotted/porcupinefish_spotted.tres" id="137_porcupinefish_spotted"] +[ext_resource type="Resource" path="res://fish/species/boxfish_yellow/boxfish_yellow.tres" id="138_boxfish_yellow"] +[ext_resource type="Resource" path="res://fish/species/butterflyfish_copperband/butterflyfish_copperband.tres" id="139_butterflyfish_copperband"] +[ext_resource type="Resource" path="res://fish/species/clownfish_ocellaris/clownfish_ocellaris.tres" id="140_clownfish_ocellaris"] +[ext_resource type="Resource" path="res://fish/species/angelfish_queen/angelfish_queen.tres" id="141_angelfish_queen"] +[ext_resource type="Resource" path="res://fish/species/grouper_atlantic_goliath/grouper_atlantic_goliath.tres" id="142_grouper_atlantic_goliath"] +[ext_resource type="Resource" path="res://fish/species/trevally_bluefin/trevally_bluefin.tres" id="143_trevally_bluefin"] +[ext_resource type="Resource" path="res://fish/species/grouper_giant/grouper_giant.tres" id="144_grouper_giant"] +[ext_resource type="Resource" path="res://fish/species/barracuda_great/barracuda_great.tres" id="145_barracuda_great"] +[ext_resource type="Resource" path="res://fish/species/grouper_gulf/grouper_gulf.tres" id="146_grouper_gulf"] +[ext_resource type="Resource" path="res://fish/species/grouper_nassau/grouper_nassau.tres" id="147_grouper_nassau"] +[ext_resource type="Resource" path="res://fish/species/grouper_red/grouper_red.tres" id="148_grouper_red"] +[ext_resource type="Resource" path="res://fish/species/chromis_blue_green/chromis_blue_green.tres" id="149_chromis_blue_green"] +[ext_resource type="Resource" path="res://fish/species/grunt_bluestriped/grunt_bluestriped.tres" id="150_grunt_bluestriped"] +[ext_resource type="Resource" path="res://fish/species/grunt_french/grunt_french.tres" id="151_grunt_french"] +[ext_resource type="Resource" path="res://fish/species/damselfish_sergeant_major/damselfish_sergeant_major.tres" id="152_damselfish_sergeant_major"] +[ext_resource type="Resource" path="res://fish/species/snapper_lane/snapper_lane.tres" id="153_snapper_lane"] +[ext_resource type="Resource" path="res://fish/species/snapper_mangrove/snapper_mangrove.tres" id="154_snapper_mangrove"] +[ext_resource type="Resource" path="res://fish/species/snapper_mutton/snapper_mutton.tres" id="155_snapper_mutton"] +[ext_resource type="Resource" path="res://fish/species/snapper_red/snapper_red.tres" id="156_snapper_red"] +[ext_resource type="Resource" path="res://fish/species/wrasse_ballan/wrasse_ballan.tres" id="157_wrasse_ballan"] +[ext_resource type="Resource" path="res://fish/species/wrasse_cleaner/wrasse_cleaner.tres" id="158_wrasse_cleaner"] +[ext_resource type="Resource" path="res://fish/species/hogfish/hogfish.tres" id="159_hogfish"] +[ext_resource type="Resource" path="res://fish/species/turtle_green/turtle_green.tres" id="160_turtle_green"] +[ext_resource type="Resource" path="res://fish/species/turtle_hawksbill/turtle_hawksbill.tres" id="161_turtle_hawksbill"] +[ext_resource type="Resource" path="res://fish/species/turtle_leatherback/turtle_leatherback.tres" id="162_turtle_leatherback"] +[ext_resource type="Resource" path="res://fish/species/turtle_loggerhead/turtle_loggerhead.tres" id="163_turtle_loggerhead"] +[ext_resource type="Resource" path="res://fish/species/seadragon_leafy/seadragon_leafy.tres" id="164_seadragon_leafy"] +[ext_resource type="Resource" path="res://fish/species/seadragon_weedy/seadragon_weedy.tres" id="165_seadragon_weedy"] +[ext_resource type="Resource" path="res://fish/species/oyster_black_lip_pearl/oyster_black_lip_pearl.tres" id="166_oyster_black_lip_pearl"] +[ext_resource type="Resource" path="res://fish/species/clam_giant/clam_giant.tres" id="167_clam_giant"] +[ext_resource type="Resource" path="res://fish/species/clam_geoduck/clam_geoduck.tres" id="168_clam_geoduck"] +[ext_resource type="Resource" path="res://fish/species/conch_queen/conch_queen.tres" id="169_conch_queen"] +[ext_resource type="Resource" path="res://fish/species/abalone_red/abalone_red.tres" id="170_abalone_red"] +[ext_resource type="Resource" path="res://fish/species/squid_bigfin_reef/squid_bigfin_reef.tres" id="171_squid_bigfin_reef"] +[ext_resource type="Resource" path="res://fish/species/squid_colossal/squid_colossal.tres" id="172_squid_colossal"] +[ext_resource type="Resource" path="res://fish/species/squid_giant/squid_giant.tres" id="173_squid_giant"] +[ext_resource type="Resource" path="res://fish/species/squid_humboldt/squid_humboldt.tres" id="174_squid_humboldt"] +[ext_resource type="Resource" path="res://fish/species/halfbeak_ballyhoo/halfbeak_ballyhoo.tres" id="175_halfbeak_ballyhoo"] +[ext_resource type="Resource" path="res://fish/species/needlefish_hound/needlefish_hound.tres" id="176_needlefish_hound"] +[ext_resource type="Resource" path="res://fish/species/flyingfish_tropical/flyingfish_tropical.tres" id="177_flyingfish_tropical"] +[ext_resource type="Resource" path="res://fish/species/bass/bass.tres" id="178_bass"] +[ext_resource type="Resource" path="res://fish/species/croaker_atlantic/croaker_atlantic.tres" id="179_croaker_atlantic"] +[ext_resource type="Resource" path="res://fish/species/black_drum/black_drum.tres" id="180_black_drum"] +[ext_resource type="Resource" path="res://fish/species/red_drum/red_drum.tres" id="181_red_drum"] +[ext_resource type="Resource" path="res://fish/species/mullet_striped/mullet_striped.tres" id="182_mullet_striped"] +[ext_resource type="Resource" path="res://fish/species/weakfish/weakfish.tres" id="183_weakfish"] +[ext_resource type="Resource" path="res://fish/species/croaker_yellowfin/croaker_yellowfin.tres" id="184_croaker_yellowfin"] +[ext_resource type="Resource" path="res://fish/species/rockfish_black/rockfish_black.tres" id="185_rockfish_black"] +[ext_resource type="Resource" path="res://fish/species/sea_bass_black/sea_bass_black.tres" id="186_sea_bass_black"] +[ext_resource type="Resource" path="res://fish/species/rockfish_canary/rockfish_canary.tres" id="187_rockfish_canary"] +[ext_resource type="Resource" path="res://fish/species/porgy_scup/porgy_scup.tres" id="188_porgy_scup"] +[ext_resource type="Resource" path="res://fish/species/sheepshead/sheepshead.tres" id="189_sheepshead"] +[ext_resource type="Resource" path="res://fish/species/tautog/tautog.tres" id="190_tautog"] +[ext_resource type="Resource" path="res://fish/species/rockfish_yelloweye/rockfish_yelloweye.tres" id="191_rockfish_yelloweye"] +[ext_resource type="Resource" path="res://fish/species/lingcod/lingcod.tres" id="192_lingcod"] +[ext_resource type="Resource" path="res://fish/species/milkfish/milkfish.tres" id="193_milkfish"] +[ext_resource type="Resource" path="res://fish/species/roosterfish/roosterfish.tres" id="194_roosterfish"] +[ext_resource type="Resource" path="res://fish/species/tarpon_atlantic/tarpon_atlantic.tres" id="195_tarpon_atlantic"] +[ext_resource type="Resource" path="res://fish/species/snook_common/snook_common.tres" id="196_snook_common"] +[ext_resource type="Resource" path="res://fish/species/bonefish/bonefish.tres" id="197_bonefish"] +[ext_resource type="Resource" path="res://fish/species/pompano_florida/pompano_florida.tres" id="198_pompano_florida"] +[ext_resource type="Resource" path="res://fish/species/ladyfish/ladyfish.tres" id="199_ladyfish"] +[ext_resource type="Resource" path="res://fish/species/permit/permit.tres" id="200_permit"] +[ext_resource type="Resource" path="res://fish/species/whale_blue/whale_blue.tres" id="201_whale_blue"] +[ext_resource type="Resource" path="res://fish/species/dolphin_bottlenose/dolphin_bottlenose.tres" id="202_dolphin_bottlenose"] +[ext_resource type="Resource" path="res://fish/species/whale_humpback/whale_humpback.tres" id="203_whale_humpback"] +[ext_resource type="Resource" path="res://fish/species/whale_killer/whale_killer.tres" id="204_whale_killer"] +[ext_resource type="Resource" path="res://fish/species/whale_sperm/whale_sperm.tres" id="205_whale_sperm"] [resource] script = ExtResource("1_pool") -candidates = [ExtResource("2_bass"), ExtResource("3_sunfish"), ExtResource("4_tuna_albacore"), ExtResource("5_tuna_bigeye"), ExtResource("6_tuna_bluefin"), ExtResource("7_tuna_skipjack"), ExtResource("8_tuna_yellowfin"), ExtResource("9_salmon_atlantic"), ExtResource("10_salmon_chum"), ExtResource("11_salmon_coho"), ExtResource("12_salmon_pink"), ExtResource("13_salmon_sockeye"), ExtResource("14_anchovy_european"), ExtResource("15_anchovy_northern"), ExtResource("16_grouper_gulf"), ExtResource("17_grouper_red"), ExtResource("18_mackerel_atlantic"), ExtResource("19_mackerel_cero"), ExtResource("20_mackerel_chub"), ExtResource("21_mackerel_king"), ExtResource("22_mackerel_spanish"), ExtResource("23_marlin_black"), ExtResource("24_marlin_blue"), ExtResource("25_marlin_white"), ExtResource("26_pomfret_black"), ExtResource("27_pomfret_chinese"), ExtResource("28_pomfret_golden"), ExtResource("29_pomfret_white"), ExtResource("30_sailfish"), ExtResource("31_snapper_lane"), ExtResource("32_snapper_mangrove"), ExtResource("33_snapper_mutton"), ExtResource("34_snapper_red"), ExtResource("35_swordfish")] +candidates = [ExtResource("2_mudskipper_atlantic"), ExtResource("3_mullet_red"), ExtResource("4_plaice_european"), ExtResource("5_flounder_summer"), ExtResource("6_flounder_winter"), ExtResource("7_dugong"), ExtResource("8_seal_harbor"), ExtResource("9_sea_otter"), ExtResource("10_walrus"), ExtResource("11_manatee_west_indian"), ExtResource("12_pipefish_bay"), ExtResource("13_seahorse_lined"), ExtResource("14_monkfish"), ExtResource("15_tripletail"), ExtResource("16_mackerel_atlantic"), ExtResource("17_bluefish"), ExtResource("18_mackerel_cero"), ExtResource("19_mackerel_chub"), ExtResource("20_jack_crevalle"), ExtResource("21_mackerel_king"), ExtResource("22_mackerel_spanish"), ExtResource("23_queenfish_talang"), ExtResource("24_sand_lance_american"), ExtResource("25_menhaden_atlantic"), ExtResource("26_pomfret_black"), ExtResource("27_pomfret_chinese"), ExtResource("28_anchovy_european"), ExtResource("29_sardine_european"), ExtResource("30_pomfret_golden"), ExtResource("31_anchovy_northern"), ExtResource("32_sardine_pacific"), ExtResource("33_pomfret_white"), ExtResource("34_shark_blacktip"), ExtResource("35_shark_great_hammerhead"), ExtResource("36_shark_great_white"), ExtResource("37_shark_tiger"), ExtResource("38_shark_whale"), ExtResource("39_wolffish_atlantic"), ExtResource("40_cusk"), ExtResource("41_wolffish_spotted"), ExtResource("42_herring_atlantic"), ExtResource("43_capelin"), ExtResource("44_sprat_european"), ExtResource("45_herring_pacific"), ExtResource("46_pollock_alaska"), ExtResource("47_cod_atlantic"), ExtResource("48_pollock_atlantic"), ExtResource("49_sole_dover"), ExtResource("50_haddock"), ExtResource("51_cod_pacific"), ExtResource("52_hake_pacific"), ExtResource("53_hake_silver"), ExtResource("54_nautilus_chambered"), ExtResource("55_cuttlefish_common"), ExtResource("56_cuttlefish_flamboyant"), ExtResource("57_tilefish_blueline"), ExtResource("58_tilefish_golden"), ExtResource("59_ocean_perch_pacific"), ExtResource("60_sea_bass_chilean"), ExtResource("61_sablefish"), ExtResource("62_wreckfish"), ExtResource("63_oarfish_giant"), ExtResource("64_coelacanth_west_indian"), ExtResource("65_anglerfish_black_seadevil"), ExtResource("66_fangtooth_common"), ExtResource("67_gulper_eel"), ExtResource("68_barreleye_pacific"), ExtResource("69_blobfish_smooth_head"), ExtResource("70_lanternfish_spotted"), ExtResource("71_sea_star_crown_of_thorns"), ExtResource("72_sea_cucumber_giant_california"), ExtResource("73_urchin_purple"), ExtResource("74_sand_dollar"), ExtResource("75_sea_star_sunflower"), ExtResource("76_jelly_crystal"), ExtResource("77_jelly_lions_mane"), ExtResource("78_jelly_moon"), ExtResource("79_jelly_pacific_sea_nettle"), ExtResource("80_jelly_sea_wasp"), ExtResource("81_pompano_african"), ExtResource("82_cobia"), ExtResource("83_trevally_giant"), ExtResource("84_amberjack_greater"), ExtResource("85_amberjack_lesser"), ExtResource("86_halibut_atlantic"), ExtResource("87_halibut_pacific"), ExtResource("88_turbot"), ExtResource("89_lobster_american"), ExtResource("90_krill_antarctic"), ExtResource("91_lobster_caribbean_spiny"), ExtResource("92_shrimp_peacock_mantis"), ExtResource("93_shrimp_skunk_cleaner"), ExtResource("94_crab_japanese_spider"), ExtResource("95_crab_red_king"), ExtResource("96_salmon_atlantic"), ExtResource("97_salmon_chum"), ExtResource("98_salmon_coho"), ExtResource("99_salmon_pink"), ExtResource("100_salmon_sockeye"), ExtResource("101_marlin_black"), ExtResource("102_marlin_blue"), ExtResource("103_sailfish"), ExtResource("104_swordfish"), ExtResource("105_marlin_white"), ExtResource("106_mahi_mahi"), ExtResource("107_opah"), ExtResource("108_wahoo"), ExtResource("109_tuna_albacore"), ExtResource("110_tuna_bigeye"), ExtResource("111_tuna_bluefin"), ExtResource("112_tuna_skipjack"), ExtResource("113_tuna_yellowfin"), ExtResource("114_octopus_common"), ExtResource("115_octopus_day"), ExtResource("116_octopus_giant_pacific"), ExtResource("117_octopus_greater_blue_ringed"), ExtResource("118_sunfish"), ExtResource("119_skate_barndoor"), ExtResource("120_manta_ray_giant"), ExtResource("121_sawfish_largetooth"), ExtResource("122_stingray_southern"), ExtResource("123_lionfish_red"), ExtResource("124_scorpionfish_red"), ExtResource("125_moray_green"), ExtResource("126_flounder_peacock"), ExtResource("127_surgeonfish_blue"), ExtResource("128_parrotfish_rainbow"), ExtResource("129_parrotfish_stoplight"), ExtResource("130_tang_yellow"), ExtResource("131_trumpetfish_atlantic"), ExtResource("132_triggerfish_gray"), ExtResource("133_pufferfish_guineafowl"), ExtResource("134_cowfish_longhorn"), ExtResource("135_triggerfish_queen"), ExtResource("136_cornetfish_red"), ExtResource("137_porcupinefish_spotted"), ExtResource("138_boxfish_yellow"), ExtResource("139_butterflyfish_copperband"), ExtResource("140_clownfish_ocellaris"), ExtResource("141_angelfish_queen"), ExtResource("142_grouper_atlantic_goliath"), ExtResource("143_trevally_bluefin"), ExtResource("144_grouper_giant"), ExtResource("145_barracuda_great"), ExtResource("146_grouper_gulf"), ExtResource("147_grouper_nassau"), ExtResource("148_grouper_red"), ExtResource("149_chromis_blue_green"), ExtResource("150_grunt_bluestriped"), ExtResource("151_grunt_french"), ExtResource("152_damselfish_sergeant_major"), ExtResource("153_snapper_lane"), ExtResource("154_snapper_mangrove"), ExtResource("155_snapper_mutton"), ExtResource("156_snapper_red"), ExtResource("157_wrasse_ballan"), ExtResource("158_wrasse_cleaner"), ExtResource("159_hogfish"), ExtResource("160_turtle_green"), ExtResource("161_turtle_hawksbill"), ExtResource("162_turtle_leatherback"), ExtResource("163_turtle_loggerhead"), ExtResource("164_seadragon_leafy"), ExtResource("165_seadragon_weedy"), ExtResource("166_oyster_black_lip_pearl"), ExtResource("167_clam_giant"), ExtResource("168_clam_geoduck"), ExtResource("169_conch_queen"), ExtResource("170_abalone_red"), ExtResource("171_squid_bigfin_reef"), ExtResource("172_squid_colossal"), ExtResource("173_squid_giant"), ExtResource("174_squid_humboldt"), ExtResource("175_halfbeak_ballyhoo"), ExtResource("176_needlefish_hound"), ExtResource("177_flyingfish_tropical"), ExtResource("178_bass"), ExtResource("179_croaker_atlantic"), ExtResource("180_black_drum"), ExtResource("181_red_drum"), ExtResource("182_mullet_striped"), ExtResource("183_weakfish"), ExtResource("184_croaker_yellowfin"), ExtResource("185_rockfish_black"), ExtResource("186_sea_bass_black"), ExtResource("187_rockfish_canary"), ExtResource("188_porgy_scup"), ExtResource("189_sheepshead"), ExtResource("190_tautog"), ExtResource("191_rockfish_yelloweye"), ExtResource("192_lingcod"), ExtResource("193_milkfish"), ExtResource("194_roosterfish"), ExtResource("195_tarpon_atlantic"), ExtResource("196_snook_common"), ExtResource("197_bonefish"), ExtResource("198_pompano_florida"), ExtResource("199_ladyfish"), ExtResource("200_permit"), ExtResource("201_whale_blue"), ExtResource("202_dolphin_bottlenose"), ExtResource("203_whale_humpback"), ExtResource("204_whale_killer"), ExtResource("205_whale_sperm")] diff --git a/fish/pools/starter_pond_pool.tres b/fish/pools/starter_pond_pool.tres index de1a327..e9718d9 100644 --- a/fish/pools/starter_pond_pool.tres +++ b/fish/pools/starter_pond_pool.tres @@ -1,26 +1,113 @@ -[gd_resource type="Resource" load_steps=21 format=3] +[gd_resource type="Resource" load_steps=108 format=3] [ext_resource type="Script" path="res://fish/fish_pool.gd" id="1_pool"] -[ext_resource type="Resource" path="res://fish/species/bluegill/bluegill.tres" id="2_bluegill"] -[ext_resource type="Resource" path="res://fish/species/carp/carp.tres" id="3_carp"] -[ext_resource type="Resource" path="res://fish/species/catfish_blue/catfish_blue.tres" id="4_catfish_blue"] -[ext_resource type="Resource" path="res://fish/species/catfish_channel/catfish_channel.tres" id="5_catfish_channel"] -[ext_resource type="Resource" path="res://fish/species/catfish_flathead/catfish_flathead.tres" id="6_catfish_flathead"] -[ext_resource type="Resource" path="res://fish/species/catfish_white/catfish_white.tres" id="7_catfish_white"] -[ext_resource type="Resource" path="res://fish/species/goby_round/goby_round.tres" id="8_goby_round"] -[ext_resource type="Resource" path="res://fish/species/chub_european/chub_european.tres" id="9_chub_european"] -[ext_resource type="Resource" path="res://fish/species/chub_flame/chub_flame.tres" id="10_chub_flame"] -[ext_resource type="Resource" path="res://fish/species/chub_lake/chub_lake.tres" id="11_chub_lake"] -[ext_resource type="Resource" path="res://fish/species/goldfish/goldfish.tres" id="12_goldfish"] -[ext_resource type="Resource" path="res://fish/species/goldfish_bubbleeye/goldfish_bubbleeye.tres" id="13_goldfish_bubbleeye"] -[ext_resource type="Resource" path="res://fish/species/sauger/sauger.tres" id="14_sauger"] -[ext_resource type="Resource" path="res://fish/species/saugeye/saugeye.tres" id="15_saugeye"] -[ext_resource type="Resource" path="res://fish/species/trout_cutthroat/trout_cutthroat.tres" id="16_trout_cutthroat"] -[ext_resource type="Resource" path="res://fish/species/trout_golden/trout_golden.tres" id="17_trout_golden"] -[ext_resource type="Resource" path="res://fish/species/trout_rainbow/trout_rainbow.tres" id="18_trout_rainbow"] -[ext_resource type="Resource" path="res://fish/species/trout_steelhead/trout_steelhead.tres" id="19_trout_steelhead"] -[ext_resource type="Resource" path="res://fish/species/walleye/walleye.tres" id="20_walleye"] +[ext_resource type="Resource" path="res://fish/species/bowfin/bowfin.tres" id="2_bowfin"] +[ext_resource type="Resource" path="res://fish/species/gar_spotted/gar_spotted.tres" id="3_gar_spotted"] +[ext_resource type="Resource" path="res://fish/species/lungfish_west_african/lungfish_west_african.tres" id="4_lungfish_west_african"] +[ext_resource type="Resource" path="res://fish/species/guppy/guppy.tres" id="5_guppy"] +[ext_resource type="Resource" path="res://fish/species/tetra_neon/tetra_neon.tres" id="6_tetra_neon"] +[ext_resource type="Resource" path="res://fish/species/danio_zebra/danio_zebra.tres" id="7_danio_zebra"] +[ext_resource type="Resource" path="res://fish/species/largemouth_bass/largemouth_bass.tres" id="8_largemouth_bass"] +[ext_resource type="Resource" path="res://fish/species/bullhead_black/bullhead_black.tres" id="9_bullhead_black"] +[ext_resource type="Resource" path="res://fish/species/bullhead_brown/bullhead_brown.tres" id="10_bullhead_brown"] +[ext_resource type="Resource" path="res://fish/species/catfish_channel/catfish_channel.tres" id="11_catfish_channel"] +[ext_resource type="Resource" path="res://fish/species/catfish_white/catfish_white.tres" id="12_catfish_white"] +[ext_resource type="Resource" path="res://fish/species/bullhead_yellow/bullhead_yellow.tres" id="13_bullhead_yellow"] +[ext_resource type="Resource" path="res://fish/species/carp/carp.tres" id="14_carp"] +[ext_resource type="Resource" path="res://fish/species/roach_common/roach_common.tres" id="15_roach_common"] +[ext_resource type="Resource" path="res://fish/species/rudd/rudd.tres" id="16_rudd"] +[ext_resource type="Resource" path="res://fish/species/tench/tench.tres" id="17_tench"] +[ext_resource type="Resource" path="res://fish/species/crayfish_red_swamp/crayfish_red_swamp.tres" id="18_crayfish_red_swamp"] +[ext_resource type="Resource" path="res://fish/species/minnow_fathead/minnow_fathead.tres" id="19_minnow_fathead"] +[ext_resource type="Resource" path="res://fish/species/shiner_golden/shiner_golden.tres" id="20_shiner_golden"] +[ext_resource type="Resource" path="res://fish/species/loach_weather/loach_weather.tres" id="21_loach_weather"] +[ext_resource type="Resource" path="res://fish/species/goldfish_bubbleeye/goldfish_bubbleeye.tres" id="22_goldfish_bubbleeye"] +[ext_resource type="Resource" path="res://fish/species/goldfish/goldfish.tres" id="23_goldfish"] +[ext_resource type="Resource" path="res://fish/species/koi/koi.tres" id="24_koi"] +[ext_resource type="Resource" path="res://fish/species/crappie_black/crappie_black.tres" id="25_crappie_black"] +[ext_resource type="Resource" path="res://fish/species/bluegill/bluegill.tres" id="26_bluegill"] +[ext_resource type="Resource" path="res://fish/species/green_sunfish/green_sunfish.tres" id="27_green_sunfish"] +[ext_resource type="Resource" path="res://fish/species/pumpkinseed/pumpkinseed.tres" id="28_pumpkinseed"] +[ext_resource type="Resource" path="res://fish/species/redear_sunfish/redear_sunfish.tres" id="29_redear_sunfish"] +[ext_resource type="Resource" path="res://fish/species/warmouth/warmouth.tres" id="30_warmouth"] +[ext_resource type="Resource" path="res://fish/species/pickerel_chain/pickerel_chain.tres" id="31_pickerel_chain"] +[ext_resource type="Resource" path="res://fish/species/pickerel_grass/pickerel_grass.tres" id="32_pickerel_grass"] +[ext_resource type="Resource" path="res://fish/species/betta_siamese/betta_siamese.tres" id="33_betta_siamese"] +[ext_resource type="Resource" path="res://fish/species/catfish_walking/catfish_walking.tres" id="34_catfish_walking"] +[ext_resource type="Resource" path="res://fish/species/sturgeon_lake/sturgeon_lake.tres" id="35_sturgeon_lake"] +[ext_resource type="Resource" path="res://fish/species/burbot/burbot.tres" id="36_burbot"] +[ext_resource type="Resource" path="res://fish/species/cisco/cisco.tres" id="37_cisco"] +[ext_resource type="Resource" path="res://fish/species/whitefish_lake/whitefish_lake.tres" id="38_whitefish_lake"] +[ext_resource type="Resource" path="res://fish/species/char_arctic/char_arctic.tres" id="39_char_arctic"] +[ext_resource type="Resource" path="res://fish/species/trout_golden/trout_golden.tres" id="40_trout_golden"] +[ext_resource type="Resource" path="res://fish/species/axolotl/axolotl.tres" id="41_axolotl"] +[ext_resource type="Resource" path="res://fish/species/bream_common/bream_common.tres" id="42_bream_common"] +[ext_resource type="Resource" path="res://fish/species/muskellunge/muskellunge.tres" id="43_muskellunge"] +[ext_resource type="Resource" path="res://fish/species/shiner_emerald/shiner_emerald.tres" id="44_shiner_emerald"] +[ext_resource type="Resource" path="res://fish/species/chub_lake/chub_lake.tres" id="45_chub_lake"] +[ext_resource type="Resource" path="res://fish/species/crappie_white/crappie_white.tres" id="46_crappie_white"] +[ext_resource type="Resource" path="res://fish/species/yellow_perch/yellow_perch.tres" id="47_yellow_perch"] +[ext_resource type="Resource" path="res://fish/species/pike_northern/pike_northern.tres" id="48_pike_northern"] +[ext_resource type="Resource" path="res://fish/species/saugeye/saugeye.tres" id="49_saugeye"] +[ext_resource type="Resource" path="res://fish/species/walleye/walleye.tres" id="50_walleye"] +[ext_resource type="Resource" path="res://fish/species/goby_round/goby_round.tres" id="51_goby_round"] +[ext_resource type="Resource" path="res://fish/species/smelt_rainbow/smelt_rainbow.tres" id="52_smelt_rainbow"] +[ext_resource type="Resource" path="res://fish/species/gourami_giant/gourami_giant.tres" id="53_gourami_giant"] +[ext_resource type="Resource" path="res://fish/species/tilapia_nile/tilapia_nile.tres" id="54_tilapia_nile"] +[ext_resource type="Resource" path="res://fish/species/gar_longnose/gar_longnose.tres" id="55_gar_longnose"] +[ext_resource type="Resource" path="res://fish/species/paddlefish/paddlefish.tres" id="56_paddlefish"] +[ext_resource type="Resource" path="res://fish/species/sturgeon_shovelnose/sturgeon_shovelnose.tres" id="57_sturgeon_shovelnose"] +[ext_resource type="Resource" path="res://fish/species/foureyes_largescale/foureyes_largescale.tres" id="58_foureyes_largescale"] +[ext_resource type="Resource" path="res://fish/species/grayling_arctic/grayling_arctic.tres" id="59_grayling_arctic"] +[ext_resource type="Resource" path="res://fish/species/trout_brown/trout_brown.tres" id="60_trout_brown"] +[ext_resource type="Resource" path="res://fish/species/trout_cutthroat/trout_cutthroat.tres" id="61_trout_cutthroat"] +[ext_resource type="Resource" path="res://fish/species/trout_rainbow/trout_rainbow.tres" id="62_trout_rainbow"] +[ext_resource type="Resource" path="res://fish/species/hellbender/hellbender.tres" id="63_hellbender"] +[ext_resource type="Resource" path="res://fish/species/smallmouth_bass/smallmouth_bass.tres" id="64_smallmouth_bass"] +[ext_resource type="Resource" path="res://fish/species/buffalo_bigmouth/buffalo_bigmouth.tres" id="65_buffalo_bigmouth"] +[ext_resource type="Resource" path="res://fish/species/redhorse_golden/redhorse_golden.tres" id="66_redhorse_golden"] +[ext_resource type="Resource" path="res://fish/species/quillback/quillback.tres" id="67_quillback"] +[ext_resource type="Resource" path="res://fish/species/buffalo_smallmouth/buffalo_smallmouth.tres" id="68_buffalo_smallmouth"] +[ext_resource type="Resource" path="res://fish/species/sucker_white/sucker_white.tres" id="69_sucker_white"] +[ext_resource type="Resource" path="res://fish/species/catfish_blue/catfish_blue.tres" id="70_catfish_blue"] +[ext_resource type="Resource" path="res://fish/species/catfish_flathead/catfish_flathead.tres" id="71_catfish_flathead"] +[ext_resource type="Resource" path="res://fish/species/madtom_tadpole/madtom_tadpole.tres" id="72_madtom_tadpole"] +[ext_resource type="Resource" path="res://fish/species/barbel_common/barbel_common.tres" id="73_barbel_common"] +[ext_resource type="Resource" path="res://fish/species/chub_european/chub_european.tres" id="74_chub_european"] +[ext_resource type="Resource" path="res://fish/species/fallfish/fallfish.tres" id="75_fallfish"] +[ext_resource type="Resource" path="res://fish/species/ide/ide.tres" id="76_ide"] +[ext_resource type="Resource" path="res://fish/species/gar_alligator/gar_alligator.tres" id="77_gar_alligator"] +[ext_resource type="Resource" path="res://fish/species/arapaima/arapaima.tres" id="78_arapaima"] +[ext_resource type="Resource" path="res://fish/species/tigerfish_goliath/tigerfish_goliath.tres" id="79_tigerfish_goliath"] +[ext_resource type="Resource" path="res://fish/species/shiner_common/shiner_common.tres" id="80_shiner_common"] +[ext_resource type="Resource" path="res://fish/species/chub_creek/chub_creek.tres" id="81_chub_creek"] +[ext_resource type="Resource" path="res://fish/species/chub_flame/chub_flame.tres" id="82_chub_flame"] +[ext_resource type="Resource" path="res://fish/species/electric_eel/electric_eel.tres" id="83_electric_eel"] +[ext_resource type="Resource" path="res://fish/species/freshwater_drum/freshwater_drum.tres" id="84_freshwater_drum"] +[ext_resource type="Resource" path="res://fish/species/goldeye/goldeye.tres" id="85_goldeye"] +[ext_resource type="Resource" path="res://fish/species/mooneye/mooneye.tres" id="86_mooneye"] +[ext_resource type="Resource" path="res://fish/species/sauger/sauger.tres" id="87_sauger"] +[ext_resource type="Resource" path="res://fish/species/eel_american/eel_american.tres" id="88_eel_american"] +[ext_resource type="Resource" path="res://fish/species/eel_european/eel_european.tres" id="89_eel_european"] +[ext_resource type="Resource" path="res://fish/species/smelt_eulachon/smelt_eulachon.tres" id="90_smelt_eulachon"] +[ext_resource type="Resource" path="res://fish/species/sturgeon_white/sturgeon_white.tres" id="91_sturgeon_white"] +[ext_resource type="Resource" path="res://fish/species/trout_steelhead/trout_steelhead.tres" id="92_trout_steelhead"] +[ext_resource type="Resource" path="res://fish/species/stingray_ocellate_river/stingray_ocellate_river.tres" id="93_stingray_ocellate_river"] +[ext_resource type="Resource" path="res://fish/species/white_perch/white_perch.tres" id="94_white_perch"] +[ext_resource type="Resource" path="res://fish/species/barramundi/barramundi.tres" id="95_barramundi"] +[ext_resource type="Resource" path="res://fish/species/knifefish_clown/knifefish_clown.tres" id="96_knifefish_clown"] +[ext_resource type="Resource" path="res://fish/species/loach_clown/loach_clown.tres" id="97_loach_clown"] +[ext_resource type="Resource" path="res://fish/species/discus/discus.tres" id="98_discus"] +[ext_resource type="Resource" path="res://fish/species/angelfish_freshwater/angelfish_freshwater.tres" id="99_angelfish_freshwater"] +[ext_resource type="Resource" path="res://fish/species/oscar/oscar.tres" id="100_oscar"] +[ext_resource type="Resource" path="res://fish/species/tambaqui/tambaqui.tres" id="101_tambaqui"] +[ext_resource type="Resource" path="res://fish/species/snakehead_giant/snakehead_giant.tres" id="102_snakehead_giant"] +[ext_resource type="Resource" path="res://fish/species/dorado_golden/dorado_golden.tres" id="103_dorado_golden"] +[ext_resource type="Resource" path="res://fish/species/mahseer_golden/mahseer_golden.tres" id="104_mahseer_golden"] +[ext_resource type="Resource" path="res://fish/species/peacock_bass/peacock_bass.tres" id="105_peacock_bass"] +[ext_resource type="Resource" path="res://fish/species/piranha_red_bellied/piranha_red_bellied.tres" id="106_piranha_red_bellied"] +[ext_resource type="Resource" path="res://fish/species/arowana_silver/arowana_silver.tres" id="107_arowana_silver"] [resource] script = ExtResource("1_pool") -candidates = [ExtResource("2_bluegill"), ExtResource("3_carp"), ExtResource("4_catfish_blue"), ExtResource("5_catfish_channel"), ExtResource("6_catfish_flathead"), ExtResource("7_catfish_white"), ExtResource("8_goby_round"), ExtResource("9_chub_european"), ExtResource("10_chub_flame"), ExtResource("11_chub_lake"), ExtResource("12_goldfish"), ExtResource("13_goldfish_bubbleeye"), ExtResource("14_sauger"), ExtResource("15_saugeye"), ExtResource("16_trout_cutthroat"), ExtResource("17_trout_golden"), ExtResource("18_trout_rainbow"), ExtResource("19_trout_steelhead"), ExtResource("20_walleye")] +candidates = [ExtResource("2_bowfin"), ExtResource("3_gar_spotted"), ExtResource("4_lungfish_west_african"), ExtResource("5_guppy"), ExtResource("6_tetra_neon"), ExtResource("7_danio_zebra"), ExtResource("8_largemouth_bass"), ExtResource("9_bullhead_black"), ExtResource("10_bullhead_brown"), ExtResource("11_catfish_channel"), ExtResource("12_catfish_white"), ExtResource("13_bullhead_yellow"), ExtResource("14_carp"), ExtResource("15_roach_common"), ExtResource("16_rudd"), ExtResource("17_tench"), ExtResource("18_crayfish_red_swamp"), ExtResource("19_minnow_fathead"), ExtResource("20_shiner_golden"), ExtResource("21_loach_weather"), ExtResource("22_goldfish_bubbleeye"), ExtResource("23_goldfish"), ExtResource("24_koi"), ExtResource("25_crappie_black"), ExtResource("26_bluegill"), ExtResource("27_green_sunfish"), ExtResource("28_pumpkinseed"), ExtResource("29_redear_sunfish"), ExtResource("30_warmouth"), ExtResource("31_pickerel_chain"), ExtResource("32_pickerel_grass"), ExtResource("33_betta_siamese"), ExtResource("34_catfish_walking"), ExtResource("35_sturgeon_lake"), ExtResource("36_burbot"), ExtResource("37_cisco"), ExtResource("38_whitefish_lake"), ExtResource("39_char_arctic"), ExtResource("40_trout_golden"), ExtResource("41_axolotl"), ExtResource("42_bream_common"), ExtResource("43_muskellunge"), ExtResource("44_shiner_emerald"), ExtResource("45_chub_lake"), ExtResource("46_crappie_white"), ExtResource("47_yellow_perch"), ExtResource("48_pike_northern"), ExtResource("49_saugeye"), ExtResource("50_walleye"), ExtResource("51_goby_round"), ExtResource("52_smelt_rainbow"), ExtResource("53_gourami_giant"), ExtResource("54_tilapia_nile"), ExtResource("55_gar_longnose"), ExtResource("56_paddlefish"), ExtResource("57_sturgeon_shovelnose"), ExtResource("58_foureyes_largescale"), ExtResource("59_grayling_arctic"), ExtResource("60_trout_brown"), ExtResource("61_trout_cutthroat"), ExtResource("62_trout_rainbow"), ExtResource("63_hellbender"), ExtResource("64_smallmouth_bass"), ExtResource("65_buffalo_bigmouth"), ExtResource("66_redhorse_golden"), ExtResource("67_quillback"), ExtResource("68_buffalo_smallmouth"), ExtResource("69_sucker_white"), ExtResource("70_catfish_blue"), ExtResource("71_catfish_flathead"), ExtResource("72_madtom_tadpole"), ExtResource("73_barbel_common"), ExtResource("74_chub_european"), ExtResource("75_fallfish"), ExtResource("76_ide"), ExtResource("77_gar_alligator"), ExtResource("78_arapaima"), ExtResource("79_tigerfish_goliath"), ExtResource("80_shiner_common"), ExtResource("81_chub_creek"), ExtResource("82_chub_flame"), ExtResource("83_electric_eel"), ExtResource("84_freshwater_drum"), ExtResource("85_goldeye"), ExtResource("86_mooneye"), ExtResource("87_sauger"), ExtResource("88_eel_american"), ExtResource("89_eel_european"), ExtResource("90_smelt_eulachon"), ExtResource("91_sturgeon_white"), ExtResource("92_trout_steelhead"), ExtResource("93_stingray_ocellate_river"), ExtResource("94_white_perch"), ExtResource("95_barramundi"), ExtResource("96_knifefish_clown"), ExtResource("97_loach_clown"), ExtResource("98_discus"), ExtResource("99_angelfish_freshwater"), ExtResource("100_oscar"), ExtResource("101_tambaqui"), ExtResource("102_snakehead_giant"), ExtResource("103_dorado_golden"), ExtResource("104_mahseer_golden"), ExtResource("105_peacock_bass"), ExtResource("106_piranha_red_bellied"), ExtResource("107_arowana_silver")] diff --git a/fish/species/abalone_red/abalone_red.tres b/fish/species/abalone_red/abalone_red.tres index 039c7e2..6efe784 100644 --- a/fish/species/abalone_red/abalone_red.tres +++ b/fish/species/abalone_red/abalone_red.tres @@ -1,8 +1,9 @@ -[gd_resource type="Resource" script_class="FishData" load_steps=4 format=3] +[gd_resource type="Resource" script_class="FishData" load_steps=5 format=3] [ext_resource type="Script" path="res://fish/fish_data.gd" id="1_fish_data"] [ext_resource type="Resource" path="res://fishing/common_catch_profile.tres" id="2_profile"] [ext_resource type="Script" path="res://fish/fish_availability.gd" id="3_availability"] +[ext_resource type="Texture2D" path="res://art/exported/creatures/fish_placeholder.png" id="99_fish_placeholder"] [sub_resource type="Resource" id="Availability"] script = ExtResource("3_availability") @@ -13,10 +14,11 @@ require_fog = true script = ExtResource("1_fish_data") id = &"abalone_red" display_name = "red abalone" -active = false +active = true catalog_number = 6405 collection_group = &"Shellfish" logbook_fact = "red abalones cling to pacific rocks with broad muscular feet. rows of shell holes release water that has passed over the gills." +available_seasons = 15 allowed_water_types = 2 rarity = 3 base_catch_weight = 0.09 @@ -27,3 +29,4 @@ weight_max_lb = 12.0 sell_value_min = 24 sell_value_max = 56 sell_value_curve = 0.88 +display_texture = ExtResource("99_fish_placeholder") diff --git a/fish/species/amberjack_greater/amberjack_greater.tres b/fish/species/amberjack_greater/amberjack_greater.tres index 53ea638..b0e40b8 100644 --- a/fish/species/amberjack_greater/amberjack_greater.tres +++ b/fish/species/amberjack_greater/amberjack_greater.tres @@ -1,8 +1,9 @@ -[gd_resource type="Resource" script_class="FishData" load_steps=4 format=3] +[gd_resource type="Resource" script_class="FishData" load_steps=5 format=3] [ext_resource type="Script" path="res://fish/fish_data.gd" id="1_fish_data"] [ext_resource type="Resource" path="res://fishing/common_catch_profile.tres" id="2_profile"] [ext_resource type="Script" path="res://fish/fish_availability.gd" id="3_availability"] +[ext_resource type="Texture2D" path="res://art/exported/creatures/fish_placeholder.png" id="99_fish_placeholder"] [sub_resource type="Resource" id="Availability"] script = ExtResource("3_availability") @@ -11,10 +12,11 @@ script = ExtResource("3_availability") script = ExtResource("1_fish_data") id = &"amberjack_greater" display_name = "greater amberjack" -active = false +active = true catalog_number = 3604 collection_group = &"Large coastal predators" logbook_fact = "greater amberjacks circle reefs, wrecks, and offshore platforms. a dark stripe crosses the eye of their sturdy torpedo-shaped bodies." +available_seasons = 6 allowed_water_types = 2 rarity = 2 base_catch_weight = 0.25 @@ -25,3 +27,4 @@ weight_max_lb = 90.0 sell_value_min = 15 sell_value_max = 42 sell_value_curve = 0.82 +display_texture = ExtResource("99_fish_placeholder") diff --git a/fish/species/amberjack_lesser/amberjack_lesser.tres b/fish/species/amberjack_lesser/amberjack_lesser.tres index 2fd0aec..1d5983c 100644 --- a/fish/species/amberjack_lesser/amberjack_lesser.tres +++ b/fish/species/amberjack_lesser/amberjack_lesser.tres @@ -1,8 +1,9 @@ -[gd_resource type="Resource" script_class="FishData" load_steps=4 format=3] +[gd_resource type="Resource" script_class="FishData" load_steps=5 format=3] [ext_resource type="Script" path="res://fish/fish_data.gd" id="1_fish_data"] [ext_resource type="Resource" path="res://fishing/common_catch_profile.tres" id="2_profile"] [ext_resource type="Script" path="res://fish/fish_availability.gd" id="3_availability"] +[ext_resource type="Texture2D" path="res://art/exported/creatures/fish_placeholder.png" id="99_fish_placeholder"] [sub_resource type="Resource" id="Availability"] script = ExtResource("3_availability") @@ -11,10 +12,11 @@ script = ExtResource("3_availability") script = ExtResource("1_fish_data") id = &"amberjack_lesser" display_name = "lesser amberjack" -active = false +active = true catalog_number = 3605 collection_group = &"Large coastal predators" logbook_fact = "lesser amberjacks school around deep reefs and floating objects. an enlarged eye suits their preference for dimmer water." +available_seasons = 6 allowed_water_types = 2 rarity = 1 base_catch_weight = 0.75 @@ -25,3 +27,4 @@ weight_max_lb = 20.0 sell_value_min = 7 sell_value_max = 18 sell_value_curve = 0.86 +display_texture = ExtResource("99_fish_placeholder") diff --git a/fish/species/anchovy_european/anchovy_european.tres b/fish/species/anchovy_european/anchovy_european.tres index 722fbaf..0a7d122 100644 --- a/fish/species/anchovy_european/anchovy_european.tres +++ b/fish/species/anchovy_european/anchovy_european.tres @@ -3,7 +3,7 @@ [ext_resource type="Script" uid="uid://h7hg45b7wmst" path="res://fish/fish_data.gd" id="1_fish_data"] [ext_resource type="Resource" path="res://fishing/common_catch_profile.tres" id="2_profile"] [ext_resource type="Script" uid="uid://bs7cqi88csolc" path="res://fish/fish_availability.gd" id="3_availability_script"] -[ext_resource type="Texture2D" uid="uid://debgohfsg4ec7" path="res://fish/species/anchovy_european/fish_anchovy_european.png" id="4_texture"] +[ext_resource type="Texture2D" path="res://art/exported/creatures/805.png" id="4_texture"] [sub_resource type="Resource" id="AnchovyEuropeanAvailability"] script = ExtResource("3_availability_script") @@ -17,6 +17,7 @@ active = true catalog_number = 805 collection_group = &"Coastal schooling fish" logbook_fact = "european anchovies form dense schools and feed by filtering tiny plankton from coastal water." +available_seasons = 7 allowed_water_types = 2 base_catch_weight = 0.5 catch_profile = ExtResource("2_profile") diff --git a/fish/species/anchovy_european/fish_anchovy_european.png b/fish/species/anchovy_european/fish_anchovy_european.png index 44742f8..d691c72 100644 Binary files a/fish/species/anchovy_european/fish_anchovy_european.png and b/fish/species/anchovy_european/fish_anchovy_european.png differ diff --git a/fish/species/anchovy_northern/anchovy_northern.tres b/fish/species/anchovy_northern/anchovy_northern.tres index a1940d5..e2c7fa0 100644 --- a/fish/species/anchovy_northern/anchovy_northern.tres +++ b/fish/species/anchovy_northern/anchovy_northern.tres @@ -3,7 +3,7 @@ [ext_resource type="Script" uid="uid://h7hg45b7wmst" path="res://fish/fish_data.gd" id="1_fish_data"] [ext_resource type="Resource" path="res://fishing/common_catch_profile.tres" id="2_profile"] [ext_resource type="Script" uid="uid://bs7cqi88csolc" path="res://fish/fish_availability.gd" id="3_availability_script"] -[ext_resource type="Texture2D" uid="uid://6sikqc8eivta" path="res://fish/species/anchovy_northern/fish_anchovy_northern.png" id="4_texture"] +[ext_resource type="Texture2D" path="res://art/exported/creatures/808.png" id="4_texture"] [sub_resource type="Resource" id="AnchovyNorthernAvailability"] script = ExtResource("3_availability_script") @@ -17,6 +17,7 @@ active = true catalog_number = 808 collection_group = &"Coastal schooling fish" logbook_fact = "northern anchovies gather in huge schools along the pacific coast and filter plankton with their fine gill rakers." +available_seasons = 15 allowed_water_types = 2 base_catch_weight = 0.5 catch_profile = ExtResource("2_profile") diff --git a/fish/species/anchovy_northern/fish_anchovy_northern.png b/fish/species/anchovy_northern/fish_anchovy_northern.png index 20bacd8..f8749fb 100644 Binary files a/fish/species/anchovy_northern/fish_anchovy_northern.png and b/fish/species/anchovy_northern/fish_anchovy_northern.png differ diff --git a/fish/species/angelfish_freshwater/angelfish_freshwater.tres b/fish/species/angelfish_freshwater/angelfish_freshwater.tres index 5d9bda2..7a58450 100644 --- a/fish/species/angelfish_freshwater/angelfish_freshwater.tres +++ b/fish/species/angelfish_freshwater/angelfish_freshwater.tres @@ -1,8 +1,9 @@ -[gd_resource type="Resource" script_class="FishData" load_steps=4 format=3] +[gd_resource type="Resource" script_class="FishData" load_steps=5 format=3] [ext_resource type="Script" path="res://fish/fish_data.gd" id="1_fish_data"] [ext_resource type="Resource" path="res://fishing/common_catch_profile.tres" id="2_profile"] [ext_resource type="Script" path="res://fish/fish_availability.gd" id="3_availability"] +[ext_resource type="Texture2D" path="res://art/exported/creatures/fish_placeholder.png" id="99_fish_placeholder"] [sub_resource type="Resource" id="Availability"] script = ExtResource("3_availability") @@ -12,10 +13,11 @@ allow_night = false script = ExtResource("1_fish_data") id = &"angelfish_freshwater" display_name = "freshwater angelfish" -active = false +active = true catalog_number = 7504 collection_group = &"Tropical freshwater fish" logbook_fact = "freshwater angelfish slip between tall plants on narrow triangular bodies. long fins and vertical bars resemble stems and shadows." +available_seasons = 15 allowed_water_types = 1 rarity = 2 base_catch_weight = 0.3 @@ -26,3 +28,4 @@ weight_max_lb = 0.5 sell_value_min = 10 sell_value_max = 22 sell_value_curve = 0.95 +display_texture = ExtResource("99_fish_placeholder") diff --git a/fish/species/angelfish_queen/angelfish_queen.tres b/fish/species/angelfish_queen/angelfish_queen.tres index d45bbea..5a15f5b 100644 --- a/fish/species/angelfish_queen/angelfish_queen.tres +++ b/fish/species/angelfish_queen/angelfish_queen.tres @@ -1,8 +1,9 @@ -[gd_resource type="Resource" script_class="FishData" load_steps=4 format=3] +[gd_resource type="Resource" script_class="FishData" load_steps=5 format=3] [ext_resource type="Script" path="res://fish/fish_data.gd" id="1_fish_data"] [ext_resource type="Resource" path="res://fishing/common_catch_profile.tres" id="2_profile"] [ext_resource type="Script" path="res://fish/fish_availability.gd" id="3_availability"] +[ext_resource type="Texture2D" path="res://art/exported/creatures/fish_placeholder.png" id="99_fish_placeholder"] [sub_resource type="Resource" id="Availability"] script = ExtResource("3_availability") @@ -12,10 +13,11 @@ allow_night = false script = ExtResource("1_fish_data") id = &"angelfish_queen" display_name = "queen angelfish" -active = false +active = true catalog_number = 5703 collection_group = &"Reef ornamentals" logbook_fact = "queen angelfish graze sponges from warm atlantic reefs. a blue-ringed spot on the forehead resembles a tiny crown." +available_seasons = 15 allowed_water_types = 2 rarity = 2 base_catch_weight = 0.3 @@ -26,3 +28,4 @@ weight_max_lb = 2.0 sell_value_min = 11 sell_value_max = 25 sell_value_curve = 0.94 +display_texture = ExtResource("99_fish_placeholder") diff --git a/fish/species/anglerfish_black_seadevil/anglerfish_black_seadevil.tres b/fish/species/anglerfish_black_seadevil/anglerfish_black_seadevil.tres index 2888120..83b1fb3 100644 --- a/fish/species/anglerfish_black_seadevil/anglerfish_black_seadevil.tres +++ b/fish/species/anglerfish_black_seadevil/anglerfish_black_seadevil.tres @@ -1,8 +1,9 @@ -[gd_resource type="Resource" script_class="FishData" load_steps=4 format=3] +[gd_resource type="Resource" script_class="FishData" load_steps=5 format=3] [ext_resource type="Script" path="res://fish/fish_data.gd" id="1_fish_data"] [ext_resource type="Resource" path="res://fishing/common_catch_profile.tres" id="2_profile"] [ext_resource type="Script" path="res://fish/fish_availability.gd" id="3_availability"] +[ext_resource type="Texture2D" path="res://art/exported/creatures/fish_placeholder.png" id="99_fish_placeholder"] [sub_resource type="Resource" id="Availability"] script = ExtResource("3_availability") @@ -12,10 +13,11 @@ allow_day = false script = ExtResource("1_fish_data") id = &"anglerfish_black_seadevil" display_name = "black seadevil" -active = false +active = true catalog_number = 1801 collection_group = &"Deep-sea oddities" logbook_fact = "black seadevils lure prey with a glowing organ suspended above the mouth. tiny males permanently attach to much larger females." +available_seasons = 15 allowed_water_types = 2 rarity = 4 base_catch_weight = 0.05 @@ -26,3 +28,4 @@ weight_max_lb = 2.0 sell_value_min = 48 sell_value_max = 105 sell_value_curve = 0.92 +display_texture = ExtResource("99_fish_placeholder") diff --git a/fish/species/arapaima/arapaima.tres b/fish/species/arapaima/arapaima.tres index 2ee2c75..b43e3bd 100644 --- a/fish/species/arapaima/arapaima.tres +++ b/fish/species/arapaima/arapaima.tres @@ -1,8 +1,9 @@ -[gd_resource type="Resource" script_class="FishData" load_steps=4 format=3] +[gd_resource type="Resource" script_class="FishData" load_steps=5 format=3] [ext_resource type="Script" path="res://fish/fish_data.gd" id="1_fish_data"] [ext_resource type="Resource" path="res://fishing/common_catch_profile.tres" id="2_profile"] [ext_resource type="Script" path="res://fish/fish_availability.gd" id="3_availability"] +[ext_resource type="Texture2D" path="res://art/exported/creatures/fish_placeholder.png" id="99_fish_placeholder"] [sub_resource type="Resource" id="Availability"] script = ExtResource("3_availability") @@ -12,10 +13,11 @@ allow_night = false script = ExtResource("1_fish_data") id = &"arapaima" display_name = "arapaima" -active = false +active = true catalog_number = 2702 collection_group = &"Freshwater giants" logbook_fact = "arapaima must surface frequently to gulp air through a specialized swim bladder. large armored scales protect their long river-going bodies." +available_seasons = 15 allowed_water_types = 1 rarity = 4 base_catch_weight = 0.04 @@ -26,3 +28,4 @@ weight_max_lb = 400.0 sell_value_min = 60 sell_value_max = 140 sell_value_curve = 0.78 +display_texture = ExtResource("99_fish_placeholder") diff --git a/fish/species/arowana_silver/arowana_silver.tres b/fish/species/arowana_silver/arowana_silver.tres index 413621c..42baf33 100644 --- a/fish/species/arowana_silver/arowana_silver.tres +++ b/fish/species/arowana_silver/arowana_silver.tres @@ -1,8 +1,9 @@ -[gd_resource type="Resource" script_class="FishData" load_steps=4 format=3] +[gd_resource type="Resource" script_class="FishData" load_steps=5 format=3] [ext_resource type="Script" path="res://fish/fish_data.gd" id="1_fish_data"] [ext_resource type="Resource" path="res://fishing/common_catch_profile.tres" id="2_profile"] [ext_resource type="Script" path="res://fish/fish_availability.gd" id="3_availability"] +[ext_resource type="Texture2D" path="res://art/exported/creatures/fish_placeholder.png" id="99_fish_placeholder"] [sub_resource type="Resource" id="Availability"] script = ExtResource("3_availability") @@ -13,10 +14,11 @@ require_fog = true script = ExtResource("1_fish_data") id = &"arowana_silver" display_name = "silver arowana" -active = false +active = true catalog_number = 7606 collection_group = &"Tropical freshwater predators" logbook_fact = "silver arowanas patrol the surface with upturned mouths and long bodies. powerful jumps capture insects and small animals above the water." +available_seasons = 15 allowed_water_types = 1 rarity = 3 base_catch_weight = 0.11 @@ -27,3 +29,4 @@ weight_max_lb = 15.0 sell_value_min = 25 sell_value_max = 56 sell_value_curve = 0.86 +display_texture = ExtResource("99_fish_placeholder") diff --git a/fish/species/axolotl/axolotl.tres b/fish/species/axolotl/axolotl.tres index 17ba5ad..c201f9c 100644 --- a/fish/species/axolotl/axolotl.tres +++ b/fish/species/axolotl/axolotl.tres @@ -1,8 +1,9 @@ -[gd_resource type="Resource" script_class="FishData" load_steps=4 format=3] +[gd_resource type="Resource" script_class="FishData" load_steps=5 format=3] [ext_resource type="Script" path="res://fish/fish_data.gd" id="1_fish_data"] [ext_resource type="Resource" path="res://fishing/common_catch_profile.tres" id="2_profile"] [ext_resource type="Script" path="res://fish/fish_availability.gd" id="3_availability"] +[ext_resource type="Texture2D" path="res://art/exported/creatures/fish_placeholder.png" id="99_fish_placeholder"] [sub_resource type="Resource" id="Availability"] script = ExtResource("3_availability") @@ -13,10 +14,11 @@ require_fog = true script = ExtResource("1_fish_data") id = &"axolotl" display_name = "axolotl" -active = false +active = true catalog_number = 2001 collection_group = &"Freshwater amphibians" logbook_fact = "axolotls remain aquatic and keep feathery external gills throughout adulthood. lost limbs and parts of several organs can regenerate." +available_seasons = 7 allowed_water_types = 1 rarity = 4 base_catch_weight = 0.04 @@ -27,3 +29,4 @@ weight_max_lb = 0.7 sell_value_min = 36 sell_value_max = 78 sell_value_curve = 0.96 +display_texture = ExtResource("99_fish_placeholder") diff --git a/fish/species/barbel_common/barbel_common.tres b/fish/species/barbel_common/barbel_common.tres index 4e1b93d..9cbafff 100644 --- a/fish/species/barbel_common/barbel_common.tres +++ b/fish/species/barbel_common/barbel_common.tres @@ -1,8 +1,9 @@ -[gd_resource type="Resource" script_class="FishData" load_steps=4 format=3] +[gd_resource type="Resource" script_class="FishData" load_steps=5 format=3] [ext_resource type="Script" path="res://fish/fish_data.gd" id="1_fish_data"] [ext_resource type="Resource" path="res://fishing/common_catch_profile.tres" id="2_profile"] [ext_resource type="Script" path="res://fish/fish_availability.gd" id="3_availability"] +[ext_resource type="Texture2D" path="res://art/exported/creatures/fish_placeholder.png" id="99_fish_placeholder"] [sub_resource type="Resource" id="Availability"] script = ExtResource("3_availability") @@ -13,10 +14,11 @@ require_rain = true script = ExtResource("1_fish_data") id = &"barbel_common" display_name = "common barbel" -active = false +active = true catalog_number = 2501 collection_group = &"Freshwater coarse fish" logbook_fact = "common barbels hold close to fast river bottoms with streamlined bodies and broad fins. four mouth barbels locate food among stones." +available_seasons = 7 allowed_water_types = 1 rarity = 2 base_catch_weight = 0.28 @@ -27,3 +29,4 @@ weight_max_lb = 25.0 sell_value_min = 13 sell_value_max = 31 sell_value_curve = 0.85 +display_texture = ExtResource("99_fish_placeholder") diff --git a/fish/species/barracuda_great/barracuda_great.tres b/fish/species/barracuda_great/barracuda_great.tres index c2a105f..f15092c 100644 --- a/fish/species/barracuda_great/barracuda_great.tres +++ b/fish/species/barracuda_great/barracuda_great.tres @@ -1,8 +1,9 @@ -[gd_resource type="Resource" script_class="FishData" load_steps=4 format=3] +[gd_resource type="Resource" script_class="FishData" load_steps=5 format=3] [ext_resource type="Script" path="res://fish/fish_data.gd" id="1_fish_data"] [ext_resource type="Resource" path="res://fishing/common_catch_profile.tres" id="2_profile"] [ext_resource type="Script" path="res://fish/fish_availability.gd" id="3_availability"] +[ext_resource type="Texture2D" path="res://art/exported/creatures/fish_placeholder.png" id="99_fish_placeholder"] [sub_resource type="Resource" id="Availability"] script = ExtResource("3_availability") @@ -13,10 +14,11 @@ require_fog = true script = ExtResource("1_fish_data") id = &"barracuda_great" display_name = "great barracuda" -active = false +active = true catalog_number = 5804 collection_group = &"Reef predators" logbook_fact = "great barracudas hover motionless before accelerating toward prey. long jaws carry two distinct rows of sharp teeth." +available_seasons = 15 allowed_water_types = 2 rarity = 3 base_catch_weight = 0.12 @@ -27,3 +29,4 @@ weight_max_lb = 80.0 sell_value_min = 28 sell_value_max = 65 sell_value_curve = 0.82 +display_texture = ExtResource("99_fish_placeholder") diff --git a/fish/species/barramundi/barramundi.tres b/fish/species/barramundi/barramundi.tres index afbd336..705001d 100644 --- a/fish/species/barramundi/barramundi.tres +++ b/fish/species/barramundi/barramundi.tres @@ -1,8 +1,9 @@ -[gd_resource type="Resource" script_class="FishData" load_steps=4 format=3] +[gd_resource type="Resource" script_class="FishData" load_steps=5 format=3] [ext_resource type="Script" path="res://fish/fish_data.gd" id="1_fish_data"] [ext_resource type="Resource" path="res://fishing/common_catch_profile.tres" id="2_profile"] [ext_resource type="Script" path="res://fish/fish_availability.gd" id="3_availability"] +[ext_resource type="Texture2D" path="res://art/exported/creatures/fish_placeholder.png" id="99_fish_placeholder"] [sub_resource type="Resource" id="Availability"] script = ExtResource("3_availability") @@ -13,10 +14,11 @@ require_rain = true script = ExtResource("1_fish_data") id = &"barramundi" display_name = "barramundi" -active = false +active = true catalog_number = 7302 collection_group = &"Tropical estuary" logbook_fact = "barramundi move between rivers and coasts and can breathe in low-oxygen water. many mature first as males and later become females." +available_seasons = 15 allowed_water_types = 3 rarity = 2 base_catch_weight = 0.24 @@ -27,3 +29,4 @@ weight_max_lb = 45.0 sell_value_min = 15 sell_value_max = 38 sell_value_curve = 0.84 +display_texture = ExtResource("99_fish_placeholder") diff --git a/fish/species/barreleye_pacific/barreleye_pacific.tres b/fish/species/barreleye_pacific/barreleye_pacific.tres index d784c35..c0705dd 100644 --- a/fish/species/barreleye_pacific/barreleye_pacific.tres +++ b/fish/species/barreleye_pacific/barreleye_pacific.tres @@ -1,8 +1,9 @@ -[gd_resource type="Resource" script_class="FishData" load_steps=4 format=3] +[gd_resource type="Resource" script_class="FishData" load_steps=5 format=3] [ext_resource type="Script" path="res://fish/fish_data.gd" id="1_fish_data"] [ext_resource type="Resource" path="res://fishing/common_catch_profile.tres" id="2_profile"] [ext_resource type="Script" path="res://fish/fish_availability.gd" id="3_availability"] +[ext_resource type="Texture2D" path="res://art/exported/creatures/fish_placeholder.png" id="99_fish_placeholder"] [sub_resource type="Resource" id="Availability"] script = ExtResource("3_availability") @@ -13,10 +14,11 @@ require_fog = true script = ExtResource("1_fish_data") id = &"barreleye_pacific" display_name = "Pacific barreleye" -active = false +active = true catalog_number = 1804 collection_group = &"Deep-sea oddities" logbook_fact = "pacific barreleyes peer upward through transparent shields covering the head. tubular eyes rotate forward when the fish turns to feed." +available_seasons = 15 allowed_water_types = 2 rarity = 4 base_catch_weight = 0.045 @@ -27,3 +29,4 @@ weight_max_lb = 2.5 sell_value_min = 42 sell_value_max = 88 sell_value_curve = 0.9 +display_texture = ExtResource("99_fish_placeholder") diff --git a/fish/species/bass/bass.tres b/fish/species/bass/bass.tres index b263c3f..9d52609 100644 --- a/fish/species/bass/bass.tres +++ b/fish/species/bass/bass.tres @@ -3,7 +3,7 @@ [ext_resource type="Script" uid="uid://h7hg45b7wmst" path="res://fish/fish_data.gd" id="1_fish_data"] [ext_resource type="Resource" path="res://fishing/bass_catch_profile.tres" id="2_profile"] [ext_resource type="Script" uid="uid://bs7cqi88csolc" path="res://fish/fish_availability.gd" id="3_availability_script"] -[ext_resource type="Texture2D" uid="uid://dvh6s86asl4ix" path="res://fish/species/bass/fish_bass_striped.png" id="4_texture"] +[ext_resource type="Texture2D" path="res://art/exported/creatures/fish_placeholder.png" id="4_texture"] [sub_resource type="Resource" id="BassAvailability"] script = ExtResource("3_availability_script") @@ -18,6 +18,7 @@ active = true catalog_number = 6701 collection_group = &"Temperate coastal" logbook_fact = "striped bass split their lives between salt and fresh water, returning upriver to spawn. a long-lived striper may see three decades." +available_seasons = 5 allowed_water_types = 2 rarity = 1 base_catch_weight = 4.0 diff --git a/fish/species/bass/fish_bass_striped.png b/fish/species/bass/fish_bass_striped.png index efbf835..e39f48f 100644 Binary files a/fish/species/bass/fish_bass_striped.png and b/fish/species/bass/fish_bass_striped.png differ diff --git a/fish/species/beetle_stag_common/beetle_stag_common.png b/fish/species/beetle_stag_common/beetle_stag_common.png new file mode 100644 index 0000000..5ada780 Binary files /dev/null and b/fish/species/beetle_stag_common/beetle_stag_common.png differ diff --git a/fish/species/beetle_stag_common/beetle_stag_common.png.import b/fish/species/beetle_stag_common/beetle_stag_common.png.import new file mode 100644 index 0000000..4ad3482 --- /dev/null +++ b/fish/species/beetle_stag_common/beetle_stag_common.png.import @@ -0,0 +1,40 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://blw6lydoba8kd" +path="res://.godot/imported/beetle_stag_common.png-5eb7426d7dbda5083e39efc4cb980c8d.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://fish/species/beetle_stag_common/beetle_stag_common.png" +dest_files=["res://.godot/imported/beetle_stag_common.png-5eb7426d7dbda5083e39efc4cb980c8d.ctex"] + +[params] + +compress/mode=0 +compress/high_quality=false +compress/lossy_quality=0.7 +compress/uastc_level=0 +compress/rdo_quality_loss=0.0 +compress/hdr_compression=1 +compress/normal_map=0 +compress/channel_pack=0 +mipmaps/generate=false +mipmaps/limit=-1 +roughness/mode=0 +roughness/src_normal="" +process/channel_remap/red=0 +process/channel_remap/green=1 +process/channel_remap/blue=2 +process/channel_remap/alpha=3 +process/fix_alpha_border=true +process/premult_alpha=false +process/normal_map_invert_y=false +process/hdr_as_srgb=false +process/hdr_clamp_exposure=false +process/size_limit=0 +detect_3d/compress_to=1 diff --git a/fish/species/beetle_stag_common/beetle_stag_common.tres b/fish/species/beetle_stag_common/beetle_stag_common.tres new file mode 100644 index 0000000..f0f0e6d --- /dev/null +++ b/fish/species/beetle_stag_common/beetle_stag_common.tres @@ -0,0 +1,27 @@ +[gd_resource type="Resource" script_class="FishData" load_steps=4 format=3] + +[ext_resource type="Script" path="res://fish/fish_data.gd" id="1_fish_data"] +[ext_resource type="Resource" path="res://fishing/common_catch_profile.tres" id="2_profile"] +[ext_resource type="Texture2D" path="res://fish/species/beetle_stag_common/beetle_stag_common.png" id="3_texture"] + +[resource] +script = ExtResource("1_fish_data") +id = &"beetle_stag_common" +display_name = "common stag beetle" +active = true +catalog_number = 8001 +collection_group = &"Beetles" +logbook_fact = "common stag beetles use broad jaws to wrestle rivals and cling to tree bark. adults feed on sap and other sweet plant juices." +collection_method = 1 +habitat_label = "tree trunks" +available_seasons = 2 +allowed_water_types = 0 +rarity = 0 +base_catch_weight = 1.0 +catch_profile = ExtResource("2_profile") +weight_min_lb = 0.02 +weight_max_lb = 0.12 +sell_value_min = 4 +sell_value_max = 12 +sell_value_curve = 1.0 +display_texture = ExtResource("3_texture") diff --git a/fish/species/betta_siamese/betta_siamese.tres b/fish/species/betta_siamese/betta_siamese.tres index 06bbac6..4c9ca3c 100644 --- a/fish/species/betta_siamese/betta_siamese.tres +++ b/fish/species/betta_siamese/betta_siamese.tres @@ -1,8 +1,9 @@ -[gd_resource type="Resource" script_class="FishData" load_steps=4 format=3] +[gd_resource type="Resource" script_class="FishData" load_steps=5 format=3] [ext_resource type="Script" path="res://fish/fish_data.gd" id="1_fish_data"] [ext_resource type="Resource" path="res://fishing/common_catch_profile.tres" id="2_profile"] [ext_resource type="Script" path="res://fish/fish_availability.gd" id="3_availability"] +[ext_resource type="Texture2D" path="res://art/exported/creatures/7508.png" id="99_fish_placeholder"] [sub_resource type="Resource" id="Availability"] script = ExtResource("3_availability") @@ -13,10 +14,11 @@ require_rain = true script = ExtResource("1_fish_data") id = &"betta_siamese" display_name = "Siamese fighting fish" -active = false +active = true catalog_number = 7508 collection_group = &"Tropical freshwater fish" logbook_fact = "siamese fighting fish breathe surface air with a labyrinth organ. males build bubble nests and guard the eggs beneath them." +available_seasons = 15 allowed_water_types = 1 rarity = 1 base_catch_weight = 1.0 @@ -27,3 +29,4 @@ weight_max_lb = 0.15 sell_value_min = 5 sell_value_max = 10 sell_value_curve = 1.0 +display_texture = ExtResource("99_fish_placeholder") diff --git a/fish/species/black_drum/black_drum.tres b/fish/species/black_drum/black_drum.tres index 88a4ee2..b542327 100644 --- a/fish/species/black_drum/black_drum.tres +++ b/fish/species/black_drum/black_drum.tres @@ -1,8 +1,9 @@ -[gd_resource type="Resource" script_class="FishData" load_steps=4 format=3] +[gd_resource type="Resource" script_class="FishData" load_steps=5 format=3] [ext_resource type="Script" path="res://fish/fish_data.gd" id="1_fish_data"] [ext_resource type="Resource" path="res://fishing/common_catch_profile.tres" id="2_profile"] [ext_resource type="Script" path="res://fish/fish_availability.gd" id="3_availability"] +[ext_resource type="Texture2D" path="res://art/exported/creatures/fish_placeholder.png" id="99_fish_placeholder"] [sub_resource type="Resource" id="Availability"] script = ExtResource("3_availability") @@ -12,10 +13,11 @@ allow_day = false script = ExtResource("1_fish_data") id = &"black_drum" display_name = "black drum" -active = false +active = true catalog_number = 6802 collection_group = &"Temperate estuary" logbook_fact = "black drum crush oysters and crabs with rounded throat teeth. large adults develop dark vertical bars that fade with age." +available_seasons = 7 allowed_water_types = 2 rarity = 1 base_catch_weight = 0.7 @@ -26,3 +28,4 @@ weight_max_lb = 70.0 sell_value_min = 8 sell_value_max = 27 sell_value_curve = 0.82 +display_texture = ExtResource("99_fish_placeholder") diff --git a/fish/species/blobfish_smooth_head/blobfish_smooth_head.tres b/fish/species/blobfish_smooth_head/blobfish_smooth_head.tres index 0117988..4245304 100644 --- a/fish/species/blobfish_smooth_head/blobfish_smooth_head.tres +++ b/fish/species/blobfish_smooth_head/blobfish_smooth_head.tres @@ -1,8 +1,9 @@ -[gd_resource type="Resource" script_class="FishData" load_steps=4 format=3] +[gd_resource type="Resource" script_class="FishData" load_steps=5 format=3] [ext_resource type="Script" path="res://fish/fish_data.gd" id="1_fish_data"] [ext_resource type="Resource" path="res://fishing/common_catch_profile.tres" id="2_profile"] [ext_resource type="Script" path="res://fish/fish_availability.gd" id="3_availability"] +[ext_resource type="Texture2D" path="res://art/exported/creatures/fish_placeholder.png" id="99_fish_placeholder"] [sub_resource type="Resource" id="Availability"] script = ExtResource("3_availability") @@ -13,10 +14,11 @@ require_fog = true script = ExtResource("1_fish_data") id = &"blobfish_smooth_head" display_name = "smooth-head blobfish" -active = false +active = true catalog_number = 1805 collection_group = &"Deep-sea oddities" logbook_fact = "smooth-head blobfish rest on deep slopes where pressure supports their soft bodies. they conserve energy by waiting for edible matter nearby." +available_seasons = 15 allowed_water_types = 2 rarity = 4 base_catch_weight = 0.04 @@ -27,3 +29,4 @@ weight_max_lb = 5.0 sell_value_min = 42 sell_value_max = 90 sell_value_curve = 0.86 +display_texture = ExtResource("99_fish_placeholder") diff --git a/fish/species/bluefish/bluefish.tres b/fish/species/bluefish/bluefish.tres index 70288f5..d8888f7 100644 --- a/fish/species/bluefish/bluefish.tres +++ b/fish/species/bluefish/bluefish.tres @@ -1,8 +1,9 @@ -[gd_resource type="Resource" script_class="FishData" load_steps=4 format=3] +[gd_resource type="Resource" script_class="FishData" load_steps=5 format=3] [ext_resource type="Script" path="res://fish/fish_data.gd" id="1_fish_data"] [ext_resource type="Resource" path="res://fishing/common_catch_profile.tres" id="2_profile"] [ext_resource type="Script" path="res://fish/fish_availability.gd" id="3_availability"] +[ext_resource type="Texture2D" path="res://art/exported/creatures/fish_placeholder.png" id="99_fish_placeholder"] [sub_resource type="Resource" id="Availability"] script = ExtResource("3_availability") @@ -12,10 +13,11 @@ allow_night = false script = ExtResource("1_fish_data") id = &"bluefish" display_name = "bluefish" -active = false +active = true catalog_number = 702 collection_group = &"Coastal pelagic fish" logbook_fact = "bluefish race in coordinated schools while pursuing smaller fish. sharp teeth and powerful jaws make their feeding bursts especially fierce." +available_seasons = 7 allowed_water_types = 2 rarity = 1 base_catch_weight = 0.85 @@ -26,3 +28,4 @@ weight_max_lb = 25.0 sell_value_min = 7 sell_value_max = 19 sell_value_curve = 0.85 +display_texture = ExtResource("99_fish_placeholder") diff --git a/fish/species/bluegill/bluegill.tres b/fish/species/bluegill/bluegill.tres index 04c03d0..1ad5656 100644 --- a/fish/species/bluegill/bluegill.tres +++ b/fish/species/bluegill/bluegill.tres @@ -3,7 +3,7 @@ [ext_resource type="Script" path="res://fish/fish_data.gd" id="1_fish_data"] [ext_resource type="Resource" path="res://fishing/common_catch_profile.tres" id="2_profile"] [ext_resource type="Resource" path="res://fish/day_availability.tres" id="3_availability"] -[ext_resource type="Texture2D" path="res://fish/species/bluegill/fish_bluegill.png" id="4_texture"] +[ext_resource type="Texture2D" path="res://art/exported/creatures/fish_placeholder.png" id="4_texture"] [resource] script = ExtResource("1_fish_data") @@ -13,6 +13,7 @@ active = true catalog_number = 3102 collection_group = &"Freshwater panfish" logbook_fact = "bluegill fathers sweep shallow bowls into the bottom for nests, then stand guard. whole neighborhoods of nests can crowd together." +available_seasons = 7 allowed_water_types = 1 rarity = 0 base_catch_weight = 10.0 diff --git a/fish/species/bluegill/fish_bluegill.png b/fish/species/bluegill/fish_bluegill.png index 013db04..9ad6e4f 100644 Binary files a/fish/species/bluegill/fish_bluegill.png and b/fish/species/bluegill/fish_bluegill.png differ diff --git a/fish/species/bonefish/bonefish.tres b/fish/species/bonefish/bonefish.tres index 0c0d6dd..b2949d2 100644 --- a/fish/species/bonefish/bonefish.tres +++ b/fish/species/bonefish/bonefish.tres @@ -1,8 +1,9 @@ -[gd_resource type="Resource" script_class="FishData" load_steps=4 format=3] +[gd_resource type="Resource" script_class="FishData" load_steps=5 format=3] [ext_resource type="Script" path="res://fish/fish_data.gd" id="1_fish_data"] [ext_resource type="Resource" path="res://fishing/common_catch_profile.tres" id="2_profile"] [ext_resource type="Script" path="res://fish/fish_availability.gd" id="3_availability"] +[ext_resource type="Texture2D" path="res://art/exported/creatures/fish_placeholder.png" id="99_fish_placeholder"] [sub_resource type="Resource" id="Availability"] script = ExtResource("3_availability") @@ -13,10 +14,11 @@ forbid_fog = true script = ExtResource("1_fish_data") id = &"bonefish" display_name = "bonefish" -active = false +active = true catalog_number = 7401 collection_group = &"Tropical flats fish" logbook_fact = "bonefish sweep tropical flats in silvery schools and root for buried prey. their speed and pale bodies make them difficult to follow in shallow water." +available_seasons = 15 allowed_water_types = 2 rarity = 2 base_catch_weight = 0.25 @@ -27,3 +29,4 @@ weight_max_lb = 15.0 sell_value_min = 13 sell_value_max = 31 sell_value_curve = 0.86 +display_texture = ExtResource("99_fish_placeholder") diff --git a/fish/species/bowfin/bowfin.png b/fish/species/bowfin/bowfin.png new file mode 100644 index 0000000..9d40491 Binary files /dev/null and b/fish/species/bowfin/bowfin.png differ diff --git a/items/icons/shop/64_power_plus.png.import b/fish/species/bowfin/bowfin.png.import similarity index 73% rename from items/icons/shop/64_power_plus.png.import rename to fish/species/bowfin/bowfin.png.import index c82907d..b5f2a10 100644 --- a/items/icons/shop/64_power_plus.png.import +++ b/fish/species/bowfin/bowfin.png.import @@ -2,16 +2,16 @@ importer="texture" type="CompressedTexture2D" -uid="uid://xh2g4eytrjep" -path="res://.godot/imported/64_power_plus.png-98b7e06d3090a4411d56e2046b8c9d4b.ctex" +uid="uid://dgqegw70vkihk" +path="res://.godot/imported/bowfin.png-062edda1eb3529c0e6365e0ca93cf3ef.ctex" metadata={ "vram_texture": false } [deps] -source_file="res://items/icons/shop/64_power_plus.png" -dest_files=["res://.godot/imported/64_power_plus.png-98b7e06d3090a4411d56e2046b8c9d4b.ctex"] +source_file="res://fish/species/bowfin/bowfin.png" +dest_files=["res://.godot/imported/bowfin.png-062edda1eb3529c0e6365e0ca93cf3ef.ctex"] [params] diff --git a/fish/species/bowfin/bowfin.tres b/fish/species/bowfin/bowfin.tres index 748197a..7b2881f 100644 --- a/fish/species/bowfin/bowfin.tres +++ b/fish/species/bowfin/bowfin.tres @@ -1,8 +1,9 @@ -[gd_resource type="Resource" script_class="FishData" load_steps=4 format=3] +[gd_resource type="Resource" script_class="FishData" load_steps=5 format=3] [ext_resource type="Script" path="res://fish/fish_data.gd" id="1_fish_data"] [ext_resource type="Resource" path="res://fishing/common_catch_profile.tres" id="2_profile"] [ext_resource type="Script" path="res://fish/fish_availability.gd" id="3_availability"] +[ext_resource type="Texture2D" path="res://art/exported/creatures/101.png" id="4_texture"] [sub_resource type="Resource" id="Availability"] script = ExtResource("3_availability") @@ -13,10 +14,11 @@ require_fog = true script = ExtResource("1_fish_data") id = &"bowfin" display_name = "bowfin" -active = false +active = true catalog_number = 101 collection_group = &"Ancient freshwater fish" logbook_fact = "bowfin can gulp air at the surface when warm backwaters run low on oxygen. a long dorsal fin ripples as they stalk prey." +available_seasons = 7 allowed_water_types = 1 rarity = 2 base_catch_weight = 0.28 @@ -27,3 +29,4 @@ weight_max_lb = 20.0 sell_value_min = 13 sell_value_max = 30 sell_value_curve = 0.85 +display_texture = ExtResource("4_texture") diff --git a/fish/species/boxfish_yellow/boxfish_yellow.tres b/fish/species/boxfish_yellow/boxfish_yellow.tres index d701ada..aeda5ad 100644 --- a/fish/species/boxfish_yellow/boxfish_yellow.tres +++ b/fish/species/boxfish_yellow/boxfish_yellow.tres @@ -1,8 +1,9 @@ -[gd_resource type="Resource" script_class="FishData" load_steps=4 format=3] +[gd_resource type="Resource" script_class="FishData" load_steps=5 format=3] [ext_resource type="Script" path="res://fish/fish_data.gd" id="1_fish_data"] [ext_resource type="Resource" path="res://fishing/common_catch_profile.tres" id="2_profile"] [ext_resource type="Script" path="res://fish/fish_availability.gd" id="3_availability"] +[ext_resource type="Texture2D" path="res://art/exported/creatures/fish_placeholder.png" id="99_fish_placeholder"] [sub_resource type="Resource" id="Availability"] script = ExtResource("3_availability") @@ -12,10 +13,11 @@ allow_night = false script = ExtResource("1_fish_data") id = &"boxfish_yellow" display_name = "yellow boxfish" -active = false +active = true catalog_number = 5608 collection_group = &"Reef oddities" logbook_fact = "yellow boxfish juveniles are bright cubes covered in black spots. rigid body armor leaves small fins to provide careful steering." +available_seasons = 15 allowed_water_types = 2 rarity = 2 base_catch_weight = 0.32 @@ -26,3 +28,4 @@ weight_max_lb = 0.8 sell_value_min = 10 sell_value_max = 22 sell_value_curve = 0.96 +display_texture = ExtResource("99_fish_placeholder") diff --git a/fish/species/bream_common/bream_common.tres b/fish/species/bream_common/bream_common.tres index 54ecc57..1c7398c 100644 --- a/fish/species/bream_common/bream_common.tres +++ b/fish/species/bream_common/bream_common.tres @@ -1,8 +1,9 @@ -[gd_resource type="Resource" script_class="FishData" load_steps=4 format=3] +[gd_resource type="Resource" script_class="FishData" load_steps=5 format=3] [ext_resource type="Script" path="res://fish/fish_data.gd" id="1_fish_data"] [ext_resource type="Resource" path="res://fishing/common_catch_profile.tres" id="2_profile"] [ext_resource type="Script" path="res://fish/fish_availability.gd" id="3_availability"] +[ext_resource type="Texture2D" path="res://art/exported/creatures/fish_placeholder.png" id="99_fish_placeholder"] [sub_resource type="Resource" id="Availability"] script = ExtResource("3_availability") @@ -11,10 +12,11 @@ script = ExtResource("3_availability") script = ExtResource("1_fish_data") id = &"bream_common" display_name = "common bream" -active = false +active = true catalog_number = 2502 collection_group = &"Freshwater coarse fish" logbook_fact = "common bream gather in slow rivers and lakes with silvery, deep-sided bodies. protruding mouths sift insect larvae from soft bottoms." +available_seasons = 13 allowed_water_types = 1 rarity = 0 base_catch_weight = 1.8 @@ -25,3 +27,4 @@ weight_max_lb = 15.0 sell_value_min = 4 sell_value_max = 12 sell_value_curve = 0.88 +display_texture = ExtResource("99_fish_placeholder") diff --git a/fish/species/buffalo_bigmouth/buffalo_bigmouth.tres b/fish/species/buffalo_bigmouth/buffalo_bigmouth.tres index 4053eb6..bae0473 100644 --- a/fish/species/buffalo_bigmouth/buffalo_bigmouth.tres +++ b/fish/species/buffalo_bigmouth/buffalo_bigmouth.tres @@ -1,8 +1,9 @@ -[gd_resource type="Resource" script_class="FishData" load_steps=4 format=3] +[gd_resource type="Resource" script_class="FishData" load_steps=5 format=3] [ext_resource type="Script" path="res://fish/fish_data.gd" id="1_fish_data"] [ext_resource type="Resource" path="res://fishing/common_catch_profile.tres" id="2_profile"] [ext_resource type="Script" path="res://fish/fish_availability.gd" id="3_availability"] +[ext_resource type="Texture2D" path="res://art/exported/creatures/fish_placeholder.png" id="99_fish_placeholder"] [sub_resource type="Resource" id="Availability"] script = ExtResource("3_availability") @@ -12,10 +13,11 @@ require_fog = true script = ExtResource("1_fish_data") id = &"buffalo_bigmouth" display_name = "bigmouth buffalo" -active = false +active = true catalog_number = 2301 collection_group = &"Freshwater bottom fish" logbook_fact = "bigmouth buffalo filter plankton with fine gill rakers instead of rooting for prey. some individuals survive for more than a century." +available_seasons = 7 allowed_water_types = 1 rarity = 3 base_catch_weight = 0.12 @@ -26,3 +28,4 @@ weight_max_lb = 80.0 sell_value_min = 28 sell_value_max = 63 sell_value_curve = 0.82 +display_texture = ExtResource("99_fish_placeholder") diff --git a/fish/species/buffalo_smallmouth/buffalo_smallmouth.tres b/fish/species/buffalo_smallmouth/buffalo_smallmouth.tres index f0d2780..2756035 100644 --- a/fish/species/buffalo_smallmouth/buffalo_smallmouth.tres +++ b/fish/species/buffalo_smallmouth/buffalo_smallmouth.tres @@ -1,8 +1,9 @@ -[gd_resource type="Resource" script_class="FishData" load_steps=4 format=3] +[gd_resource type="Resource" script_class="FishData" load_steps=5 format=3] [ext_resource type="Script" path="res://fish/fish_data.gd" id="1_fish_data"] [ext_resource type="Resource" path="res://fishing/common_catch_profile.tres" id="2_profile"] [ext_resource type="Script" path="res://fish/fish_availability.gd" id="3_availability"] +[ext_resource type="Texture2D" path="res://art/exported/creatures/fish_placeholder.png" id="99_fish_placeholder"] [sub_resource type="Resource" id="Availability"] script = ExtResource("3_availability") @@ -11,10 +12,11 @@ script = ExtResource("3_availability") script = ExtResource("1_fish_data") id = &"buffalo_smallmouth" display_name = "smallmouth buffalo" -active = false +active = true catalog_number = 2304 collection_group = &"Freshwater bottom fish" logbook_fact = "smallmouth buffalo use thick lips to graze bottom-dwelling food in warm rivers. their deep, heavy bodies form a pronounced arch behind the head." +available_seasons = 7 allowed_water_types = 1 rarity = 2 base_catch_weight = 0.3 @@ -25,3 +27,4 @@ weight_max_lb = 45.0 sell_value_min = 14 sell_value_max = 34 sell_value_curve = 0.84 +display_texture = ExtResource("99_fish_placeholder") diff --git a/fish/species/bullhead_black/bullhead_black.tres b/fish/species/bullhead_black/bullhead_black.tres index 87f6155..1d904bd 100644 --- a/fish/species/bullhead_black/bullhead_black.tres +++ b/fish/species/bullhead_black/bullhead_black.tres @@ -1,8 +1,9 @@ -[gd_resource type="Resource" script_class="FishData" load_steps=4 format=3] +[gd_resource type="Resource" script_class="FishData" load_steps=5 format=3] [ext_resource type="Script" path="res://fish/fish_data.gd" id="1_fish_data"] [ext_resource type="Resource" path="res://fishing/common_catch_profile.tres" id="2_profile"] [ext_resource type="Script" path="res://fish/fish_availability.gd" id="3_availability"] +[ext_resource type="Texture2D" path="res://art/exported/creatures/fish_placeholder.png" id="99_fish_placeholder"] [sub_resource type="Resource" id="Availability"] script = ExtResource("3_availability") @@ -12,10 +13,11 @@ allow_day = false script = ExtResource("1_fish_data") id = &"bullhead_black" display_name = "black bullhead" -active = false +active = true catalog_number = 2401 collection_group = &"Freshwater catfish" logbook_fact = "black bullheads tolerate warm, cloudy water with little oxygen. stout spines protect the dorsal and pectoral fins from predators." +available_seasons = 7 allowed_water_types = 1 rarity = 1 base_catch_weight = 1.0 @@ -26,3 +28,4 @@ weight_max_lb = 6.0 sell_value_min = 5 sell_value_max = 11 sell_value_curve = 0.92 +display_texture = ExtResource("99_fish_placeholder") diff --git a/fish/species/bullhead_brown/bullhead_brown.tres b/fish/species/bullhead_brown/bullhead_brown.tres index c900d5f..b3651b2 100644 --- a/fish/species/bullhead_brown/bullhead_brown.tres +++ b/fish/species/bullhead_brown/bullhead_brown.tres @@ -1,8 +1,9 @@ -[gd_resource type="Resource" script_class="FishData" load_steps=4 format=3] +[gd_resource type="Resource" script_class="FishData" load_steps=5 format=3] [ext_resource type="Script" path="res://fish/fish_data.gd" id="1_fish_data"] [ext_resource type="Resource" path="res://fishing/common_catch_profile.tres" id="2_profile"] [ext_resource type="Script" path="res://fish/fish_availability.gd" id="3_availability"] +[ext_resource type="Texture2D" path="res://art/exported/creatures/fish_placeholder.png" id="99_fish_placeholder"] [sub_resource type="Resource" id="Availability"] script = ExtResource("3_availability") @@ -12,10 +13,11 @@ allow_day = false script = ExtResource("1_fish_data") id = &"bullhead_brown" display_name = "brown bullhead" -active = false +active = true catalog_number = 2403 collection_group = &"Freshwater catfish" logbook_fact = "brown bullheads search muddy bottoms with eight sensitive barbels. males guard nests and herd newly hatched young in a dark moving ball." +available_seasons = 7 allowed_water_types = 1 rarity = 0 base_catch_weight = 2.3 @@ -26,3 +28,4 @@ weight_max_lb = 4.0 sell_value_min = 3 sell_value_max = 7 sell_value_curve = 0.95 +display_texture = ExtResource("99_fish_placeholder") diff --git a/fish/species/bullhead_yellow/bullhead_yellow.tres b/fish/species/bullhead_yellow/bullhead_yellow.tres index e2b5d63..4dce589 100644 --- a/fish/species/bullhead_yellow/bullhead_yellow.tres +++ b/fish/species/bullhead_yellow/bullhead_yellow.tres @@ -1,8 +1,9 @@ -[gd_resource type="Resource" script_class="FishData" load_steps=4 format=3] +[gd_resource type="Resource" script_class="FishData" load_steps=5 format=3] [ext_resource type="Script" path="res://fish/fish_data.gd" id="1_fish_data"] [ext_resource type="Resource" path="res://fishing/common_catch_profile.tres" id="2_profile"] [ext_resource type="Script" path="res://fish/fish_availability.gd" id="3_availability"] +[ext_resource type="Texture2D" path="res://art/exported/creatures/fish_placeholder.png" id="99_fish_placeholder"] [sub_resource type="Resource" id="Availability"] script = ExtResource("3_availability") @@ -13,10 +14,11 @@ require_rain = true script = ExtResource("1_fish_data") id = &"bullhead_yellow" display_name = "yellow bullhead" -active = false +active = true catalog_number = 2408 collection_group = &"Freshwater catfish" logbook_fact = "yellow bullheads use pale chin barbels to distinguish food in murky shallows. both parents may guard the nest and schooling young." +available_seasons = 7 allowed_water_types = 1 rarity = 0 base_catch_weight = 2.0 @@ -27,3 +29,4 @@ weight_max_lb = 3.5 sell_value_min = 3 sell_value_max = 7 sell_value_curve = 0.95 +display_texture = ExtResource("99_fish_placeholder") diff --git a/fish/species/burbot/burbot.tres b/fish/species/burbot/burbot.tres index 25e9277..e46006c 100644 --- a/fish/species/burbot/burbot.tres +++ b/fish/species/burbot/burbot.tres @@ -1,8 +1,9 @@ -[gd_resource type="Resource" script_class="FishData" load_steps=4 format=3] +[gd_resource type="Resource" script_class="FishData" load_steps=5 format=3] [ext_resource type="Script" path="res://fish/fish_data.gd" id="1_fish_data"] [ext_resource type="Resource" path="res://fishing/common_catch_profile.tres" id="2_profile"] [ext_resource type="Script" path="res://fish/fish_availability.gd" id="3_availability"] +[ext_resource type="Texture2D" path="res://art/exported/creatures/fish_placeholder.png" id="99_fish_placeholder"] [sub_resource type="Resource" id="Availability"] script = ExtResource("3_availability") @@ -13,10 +14,11 @@ require_fog = true script = ExtResource("1_fish_data") id = &"burbot" display_name = "burbot" -active = false +active = true catalog_number = 1001 collection_group = &"Cold freshwater fish" logbook_fact = "burbot are the only freshwater members of the cod family. they become most active in cold darkness and may spawn beneath winter ice." +available_seasons = 13 allowed_water_types = 1 rarity = 2 base_catch_weight = 0.24 @@ -27,3 +29,4 @@ weight_max_lb = 18.0 sell_value_min = 12 sell_value_max = 28 sell_value_curve = 0.86 +display_texture = ExtResource("99_fish_placeholder") diff --git a/fish/species/butterflyfish_copperband/butterflyfish_copperband.tres b/fish/species/butterflyfish_copperband/butterflyfish_copperband.tres index e9a3385..7a7c112 100644 --- a/fish/species/butterflyfish_copperband/butterflyfish_copperband.tres +++ b/fish/species/butterflyfish_copperband/butterflyfish_copperband.tres @@ -1,8 +1,9 @@ -[gd_resource type="Resource" script_class="FishData" load_steps=4 format=3] +[gd_resource type="Resource" script_class="FishData" load_steps=5 format=3] [ext_resource type="Script" path="res://fish/fish_data.gd" id="1_fish_data"] [ext_resource type="Resource" path="res://fishing/common_catch_profile.tres" id="2_profile"] [ext_resource type="Script" path="res://fish/fish_availability.gd" id="3_availability"] +[ext_resource type="Texture2D" path="res://art/exported/creatures/fish_placeholder.png" id="99_fish_placeholder"] [sub_resource type="Resource" id="Availability"] script = ExtResource("3_availability") @@ -13,10 +14,11 @@ forbid_fog = true script = ExtResource("1_fish_data") id = &"butterflyfish_copperband" display_name = "copperband butterflyfish" -active = false +active = true catalog_number = 5701 collection_group = &"Reef ornamentals" logbook_fact = "copperband butterflyfish probe reef cracks with long narrow snouts. bold orange bands and a false eyespot confuse predators." +available_seasons = 15 allowed_water_types = 2 rarity = 2 base_catch_weight = 0.32 @@ -27,3 +29,4 @@ weight_max_lb = 0.4 sell_value_min = 9 sell_value_max = 21 sell_value_curve = 0.98 +display_texture = ExtResource("99_fish_placeholder") diff --git a/fish/species/capelin/capelin.tres b/fish/species/capelin/capelin.tres index 0e5f25b..5759cb8 100644 --- a/fish/species/capelin/capelin.tres +++ b/fish/species/capelin/capelin.tres @@ -1,8 +1,9 @@ -[gd_resource type="Resource" script_class="FishData" load_steps=4 format=3] +[gd_resource type="Resource" script_class="FishData" load_steps=5 format=3] [ext_resource type="Script" path="res://fish/fish_data.gd" id="1_fish_data"] [ext_resource type="Resource" path="res://fishing/common_catch_profile.tres" id="2_profile"] [ext_resource type="Script" path="res://fish/fish_availability.gd" id="3_availability"] +[ext_resource type="Texture2D" path="res://art/exported/creatures/fish_placeholder.png" id="99_fish_placeholder"] [sub_resource type="Resource" id="Availability"] script = ExtResource("3_availability") @@ -12,10 +13,11 @@ require_fog = true script = ExtResource("1_fish_data") id = &"capelin" display_name = "capelin" -active = false +active = true catalog_number = 1302 collection_group = &"Cold schooling fish" logbook_fact = "capelin are small polar fish that feed whales, seabirds, and larger fish. many schools roll onto beaches or shallows to release their eggs." +available_seasons = 13 allowed_water_types = 2 rarity = 1 base_catch_weight = 1.0 @@ -26,3 +28,4 @@ weight_max_lb = 0.2 sell_value_min = 4 sell_value_max = 8 sell_value_curve = 1.0 +display_texture = ExtResource("99_fish_placeholder") diff --git a/fish/species/carp/carp.tres b/fish/species/carp/carp.tres index 4bcdb6c..24b50e7 100644 --- a/fish/species/carp/carp.tres +++ b/fish/species/carp/carp.tres @@ -3,7 +3,7 @@ [ext_resource type="Script" uid="uid://h7hg45b7wmst" path="res://fish/fish_data.gd" id="1_fish_data"] [ext_resource type="Resource" path="res://fishing/carp_catch_profile.tres" id="2_profile"] [ext_resource type="Script" uid="uid://bs7cqi88csolc" path="res://fish/fish_availability.gd" id="3_availability_script"] -[ext_resource type="Texture2D" uid="uid://c6pa1gqwv1a5s" path="res://fish/species/carp/fish_carp_common.png" id="4_texture"] +[ext_resource type="Texture2D" path="res://art/exported/creatures/fish_placeholder.png" id="4_texture"] [sub_resource type="Resource" id="CarpAvailability"] script = ExtResource("3_availability_script") @@ -18,6 +18,7 @@ active = true catalog_number = 2503 collection_group = &"Freshwater coarse fish" logbook_fact = "whisker-like barbels help a common carp investigate the bottom. nosing through sediment can cloud the water and loosen plants." +available_seasons = 15 allowed_water_types = 1 rarity = 2 base_catch_weight = 1.5 diff --git a/fish/species/carp/fish_carp_common.png b/fish/species/carp/fish_carp_common.png index 709f4d4..3a98f8e 100644 Binary files a/fish/species/carp/fish_carp_common.png and b/fish/species/carp/fish_carp_common.png differ diff --git a/fish/species/catfish_blue/catfish_blue.tres b/fish/species/catfish_blue/catfish_blue.tres index 98fda16..8df5866 100644 --- a/fish/species/catfish_blue/catfish_blue.tres +++ b/fish/species/catfish_blue/catfish_blue.tres @@ -3,11 +3,11 @@ [ext_resource type="Script" uid="uid://h7hg45b7wmst" path="res://fish/fish_data.gd" id="1_fish_data"] [ext_resource type="Resource" path="res://fishing/bass_catch_profile.tres" id="2_profile"] [ext_resource type="Script" uid="uid://bs7cqi88csolc" path="res://fish/fish_availability.gd" id="3_availability_script"] -[ext_resource type="Texture2D" uid="uid://7f1dtcou8moe" path="res://fish/species/catfish_blue/fish_catfish_blue.png" id="4_texture"] +[ext_resource type="Texture2D" path="res://art/exported/creatures/fish_placeholder.png" id="4_texture"] [sub_resource type="Resource" id="BlueCatfishAvailability"] script = ExtResource("3_availability_script") -allowed_location_tags = Array[StringName]([&"starter_pond"]) +allowed_location_tags = Array[StringName]([&"river"]) allow_day = false preferred_bait_tags = Array[StringName]([&"worm", &"minnow"]) preferred_bait_weight_multiplier = 1.35 @@ -20,6 +20,7 @@ active = true catalog_number = 2402 collection_group = &"Freshwater catfish" logbook_fact = "a deep fork in the tail inspired the blue catfish's scientific name. it rests deep by daylight and becomes more active after dark." +available_seasons = 7 allowed_water_types = 1 rarity = 1 base_catch_weight = 1.25 diff --git a/fish/species/catfish_blue/fish_catfish_blue.png b/fish/species/catfish_blue/fish_catfish_blue.png index 6482e15..73511b6 100644 Binary files a/fish/species/catfish_blue/fish_catfish_blue.png and b/fish/species/catfish_blue/fish_catfish_blue.png differ diff --git a/fish/species/catfish_channel/catfish_channel.tres b/fish/species/catfish_channel/catfish_channel.tres index 69aff97..e72fdb0 100644 --- a/fish/species/catfish_channel/catfish_channel.tres +++ b/fish/species/catfish_channel/catfish_channel.tres @@ -3,11 +3,11 @@ [ext_resource type="Script" uid="uid://h7hg45b7wmst" path="res://fish/fish_data.gd" id="1_fish_data"] [ext_resource type="Resource" path="res://fishing/common_catch_profile.tres" id="2_profile"] [ext_resource type="Script" uid="uid://bs7cqi88csolc" path="res://fish/fish_availability.gd" id="3_availability_script"] -[ext_resource type="Texture2D" uid="uid://dvxpk2ltt3blb" path="res://fish/species/catfish_channel/fish_catfish_channel.png" id="4_texture"] +[ext_resource type="Texture2D" path="res://art/exported/creatures/fish_placeholder.png" id="4_texture"] [sub_resource type="Resource" id="ChannelCatfishAvailability"] script = ExtResource("3_availability_script") -allowed_location_tags = Array[StringName]([&"starter_pond"]) +allowed_location_tags = Array[StringName]([&"starter_pond", &"pond"]) allow_day = false preferred_bait_tags = Array[StringName]([&"worm"]) preferred_bait_weight_multiplier = 1.35 @@ -20,6 +20,7 @@ active = true catalog_number = 2404 collection_group = &"Freshwater catfish" logbook_fact = "a channel catfish can taste through skin all over its body, especially near its gills and whiskers. the male watches the eggs." +available_seasons = 7 allowed_water_types = 1 base_catch_weight = 2.0 catch_profile = ExtResource("2_profile") diff --git a/fish/species/catfish_channel/fish_catfish_channel.png b/fish/species/catfish_channel/fish_catfish_channel.png index b858806..566955a 100644 Binary files a/fish/species/catfish_channel/fish_catfish_channel.png and b/fish/species/catfish_channel/fish_catfish_channel.png differ diff --git a/fish/species/catfish_flathead/catfish_flathead.tres b/fish/species/catfish_flathead/catfish_flathead.tres index 84a6f01..de0e5f6 100644 --- a/fish/species/catfish_flathead/catfish_flathead.tres +++ b/fish/species/catfish_flathead/catfish_flathead.tres @@ -3,11 +3,11 @@ [ext_resource type="Script" uid="uid://h7hg45b7wmst" path="res://fish/fish_data.gd" id="1_fish_data"] [ext_resource type="Resource" path="res://fishing/bass_catch_profile.tres" id="2_profile"] [ext_resource type="Script" uid="uid://bs7cqi88csolc" path="res://fish/fish_availability.gd" id="3_availability_script"] -[ext_resource type="Texture2D" uid="uid://bacx63lp0yh7t" path="res://fish/species/catfish_flathead/fish_catfish_flathead.png" id="4_texture"] +[ext_resource type="Texture2D" path="res://art/exported/creatures/fish_placeholder.png" id="4_texture"] [sub_resource type="Resource" id="FlatheadCatfishAvailability"] script = ExtResource("3_availability_script") -allowed_location_tags = Array[StringName]([&"starter_pond"]) +allowed_location_tags = Array[StringName]([&"river"]) allow_day = false preferred_bait_tags = Array[StringName]([&"worm", &"minnow"]) preferred_bait_weight_multiplier = 1.35 @@ -20,6 +20,7 @@ active = true catalog_number = 2405 collection_group = &"Freshwater catfish" logbook_fact = "flatheads favor hideouts made by logs, rocks, ledges, and other underwater structure. as they grow, fish dominate their menu." +available_seasons = 7 allowed_water_types = 1 rarity = 1 catch_profile = ExtResource("2_profile") diff --git a/fish/species/catfish_flathead/fish_catfish_flathead.png b/fish/species/catfish_flathead/fish_catfish_flathead.png index e248c02..0122fda 100644 Binary files a/fish/species/catfish_flathead/fish_catfish_flathead.png and b/fish/species/catfish_flathead/fish_catfish_flathead.png differ diff --git a/fish/species/catfish_walking/catfish_walking.tres b/fish/species/catfish_walking/catfish_walking.tres index 7b8dbf4..fe36cee 100644 --- a/fish/species/catfish_walking/catfish_walking.tres +++ b/fish/species/catfish_walking/catfish_walking.tres @@ -1,8 +1,9 @@ -[gd_resource type="Resource" script_class="FishData" load_steps=4 format=3] +[gd_resource type="Resource" script_class="FishData" load_steps=5 format=3] [ext_resource type="Script" path="res://fish/fish_data.gd" id="1_fish_data"] [ext_resource type="Resource" path="res://fishing/common_catch_profile.tres" id="2_profile"] [ext_resource type="Script" path="res://fish/fish_availability.gd" id="3_availability"] +[ext_resource type="Texture2D" path="res://art/exported/creatures/fish_placeholder.png" id="99_fish_placeholder"] [sub_resource type="Resource" id="Availability"] script = ExtResource("3_availability") @@ -13,10 +14,11 @@ require_rain = true script = ExtResource("1_fish_data") id = &"catfish_walking" display_name = "walking catfish" -active = false +active = true catalog_number = 7510 collection_group = &"Tropical freshwater fish" logbook_fact = "walking catfish wriggle across wet ground using stiff pectoral spines for support. an air-breathing organ helps them survive the journey." +available_seasons = 15 allowed_water_types = 1 rarity = 2 base_catch_weight = 0.3 @@ -27,3 +29,4 @@ weight_max_lb = 5.0 sell_value_min = 11 sell_value_max = 24 sell_value_curve = 0.9 +display_texture = ExtResource("99_fish_placeholder") diff --git a/fish/species/catfish_white/catfish_white.tres b/fish/species/catfish_white/catfish_white.tres index e5cc545..86b799f 100644 --- a/fish/species/catfish_white/catfish_white.tres +++ b/fish/species/catfish_white/catfish_white.tres @@ -3,11 +3,11 @@ [ext_resource type="Script" uid="uid://h7hg45b7wmst" path="res://fish/fish_data.gd" id="1_fish_data"] [ext_resource type="Resource" path="res://fishing/common_catch_profile.tres" id="2_profile"] [ext_resource type="Script" uid="uid://bs7cqi88csolc" path="res://fish/fish_availability.gd" id="3_availability_script"] -[ext_resource type="Texture2D" uid="uid://bf6kiawwekv7g" path="res://fish/species/catfish_white/fish_catfish_white.png" id="4_texture"] +[ext_resource type="Texture2D" path="res://art/exported/creatures/fish_placeholder.png" id="4_texture"] [sub_resource type="Resource" id="WhiteCatfishAvailability"] script = ExtResource("3_availability_script") -allowed_location_tags = Array[StringName]([&"starter_pond"]) +allowed_location_tags = Array[StringName]([&"starter_pond", &"pond"]) allow_day = false preferred_bait_tags = Array[StringName]([&"worm"]) preferred_bait_weight_multiplier = 1.35 @@ -20,6 +20,7 @@ active = true catalog_number = 2407 collection_group = &"Freshwater catfish" logbook_fact = "white catfish began along the atlantic coast between new york and florida. people later carried them far beyond that home range." +available_seasons = 7 allowed_water_types = 1 base_catch_weight = 2.0 catch_profile = ExtResource("2_profile") diff --git a/fish/species/catfish_white/fish_catfish_white.png b/fish/species/catfish_white/fish_catfish_white.png index 499be44..bdcb730 100644 Binary files a/fish/species/catfish_white/fish_catfish_white.png and b/fish/species/catfish_white/fish_catfish_white.png differ diff --git a/fish/species/char_arctic/char_arctic.tres b/fish/species/char_arctic/char_arctic.tres index cb47137..17d08d1 100644 --- a/fish/species/char_arctic/char_arctic.tres +++ b/fish/species/char_arctic/char_arctic.tres @@ -1,8 +1,9 @@ -[gd_resource type="Resource" script_class="FishData" load_steps=4 format=3] +[gd_resource type="Resource" script_class="FishData" load_steps=5 format=3] [ext_resource type="Script" path="res://fish/fish_data.gd" id="1_fish_data"] [ext_resource type="Resource" path="res://fishing/common_catch_profile.tres" id="2_profile"] [ext_resource type="Script" path="res://fish/fish_availability.gd" id="3_availability"] +[ext_resource type="Texture2D" path="res://art/exported/creatures/fish_placeholder.png" id="99_fish_placeholder"] [sub_resource type="Resource" id="Availability"] script = ExtResource("3_availability") @@ -12,10 +13,11 @@ forbid_rain = true script = ExtResource("1_fish_data") id = &"char_arctic" display_name = "arctic char" -active = false +active = true catalog_number = 1101 collection_group = &"Cold freshwater salmonids" logbook_fact = "arctic char thrive farther north than any other freshwater fish. some remain in lakes while others migrate between rivers and the sea." +available_seasons = 13 allowed_water_types = 3 rarity = 2 base_catch_weight = 0.3 @@ -26,3 +28,4 @@ weight_max_lb = 25.0 sell_value_min = 14 sell_value_max = 32 sell_value_curve = 0.86 +display_texture = ExtResource("99_fish_placeholder") diff --git a/fish/species/chromis_blue_green/chromis_blue_green.tres b/fish/species/chromis_blue_green/chromis_blue_green.tres index e02ded5..65f35b4 100644 --- a/fish/species/chromis_blue_green/chromis_blue_green.tres +++ b/fish/species/chromis_blue_green/chromis_blue_green.tres @@ -1,8 +1,9 @@ -[gd_resource type="Resource" script_class="FishData" load_steps=4 format=3] +[gd_resource type="Resource" script_class="FishData" load_steps=5 format=3] [ext_resource type="Script" path="res://fish/fish_data.gd" id="1_fish_data"] [ext_resource type="Resource" path="res://fishing/common_catch_profile.tres" id="2_profile"] [ext_resource type="Script" path="res://fish/fish_availability.gd" id="3_availability"] +[ext_resource type="Texture2D" path="res://art/exported/creatures/5901.png" id="99_fish_placeholder"] [sub_resource type="Resource" id="Availability"] script = ExtResource("3_availability") @@ -12,10 +13,11 @@ allow_night = false script = ExtResource("1_fish_data") id = &"chromis_blue_green" display_name = "blue-green chromis" -active = false +active = true catalog_number = 5901 collection_group = &"Reef schooling fish" logbook_fact = "blue-green chromis form loose clouds above branching coral. the school dives into narrow shelter whenever a predator approaches." +available_seasons = 15 allowed_water_types = 2 rarity = 0 base_catch_weight = 2.8 @@ -26,3 +28,4 @@ weight_max_lb = 0.25 sell_value_min = 2 sell_value_max = 4 sell_value_curve = 1.0 +display_texture = ExtResource("99_fish_placeholder") diff --git a/fish/species/chub_creek/chub_creek.tres b/fish/species/chub_creek/chub_creek.tres index e2bda01..1739712 100644 --- a/fish/species/chub_creek/chub_creek.tres +++ b/fish/species/chub_creek/chub_creek.tres @@ -1,8 +1,9 @@ -[gd_resource type="Resource" script_class="FishData" load_steps=4 format=3] +[gd_resource type="Resource" script_class="FishData" load_steps=5 format=3] [ext_resource type="Script" path="res://fish/fish_data.gd" id="1_fish_data"] [ext_resource type="Resource" path="res://fishing/common_catch_profile.tres" id="2_profile"] [ext_resource type="Script" path="res://fish/fish_availability.gd" id="3_availability"] +[ext_resource type="Texture2D" path="res://art/exported/creatures/fish_placeholder.png" id="99_fish_placeholder"] [sub_resource type="Resource" id="Availability"] script = ExtResource("3_availability") @@ -12,10 +13,11 @@ allow_night = false script = ExtResource("1_fish_data") id = &"chub_creek" display_name = "creek chub" -active = false +active = true catalog_number = 2802 collection_group = &"Freshwater minnows" logbook_fact = "creek chubs gather around pools and undercut banks in small streams. males build gravel ridges where several fish may spawn." +available_seasons = 7 allowed_water_types = 1 rarity = 0 base_catch_weight = 3.2 @@ -26,3 +28,4 @@ weight_max_lb = 0.8 sell_value_min = 2 sell_value_max = 4 sell_value_curve = 1.0 +display_texture = ExtResource("99_fish_placeholder") diff --git a/fish/species/chub_european/chub_european.tres b/fish/species/chub_european/chub_european.tres index aeed2b7..a218aec 100644 --- a/fish/species/chub_european/chub_european.tres +++ b/fish/species/chub_european/chub_european.tres @@ -3,11 +3,11 @@ [ext_resource type="Script" uid="uid://h7hg45b7wmst" path="res://fish/fish_data.gd" id="1_fish_data"] [ext_resource type="Resource" path="res://fishing/common_catch_profile.tres" id="2_profile"] [ext_resource type="Script" uid="uid://bs7cqi88csolc" path="res://fish/fish_availability.gd" id="3_availability_script"] -[ext_resource type="Texture2D" uid="uid://c04wtbyslmpll" path="res://fish/species/chub_european/fish_chub_european.png" id="4_texture"] +[ext_resource type="Texture2D" path="res://art/exported/creatures/fish_placeholder.png" id="4_texture"] [sub_resource type="Resource" id="ChubEuropeanAvailability"] script = ExtResource("3_availability_script") -allowed_location_tags = Array[StringName]([&"starter_pond"]) +allowed_location_tags = Array[StringName]([&"river"]) [resource] script = ExtResource("1_fish_data") @@ -17,6 +17,7 @@ active = true catalog_number = 2505 collection_group = &"Freshwater coarse fish" logbook_fact = "european chub are adaptable river fish. adults often patrol shallows and feed on insects, small fish, and fruit." +available_seasons = 15 allowed_water_types = 1 base_catch_weight = 0.55 catch_profile = ExtResource("2_profile") diff --git a/fish/species/chub_european/fish_chub_european.png b/fish/species/chub_european/fish_chub_european.png index 03ed536..e850ada 100644 Binary files a/fish/species/chub_european/fish_chub_european.png and b/fish/species/chub_european/fish_chub_european.png differ diff --git a/fish/species/chub_flame/chub_flame.tres b/fish/species/chub_flame/chub_flame.tres index 4ca30fe..2bf815c 100644 --- a/fish/species/chub_flame/chub_flame.tres +++ b/fish/species/chub_flame/chub_flame.tres @@ -3,11 +3,11 @@ [ext_resource type="Script" uid="uid://h7hg45b7wmst" path="res://fish/fish_data.gd" id="1_fish_data"] [ext_resource type="Resource" path="res://fishing/common_catch_profile.tres" id="2_profile"] [ext_resource type="Script" uid="uid://bs7cqi88csolc" path="res://fish/fish_availability.gd" id="3_availability_script"] -[ext_resource type="Texture2D" uid="uid://bla6pc21imxsi" path="res://fish/species/chub_flame/fish_chub_flame.png" id="4_texture"] +[ext_resource type="Texture2D" path="res://art/exported/creatures/fish_placeholder.png" id="4_texture"] [sub_resource type="Resource" id="ChubFlameAvailability"] script = ExtResource("3_availability_script") -allowed_location_tags = Array[StringName]([&"starter_pond"]) +allowed_location_tags = Array[StringName]([&"river"]) [resource] script = ExtResource("1_fish_data") @@ -17,6 +17,7 @@ active = true catalog_number = 2805 collection_group = &"Freshwater minnows" logbook_fact = "flame chubs prefer cool, clear streams. their bright breeding colors make a small fish easy to spot in spring water." +available_seasons = 7 allowed_water_types = 1 rarity = 1 base_catch_weight = 0.4 diff --git a/fish/species/chub_flame/fish_chub_flame.png b/fish/species/chub_flame/fish_chub_flame.png index 98c67e3..a94fc71 100644 Binary files a/fish/species/chub_flame/fish_chub_flame.png and b/fish/species/chub_flame/fish_chub_flame.png differ diff --git a/fish/species/chub_lake/chub_lake.tres b/fish/species/chub_lake/chub_lake.tres index 8b8927f..6da6b43 100644 --- a/fish/species/chub_lake/chub_lake.tres +++ b/fish/species/chub_lake/chub_lake.tres @@ -3,11 +3,11 @@ [ext_resource type="Script" uid="uid://h7hg45b7wmst" path="res://fish/fish_data.gd" id="1_fish_data"] [ext_resource type="Resource" path="res://fishing/common_catch_profile.tres" id="2_profile"] [ext_resource type="Script" uid="uid://bs7cqi88csolc" path="res://fish/fish_availability.gd" id="3_availability_script"] -[ext_resource type="Texture2D" uid="uid://w8cjrpnv350h" path="res://fish/species/chub_lake/fish_chub_lake.png" id="4_texture"] +[ext_resource type="Texture2D" path="res://art/exported/creatures/fish_placeholder.png" id="4_texture"] [sub_resource type="Resource" id="ChubLakeAvailability"] script = ExtResource("3_availability_script") -allowed_location_tags = Array[StringName]([&"starter_pond"]) +allowed_location_tags = Array[StringName]([&"lake"]) [resource] script = ExtResource("1_fish_data") @@ -17,6 +17,7 @@ active = true catalog_number = 2807 collection_group = &"Freshwater minnows" logbook_fact = "lake chubs school in cold northern water and use their small mouths to pick insects and other tiny prey from the current." +available_seasons = 13 allowed_water_types = 1 base_catch_weight = 0.55 catch_profile = ExtResource("2_profile") diff --git a/fish/species/chub_lake/fish_chub_lake.png b/fish/species/chub_lake/fish_chub_lake.png index 73101f6..6aac214 100644 Binary files a/fish/species/chub_lake/fish_chub_lake.png and b/fish/species/chub_lake/fish_chub_lake.png differ diff --git a/fish/species/cisco/cisco.tres b/fish/species/cisco/cisco.tres index 694a9ec..1bc53b0 100644 --- a/fish/species/cisco/cisco.tres +++ b/fish/species/cisco/cisco.tres @@ -1,8 +1,9 @@ -[gd_resource type="Resource" script_class="FishData" load_steps=4 format=3] +[gd_resource type="Resource" script_class="FishData" load_steps=5 format=3] [ext_resource type="Script" path="res://fish/fish_data.gd" id="1_fish_data"] [ext_resource type="Resource" path="res://fishing/common_catch_profile.tres" id="2_profile"] [ext_resource type="Script" path="res://fish/fish_availability.gd" id="3_availability"] +[ext_resource type="Texture2D" path="res://art/exported/creatures/fish_placeholder.png" id="99_fish_placeholder"] [sub_resource type="Resource" id="Availability"] script = ExtResource("3_availability") @@ -12,10 +13,11 @@ allow_night = false script = ExtResource("1_fish_data") id = &"cisco" display_name = "cisco" -active = false +active = true catalog_number = 1002 collection_group = &"Cold freshwater fish" logbook_fact = "cisco school in the cool open water of northern lakes. these slim relatives of salmon feed on plankton and become prey for larger fish." +available_seasons = 13 allowed_water_types = 1 rarity = 0 base_catch_weight = 2.2 @@ -26,3 +28,4 @@ weight_max_lb = 3.0 sell_value_min = 3 sell_value_max = 7 sell_value_curve = 0.95 +display_texture = ExtResource("99_fish_placeholder") diff --git a/fish/species/clam_geoduck/clam_geoduck.tres b/fish/species/clam_geoduck/clam_geoduck.tres index 82c8eac..492113c 100644 --- a/fish/species/clam_geoduck/clam_geoduck.tres +++ b/fish/species/clam_geoduck/clam_geoduck.tres @@ -1,8 +1,9 @@ -[gd_resource type="Resource" script_class="FishData" load_steps=4 format=3] +[gd_resource type="Resource" script_class="FishData" load_steps=5 format=3] [ext_resource type="Script" path="res://fish/fish_data.gd" id="1_fish_data"] [ext_resource type="Resource" path="res://fishing/common_catch_profile.tres" id="2_profile"] [ext_resource type="Script" path="res://fish/fish_availability.gd" id="3_availability"] +[ext_resource type="Texture2D" path="res://art/exported/creatures/fish_placeholder.png" id="99_fish_placeholder"] [sub_resource type="Resource" id="Availability"] script = ExtResource("3_availability") @@ -13,10 +14,11 @@ require_fog = true script = ExtResource("1_fish_data") id = &"clam_geoduck" display_name = "Pacific geoduck" -active = false +active = true catalog_number = 6403 collection_group = &"Shellfish" logbook_fact = "pacific geoducks bury their shells deep while a long siphon reaches the seafloor. these clams can survive for well over a century." +available_seasons = 15 allowed_water_types = 2 rarity = 2 base_catch_weight = 0.25 @@ -27,3 +29,4 @@ weight_max_lb = 15.0 sell_value_min = 14 sell_value_max = 34 sell_value_curve = 0.88 +display_texture = ExtResource("99_fish_placeholder") diff --git a/fish/species/clam_giant/clam_giant.tres b/fish/species/clam_giant/clam_giant.tres index d56f410..2b4f59d 100644 --- a/fish/species/clam_giant/clam_giant.tres +++ b/fish/species/clam_giant/clam_giant.tres @@ -1,8 +1,9 @@ -[gd_resource type="Resource" script_class="FishData" load_steps=4 format=3] +[gd_resource type="Resource" script_class="FishData" load_steps=5 format=3] [ext_resource type="Script" path="res://fish/fish_data.gd" id="1_fish_data"] [ext_resource type="Resource" path="res://fishing/common_catch_profile.tres" id="2_profile"] [ext_resource type="Script" path="res://fish/fish_availability.gd" id="3_availability"] +[ext_resource type="Texture2D" path="res://art/exported/creatures/fish_placeholder.png" id="99_fish_placeholder"] [sub_resource type="Resource" id="Availability"] script = ExtResource("3_availability") @@ -13,10 +14,11 @@ forbid_fog = true script = ExtResource("1_fish_data") id = &"clam_giant" display_name = "giant clam" -active = false +active = true catalog_number = 6402 collection_group = &"Shellfish" logbook_fact = "giant clams host photosynthetic algae inside brightly colored mantles. heavy shells remain anchored to one reef spot throughout adulthood." +available_seasons = 15 allowed_water_types = 2 rarity = 3 base_catch_weight = 0.1 @@ -27,3 +29,4 @@ weight_max_lb = 500.0 sell_value_min = 28 sell_value_max = 72 sell_value_curve = 0.8 +display_texture = ExtResource("99_fish_placeholder") diff --git a/fish/species/clam_manila/clam_manila.png b/fish/species/clam_manila/clam_manila.png new file mode 100644 index 0000000..72f5bfb Binary files /dev/null and b/fish/species/clam_manila/clam_manila.png differ diff --git a/ui/assets/title/netfishing_logo.png.import b/fish/species/clam_manila/clam_manila.png.import similarity index 72% rename from ui/assets/title/netfishing_logo.png.import rename to fish/species/clam_manila/clam_manila.png.import index 2aa351a..6e8d0bc 100644 --- a/ui/assets/title/netfishing_logo.png.import +++ b/fish/species/clam_manila/clam_manila.png.import @@ -2,16 +2,16 @@ importer="texture" type="CompressedTexture2D" -uid="uid://ckqayis1ckb2v" -path="res://.godot/imported/netfishing_logo.png-82ab9fce5851dcc5239eca178e8cde99.ctex" +uid="uid://tmbkp1ohcavc" +path="res://.godot/imported/clam_manila.png-b04bc787291fc96749979a40380ba399.ctex" metadata={ "vram_texture": false } [deps] -source_file="res://ui/assets/title/netfishing_logo.png" -dest_files=["res://.godot/imported/netfishing_logo.png-82ab9fce5851dcc5239eca178e8cde99.ctex"] +source_file="res://fish/species/clam_manila/clam_manila.png" +dest_files=["res://.godot/imported/clam_manila.png-b04bc787291fc96749979a40380ba399.ctex"] [params] diff --git a/fish/species/clam_manila/clam_manila.tres b/fish/species/clam_manila/clam_manila.tres new file mode 100644 index 0000000..20e3f8a --- /dev/null +++ b/fish/species/clam_manila/clam_manila.tres @@ -0,0 +1,28 @@ +[gd_resource type="Resource" script_class="FishData" load_steps=4 format=3] + +[ext_resource type="Script" path="res://fish/fish_data.gd" id="1_fish_data"] +[ext_resource type="Resource" path="res://fishing/common_catch_profile.tres" id="2_profile"] +[ext_resource type="Texture2D" path="res://fish/species/clam_manila/clam_manila.png" id="3_texture"] + +[resource] +script = ExtResource("1_fish_data") +id = &"clam_manila" +display_name = "Manila clam" +active = true +catalog_number = 6406 +collection_group = &"Shellfish" +logbook_fact = "manila clams bury themselves in wet coastal sand and reveal their hiding places with small spurts of water." +collection_method = 2 +logbook_section = 1 +habitat_label = "wet beach sand" +available_seasons = 15 +allowed_water_types = 2 +rarity = 0 +base_catch_weight = 1.0 +catch_profile = ExtResource("2_profile") +weight_min_lb = 0.05 +weight_max_lb = 0.3 +sell_value_min = 3 +sell_value_max = 8 +sell_value_curve = 1.0 +display_texture = ExtResource("3_texture") diff --git a/fish/species/clownfish_ocellaris/clownfish_ocellaris.tres b/fish/species/clownfish_ocellaris/clownfish_ocellaris.tres index b09dbdb..16566cb 100644 --- a/fish/species/clownfish_ocellaris/clownfish_ocellaris.tres +++ b/fish/species/clownfish_ocellaris/clownfish_ocellaris.tres @@ -1,8 +1,9 @@ -[gd_resource type="Resource" script_class="FishData" load_steps=4 format=3] +[gd_resource type="Resource" script_class="FishData" load_steps=5 format=3] [ext_resource type="Script" path="res://fish/fish_data.gd" id="1_fish_data"] [ext_resource type="Resource" path="res://fishing/common_catch_profile.tres" id="2_profile"] [ext_resource type="Script" path="res://fish/fish_availability.gd" id="3_availability"] +[ext_resource type="Texture2D" path="res://art/exported/creatures/5702.png" id="99_fish_placeholder"] [sub_resource type="Resource" id="Availability"] script = ExtResource("3_availability") @@ -12,10 +13,11 @@ allow_night = false script = ExtResource("1_fish_data") id = &"clownfish_ocellaris" display_name = "ocellaris clownfish" -active = false +active = true catalog_number = 5702 collection_group = &"Reef ornamentals" logbook_fact = "ocellaris clownfish shelter safely among stinging anemone tentacles. each group is led by a female that develops from the largest male." +available_seasons = 15 allowed_water_types = 2 rarity = 1 base_catch_weight = 1.0 @@ -26,3 +28,4 @@ weight_max_lb = 0.15 sell_value_min = 5 sell_value_max = 10 sell_value_curve = 1.0 +display_texture = ExtResource("99_fish_placeholder") diff --git a/fish/species/cobia/cobia.tres b/fish/species/cobia/cobia.tres index 885f55a..51dec82 100644 --- a/fish/species/cobia/cobia.tres +++ b/fish/species/cobia/cobia.tres @@ -1,8 +1,9 @@ -[gd_resource type="Resource" script_class="FishData" load_steps=4 format=3] +[gd_resource type="Resource" script_class="FishData" load_steps=5 format=3] [ext_resource type="Script" path="res://fish/fish_data.gd" id="1_fish_data"] [ext_resource type="Resource" path="res://fishing/common_catch_profile.tres" id="2_profile"] [ext_resource type="Script" path="res://fish/fish_availability.gd" id="3_availability"] +[ext_resource type="Texture2D" path="res://art/exported/creatures/fish_placeholder.png" id="99_fish_placeholder"] [sub_resource type="Resource" id="Availability"] script = ExtResource("3_availability") @@ -12,10 +13,11 @@ allow_night = false script = ExtResource("1_fish_data") id = &"cobia" display_name = "cobia" -active = false +active = true catalog_number = 3602 collection_group = &"Large coastal predators" logbook_fact = "cobia often follow sharks, rays, and floating structures in warm seas. a broad dark stripe runs along their long, powerful bodies." +available_seasons = 6 allowed_water_types = 2 rarity = 2 base_catch_weight = 0.24 @@ -26,3 +28,4 @@ weight_max_lb = 80.0 sell_value_min = 15 sell_value_max = 40 sell_value_curve = 0.82 +display_texture = ExtResource("99_fish_placeholder") diff --git a/fish/species/cod_atlantic/cod_atlantic.tres b/fish/species/cod_atlantic/cod_atlantic.tres index 22ee1ca..640ccaa 100644 --- a/fish/species/cod_atlantic/cod_atlantic.tres +++ b/fish/species/cod_atlantic/cod_atlantic.tres @@ -1,8 +1,9 @@ -[gd_resource type="Resource" script_class="FishData" load_steps=4 format=3] +[gd_resource type="Resource" script_class="FishData" load_steps=5 format=3] [ext_resource type="Script" path="res://fish/fish_data.gd" id="1_fish_data"] [ext_resource type="Resource" path="res://fishing/common_catch_profile.tres" id="2_profile"] [ext_resource type="Script" path="res://fish/fish_availability.gd" id="3_availability"] +[ext_resource type="Texture2D" path="res://art/exported/creatures/fish_placeholder.png" id="99_fish_placeholder"] [sub_resource type="Resource" id="Availability"] script = ExtResource("3_availability") @@ -11,10 +12,11 @@ script = ExtResource("3_availability") script = ExtResource("1_fish_data") id = &"cod_atlantic" display_name = "atlantic cod" -active = false +active = true catalog_number = 1402 collection_group = &"Cold shelf fish" logbook_fact = "atlantic cod carry a pale lateral line and one chin barbel. they search cold seafloors for crustaceans, mollusks, and smaller fish." +available_seasons = 13 allowed_water_types = 2 rarity = 0 base_catch_weight = 1.8 @@ -25,3 +27,4 @@ weight_max_lb = 55.0 sell_value_min = 5 sell_value_max = 18 sell_value_curve = 0.85 +display_texture = ExtResource("99_fish_placeholder") diff --git a/fish/species/cod_pacific/cod_pacific.tres b/fish/species/cod_pacific/cod_pacific.tres index 7f0b8ce..729acc1 100644 --- a/fish/species/cod_pacific/cod_pacific.tres +++ b/fish/species/cod_pacific/cod_pacific.tres @@ -1,8 +1,9 @@ -[gd_resource type="Resource" script_class="FishData" load_steps=4 format=3] +[gd_resource type="Resource" script_class="FishData" load_steps=5 format=3] [ext_resource type="Script" path="res://fish/fish_data.gd" id="1_fish_data"] [ext_resource type="Resource" path="res://fishing/common_catch_profile.tres" id="2_profile"] [ext_resource type="Script" path="res://fish/fish_availability.gd" id="3_availability"] +[ext_resource type="Texture2D" path="res://art/exported/creatures/fish_placeholder.png" id="99_fish_placeholder"] [sub_resource type="Resource" id="Availability"] script = ExtResource("3_availability") @@ -11,10 +12,11 @@ script = ExtResource("3_availability") script = ExtResource("1_fish_data") id = &"cod_pacific" display_name = "pacific cod" -active = false +active = true catalog_number = 1406 collection_group = &"Cold shelf fish" logbook_fact = "pacific cod use a chin barbel to investigate cold shelf bottoms. seasonal schools follow prey between deeper water and coastal spawning grounds." +available_seasons = 13 allowed_water_types = 2 rarity = 0 base_catch_weight = 1.8 @@ -25,3 +27,4 @@ weight_max_lb = 45.0 sell_value_min = 5 sell_value_max = 17 sell_value_curve = 0.85 +display_texture = ExtResource("99_fish_placeholder") diff --git a/fish/species/coelacanth_west_indian/coelacanth_west_indian.tres b/fish/species/coelacanth_west_indian/coelacanth_west_indian.tres index fafc161..8b7bf18 100644 --- a/fish/species/coelacanth_west_indian/coelacanth_west_indian.tres +++ b/fish/species/coelacanth_west_indian/coelacanth_west_indian.tres @@ -1,8 +1,9 @@ -[gd_resource type="Resource" script_class="FishData" load_steps=4 format=3] +[gd_resource type="Resource" script_class="FishData" load_steps=5 format=3] [ext_resource type="Script" path="res://fish/fish_data.gd" id="1_fish_data"] [ext_resource type="Resource" path="res://fishing/common_catch_profile.tres" id="2_profile"] [ext_resource type="Script" path="res://fish/fish_availability.gd" id="3_availability"] +[ext_resource type="Texture2D" path="res://art/exported/creatures/fish_placeholder.png" id="99_fish_placeholder"] [sub_resource type="Resource" id="Availability"] script = ExtResource("3_availability") @@ -13,10 +14,11 @@ require_fog = true script = ExtResource("1_fish_data") id = &"coelacanth_west_indian" display_name = "West Indian Ocean coelacanth" -active = false +active = true catalog_number = 1702 collection_group = &"Deep-sea legends" logbook_fact = "west indian ocean coelacanths shelter in deep volcanic caves by day. fleshy lobed fins move in an alternating, limb-like rhythm." +available_seasons = 15 allowed_water_types = 2 rarity = 4 base_catch_weight = 0.03 @@ -27,3 +29,4 @@ weight_max_lb = 200.0 sell_value_min = 65 sell_value_max = 145 sell_value_curve = 0.8 +display_texture = ExtResource("99_fish_placeholder") diff --git a/fish/species/conch_queen/conch_queen.tres b/fish/species/conch_queen/conch_queen.tres index 0868ddf..045012b 100644 --- a/fish/species/conch_queen/conch_queen.tres +++ b/fish/species/conch_queen/conch_queen.tres @@ -1,8 +1,9 @@ -[gd_resource type="Resource" script_class="FishData" load_steps=4 format=3] +[gd_resource type="Resource" script_class="FishData" load_steps=5 format=3] [ext_resource type="Script" path="res://fish/fish_data.gd" id="1_fish_data"] [ext_resource type="Resource" path="res://fishing/common_catch_profile.tres" id="2_profile"] [ext_resource type="Script" path="res://fish/fish_availability.gd" id="3_availability"] +[ext_resource type="Texture2D" path="res://art/exported/creatures/fish_placeholder.png" id="99_fish_placeholder"] [sub_resource type="Resource" id="Availability"] script = ExtResource("3_availability") @@ -13,10 +14,11 @@ forbid_fog = true script = ExtResource("1_fish_data") id = &"conch_queen" display_name = "queen conch" -active = false +active = true catalog_number = 6404 collection_group = &"Shellfish" logbook_fact = "queen conchs graze algae with a long flexible snout. adults develop a broad flared shell lip and move by vaulting on one muscular foot." +available_seasons = 15 allowed_water_types = 2 rarity = 2 base_catch_weight = 0.24 @@ -27,3 +29,4 @@ weight_max_lb = 5.0 sell_value_min = 15 sell_value_max = 36 sell_value_curve = 0.91 +display_texture = ExtResource("99_fish_placeholder") diff --git a/fish/species/cornetfish_red/cornetfish_red.tres b/fish/species/cornetfish_red/cornetfish_red.tres index fe4fbc9..ea750bd 100644 --- a/fish/species/cornetfish_red/cornetfish_red.tres +++ b/fish/species/cornetfish_red/cornetfish_red.tres @@ -1,8 +1,9 @@ -[gd_resource type="Resource" script_class="FishData" load_steps=4 format=3] +[gd_resource type="Resource" script_class="FishData" load_steps=5 format=3] [ext_resource type="Script" path="res://fish/fish_data.gd" id="1_fish_data"] [ext_resource type="Resource" path="res://fishing/common_catch_profile.tres" id="2_profile"] [ext_resource type="Script" path="res://fish/fish_availability.gd" id="3_availability"] +[ext_resource type="Texture2D" path="res://art/exported/creatures/fish_placeholder.png" id="99_fish_placeholder"] [sub_resource type="Resource" id="Availability"] script = ExtResource("3_availability") @@ -13,10 +14,11 @@ require_fog = true script = ExtResource("1_fish_data") id = &"cornetfish_red" display_name = "red cornetfish" -active = false +active = true catalog_number = 5606 collection_group = &"Reef oddities" logbook_fact = "red cornetfish stalk reefs with extremely long bodies and tubular snouts. a trailing filament extends from the center of the tail." +available_seasons = 15 allowed_water_types = 2 rarity = 3 base_catch_weight = 0.11 @@ -27,3 +29,4 @@ weight_max_lb = 4.0 sell_value_min = 24 sell_value_max = 55 sell_value_curve = 0.92 +display_texture = ExtResource("99_fish_placeholder") diff --git a/fish/species/cowfish_longhorn/cowfish_longhorn.tres b/fish/species/cowfish_longhorn/cowfish_longhorn.tres index 2f647cc..2a848a7 100644 --- a/fish/species/cowfish_longhorn/cowfish_longhorn.tres +++ b/fish/species/cowfish_longhorn/cowfish_longhorn.tres @@ -1,8 +1,9 @@ -[gd_resource type="Resource" script_class="FishData" load_steps=4 format=3] +[gd_resource type="Resource" script_class="FishData" load_steps=5 format=3] [ext_resource type="Script" path="res://fish/fish_data.gd" id="1_fish_data"] [ext_resource type="Resource" path="res://fishing/common_catch_profile.tres" id="2_profile"] [ext_resource type="Script" path="res://fish/fish_availability.gd" id="3_availability"] +[ext_resource type="Texture2D" path="res://art/exported/creatures/fish_placeholder.png" id="99_fish_placeholder"] [sub_resource type="Resource" id="Availability"] script = ExtResource("3_availability") @@ -13,10 +14,11 @@ require_fog = true script = ExtResource("1_fish_data") id = &"cowfish_longhorn" display_name = "longhorn cowfish" -active = false +active = true catalog_number = 5604 collection_group = &"Reef oddities" logbook_fact = "longhorn cowfish wear a rigid box of fused scales with horns above the eyes. small fins steer the angular body with surprising precision." +available_seasons = 15 allowed_water_types = 2 rarity = 3 base_catch_weight = 0.13 @@ -27,3 +29,4 @@ weight_max_lb = 2.0 sell_value_min = 23 sell_value_max = 52 sell_value_curve = 0.94 +display_texture = ExtResource("99_fish_placeholder") diff --git a/fish/species/crab_blue/crab_blue.tres b/fish/species/crab_blue/crab_blue.tres index fd2ec5c..2ee3279 100644 --- a/fish/species/crab_blue/crab_blue.tres +++ b/fish/species/crab_blue/crab_blue.tres @@ -19,6 +19,7 @@ logbook_fact = "blue crabs swim with flattened rear legs shaped like paddles. br collection_method = 1 logbook_section = 1 habitat_label = "shallow coastal water" +available_seasons = 6 allowed_water_types = 2 rarity = 0 base_catch_weight = 1.15 diff --git a/fish/species/crab_brown/crab_brown.tres b/fish/species/crab_brown/crab_brown.tres index 14e30c8..7dec427 100644 --- a/fish/species/crab_brown/crab_brown.tres +++ b/fish/species/crab_brown/crab_brown.tres @@ -2,7 +2,7 @@ [ext_resource type="Script" path="res://fish/fish_data.gd" id="1_fish_data"] [ext_resource type="Resource" path="res://fishing/common_catch_profile.tres" id="2_profile"] -[ext_resource type="Texture2D" path="res://fish/species/crab_brown/crab_brown.png" id="3_texture"] +[ext_resource type="Texture2D" path="res://art/exported/creatures/3906.png" id="3_texture"] [resource] script = ExtResource("1_fish_data") @@ -15,6 +15,7 @@ logbook_fact = "brown crabs hide among rocks and sand along sheltered coasts. br collection_method = 1 logbook_section = 1 habitat_label = "dry beach sand" +available_seasons = 15 allowed_water_types = 2 rarity = 0 base_catch_weight = 1.0 diff --git a/fish/species/crab_dungeness/crab_dungeness.tres b/fish/species/crab_dungeness/crab_dungeness.tres index ada612a..bb56819 100644 --- a/fish/species/crab_dungeness/crab_dungeness.tres +++ b/fish/species/crab_dungeness/crab_dungeness.tres @@ -20,6 +20,7 @@ logbook_fact = "dungeness crabs bury beneath sand with only their eyes and anten collection_method = 1 logbook_section = 1 habitat_label = "shallow coastal sand" +available_seasons = 13 allowed_water_types = 2 rarity = 1 base_catch_weight = 0.65 diff --git a/fish/species/crab_ghost/crab_ghost.tres b/fish/species/crab_ghost/crab_ghost.tres index dca2eff..db54293 100644 --- a/fish/species/crab_ghost/crab_ghost.tres +++ b/fish/species/crab_ghost/crab_ghost.tres @@ -20,6 +20,7 @@ logbook_fact = "atlantic ghost crabs dash across beaches on long pale legs and r collection_method = 1 logbook_section = 1 habitat_label = "dry beach sand" +available_seasons = 6 allowed_water_types = 2 rarity = 2 base_catch_weight = 0.28 diff --git a/fish/species/crab_japanese_spider/crab_japanese_spider.tres b/fish/species/crab_japanese_spider/crab_japanese_spider.tres index e045021..33ffbff 100644 --- a/fish/species/crab_japanese_spider/crab_japanese_spider.tres +++ b/fish/species/crab_japanese_spider/crab_japanese_spider.tres @@ -1,8 +1,9 @@ -[gd_resource type="Resource" script_class="FishData" load_steps=4 format=3] +[gd_resource type="Resource" script_class="FishData" load_steps=5 format=3] [ext_resource type="Script" path="res://fish/fish_data.gd" id="1_fish_data"] [ext_resource type="Resource" path="res://fishing/common_catch_profile.tres" id="2_profile"] [ext_resource type="Script" path="res://fish/fish_availability.gd" id="3_availability"] +[ext_resource type="Texture2D" path="res://art/exported/creatures/fish_placeholder.png" id="99_fish_placeholder"] [sub_resource type="Resource" id="Availability"] script = ExtResource("3_availability") @@ -12,10 +13,11 @@ allow_day = false script = ExtResource("1_fish_data") id = &"crab_japanese_spider" display_name = "Japanese spider crab" -active = false +active = true catalog_number = 3904 collection_group = &"Marine crabs" logbook_fact = "japanese spider crabs carry the longest leg span of any living arthropod. adults roam deep seafloors around japan." +available_seasons = 13 allowed_water_types = 2 rarity = 4 base_catch_weight = 0.045 @@ -26,3 +28,4 @@ weight_max_lb = 44.0 sell_value_min = 38 sell_value_max = 88 sell_value_curve = 0.84 +display_texture = ExtResource("99_fish_placeholder") diff --git a/fish/species/crab_red_king/crab_red_king.tres b/fish/species/crab_red_king/crab_red_king.tres index d0b8a74..c82579a 100644 --- a/fish/species/crab_red_king/crab_red_king.tres +++ b/fish/species/crab_red_king/crab_red_king.tres @@ -1,8 +1,9 @@ -[gd_resource type="Resource" script_class="FishData" load_steps=4 format=3] +[gd_resource type="Resource" script_class="FishData" load_steps=5 format=3] [ext_resource type="Script" path="res://fish/fish_data.gd" id="1_fish_data"] [ext_resource type="Resource" path="res://fishing/common_catch_profile.tres" id="2_profile"] [ext_resource type="Script" path="res://fish/fish_availability.gd" id="3_availability"] +[ext_resource type="Texture2D" path="res://art/exported/creatures/fish_placeholder.png" id="99_fish_placeholder"] [sub_resource type="Resource" id="Availability"] script = ExtResource("3_availability") @@ -13,10 +14,11 @@ require_fog = true script = ExtResource("1_fish_data") id = &"crab_red_king" display_name = "red king crab" -active = false +active = true catalog_number = 3905 collection_group = &"Marine crabs" logbook_fact = "red king crabs stride over cold northern bottoms on long armored legs. despite the name, they are closer to hermit crabs than true crabs." +available_seasons = 13 allowed_water_types = 2 rarity = 3 base_catch_weight = 0.11 @@ -27,3 +29,4 @@ weight_max_lb = 24.0 sell_value_min = 24 sell_value_max = 58 sell_value_curve = 0.85 +display_texture = ExtResource("99_fish_placeholder") diff --git a/fish/species/crappie_black/crappie_black.tres b/fish/species/crappie_black/crappie_black.tres index ba6956e..0359a2c 100644 --- a/fish/species/crappie_black/crappie_black.tres +++ b/fish/species/crappie_black/crappie_black.tres @@ -1,8 +1,9 @@ -[gd_resource type="Resource" script_class="FishData" load_steps=4 format=3] +[gd_resource type="Resource" script_class="FishData" load_steps=5 format=3] [ext_resource type="Script" path="res://fish/fish_data.gd" id="1_fish_data"] [ext_resource type="Resource" path="res://fishing/common_catch_profile.tres" id="2_profile"] [ext_resource type="Script" path="res://fish/fish_availability.gd" id="3_availability"] +[ext_resource type="Texture2D" path="res://art/exported/creatures/fish_placeholder.png" id="99_fish_placeholder"] [sub_resource type="Resource" id="Availability"] script = ExtResource("3_availability") @@ -12,10 +13,11 @@ require_fog = true script = ExtResource("1_fish_data") id = &"crappie_black" display_name = "black crappie" -active = false +active = true catalog_number = 3101 collection_group = &"Freshwater panfish" logbook_fact = "black crappie gather around submerged wood and vegetation in clear water. irregular dark speckles scatter across their deep silver bodies." +available_seasons = 13 allowed_water_types = 1 rarity = 1 base_catch_weight = 1.0 @@ -26,3 +28,4 @@ weight_max_lb = 4.0 sell_value_min = 5 sell_value_max = 11 sell_value_curve = 0.9 +display_texture = ExtResource("99_fish_placeholder") diff --git a/fish/species/crappie_white/crappie_white.tres b/fish/species/crappie_white/crappie_white.tres index 85c22b0..7806c37 100644 --- a/fish/species/crappie_white/crappie_white.tres +++ b/fish/species/crappie_white/crappie_white.tres @@ -1,8 +1,9 @@ -[gd_resource type="Resource" script_class="FishData" load_steps=4 format=3] +[gd_resource type="Resource" script_class="FishData" load_steps=5 format=3] [ext_resource type="Script" path="res://fish/fish_data.gd" id="1_fish_data"] [ext_resource type="Resource" path="res://fishing/common_catch_profile.tres" id="2_profile"] [ext_resource type="Script" path="res://fish/fish_availability.gd" id="3_availability"] +[ext_resource type="Texture2D" path="res://art/exported/creatures/fish_placeholder.png" id="99_fish_placeholder"] [sub_resource type="Resource" id="Availability"] script = ExtResource("3_availability") @@ -12,10 +13,11 @@ allow_day = false script = ExtResource("1_fish_data") id = &"crappie_white" display_name = "white crappie" -active = false +active = true catalog_number = 3107 collection_group = &"Freshwater panfish" logbook_fact = "white crappie favor warm, cloudy water and gather around structure. vertical bars cross their silver sides instead of scattered speckles." +available_seasons = 13 allowed_water_types = 1 rarity = 0 base_catch_weight = 1.7 @@ -26,3 +28,4 @@ weight_max_lb = 4.5 sell_value_min = 4 sell_value_max = 9 sell_value_curve = 0.9 +display_texture = ExtResource("99_fish_placeholder") diff --git a/fish/species/crayfish_red_swamp/crayfish_red_swamp.tres b/fish/species/crayfish_red_swamp/crayfish_red_swamp.tres index cd9d6a0..b53448d 100644 --- a/fish/species/crayfish_red_swamp/crayfish_red_swamp.tres +++ b/fish/species/crayfish_red_swamp/crayfish_red_swamp.tres @@ -1,8 +1,9 @@ -[gd_resource type="Resource" script_class="FishData" load_steps=4 format=3] +[gd_resource type="Resource" script_class="FishData" load_steps=5 format=3] [ext_resource type="Script" path="res://fish/fish_data.gd" id="1_fish_data"] [ext_resource type="Resource" path="res://fishing/common_catch_profile.tres" id="2_profile"] [ext_resource type="Script" path="res://fish/fish_availability.gd" id="3_availability"] +[ext_resource type="Texture2D" path="res://art/exported/creatures/fish_placeholder.png" id="99_fish_placeholder"] [sub_resource type="Resource" id="Availability"] script = ExtResource("3_availability") @@ -13,10 +14,11 @@ require_rain = true script = ExtResource("1_fish_data") id = &"crayfish_red_swamp" display_name = "red swamp crayfish" -active = false +active = true catalog_number = 2601 collection_group = &"Freshwater crustaceans" logbook_fact = "red swamp crayfish burrow into wet ground when water recedes. adaptable populations feed on plants, carrion, and small aquatic animals." +available_seasons = 7 allowed_water_types = 1 rarity = 0 base_catch_weight = 1.1 @@ -27,3 +29,4 @@ weight_max_lb = 0.25 sell_value_min = 3 sell_value_max = 7 sell_value_curve = 0.98 +display_texture = ExtResource("99_fish_placeholder") diff --git a/fish/species/croaker_atlantic/croaker_atlantic.tres b/fish/species/croaker_atlantic/croaker_atlantic.tres index 2f4df70..c35e7de 100644 --- a/fish/species/croaker_atlantic/croaker_atlantic.tres +++ b/fish/species/croaker_atlantic/croaker_atlantic.tres @@ -1,8 +1,9 @@ -[gd_resource type="Resource" script_class="FishData" load_steps=4 format=3] +[gd_resource type="Resource" script_class="FishData" load_steps=5 format=3] [ext_resource type="Script" path="res://fish/fish_data.gd" id="1_fish_data"] [ext_resource type="Resource" path="res://fishing/common_catch_profile.tres" id="2_profile"] [ext_resource type="Script" path="res://fish/fish_availability.gd" id="3_availability"] +[ext_resource type="Texture2D" path="res://art/exported/creatures/fish_placeholder.png" id="99_fish_placeholder"] [sub_resource type="Resource" id="Availability"] script = ExtResource("3_availability") @@ -13,10 +14,11 @@ require_rain = true script = ExtResource("1_fish_data") id = &"croaker_atlantic" display_name = "atlantic croaker" -active = false +active = true catalog_number = 6801 collection_group = &"Temperate estuary" logbook_fact = "atlantic croakers vibrate muscles against the swim bladder to make a croaking sound. chin barbels locate worms in sandy bays." +available_seasons = 7 allowed_water_types = 2 rarity = 0 base_catch_weight = 2.1 @@ -27,3 +29,4 @@ weight_max_lb = 5.0 sell_value_min = 3 sell_value_max = 8 sell_value_curve = 0.92 +display_texture = ExtResource("99_fish_placeholder") diff --git a/fish/species/croaker_yellowfin/croaker_yellowfin.tres b/fish/species/croaker_yellowfin/croaker_yellowfin.tres index ed5410d..84885f9 100644 --- a/fish/species/croaker_yellowfin/croaker_yellowfin.tres +++ b/fish/species/croaker_yellowfin/croaker_yellowfin.tres @@ -1,8 +1,9 @@ -[gd_resource type="Resource" script_class="FishData" load_steps=4 format=3] +[gd_resource type="Resource" script_class="FishData" load_steps=5 format=3] [ext_resource type="Script" path="res://fish/fish_data.gd" id="1_fish_data"] [ext_resource type="Resource" path="res://fishing/common_catch_profile.tres" id="2_profile"] [ext_resource type="Script" path="res://fish/fish_availability.gd" id="3_availability"] +[ext_resource type="Texture2D" path="res://art/exported/creatures/fish_placeholder.png" id="99_fish_placeholder"] [sub_resource type="Resource" id="Availability"] script = ExtResource("3_availability") @@ -11,10 +12,11 @@ script = ExtResource("3_availability") script = ExtResource("1_fish_data") id = &"croaker_yellowfin" display_name = "yellowfin croaker" -active = false +active = true catalog_number = 6807 collection_group = &"Temperate estuary" logbook_fact = "yellowfin croakers search sandy surf zones with a small chin barbel. internal muscles produce croaks and drumming calls." +available_seasons = 7 allowed_water_types = 2 rarity = 0 base_catch_weight = 2.0 @@ -25,3 +27,4 @@ weight_max_lb = 4.0 sell_value_min = 3 sell_value_max = 8 sell_value_curve = 0.92 +display_texture = ExtResource("99_fish_placeholder") diff --git a/fish/species/cusk/cusk.tres b/fish/species/cusk/cusk.tres index c43b1b7..b223ba1 100644 --- a/fish/species/cusk/cusk.tres +++ b/fish/species/cusk/cusk.tres @@ -1,8 +1,9 @@ -[gd_resource type="Resource" script_class="FishData" load_steps=4 format=3] +[gd_resource type="Resource" script_class="FishData" load_steps=5 format=3] [ext_resource type="Script" path="res://fish/fish_data.gd" id="1_fish_data"] [ext_resource type="Resource" path="res://fishing/common_catch_profile.tres" id="2_profile"] [ext_resource type="Script" path="res://fish/fish_availability.gd" id="3_availability"] +[ext_resource type="Texture2D" path="res://art/exported/creatures/fish_placeholder.png" id="99_fish_placeholder"] [sub_resource type="Resource" id="Availability"] script = ExtResource("3_availability") @@ -12,10 +13,11 @@ allow_day = false script = ExtResource("1_fish_data") id = &"cusk" display_name = "cusk" -active = false +active = true catalog_number = 1202 collection_group = &"Cold reef fish" logbook_fact = "cusk move slowly across cold rocky bottoms, sheltering in cracks and caves. a single long fin runs around much of the rear body." +available_seasons = 13 allowed_water_types = 2 rarity = 1 base_catch_weight = 0.75 @@ -26,3 +28,4 @@ weight_max_lb = 30.0 sell_value_min = 7 sell_value_max = 19 sell_value_curve = 0.85 +display_texture = ExtResource("99_fish_placeholder") diff --git a/fish/species/cuttlefish_common/cuttlefish_common.tres b/fish/species/cuttlefish_common/cuttlefish_common.tres index 98ec8a0..c1ef5ec 100644 --- a/fish/species/cuttlefish_common/cuttlefish_common.tres +++ b/fish/species/cuttlefish_common/cuttlefish_common.tres @@ -1,8 +1,9 @@ -[gd_resource type="Resource" script_class="FishData" load_steps=4 format=3] +[gd_resource type="Resource" script_class="FishData" load_steps=5 format=3] [ext_resource type="Script" path="res://fish/fish_data.gd" id="1_fish_data"] [ext_resource type="Resource" path="res://fishing/common_catch_profile.tres" id="2_profile"] [ext_resource type="Script" path="res://fish/fish_availability.gd" id="3_availability"] +[ext_resource type="Texture2D" path="res://art/exported/creatures/fish_placeholder.png" id="99_fish_placeholder"] [sub_resource type="Resource" id="Availability"] script = ExtResource("3_availability") @@ -12,10 +13,11 @@ allow_night = false script = ExtResource("1_fish_data") id = &"cuttlefish_common" display_name = "common cuttlefish" -active = false +active = true catalog_number = 1502 collection_group = &"Cuttlefish and nautiluses" logbook_fact = "common cuttlefish flash changing colors and patterns through specialized skin cells. an internal cuttlebone controls buoyancy." +available_seasons = 15 allowed_water_types = 2 rarity = 1 base_catch_weight = 0.55 @@ -26,3 +28,4 @@ weight_max_lb = 12.0 sell_value_min = 7 sell_value_max = 17 sell_value_curve = 0.9 +display_texture = ExtResource("99_fish_placeholder") diff --git a/fish/species/cuttlefish_flamboyant/cuttlefish_flamboyant.tres b/fish/species/cuttlefish_flamboyant/cuttlefish_flamboyant.tres index 4c19554..496ade9 100644 --- a/fish/species/cuttlefish_flamboyant/cuttlefish_flamboyant.tres +++ b/fish/species/cuttlefish_flamboyant/cuttlefish_flamboyant.tres @@ -1,8 +1,9 @@ -[gd_resource type="Resource" script_class="FishData" load_steps=4 format=3] +[gd_resource type="Resource" script_class="FishData" load_steps=5 format=3] [ext_resource type="Script" path="res://fish/fish_data.gd" id="1_fish_data"] [ext_resource type="Resource" path="res://fishing/common_catch_profile.tres" id="2_profile"] [ext_resource type="Script" path="res://fish/fish_availability.gd" id="3_availability"] +[ext_resource type="Texture2D" path="res://art/exported/creatures/fish_placeholder.png" id="99_fish_placeholder"] [sub_resource type="Resource" id="Availability"] script = ExtResource("3_availability") @@ -13,10 +14,11 @@ require_rain = true script = ExtResource("1_fish_data") id = &"cuttlefish_flamboyant" display_name = "flamboyant cuttlefish" -active = false +active = true catalog_number = 1503 collection_group = &"Cuttlefish and nautiluses" logbook_fact = "flamboyant cuttlefish walk along the seafloor on their arms and fins. vivid displays warn predators of potent toxins." +available_seasons = 15 allowed_water_types = 2 rarity = 3 base_catch_weight = 0.1 @@ -27,3 +29,4 @@ weight_max_lb = 0.4 sell_value_min = 26 sell_value_max = 58 sell_value_curve = 0.96 +display_texture = ExtResource("99_fish_placeholder") diff --git a/fish/species/damselfish_sergeant_major/damselfish_sergeant_major.tres b/fish/species/damselfish_sergeant_major/damselfish_sergeant_major.tres index 24260cf..483565c 100644 --- a/fish/species/damselfish_sergeant_major/damselfish_sergeant_major.tres +++ b/fish/species/damselfish_sergeant_major/damselfish_sergeant_major.tres @@ -1,8 +1,9 @@ -[gd_resource type="Resource" script_class="FishData" load_steps=4 format=3] +[gd_resource type="Resource" script_class="FishData" load_steps=5 format=3] [ext_resource type="Script" path="res://fish/fish_data.gd" id="1_fish_data"] [ext_resource type="Resource" path="res://fishing/common_catch_profile.tres" id="2_profile"] [ext_resource type="Script" path="res://fish/fish_availability.gd" id="3_availability"] +[ext_resource type="Texture2D" path="res://art/exported/creatures/fish_placeholder.png" id="99_fish_placeholder"] [sub_resource type="Resource" id="Availability"] script = ExtResource("3_availability") @@ -12,10 +13,11 @@ allow_night = false script = ExtResource("1_fish_data") id = &"damselfish_sergeant_major" display_name = "sergeant major" -active = false +active = true catalog_number = 5904 collection_group = &"Reef schooling fish" logbook_fact = "sergeant majors guard purple egg patches on hard reef surfaces. five dark bars cross their yellow and silver bodies." +available_seasons = 15 allowed_water_types = 2 rarity = 0 base_catch_weight = 2.5 @@ -26,3 +28,4 @@ weight_max_lb = 0.5 sell_value_min = 2 sell_value_max = 5 sell_value_curve = 0.98 +display_texture = ExtResource("99_fish_placeholder") diff --git a/fish/species/danio_zebra/danio_zebra.tres b/fish/species/danio_zebra/danio_zebra.tres index 72567d8..0f73935 100644 --- a/fish/species/danio_zebra/danio_zebra.tres +++ b/fish/species/danio_zebra/danio_zebra.tres @@ -1,8 +1,9 @@ -[gd_resource type="Resource" script_class="FishData" load_steps=4 format=3] +[gd_resource type="Resource" script_class="FishData" load_steps=5 format=3] [ext_resource type="Script" path="res://fish/fish_data.gd" id="1_fish_data"] [ext_resource type="Resource" path="res://fishing/common_catch_profile.tres" id="2_profile"] [ext_resource type="Script" path="res://fish/fish_availability.gd" id="3_availability"] +[ext_resource type="Texture2D" path="res://art/exported/creatures/fish_placeholder.png" id="99_fish_placeholder"] [sub_resource type="Resource" id="Availability"] script = ExtResource("3_availability") @@ -12,10 +13,11 @@ allow_night = false script = ExtResource("1_fish_data") id = &"danio_zebra" display_name = "zebrafish" -active = false +active = true catalog_number = 2103 collection_group = &"Freshwater aquarium fish" logbook_fact = "zebrafish carry horizontal blue stripes from gill to tail. hardy schools thrive in shallow streams, flooded fields, and quiet pools." +available_seasons = 15 allowed_water_types = 1 rarity = 0 base_catch_weight = 1.35 @@ -26,3 +28,4 @@ weight_max_lb = 0.12 sell_value_min = 2 sell_value_max = 5 sell_value_curve = 0.98 +display_texture = ExtResource("99_fish_placeholder") diff --git a/fish/species/discus/discus.tres b/fish/species/discus/discus.tres index 4b84820..9803f77 100644 --- a/fish/species/discus/discus.tres +++ b/fish/species/discus/discus.tres @@ -1,8 +1,9 @@ -[gd_resource type="Resource" script_class="FishData" load_steps=4 format=3] +[gd_resource type="Resource" script_class="FishData" load_steps=5 format=3] [ext_resource type="Script" path="res://fish/fish_data.gd" id="1_fish_data"] [ext_resource type="Resource" path="res://fishing/common_catch_profile.tres" id="2_profile"] [ext_resource type="Script" path="res://fish/fish_availability.gd" id="3_availability"] +[ext_resource type="Texture2D" path="res://art/exported/creatures/fish_placeholder.png" id="99_fish_placeholder"] [sub_resource type="Resource" id="Availability"] script = ExtResource("3_availability") @@ -13,10 +14,11 @@ require_fog = true script = ExtResource("1_fish_data") id = &"discus" display_name = "discus" -active = false +active = true catalog_number = 7503 collection_group = &"Tropical freshwater fish" logbook_fact = "discus move through quiet amazon backwaters with round, flattened bodies. parents feed newly hatched young with nutrient-rich skin mucus." +available_seasons = 15 allowed_water_types = 1 rarity = 3 base_catch_weight = 0.12 @@ -27,3 +29,4 @@ weight_max_lb = 1.0 sell_value_min = 24 sell_value_max = 52 sell_value_curve = 0.92 +display_texture = ExtResource("99_fish_placeholder") diff --git a/fish/species/dolphin_bottlenose/dolphin_bottlenose.tres b/fish/species/dolphin_bottlenose/dolphin_bottlenose.tres index 8d07e73..2b410ea 100644 --- a/fish/species/dolphin_bottlenose/dolphin_bottlenose.tres +++ b/fish/species/dolphin_bottlenose/dolphin_bottlenose.tres @@ -1,8 +1,9 @@ -[gd_resource type="Resource" script_class="FishData" load_steps=4 format=3] +[gd_resource type="Resource" script_class="FishData" load_steps=5 format=3] [ext_resource type="Script" path="res://fish/fish_data.gd" id="1_fish_data"] [ext_resource type="Resource" path="res://fishing/common_catch_profile.tres" id="2_profile"] [ext_resource type="Script" path="res://fish/fish_availability.gd" id="3_availability"] +[ext_resource type="Texture2D" path="res://art/exported/creatures/fish_placeholder.png" id="99_fish_placeholder"] [sub_resource type="Resource" id="Availability"] script = ExtResource("3_availability") @@ -13,10 +14,11 @@ forbid_fog = true script = ExtResource("1_fish_data") id = &"dolphin_bottlenose" display_name = "common bottlenose dolphin" -active = false +active = true catalog_number = 7702 collection_group = &"Whales and dolphins" logbook_fact = "common bottlenose dolphins coordinate with whistles, clicks, and body signals. echolocation reveals prey hidden in dark or cloudy water." +available_seasons = 15 allowed_water_types = 2 rarity = 4 base_catch_weight = 0.012 @@ -27,3 +29,4 @@ weight_max_lb = 1400.0 sell_value_min = 75 sell_value_max = 180 sell_value_curve = 0.76 +display_texture = ExtResource("99_fish_placeholder") diff --git a/fish/species/dorado_golden/dorado_golden.tres b/fish/species/dorado_golden/dorado_golden.tres index c5f7abf..e22f7c9 100644 --- a/fish/species/dorado_golden/dorado_golden.tres +++ b/fish/species/dorado_golden/dorado_golden.tres @@ -1,8 +1,9 @@ -[gd_resource type="Resource" script_class="FishData" load_steps=4 format=3] +[gd_resource type="Resource" script_class="FishData" load_steps=5 format=3] [ext_resource type="Script" path="res://fish/fish_data.gd" id="1_fish_data"] [ext_resource type="Resource" path="res://fishing/common_catch_profile.tres" id="2_profile"] [ext_resource type="Script" path="res://fish/fish_availability.gd" id="3_availability"] +[ext_resource type="Texture2D" path="res://art/exported/creatures/fish_placeholder.png" id="99_fish_placeholder"] [sub_resource type="Resource" id="Availability"] script = ExtResource("3_availability") @@ -13,10 +14,11 @@ require_rain = true script = ExtResource("1_fish_data") id = &"dorado_golden" display_name = "golden dorado" -active = false +active = true catalog_number = 7602 collection_group = &"Tropical freshwater predators" logbook_fact = "golden dorado chase fish through powerful south american rivers. muscular tails, heavy jaws, and golden scales suit life in fast current." +available_seasons = 15 allowed_water_types = 1 rarity = 3 base_catch_weight = 0.1 @@ -27,3 +29,4 @@ weight_max_lb = 55.0 sell_value_min = 29 sell_value_max = 66 sell_value_curve = 0.82 +display_texture = ExtResource("99_fish_placeholder") diff --git a/fish/species/dugong/dugong.tres b/fish/species/dugong/dugong.tres index d6c756d..0c81d2e 100644 --- a/fish/species/dugong/dugong.tres +++ b/fish/species/dugong/dugong.tres @@ -1,8 +1,9 @@ -[gd_resource type="Resource" script_class="FishData" load_steps=4 format=3] +[gd_resource type="Resource" script_class="FishData" load_steps=5 format=3] [ext_resource type="Script" path="res://fish/fish_data.gd" id="1_fish_data"] [ext_resource type="Resource" path="res://fishing/common_catch_profile.tres" id="2_profile"] [ext_resource type="Script" path="res://fish/fish_availability.gd" id="3_availability"] +[ext_resource type="Texture2D" path="res://art/exported/creatures/fish_placeholder.png" id="99_fish_placeholder"] [sub_resource type="Resource" id="Availability"] script = ExtResource("3_availability") @@ -13,10 +14,11 @@ forbid_fog = true script = ExtResource("1_fish_data") id = &"dugong" display_name = "dugong" -active = false +active = true catalog_number = 501 collection_group = &"Coastal marine mammals" logbook_fact = "dugongs graze seagrass meadows with a downturned, bristled snout. they are the only fully marine members of the sirenian family." +available_seasons = 15 allowed_water_types = 2 rarity = 4 base_catch_weight = 0.011 @@ -27,3 +29,4 @@ weight_max_lb = 1100.0 sell_value_min = 72 sell_value_max = 165 sell_value_curve = 0.77 +display_texture = ExtResource("99_fish_placeholder") diff --git a/fish/species/eel_american/eel_american.tres b/fish/species/eel_american/eel_american.tres index 54a671b..a433afa 100644 --- a/fish/species/eel_american/eel_american.tres +++ b/fish/species/eel_american/eel_american.tres @@ -1,8 +1,9 @@ -[gd_resource type="Resource" script_class="FishData" load_steps=4 format=3] +[gd_resource type="Resource" script_class="FishData" load_steps=5 format=3] [ext_resource type="Script" path="res://fish/fish_data.gd" id="1_fish_data"] [ext_resource type="Resource" path="res://fishing/common_catch_profile.tres" id="2_profile"] [ext_resource type="Script" path="res://fish/fish_availability.gd" id="3_availability"] +[ext_resource type="Texture2D" path="res://art/exported/creatures/fish_placeholder.png" id="99_fish_placeholder"] [sub_resource type="Resource" id="Availability"] script = ExtResource("3_availability") @@ -13,10 +14,11 @@ require_rain = true script = ExtResource("1_fish_data") id = &"eel_american" display_name = "american eel" -active = false +active = true catalog_number = 4001 collection_group = &"Migratory eels" logbook_fact = "american eels hatch far out in the sargasso sea before entering freshwater rivers. adults later reverse the journey to spawn once." +available_seasons = 12 allowed_water_types = 3 rarity = 2 base_catch_weight = 0.25 @@ -27,3 +29,4 @@ weight_max_lb = 8.0 sell_value_min = 12 sell_value_max = 27 sell_value_curve = 0.88 +display_texture = ExtResource("99_fish_placeholder") diff --git a/fish/species/eel_european/eel_european.tres b/fish/species/eel_european/eel_european.tres index 54a0c61..7683d92 100644 --- a/fish/species/eel_european/eel_european.tres +++ b/fish/species/eel_european/eel_european.tres @@ -1,8 +1,9 @@ -[gd_resource type="Resource" script_class="FishData" load_steps=4 format=3] +[gd_resource type="Resource" script_class="FishData" load_steps=5 format=3] [ext_resource type="Script" path="res://fish/fish_data.gd" id="1_fish_data"] [ext_resource type="Resource" path="res://fishing/common_catch_profile.tres" id="2_profile"] [ext_resource type="Script" path="res://fish/fish_availability.gd" id="3_availability"] +[ext_resource type="Texture2D" path="res://art/exported/creatures/fish_placeholder.png" id="99_fish_placeholder"] [sub_resource type="Resource" id="Availability"] script = ExtResource("3_availability") @@ -13,10 +14,11 @@ require_fog = true script = ExtResource("1_fish_data") id = &"eel_european" display_name = "european eel" -active = false +active = true catalog_number = 4002 collection_group = &"Migratory eels" logbook_fact = "european eels cross the atlantic as transparent larvae before entering rivers and lakes. mature silver eels return to sea to reproduce." +available_seasons = 12 allowed_water_types = 3 rarity = 2 base_catch_weight = 0.2 @@ -27,3 +29,4 @@ weight_max_lb = 10.0 sell_value_min = 13 sell_value_max = 30 sell_value_curve = 0.88 +display_texture = ExtResource("99_fish_placeholder") diff --git a/fish/species/electric_eel/electric_eel.tres b/fish/species/electric_eel/electric_eel.tres index cc63eea..ef5b6df 100644 --- a/fish/species/electric_eel/electric_eel.tres +++ b/fish/species/electric_eel/electric_eel.tres @@ -1,8 +1,9 @@ -[gd_resource type="Resource" script_class="FishData" load_steps=4 format=3] +[gd_resource type="Resource" script_class="FishData" load_steps=5 format=3] [ext_resource type="Script" path="res://fish/fish_data.gd" id="1_fish_data"] [ext_resource type="Resource" path="res://fishing/common_catch_profile.tres" id="2_profile"] [ext_resource type="Script" path="res://fish/fish_availability.gd" id="3_availability"] +[ext_resource type="Texture2D" path="res://art/exported/creatures/fish_placeholder.png" id="99_fish_placeholder"] [sub_resource type="Resource" id="Availability"] script = ExtResource("3_availability") @@ -13,10 +14,11 @@ require_rain = true script = ExtResource("1_fish_data") id = &"electric_eel" display_name = "electric eel" -active = false +active = true catalog_number = 2901 collection_group = &"Freshwater oddities" logbook_fact = "electric eels navigate and hunt with electrical pulses produced along most of the body. they must surface regularly to breathe air." +available_seasons = 15 allowed_water_types = 1 rarity = 3 base_catch_weight = 0.1 @@ -27,3 +29,4 @@ weight_max_lb = 44.0 sell_value_min = 25 sell_value_max = 60 sell_value_curve = 0.82 +display_texture = ExtResource("99_fish_placeholder") diff --git a/fish/species/fallfish/fallfish.tres b/fish/species/fallfish/fallfish.tres index 72e3774..53ef7b6 100644 --- a/fish/species/fallfish/fallfish.tres +++ b/fish/species/fallfish/fallfish.tres @@ -1,8 +1,9 @@ -[gd_resource type="Resource" script_class="FishData" load_steps=4 format=3] +[gd_resource type="Resource" script_class="FishData" load_steps=5 format=3] [ext_resource type="Script" path="res://fish/fish_data.gd" id="1_fish_data"] [ext_resource type="Resource" path="res://fishing/common_catch_profile.tres" id="2_profile"] [ext_resource type="Script" path="res://fish/fish_availability.gd" id="3_availability"] +[ext_resource type="Texture2D" path="res://art/exported/creatures/fish_placeholder.png" id="99_fish_placeholder"] [sub_resource type="Resource" id="Availability"] script = ExtResource("3_availability") @@ -13,10 +14,11 @@ require_rain = true script = ExtResource("1_fish_data") id = &"fallfish" display_name = "fallfish" -active = false +active = true catalog_number = 2506 collection_group = &"Freshwater coarse fish" logbook_fact = "fallfish are large minnows that build broad stone nests in flowing water. other stream fish often reuse the gravel mounds for spawning." +available_seasons = 7 allowed_water_types = 1 rarity = 1 base_catch_weight = 0.9 @@ -27,3 +29,4 @@ weight_max_lb = 3.5 sell_value_min = 5 sell_value_max = 10 sell_value_curve = 0.92 +display_texture = ExtResource("99_fish_placeholder") diff --git a/fish/species/fangtooth_common/fangtooth_common.tres b/fish/species/fangtooth_common/fangtooth_common.tres index e53e1ad..1004279 100644 --- a/fish/species/fangtooth_common/fangtooth_common.tres +++ b/fish/species/fangtooth_common/fangtooth_common.tres @@ -1,8 +1,9 @@ -[gd_resource type="Resource" script_class="FishData" load_steps=4 format=3] +[gd_resource type="Resource" script_class="FishData" load_steps=5 format=3] [ext_resource type="Script" path="res://fish/fish_data.gd" id="1_fish_data"] [ext_resource type="Resource" path="res://fishing/common_catch_profile.tres" id="2_profile"] [ext_resource type="Script" path="res://fish/fish_availability.gd" id="3_availability"] +[ext_resource type="Texture2D" path="res://art/exported/creatures/fish_placeholder.png" id="99_fish_placeholder"] [sub_resource type="Resource" id="Availability"] script = ExtResource("3_availability") @@ -12,10 +13,11 @@ allow_day = false script = ExtResource("1_fish_data") id = &"fangtooth_common" display_name = "common fangtooth" -active = false +active = true catalog_number = 1802 collection_group = &"Deep-sea oddities" logbook_fact = "common fangtooths carry outsized teeth that fit into pockets in the roof of the mouth. they migrate upward from deep water after dark." +available_seasons = 15 allowed_water_types = 2 rarity = 3 base_catch_weight = 0.1 @@ -26,3 +28,4 @@ weight_max_lb = 0.5 sell_value_min = 25 sell_value_max = 56 sell_value_curve = 0.96 +display_texture = ExtResource("99_fish_placeholder") diff --git a/fish/species/flounder_peacock/flounder_peacock.tres b/fish/species/flounder_peacock/flounder_peacock.tres index 54737a4..3d096df 100644 --- a/fish/species/flounder_peacock/flounder_peacock.tres +++ b/fish/species/flounder_peacock/flounder_peacock.tres @@ -1,8 +1,9 @@ -[gd_resource type="Resource" script_class="FishData" load_steps=4 format=3] +[gd_resource type="Resource" script_class="FishData" load_steps=5 format=3] [ext_resource type="Script" path="res://fish/fish_data.gd" id="1_fish_data"] [ext_resource type="Resource" path="res://fishing/common_catch_profile.tres" id="2_profile"] [ext_resource type="Script" path="res://fish/fish_availability.gd" id="3_availability"] +[ext_resource type="Texture2D" path="res://art/exported/creatures/fish_placeholder.png" id="99_fish_placeholder"] [sub_resource type="Resource" id="Availability"] script = ExtResource("3_availability") @@ -12,10 +13,11 @@ allow_night = false script = ExtResource("1_fish_data") id = &"flounder_peacock" display_name = "peacock flounder" -active = false +active = true catalog_number = 5401 collection_group = &"Reef flatfish" logbook_fact = "peacock flounders change their spots and colors to match tropical sand. both eyes scan above while the flat body remains concealed." +available_seasons = 15 allowed_water_types = 2 rarity = 2 base_catch_weight = 0.3 @@ -26,3 +28,4 @@ weight_max_lb = 5.0 sell_value_min = 11 sell_value_max = 24 sell_value_curve = 0.9 +display_texture = ExtResource("99_fish_placeholder") diff --git a/fish/species/flounder_summer/flounder_summer.tres b/fish/species/flounder_summer/flounder_summer.tres index 9d5892b..680738d 100644 --- a/fish/species/flounder_summer/flounder_summer.tres +++ b/fish/species/flounder_summer/flounder_summer.tres @@ -1,8 +1,9 @@ -[gd_resource type="Resource" script_class="FishData" load_steps=4 format=3] +[gd_resource type="Resource" script_class="FishData" load_steps=5 format=3] [ext_resource type="Script" path="res://fish/fish_data.gd" id="1_fish_data"] [ext_resource type="Resource" path="res://fishing/common_catch_profile.tres" id="2_profile"] [ext_resource type="Script" path="res://fish/fish_availability.gd" id="3_availability"] +[ext_resource type="Texture2D" path="res://art/exported/creatures/fish_placeholder.png" id="99_fish_placeholder"] [sub_resource type="Resource" id="Availability"] script = ExtResource("3_availability") @@ -12,10 +13,11 @@ allow_night = false script = ExtResource("1_fish_data") id = &"flounder_summer" display_name = "summer flounder" -active = false +active = true catalog_number = 402 collection_group = &"Coastal flatfish" logbook_fact = "summer flounder bury themselves in sand with only their eyes exposed. a sudden burst carries them upward to seize passing prey." +available_seasons = 7 allowed_water_types = 2 rarity = 1 base_catch_weight = 0.9 @@ -26,3 +28,4 @@ weight_max_lb = 15.0 sell_value_min = 6 sell_value_max = 16 sell_value_curve = 0.88 +display_texture = ExtResource("99_fish_placeholder") diff --git a/fish/species/flounder_winter/flounder_winter.tres b/fish/species/flounder_winter/flounder_winter.tres index 6ad7a4b..c3ae09b 100644 --- a/fish/species/flounder_winter/flounder_winter.tres +++ b/fish/species/flounder_winter/flounder_winter.tres @@ -1,8 +1,9 @@ -[gd_resource type="Resource" script_class="FishData" load_steps=4 format=3] +[gd_resource type="Resource" script_class="FishData" load_steps=5 format=3] [ext_resource type="Script" path="res://fish/fish_data.gd" id="1_fish_data"] [ext_resource type="Resource" path="res://fishing/common_catch_profile.tres" id="2_profile"] [ext_resource type="Script" path="res://fish/fish_availability.gd" id="3_availability"] +[ext_resource type="Texture2D" path="res://art/exported/creatures/403.png" id="99_fish_placeholder"] [sub_resource type="Resource" id="Availability"] script = ExtResource("3_availability") @@ -13,10 +14,11 @@ forbid_rain = true script = ExtResource("1_fish_data") id = &"flounder_winter" display_name = "winter flounder" -active = false +active = true catalog_number = 403 collection_group = &"Coastal flatfish" logbook_fact = "winter flounder favor cool bays and estuaries where they rest on muddy bottoms. their eyes sit on the right side of the body." +available_seasons = 13 allowed_water_types = 2 rarity = 0 base_catch_weight = 1.8 @@ -27,3 +29,4 @@ weight_max_lb = 8.0 sell_value_min = 4 sell_value_max = 9 sell_value_curve = 0.9 +display_texture = ExtResource("99_fish_placeholder") diff --git a/fish/species/flyingfish_tropical/flyingfish_tropical.tres b/fish/species/flyingfish_tropical/flyingfish_tropical.tres index 7f94269..12fd4bb 100644 --- a/fish/species/flyingfish_tropical/flyingfish_tropical.tres +++ b/fish/species/flyingfish_tropical/flyingfish_tropical.tres @@ -1,8 +1,9 @@ -[gd_resource type="Resource" script_class="FishData" load_steps=4 format=3] +[gd_resource type="Resource" script_class="FishData" load_steps=5 format=3] [ext_resource type="Script" path="res://fish/fish_data.gd" id="1_fish_data"] [ext_resource type="Resource" path="res://fishing/common_catch_profile.tres" id="2_profile"] [ext_resource type="Script" path="res://fish/fish_availability.gd" id="3_availability"] +[ext_resource type="Texture2D" path="res://art/exported/creatures/fish_placeholder.png" id="99_fish_placeholder"] [sub_resource type="Resource" id="Availability"] script = ExtResource("3_availability") @@ -13,10 +14,11 @@ forbid_rain = true script = ExtResource("1_fish_data") id = &"flyingfish_tropical" display_name = "tropical flyingfish" -active = false +active = true catalog_number = 6603 collection_group = &"Surface ocean fish" logbook_fact = "tropical flyingfish accelerate underwater before spreading enlarged fins above the surface. glides help them escape pursuing predators." +available_seasons = 15 allowed_water_types = 2 rarity = 2 base_catch_weight = 0.35 @@ -27,3 +29,4 @@ weight_max_lb = 1.5 sell_value_min = 10 sell_value_max = 22 sell_value_curve = 0.94 +display_texture = ExtResource("99_fish_placeholder") diff --git a/fish/species/foureyes_largescale/foureyes_largescale.tres b/fish/species/foureyes_largescale/foureyes_largescale.tres index 23b1b6c..7ebba2f 100644 --- a/fish/species/foureyes_largescale/foureyes_largescale.tres +++ b/fish/species/foureyes_largescale/foureyes_largescale.tres @@ -1,8 +1,9 @@ -[gd_resource type="Resource" script_class="FishData" load_steps=4 format=3] +[gd_resource type="Resource" script_class="FishData" load_steps=5 format=3] [ext_resource type="Script" path="res://fish/fish_data.gd" id="1_fish_data"] [ext_resource type="Resource" path="res://fishing/common_catch_profile.tres" id="2_profile"] [ext_resource type="Script" path="res://fish/fish_availability.gd" id="3_availability"] +[ext_resource type="Texture2D" path="res://art/exported/creatures/fish_placeholder.png" id="99_fish_placeholder"] [sub_resource type="Resource" id="Availability"] script = ExtResource("3_availability") @@ -12,10 +13,11 @@ allow_night = false script = ExtResource("1_fish_data") id = &"foureyes_largescale" display_name = "largescale foureyes" -active = false +active = true catalog_number = 202 collection_group = &"Brackish oddities" logbook_fact = "largescale foureyes cruise with each eye divided across the waterline. one half watches above while the other scans below." +available_seasons = 15 allowed_water_types = 3 rarity = 2 base_catch_weight = 0.32 @@ -26,3 +28,4 @@ weight_max_lb = 1.0 sell_value_min = 10 sell_value_max = 23 sell_value_curve = 0.95 +display_texture = ExtResource("99_fish_placeholder") diff --git a/fish/species/freshwater_drum/freshwater_drum.tres b/fish/species/freshwater_drum/freshwater_drum.tres index bd1389b..f52f9fe 100644 --- a/fish/species/freshwater_drum/freshwater_drum.tres +++ b/fish/species/freshwater_drum/freshwater_drum.tres @@ -1,8 +1,9 @@ -[gd_resource type="Resource" script_class="FishData" load_steps=4 format=3] +[gd_resource type="Resource" script_class="FishData" load_steps=5 format=3] [ext_resource type="Script" path="res://fish/fish_data.gd" id="1_fish_data"] [ext_resource type="Resource" path="res://fishing/common_catch_profile.tres" id="2_profile"] [ext_resource type="Script" path="res://fish/fish_availability.gd" id="3_availability"] +[ext_resource type="Texture2D" path="res://art/exported/creatures/fish_placeholder.png" id="99_fish_placeholder"] [sub_resource type="Resource" id="Availability"] script = ExtResource("3_availability") @@ -13,10 +14,11 @@ require_rain = true script = ExtResource("1_fish_data") id = &"freshwater_drum" display_name = "freshwater drum" -active = false +active = true catalog_number = 2902 collection_group = &"Freshwater oddities" logbook_fact = "freshwater drum crush snails and mussels with powerful throat teeth. muscles vibrating against the swim bladder produce a low drumming sound." +available_seasons = 7 allowed_water_types = 1 rarity = 1 base_catch_weight = 0.7 @@ -27,3 +29,4 @@ weight_max_lb = 35.0 sell_value_min = 7 sell_value_max = 20 sell_value_curve = 0.85 +display_texture = ExtResource("99_fish_placeholder") diff --git a/fish/species/gar_alligator/gar_alligator.tres b/fish/species/gar_alligator/gar_alligator.tres index 48c02e2..f5439a4 100644 --- a/fish/species/gar_alligator/gar_alligator.tres +++ b/fish/species/gar_alligator/gar_alligator.tres @@ -1,8 +1,9 @@ -[gd_resource type="Resource" script_class="FishData" load_steps=4 format=3] +[gd_resource type="Resource" script_class="FishData" load_steps=5 format=3] [ext_resource type="Script" path="res://fish/fish_data.gd" id="1_fish_data"] [ext_resource type="Resource" path="res://fishing/common_catch_profile.tres" id="2_profile"] [ext_resource type="Script" path="res://fish/fish_availability.gd" id="3_availability"] +[ext_resource type="Texture2D" path="res://art/exported/creatures/fish_placeholder.png" id="99_fish_placeholder"] [sub_resource type="Resource" id="Availability"] script = ExtResource("3_availability") @@ -12,10 +13,11 @@ allow_day = false script = ExtResource("1_fish_data") id = &"gar_alligator" display_name = "alligator gar" -active = false +active = true catalog_number = 2701 collection_group = &"Freshwater giants" logbook_fact = "alligator gar combine a broad tooth-filled snout with heavy armor-like scales. a vascular swim bladder lets them breathe air at the surface." +available_seasons = 7 allowed_water_types = 1 rarity = 4 base_catch_weight = 0.055 @@ -26,3 +28,4 @@ weight_max_lb = 300.0 sell_value_min = 55 sell_value_max = 125 sell_value_curve = 0.8 +display_texture = ExtResource("99_fish_placeholder") diff --git a/fish/species/gar_longnose/gar_longnose.png b/fish/species/gar_longnose/gar_longnose.png new file mode 100644 index 0000000..2cfa552 Binary files /dev/null and b/fish/species/gar_longnose/gar_longnose.png differ diff --git a/items/icons/equipment/64_cooler_plus.png.import b/fish/species/gar_longnose/gar_longnose.png.import similarity index 72% rename from items/icons/equipment/64_cooler_plus.png.import rename to fish/species/gar_longnose/gar_longnose.png.import index 44e493a..385d22c 100644 --- a/items/icons/equipment/64_cooler_plus.png.import +++ b/fish/species/gar_longnose/gar_longnose.png.import @@ -2,16 +2,16 @@ importer="texture" type="CompressedTexture2D" -uid="uid://baht2hredfky8" -path="res://.godot/imported/64_cooler_plus.png-d0daa39246f92fd9774ec1721970efad.ctex" +uid="uid://brb46wv5v6htb" +path="res://.godot/imported/gar_longnose.png-91bf63255a3f7c479162d07d1e71edf8.ctex" metadata={ "vram_texture": false } [deps] -source_file="res://items/icons/equipment/64_cooler_plus.png" -dest_files=["res://.godot/imported/64_cooler_plus.png-d0daa39246f92fd9774ec1721970efad.ctex"] +source_file="res://fish/species/gar_longnose/gar_longnose.png" +dest_files=["res://.godot/imported/gar_longnose.png-91bf63255a3f7c479162d07d1e71edf8.ctex"] [params] diff --git a/fish/species/gar_longnose/gar_longnose.tres b/fish/species/gar_longnose/gar_longnose.tres index 29a8d68..aaabbfe 100644 --- a/fish/species/gar_longnose/gar_longnose.tres +++ b/fish/species/gar_longnose/gar_longnose.tres @@ -1,8 +1,9 @@ -[gd_resource type="Resource" script_class="FishData" load_steps=4 format=3] +[gd_resource type="Resource" script_class="FishData" load_steps=5 format=3] [ext_resource type="Script" path="res://fish/fish_data.gd" id="1_fish_data"] [ext_resource type="Resource" path="res://fishing/common_catch_profile.tres" id="2_profile"] [ext_resource type="Script" path="res://fish/fish_availability.gd" id="3_availability"] +[ext_resource type="Texture2D" path="res://art/exported/creatures/103.png" id="4_texture"] [sub_resource type="Resource" id="Availability"] script = ExtResource("3_availability") @@ -12,10 +13,11 @@ allow_night = false script = ExtResource("1_fish_data") id = &"gar_longnose" display_name = "longnose gar" -active = false +active = true catalog_number = 103 collection_group = &"Ancient freshwater fish" logbook_fact = "longnose gar wait near the surface before snapping sideways at passing fish. their narrow jaws carry rows of fine needle-like teeth." +available_seasons = 7 allowed_water_types = 1 rarity = 2 base_catch_weight = 0.24 @@ -26,3 +28,4 @@ weight_max_lb = 35.0 sell_value_min = 14 sell_value_max = 34 sell_value_curve = 0.85 +display_texture = ExtResource("4_texture") diff --git a/fish/species/gar_spotted/gar_spotted.png b/fish/species/gar_spotted/gar_spotted.png new file mode 100644 index 0000000..80cdfdf Binary files /dev/null and b/fish/species/gar_spotted/gar_spotted.png differ diff --git a/fish/species/gar_spotted/gar_spotted.png.import b/fish/species/gar_spotted/gar_spotted.png.import new file mode 100644 index 0000000..95d737f --- /dev/null +++ b/fish/species/gar_spotted/gar_spotted.png.import @@ -0,0 +1,40 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://b81tl0mmq7gxx" +path="res://.godot/imported/gar_spotted.png-0361bdcc323bb7449e240ef3835b7e18.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://fish/species/gar_spotted/gar_spotted.png" +dest_files=["res://.godot/imported/gar_spotted.png-0361bdcc323bb7449e240ef3835b7e18.ctex"] + +[params] + +compress/mode=0 +compress/high_quality=false +compress/lossy_quality=0.7 +compress/uastc_level=0 +compress/rdo_quality_loss=0.0 +compress/hdr_compression=1 +compress/normal_map=0 +compress/channel_pack=0 +mipmaps/generate=false +mipmaps/limit=-1 +roughness/mode=0 +roughness/src_normal="" +process/channel_remap/red=0 +process/channel_remap/green=1 +process/channel_remap/blue=2 +process/channel_remap/alpha=3 +process/fix_alpha_border=true +process/premult_alpha=false +process/normal_map_invert_y=false +process/hdr_as_srgb=false +process/hdr_clamp_exposure=false +process/size_limit=0 +detect_3d/compress_to=1 diff --git a/fish/species/gar_spotted/gar_spotted.tres b/fish/species/gar_spotted/gar_spotted.tres index abb3d16..3405ee9 100644 --- a/fish/species/gar_spotted/gar_spotted.tres +++ b/fish/species/gar_spotted/gar_spotted.tres @@ -1,8 +1,9 @@ -[gd_resource type="Resource" script_class="FishData" load_steps=4 format=3] +[gd_resource type="Resource" script_class="FishData" load_steps=5 format=3] [ext_resource type="Script" path="res://fish/fish_data.gd" id="1_fish_data"] [ext_resource type="Resource" path="res://fishing/common_catch_profile.tres" id="2_profile"] [ext_resource type="Script" path="res://fish/fish_availability.gd" id="3_availability"] +[ext_resource type="Texture2D" path="res://art/exported/creatures/106.png" id="4_texture"] [sub_resource type="Resource" id="Availability"] script = ExtResource("3_availability") @@ -13,10 +14,11 @@ require_fog = true script = ExtResource("1_fish_data") id = &"gar_spotted" display_name = "spotted gar" -active = false +active = true catalog_number = 106 collection_group = &"Ancient freshwater fish" logbook_fact = "spotted gar linger among vegetation where their mottled bodies break up their outline. they rise to gulp air as well as breathing through gills." +available_seasons = 7 allowed_water_types = 1 rarity = 2 base_catch_weight = 0.2 @@ -27,3 +29,4 @@ weight_max_lb = 15.0 sell_value_min = 13 sell_value_max = 29 sell_value_curve = 0.88 +display_texture = ExtResource("4_texture") diff --git a/fish/species/goby_round/fish_goby_round.png b/fish/species/goby_round/fish_goby_round.png index 89e3f78..02a5855 100644 Binary files a/fish/species/goby_round/fish_goby_round.png and b/fish/species/goby_round/fish_goby_round.png differ diff --git a/fish/species/goby_round/goby_round.tres b/fish/species/goby_round/goby_round.tres index 20d76a4..d8edf5e 100644 --- a/fish/species/goby_round/goby_round.tres +++ b/fish/species/goby_round/goby_round.tres @@ -3,7 +3,7 @@ [ext_resource type="Script" uid="uid://h7hg45b7wmst" path="res://fish/fish_data.gd" id="1_fish_data"] [ext_resource type="Resource" path="res://fishing/common_catch_profile.tres" id="2_profile"] [ext_resource type="Script" uid="uid://bs7cqi88csolc" path="res://fish/fish_availability.gd" id="3_availability_script"] -[ext_resource type="Texture2D" uid="uid://bdhywe0r1xcio" path="res://fish/species/goby_round/fish_goby_round.png" id="4_texture"] +[ext_resource type="Texture2D" path="res://art/exported/creatures/fish_placeholder.png" id="4_texture"] [sub_resource type="Resource" id="RoundGobyAvailability"] script = ExtResource("3_availability_script") @@ -18,6 +18,7 @@ active = true catalog_number = 3401 collection_group = &"Freshwater small fish" logbook_fact = "round gobies use fused pelvic fins like a suction cup to hold onto rocks. they are small fish with a famously large appetite." +available_seasons = 15 allowed_water_types = 1 base_catch_weight = 8.0 catch_profile = ExtResource("2_profile") diff --git a/fish/species/goldeye/goldeye.tres b/fish/species/goldeye/goldeye.tres index c623dc8..1d09b7c 100644 --- a/fish/species/goldeye/goldeye.tres +++ b/fish/species/goldeye/goldeye.tres @@ -1,8 +1,9 @@ -[gd_resource type="Resource" script_class="FishData" load_steps=4 format=3] +[gd_resource type="Resource" script_class="FishData" load_steps=5 format=3] [ext_resource type="Script" path="res://fish/fish_data.gd" id="1_fish_data"] [ext_resource type="Resource" path="res://fishing/common_catch_profile.tres" id="2_profile"] [ext_resource type="Script" path="res://fish/fish_availability.gd" id="3_availability"] +[ext_resource type="Texture2D" path="res://art/exported/creatures/fish_placeholder.png" id="99_fish_placeholder"] [sub_resource type="Resource" id="Availability"] script = ExtResource("3_availability") @@ -13,10 +14,11 @@ require_fog = true script = ExtResource("1_fish_data") id = &"goldeye" display_name = "goldeye" -active = false +active = true catalog_number = 2903 collection_group = &"Freshwater oddities" logbook_fact = "goldeye patrol turbid rivers with large light-sensitive eyes and a toothed tongue. they rise toward the surface to hunt insects and small fish." +available_seasons = 13 allowed_water_types = 1 rarity = 2 base_catch_weight = 0.3 @@ -27,3 +29,4 @@ weight_max_lb = 6.0 sell_value_min = 12 sell_value_max = 25 sell_value_curve = 0.9 +display_texture = ExtResource("99_fish_placeholder") diff --git a/fish/species/goldfish/fish_goldfish.png b/fish/species/goldfish/fish_goldfish.png index 7ca035b..7214195 100644 Binary files a/fish/species/goldfish/fish_goldfish.png and b/fish/species/goldfish/fish_goldfish.png differ diff --git a/fish/species/goldfish/goldfish.tres b/fish/species/goldfish/goldfish.tres index c70b2d3..444741b 100644 --- a/fish/species/goldfish/goldfish.tres +++ b/fish/species/goldfish/goldfish.tres @@ -3,11 +3,11 @@ [ext_resource type="Script" uid="uid://h7hg45b7wmst" path="res://fish/fish_data.gd" id="1_fish_data"] [ext_resource type="Resource" path="res://fishing/common_catch_profile.tres" id="2_profile"] [ext_resource type="Script" uid="uid://bs7cqi88csolc" path="res://fish/fish_availability.gd" id="3_availability_script"] -[ext_resource type="Texture2D" uid="uid://c6uth7aob03kg" path="res://fish/species/goldfish/fish_goldfish.png" id="4_texture"] +[ext_resource type="Texture2D" path="res://art/exported/creatures/fish_placeholder.png" id="4_texture"] [sub_resource type="Resource" id="GoldfishAvailability"] script = ExtResource("3_availability_script") -allowed_location_tags = Array[StringName]([&"starter_pond"]) +allowed_location_tags = Array[StringName]([&"starter_pond", &"pond"]) [resource] script = ExtResource("1_fish_data") @@ -17,6 +17,7 @@ active = true catalog_number = 3002 collection_group = &"Freshwater ornamental" logbook_fact = "goldfish can tolerate a surprisingly wide range of conditions. their wild relatives often live in slow, weedy water." +available_seasons = 15 allowed_water_types = 1 base_catch_weight = 0.5 catch_profile = ExtResource("2_profile") diff --git a/fish/species/goldfish_bubbleeye/fish_goldfish_bubbleeye.png b/fish/species/goldfish_bubbleeye/fish_goldfish_bubbleeye.png index b621e16..c25b2f7 100644 Binary files a/fish/species/goldfish_bubbleeye/fish_goldfish_bubbleeye.png and b/fish/species/goldfish_bubbleeye/fish_goldfish_bubbleeye.png differ diff --git a/fish/species/goldfish_bubbleeye/goldfish_bubbleeye.tres b/fish/species/goldfish_bubbleeye/goldfish_bubbleeye.tres index aa75c08..d88719c 100644 --- a/fish/species/goldfish_bubbleeye/goldfish_bubbleeye.tres +++ b/fish/species/goldfish_bubbleeye/goldfish_bubbleeye.tres @@ -3,11 +3,11 @@ [ext_resource type="Script" uid="uid://h7hg45b7wmst" path="res://fish/fish_data.gd" id="1_fish_data"] [ext_resource type="Resource" path="res://fishing/common_catch_profile.tres" id="2_profile"] [ext_resource type="Script" uid="uid://bs7cqi88csolc" path="res://fish/fish_availability.gd" id="3_availability_script"] -[ext_resource type="Texture2D" uid="uid://brjjnxr6n7olr" path="res://fish/species/goldfish_bubbleeye/fish_goldfish_bubbleeye.png" id="4_texture"] +[ext_resource type="Texture2D" path="res://art/exported/creatures/fish_placeholder.png" id="4_texture"] [sub_resource type="Resource" id="GoldfishBubbleeyeAvailability"] script = ExtResource("3_availability_script") -allowed_location_tags = Array[StringName]([&"starter_pond"]) +allowed_location_tags = Array[StringName]([&"starter_pond", &"pond"]) [resource] script = ExtResource("1_fish_data") @@ -17,6 +17,7 @@ active = true catalog_number = 3001 collection_group = &"Freshwater ornamental" logbook_fact = "bubble-eye goldfish have delicate fluid-filled sacs beneath their eyes, making careful handling especially important." +available_seasons = 15 allowed_water_types = 1 rarity = 1 base_catch_weight = 0.35 diff --git a/fish/species/gourami_giant/gourami_giant.tres b/fish/species/gourami_giant/gourami_giant.tres index b7a9095..b4f8f52 100644 --- a/fish/species/gourami_giant/gourami_giant.tres +++ b/fish/species/gourami_giant/gourami_giant.tres @@ -1,8 +1,9 @@ -[gd_resource type="Resource" script_class="FishData" load_steps=4 format=3] +[gd_resource type="Resource" script_class="FishData" load_steps=5 format=3] [ext_resource type="Script" path="res://fish/fish_data.gd" id="1_fish_data"] [ext_resource type="Resource" path="res://fishing/common_catch_profile.tres" id="2_profile"] [ext_resource type="Script" path="res://fish/fish_availability.gd" id="3_availability"] +[ext_resource type="Texture2D" path="res://art/exported/creatures/fish_placeholder.png" id="99_fish_placeholder"] [sub_resource type="Resource" id="Availability"] script = ExtResource("3_availability") @@ -12,10 +13,11 @@ allow_night = false script = ExtResource("1_fish_data") id = &"gourami_giant" display_name = "giant gourami" -active = false +active = true catalog_number = 7505 collection_group = &"Tropical freshwater fish" logbook_fact = "giant gouramis breathe surface air through a specialized labyrinth organ. adults graze plants but also investigate insects and small animals." +available_seasons = 15 allowed_water_types = 1 rarity = 2 base_catch_weight = 0.25 @@ -26,3 +28,4 @@ weight_max_lb = 20.0 sell_value_min = 13 sell_value_max = 31 sell_value_curve = 0.86 +display_texture = ExtResource("99_fish_placeholder") diff --git a/fish/species/grayling_arctic/grayling_arctic.tres b/fish/species/grayling_arctic/grayling_arctic.tres index fc1e09d..ae6321a 100644 --- a/fish/species/grayling_arctic/grayling_arctic.tres +++ b/fish/species/grayling_arctic/grayling_arctic.tres @@ -1,8 +1,9 @@ -[gd_resource type="Resource" script_class="FishData" load_steps=4 format=3] +[gd_resource type="Resource" script_class="FishData" load_steps=5 format=3] [ext_resource type="Script" path="res://fish/fish_data.gd" id="1_fish_data"] [ext_resource type="Resource" path="res://fishing/common_catch_profile.tres" id="2_profile"] [ext_resource type="Script" path="res://fish/fish_availability.gd" id="3_availability"] +[ext_resource type="Texture2D" path="res://art/exported/creatures/fish_placeholder.png" id="99_fish_placeholder"] [sub_resource type="Resource" id="Availability"] script = ExtResource("3_availability") @@ -13,10 +14,11 @@ forbid_fog = true script = ExtResource("1_fish_data") id = &"grayling_arctic" display_name = "arctic grayling" -active = false +active = true catalog_number = 1102 collection_group = &"Cold freshwater salmonids" logbook_fact = "arctic grayling carry a tall, colorful dorsal fin like a sail. they feed on drifting insects in cold, clear rivers and lakes." +available_seasons = 13 allowed_water_types = 1 rarity = 1 base_catch_weight = 0.75 @@ -27,3 +29,4 @@ weight_max_lb = 6.0 sell_value_min = 6 sell_value_max = 14 sell_value_curve = 0.9 +display_texture = ExtResource("99_fish_placeholder") diff --git a/fish/species/green_sunfish/green_sunfish.tres b/fish/species/green_sunfish/green_sunfish.tres index 92a6838..fdd1ddd 100644 --- a/fish/species/green_sunfish/green_sunfish.tres +++ b/fish/species/green_sunfish/green_sunfish.tres @@ -1,8 +1,9 @@ -[gd_resource type="Resource" script_class="FishData" load_steps=4 format=3] +[gd_resource type="Resource" script_class="FishData" load_steps=5 format=3] [ext_resource type="Script" path="res://fish/fish_data.gd" id="1_fish_data"] [ext_resource type="Resource" path="res://fishing/common_catch_profile.tres" id="2_profile"] [ext_resource type="Script" path="res://fish/fish_availability.gd" id="3_availability"] +[ext_resource type="Texture2D" path="res://art/exported/creatures/fish_placeholder.png" id="99_fish_placeholder"] [sub_resource type="Resource" id="Availability"] script = ExtResource("3_availability") @@ -12,10 +13,11 @@ allow_night = false script = ExtResource("1_fish_data") id = &"green_sunfish" display_name = "green sunfish" -active = false +active = true catalog_number = 3103 collection_group = &"Freshwater panfish" logbook_fact = "green sunfish tolerate small, warm, cloudy pools better than many relatives. a large mouth lets them tackle insects, crayfish, and fish." +available_seasons = 7 allowed_water_types = 1 rarity = 0 base_catch_weight = 3.2 @@ -26,3 +28,4 @@ weight_max_lb = 1.5 sell_value_min = 2 sell_value_max = 5 sell_value_curve = 1.0 +display_texture = ExtResource("99_fish_placeholder") diff --git a/fish/species/grouper_atlantic_goliath/grouper_atlantic_goliath.tres b/fish/species/grouper_atlantic_goliath/grouper_atlantic_goliath.tres index fae0ea5..eb2d2bf 100644 --- a/fish/species/grouper_atlantic_goliath/grouper_atlantic_goliath.tres +++ b/fish/species/grouper_atlantic_goliath/grouper_atlantic_goliath.tres @@ -1,8 +1,9 @@ -[gd_resource type="Resource" script_class="FishData" load_steps=4 format=3] +[gd_resource type="Resource" script_class="FishData" load_steps=5 format=3] [ext_resource type="Script" path="res://fish/fish_data.gd" id="1_fish_data"] [ext_resource type="Resource" path="res://fishing/common_catch_profile.tres" id="2_profile"] [ext_resource type="Script" path="res://fish/fish_availability.gd" id="3_availability"] +[ext_resource type="Texture2D" path="res://art/exported/creatures/fish_placeholder.png" id="99_fish_placeholder"] [sub_resource type="Resource" id="Availability"] script = ExtResource("3_availability") @@ -12,10 +13,11 @@ require_fog = true script = ExtResource("1_fish_data") id = &"grouper_atlantic_goliath" display_name = "Atlantic goliath grouper" -active = false +active = true catalog_number = 5801 collection_group = &"Reef predators" logbook_fact = "atlantic goliath groupers occupy reefs, wrecks, and mangrove roots. enormous mouths pull prey inward with a sudden pressure drop." +available_seasons = 15 allowed_water_types = 2 rarity = 4 base_catch_weight = 0.05 @@ -26,3 +28,4 @@ weight_max_lb = 800.0 sell_value_min = 50 sell_value_max = 125 sell_value_curve = 0.78 +display_texture = ExtResource("99_fish_placeholder") diff --git a/fish/species/grouper_giant/grouper_giant.tres b/fish/species/grouper_giant/grouper_giant.tres index bc4ecf1..9051115 100644 --- a/fish/species/grouper_giant/grouper_giant.tres +++ b/fish/species/grouper_giant/grouper_giant.tres @@ -1,8 +1,9 @@ -[gd_resource type="Resource" script_class="FishData" load_steps=4 format=3] +[gd_resource type="Resource" script_class="FishData" load_steps=5 format=3] [ext_resource type="Script" path="res://fish/fish_data.gd" id="1_fish_data"] [ext_resource type="Resource" path="res://fishing/common_catch_profile.tres" id="2_profile"] [ext_resource type="Script" path="res://fish/fish_availability.gd" id="3_availability"] +[ext_resource type="Texture2D" path="res://art/exported/creatures/fish_placeholder.png" id="99_fish_placeholder"] [sub_resource type="Resource" id="Availability"] script = ExtResource("3_availability") @@ -12,10 +13,11 @@ require_fog = true script = ExtResource("1_fish_data") id = &"grouper_giant" display_name = "giant grouper" -active = false +active = true catalog_number = 5803 collection_group = &"Reef predators" logbook_fact = "giant groupers become massive ambush predators around indo-pacific reefs. juveniles carry bold black-and-yellow markings." +available_seasons = 15 allowed_water_types = 2 rarity = 4 base_catch_weight = 0.045 @@ -26,3 +28,4 @@ weight_max_lb = 880.0 sell_value_min = 52 sell_value_max = 128 sell_value_curve = 0.78 +display_texture = ExtResource("99_fish_placeholder") diff --git a/fish/species/grouper_gulf/fish_grouper_gulf.png b/fish/species/grouper_gulf/fish_grouper_gulf.png index e74ea10..b1dd35a 100644 Binary files a/fish/species/grouper_gulf/fish_grouper_gulf.png and b/fish/species/grouper_gulf/fish_grouper_gulf.png differ diff --git a/fish/species/grouper_gulf/grouper_gulf.tres b/fish/species/grouper_gulf/grouper_gulf.tres index c3aaffa..ec4b583 100644 --- a/fish/species/grouper_gulf/grouper_gulf.tres +++ b/fish/species/grouper_gulf/grouper_gulf.tres @@ -3,7 +3,7 @@ [ext_resource type="Script" uid="uid://h7hg45b7wmst" path="res://fish/fish_data.gd" id="1_fish_data"] [ext_resource type="Resource" path="res://fishing/common_catch_profile.tres" id="2_profile"] [ext_resource type="Script" uid="uid://bs7cqi88csolc" path="res://fish/fish_availability.gd" id="3_availability_script"] -[ext_resource type="Texture2D" uid="uid://ctu8xd5or7v3h" path="res://fish/species/grouper_gulf/fish_grouper_gulf.png" id="4_texture"] +[ext_resource type="Texture2D" path="res://art/exported/creatures/fish_placeholder.png" id="4_texture"] [sub_resource type="Resource" id="GrouperGulfAvailability"] script = ExtResource("3_availability_script") @@ -17,6 +17,7 @@ active = true catalog_number = 5805 collection_group = &"Reef predators" logbook_fact = "gulf grouper are ambush predators that use a sudden gulp to pull prey into their cavernous mouths." +available_seasons = 15 allowed_water_types = 2 rarity = 1 base_catch_weight = 0.3 diff --git a/fish/species/grouper_nassau/grouper_nassau.tres b/fish/species/grouper_nassau/grouper_nassau.tres index 06bbcdf..de4b0fd 100644 --- a/fish/species/grouper_nassau/grouper_nassau.tres +++ b/fish/species/grouper_nassau/grouper_nassau.tres @@ -1,8 +1,9 @@ -[gd_resource type="Resource" script_class="FishData" load_steps=4 format=3] +[gd_resource type="Resource" script_class="FishData" load_steps=5 format=3] [ext_resource type="Script" path="res://fish/fish_data.gd" id="1_fish_data"] [ext_resource type="Resource" path="res://fishing/common_catch_profile.tres" id="2_profile"] [ext_resource type="Script" path="res://fish/fish_availability.gd" id="3_availability"] +[ext_resource type="Texture2D" path="res://art/exported/creatures/fish_placeholder.png" id="99_fish_placeholder"] [sub_resource type="Resource" id="Availability"] script = ExtResource("3_availability") @@ -12,10 +13,11 @@ forbid_fog = true script = ExtResource("1_fish_data") id = &"grouper_nassau" display_name = "Nassau grouper" -active = false +active = true catalog_number = 5806 collection_group = &"Reef predators" logbook_fact = "nassau groupers shift their bars and colors with mood and surroundings. adults gather at traditional reef sites to spawn." +available_seasons = 15 allowed_water_types = 2 rarity = 3 base_catch_weight = 0.12 @@ -26,3 +28,4 @@ weight_max_lb = 55.0 sell_value_min = 25 sell_value_max = 62 sell_value_curve = 0.82 +display_texture = ExtResource("99_fish_placeholder") diff --git a/fish/species/grouper_red/fish_grouper_red.png b/fish/species/grouper_red/fish_grouper_red.png index 33b5481..f0564b7 100644 Binary files a/fish/species/grouper_red/fish_grouper_red.png and b/fish/species/grouper_red/fish_grouper_red.png differ diff --git a/fish/species/grouper_red/grouper_red.tres b/fish/species/grouper_red/grouper_red.tres index b83fecb..d746cc2 100644 --- a/fish/species/grouper_red/grouper_red.tres +++ b/fish/species/grouper_red/grouper_red.tres @@ -3,7 +3,7 @@ [ext_resource type="Script" uid="uid://h7hg45b7wmst" path="res://fish/fish_data.gd" id="1_fish_data"] [ext_resource type="Resource" path="res://fishing/common_catch_profile.tres" id="2_profile"] [ext_resource type="Script" uid="uid://bs7cqi88csolc" path="res://fish/fish_availability.gd" id="3_availability_script"] -[ext_resource type="Texture2D" uid="uid://jjcc78tffxhb" path="res://fish/species/grouper_red/fish_grouper_red.png" id="4_texture"] +[ext_resource type="Texture2D" path="res://art/exported/creatures/fish_placeholder.png" id="4_texture"] [sub_resource type="Resource" id="GrouperRedAvailability"] script = ExtResource("3_availability_script") @@ -17,6 +17,7 @@ active = true catalog_number = 5807 collection_group = &"Reef predators" logbook_fact = "red grouper excavate shelters in reef rubble. the hollows they make can become hiding places for many smaller animals." +available_seasons = 15 allowed_water_types = 2 rarity = 2 base_catch_weight = 0.2 diff --git a/fish/species/grunt_bluestriped/grunt_bluestriped.tres b/fish/species/grunt_bluestriped/grunt_bluestriped.tres index ef78e38..87e9215 100644 --- a/fish/species/grunt_bluestriped/grunt_bluestriped.tres +++ b/fish/species/grunt_bluestriped/grunt_bluestriped.tres @@ -1,8 +1,9 @@ -[gd_resource type="Resource" script_class="FishData" load_steps=4 format=3] +[gd_resource type="Resource" script_class="FishData" load_steps=5 format=3] [ext_resource type="Script" path="res://fish/fish_data.gd" id="1_fish_data"] [ext_resource type="Resource" path="res://fishing/common_catch_profile.tres" id="2_profile"] [ext_resource type="Script" path="res://fish/fish_availability.gd" id="3_availability"] +[ext_resource type="Texture2D" path="res://art/exported/creatures/fish_placeholder.png" id="99_fish_placeholder"] [sub_resource type="Resource" id="Availability"] script = ExtResource("3_availability") @@ -12,10 +13,11 @@ allow_night = false script = ExtResource("1_fish_data") id = &"grunt_bluestriped" display_name = "bluestriped grunt" -active = false +active = true catalog_number = 5902 collection_group = &"Reef schooling fish" logbook_fact = "bluestriped grunts shelter on reefs by day and spread over seagrass to feed at night. grinding throat teeth produce audible grunts." +available_seasons = 15 allowed_water_types = 2 rarity = 0 base_catch_weight = 2.0 @@ -26,3 +28,4 @@ weight_max_lb = 3.0 sell_value_min = 3 sell_value_max = 7 sell_value_curve = 0.94 +display_texture = ExtResource("99_fish_placeholder") diff --git a/fish/species/grunt_french/grunt_french.tres b/fish/species/grunt_french/grunt_french.tres index d695ecd..da0bd90 100644 --- a/fish/species/grunt_french/grunt_french.tres +++ b/fish/species/grunt_french/grunt_french.tres @@ -1,8 +1,9 @@ -[gd_resource type="Resource" script_class="FishData" load_steps=4 format=3] +[gd_resource type="Resource" script_class="FishData" load_steps=5 format=3] [ext_resource type="Script" path="res://fish/fish_data.gd" id="1_fish_data"] [ext_resource type="Resource" path="res://fishing/common_catch_profile.tres" id="2_profile"] [ext_resource type="Script" path="res://fish/fish_availability.gd" id="3_availability"] +[ext_resource type="Texture2D" path="res://art/exported/creatures/fish_placeholder.png" id="99_fish_placeholder"] [sub_resource type="Resource" id="Availability"] script = ExtResource("3_availability") @@ -12,10 +13,11 @@ allow_night = false script = ExtResource("1_fish_data") id = &"grunt_french" display_name = "French grunt" -active = false +active = true catalog_number = 5903 collection_group = &"Reef schooling fish" logbook_fact = "french grunts gather in yellow-striped schools around reefs and wrecks. they travel into nearby sand and grass beds after dark." +available_seasons = 15 allowed_water_types = 2 rarity = 0 base_catch_weight = 2.0 @@ -26,3 +28,4 @@ weight_max_lb = 3.5 sell_value_min = 3 sell_value_max = 7 sell_value_curve = 0.94 +display_texture = ExtResource("99_fish_placeholder") diff --git a/fish/species/gulper_eel/gulper_eel.tres b/fish/species/gulper_eel/gulper_eel.tres index 328a595..11245c9 100644 --- a/fish/species/gulper_eel/gulper_eel.tres +++ b/fish/species/gulper_eel/gulper_eel.tres @@ -1,8 +1,9 @@ -[gd_resource type="Resource" script_class="FishData" load_steps=4 format=3] +[gd_resource type="Resource" script_class="FishData" load_steps=5 format=3] [ext_resource type="Script" path="res://fish/fish_data.gd" id="1_fish_data"] [ext_resource type="Resource" path="res://fishing/common_catch_profile.tres" id="2_profile"] [ext_resource type="Script" path="res://fish/fish_availability.gd" id="3_availability"] +[ext_resource type="Texture2D" path="res://art/exported/creatures/fish_placeholder.png" id="99_fish_placeholder"] [sub_resource type="Resource" id="Availability"] script = ExtResource("3_availability") @@ -13,10 +14,11 @@ require_fog = true script = ExtResource("1_fish_data") id = &"gulper_eel" display_name = "gulper eel" -active = false +active = true catalog_number = 1803 collection_group = &"Deep-sea oddities" logbook_fact = "gulper eels unfold enormous mouths to engulf prey in the deep sea. a whip-like tail ends in a small light-producing organ." +available_seasons = 15 allowed_water_types = 2 rarity = 4 base_catch_weight = 0.04 @@ -27,3 +29,4 @@ weight_max_lb = 18.0 sell_value_min = 44 sell_value_max = 92 sell_value_curve = 0.86 +display_texture = ExtResource("99_fish_placeholder") diff --git a/fish/species/guppy/guppy.tres b/fish/species/guppy/guppy.tres index 911447f..9771dfb 100644 --- a/fish/species/guppy/guppy.tres +++ b/fish/species/guppy/guppy.tres @@ -1,8 +1,9 @@ -[gd_resource type="Resource" script_class="FishData" load_steps=4 format=3] +[gd_resource type="Resource" script_class="FishData" load_steps=5 format=3] [ext_resource type="Script" path="res://fish/fish_data.gd" id="1_fish_data"] [ext_resource type="Resource" path="res://fishing/common_catch_profile.tres" id="2_profile"] [ext_resource type="Script" path="res://fish/fish_availability.gd" id="3_availability"] +[ext_resource type="Texture2D" path="res://art/exported/creatures/fish_placeholder.png" id="99_fish_placeholder"] [sub_resource type="Resource" id="Availability"] script = ExtResource("3_availability") @@ -12,10 +13,11 @@ allow_night = false script = ExtResource("1_fish_data") id = &"guppy" display_name = "guppy" -active = false +active = true catalog_number = 2101 collection_group = &"Freshwater aquarium fish" logbook_fact = "guppies are livebearers whose young arrive ready to swim. males display bright colors while females often favor larger, less flashy bodies." +available_seasons = 15 allowed_water_types = 1 rarity = 0 base_catch_weight = 1.5 @@ -26,3 +28,4 @@ weight_max_lb = 0.15 sell_value_min = 2 sell_value_max = 5 sell_value_curve = 0.98 +display_texture = ExtResource("99_fish_placeholder") diff --git a/fish/species/haddock/haddock.tres b/fish/species/haddock/haddock.tres index 0f73e63..ec5db7d 100644 --- a/fish/species/haddock/haddock.tres +++ b/fish/species/haddock/haddock.tres @@ -1,8 +1,9 @@ -[gd_resource type="Resource" script_class="FishData" load_steps=4 format=3] +[gd_resource type="Resource" script_class="FishData" load_steps=5 format=3] [ext_resource type="Script" path="res://fish/fish_data.gd" id="1_fish_data"] [ext_resource type="Resource" path="res://fishing/common_catch_profile.tres" id="2_profile"] [ext_resource type="Script" path="res://fish/fish_availability.gd" id="3_availability"] +[ext_resource type="Texture2D" path="res://art/exported/creatures/fish_placeholder.png" id="99_fish_placeholder"] [sub_resource type="Resource" id="Availability"] script = ExtResource("3_availability") @@ -12,10 +13,11 @@ allow_night = false script = ExtResource("1_fish_data") id = &"haddock" display_name = "haddock" -active = false +active = true catalog_number = 1405 collection_group = &"Cold shelf fish" logbook_fact = "haddock are recognized by a dark shoulder mark and black lateral line. schools forage over cold seafloors for small bottom animals." +available_seasons = 13 allowed_water_types = 2 rarity = 0 base_catch_weight = 2.0 @@ -26,3 +28,4 @@ weight_max_lb = 20.0 sell_value_min = 4 sell_value_max = 11 sell_value_curve = 0.9 +display_texture = ExtResource("99_fish_placeholder") diff --git a/fish/species/hake_pacific/hake_pacific.tres b/fish/species/hake_pacific/hake_pacific.tres index 85b521b..2a7293b 100644 --- a/fish/species/hake_pacific/hake_pacific.tres +++ b/fish/species/hake_pacific/hake_pacific.tres @@ -1,8 +1,9 @@ -[gd_resource type="Resource" script_class="FishData" load_steps=4 format=3] +[gd_resource type="Resource" script_class="FishData" load_steps=5 format=3] [ext_resource type="Script" path="res://fish/fish_data.gd" id="1_fish_data"] [ext_resource type="Resource" path="res://fishing/common_catch_profile.tres" id="2_profile"] [ext_resource type="Script" path="res://fish/fish_availability.gd" id="3_availability"] +[ext_resource type="Texture2D" path="res://art/exported/creatures/fish_placeholder.png" id="99_fish_placeholder"] [sub_resource type="Resource" id="Availability"] script = ExtResource("3_availability") @@ -12,10 +13,11 @@ allow_day = false script = ExtResource("1_fish_data") id = &"hake_pacific" display_name = "pacific hake" -active = false +active = true catalog_number = 1407 collection_group = &"Cold shelf fish" logbook_fact = "pacific hake rise from deep water at night to feed on krill and fish. large schools migrate along the west coast with changing seasons." +available_seasons = 13 allowed_water_types = 2 rarity = 0 base_catch_weight = 1.7 @@ -26,3 +28,4 @@ weight_max_lb = 8.0 sell_value_min = 3 sell_value_max = 9 sell_value_curve = 0.92 +display_texture = ExtResource("99_fish_placeholder") diff --git a/fish/species/hake_silver/hake_silver.tres b/fish/species/hake_silver/hake_silver.tres index 79d7ea0..ffb42ff 100644 --- a/fish/species/hake_silver/hake_silver.tres +++ b/fish/species/hake_silver/hake_silver.tres @@ -1,8 +1,9 @@ -[gd_resource type="Resource" script_class="FishData" load_steps=4 format=3] +[gd_resource type="Resource" script_class="FishData" load_steps=5 format=3] [ext_resource type="Script" path="res://fish/fish_data.gd" id="1_fish_data"] [ext_resource type="Resource" path="res://fishing/common_catch_profile.tres" id="2_profile"] [ext_resource type="Script" path="res://fish/fish_availability.gd" id="3_availability"] +[ext_resource type="Texture2D" path="res://art/exported/creatures/fish_placeholder.png" id="99_fish_placeholder"] [sub_resource type="Resource" id="Availability"] script = ExtResource("3_availability") @@ -12,10 +13,11 @@ allow_day = false script = ExtResource("1_fish_data") id = &"hake_silver" display_name = "silver hake" -active = false +active = true catalog_number = 1408 collection_group = &"Cold shelf fish" logbook_fact = "silver hake hunt fish and crustaceans over sandy atlantic shelves. they move upward after dark and return toward the bottom by day." +available_seasons = 13 allowed_water_types = 2 rarity = 0 base_catch_weight = 1.7 @@ -26,3 +28,4 @@ weight_max_lb = 5.0 sell_value_min = 3 sell_value_max = 8 sell_value_curve = 0.92 +display_texture = ExtResource("99_fish_placeholder") diff --git a/fish/species/halfbeak_ballyhoo/halfbeak_ballyhoo.tres b/fish/species/halfbeak_ballyhoo/halfbeak_ballyhoo.tres index 7362805..9512381 100644 --- a/fish/species/halfbeak_ballyhoo/halfbeak_ballyhoo.tres +++ b/fish/species/halfbeak_ballyhoo/halfbeak_ballyhoo.tres @@ -1,8 +1,9 @@ -[gd_resource type="Resource" script_class="FishData" load_steps=4 format=3] +[gd_resource type="Resource" script_class="FishData" load_steps=5 format=3] [ext_resource type="Script" path="res://fish/fish_data.gd" id="1_fish_data"] [ext_resource type="Resource" path="res://fishing/common_catch_profile.tres" id="2_profile"] [ext_resource type="Script" path="res://fish/fish_availability.gd" id="3_availability"] +[ext_resource type="Texture2D" path="res://art/exported/creatures/fish_placeholder.png" id="99_fish_placeholder"] [sub_resource type="Resource" id="Availability"] script = ExtResource("3_availability") @@ -12,10 +13,11 @@ allow_night = false script = ExtResource("1_fish_data") id = &"halfbeak_ballyhoo" display_name = "ballyhoo" -active = false +active = true catalog_number = 6601 collection_group = &"Surface ocean fish" logbook_fact = "ballyhoo skim warm ocean surfaces with an extended lower jaw. tight schools scatter into quick leaps when predators strike." +available_seasons = 15 allowed_water_types = 2 rarity = 0 base_catch_weight = 2.5 @@ -26,3 +28,4 @@ weight_max_lb = 1.0 sell_value_min = 2 sell_value_max = 5 sell_value_curve = 0.98 +display_texture = ExtResource("99_fish_placeholder") diff --git a/fish/species/halibut_atlantic/halibut_atlantic.tres b/fish/species/halibut_atlantic/halibut_atlantic.tres index c8bf167..ead724a 100644 --- a/fish/species/halibut_atlantic/halibut_atlantic.tres +++ b/fish/species/halibut_atlantic/halibut_atlantic.tres @@ -1,8 +1,9 @@ -[gd_resource type="Resource" script_class="FishData" load_steps=4 format=3] +[gd_resource type="Resource" script_class="FishData" load_steps=5 format=3] [ext_resource type="Script" path="res://fish/fish_data.gd" id="1_fish_data"] [ext_resource type="Resource" path="res://fishing/common_catch_profile.tres" id="2_profile"] [ext_resource type="Script" path="res://fish/fish_availability.gd" id="3_availability"] +[ext_resource type="Texture2D" path="res://art/exported/creatures/fish_placeholder.png" id="99_fish_placeholder"] [sub_resource type="Resource" id="Availability"] script = ExtResource("3_availability") @@ -11,10 +12,11 @@ script = ExtResource("3_availability") script = ExtResource("1_fish_data") id = &"halibut_atlantic" display_name = "atlantic halibut" -active = false +active = true catalog_number = 3701 collection_group = &"Large flatfish" logbook_fact = "atlantic halibut are immense right-eyed flatfish of cold northern seas. adults ambush fish and squid from deep rocky or sandy bottoms." +available_seasons = 13 allowed_water_types = 2 rarity = 3 base_catch_weight = 0.1 @@ -25,3 +27,4 @@ weight_max_lb = 300.0 sell_value_min = 32 sell_value_max = 82 sell_value_curve = 0.8 +display_texture = ExtResource("99_fish_placeholder") diff --git a/fish/species/halibut_pacific/halibut_pacific.tres b/fish/species/halibut_pacific/halibut_pacific.tres index 9980aef..3856b5a 100644 --- a/fish/species/halibut_pacific/halibut_pacific.tres +++ b/fish/species/halibut_pacific/halibut_pacific.tres @@ -1,8 +1,9 @@ -[gd_resource type="Resource" script_class="FishData" load_steps=4 format=3] +[gd_resource type="Resource" script_class="FishData" load_steps=5 format=3] [ext_resource type="Script" path="res://fish/fish_data.gd" id="1_fish_data"] [ext_resource type="Resource" path="res://fishing/common_catch_profile.tres" id="2_profile"] [ext_resource type="Script" path="res://fish/fish_availability.gd" id="3_availability"] +[ext_resource type="Texture2D" path="res://art/exported/creatures/fish_placeholder.png" id="99_fish_placeholder"] [sub_resource type="Resource" id="Availability"] script = ExtResource("3_availability") @@ -11,10 +12,11 @@ script = ExtResource("3_availability") script = ExtResource("1_fish_data") id = &"halibut_pacific" display_name = "pacific halibut" -active = false +active = true catalog_number = 3702 collection_group = &"Large flatfish" logbook_fact = "pacific halibut lie camouflaged on cold continental shelves. powerful flat bodies can travel long distances between feeding and spawning grounds." +available_seasons = 13 allowed_water_types = 2 rarity = 3 base_catch_weight = 0.1 @@ -25,3 +27,4 @@ weight_max_lb = 350.0 sell_value_min = 34 sell_value_max = 86 sell_value_curve = 0.8 +display_texture = ExtResource("99_fish_placeholder") diff --git a/fish/species/hellbender/hellbender.tres b/fish/species/hellbender/hellbender.tres index 8a9d228..2c55863 100644 --- a/fish/species/hellbender/hellbender.tres +++ b/fish/species/hellbender/hellbender.tres @@ -1,8 +1,9 @@ -[gd_resource type="Resource" script_class="FishData" load_steps=4 format=3] +[gd_resource type="Resource" script_class="FishData" load_steps=5 format=3] [ext_resource type="Script" path="res://fish/fish_data.gd" id="1_fish_data"] [ext_resource type="Resource" path="res://fishing/common_catch_profile.tres" id="2_profile"] [ext_resource type="Script" path="res://fish/fish_availability.gd" id="3_availability"] +[ext_resource type="Texture2D" path="res://art/exported/creatures/fish_placeholder.png" id="99_fish_placeholder"] [sub_resource type="Resource" id="Availability"] script = ExtResource("3_availability") @@ -13,10 +14,11 @@ require_rain = true script = ExtResource("1_fish_data") id = &"hellbender" display_name = "hellbender" -active = false +active = true catalog_number = 2002 collection_group = &"Freshwater amphibians" logbook_fact = "hellbenders hide beneath large rocks in cool, clean rivers. folds of loose skin absorb oxygen while the flattened body grips the current." +available_seasons = 7 allowed_water_types = 1 rarity = 3 base_catch_weight = 0.1 @@ -27,3 +29,4 @@ weight_max_lb = 5.5 sell_value_min = 24 sell_value_max = 54 sell_value_curve = 0.91 +display_texture = ExtResource("99_fish_placeholder") diff --git a/fish/species/herring_atlantic/herring_atlantic.tres b/fish/species/herring_atlantic/herring_atlantic.tres index 00f1e36..e193dcc 100644 --- a/fish/species/herring_atlantic/herring_atlantic.tres +++ b/fish/species/herring_atlantic/herring_atlantic.tres @@ -1,8 +1,9 @@ -[gd_resource type="Resource" script_class="FishData" load_steps=4 format=3] +[gd_resource type="Resource" script_class="FishData" load_steps=5 format=3] [ext_resource type="Script" path="res://fish/fish_data.gd" id="1_fish_data"] [ext_resource type="Resource" path="res://fishing/common_catch_profile.tres" id="2_profile"] [ext_resource type="Script" path="res://fish/fish_availability.gd" id="3_availability"] +[ext_resource type="Texture2D" path="res://art/exported/creatures/fish_placeholder.png" id="99_fish_placeholder"] [sub_resource type="Resource" id="Availability"] script = ExtResource("3_availability") @@ -11,10 +12,11 @@ script = ExtResource("3_availability") script = ExtResource("1_fish_data") id = &"herring_atlantic" display_name = "atlantic herring" -active = false +active = true catalog_number = 1301 collection_group = &"Cold schooling fish" logbook_fact = "atlantic herring gather in immense schools that move between feeding and spawning grounds. they filter plankton with fine gill rakers." +available_seasons = 13 allowed_water_types = 2 rarity = 0 base_catch_weight = 3.0 @@ -25,3 +27,4 @@ weight_max_lb = 1.5 sell_value_min = 2 sell_value_max = 5 sell_value_curve = 0.98 +display_texture = ExtResource("99_fish_placeholder") diff --git a/fish/species/herring_pacific/herring_pacific.tres b/fish/species/herring_pacific/herring_pacific.tres index 27dcff7..7d8e754 100644 --- a/fish/species/herring_pacific/herring_pacific.tres +++ b/fish/species/herring_pacific/herring_pacific.tres @@ -1,8 +1,9 @@ -[gd_resource type="Resource" script_class="FishData" load_steps=4 format=3] +[gd_resource type="Resource" script_class="FishData" load_steps=5 format=3] [ext_resource type="Script" path="res://fish/fish_data.gd" id="1_fish_data"] [ext_resource type="Resource" path="res://fishing/common_catch_profile.tres" id="2_profile"] [ext_resource type="Script" path="res://fish/fish_availability.gd" id="3_availability"] +[ext_resource type="Texture2D" path="res://art/exported/creatures/fish_placeholder.png" id="99_fish_placeholder"] [sub_resource type="Resource" id="Availability"] script = ExtResource("3_availability") @@ -12,10 +13,11 @@ require_rain = true script = ExtResource("1_fish_data") id = &"herring_pacific" display_name = "pacific herring" -active = false +active = true catalog_number = 1304 collection_group = &"Cold schooling fish" logbook_fact = "pacific herring return to coastal shallows to coat plants and rocks with eggs. their oily schools support entire marine food webs." +available_seasons = 13 allowed_water_types = 2 rarity = 0 base_catch_weight = 2.8 @@ -26,3 +28,4 @@ weight_max_lb = 1.5 sell_value_min = 2 sell_value_max = 5 sell_value_curve = 0.98 +display_texture = ExtResource("99_fish_placeholder") diff --git a/fish/species/hogfish/hogfish.tres b/fish/species/hogfish/hogfish.tres index 8d7dd29..0e94a20 100644 --- a/fish/species/hogfish/hogfish.tres +++ b/fish/species/hogfish/hogfish.tres @@ -1,8 +1,9 @@ -[gd_resource type="Resource" script_class="FishData" load_steps=4 format=3] +[gd_resource type="Resource" script_class="FishData" load_steps=5 format=3] [ext_resource type="Script" path="res://fish/fish_data.gd" id="1_fish_data"] [ext_resource type="Resource" path="res://fishing/common_catch_profile.tres" id="2_profile"] [ext_resource type="Script" path="res://fish/fish_availability.gd" id="3_availability"] +[ext_resource type="Texture2D" path="res://art/exported/creatures/6103.png" id="99_fish_placeholder"] [sub_resource type="Resource" id="Availability"] script = ExtResource("3_availability") @@ -12,10 +13,11 @@ allow_night = false script = ExtResource("1_fish_data") id = &"hogfish" display_name = "hogfish" -active = false +active = true catalog_number = 6103 collection_group = &"Reef wrasses" logbook_fact = "hogfish root through sand with long pig-like snouts in search of shellfish. adults can change from female to male as social groups shift." +available_seasons = 15 allowed_water_types = 2 rarity = 2 base_catch_weight = 0.3 @@ -26,3 +28,4 @@ weight_max_lb = 20.0 sell_value_min = 12 sell_value_max = 30 sell_value_curve = 0.86 +display_texture = ExtResource("99_fish_placeholder") diff --git a/fish/species/ide/ide.tres b/fish/species/ide/ide.tres index dcc9980..aea8907 100644 --- a/fish/species/ide/ide.tres +++ b/fish/species/ide/ide.tres @@ -1,8 +1,9 @@ -[gd_resource type="Resource" script_class="FishData" load_steps=4 format=3] +[gd_resource type="Resource" script_class="FishData" load_steps=5 format=3] [ext_resource type="Script" path="res://fish/fish_data.gd" id="1_fish_data"] [ext_resource type="Resource" path="res://fishing/common_catch_profile.tres" id="2_profile"] [ext_resource type="Script" path="res://fish/fish_availability.gd" id="3_availability"] +[ext_resource type="Texture2D" path="res://art/exported/creatures/fish_placeholder.png" id="99_fish_placeholder"] [sub_resource type="Resource" id="Availability"] script = ExtResource("3_availability") @@ -12,10 +13,11 @@ allow_night = false script = ExtResource("1_fish_data") id = &"ide" display_name = "ide" -active = false +active = true catalog_number = 2507 collection_group = &"Freshwater coarse fish" logbook_fact = "ide move between rivers, lakes, and brackish coastal water in loose schools. adults eat insects, crustaceans, plants, and small fish." +available_seasons = 7 allowed_water_types = 1 rarity = 1 base_catch_weight = 0.8 @@ -26,3 +28,4 @@ weight_max_lb = 9.0 sell_value_min = 6 sell_value_max = 14 sell_value_curve = 0.9 +display_texture = ExtResource("99_fish_placeholder") diff --git a/fish/species/jack_crevalle/jack_crevalle.tres b/fish/species/jack_crevalle/jack_crevalle.tres index e20485e..4110dcc 100644 --- a/fish/species/jack_crevalle/jack_crevalle.tres +++ b/fish/species/jack_crevalle/jack_crevalle.tres @@ -1,8 +1,9 @@ -[gd_resource type="Resource" script_class="FishData" load_steps=4 format=3] +[gd_resource type="Resource" script_class="FishData" load_steps=5 format=3] [ext_resource type="Script" path="res://fish/fish_data.gd" id="1_fish_data"] [ext_resource type="Resource" path="res://fishing/common_catch_profile.tres" id="2_profile"] [ext_resource type="Script" path="res://fish/fish_availability.gd" id="3_availability"] +[ext_resource type="Texture2D" path="res://art/exported/creatures/fish_placeholder.png" id="99_fish_placeholder"] [sub_resource type="Resource" id="Availability"] script = ExtResource("3_availability") @@ -13,10 +14,11 @@ require_rain = true script = ExtResource("1_fish_data") id = &"jack_crevalle" display_name = "crevalle jack" -active = false +active = true catalog_number = 705 collection_group = &"Coastal pelagic fish" logbook_fact = "crevalle jacks patrol warm coasts in fast-moving schools. their deep bodies and forked tails deliver long, powerful runs." +available_seasons = 6 allowed_water_types = 2 rarity = 1 base_catch_weight = 0.8 @@ -27,3 +29,4 @@ weight_max_lb = 35.0 sell_value_min = 7 sell_value_max = 20 sell_value_curve = 0.84 +display_texture = ExtResource("99_fish_placeholder") diff --git a/fish/species/jelly_crystal/jelly_crystal.tres b/fish/species/jelly_crystal/jelly_crystal.tres index fe2f34e..f8746fa 100644 --- a/fish/species/jelly_crystal/jelly_crystal.tres +++ b/fish/species/jelly_crystal/jelly_crystal.tres @@ -1,8 +1,9 @@ -[gd_resource type="Resource" script_class="FishData" load_steps=4 format=3] +[gd_resource type="Resource" script_class="FishData" load_steps=5 format=3] [ext_resource type="Script" path="res://fish/fish_data.gd" id="1_fish_data"] [ext_resource type="Resource" path="res://fishing/common_catch_profile.tres" id="2_profile"] [ext_resource type="Script" path="res://fish/fish_availability.gd" id="3_availability"] +[ext_resource type="Texture2D" path="res://art/exported/creatures/fish_placeholder.png" id="99_fish_placeholder"] [sub_resource type="Resource" id="Availability"] script = ExtResource("3_availability") @@ -13,10 +14,11 @@ forbid_fog = true script = ExtResource("1_fish_data") id = &"jelly_crystal" display_name = "crystal jelly" -active = false +active = true catalog_number = 3501 collection_group = &"Jellies" logbook_fact = "crystal jellies are nearly transparent except for glowing points around the bell. their green fluorescent protein transformed biological research." +available_seasons = 9 allowed_water_types = 2 rarity = 2 base_catch_weight = 0.24 @@ -27,3 +29,4 @@ weight_max_lb = 4.0 sell_value_min = 15 sell_value_max = 34 sell_value_curve = 0.93 +display_texture = ExtResource("99_fish_placeholder") diff --git a/fish/species/jelly_lions_mane/jelly_lions_mane.tres b/fish/species/jelly_lions_mane/jelly_lions_mane.tres index cedb3c8..c7c6fbb 100644 --- a/fish/species/jelly_lions_mane/jelly_lions_mane.tres +++ b/fish/species/jelly_lions_mane/jelly_lions_mane.tres @@ -1,8 +1,9 @@ -[gd_resource type="Resource" script_class="FishData" load_steps=4 format=3] +[gd_resource type="Resource" script_class="FishData" load_steps=5 format=3] [ext_resource type="Script" path="res://fish/fish_data.gd" id="1_fish_data"] [ext_resource type="Resource" path="res://fishing/common_catch_profile.tres" id="2_profile"] [ext_resource type="Script" path="res://fish/fish_availability.gd" id="3_availability"] +[ext_resource type="Texture2D" path="res://art/exported/creatures/fish_placeholder.png" id="99_fish_placeholder"] [sub_resource type="Resource" id="Availability"] script = ExtResource("3_availability") @@ -13,10 +14,11 @@ require_fog = true script = ExtResource("1_fish_data") id = &"jelly_lions_mane" display_name = "lion's mane jelly" -active = false +active = true catalog_number = 3502 collection_group = &"Jellies" logbook_fact = "lion's mane jellies trail dense curtains of tentacles through cold seas. the bell darkens from yellow to deep red as the animal grows." +available_seasons = 13 allowed_water_types = 2 rarity = 3 base_catch_weight = 0.11 @@ -27,3 +29,4 @@ weight_max_lb = 200.0 sell_value_min = 24 sell_value_max = 58 sell_value_curve = 0.82 +display_texture = ExtResource("99_fish_placeholder") diff --git a/fish/species/jelly_moon/jelly_moon.tres b/fish/species/jelly_moon/jelly_moon.tres index ef7cbe1..378c11d 100644 --- a/fish/species/jelly_moon/jelly_moon.tres +++ b/fish/species/jelly_moon/jelly_moon.tres @@ -1,8 +1,9 @@ -[gd_resource type="Resource" script_class="FishData" load_steps=4 format=3] +[gd_resource type="Resource" script_class="FishData" load_steps=5 format=3] [ext_resource type="Script" path="res://fish/fish_data.gd" id="1_fish_data"] [ext_resource type="Resource" path="res://fishing/common_catch_profile.tres" id="2_profile"] [ext_resource type="Script" path="res://fish/fish_availability.gd" id="3_availability"] +[ext_resource type="Texture2D" path="res://art/exported/creatures/fish_placeholder.png" id="99_fish_placeholder"] [sub_resource type="Resource" id="Availability"] script = ExtResource("3_availability") @@ -12,10 +13,11 @@ allow_day = false script = ExtResource("1_fish_data") id = &"jelly_moon" display_name = "moon jelly" -active = false +active = true catalog_number = 3503 collection_group = &"Jellies" logbook_fact = "moon jellies pulse gently with four horseshoe-shaped organs visible through the bell. short tentacles sweep plankton toward the mouth." +available_seasons = 15 allowed_water_types = 2 rarity = 1 base_catch_weight = 0.7 @@ -26,3 +28,4 @@ weight_max_lb = 5.0 sell_value_min = 6 sell_value_max = 14 sell_value_curve = 0.94 +display_texture = ExtResource("99_fish_placeholder") diff --git a/fish/species/jelly_pacific_sea_nettle/jelly_pacific_sea_nettle.tres b/fish/species/jelly_pacific_sea_nettle/jelly_pacific_sea_nettle.tres index e3697b3..b31f4b3 100644 --- a/fish/species/jelly_pacific_sea_nettle/jelly_pacific_sea_nettle.tres +++ b/fish/species/jelly_pacific_sea_nettle/jelly_pacific_sea_nettle.tres @@ -1,8 +1,9 @@ -[gd_resource type="Resource" script_class="FishData" load_steps=4 format=3] +[gd_resource type="Resource" script_class="FishData" load_steps=5 format=3] [ext_resource type="Script" path="res://fish/fish_data.gd" id="1_fish_data"] [ext_resource type="Resource" path="res://fishing/common_catch_profile.tres" id="2_profile"] [ext_resource type="Script" path="res://fish/fish_availability.gd" id="3_availability"] +[ext_resource type="Texture2D" path="res://art/exported/creatures/fish_placeholder.png" id="99_fish_placeholder"] [sub_resource type="Resource" id="Availability"] script = ExtResource("3_availability") @@ -13,10 +14,11 @@ forbid_fog = true script = ExtResource("1_fish_data") id = &"jelly_pacific_sea_nettle" display_name = "Pacific sea nettle" -active = false +active = true catalog_number = 3504 collection_group = &"Jellies" logbook_fact = "pacific sea nettles carry rust-colored stripes across pale bells. long tentacles and frilled mouth arms capture plankton and small fish." +available_seasons = 6 allowed_water_types = 2 rarity = 2 base_catch_weight = 0.28 @@ -27,3 +29,4 @@ weight_max_lb = 12.0 sell_value_min = 14 sell_value_max = 32 sell_value_curve = 0.9 +display_texture = ExtResource("99_fish_placeholder") diff --git a/fish/species/jelly_sea_wasp/jelly_sea_wasp.tres b/fish/species/jelly_sea_wasp/jelly_sea_wasp.tres index 64c2288..29bed0a 100644 --- a/fish/species/jelly_sea_wasp/jelly_sea_wasp.tres +++ b/fish/species/jelly_sea_wasp/jelly_sea_wasp.tres @@ -1,8 +1,9 @@ -[gd_resource type="Resource" script_class="FishData" load_steps=4 format=3] +[gd_resource type="Resource" script_class="FishData" load_steps=5 format=3] [ext_resource type="Script" path="res://fish/fish_data.gd" id="1_fish_data"] [ext_resource type="Resource" path="res://fishing/common_catch_profile.tres" id="2_profile"] [ext_resource type="Script" path="res://fish/fish_availability.gd" id="3_availability"] +[ext_resource type="Texture2D" path="res://art/exported/creatures/fish_placeholder.png" id="99_fish_placeholder"] [sub_resource type="Resource" id="Availability"] script = ExtResource("3_availability") @@ -13,10 +14,11 @@ require_rain = true script = ExtResource("1_fish_data") id = &"jelly_sea_wasp" display_name = "sea wasp" -active = false +active = true catalog_number = 3505 collection_group = &"Jellies" logbook_fact = "sea wasps have box-shaped bells and clusters of eyes along the lower edge. their long tentacles deliver exceptionally potent venom." +available_seasons = 15 allowed_water_types = 2 rarity = 4 base_catch_weight = 0.035 @@ -27,3 +29,4 @@ weight_max_lb = 6.0 sell_value_min = 42 sell_value_max = 90 sell_value_curve = 0.9 +display_texture = ExtResource("99_fish_placeholder") diff --git a/fish/species/knifefish_clown/knifefish_clown.tres b/fish/species/knifefish_clown/knifefish_clown.tres index 23781ad..c83b877 100644 --- a/fish/species/knifefish_clown/knifefish_clown.tres +++ b/fish/species/knifefish_clown/knifefish_clown.tres @@ -1,8 +1,9 @@ -[gd_resource type="Resource" script_class="FishData" load_steps=4 format=3] +[gd_resource type="Resource" script_class="FishData" load_steps=5 format=3] [ext_resource type="Script" path="res://fish/fish_data.gd" id="1_fish_data"] [ext_resource type="Resource" path="res://fishing/common_catch_profile.tres" id="2_profile"] [ext_resource type="Script" path="res://fish/fish_availability.gd" id="3_availability"] +[ext_resource type="Texture2D" path="res://art/exported/creatures/fish_placeholder.png" id="99_fish_placeholder"] [sub_resource type="Resource" id="Availability"] script = ExtResource("3_availability") @@ -13,10 +14,11 @@ require_fog = true script = ExtResource("1_fish_data") id = &"knifefish_clown" display_name = "clown knifefish" -active = false +active = true catalog_number = 7501 collection_group = &"Tropical freshwater fish" logbook_fact = "clown knifefish undulate one long belly fin to glide forward or backward. dark eye-like spots line their silver nocturnal bodies." +available_seasons = 15 allowed_water_types = 1 rarity = 2 base_catch_weight = 0.25 @@ -27,3 +29,4 @@ weight_max_lb = 25.0 sell_value_min = 16 sell_value_max = 38 sell_value_curve = 0.86 +display_texture = ExtResource("99_fish_placeholder") diff --git a/fish/species/koi/koi.tres b/fish/species/koi/koi.tres index 7c110cc..58c7c29 100644 --- a/fish/species/koi/koi.tres +++ b/fish/species/koi/koi.tres @@ -1,8 +1,9 @@ -[gd_resource type="Resource" script_class="FishData" load_steps=4 format=3] +[gd_resource type="Resource" script_class="FishData" load_steps=5 format=3] [ext_resource type="Script" path="res://fish/fish_data.gd" id="1_fish_data"] [ext_resource type="Resource" path="res://fishing/common_catch_profile.tres" id="2_profile"] [ext_resource type="Script" path="res://fish/fish_availability.gd" id="3_availability"] +[ext_resource type="Texture2D" path="res://art/exported/creatures/fish_placeholder.png" id="99_fish_placeholder"] [sub_resource type="Resource" id="Availability"] script = ExtResource("3_availability") @@ -13,10 +14,11 @@ forbid_fog = true script = ExtResource("1_fish_data") id = &"koi" display_name = "koi" -active = false +active = true catalog_number = 3003 collection_group = &"Freshwater ornamental" logbook_fact = "koi are colorful domesticated forms of common carp selected over many generations. each fish carries a distinctive arrangement of patches and scales." +available_seasons = 15 allowed_water_types = 1 rarity = 2 base_catch_weight = 0.28 @@ -27,3 +29,4 @@ weight_max_lb = 35.0 sell_value_min = 14 sell_value_max = 34 sell_value_curve = 0.87 +display_texture = ExtResource("99_fish_placeholder") diff --git a/fish/species/krill_antarctic/krill_antarctic.tres b/fish/species/krill_antarctic/krill_antarctic.tres index 390487d..8cdf8e6 100644 --- a/fish/species/krill_antarctic/krill_antarctic.tres +++ b/fish/species/krill_antarctic/krill_antarctic.tres @@ -1,8 +1,9 @@ -[gd_resource type="Resource" script_class="FishData" load_steps=4 format=3] +[gd_resource type="Resource" script_class="FishData" load_steps=5 format=3] [ext_resource type="Script" path="res://fish/fish_data.gd" id="1_fish_data"] [ext_resource type="Resource" path="res://fishing/common_catch_profile.tres" id="2_profile"] [ext_resource type="Script" path="res://fish/fish_availability.gd" id="3_availability"] +[ext_resource type="Texture2D" path="res://art/exported/creatures/fish_placeholder.png" id="99_fish_placeholder"] [sub_resource type="Resource" id="Availability"] script = ExtResource("3_availability") @@ -12,10 +13,11 @@ allow_day = false script = ExtResource("1_fish_data") id = &"krill_antarctic" display_name = "Antarctic krill" -active = false +active = true catalog_number = 3802 collection_group = &"Lobsters and shrimp" logbook_fact = "antarctic krill form enormous swarms beneath southern seas and ice. these small crustaceans feed whales, seals, penguins, and fish." +available_seasons = 15 allowed_water_types = 2 rarity = 2 base_catch_weight = 0.3 @@ -26,3 +28,4 @@ weight_max_lb = 0.01 sell_value_min = 10 sell_value_max = 22 sell_value_curve = 0.99 +display_texture = ExtResource("99_fish_placeholder") diff --git a/fish/species/ladyfish/ladyfish.tres b/fish/species/ladyfish/ladyfish.tres index 1cc8e7b..57c277c 100644 --- a/fish/species/ladyfish/ladyfish.tres +++ b/fish/species/ladyfish/ladyfish.tres @@ -1,8 +1,9 @@ -[gd_resource type="Resource" script_class="FishData" load_steps=4 format=3] +[gd_resource type="Resource" script_class="FishData" load_steps=5 format=3] [ext_resource type="Script" path="res://fish/fish_data.gd" id="1_fish_data"] [ext_resource type="Resource" path="res://fishing/common_catch_profile.tres" id="2_profile"] [ext_resource type="Script" path="res://fish/fish_availability.gd" id="3_availability"] +[ext_resource type="Texture2D" path="res://art/exported/creatures/7403.png" id="99_fish_placeholder"] [sub_resource type="Resource" id="Availability"] script = ExtResource("3_availability") @@ -13,10 +14,11 @@ require_rain = true script = ExtResource("1_fish_data") id = &"ladyfish" display_name = "ladyfish" -active = false +active = true catalog_number = 7403 collection_group = &"Tropical flats fish" logbook_fact = "ladyfish race through warm shallows after schooling prey and often leap when pursued. a deeply forked tail powers their slender bodies." +available_seasons = 15 allowed_water_types = 2 rarity = 0 base_catch_weight = 1.7 @@ -27,3 +29,4 @@ weight_max_lb = 8.0 sell_value_min = 4 sell_value_max = 10 sell_value_curve = 0.9 +display_texture = ExtResource("99_fish_placeholder") diff --git a/fish/species/lanternfish_spotted/lanternfish_spotted.tres b/fish/species/lanternfish_spotted/lanternfish_spotted.tres index 8d47916..28446b7 100644 --- a/fish/species/lanternfish_spotted/lanternfish_spotted.tres +++ b/fish/species/lanternfish_spotted/lanternfish_spotted.tres @@ -1,8 +1,9 @@ -[gd_resource type="Resource" script_class="FishData" load_steps=4 format=3] +[gd_resource type="Resource" script_class="FishData" load_steps=5 format=3] [ext_resource type="Script" path="res://fish/fish_data.gd" id="1_fish_data"] [ext_resource type="Resource" path="res://fishing/common_catch_profile.tres" id="2_profile"] [ext_resource type="Script" path="res://fish/fish_availability.gd" id="3_availability"] +[ext_resource type="Texture2D" path="res://art/exported/creatures/fish_placeholder.png" id="99_fish_placeholder"] [sub_resource type="Resource" id="Availability"] script = ExtResource("3_availability") @@ -12,10 +13,11 @@ allow_day = false script = ExtResource("1_fish_data") id = &"lanternfish_spotted" display_name = "spotted lanternfish" -active = false +active = true catalog_number = 1806 collection_group = &"Deep-sea oddities" logbook_fact = "spotted lanternfish carry rows of light-producing organs along their bodies. immense schools rise toward the surface each night." +available_seasons = 15 allowed_water_types = 2 rarity = 2 base_catch_weight = 0.24 @@ -26,3 +28,4 @@ weight_max_lb = 0.5 sell_value_min = 14 sell_value_max = 30 sell_value_curve = 0.95 +display_texture = ExtResource("99_fish_placeholder") diff --git a/fish/species/largemouth_bass/largemouth_bass.tres b/fish/species/largemouth_bass/largemouth_bass.tres index e32cd20..aa89d04 100644 --- a/fish/species/largemouth_bass/largemouth_bass.tres +++ b/fish/species/largemouth_bass/largemouth_bass.tres @@ -1,8 +1,9 @@ -[gd_resource type="Resource" script_class="FishData" load_steps=4 format=3] +[gd_resource type="Resource" script_class="FishData" load_steps=5 format=3] [ext_resource type="Script" path="res://fish/fish_data.gd" id="1_fish_data"] [ext_resource type="Resource" path="res://fishing/common_catch_profile.tres" id="2_profile"] [ext_resource type="Script" path="res://fish/fish_availability.gd" id="3_availability"] +[ext_resource type="Texture2D" path="res://art/exported/creatures/fish_placeholder.png" id="99_fish_placeholder"] [sub_resource type="Resource" id="Availability"] script = ExtResource("3_availability") @@ -11,10 +12,11 @@ script = ExtResource("3_availability") script = ExtResource("1_fish_data") id = &"largemouth_bass" display_name = "largemouth bass" -active = false +active = true catalog_number = 2201 collection_group = &"Freshwater bass" logbook_fact = "largemouth bass wait among weeds and timber before lunging at prey. the upper jaw extends beyond the eye when the mouth is closed." +available_seasons = 7 allowed_water_types = 1 rarity = 0 base_catch_weight = 2.5 @@ -25,3 +27,4 @@ weight_max_lb = 18.0 sell_value_min = 4 sell_value_max = 12 sell_value_curve = 0.9 +display_texture = ExtResource("99_fish_placeholder") diff --git a/fish/species/lingcod/lingcod.tres b/fish/species/lingcod/lingcod.tres index 34c8c0b..807dc8b 100644 --- a/fish/species/lingcod/lingcod.tres +++ b/fish/species/lingcod/lingcod.tres @@ -1,8 +1,9 @@ -[gd_resource type="Resource" script_class="FishData" load_steps=4 format=3] +[gd_resource type="Resource" script_class="FishData" load_steps=5 format=3] [ext_resource type="Script" path="res://fish/fish_data.gd" id="1_fish_data"] [ext_resource type="Resource" path="res://fishing/common_catch_profile.tres" id="2_profile"] [ext_resource type="Script" path="res://fish/fish_availability.gd" id="3_availability"] +[ext_resource type="Texture2D" path="res://art/exported/creatures/fish_placeholder.png" id="99_fish_placeholder"] [sub_resource type="Resource" id="Availability"] script = ExtResource("3_availability") @@ -11,10 +12,11 @@ script = ExtResource("3_availability") script = ExtResource("1_fish_data") id = &"lingcod" display_name = "lingcod" -active = false +active = true catalog_number = 7001 collection_group = &"Temperate reef predators" logbook_fact = "lingcod guard rocky dens and ambush fish with a huge tooth-lined mouth. despite the name, they are greenling relatives rather than cod." +available_seasons = 13 allowed_water_types = 2 rarity = 2 base_catch_weight = 0.25 @@ -25,3 +27,4 @@ weight_max_lb = 60.0 sell_value_min = 14 sell_value_max = 38 sell_value_curve = 0.83 +display_texture = ExtResource("99_fish_placeholder") diff --git a/fish/species/lionfish_red/lionfish_red.tres b/fish/species/lionfish_red/lionfish_red.tres index 9b46e72..f3c3b3b 100644 --- a/fish/species/lionfish_red/lionfish_red.tres +++ b/fish/species/lionfish_red/lionfish_red.tres @@ -1,8 +1,9 @@ -[gd_resource type="Resource" script_class="FishData" load_steps=4 format=3] +[gd_resource type="Resource" script_class="FishData" load_steps=5 format=3] [ext_resource type="Script" path="res://fish/fish_data.gd" id="1_fish_data"] [ext_resource type="Resource" path="res://fishing/common_catch_profile.tres" id="2_profile"] [ext_resource type="Script" path="res://fish/fish_availability.gd" id="3_availability"] +[ext_resource type="Texture2D" path="res://art/exported/creatures/fish_placeholder.png" id="99_fish_placeholder"] [sub_resource type="Resource" id="Availability"] script = ExtResource("3_availability") @@ -12,10 +13,11 @@ allow_day = false script = ExtResource("1_fish_data") id = &"lionfish_red" display_name = "red lionfish" -active = false +active = true catalog_number = 5201 collection_group = &"Reef ambush fish" logbook_fact = "red lionfish spread ornate venomous spines when threatened. broad fins herd smaller fish into corners before a rapid gulp." +available_seasons = 15 allowed_water_types = 2 rarity = 2 base_catch_weight = 0.3 @@ -26,3 +28,4 @@ weight_max_lb = 3.0 sell_value_min = 11 sell_value_max = 25 sell_value_curve = 0.92 +display_texture = ExtResource("99_fish_placeholder") diff --git a/fish/species/loach_clown/loach_clown.tres b/fish/species/loach_clown/loach_clown.tres index afe5549..f99a1be 100644 --- a/fish/species/loach_clown/loach_clown.tres +++ b/fish/species/loach_clown/loach_clown.tres @@ -1,8 +1,9 @@ -[gd_resource type="Resource" script_class="FishData" load_steps=4 format=3] +[gd_resource type="Resource" script_class="FishData" load_steps=5 format=3] [ext_resource type="Script" path="res://fish/fish_data.gd" id="1_fish_data"] [ext_resource type="Resource" path="res://fishing/common_catch_profile.tres" id="2_profile"] [ext_resource type="Script" path="res://fish/fish_availability.gd" id="3_availability"] +[ext_resource type="Texture2D" path="res://art/exported/creatures/fish_placeholder.png" id="99_fish_placeholder"] [sub_resource type="Resource" id="Availability"] script = ExtResource("3_availability") @@ -13,10 +14,11 @@ require_rain = true script = ExtResource("1_fish_data") id = &"loach_clown" display_name = "clown loach" -active = false +active = true catalog_number = 7502 collection_group = &"Tropical freshwater fish" logbook_fact = "clown loaches rest in groups and make clicking sounds while feeding. orange bodies carry three broad black bands and small eye spines." +available_seasons = 15 allowed_water_types = 1 rarity = 2 base_catch_weight = 0.32 @@ -27,3 +29,4 @@ weight_max_lb = 2.0 sell_value_min = 10 sell_value_max = 22 sell_value_curve = 0.9 +display_texture = ExtResource("99_fish_placeholder") diff --git a/fish/species/loach_weather/loach_weather.tres b/fish/species/loach_weather/loach_weather.tres index 8b23ea1..cc7afef 100644 --- a/fish/species/loach_weather/loach_weather.tres +++ b/fish/species/loach_weather/loach_weather.tres @@ -1,8 +1,9 @@ -[gd_resource type="Resource" script_class="FishData" load_steps=4 format=3] +[gd_resource type="Resource" script_class="FishData" load_steps=5 format=3] [ext_resource type="Script" path="res://fish/fish_data.gd" id="1_fish_data"] [ext_resource type="Resource" path="res://fishing/common_catch_profile.tres" id="2_profile"] [ext_resource type="Script" path="res://fish/fish_availability.gd" id="3_availability"] +[ext_resource type="Texture2D" path="res://art/exported/creatures/fish_placeholder.png" id="99_fish_placeholder"] [sub_resource type="Resource" id="Availability"] script = ExtResource("3_availability") @@ -12,10 +13,11 @@ require_rain = true script = ExtResource("1_fish_data") id = &"loach_weather" display_name = "weather loach" -active = false +active = true catalog_number = 2905 collection_group = &"Freshwater oddities" logbook_fact = "weather loaches gulp air and pass it through the intestine when oxygen runs low. restless activity often increases as air pressure falls." +available_seasons = 15 allowed_water_types = 1 rarity = 1 base_catch_weight = 0.85 @@ -26,3 +28,4 @@ weight_max_lb = 0.7 sell_value_min = 5 sell_value_max = 11 sell_value_curve = 0.95 +display_texture = ExtResource("99_fish_placeholder") diff --git a/fish/species/lobster_american/lobster_american.tres b/fish/species/lobster_american/lobster_american.tres index 92bdb7f..b70b809 100644 --- a/fish/species/lobster_american/lobster_american.tres +++ b/fish/species/lobster_american/lobster_american.tres @@ -1,8 +1,9 @@ -[gd_resource type="Resource" script_class="FishData" load_steps=4 format=3] +[gd_resource type="Resource" script_class="FishData" load_steps=5 format=3] [ext_resource type="Script" path="res://fish/fish_data.gd" id="1_fish_data"] [ext_resource type="Resource" path="res://fishing/common_catch_profile.tres" id="2_profile"] [ext_resource type="Script" path="res://fish/fish_availability.gd" id="3_availability"] +[ext_resource type="Texture2D" path="res://art/exported/creatures/fish_placeholder.png" id="99_fish_placeholder"] [sub_resource type="Resource" id="Availability"] script = ExtResource("3_availability") @@ -13,10 +14,11 @@ require_fog = true script = ExtResource("1_fish_data") id = &"lobster_american" display_name = "American lobster" -active = false +active = true catalog_number = 3801 collection_group = &"Lobsters and shrimp" logbook_fact = "american lobsters shelter in rocky crevices and emerge to forage along the bottom. one claw crushes while the other cuts and grips." +available_seasons = 15 allowed_water_types = 2 rarity = 2 base_catch_weight = 0.28 @@ -27,3 +29,4 @@ weight_max_lb = 44.0 sell_value_min = 16 sell_value_max = 42 sell_value_curve = 0.86 +display_texture = ExtResource("99_fish_placeholder") diff --git a/fish/species/lobster_caribbean_spiny/lobster_caribbean_spiny.tres b/fish/species/lobster_caribbean_spiny/lobster_caribbean_spiny.tres index 94672a9..cdd828c 100644 --- a/fish/species/lobster_caribbean_spiny/lobster_caribbean_spiny.tres +++ b/fish/species/lobster_caribbean_spiny/lobster_caribbean_spiny.tres @@ -1,8 +1,9 @@ -[gd_resource type="Resource" script_class="FishData" load_steps=4 format=3] +[gd_resource type="Resource" script_class="FishData" load_steps=5 format=3] [ext_resource type="Script" path="res://fish/fish_data.gd" id="1_fish_data"] [ext_resource type="Resource" path="res://fishing/common_catch_profile.tres" id="2_profile"] [ext_resource type="Script" path="res://fish/fish_availability.gd" id="3_availability"] +[ext_resource type="Texture2D" path="res://art/exported/creatures/fish_placeholder.png" id="99_fish_placeholder"] [sub_resource type="Resource" id="Availability"] script = ExtResource("3_availability") @@ -13,10 +14,11 @@ forbid_fog = true script = ExtResource("1_fish_data") id = &"lobster_caribbean_spiny" display_name = "Caribbean spiny lobster" -active = false +active = true catalog_number = 3803 collection_group = &"Lobsters and shrimp" logbook_fact = "caribbean spiny lobsters rely on long antennae and a thorny shell instead of large claws. groups march together across the seafloor." +available_seasons = 15 allowed_water_types = 2 rarity = 2 base_catch_weight = 0.25 @@ -27,3 +29,4 @@ weight_max_lb = 26.0 sell_value_min = 15 sell_value_max = 38 sell_value_curve = 0.87 +display_texture = ExtResource("99_fish_placeholder") diff --git a/fish/species/lungfish_west_african/lungfish_west_african.png b/fish/species/lungfish_west_african/lungfish_west_african.png new file mode 100644 index 0000000..9960ab0 Binary files /dev/null and b/fish/species/lungfish_west_african/lungfish_west_african.png differ diff --git a/fish/species/lungfish_west_african/lungfish_west_african.png.import b/fish/species/lungfish_west_african/lungfish_west_african.png.import new file mode 100644 index 0000000..dfb1875 --- /dev/null +++ b/fish/species/lungfish_west_african/lungfish_west_african.png.import @@ -0,0 +1,40 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://i7uefoxij0xr" +path="res://.godot/imported/lungfish_west_african.png-39f7845a079da2da99841f01c797b183.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://fish/species/lungfish_west_african/lungfish_west_african.png" +dest_files=["res://.godot/imported/lungfish_west_african.png-39f7845a079da2da99841f01c797b183.ctex"] + +[params] + +compress/mode=0 +compress/high_quality=false +compress/lossy_quality=0.7 +compress/uastc_level=0 +compress/rdo_quality_loss=0.0 +compress/hdr_compression=1 +compress/normal_map=0 +compress/channel_pack=0 +mipmaps/generate=false +mipmaps/limit=-1 +roughness/mode=0 +roughness/src_normal="" +process/channel_remap/red=0 +process/channel_remap/green=1 +process/channel_remap/blue=2 +process/channel_remap/alpha=3 +process/fix_alpha_border=true +process/premult_alpha=false +process/normal_map_invert_y=false +process/hdr_as_srgb=false +process/hdr_clamp_exposure=false +process/size_limit=0 +detect_3d/compress_to=1 diff --git a/fish/species/lungfish_west_african/lungfish_west_african.tres b/fish/species/lungfish_west_african/lungfish_west_african.tres index 4baad67..f049cff 100644 --- a/fish/species/lungfish_west_african/lungfish_west_african.tres +++ b/fish/species/lungfish_west_african/lungfish_west_african.tres @@ -1,8 +1,9 @@ -[gd_resource type="Resource" script_class="FishData" load_steps=4 format=3] +[gd_resource type="Resource" script_class="FishData" load_steps=5 format=3] [ext_resource type="Script" path="res://fish/fish_data.gd" id="1_fish_data"] [ext_resource type="Resource" path="res://fishing/common_catch_profile.tres" id="2_profile"] [ext_resource type="Script" path="res://fish/fish_availability.gd" id="3_availability"] +[ext_resource type="Texture2D" path="res://art/exported/creatures/107.png" id="4_texture"] [sub_resource type="Resource" id="Availability"] script = ExtResource("3_availability") @@ -13,10 +14,11 @@ require_rain = true script = ExtResource("1_fish_data") id = &"lungfish_west_african" display_name = "West African lungfish" -active = false +active = true catalog_number = 107 collection_group = &"Ancient freshwater fish" logbook_fact = "west african lungfish breathe air with paired lungs. when floodplains dry, they seal themselves in a mud cocoon until water returns." +available_seasons = 6 allowed_water_types = 1 rarity = 2 base_catch_weight = 0.3 @@ -27,3 +29,4 @@ weight_max_lb = 10.0 sell_value_min = 12 sell_value_max = 28 sell_value_curve = 0.86 +display_texture = ExtResource("4_texture") diff --git a/fish/species/mackerel_atlantic/fish_mackerel_atlantic.png b/fish/species/mackerel_atlantic/fish_mackerel_atlantic.png index 67a2410..e5fbd98 100644 Binary files a/fish/species/mackerel_atlantic/fish_mackerel_atlantic.png and b/fish/species/mackerel_atlantic/fish_mackerel_atlantic.png differ diff --git a/fish/species/mackerel_atlantic/mackerel_atlantic.tres b/fish/species/mackerel_atlantic/mackerel_atlantic.tres index edf6d38..ba6e0d8 100644 --- a/fish/species/mackerel_atlantic/mackerel_atlantic.tres +++ b/fish/species/mackerel_atlantic/mackerel_atlantic.tres @@ -3,7 +3,7 @@ [ext_resource type="Script" uid="uid://h7hg45b7wmst" path="res://fish/fish_data.gd" id="1_fish_data"] [ext_resource type="Resource" path="res://fishing/common_catch_profile.tres" id="2_profile"] [ext_resource type="Script" uid="uid://bs7cqi88csolc" path="res://fish/fish_availability.gd" id="3_availability_script"] -[ext_resource type="Texture2D" uid="uid://breyc8fqq8lq3" path="res://fish/species/mackerel_atlantic/fish_mackerel_atlantic.png" id="4_texture"] +[ext_resource type="Texture2D" path="res://art/exported/creatures/701.png" id="4_texture"] [sub_resource type="Resource" id="MackerelAtlanticAvailability"] script = ExtResource("3_availability_script") @@ -17,6 +17,7 @@ active = true catalog_number = 701 collection_group = &"Coastal pelagic fish" logbook_fact = "atlantic mackerel travel in fast schools across the north atlantic and feed on plankton and small schooling fish." +available_seasons = 7 allowed_water_types = 2 base_catch_weight = 0.5 catch_profile = ExtResource("2_profile") diff --git a/fish/species/mackerel_cero/fish_mackerel_cero.png b/fish/species/mackerel_cero/fish_mackerel_cero.png index 82cb340..610b99c 100644 Binary files a/fish/species/mackerel_cero/fish_mackerel_cero.png and b/fish/species/mackerel_cero/fish_mackerel_cero.png differ diff --git a/fish/species/mackerel_cero/mackerel_cero.tres b/fish/species/mackerel_cero/mackerel_cero.tres index 6dc9040..25cd4c5 100644 --- a/fish/species/mackerel_cero/mackerel_cero.tres +++ b/fish/species/mackerel_cero/mackerel_cero.tres @@ -3,7 +3,7 @@ [ext_resource type="Script" uid="uid://h7hg45b7wmst" path="res://fish/fish_data.gd" id="1_fish_data"] [ext_resource type="Resource" path="res://fishing/common_catch_profile.tres" id="2_profile"] [ext_resource type="Script" uid="uid://bs7cqi88csolc" path="res://fish/fish_availability.gd" id="3_availability_script"] -[ext_resource type="Texture2D" uid="uid://g8qanq47g1b8" path="res://fish/species/mackerel_cero/fish_mackerel_cero.png" id="4_texture"] +[ext_resource type="Texture2D" path="res://art/exported/creatures/fish_placeholder.png" id="4_texture"] [sub_resource type="Resource" id="MackerelCeroAvailability"] script = ExtResource("3_availability_script") @@ -17,6 +17,7 @@ active = true catalog_number = 703 collection_group = &"Coastal pelagic fish" logbook_fact = "cero mackerel are streamlined coastal hunters. sharp teeth help them slash through schools of smaller fish." +available_seasons = 15 allowed_water_types = 2 rarity = 1 base_catch_weight = 0.35 diff --git a/fish/species/mackerel_chub/fish_mackerel_chub.png b/fish/species/mackerel_chub/fish_mackerel_chub.png index c0687ff..2d668fd 100644 Binary files a/fish/species/mackerel_chub/fish_mackerel_chub.png and b/fish/species/mackerel_chub/fish_mackerel_chub.png differ diff --git a/fish/species/mackerel_chub/mackerel_chub.tres b/fish/species/mackerel_chub/mackerel_chub.tres index 189904e..891abe4 100644 --- a/fish/species/mackerel_chub/mackerel_chub.tres +++ b/fish/species/mackerel_chub/mackerel_chub.tres @@ -3,7 +3,7 @@ [ext_resource type="Script" uid="uid://h7hg45b7wmst" path="res://fish/fish_data.gd" id="1_fish_data"] [ext_resource type="Resource" path="res://fishing/common_catch_profile.tres" id="2_profile"] [ext_resource type="Script" uid="uid://bs7cqi88csolc" path="res://fish/fish_availability.gd" id="3_availability_script"] -[ext_resource type="Texture2D" uid="uid://b7q2t02oo2bcp" path="res://fish/species/mackerel_chub/fish_mackerel_chub.png" id="4_texture"] +[ext_resource type="Texture2D" path="res://art/exported/creatures/704.png" id="4_texture"] [sub_resource type="Resource" id="MackerelChubAvailability"] script = ExtResource("3_availability_script") @@ -17,6 +17,7 @@ active = true catalog_number = 704 collection_group = &"Coastal pelagic fish" logbook_fact = "chub mackerel school near the surface and follow plankton blooms. their dark wavy bars help identify them at a glance." +available_seasons = 7 allowed_water_types = 2 base_catch_weight = 0.5 catch_profile = ExtResource("2_profile") diff --git a/fish/species/mackerel_king/fish_mackerel_king.png b/fish/species/mackerel_king/fish_mackerel_king.png index 01fd603..7ec6614 100644 Binary files a/fish/species/mackerel_king/fish_mackerel_king.png and b/fish/species/mackerel_king/fish_mackerel_king.png differ diff --git a/fish/species/mackerel_king/mackerel_king.tres b/fish/species/mackerel_king/mackerel_king.tres index 4e0a047..9c00470 100644 --- a/fish/species/mackerel_king/mackerel_king.tres +++ b/fish/species/mackerel_king/mackerel_king.tres @@ -3,7 +3,7 @@ [ext_resource type="Script" uid="uid://h7hg45b7wmst" path="res://fish/fish_data.gd" id="1_fish_data"] [ext_resource type="Resource" path="res://fishing/common_catch_profile.tres" id="2_profile"] [ext_resource type="Script" uid="uid://bs7cqi88csolc" path="res://fish/fish_availability.gd" id="3_availability_script"] -[ext_resource type="Texture2D" uid="uid://b2fag3xemyx5s" path="res://fish/species/mackerel_king/fish_mackerel_king.png" id="4_texture"] +[ext_resource type="Texture2D" path="res://art/exported/creatures/fish_placeholder.png" id="4_texture"] [sub_resource type="Resource" id="MackerelKingAvailability"] script = ExtResource("3_availability_script") @@ -17,6 +17,7 @@ active = true catalog_number = 706 collection_group = &"Coastal pelagic fish" logbook_fact = "king mackerel are swift coastal predators. their pointed teeth and long body are built for sudden bursts of speed." +available_seasons = 6 allowed_water_types = 2 rarity = 1 base_catch_weight = 0.3 diff --git a/fish/species/mackerel_spanish/fish_mackerel_spanish.png b/fish/species/mackerel_spanish/fish_mackerel_spanish.png index 2a97bed..5cbe847 100644 Binary files a/fish/species/mackerel_spanish/fish_mackerel_spanish.png and b/fish/species/mackerel_spanish/fish_mackerel_spanish.png differ diff --git a/fish/species/mackerel_spanish/mackerel_spanish.tres b/fish/species/mackerel_spanish/mackerel_spanish.tres index 0aee136..1f0bcf4 100644 --- a/fish/species/mackerel_spanish/mackerel_spanish.tres +++ b/fish/species/mackerel_spanish/mackerel_spanish.tres @@ -3,7 +3,7 @@ [ext_resource type="Script" uid="uid://h7hg45b7wmst" path="res://fish/fish_data.gd" id="1_fish_data"] [ext_resource type="Resource" path="res://fishing/common_catch_profile.tres" id="2_profile"] [ext_resource type="Script" uid="uid://bs7cqi88csolc" path="res://fish/fish_availability.gd" id="3_availability_script"] -[ext_resource type="Texture2D" uid="uid://cy2hmpenpkee2" path="res://fish/species/mackerel_spanish/fish_mackerel_spanish.png" id="4_texture"] +[ext_resource type="Texture2D" path="res://art/exported/creatures/fish_placeholder.png" id="4_texture"] [sub_resource type="Resource" id="MackerelSpanishAvailability"] script = ExtResource("3_availability_script") @@ -17,6 +17,7 @@ active = true catalog_number = 707 collection_group = &"Coastal pelagic fish" logbook_fact = "spanish mackerel hunt in warm coastal waters and often travel in loose schools while chasing baitfish." +available_seasons = 6 allowed_water_types = 2 rarity = 1 base_catch_weight = 0.35 diff --git a/fish/species/madtom_tadpole/madtom_tadpole.tres b/fish/species/madtom_tadpole/madtom_tadpole.tres index d43c1c5..d0a5545 100644 --- a/fish/species/madtom_tadpole/madtom_tadpole.tres +++ b/fish/species/madtom_tadpole/madtom_tadpole.tres @@ -1,8 +1,9 @@ -[gd_resource type="Resource" script_class="FishData" load_steps=4 format=3] +[gd_resource type="Resource" script_class="FishData" load_steps=5 format=3] [ext_resource type="Script" path="res://fish/fish_data.gd" id="1_fish_data"] [ext_resource type="Resource" path="res://fishing/common_catch_profile.tres" id="2_profile"] [ext_resource type="Script" path="res://fish/fish_availability.gd" id="3_availability"] +[ext_resource type="Texture2D" path="res://art/exported/creatures/fish_placeholder.png" id="99_fish_placeholder"] [sub_resource type="Resource" id="Availability"] script = ExtResource("3_availability") @@ -12,10 +13,11 @@ allow_day = false script = ExtResource("1_fish_data") id = &"madtom_tadpole" display_name = "tadpole madtom" -active = false +active = true catalog_number = 2406 collection_group = &"Freshwater catfish" logbook_fact = "tadpole madtoms are tiny nocturnal catfish that shelter beneath vegetation and debris. venomous fin spines discourage larger predators." +available_seasons = 7 allowed_water_types = 1 rarity = 2 base_catch_weight = 0.35 @@ -26,3 +28,4 @@ weight_max_lb = 0.15 sell_value_min = 8 sell_value_max = 16 sell_value_curve = 0.95 +display_texture = ExtResource("99_fish_placeholder") diff --git a/fish/species/mahi_mahi/mahi_mahi.tres b/fish/species/mahi_mahi/mahi_mahi.tres index ded9958..691a52a 100644 --- a/fish/species/mahi_mahi/mahi_mahi.tres +++ b/fish/species/mahi_mahi/mahi_mahi.tres @@ -1,8 +1,9 @@ -[gd_resource type="Resource" script_class="FishData" load_steps=4 format=3] +[gd_resource type="Resource" script_class="FishData" load_steps=5 format=3] [ext_resource type="Script" path="res://fish/fish_data.gd" id="1_fish_data"] [ext_resource type="Resource" path="res://fishing/common_catch_profile.tres" id="2_profile"] [ext_resource type="Script" path="res://fish/fish_availability.gd" id="3_availability"] +[ext_resource type="Texture2D" path="res://art/exported/creatures/4701.png" id="99_fish_placeholder"] [sub_resource type="Resource" id="Availability"] script = ExtResource("3_availability") @@ -13,10 +14,11 @@ forbid_fog = true script = ExtResource("1_fish_data") id = &"mahi_mahi" display_name = "mahi-mahi" -active = false +active = true catalog_number = 4701 collection_group = &"Oceanic pelagic fish" logbook_fact = "mahi-mahi flash brilliant blue, green, and gold while chasing prey near the surface. they grow quickly and gather around floating objects." +available_seasons = 6 allowed_water_types = 2 rarity = 2 base_catch_weight = 0.28 @@ -27,3 +29,4 @@ weight_max_lb = 50.0 sell_value_min = 15 sell_value_max = 38 sell_value_curve = 0.84 +display_texture = ExtResource("99_fish_placeholder") diff --git a/fish/species/mahseer_golden/mahseer_golden.tres b/fish/species/mahseer_golden/mahseer_golden.tres index 4a51858..1459de1 100644 --- a/fish/species/mahseer_golden/mahseer_golden.tres +++ b/fish/species/mahseer_golden/mahseer_golden.tres @@ -1,8 +1,9 @@ -[gd_resource type="Resource" script_class="FishData" load_steps=4 format=3] +[gd_resource type="Resource" script_class="FishData" load_steps=5 format=3] [ext_resource type="Script" path="res://fish/fish_data.gd" id="1_fish_data"] [ext_resource type="Resource" path="res://fishing/common_catch_profile.tres" id="2_profile"] [ext_resource type="Script" path="res://fish/fish_availability.gd" id="3_availability"] +[ext_resource type="Texture2D" path="res://art/exported/creatures/fish_placeholder.png" id="99_fish_placeholder"] [sub_resource type="Resource" id="Availability"] script = ExtResource("3_availability") @@ -13,10 +14,11 @@ require_rain = true script = ExtResource("1_fish_data") id = &"mahseer_golden" display_name = "golden mahseer" -active = false +active = true catalog_number = 7603 collection_group = &"Tropical freshwater predators" logbook_fact = "golden mahseer migrate through swift mountain rivers to reach spawning grounds. large scales shine bronze beneath reddish fins." +available_seasons = 15 allowed_water_types = 1 rarity = 3 base_catch_weight = 0.09 @@ -27,3 +29,4 @@ weight_max_lb = 90.0 sell_value_min = 32 sell_value_max = 72 sell_value_curve = 0.82 +display_texture = ExtResource("99_fish_placeholder") diff --git a/fish/species/manatee_west_indian/manatee_west_indian.tres b/fish/species/manatee_west_indian/manatee_west_indian.tres index 65094d0..7154157 100644 --- a/fish/species/manatee_west_indian/manatee_west_indian.tres +++ b/fish/species/manatee_west_indian/manatee_west_indian.tres @@ -1,8 +1,9 @@ -[gd_resource type="Resource" script_class="FishData" load_steps=4 format=3] +[gd_resource type="Resource" script_class="FishData" load_steps=5 format=3] [ext_resource type="Script" path="res://fish/fish_data.gd" id="1_fish_data"] [ext_resource type="Resource" path="res://fishing/common_catch_profile.tres" id="2_profile"] [ext_resource type="Script" path="res://fish/fish_availability.gd" id="3_availability"] +[ext_resource type="Texture2D" path="res://art/exported/creatures/fish_placeholder.png" id="99_fish_placeholder"] [sub_resource type="Resource" id="Availability"] script = ExtResource("3_availability") @@ -13,10 +14,11 @@ forbid_fog = true script = ExtResource("1_fish_data") id = &"manatee_west_indian" display_name = "West Indian manatee" -active = false +active = true catalog_number = 505 collection_group = &"Coastal marine mammals" logbook_fact = "west indian manatees graze aquatic plants in warm coastal water and rivers. they surface regularly to breathe through nostrils atop the snout." +available_seasons = 15 allowed_water_types = 2 rarity = 4 base_catch_weight = 0.012 @@ -27,3 +29,4 @@ weight_max_lb = 1300.0 sell_value_min = 70 sell_value_max = 160 sell_value_curve = 0.77 +display_texture = ExtResource("99_fish_placeholder") diff --git a/fish/species/manta_ray_giant/manta_ray_giant.tres b/fish/species/manta_ray_giant/manta_ray_giant.tres index 29eeede..13eef47 100644 --- a/fish/species/manta_ray_giant/manta_ray_giant.tres +++ b/fish/species/manta_ray_giant/manta_ray_giant.tres @@ -1,8 +1,9 @@ -[gd_resource type="Resource" script_class="FishData" load_steps=4 format=3] +[gd_resource type="Resource" script_class="FishData" load_steps=5 format=3] [ext_resource type="Script" path="res://fish/fish_data.gd" id="1_fish_data"] [ext_resource type="Resource" path="res://fishing/common_catch_profile.tres" id="2_profile"] [ext_resource type="Script" path="res://fish/fish_availability.gd" id="3_availability"] +[ext_resource type="Texture2D" path="res://art/exported/creatures/fish_placeholder.png" id="99_fish_placeholder"] [sub_resource type="Resource" id="Availability"] script = ExtResource("3_availability") @@ -13,10 +14,11 @@ forbid_fog = true script = ExtResource("1_fish_data") id = &"manta_ray_giant" display_name = "giant manta ray" -active = false +active = true catalog_number = 5102 collection_group = &"Rays and skates" logbook_fact = "giant manta rays funnel plankton into wide mouths with two flexible head fins. each belly carries a unique pattern of dark spots." +available_seasons = 15 allowed_water_types = 2 rarity = 4 base_catch_weight = 0.025 @@ -27,3 +29,4 @@ weight_max_lb = 1000.0 sell_value_min = 65 sell_value_max = 150 sell_value_curve = 0.76 +display_texture = ExtResource("99_fish_placeholder") diff --git a/fish/species/marlin_black/fish_marlin_black.png b/fish/species/marlin_black/fish_marlin_black.png index 6cbcccd..ae4d9ab 100644 Binary files a/fish/species/marlin_black/fish_marlin_black.png and b/fish/species/marlin_black/fish_marlin_black.png differ diff --git a/fish/species/marlin_black/marlin_black.tres b/fish/species/marlin_black/marlin_black.tres index 93f0ba2..26f506a 100644 --- a/fish/species/marlin_black/marlin_black.tres +++ b/fish/species/marlin_black/marlin_black.tres @@ -3,7 +3,7 @@ [ext_resource type="Script" uid="uid://h7hg45b7wmst" path="res://fish/fish_data.gd" id="1_fish_data"] [ext_resource type="Resource" path="res://fishing/common_catch_profile.tres" id="2_profile"] [ext_resource type="Script" uid="uid://bs7cqi88csolc" path="res://fish/fish_availability.gd" id="3_availability_script"] -[ext_resource type="Texture2D" uid="uid://dkdctr2o52vrb" path="res://fish/species/marlin_black/fish_marlin_black.png" id="4_texture"] +[ext_resource type="Texture2D" path="res://art/exported/creatures/fish_placeholder.png" id="4_texture"] [sub_resource type="Resource" id="MarlinBlackAvailability"] script = ExtResource("3_availability_script") @@ -17,6 +17,7 @@ active = true catalog_number = 4601 collection_group = &"Oceanic billfish" logbook_fact = "black marlin are powerful billfish that spend much of their lives in warm open ocean and can make blistering runs." +available_seasons = 6 allowed_water_types = 2 rarity = 3 base_catch_weight = 0.08 diff --git a/fish/species/marlin_blue/fish_marlin_blue.png b/fish/species/marlin_blue/fish_marlin_blue.png index 7df059f..0f4c357 100644 Binary files a/fish/species/marlin_blue/fish_marlin_blue.png and b/fish/species/marlin_blue/fish_marlin_blue.png differ diff --git a/fish/species/marlin_blue/marlin_blue.tres b/fish/species/marlin_blue/marlin_blue.tres index 51cff14..c8ee35d 100644 --- a/fish/species/marlin_blue/marlin_blue.tres +++ b/fish/species/marlin_blue/marlin_blue.tres @@ -3,7 +3,7 @@ [ext_resource type="Script" uid="uid://h7hg45b7wmst" path="res://fish/fish_data.gd" id="1_fish_data"] [ext_resource type="Resource" path="res://fishing/common_catch_profile.tres" id="2_profile"] [ext_resource type="Script" uid="uid://bs7cqi88csolc" path="res://fish/fish_availability.gd" id="3_availability_script"] -[ext_resource type="Texture2D" uid="uid://de35fjoytbomu" path="res://fish/species/marlin_blue/fish_marlin_blue.png" id="4_texture"] +[ext_resource type="Texture2D" path="res://art/exported/creatures/fish_placeholder.png" id="4_texture"] [sub_resource type="Resource" id="MarlinBlueAvailability"] script = ExtResource("3_availability_script") @@ -17,6 +17,7 @@ active = true catalog_number = 4602 collection_group = &"Oceanic billfish" logbook_fact = "blue marlin are highly migratory open-ocean hunters. their long bill helps them stun prey before turning back to feed." +available_seasons = 6 allowed_water_types = 2 rarity = 4 base_catch_weight = 0.05 diff --git a/fish/species/marlin_white/fish_marlin_white.png b/fish/species/marlin_white/fish_marlin_white.png index 76fb780..327bd91 100644 Binary files a/fish/species/marlin_white/fish_marlin_white.png and b/fish/species/marlin_white/fish_marlin_white.png differ diff --git a/fish/species/marlin_white/marlin_white.tres b/fish/species/marlin_white/marlin_white.tres index bbbf34f..a69d01d 100644 --- a/fish/species/marlin_white/marlin_white.tres +++ b/fish/species/marlin_white/marlin_white.tres @@ -3,7 +3,7 @@ [ext_resource type="Script" uid="uid://h7hg45b7wmst" path="res://fish/fish_data.gd" id="1_fish_data"] [ext_resource type="Resource" path="res://fishing/common_catch_profile.tres" id="2_profile"] [ext_resource type="Script" uid="uid://bs7cqi88csolc" path="res://fish/fish_availability.gd" id="3_availability_script"] -[ext_resource type="Texture2D" uid="uid://bdvy4ujx2htcy" path="res://fish/species/marlin_white/fish_marlin_white.png" id="4_texture"] +[ext_resource type="Texture2D" path="res://art/exported/creatures/fish_placeholder.png" id="4_texture"] [sub_resource type="Resource" id="MarlinWhiteAvailability"] script = ExtResource("3_availability_script") @@ -17,6 +17,7 @@ active = true catalog_number = 4605 collection_group = &"Oceanic billfish" logbook_fact = "white marlin favor warm offshore water and use their rounded dorsal fin and bill to weave through schools of prey." +available_seasons = 6 allowed_water_types = 2 rarity = 3 base_catch_weight = 0.1 diff --git a/fish/species/menhaden_atlantic/menhaden_atlantic.tres b/fish/species/menhaden_atlantic/menhaden_atlantic.tres index ced8488..53b4d6e 100644 --- a/fish/species/menhaden_atlantic/menhaden_atlantic.tres +++ b/fish/species/menhaden_atlantic/menhaden_atlantic.tres @@ -1,8 +1,9 @@ -[gd_resource type="Resource" script_class="FishData" load_steps=4 format=3] +[gd_resource type="Resource" script_class="FishData" load_steps=5 format=3] [ext_resource type="Script" path="res://fish/fish_data.gd" id="1_fish_data"] [ext_resource type="Resource" path="res://fishing/common_catch_profile.tres" id="2_profile"] [ext_resource type="Script" path="res://fish/fish_availability.gd" id="3_availability"] +[ext_resource type="Texture2D" path="res://art/exported/creatures/802.png" id="99_fish_placeholder"] [sub_resource type="Resource" id="Availability"] script = ExtResource("3_availability") @@ -12,10 +13,11 @@ allow_night = false script = ExtResource("1_fish_data") id = &"menhaden_atlantic" display_name = "atlantic menhaden" -active = false +active = true catalog_number = 802 collection_group = &"Coastal schooling fish" logbook_fact = "atlantic menhaden strain plankton from coastal water with fine gill rakers. dense schools feed whales, seabirds, and predatory fish." +available_seasons = 7 allowed_water_types = 2 rarity = 0 base_catch_weight = 3.0 @@ -26,3 +28,4 @@ weight_max_lb = 1.5 sell_value_min = 2 sell_value_max = 5 sell_value_curve = 0.98 +display_texture = ExtResource("99_fish_placeholder") diff --git a/fish/species/milkfish/milkfish.tres b/fish/species/milkfish/milkfish.tres index 08d5627..9c8362a 100644 --- a/fish/species/milkfish/milkfish.tres +++ b/fish/species/milkfish/milkfish.tres @@ -1,8 +1,9 @@ -[gd_resource type="Resource" script_class="FishData" load_steps=4 format=3] +[gd_resource type="Resource" script_class="FishData" load_steps=5 format=3] [ext_resource type="Script" path="res://fish/fish_data.gd" id="1_fish_data"] [ext_resource type="Resource" path="res://fishing/common_catch_profile.tres" id="2_profile"] [ext_resource type="Script" path="res://fish/fish_availability.gd" id="3_availability"] +[ext_resource type="Texture2D" path="res://art/exported/creatures/7101.png" id="99_fish_placeholder"] [sub_resource type="Resource" id="Availability"] script = ExtResource("3_availability") @@ -12,10 +13,11 @@ allow_night = false script = ExtResource("1_fish_data") id = &"milkfish" display_name = "milkfish" -active = false +active = true catalog_number = 7101 collection_group = &"Tropical coastal fish" logbook_fact = "milkfish graze algae and tiny organisms in warm coastal shallows. deeply forked tails drive large schools through lagoons and estuaries." +available_seasons = 15 allowed_water_types = 2 rarity = 0 base_catch_weight = 1.8 @@ -26,3 +28,4 @@ weight_max_lb = 25.0 sell_value_min = 4 sell_value_max = 12 sell_value_curve = 0.88 +display_texture = ExtResource("99_fish_placeholder") diff --git a/fish/species/minnow_fathead/minnow_fathead.tres b/fish/species/minnow_fathead/minnow_fathead.tres index be28197..cf00159 100644 --- a/fish/species/minnow_fathead/minnow_fathead.tres +++ b/fish/species/minnow_fathead/minnow_fathead.tres @@ -1,8 +1,9 @@ -[gd_resource type="Resource" script_class="FishData" load_steps=4 format=3] +[gd_resource type="Resource" script_class="FishData" load_steps=5 format=3] [ext_resource type="Script" path="res://fish/fish_data.gd" id="1_fish_data"] [ext_resource type="Resource" path="res://fishing/common_catch_profile.tres" id="2_profile"] [ext_resource type="Script" path="res://fish/fish_availability.gd" id="3_availability"] +[ext_resource type="Texture2D" path="res://art/exported/creatures/fish_placeholder.png" id="99_fish_placeholder"] [sub_resource type="Resource" id="Availability"] script = ExtResource("3_availability") @@ -12,10 +13,11 @@ allow_night = false script = ExtResource("1_fish_data") id = &"minnow_fathead" display_name = "fathead minnow" -active = false +active = true catalog_number = 2804 collection_group = &"Freshwater minnows" logbook_fact = "fathead minnows tolerate warm, muddy ponds where many fish struggle. males guard eggs laid beneath rocks, logs, and other cover." +available_seasons = 7 allowed_water_types = 1 rarity = 0 base_catch_weight = 4.5 @@ -26,3 +28,4 @@ weight_max_lb = 0.2 sell_value_min = 1 sell_value_max = 2 sell_value_curve = 1.0 +display_texture = ExtResource("99_fish_placeholder") diff --git a/fish/species/monkfish/monkfish.tres b/fish/species/monkfish/monkfish.tres index a4374e1..d485570 100644 --- a/fish/species/monkfish/monkfish.tres +++ b/fish/species/monkfish/monkfish.tres @@ -1,8 +1,9 @@ -[gd_resource type="Resource" script_class="FishData" load_steps=4 format=3] +[gd_resource type="Resource" script_class="FishData" load_steps=5 format=3] [ext_resource type="Script" path="res://fish/fish_data.gd" id="1_fish_data"] [ext_resource type="Resource" path="res://fishing/common_catch_profile.tres" id="2_profile"] [ext_resource type="Script" path="res://fish/fish_availability.gd" id="3_availability"] +[ext_resource type="Texture2D" path="res://art/exported/creatures/fish_placeholder.png" id="99_fish_placeholder"] [sub_resource type="Resource" id="Availability"] script = ExtResource("3_availability") @@ -13,10 +14,11 @@ require_fog = true script = ExtResource("1_fish_data") id = &"monkfish" display_name = "monkfish" -active = false +active = true catalog_number = 603 collection_group = &"Coastal oddities" logbook_fact = "monkfish hide against the bottom and wave a fleshy lure above a cavernous mouth. a sudden gulp draws fish and crustaceans inward." +available_seasons = 13 allowed_water_types = 2 rarity = 2 base_catch_weight = 0.25 @@ -27,3 +29,4 @@ weight_max_lb = 55.0 sell_value_min = 14 sell_value_max = 35 sell_value_curve = 0.84 +display_texture = ExtResource("99_fish_placeholder") diff --git a/fish/species/mooneye/mooneye.tres b/fish/species/mooneye/mooneye.tres index e663618..3dff8a1 100644 --- a/fish/species/mooneye/mooneye.tres +++ b/fish/species/mooneye/mooneye.tres @@ -1,8 +1,9 @@ -[gd_resource type="Resource" script_class="FishData" load_steps=4 format=3] +[gd_resource type="Resource" script_class="FishData" load_steps=5 format=3] [ext_resource type="Script" path="res://fish/fish_data.gd" id="1_fish_data"] [ext_resource type="Resource" path="res://fishing/common_catch_profile.tres" id="2_profile"] [ext_resource type="Script" path="res://fish/fish_availability.gd" id="3_availability"] +[ext_resource type="Texture2D" path="res://art/exported/creatures/fish_placeholder.png" id="99_fish_placeholder"] [sub_resource type="Resource" id="Availability"] script = ExtResource("3_availability") @@ -12,10 +13,11 @@ allow_day = false script = ExtResource("1_fish_data") id = &"mooneye" display_name = "mooneye" -active = false +active = true catalog_number = 2904 collection_group = &"Freshwater oddities" logbook_fact = "mooneyes flash silver in clear rivers and lakes while feeding near the surface. their large eyes suit evening hunts for insects and small fish." +available_seasons = 13 allowed_water_types = 1 rarity = 1 base_catch_weight = 0.85 @@ -26,3 +28,4 @@ weight_max_lb = 4.0 sell_value_min = 5 sell_value_max = 11 sell_value_curve = 0.92 +display_texture = ExtResource("99_fish_placeholder") diff --git a/fish/species/moray_green/moray_green.tres b/fish/species/moray_green/moray_green.tres index 36aee31..e0d49ae 100644 --- a/fish/species/moray_green/moray_green.tres +++ b/fish/species/moray_green/moray_green.tres @@ -1,8 +1,9 @@ -[gd_resource type="Resource" script_class="FishData" load_steps=4 format=3] +[gd_resource type="Resource" script_class="FishData" load_steps=5 format=3] [ext_resource type="Script" path="res://fish/fish_data.gd" id="1_fish_data"] [ext_resource type="Resource" path="res://fishing/common_catch_profile.tres" id="2_profile"] [ext_resource type="Script" path="res://fish/fish_availability.gd" id="3_availability"] +[ext_resource type="Texture2D" path="res://art/exported/creatures/fish_placeholder.png" id="99_fish_placeholder"] [sub_resource type="Resource" id="Availability"] script = ExtResource("3_availability") @@ -12,10 +13,11 @@ allow_day = false script = ExtResource("1_fish_data") id = &"moray_green" display_name = "green moray" -active = false +active = true catalog_number = 5301 collection_group = &"Reef eels" logbook_fact = "green morays appear green because yellow mucus coats blue-gray skin. a second set of jaws pulls captured prey deeper into the throat." +available_seasons = 15 allowed_water_types = 2 rarity = 2 base_catch_weight = 0.28 @@ -26,3 +28,4 @@ weight_max_lb = 30.0 sell_value_min = 13 sell_value_max = 32 sell_value_curve = 0.86 +display_texture = ExtResource("99_fish_placeholder") diff --git a/fish/species/mudskipper_atlantic/mudskipper_atlantic.tres b/fish/species/mudskipper_atlantic/mudskipper_atlantic.tres index f548d93..7df958a 100644 --- a/fish/species/mudskipper_atlantic/mudskipper_atlantic.tres +++ b/fish/species/mudskipper_atlantic/mudskipper_atlantic.tres @@ -1,8 +1,9 @@ -[gd_resource type="Resource" script_class="FishData" load_steps=4 format=3] +[gd_resource type="Resource" script_class="FishData" load_steps=5 format=3] [ext_resource type="Script" path="res://fish/fish_data.gd" id="1_fish_data"] [ext_resource type="Resource" path="res://fishing/common_catch_profile.tres" id="2_profile"] [ext_resource type="Script" path="res://fish/fish_availability.gd" id="3_availability"] +[ext_resource type="Texture2D" path="res://art/exported/creatures/201.png" id="99_fish_placeholder"] [sub_resource type="Resource" id="Availability"] script = ExtResource("3_availability") @@ -13,10 +14,11 @@ require_rain = true script = ExtResource("1_fish_data") id = &"mudskipper_atlantic" display_name = "atlantic mudskipper" -active = false +active = true catalog_number = 201 collection_group = &"Brackish oddities" logbook_fact = "atlantic mudskippers use sturdy fins to hop and crawl across exposed mud. moist skin and mouth linings let them breathe out of water." +available_seasons = 15 allowed_water_types = 2 rarity = 1 base_catch_weight = 1.0 @@ -27,3 +29,4 @@ weight_max_lb = 0.5 sell_value_min = 5 sell_value_max = 11 sell_value_curve = 0.95 +display_texture = ExtResource("99_fish_placeholder") diff --git a/fish/species/mullet_red/mullet_red.tres b/fish/species/mullet_red/mullet_red.tres index 3b2a878..67a35fa 100644 --- a/fish/species/mullet_red/mullet_red.tres +++ b/fish/species/mullet_red/mullet_red.tres @@ -1,8 +1,9 @@ -[gd_resource type="Resource" script_class="FishData" load_steps=4 format=3] +[gd_resource type="Resource" script_class="FishData" load_steps=5 format=3] [ext_resource type="Script" path="res://fish/fish_data.gd" id="1_fish_data"] [ext_resource type="Resource" path="res://fishing/common_catch_profile.tres" id="2_profile"] [ext_resource type="Script" path="res://fish/fish_availability.gd" id="3_availability"] +[ext_resource type="Texture2D" path="res://art/exported/creatures/fish_placeholder.png" id="99_fish_placeholder"] [sub_resource type="Resource" id="Availability"] script = ExtResource("3_availability") @@ -12,10 +13,11 @@ allow_night = false script = ExtResource("1_fish_data") id = &"mullet_red" display_name = "red mullet" -active = false +active = true catalog_number = 301 collection_group = &"Coastal bottom fish" logbook_fact = "red mullet comb sandy bottoms with two chin barbels that taste hidden prey. their foraging leaves winding trails in the sediment." +available_seasons = 7 allowed_water_types = 2 rarity = 1 base_catch_weight = 0.9 @@ -26,3 +28,4 @@ weight_max_lb = 3.0 sell_value_min = 5 sell_value_max = 11 sell_value_curve = 0.92 +display_texture = ExtResource("99_fish_placeholder") diff --git a/fish/species/mullet_striped/mullet_striped.tres b/fish/species/mullet_striped/mullet_striped.tres index 7d75d6b..a285ee7 100644 --- a/fish/species/mullet_striped/mullet_striped.tres +++ b/fish/species/mullet_striped/mullet_striped.tres @@ -1,8 +1,9 @@ -[gd_resource type="Resource" script_class="FishData" load_steps=4 format=3] +[gd_resource type="Resource" script_class="FishData" load_steps=5 format=3] [ext_resource type="Script" path="res://fish/fish_data.gd" id="1_fish_data"] [ext_resource type="Resource" path="res://fishing/common_catch_profile.tres" id="2_profile"] [ext_resource type="Script" path="res://fish/fish_availability.gd" id="3_availability"] +[ext_resource type="Texture2D" path="res://art/exported/creatures/6804.png" id="99_fish_placeholder"] [sub_resource type="Resource" id="Availability"] script = ExtResource("3_availability") @@ -12,10 +13,11 @@ allow_night = false script = ExtResource("1_fish_data") id = &"mullet_striped" display_name = "striped mullet" -active = false +active = true catalog_number = 6804 collection_group = &"Temperate estuary" logbook_fact = "striped mullet leap clear of the water and travel in coastal schools. they graze algae and detritus with specialized digestive systems." +available_seasons = 7 allowed_water_types = 3 rarity = 0 base_catch_weight = 2.5 @@ -26,3 +28,4 @@ weight_max_lb = 8.0 sell_value_min = 3 sell_value_max = 8 sell_value_curve = 0.92 +display_texture = ExtResource("99_fish_placeholder") diff --git a/fish/species/muskellunge/muskellunge.tres b/fish/species/muskellunge/muskellunge.tres index 84c8513..e747d07 100644 --- a/fish/species/muskellunge/muskellunge.tres +++ b/fish/species/muskellunge/muskellunge.tres @@ -1,8 +1,9 @@ -[gd_resource type="Resource" script_class="FishData" load_steps=4 format=3] +[gd_resource type="Resource" script_class="FishData" load_steps=5 format=3] [ext_resource type="Script" path="res://fish/fish_data.gd" id="1_fish_data"] [ext_resource type="Resource" path="res://fishing/common_catch_profile.tres" id="2_profile"] [ext_resource type="Script" path="res://fish/fish_availability.gd" id="3_availability"] +[ext_resource type="Texture2D" path="res://art/exported/creatures/fish_placeholder.png" id="99_fish_placeholder"] [sub_resource type="Resource" id="Availability"] script = ExtResource("3_availability") @@ -13,10 +14,11 @@ require_fog = true script = ExtResource("1_fish_data") id = &"muskellunge" display_name = "muskellunge" -active = false +active = true catalog_number = 2704 collection_group = &"Freshwater giants" logbook_fact = "muskellunge wait motionless among weeds before exploding toward prey. pale bodies carry bars or spots that fade into broken underwater light." +available_seasons = 13 allowed_water_types = 1 rarity = 3 base_catch_weight = 0.11 @@ -27,3 +29,4 @@ weight_max_lb = 60.0 sell_value_min = 32 sell_value_max = 72 sell_value_curve = 0.82 +display_texture = ExtResource("99_fish_placeholder") diff --git a/fish/species/nautilus_chambered/nautilus_chambered.tres b/fish/species/nautilus_chambered/nautilus_chambered.tres index fd6189c..562f16b 100644 --- a/fish/species/nautilus_chambered/nautilus_chambered.tres +++ b/fish/species/nautilus_chambered/nautilus_chambered.tres @@ -1,8 +1,9 @@ -[gd_resource type="Resource" script_class="FishData" load_steps=4 format=3] +[gd_resource type="Resource" script_class="FishData" load_steps=5 format=3] [ext_resource type="Script" path="res://fish/fish_data.gd" id="1_fish_data"] [ext_resource type="Resource" path="res://fishing/common_catch_profile.tres" id="2_profile"] [ext_resource type="Script" path="res://fish/fish_availability.gd" id="3_availability"] +[ext_resource type="Texture2D" path="res://art/exported/creatures/fish_placeholder.png" id="99_fish_placeholder"] [sub_resource type="Resource" id="Availability"] script = ExtResource("3_availability") @@ -13,10 +14,11 @@ require_fog = true script = ExtResource("1_fish_data") id = &"nautilus_chambered" display_name = "chambered nautilus" -active = false +active = true catalog_number = 1501 collection_group = &"Cuttlefish and nautiluses" logbook_fact = "chambered nautiluses regulate buoyancy with gas-filled shell chambers. dozens of small tentacles feel for food in dark reef slopes." +available_seasons = 15 allowed_water_types = 2 rarity = 4 base_catch_weight = 0.05 @@ -27,3 +29,4 @@ weight_max_lb = 3.0 sell_value_min = 34 sell_value_max = 76 sell_value_curve = 0.92 +display_texture = ExtResource("99_fish_placeholder") diff --git a/fish/species/needlefish_hound/needlefish_hound.tres b/fish/species/needlefish_hound/needlefish_hound.tres index ecb8226..5d97670 100644 --- a/fish/species/needlefish_hound/needlefish_hound.tres +++ b/fish/species/needlefish_hound/needlefish_hound.tres @@ -1,8 +1,9 @@ -[gd_resource type="Resource" script_class="FishData" load_steps=4 format=3] +[gd_resource type="Resource" script_class="FishData" load_steps=5 format=3] [ext_resource type="Script" path="res://fish/fish_data.gd" id="1_fish_data"] [ext_resource type="Resource" path="res://fishing/common_catch_profile.tres" id="2_profile"] [ext_resource type="Script" path="res://fish/fish_availability.gd" id="3_availability"] +[ext_resource type="Texture2D" path="res://art/exported/creatures/fish_placeholder.png" id="99_fish_placeholder"] [sub_resource type="Resource" id="Availability"] script = ExtResource("3_availability") @@ -12,10 +13,11 @@ allow_night = false script = ExtResource("1_fish_data") id = &"needlefish_hound" display_name = "houndfish" -active = false +active = true catalog_number = 6602 collection_group = &"Surface ocean fish" logbook_fact = "houndfish hunt near the surface with long jaws filled with fine teeth. powerful leaps can carry their narrow bodies far above the water." +available_seasons = 15 allowed_water_types = 2 rarity = 2 base_catch_weight = 0.3 @@ -26,3 +28,4 @@ weight_max_lb = 10.0 sell_value_min = 11 sell_value_max = 25 sell_value_curve = 0.88 +display_texture = ExtResource("99_fish_placeholder") diff --git a/fish/species/oarfish_giant/oarfish_giant.tres b/fish/species/oarfish_giant/oarfish_giant.tres index f34adcc..2bcd4ab 100644 --- a/fish/species/oarfish_giant/oarfish_giant.tres +++ b/fish/species/oarfish_giant/oarfish_giant.tres @@ -1,8 +1,9 @@ -[gd_resource type="Resource" script_class="FishData" load_steps=4 format=3] +[gd_resource type="Resource" script_class="FishData" load_steps=5 format=3] [ext_resource type="Script" path="res://fish/fish_data.gd" id="1_fish_data"] [ext_resource type="Resource" path="res://fishing/common_catch_profile.tres" id="2_profile"] [ext_resource type="Script" path="res://fish/fish_availability.gd" id="3_availability"] +[ext_resource type="Texture2D" path="res://art/exported/creatures/fish_placeholder.png" id="99_fish_placeholder"] [sub_resource type="Resource" id="Availability"] script = ExtResource("3_availability") @@ -13,10 +14,11 @@ require_fog = true script = ExtResource("1_fish_data") id = &"oarfish_giant" display_name = "giant oarfish" -active = false +active = true catalog_number = 1701 collection_group = &"Deep-sea legends" logbook_fact = "giant oarfish drift vertically through deep open water, rowing with a crimson dorsal fin. their ribbon-like bodies can reach remarkable lengths." +available_seasons = 15 allowed_water_types = 2 rarity = 4 base_catch_weight = 0.035 @@ -27,3 +29,4 @@ weight_max_lb = 600.0 sell_value_min = 60 sell_value_max = 140 sell_value_curve = 0.78 +display_texture = ExtResource("99_fish_placeholder") diff --git a/fish/species/ocean_perch_pacific/ocean_perch_pacific.tres b/fish/species/ocean_perch_pacific/ocean_perch_pacific.tres index a7f9873..6b0cdcc 100644 --- a/fish/species/ocean_perch_pacific/ocean_perch_pacific.tres +++ b/fish/species/ocean_perch_pacific/ocean_perch_pacific.tres @@ -1,8 +1,9 @@ -[gd_resource type="Resource" script_class="FishData" load_steps=4 format=3] +[gd_resource type="Resource" script_class="FishData" load_steps=5 format=3] [ext_resource type="Script" path="res://fish/fish_data.gd" id="1_fish_data"] [ext_resource type="Resource" path="res://fishing/common_catch_profile.tres" id="2_profile"] [ext_resource type="Script" path="res://fish/fish_availability.gd" id="3_availability"] +[ext_resource type="Texture2D" path="res://art/exported/creatures/fish_placeholder.png" id="99_fish_placeholder"] [sub_resource type="Resource" id="Availability"] script = ExtResource("3_availability") @@ -11,10 +12,11 @@ script = ExtResource("3_availability") script = ExtResource("1_fish_data") id = &"ocean_perch_pacific" display_name = "Pacific ocean perch" -active = false +active = true catalog_number = 1603 collection_group = &"Deep shelf fish" logbook_fact = "pacific ocean perch hover around deep rocky reefs in the north pacific. these slow-growing fish give birth to live young." +available_seasons = 15 allowed_water_types = 2 rarity = 1 base_catch_weight = 0.8 @@ -25,3 +27,4 @@ weight_max_lb = 12.0 sell_value_min = 7 sell_value_max = 17 sell_value_curve = 0.88 +display_texture = ExtResource("99_fish_placeholder") diff --git a/fish/species/octopus_common/octopus_common.tres b/fish/species/octopus_common/octopus_common.tres index b86950e..e379010 100644 --- a/fish/species/octopus_common/octopus_common.tres +++ b/fish/species/octopus_common/octopus_common.tres @@ -1,8 +1,9 @@ -[gd_resource type="Resource" script_class="FishData" load_steps=4 format=3] +[gd_resource type="Resource" script_class="FishData" load_steps=5 format=3] [ext_resource type="Script" path="res://fish/fish_data.gd" id="1_fish_data"] [ext_resource type="Resource" path="res://fishing/common_catch_profile.tres" id="2_profile"] [ext_resource type="Script" path="res://fish/fish_availability.gd" id="3_availability"] +[ext_resource type="Texture2D" path="res://art/exported/creatures/fish_placeholder.png" id="99_fish_placeholder"] [sub_resource type="Resource" id="Availability"] script = ExtResource("3_availability") @@ -12,10 +13,11 @@ allow_day = false script = ExtResource("1_fish_data") id = &"octopus_common" display_name = "common octopus" -active = false +active = true catalog_number = 4901 collection_group = &"Octopuses" logbook_fact = "common octopuses squeeze through narrow cracks and solve problems while hunting reefs. skin cells rapidly change color and texture." +available_seasons = 15 allowed_water_types = 2 rarity = 1 base_catch_weight = 0.65 @@ -26,3 +28,4 @@ weight_max_lb = 22.0 sell_value_min = 7 sell_value_max = 18 sell_value_curve = 0.87 +display_texture = ExtResource("99_fish_placeholder") diff --git a/fish/species/octopus_day/octopus_day.tres b/fish/species/octopus_day/octopus_day.tres index aada4c1..4384f38 100644 --- a/fish/species/octopus_day/octopus_day.tres +++ b/fish/species/octopus_day/octopus_day.tres @@ -1,8 +1,9 @@ -[gd_resource type="Resource" script_class="FishData" load_steps=4 format=3] +[gd_resource type="Resource" script_class="FishData" load_steps=5 format=3] [ext_resource type="Script" path="res://fish/fish_data.gd" id="1_fish_data"] [ext_resource type="Resource" path="res://fishing/common_catch_profile.tres" id="2_profile"] [ext_resource type="Script" path="res://fish/fish_availability.gd" id="3_availability"] +[ext_resource type="Texture2D" path="res://art/exported/creatures/fish_placeholder.png" id="99_fish_placeholder"] [sub_resource type="Resource" id="Availability"] script = ExtResource("3_availability") @@ -13,10 +14,11 @@ forbid_fog = true script = ExtResource("1_fish_data") id = &"octopus_day" display_name = "day octopus" -active = false +active = true catalog_number = 4902 collection_group = &"Octopuses" logbook_fact = "day octopuses forage across tropical reefs while the sun is high. shifting bars and spots communicate alarm, camouflage, and threat." +available_seasons = 15 allowed_water_types = 2 rarity = 2 base_catch_weight = 0.24 @@ -27,3 +29,4 @@ weight_max_lb = 15.0 sell_value_min = 15 sell_value_max = 36 sell_value_curve = 0.88 +display_texture = ExtResource("99_fish_placeholder") diff --git a/fish/species/octopus_giant_pacific/octopus_giant_pacific.tres b/fish/species/octopus_giant_pacific/octopus_giant_pacific.tres index 09aca6d..1091088 100644 --- a/fish/species/octopus_giant_pacific/octopus_giant_pacific.tres +++ b/fish/species/octopus_giant_pacific/octopus_giant_pacific.tres @@ -1,8 +1,9 @@ -[gd_resource type="Resource" script_class="FishData" load_steps=4 format=3] +[gd_resource type="Resource" script_class="FishData" load_steps=5 format=3] [ext_resource type="Script" path="res://fish/fish_data.gd" id="1_fish_data"] [ext_resource type="Resource" path="res://fishing/common_catch_profile.tres" id="2_profile"] [ext_resource type="Script" path="res://fish/fish_availability.gd" id="3_availability"] +[ext_resource type="Texture2D" path="res://art/exported/creatures/fish_placeholder.png" id="99_fish_placeholder"] [sub_resource type="Resource" id="Availability"] script = ExtResource("3_availability") @@ -13,10 +14,11 @@ require_fog = true script = ExtResource("1_fish_data") id = &"octopus_giant_pacific" display_name = "giant Pacific octopus" -active = false +active = true catalog_number = 4903 collection_group = &"Octopuses" logbook_fact = "giant pacific octopuses explore cold rocky dens with thousands of arm suckers. females guard their eggs without feeding until they hatch." +available_seasons = 15 allowed_water_types = 2 rarity = 3 base_catch_weight = 0.1 @@ -27,3 +29,4 @@ weight_max_lb = 200.0 sell_value_min = 28 sell_value_max = 70 sell_value_curve = 0.81 +display_texture = ExtResource("99_fish_placeholder") diff --git a/fish/species/octopus_greater_blue_ringed/octopus_greater_blue_ringed.tres b/fish/species/octopus_greater_blue_ringed/octopus_greater_blue_ringed.tres index a59bd06..f2a21d9 100644 --- a/fish/species/octopus_greater_blue_ringed/octopus_greater_blue_ringed.tres +++ b/fish/species/octopus_greater_blue_ringed/octopus_greater_blue_ringed.tres @@ -1,8 +1,9 @@ -[gd_resource type="Resource" script_class="FishData" load_steps=4 format=3] +[gd_resource type="Resource" script_class="FishData" load_steps=5 format=3] [ext_resource type="Script" path="res://fish/fish_data.gd" id="1_fish_data"] [ext_resource type="Resource" path="res://fishing/common_catch_profile.tres" id="2_profile"] [ext_resource type="Script" path="res://fish/fish_availability.gd" id="3_availability"] +[ext_resource type="Texture2D" path="res://art/exported/creatures/fish_placeholder.png" id="99_fish_placeholder"] [sub_resource type="Resource" id="Availability"] script = ExtResource("3_availability") @@ -13,10 +14,11 @@ require_rain = true script = ExtResource("1_fish_data") id = &"octopus_greater_blue_ringed" display_name = "greater blue-ringed octopus" -active = false +active = true catalog_number = 4904 collection_group = &"Octopuses" logbook_fact = "greater blue-ringed octopuses reveal vivid rings when threatened. a tiny beak can deliver venom strong enough to stop breathing." +available_seasons = 15 allowed_water_types = 2 rarity = 4 base_catch_weight = 0.04 @@ -27,3 +29,4 @@ weight_max_lb = 0.3 sell_value_min = 38 sell_value_max = 82 sell_value_curve = 0.96 +display_texture = ExtResource("99_fish_placeholder") diff --git a/fish/species/opah/opah.tres b/fish/species/opah/opah.tres index 2bb4231..f9b202a 100644 --- a/fish/species/opah/opah.tres +++ b/fish/species/opah/opah.tres @@ -1,8 +1,9 @@ -[gd_resource type="Resource" script_class="FishData" load_steps=4 format=3] +[gd_resource type="Resource" script_class="FishData" load_steps=5 format=3] [ext_resource type="Script" path="res://fish/fish_data.gd" id="1_fish_data"] [ext_resource type="Resource" path="res://fishing/common_catch_profile.tres" id="2_profile"] [ext_resource type="Script" path="res://fish/fish_availability.gd" id="3_availability"] +[ext_resource type="Texture2D" path="res://art/exported/creatures/fish_placeholder.png" id="99_fish_placeholder"] [sub_resource type="Resource" id="Availability"] script = ExtResource("3_availability") @@ -13,10 +14,11 @@ forbid_fog = true script = ExtResource("1_fish_data") id = &"opah" display_name = "opah" -active = false +active = true catalog_number = 4702 collection_group = &"Oceanic pelagic fish" logbook_fact = "opah circulate warm blood through much of the body, an unusual trait among fish. round silver flanks glow with red fins and pale spots." +available_seasons = 6 allowed_water_types = 2 rarity = 3 base_catch_weight = 0.09 @@ -27,3 +29,4 @@ weight_max_lb = 600.0 sell_value_min = 36 sell_value_max = 88 sell_value_curve = 0.8 +display_texture = ExtResource("99_fish_placeholder") diff --git a/fish/species/oscar/oscar.tres b/fish/species/oscar/oscar.tres index d3da024..8e780cb 100644 --- a/fish/species/oscar/oscar.tres +++ b/fish/species/oscar/oscar.tres @@ -1,8 +1,9 @@ -[gd_resource type="Resource" script_class="FishData" load_steps=4 format=3] +[gd_resource type="Resource" script_class="FishData" load_steps=5 format=3] [ext_resource type="Script" path="res://fish/fish_data.gd" id="1_fish_data"] [ext_resource type="Resource" path="res://fishing/common_catch_profile.tres" id="2_profile"] [ext_resource type="Script" path="res://fish/fish_availability.gd" id="3_availability"] +[ext_resource type="Texture2D" path="res://art/exported/creatures/fish_placeholder.png" id="99_fish_placeholder"] [sub_resource type="Resource" id="Availability"] script = ExtResource("3_availability") @@ -12,10 +13,11 @@ allow_night = false script = ExtResource("1_fish_data") id = &"oscar" display_name = "oscar" -active = false +active = true catalog_number = 7507 collection_group = &"Tropical freshwater fish" logbook_fact = "oscars are large south american cichlids that recognize routines and defend territories. a tail eyespot may redirect attacks away from the head." +available_seasons = 15 allowed_water_types = 1 rarity = 1 base_catch_weight = 0.8 @@ -26,3 +28,4 @@ weight_max_lb = 4.0 sell_value_min = 6 sell_value_max = 14 sell_value_curve = 0.9 +display_texture = ExtResource("99_fish_placeholder") diff --git a/fish/species/oyster_black_lip_pearl/oyster_black_lip_pearl.tres b/fish/species/oyster_black_lip_pearl/oyster_black_lip_pearl.tres index cc95d74..776218d 100644 --- a/fish/species/oyster_black_lip_pearl/oyster_black_lip_pearl.tres +++ b/fish/species/oyster_black_lip_pearl/oyster_black_lip_pearl.tres @@ -1,8 +1,9 @@ -[gd_resource type="Resource" script_class="FishData" load_steps=4 format=3] +[gd_resource type="Resource" script_class="FishData" load_steps=5 format=3] [ext_resource type="Script" path="res://fish/fish_data.gd" id="1_fish_data"] [ext_resource type="Resource" path="res://fishing/common_catch_profile.tres" id="2_profile"] [ext_resource type="Script" path="res://fish/fish_availability.gd" id="3_availability"] +[ext_resource type="Texture2D" path="res://art/exported/creatures/fish_placeholder.png" id="99_fish_placeholder"] [sub_resource type="Resource" id="Availability"] script = ExtResource("3_availability") @@ -12,10 +13,11 @@ allow_night = false script = ExtResource("1_fish_data") id = &"oyster_black_lip_pearl" display_name = "black-lip pearl oyster" -active = false +active = true catalog_number = 6401 collection_group = &"Shellfish" logbook_fact = "black-lip pearl oysters line their shells with dark-edged nacre. a trapped irritant can become coated in the same pearly material." +available_seasons = 15 allowed_water_types = 2 rarity = 2 base_catch_weight = 0.22 @@ -26,3 +28,4 @@ weight_max_lb = 5.0 sell_value_min = 14 sell_value_max = 40 sell_value_curve = 0.91 +display_texture = ExtResource("99_fish_placeholder") diff --git a/fish/species/paddlefish/paddlefish.png b/fish/species/paddlefish/paddlefish.png new file mode 100644 index 0000000..4a564d2 Binary files /dev/null and b/fish/species/paddlefish/paddlefish.png differ diff --git a/items/icons/shop/64_speed_plus.png.import b/fish/species/paddlefish/paddlefish.png.import similarity index 73% rename from items/icons/shop/64_speed_plus.png.import rename to fish/species/paddlefish/paddlefish.png.import index 6d330de..543fc80 100644 --- a/items/icons/shop/64_speed_plus.png.import +++ b/fish/species/paddlefish/paddlefish.png.import @@ -2,16 +2,16 @@ importer="texture" type="CompressedTexture2D" -uid="uid://dk6yx5cbpblo6" -path="res://.godot/imported/64_speed_plus.png-c695fb4021c17dfa94ed7aa48ce262c1.ctex" +uid="uid://djnsidpdhgay5" +path="res://.godot/imported/paddlefish.png-396db174ea9cb0a42741f573e0ac5be3.ctex" metadata={ "vram_texture": false } [deps] -source_file="res://items/icons/shop/64_speed_plus.png" -dest_files=["res://.godot/imported/64_speed_plus.png-c695fb4021c17dfa94ed7aa48ce262c1.ctex"] +source_file="res://fish/species/paddlefish/paddlefish.png" +dest_files=["res://.godot/imported/paddlefish.png-396db174ea9cb0a42741f573e0ac5be3.ctex"] [params] diff --git a/fish/species/paddlefish/paddlefish.tres b/fish/species/paddlefish/paddlefish.tres index c9d4925..498730b 100644 --- a/fish/species/paddlefish/paddlefish.tres +++ b/fish/species/paddlefish/paddlefish.tres @@ -1,8 +1,9 @@ -[gd_resource type="Resource" script_class="FishData" load_steps=4 format=3] +[gd_resource type="Resource" script_class="FishData" load_steps=5 format=3] [ext_resource type="Script" path="res://fish/fish_data.gd" id="1_fish_data"] [ext_resource type="Resource" path="res://fishing/common_catch_profile.tres" id="2_profile"] [ext_resource type="Script" path="res://fish/fish_availability.gd" id="3_availability"] +[ext_resource type="Texture2D" path="res://art/exported/creatures/104.png" id="4_texture"] [sub_resource type="Resource" id="Availability"] script = ExtResource("3_availability") @@ -13,10 +14,11 @@ require_rain = true script = ExtResource("1_fish_data") id = &"paddlefish" display_name = "paddlefish" -active = false +active = true catalog_number = 104 collection_group = &"Ancient freshwater fish" logbook_fact = "paddlefish cruise open rivers with their mouths wide, filtering tiny plankton from the water. the broad snout senses faint electrical signals." +available_seasons = 3 allowed_water_types = 1 rarity = 3 base_catch_weight = 0.1 @@ -27,3 +29,4 @@ weight_max_lb = 120.0 sell_value_min = 34 sell_value_max = 76 sell_value_curve = 0.82 +display_texture = ExtResource("4_texture") diff --git a/fish/species/parrotfish_rainbow/parrotfish_rainbow.tres b/fish/species/parrotfish_rainbow/parrotfish_rainbow.tres index 3320b61..c0b0dc2 100644 --- a/fish/species/parrotfish_rainbow/parrotfish_rainbow.tres +++ b/fish/species/parrotfish_rainbow/parrotfish_rainbow.tres @@ -1,8 +1,9 @@ -[gd_resource type="Resource" script_class="FishData" load_steps=4 format=3] +[gd_resource type="Resource" script_class="FishData" load_steps=5 format=3] [ext_resource type="Script" path="res://fish/fish_data.gd" id="1_fish_data"] [ext_resource type="Resource" path="res://fishing/common_catch_profile.tres" id="2_profile"] [ext_resource type="Script" path="res://fish/fish_availability.gd" id="3_availability"] +[ext_resource type="Texture2D" path="res://art/exported/creatures/fish_placeholder.png" id="99_fish_placeholder"] [sub_resource type="Resource" id="Availability"] script = ExtResource("3_availability") @@ -12,10 +13,11 @@ allow_night = false script = ExtResource("1_fish_data") id = &"parrotfish_rainbow" display_name = "rainbow parrotfish" -active = false +active = true catalog_number = 5502 collection_group = &"Reef grazers" logbook_fact = "rainbow parrotfish scrape algae from reefs with fused beak-like teeth. crushed coral passes through them and returns to the reef as sand." +available_seasons = 15 allowed_water_types = 2 rarity = 3 base_catch_weight = 0.12 @@ -26,3 +28,4 @@ weight_max_lb = 40.0 sell_value_min = 25 sell_value_max = 58 sell_value_curve = 0.84 +display_texture = ExtResource("99_fish_placeholder") diff --git a/fish/species/parrotfish_stoplight/parrotfish_stoplight.tres b/fish/species/parrotfish_stoplight/parrotfish_stoplight.tres index 2392e88..50962f4 100644 --- a/fish/species/parrotfish_stoplight/parrotfish_stoplight.tres +++ b/fish/species/parrotfish_stoplight/parrotfish_stoplight.tres @@ -1,8 +1,9 @@ -[gd_resource type="Resource" script_class="FishData" load_steps=4 format=3] +[gd_resource type="Resource" script_class="FishData" load_steps=5 format=3] [ext_resource type="Script" path="res://fish/fish_data.gd" id="1_fish_data"] [ext_resource type="Resource" path="res://fishing/common_catch_profile.tres" id="2_profile"] [ext_resource type="Script" path="res://fish/fish_availability.gd" id="3_availability"] +[ext_resource type="Texture2D" path="res://art/exported/creatures/fish_placeholder.png" id="99_fish_placeholder"] [sub_resource type="Resource" id="Availability"] script = ExtResource("3_availability") @@ -12,10 +13,11 @@ allow_night = false script = ExtResource("1_fish_data") id = &"parrotfish_stoplight" display_name = "stoplight parrotfish" -active = false +active = true catalog_number = 5503 collection_group = &"Reef grazers" logbook_fact = "stoplight parrotfish change color dramatically as they mature. powerful dental plates bite algae from hard reef surfaces." +available_seasons = 15 allowed_water_types = 2 rarity = 2 base_catch_weight = 0.28 @@ -26,3 +28,4 @@ weight_max_lb = 15.0 sell_value_min = 12 sell_value_max = 29 sell_value_curve = 0.88 +display_texture = ExtResource("99_fish_placeholder") diff --git a/fish/species/peacock_bass/peacock_bass.tres b/fish/species/peacock_bass/peacock_bass.tres index 39487fe..7cfbb5d 100644 --- a/fish/species/peacock_bass/peacock_bass.tres +++ b/fish/species/peacock_bass/peacock_bass.tres @@ -1,8 +1,9 @@ -[gd_resource type="Resource" script_class="FishData" load_steps=4 format=3] +[gd_resource type="Resource" script_class="FishData" load_steps=5 format=3] [ext_resource type="Script" path="res://fish/fish_data.gd" id="1_fish_data"] [ext_resource type="Resource" path="res://fishing/common_catch_profile.tres" id="2_profile"] [ext_resource type="Script" path="res://fish/fish_availability.gd" id="3_availability"] +[ext_resource type="Texture2D" path="res://art/exported/creatures/fish_placeholder.png" id="99_fish_placeholder"] [sub_resource type="Resource" id="Availability"] script = ExtResource("3_availability") @@ -12,10 +13,11 @@ allow_night = false script = ExtResource("1_fish_data") id = &"peacock_bass" display_name = "peacock bass" -active = false +active = true catalog_number = 7604 collection_group = &"Tropical freshwater predators" logbook_fact = "peacock bass are aggressive south american cichlids rather than true bass. adults guard nests and hunt fish in warm clear water." +available_seasons = 15 allowed_water_types = 1 rarity = 2 base_catch_weight = 0.25 @@ -26,3 +28,4 @@ weight_max_lb = 25.0 sell_value_min = 15 sell_value_max = 36 sell_value_curve = 0.84 +display_texture = ExtResource("99_fish_placeholder") diff --git a/fish/species/permit/permit.tres b/fish/species/permit/permit.tres index bd36724..f58283c 100644 --- a/fish/species/permit/permit.tres +++ b/fish/species/permit/permit.tres @@ -1,8 +1,9 @@ -[gd_resource type="Resource" script_class="FishData" load_steps=4 format=3] +[gd_resource type="Resource" script_class="FishData" load_steps=5 format=3] [ext_resource type="Script" path="res://fish/fish_data.gd" id="1_fish_data"] [ext_resource type="Resource" path="res://fishing/common_catch_profile.tres" id="2_profile"] [ext_resource type="Script" path="res://fish/fish_availability.gd" id="3_availability"] +[ext_resource type="Texture2D" path="res://art/exported/creatures/fish_placeholder.png" id="99_fish_placeholder"] [sub_resource type="Resource" id="Availability"] script = ExtResource("3_availability") @@ -13,10 +14,11 @@ forbid_rain = true script = ExtResource("1_fish_data") id = &"permit" display_name = "permit" -active = false +active = true catalog_number = 7404 collection_group = &"Tropical flats fish" logbook_fact = "permit browse tropical flats for crabs and shellfish with rubbery mouths. tall silver bodies carry long sickle-shaped dorsal and anal fins." +available_seasons = 15 allowed_water_types = 2 rarity = 3 base_catch_weight = 0.11 @@ -27,3 +29,4 @@ weight_max_lb = 50.0 sell_value_min = 27 sell_value_max = 62 sell_value_curve = 0.84 +display_texture = ExtResource("99_fish_placeholder") diff --git a/fish/species/pickerel_chain/pickerel_chain.tres b/fish/species/pickerel_chain/pickerel_chain.tres index f69ab5f..db02b7f 100644 --- a/fish/species/pickerel_chain/pickerel_chain.tres +++ b/fish/species/pickerel_chain/pickerel_chain.tres @@ -1,8 +1,9 @@ -[gd_resource type="Resource" script_class="FishData" load_steps=4 format=3] +[gd_resource type="Resource" script_class="FishData" load_steps=5 format=3] [ext_resource type="Script" path="res://fish/fish_data.gd" id="1_fish_data"] [ext_resource type="Resource" path="res://fishing/common_catch_profile.tres" id="2_profile"] [ext_resource type="Script" path="res://fish/fish_availability.gd" id="3_availability"] +[ext_resource type="Texture2D" path="res://art/exported/creatures/fish_placeholder.png" id="99_fish_placeholder"] [sub_resource type="Resource" id="Availability"] script = ExtResource("3_availability") @@ -13,10 +14,11 @@ require_rain = true script = ExtResource("1_fish_data") id = &"pickerel_chain" display_name = "chain pickerel" -active = false +active = true catalog_number = 3301 collection_group = &"Freshwater predators" logbook_fact = "chain pickerel hover among vegetation before darting at fish and frogs. a chain-like pattern breaks up their green flanks." +available_seasons = 13 allowed_water_types = 1 rarity = 1 base_catch_weight = 0.8 @@ -27,3 +29,4 @@ weight_max_lb = 9.0 sell_value_min = 6 sell_value_max = 15 sell_value_curve = 0.9 +display_texture = ExtResource("99_fish_placeholder") diff --git a/fish/species/pickerel_grass/pickerel_grass.tres b/fish/species/pickerel_grass/pickerel_grass.tres index ef59b58..9ef8952 100644 --- a/fish/species/pickerel_grass/pickerel_grass.tres +++ b/fish/species/pickerel_grass/pickerel_grass.tres @@ -1,8 +1,9 @@ -[gd_resource type="Resource" script_class="FishData" load_steps=4 format=3] +[gd_resource type="Resource" script_class="FishData" load_steps=5 format=3] [ext_resource type="Script" path="res://fish/fish_data.gd" id="1_fish_data"] [ext_resource type="Resource" path="res://fishing/common_catch_profile.tres" id="2_profile"] [ext_resource type="Script" path="res://fish/fish_availability.gd" id="3_availability"] +[ext_resource type="Texture2D" path="res://art/exported/creatures/fish_placeholder.png" id="99_fish_placeholder"] [sub_resource type="Resource" id="Availability"] script = ExtResource("3_availability") @@ -12,10 +13,11 @@ allow_night = false script = ExtResource("1_fish_data") id = &"pickerel_grass" display_name = "grass pickerel" -active = false +active = true catalog_number = 3302 collection_group = &"Freshwater predators" logbook_fact = "grass pickerel remain small enough to hunt in narrow, weedy creeks and marshes. dark bars camouflage their slim bodies among stems." +available_seasons = 13 allowed_water_types = 1 rarity = 0 base_catch_weight = 2.1 @@ -26,3 +28,4 @@ weight_max_lb = 1.5 sell_value_min = 2 sell_value_max = 6 sell_value_curve = 0.95 +display_texture = ExtResource("99_fish_placeholder") diff --git a/fish/species/pike_northern/pike_northern.tres b/fish/species/pike_northern/pike_northern.tres index eb4dc5d..05f1ed7 100644 --- a/fish/species/pike_northern/pike_northern.tres +++ b/fish/species/pike_northern/pike_northern.tres @@ -1,8 +1,9 @@ -[gd_resource type="Resource" script_class="FishData" load_steps=4 format=3] +[gd_resource type="Resource" script_class="FishData" load_steps=5 format=3] [ext_resource type="Script" path="res://fish/fish_data.gd" id="1_fish_data"] [ext_resource type="Resource" path="res://fishing/common_catch_profile.tres" id="2_profile"] [ext_resource type="Script" path="res://fish/fish_availability.gd" id="3_availability"] +[ext_resource type="Texture2D" path="res://art/exported/creatures/fish_placeholder.png" id="99_fish_placeholder"] [sub_resource type="Resource" id="Availability"] script = ExtResource("3_availability") @@ -12,10 +13,11 @@ allow_night = false script = ExtResource("1_fish_data") id = &"pike_northern" display_name = "northern pike" -active = false +active = true catalog_number = 3303 collection_group = &"Freshwater predators" logbook_fact = "northern pike are solitary ambush hunters built for sudden acceleration. pale bean-shaped spots cover their long green bodies." +available_seasons = 13 allowed_water_types = 1 rarity = 1 base_catch_weight = 0.75 @@ -26,3 +28,4 @@ weight_max_lb = 30.0 sell_value_min = 8 sell_value_max = 24 sell_value_curve = 0.85 +display_texture = ExtResource("99_fish_placeholder") diff --git a/fish/species/pipefish_bay/pipefish_bay.tres b/fish/species/pipefish_bay/pipefish_bay.tres index f5582c4..0436a8a 100644 --- a/fish/species/pipefish_bay/pipefish_bay.tres +++ b/fish/species/pipefish_bay/pipefish_bay.tres @@ -1,8 +1,9 @@ -[gd_resource type="Resource" script_class="FishData" load_steps=4 format=3] +[gd_resource type="Resource" script_class="FishData" load_steps=5 format=3] [ext_resource type="Script" path="res://fish/fish_data.gd" id="1_fish_data"] [ext_resource type="Resource" path="res://fishing/common_catch_profile.tres" id="2_profile"] [ext_resource type="Script" path="res://fish/fish_availability.gd" id="3_availability"] +[ext_resource type="Texture2D" path="res://art/exported/creatures/fish_placeholder.png" id="99_fish_placeholder"] [sub_resource type="Resource" id="Availability"] script = ExtResource("3_availability") @@ -12,10 +13,11 @@ allow_night = false script = ExtResource("1_fish_data") id = &"pipefish_bay" display_name = "bay pipefish" -active = false +active = true catalog_number = 601 collection_group = &"Coastal oddities" logbook_fact = "bay pipefish hide upright among seagrass, matching the blades with their slender bodies. males carry developing eggs in a brood pouch." +available_seasons = 15 allowed_water_types = 2 rarity = 1 base_catch_weight = 0.9 @@ -26,3 +28,4 @@ weight_max_lb = 0.04 sell_value_min = 4 sell_value_max = 9 sell_value_curve = 1.0 +display_texture = ExtResource("99_fish_placeholder") diff --git a/fish/species/piranha_red_bellied/piranha_red_bellied.tres b/fish/species/piranha_red_bellied/piranha_red_bellied.tres index efca0b8..ebc9fab 100644 --- a/fish/species/piranha_red_bellied/piranha_red_bellied.tres +++ b/fish/species/piranha_red_bellied/piranha_red_bellied.tres @@ -1,8 +1,9 @@ -[gd_resource type="Resource" script_class="FishData" load_steps=4 format=3] +[gd_resource type="Resource" script_class="FishData" load_steps=5 format=3] [ext_resource type="Script" path="res://fish/fish_data.gd" id="1_fish_data"] [ext_resource type="Resource" path="res://fishing/common_catch_profile.tres" id="2_profile"] [ext_resource type="Script" path="res://fish/fish_availability.gd" id="3_availability"] +[ext_resource type="Texture2D" path="res://art/exported/creatures/fish_placeholder.png" id="99_fish_placeholder"] [sub_resource type="Resource" id="Availability"] script = ExtResource("3_availability") @@ -12,10 +13,11 @@ require_rain = true script = ExtResource("1_fish_data") id = &"piranha_red_bellied" display_name = "red-bellied piranha" -active = false +active = true catalog_number = 7605 collection_group = &"Tropical freshwater predators" logbook_fact = "red-bellied piranhas communicate with barks and drum-like sounds. schools provide protection as they search for fish, insects, and carrion." +available_seasons = 15 allowed_water_types = 1 rarity = 2 base_catch_weight = 0.3 @@ -26,3 +28,4 @@ weight_max_lb = 4.0 sell_value_min = 12 sell_value_max = 27 sell_value_curve = 0.9 +display_texture = ExtResource("99_fish_placeholder") diff --git a/fish/species/plaice_european/plaice_european.tres b/fish/species/plaice_european/plaice_european.tres index 9e9be9a..e66f162 100644 --- a/fish/species/plaice_european/plaice_european.tres +++ b/fish/species/plaice_european/plaice_european.tres @@ -1,8 +1,9 @@ -[gd_resource type="Resource" script_class="FishData" load_steps=4 format=3] +[gd_resource type="Resource" script_class="FishData" load_steps=5 format=3] [ext_resource type="Script" path="res://fish/fish_data.gd" id="1_fish_data"] [ext_resource type="Resource" path="res://fishing/common_catch_profile.tres" id="2_profile"] [ext_resource type="Script" path="res://fish/fish_availability.gd" id="3_availability"] +[ext_resource type="Texture2D" path="res://art/exported/creatures/fish_placeholder.png" id="99_fish_placeholder"] [sub_resource type="Resource" id="Availability"] script = ExtResource("3_availability") @@ -12,10 +13,11 @@ allow_night = false script = ExtResource("1_fish_data") id = &"plaice_european" display_name = "European plaice" -active = false +active = true catalog_number = 401 collection_group = &"Coastal flatfish" logbook_fact = "european plaice lie flat on the seafloor with both eyes on the same side. orange spots help distinguish them from neighboring flatfish." +available_seasons = 13 allowed_water_types = 2 rarity = 0 base_catch_weight = 1.8 @@ -26,3 +28,4 @@ weight_max_lb = 10.0 sell_value_min = 4 sell_value_max = 10 sell_value_curve = 0.9 +display_texture = ExtResource("99_fish_placeholder") diff --git a/fish/species/pollock_alaska/pollock_alaska.tres b/fish/species/pollock_alaska/pollock_alaska.tres index 0e4af05..e9add13 100644 --- a/fish/species/pollock_alaska/pollock_alaska.tres +++ b/fish/species/pollock_alaska/pollock_alaska.tres @@ -1,8 +1,9 @@ -[gd_resource type="Resource" script_class="FishData" load_steps=4 format=3] +[gd_resource type="Resource" script_class="FishData" load_steps=5 format=3] [ext_resource type="Script" path="res://fish/fish_data.gd" id="1_fish_data"] [ext_resource type="Resource" path="res://fishing/common_catch_profile.tres" id="2_profile"] [ext_resource type="Script" path="res://fish/fish_availability.gd" id="3_availability"] +[ext_resource type="Texture2D" path="res://art/exported/creatures/fish_placeholder.png" id="99_fish_placeholder"] [sub_resource type="Resource" id="Availability"] script = ExtResource("3_availability") @@ -11,10 +12,11 @@ script = ExtResource("3_availability") script = ExtResource("1_fish_data") id = &"pollock_alaska" display_name = "Alaska pollock" -active = false +active = true catalog_number = 1401 collection_group = &"Cold shelf fish" logbook_fact = "alaska pollock form vast schools over cold northern shelves. they feed on plankton and fish while supporting many larger predators." +available_seasons = 13 allowed_water_types = 2 rarity = 0 base_catch_weight = 2.5 @@ -25,3 +27,4 @@ weight_max_lb = 8.0 sell_value_min = 3 sell_value_max = 8 sell_value_curve = 0.92 +display_texture = ExtResource("99_fish_placeholder") diff --git a/fish/species/pollock_atlantic/pollock_atlantic.tres b/fish/species/pollock_atlantic/pollock_atlantic.tres index 7d50342..494dd23 100644 --- a/fish/species/pollock_atlantic/pollock_atlantic.tres +++ b/fish/species/pollock_atlantic/pollock_atlantic.tres @@ -1,8 +1,9 @@ -[gd_resource type="Resource" script_class="FishData" load_steps=4 format=3] +[gd_resource type="Resource" script_class="FishData" load_steps=5 format=3] [ext_resource type="Script" path="res://fish/fish_data.gd" id="1_fish_data"] [ext_resource type="Resource" path="res://fishing/common_catch_profile.tres" id="2_profile"] [ext_resource type="Script" path="res://fish/fish_availability.gd" id="3_availability"] +[ext_resource type="Texture2D" path="res://art/exported/creatures/fish_placeholder.png" id="99_fish_placeholder"] [sub_resource type="Resource" id="Availability"] script = ExtResource("3_availability") @@ -13,10 +14,11 @@ forbid_fog = true script = ExtResource("1_fish_data") id = &"pollock_atlantic" display_name = "Atlantic pollock" -active = false +active = true catalog_number = 1403 collection_group = &"Cold shelf fish" logbook_fact = "atlantic pollock are swift relatives of cod with dark backs and pale lateral lines. adults gather around rocky banks and wrecks." +available_seasons = 13 allowed_water_types = 2 rarity = 1 base_catch_weight = 0.9 @@ -27,3 +29,4 @@ weight_max_lb = 35.0 sell_value_min = 7 sell_value_max = 18 sell_value_curve = 0.86 +display_texture = ExtResource("99_fish_placeholder") diff --git a/fish/species/pomfret_black/fish_pomfret_black.png b/fish/species/pomfret_black/fish_pomfret_black.png index 14ae878..3fd52d8 100644 Binary files a/fish/species/pomfret_black/fish_pomfret_black.png and b/fish/species/pomfret_black/fish_pomfret_black.png differ diff --git a/fish/species/pomfret_black/pomfret_black.tres b/fish/species/pomfret_black/pomfret_black.tres index d3e73d6..a3c9e54 100644 --- a/fish/species/pomfret_black/pomfret_black.tres +++ b/fish/species/pomfret_black/pomfret_black.tres @@ -3,7 +3,7 @@ [ext_resource type="Script" uid="uid://h7hg45b7wmst" path="res://fish/fish_data.gd" id="1_fish_data"] [ext_resource type="Resource" path="res://fishing/common_catch_profile.tres" id="2_profile"] [ext_resource type="Script" uid="uid://bs7cqi88csolc" path="res://fish/fish_availability.gd" id="3_availability_script"] -[ext_resource type="Texture2D" uid="uid://ch3y6xdo22j1o" path="res://fish/species/pomfret_black/fish_pomfret_black.png" id="4_texture"] +[ext_resource type="Texture2D" path="res://art/exported/creatures/fish_placeholder.png" id="4_texture"] [sub_resource type="Resource" id="PomfretBlackAvailability"] script = ExtResource("3_availability_script") @@ -17,6 +17,7 @@ active = true catalog_number = 803 collection_group = &"Coastal schooling fish" logbook_fact = "black pomfret have a deep, laterally compressed body that lets them maneuver neatly through open water." +available_seasons = 15 allowed_water_types = 2 rarity = 1 base_catch_weight = 0.3 diff --git a/fish/species/pomfret_chinese/fish_pomfret_chinese.png b/fish/species/pomfret_chinese/fish_pomfret_chinese.png index a7bb55e..2280027 100644 Binary files a/fish/species/pomfret_chinese/fish_pomfret_chinese.png and b/fish/species/pomfret_chinese/fish_pomfret_chinese.png differ diff --git a/fish/species/pomfret_chinese/pomfret_chinese.tres b/fish/species/pomfret_chinese/pomfret_chinese.tres index 76d6943..e3f236c 100644 --- a/fish/species/pomfret_chinese/pomfret_chinese.tres +++ b/fish/species/pomfret_chinese/pomfret_chinese.tres @@ -3,7 +3,7 @@ [ext_resource type="Script" uid="uid://h7hg45b7wmst" path="res://fish/fish_data.gd" id="1_fish_data"] [ext_resource type="Resource" path="res://fishing/common_catch_profile.tres" id="2_profile"] [ext_resource type="Script" uid="uid://bs7cqi88csolc" path="res://fish/fish_availability.gd" id="3_availability_script"] -[ext_resource type="Texture2D" uid="uid://cijr0gseldncc" path="res://fish/species/pomfret_chinese/fish_pomfret_chinese.png" id="4_texture"] +[ext_resource type="Texture2D" path="res://art/exported/creatures/fish_placeholder.png" id="4_texture"] [sub_resource type="Resource" id="PomfretChineseAvailability"] script = ExtResource("3_availability_script") @@ -17,6 +17,7 @@ active = true catalog_number = 804 collection_group = &"Coastal schooling fish" logbook_fact = "chinese pomfret are silvery schooling fish with a tall, flattened body and long sickle-shaped fins." +available_seasons = 15 allowed_water_types = 2 rarity = 1 base_catch_weight = 0.3 diff --git a/fish/species/pomfret_golden/fish_pomfret_golden.png b/fish/species/pomfret_golden/fish_pomfret_golden.png index a844b87..3929da6 100644 Binary files a/fish/species/pomfret_golden/fish_pomfret_golden.png and b/fish/species/pomfret_golden/fish_pomfret_golden.png differ diff --git a/fish/species/pomfret_golden/pomfret_golden.tres b/fish/species/pomfret_golden/pomfret_golden.tres index 8637db1..162a2e7 100644 --- a/fish/species/pomfret_golden/pomfret_golden.tres +++ b/fish/species/pomfret_golden/pomfret_golden.tres @@ -3,7 +3,7 @@ [ext_resource type="Script" uid="uid://h7hg45b7wmst" path="res://fish/fish_data.gd" id="1_fish_data"] [ext_resource type="Resource" path="res://fishing/common_catch_profile.tres" id="2_profile"] [ext_resource type="Script" uid="uid://bs7cqi88csolc" path="res://fish/fish_availability.gd" id="3_availability_script"] -[ext_resource type="Texture2D" uid="uid://7rjv7k60bv7q" path="res://fish/species/pomfret_golden/fish_pomfret_golden.png" id="4_texture"] +[ext_resource type="Texture2D" path="res://art/exported/creatures/fish_placeholder.png" id="4_texture"] [sub_resource type="Resource" id="PomfretGoldenAvailability"] script = ExtResource("3_availability_script") @@ -17,6 +17,7 @@ active = true catalog_number = 807 collection_group = &"Coastal schooling fish" logbook_fact = "golden pomfret are warm-water swimmers whose golden sheen is most noticeable along the fins and flanks." +available_seasons = 15 allowed_water_types = 2 rarity = 2 base_catch_weight = 0.18 diff --git a/fish/species/pomfret_white/fish_pomfret_white.png b/fish/species/pomfret_white/fish_pomfret_white.png index 0f2d426..cf020d5 100644 Binary files a/fish/species/pomfret_white/fish_pomfret_white.png and b/fish/species/pomfret_white/fish_pomfret_white.png differ diff --git a/fish/species/pomfret_white/pomfret_white.tres b/fish/species/pomfret_white/pomfret_white.tres index 7152086..8652e63 100644 --- a/fish/species/pomfret_white/pomfret_white.tres +++ b/fish/species/pomfret_white/pomfret_white.tres @@ -3,7 +3,7 @@ [ext_resource type="Script" uid="uid://h7hg45b7wmst" path="res://fish/fish_data.gd" id="1_fish_data"] [ext_resource type="Resource" path="res://fishing/common_catch_profile.tres" id="2_profile"] [ext_resource type="Script" uid="uid://bs7cqi88csolc" path="res://fish/fish_availability.gd" id="3_availability_script"] -[ext_resource type="Texture2D" uid="uid://c3fr0x4e1nfe0" path="res://fish/species/pomfret_white/fish_pomfret_white.png" id="4_texture"] +[ext_resource type="Texture2D" path="res://art/exported/creatures/fish_placeholder.png" id="4_texture"] [sub_resource type="Resource" id="PomfretWhiteAvailability"] script = ExtResource("3_availability_script") @@ -17,6 +17,7 @@ active = true catalog_number = 810 collection_group = &"Coastal schooling fish" logbook_fact = "white pomfret gather over coastal grounds and use their compact, deep bodies to turn quickly while feeding." +available_seasons = 15 allowed_water_types = 2 base_catch_weight = 0.45 catch_profile = ExtResource("2_profile") diff --git a/fish/species/pompano_african/pompano_african.tres b/fish/species/pompano_african/pompano_african.tres index 0b73340..598da61 100644 --- a/fish/species/pompano_african/pompano_african.tres +++ b/fish/species/pompano_african/pompano_african.tres @@ -1,8 +1,9 @@ -[gd_resource type="Resource" script_class="FishData" load_steps=4 format=3] +[gd_resource type="Resource" script_class="FishData" load_steps=5 format=3] [ext_resource type="Script" path="res://fish/fish_data.gd" id="1_fish_data"] [ext_resource type="Resource" path="res://fishing/common_catch_profile.tres" id="2_profile"] [ext_resource type="Script" path="res://fish/fish_availability.gd" id="3_availability"] +[ext_resource type="Texture2D" path="res://art/exported/creatures/fish_placeholder.png" id="99_fish_placeholder"] [sub_resource type="Resource" id="Availability"] script = ExtResource("3_availability") @@ -11,10 +12,11 @@ script = ExtResource("3_availability") script = ExtResource("1_fish_data") id = &"pompano_african" display_name = "African pompano" -active = false +active = true catalog_number = 3601 collection_group = &"Large coastal predators" logbook_fact = "african pompano develop long streaming fin rays while young. adults become deep-bodied silver hunters around reefs and offshore structure." +available_seasons = 6 allowed_water_types = 2 rarity = 2 base_catch_weight = 0.26 @@ -25,3 +27,4 @@ weight_max_lb = 50.0 sell_value_min = 14 sell_value_max = 35 sell_value_curve = 0.84 +display_texture = ExtResource("99_fish_placeholder") diff --git a/fish/species/pompano_florida/pompano_florida.tres b/fish/species/pompano_florida/pompano_florida.tres index be7a10e..b21035c 100644 --- a/fish/species/pompano_florida/pompano_florida.tres +++ b/fish/species/pompano_florida/pompano_florida.tres @@ -1,8 +1,9 @@ -[gd_resource type="Resource" script_class="FishData" load_steps=4 format=3] +[gd_resource type="Resource" script_class="FishData" load_steps=5 format=3] [ext_resource type="Script" path="res://fish/fish_data.gd" id="1_fish_data"] [ext_resource type="Resource" path="res://fishing/common_catch_profile.tres" id="2_profile"] [ext_resource type="Script" path="res://fish/fish_availability.gd" id="3_availability"] +[ext_resource type="Texture2D" path="res://art/exported/creatures/fish_placeholder.png" id="99_fish_placeholder"] [sub_resource type="Resource" id="Availability"] script = ExtResource("3_availability") @@ -13,10 +14,11 @@ forbid_fog = true script = ExtResource("1_fish_data") id = &"pompano_florida" display_name = "Florida pompano" -active = false +active = true catalog_number = 7402 collection_group = &"Tropical flats fish" logbook_fact = "florida pompano search warm surf for crabs, clams, and sand fleas. short blunt snouts lead into deep, silvery bodies." +available_seasons = 15 allowed_water_types = 2 rarity = 1 base_catch_weight = 0.85 @@ -27,3 +29,4 @@ weight_max_lb = 9.0 sell_value_min = 7 sell_value_max = 16 sell_value_curve = 0.88 +display_texture = ExtResource("99_fish_placeholder") diff --git a/fish/species/porcupinefish_spotted/porcupinefish_spotted.tres b/fish/species/porcupinefish_spotted/porcupinefish_spotted.tres index 1e51582..93d5dca 100644 --- a/fish/species/porcupinefish_spotted/porcupinefish_spotted.tres +++ b/fish/species/porcupinefish_spotted/porcupinefish_spotted.tres @@ -1,8 +1,9 @@ -[gd_resource type="Resource" script_class="FishData" load_steps=4 format=3] +[gd_resource type="Resource" script_class="FishData" load_steps=5 format=3] [ext_resource type="Script" path="res://fish/fish_data.gd" id="1_fish_data"] [ext_resource type="Resource" path="res://fishing/common_catch_profile.tres" id="2_profile"] [ext_resource type="Script" path="res://fish/fish_availability.gd" id="3_availability"] +[ext_resource type="Texture2D" path="res://art/exported/creatures/fish_placeholder.png" id="99_fish_placeholder"] [sub_resource type="Resource" id="Availability"] script = ExtResource("3_availability") @@ -13,10 +14,11 @@ require_fog = true script = ExtResource("1_fish_data") id = &"porcupinefish_spotted" display_name = "spotted porcupinefish" -active = false +active = true catalog_number = 5607 collection_group = &"Reef oddities" logbook_fact = "spotted porcupinefish inflate until long spines stand outward. fused teeth form a strong beak for crushing shelled prey." +available_seasons = 15 allowed_water_types = 2 rarity = 3 base_catch_weight = 0.12 @@ -27,3 +29,4 @@ weight_max_lb = 7.0 sell_value_min = 24 sell_value_max = 54 sell_value_curve = 0.9 +display_texture = ExtResource("99_fish_placeholder") diff --git a/fish/species/porgy_scup/porgy_scup.tres b/fish/species/porgy_scup/porgy_scup.tres index dec3c55..59dd833 100644 --- a/fish/species/porgy_scup/porgy_scup.tres +++ b/fish/species/porgy_scup/porgy_scup.tres @@ -1,8 +1,9 @@ -[gd_resource type="Resource" script_class="FishData" load_steps=4 format=3] +[gd_resource type="Resource" script_class="FishData" load_steps=5 format=3] [ext_resource type="Script" path="res://fish/fish_data.gd" id="1_fish_data"] [ext_resource type="Resource" path="res://fishing/common_catch_profile.tres" id="2_profile"] [ext_resource type="Script" path="res://fish/fish_availability.gd" id="3_availability"] +[ext_resource type="Texture2D" path="res://art/exported/creatures/fish_placeholder.png" id="99_fish_placeholder"] [sub_resource type="Resource" id="Availability"] script = ExtResource("3_availability") @@ -12,10 +13,11 @@ allow_night = false script = ExtResource("1_fish_data") id = &"porgy_scup" display_name = "scup" -active = false +active = true catalog_number = 6904 collection_group = &"Temperate reef fish" logbook_fact = "scup use small strong teeth to crush shellfish and other bottom prey. deep silver bodies gather around piers, reefs, and eelgrass." +available_seasons = 13 allowed_water_types = 2 rarity = 0 base_catch_weight = 2.2 @@ -26,3 +28,4 @@ weight_max_lb = 5.0 sell_value_min = 3 sell_value_max = 8 sell_value_curve = 0.92 +display_texture = ExtResource("99_fish_placeholder") diff --git a/fish/species/pufferfish_guineafowl/pufferfish_guineafowl.tres b/fish/species/pufferfish_guineafowl/pufferfish_guineafowl.tres index 3771896..754cf4d 100644 --- a/fish/species/pufferfish_guineafowl/pufferfish_guineafowl.tres +++ b/fish/species/pufferfish_guineafowl/pufferfish_guineafowl.tres @@ -1,8 +1,9 @@ -[gd_resource type="Resource" script_class="FishData" load_steps=4 format=3] +[gd_resource type="Resource" script_class="FishData" load_steps=5 format=3] [ext_resource type="Script" path="res://fish/fish_data.gd" id="1_fish_data"] [ext_resource type="Resource" path="res://fishing/common_catch_profile.tres" id="2_profile"] [ext_resource type="Script" path="res://fish/fish_availability.gd" id="3_availability"] +[ext_resource type="Texture2D" path="res://art/exported/creatures/fish_placeholder.png" id="99_fish_placeholder"] [sub_resource type="Resource" id="Availability"] script = ExtResource("3_availability") @@ -12,10 +13,11 @@ allow_night = false script = ExtResource("1_fish_data") id = &"pufferfish_guineafowl" display_name = "guineafowl puffer" -active = false +active = true catalog_number = 5603 collection_group = &"Reef oddities" logbook_fact = "guineafowl puffers swallow water to inflate when threatened. adults may shift from a spotted dark pattern to a vivid yellow form." +available_seasons = 15 allowed_water_types = 2 rarity = 2 base_catch_weight = 0.3 @@ -26,3 +28,4 @@ weight_max_lb = 5.0 sell_value_min = 11 sell_value_max = 26 sell_value_curve = 0.9 +display_texture = ExtResource("99_fish_placeholder") diff --git a/fish/species/pumpkinseed/pumpkinseed.tres b/fish/species/pumpkinseed/pumpkinseed.tres index 5a24e96..7928e4f 100644 --- a/fish/species/pumpkinseed/pumpkinseed.tres +++ b/fish/species/pumpkinseed/pumpkinseed.tres @@ -1,8 +1,9 @@ -[gd_resource type="Resource" script_class="FishData" load_steps=4 format=3] +[gd_resource type="Resource" script_class="FishData" load_steps=5 format=3] [ext_resource type="Script" path="res://fish/fish_data.gd" id="1_fish_data"] [ext_resource type="Resource" path="res://fishing/common_catch_profile.tres" id="2_profile"] [ext_resource type="Script" path="res://fish/fish_availability.gd" id="3_availability"] +[ext_resource type="Texture2D" path="res://art/exported/creatures/fish_placeholder.png" id="99_fish_placeholder"] [sub_resource type="Resource" id="Availability"] script = ExtResource("3_availability") @@ -12,10 +13,11 @@ allow_night = false script = ExtResource("1_fish_data") id = &"pumpkinseed" display_name = "pumpkinseed" -active = false +active = true catalog_number = 3104 collection_group = &"Freshwater panfish" logbook_fact = "pumpkinseeds use compact teeth to crush snails and other hard prey. blue facial lines and an orange gill spot brighten their round bodies." +available_seasons = 7 allowed_water_types = 1 rarity = 0 base_catch_weight = 3.0 @@ -26,3 +28,4 @@ weight_max_lb = 1.3 sell_value_min = 2 sell_value_max = 5 sell_value_curve = 1.0 +display_texture = ExtResource("99_fish_placeholder") diff --git a/fish/species/queenfish_talang/queenfish_talang.tres b/fish/species/queenfish_talang/queenfish_talang.tres index 6b3f91c..d6ee3be 100644 --- a/fish/species/queenfish_talang/queenfish_talang.tres +++ b/fish/species/queenfish_talang/queenfish_talang.tres @@ -1,8 +1,9 @@ -[gd_resource type="Resource" script_class="FishData" load_steps=4 format=3] +[gd_resource type="Resource" script_class="FishData" load_steps=5 format=3] [ext_resource type="Script" path="res://fish/fish_data.gd" id="1_fish_data"] [ext_resource type="Resource" path="res://fishing/common_catch_profile.tres" id="2_profile"] [ext_resource type="Script" path="res://fish/fish_availability.gd" id="3_availability"] +[ext_resource type="Texture2D" path="res://art/exported/creatures/fish_placeholder.png" id="99_fish_placeholder"] [sub_resource type="Resource" id="Availability"] script = ExtResource("3_availability") @@ -12,10 +13,11 @@ allow_night = false script = ExtResource("1_fish_data") id = &"queenfish_talang" display_name = "talang queenfish" -active = false +active = true catalog_number = 708 collection_group = &"Coastal pelagic fish" logbook_fact = "talang queenfish chase schooling prey near warm coasts and estuaries. hooked teeth and a deeply forked tail suit their rapid attacks." +available_seasons = 15 allowed_water_types = 2 rarity = 1 base_catch_weight = 0.8 @@ -26,3 +28,4 @@ weight_max_lb = 20.0 sell_value_min = 7 sell_value_max = 18 sell_value_curve = 0.86 +display_texture = ExtResource("99_fish_placeholder") diff --git a/fish/species/quillback/quillback.tres b/fish/species/quillback/quillback.tres index 915fc08..2ca6399 100644 --- a/fish/species/quillback/quillback.tres +++ b/fish/species/quillback/quillback.tres @@ -1,8 +1,9 @@ -[gd_resource type="Resource" script_class="FishData" load_steps=4 format=3] +[gd_resource type="Resource" script_class="FishData" load_steps=5 format=3] [ext_resource type="Script" path="res://fish/fish_data.gd" id="1_fish_data"] [ext_resource type="Resource" path="res://fishing/common_catch_profile.tres" id="2_profile"] [ext_resource type="Script" path="res://fish/fish_availability.gd" id="3_availability"] +[ext_resource type="Texture2D" path="res://art/exported/creatures/fish_placeholder.png" id="99_fish_placeholder"] [sub_resource type="Resource" id="Availability"] script = ExtResource("3_availability") @@ -12,10 +13,11 @@ allow_night = false script = ExtResource("1_fish_data") id = &"quillback" display_name = "quillback" -active = false +active = true catalog_number = 2303 collection_group = &"Freshwater bottom fish" logbook_fact = "quillbacks carry a long first dorsal ray that rises like a quill. small mouths gather insect larvae and other food from river and lake bottoms." +available_seasons = 7 allowed_water_types = 1 rarity = 1 base_catch_weight = 0.8 @@ -26,3 +28,4 @@ weight_max_lb = 15.0 sell_value_min = 6 sell_value_max = 16 sell_value_curve = 0.88 +display_texture = ExtResource("99_fish_placeholder") diff --git a/fish/species/red_drum/red_drum.tres b/fish/species/red_drum/red_drum.tres index 98c6bdd..393a002 100644 --- a/fish/species/red_drum/red_drum.tres +++ b/fish/species/red_drum/red_drum.tres @@ -1,8 +1,9 @@ -[gd_resource type="Resource" script_class="FishData" load_steps=4 format=3] +[gd_resource type="Resource" script_class="FishData" load_steps=5 format=3] [ext_resource type="Script" path="res://fish/fish_data.gd" id="1_fish_data"] [ext_resource type="Resource" path="res://fishing/common_catch_profile.tres" id="2_profile"] [ext_resource type="Script" path="res://fish/fish_availability.gd" id="3_availability"] +[ext_resource type="Texture2D" path="res://art/exported/creatures/fish_placeholder.png" id="99_fish_placeholder"] [sub_resource type="Resource" id="Availability"] script = ExtResource("3_availability") @@ -12,10 +13,11 @@ require_rain = true script = ExtResource("1_fish_data") id = &"red_drum" display_name = "red drum" -active = false +active = true catalog_number = 6803 collection_group = &"Temperate estuary" logbook_fact = "red drum use powerful tails to patrol surf and estuaries. one or more black spots near the tail may confuse predators about which end is the head." +available_seasons = 7 allowed_water_types = 2 rarity = 1 base_catch_weight = 0.75 @@ -26,3 +28,4 @@ weight_max_lb = 45.0 sell_value_min = 8 sell_value_max = 23 sell_value_curve = 0.84 +display_texture = ExtResource("99_fish_placeholder") diff --git a/fish/species/redear_sunfish/redear_sunfish.tres b/fish/species/redear_sunfish/redear_sunfish.tres index 55221d8..6078d20 100644 --- a/fish/species/redear_sunfish/redear_sunfish.tres +++ b/fish/species/redear_sunfish/redear_sunfish.tres @@ -1,8 +1,9 @@ -[gd_resource type="Resource" script_class="FishData" load_steps=4 format=3] +[gd_resource type="Resource" script_class="FishData" load_steps=5 format=3] [ext_resource type="Script" path="res://fish/fish_data.gd" id="1_fish_data"] [ext_resource type="Resource" path="res://fishing/common_catch_profile.tres" id="2_profile"] [ext_resource type="Script" path="res://fish/fish_availability.gd" id="3_availability"] +[ext_resource type="Texture2D" path="res://art/exported/creatures/fish_placeholder.png" id="99_fish_placeholder"] [sub_resource type="Resource" id="Availability"] script = ExtResource("3_availability") @@ -12,10 +13,11 @@ allow_night = false script = ExtResource("1_fish_data") id = &"redear_sunfish" display_name = "redear sunfish" -active = false +active = true catalog_number = 3105 collection_group = &"Freshwater panfish" logbook_fact = "redear sunfish specialize in snails, crushing shells with strong throat teeth. a red or orange margin marks the dark flap behind the gill." +available_seasons = 7 allowed_water_types = 1 rarity = 1 base_catch_weight = 1.1 @@ -26,3 +28,4 @@ weight_max_lb = 3.0 sell_value_min = 4 sell_value_max = 9 sell_value_curve = 0.95 +display_texture = ExtResource("99_fish_placeholder") diff --git a/fish/species/redhorse_golden/redhorse_golden.tres b/fish/species/redhorse_golden/redhorse_golden.tres index 15296d5..5ba103b 100644 --- a/fish/species/redhorse_golden/redhorse_golden.tres +++ b/fish/species/redhorse_golden/redhorse_golden.tres @@ -1,8 +1,9 @@ -[gd_resource type="Resource" script_class="FishData" load_steps=4 format=3] +[gd_resource type="Resource" script_class="FishData" load_steps=5 format=3] [ext_resource type="Script" path="res://fish/fish_data.gd" id="1_fish_data"] [ext_resource type="Resource" path="res://fishing/common_catch_profile.tres" id="2_profile"] [ext_resource type="Script" path="res://fish/fish_availability.gd" id="3_availability"] +[ext_resource type="Texture2D" path="res://art/exported/creatures/fish_placeholder.png" id="99_fish_placeholder"] [sub_resource type="Resource" id="Availability"] script = ExtResource("3_availability") @@ -12,10 +13,11 @@ allow_night = false script = ExtResource("1_fish_data") id = &"redhorse_golden" display_name = "golden redhorse" -active = false +active = true catalog_number = 2302 collection_group = &"Freshwater bottom fish" logbook_fact = "golden redhorses probe flowing river bottoms with fleshy, downward-facing mouths. coppery scales and reddish fins give them a warm glow." +available_seasons = 7 allowed_water_types = 1 rarity = 1 base_catch_weight = 0.9 @@ -26,3 +28,4 @@ weight_max_lb = 8.0 sell_value_min = 6 sell_value_max = 14 sell_value_curve = 0.9 +display_texture = ExtResource("99_fish_placeholder") diff --git a/fish/species/roach_common/roach_common.tres b/fish/species/roach_common/roach_common.tres index a85b58f..8814f1c 100644 --- a/fish/species/roach_common/roach_common.tres +++ b/fish/species/roach_common/roach_common.tres @@ -1,8 +1,9 @@ -[gd_resource type="Resource" script_class="FishData" load_steps=4 format=3] +[gd_resource type="Resource" script_class="FishData" load_steps=5 format=3] [ext_resource type="Script" path="res://fish/fish_data.gd" id="1_fish_data"] [ext_resource type="Resource" path="res://fishing/common_catch_profile.tres" id="2_profile"] [ext_resource type="Script" path="res://fish/fish_availability.gd" id="3_availability"] +[ext_resource type="Texture2D" path="res://art/exported/creatures/fish_placeholder.png" id="99_fish_placeholder"] [sub_resource type="Resource" id="Availability"] script = ExtResource("3_availability") @@ -11,10 +12,11 @@ script = ExtResource("3_availability") script = ExtResource("1_fish_data") id = &"roach_common" display_name = "common roach" -active = false +active = true catalog_number = 2504 collection_group = &"Freshwater coarse fish" logbook_fact = "common roach thrive in many lakes and rivers, often schooling near vegetation. red fins and a red-orange eye brighten their silver bodies." +available_seasons = 15 allowed_water_types = 1 rarity = 0 base_catch_weight = 2.8 @@ -25,3 +27,4 @@ weight_max_lb = 4.0 sell_value_min = 2 sell_value_max = 6 sell_value_curve = 0.95 +display_texture = ExtResource("99_fish_placeholder") diff --git a/fish/species/rockfish_black/rockfish_black.tres b/fish/species/rockfish_black/rockfish_black.tres index 4bbcd5a..f26a41c 100644 --- a/fish/species/rockfish_black/rockfish_black.tres +++ b/fish/species/rockfish_black/rockfish_black.tres @@ -1,8 +1,9 @@ -[gd_resource type="Resource" script_class="FishData" load_steps=4 format=3] +[gd_resource type="Resource" script_class="FishData" load_steps=5 format=3] [ext_resource type="Script" path="res://fish/fish_data.gd" id="1_fish_data"] [ext_resource type="Resource" path="res://fishing/common_catch_profile.tres" id="2_profile"] [ext_resource type="Script" path="res://fish/fish_availability.gd" id="3_availability"] +[ext_resource type="Texture2D" path="res://art/exported/creatures/fish_placeholder.png" id="99_fish_placeholder"] [sub_resource type="Resource" id="Availability"] script = ExtResource("3_availability") @@ -11,10 +12,11 @@ script = ExtResource("3_availability") script = ExtResource("1_fish_data") id = &"rockfish_black" display_name = "black rockfish" -active = false +active = true catalog_number = 6901 collection_group = &"Temperate reef fish" logbook_fact = "black rockfish gather above reefs and kelp along the north pacific coast. like other rockfish, they give birth to live young." +available_seasons = 13 allowed_water_types = 2 rarity = 0 base_catch_weight = 1.7 @@ -25,3 +27,4 @@ weight_max_lb = 10.0 sell_value_min = 4 sell_value_max = 11 sell_value_curve = 0.9 +display_texture = ExtResource("99_fish_placeholder") diff --git a/fish/species/rockfish_canary/rockfish_canary.tres b/fish/species/rockfish_canary/rockfish_canary.tres index 2aeb290..1e65d72 100644 --- a/fish/species/rockfish_canary/rockfish_canary.tres +++ b/fish/species/rockfish_canary/rockfish_canary.tres @@ -1,8 +1,9 @@ -[gd_resource type="Resource" script_class="FishData" load_steps=4 format=3] +[gd_resource type="Resource" script_class="FishData" load_steps=5 format=3] [ext_resource type="Script" path="res://fish/fish_data.gd" id="1_fish_data"] [ext_resource type="Resource" path="res://fishing/common_catch_profile.tres" id="2_profile"] [ext_resource type="Script" path="res://fish/fish_availability.gd" id="3_availability"] +[ext_resource type="Texture2D" path="res://art/exported/creatures/fish_placeholder.png" id="99_fish_placeholder"] [sub_resource type="Resource" id="Availability"] script = ExtResource("3_availability") @@ -12,10 +13,11 @@ allow_night = false script = ExtResource("1_fish_data") id = &"rockfish_canary" display_name = "canary rockfish" -active = false +active = true catalog_number = 6903 collection_group = &"Temperate reef fish" logbook_fact = "canary rockfish glow orange-yellow over deep pacific reefs. these long-lived fish mature slowly and give birth to live young." +available_seasons = 13 allowed_water_types = 2 rarity = 1 base_catch_weight = 0.7 @@ -26,3 +28,4 @@ weight_max_lb = 12.0 sell_value_min = 7 sell_value_max = 17 sell_value_curve = 0.88 +display_texture = ExtResource("99_fish_placeholder") diff --git a/fish/species/rockfish_yelloweye/rockfish_yelloweye.tres b/fish/species/rockfish_yelloweye/rockfish_yelloweye.tres index d06d1d3..89aab8e 100644 --- a/fish/species/rockfish_yelloweye/rockfish_yelloweye.tres +++ b/fish/species/rockfish_yelloweye/rockfish_yelloweye.tres @@ -1,8 +1,9 @@ -[gd_resource type="Resource" script_class="FishData" load_steps=4 format=3] +[gd_resource type="Resource" script_class="FishData" load_steps=5 format=3] [ext_resource type="Script" path="res://fish/fish_data.gd" id="1_fish_data"] [ext_resource type="Resource" path="res://fishing/common_catch_profile.tres" id="2_profile"] [ext_resource type="Script" path="res://fish/fish_availability.gd" id="3_availability"] +[ext_resource type="Texture2D" path="res://art/exported/creatures/fish_placeholder.png" id="99_fish_placeholder"] [sub_resource type="Resource" id="Availability"] script = ExtResource("3_availability") @@ -12,10 +13,11 @@ require_fog = true script = ExtResource("1_fish_data") id = &"rockfish_yelloweye" display_name = "yelloweye rockfish" -active = false +active = true catalog_number = 6907 collection_group = &"Temperate reef fish" logbook_fact = "yelloweye rockfish can live for more than a century on deep pacific reefs. bright golden eyes stand out against orange-red bodies." +available_seasons = 13 allowed_water_types = 2 rarity = 3 base_catch_weight = 0.09 @@ -26,3 +28,4 @@ weight_max_lb = 35.0 sell_value_min = 28 sell_value_max = 64 sell_value_curve = 0.84 +display_texture = ExtResource("99_fish_placeholder") diff --git a/fish/species/roosterfish/roosterfish.tres b/fish/species/roosterfish/roosterfish.tres index fdb432a..388dd70 100644 --- a/fish/species/roosterfish/roosterfish.tres +++ b/fish/species/roosterfish/roosterfish.tres @@ -1,8 +1,9 @@ -[gd_resource type="Resource" script_class="FishData" load_steps=4 format=3] +[gd_resource type="Resource" script_class="FishData" load_steps=5 format=3] [ext_resource type="Script" path="res://fish/fish_data.gd" id="1_fish_data"] [ext_resource type="Resource" path="res://fishing/common_catch_profile.tres" id="2_profile"] [ext_resource type="Script" path="res://fish/fish_availability.gd" id="3_availability"] +[ext_resource type="Texture2D" path="res://art/exported/creatures/fish_placeholder.png" id="99_fish_placeholder"] [sub_resource type="Resource" id="Availability"] script = ExtResource("3_availability") @@ -12,10 +13,11 @@ allow_night = false script = ExtResource("1_fish_data") id = &"roosterfish" display_name = "roosterfish" -active = false +active = true catalog_number = 7201 collection_group = &"Tropical coastal predators" logbook_fact = "roosterfish raise seven long dorsal spines while chasing prey through tropical surf. dark bands cross their sleek silver bodies." +available_seasons = 15 allowed_water_types = 2 rarity = 3 base_catch_weight = 0.11 @@ -26,3 +28,4 @@ weight_max_lb = 100.0 sell_value_min = 30 sell_value_max = 70 sell_value_curve = 0.82 +display_texture = ExtResource("99_fish_placeholder") diff --git a/fish/species/rudd/rudd.tres b/fish/species/rudd/rudd.tres index 317fa8c..ae031ac 100644 --- a/fish/species/rudd/rudd.tres +++ b/fish/species/rudd/rudd.tres @@ -1,8 +1,9 @@ -[gd_resource type="Resource" script_class="FishData" load_steps=4 format=3] +[gd_resource type="Resource" script_class="FishData" load_steps=5 format=3] [ext_resource type="Script" path="res://fish/fish_data.gd" id="1_fish_data"] [ext_resource type="Resource" path="res://fishing/common_catch_profile.tres" id="2_profile"] [ext_resource type="Script" path="res://fish/fish_availability.gd" id="3_availability"] +[ext_resource type="Texture2D" path="res://art/exported/creatures/fish_placeholder.png" id="99_fish_placeholder"] [sub_resource type="Resource" id="Availability"] script = ExtResource("3_availability") @@ -12,10 +13,11 @@ allow_night = false script = ExtResource("1_fish_data") id = &"rudd" display_name = "rudd" -active = false +active = true catalog_number = 2508 collection_group = &"Freshwater coarse fish" logbook_fact = "rudd feed near the surface with an upturned mouth and red fins. golden-green bodies disappear easily among warm, weedy shallows." +available_seasons = 7 allowed_water_types = 1 rarity = 0 base_catch_weight = 2.4 @@ -26,3 +28,4 @@ weight_max_lb = 4.5 sell_value_min = 3 sell_value_max = 7 sell_value_curve = 0.95 +display_texture = ExtResource("99_fish_placeholder") diff --git a/fish/species/sablefish/sablefish.tres b/fish/species/sablefish/sablefish.tres index d180b9b..e481e52 100644 --- a/fish/species/sablefish/sablefish.tres +++ b/fish/species/sablefish/sablefish.tres @@ -1,8 +1,9 @@ -[gd_resource type="Resource" script_class="FishData" load_steps=4 format=3] +[gd_resource type="Resource" script_class="FishData" load_steps=5 format=3] [ext_resource type="Script" path="res://fish/fish_data.gd" id="1_fish_data"] [ext_resource type="Resource" path="res://fishing/common_catch_profile.tres" id="2_profile"] [ext_resource type="Script" path="res://fish/fish_availability.gd" id="3_availability"] +[ext_resource type="Texture2D" path="res://art/exported/creatures/fish_placeholder.png" id="99_fish_placeholder"] [sub_resource type="Resource" id="Availability"] script = ExtResource("3_availability") @@ -12,10 +13,11 @@ allow_day = false script = ExtResource("1_fish_data") id = &"sablefish" display_name = "sablefish" -active = false +active = true catalog_number = 1605 collection_group = &"Deep shelf fish" logbook_fact = "sablefish roam deep north pacific slopes and can live for many decades. soft dark bodies conceal rich, oil-filled flesh." +available_seasons = 15 allowed_water_types = 2 rarity = 2 base_catch_weight = 0.22 @@ -26,3 +28,4 @@ weight_max_lb = 40.0 sell_value_min = 15 sell_value_max = 36 sell_value_curve = 0.84 +display_texture = ExtResource("99_fish_placeholder") diff --git a/fish/species/sailfish/fish_sailfish.png b/fish/species/sailfish/fish_sailfish.png index e359a3e..32b447e 100644 Binary files a/fish/species/sailfish/fish_sailfish.png and b/fish/species/sailfish/fish_sailfish.png differ diff --git a/fish/species/sailfish/sailfish.tres b/fish/species/sailfish/sailfish.tres index 398f62d..98e958d 100644 --- a/fish/species/sailfish/sailfish.tres +++ b/fish/species/sailfish/sailfish.tres @@ -3,7 +3,7 @@ [ext_resource type="Script" uid="uid://h7hg45b7wmst" path="res://fish/fish_data.gd" id="1_fish_data"] [ext_resource type="Resource" path="res://fishing/common_catch_profile.tres" id="2_profile"] [ext_resource type="Script" uid="uid://bs7cqi88csolc" path="res://fish/fish_availability.gd" id="3_availability_script"] -[ext_resource type="Texture2D" uid="uid://8rlcnfqx8or0" path="res://fish/species/sailfish/fish_sailfish.png" id="4_texture"] +[ext_resource type="Texture2D" path="res://art/exported/creatures/fish_placeholder.png" id="4_texture"] [sub_resource type="Resource" id="SailfishAvailability"] script = ExtResource("3_availability_script") @@ -17,6 +17,7 @@ active = true catalog_number = 4603 collection_group = &"Oceanic billfish" logbook_fact = "sailfish raise their enormous dorsal fin while herding baitfish. they are among the fastest fish in the sea." +available_seasons = 15 allowed_water_types = 2 rarity = 3 base_catch_weight = 0.1 diff --git a/fish/species/salmon_atlantic/fish_salmon_atlantic.png b/fish/species/salmon_atlantic/fish_salmon_atlantic.png index ea6164b..a28192e 100644 Binary files a/fish/species/salmon_atlantic/fish_salmon_atlantic.png and b/fish/species/salmon_atlantic/fish_salmon_atlantic.png differ diff --git a/fish/species/salmon_atlantic/salmon_atlantic.tres b/fish/species/salmon_atlantic/salmon_atlantic.tres index 906d86b..1c77325 100644 --- a/fish/species/salmon_atlantic/salmon_atlantic.tres +++ b/fish/species/salmon_atlantic/salmon_atlantic.tres @@ -3,7 +3,7 @@ [ext_resource type="Script" uid="uid://h7hg45b7wmst" path="res://fish/fish_data.gd" id="1_fish_data"] [ext_resource type="Resource" path="res://fishing/bass_catch_profile.tres" id="2_profile"] [ext_resource type="Script" uid="uid://bs7cqi88csolc" path="res://fish/fish_availability.gd" id="3_availability_script"] -[ext_resource type="Texture2D" uid="uid://ddbclfu5wtd5r" path="res://fish/species/salmon_atlantic/fish_salmon_atlantic.png" id="4_texture"] +[ext_resource type="Texture2D" path="res://art/exported/creatures/4401.png" id="4_texture"] [sub_resource type="Resource" id="AtlanticSalmonAvailability"] script = ExtResource("3_availability_script") @@ -18,6 +18,7 @@ active = true catalog_number = 4401 collection_group = &"Ocean-run salmon" logbook_fact = "atlantic salmon can return from the ocean to the river where they hatched. unlike many salmon, some survive to make the trip again." +available_seasons = 5 allowed_water_types = 2 rarity = 3 base_catch_weight = 0.65 diff --git a/fish/species/salmon_chum/fish_salmon_chum.png b/fish/species/salmon_chum/fish_salmon_chum.png index 920b39d..25a94eb 100644 Binary files a/fish/species/salmon_chum/fish_salmon_chum.png and b/fish/species/salmon_chum/fish_salmon_chum.png differ diff --git a/fish/species/salmon_chum/salmon_chum.tres b/fish/species/salmon_chum/salmon_chum.tres index 67d3684..8fcabd0 100644 --- a/fish/species/salmon_chum/salmon_chum.tres +++ b/fish/species/salmon_chum/salmon_chum.tres @@ -3,7 +3,7 @@ [ext_resource type="Script" uid="uid://h7hg45b7wmst" path="res://fish/fish_data.gd" id="1_fish_data"] [ext_resource type="Resource" path="res://fishing/bass_catch_profile.tres" id="2_profile"] [ext_resource type="Script" uid="uid://bs7cqi88csolc" path="res://fish/fish_availability.gd" id="3_availability_script"] -[ext_resource type="Texture2D" uid="uid://dqjkmd6l1a2i4" path="res://fish/species/salmon_chum/fish_salmon_chum.png" id="4_texture"] +[ext_resource type="Texture2D" path="res://art/exported/creatures/fish_placeholder.png" id="4_texture"] [sub_resource type="Resource" id="ChumSalmonAvailability"] script = ExtResource("3_availability_script") @@ -18,6 +18,7 @@ active = true catalog_number = 4402 collection_group = &"Ocean-run salmon" logbook_fact = "chum salmon travel immense distances and develop striking bars when they return to fresh water to spawn." +available_seasons = 4 allowed_water_types = 2 rarity = 1 base_catch_weight = 2.5 diff --git a/fish/species/salmon_coho/fish_salmon_coho.png b/fish/species/salmon_coho/fish_salmon_coho.png index 2caf696..a7fe5f0 100644 Binary files a/fish/species/salmon_coho/fish_salmon_coho.png and b/fish/species/salmon_coho/fish_salmon_coho.png differ diff --git a/fish/species/salmon_coho/salmon_coho.tres b/fish/species/salmon_coho/salmon_coho.tres index ad51f7b..b1160b1 100644 --- a/fish/species/salmon_coho/salmon_coho.tres +++ b/fish/species/salmon_coho/salmon_coho.tres @@ -3,7 +3,7 @@ [ext_resource type="Script" uid="uid://h7hg45b7wmst" path="res://fish/fish_data.gd" id="1_fish_data"] [ext_resource type="Resource" path="res://fishing/bass_catch_profile.tres" id="2_profile"] [ext_resource type="Script" uid="uid://bs7cqi88csolc" path="res://fish/fish_availability.gd" id="3_availability_script"] -[ext_resource type="Texture2D" uid="uid://c4c4e43lbr88c" path="res://fish/species/salmon_coho/fish_salmon_coho.png" id="4_texture"] +[ext_resource type="Texture2D" path="res://art/exported/creatures/fish_placeholder.png" id="4_texture"] [sub_resource type="Resource" id="CohoSalmonAvailability"] script = ExtResource("3_availability_script") @@ -18,6 +18,7 @@ active = true catalog_number = 4403 collection_group = &"Ocean-run salmon" logbook_fact = "coho salmon are agile hunters known for powerful leaps. young coho may spend more than a year growing in streams." +available_seasons = 12 allowed_water_types = 2 rarity = 2 base_catch_weight = 1.4 diff --git a/fish/species/salmon_pink/fish_salmon_pink.png b/fish/species/salmon_pink/fish_salmon_pink.png index 85b1d88..1fe2554 100644 Binary files a/fish/species/salmon_pink/fish_salmon_pink.png and b/fish/species/salmon_pink/fish_salmon_pink.png differ diff --git a/fish/species/salmon_pink/salmon_pink.tres b/fish/species/salmon_pink/salmon_pink.tres index 7f76c62..bdfa32e 100644 --- a/fish/species/salmon_pink/salmon_pink.tres +++ b/fish/species/salmon_pink/salmon_pink.tres @@ -3,7 +3,7 @@ [ext_resource type="Script" uid="uid://h7hg45b7wmst" path="res://fish/fish_data.gd" id="1_fish_data"] [ext_resource type="Resource" path="res://fishing/bass_catch_profile.tres" id="2_profile"] [ext_resource type="Script" uid="uid://bs7cqi88csolc" path="res://fish/fish_availability.gd" id="3_availability_script"] -[ext_resource type="Texture2D" uid="uid://bk27bsdrtlqap" path="res://fish/species/salmon_pink/fish_salmon_pink.png" id="4_texture"] +[ext_resource type="Texture2D" path="res://art/exported/creatures/fish_placeholder.png" id="4_texture"] [sub_resource type="Resource" id="PinkSalmonAvailability"] script = ExtResource("3_availability_script") @@ -18,6 +18,7 @@ active = true catalog_number = 4404 collection_group = &"Ocean-run salmon" logbook_fact = "pink salmon usually follow a strict two-year life cycle. spawning males develop the hump that inspired their nickname." +available_seasons = 6 allowed_water_types = 2 rarity = 1 base_catch_weight = 3.0 diff --git a/fish/species/salmon_sockeye/fish_salmon_sockeye.png b/fish/species/salmon_sockeye/fish_salmon_sockeye.png index bb98433..0569084 100644 Binary files a/fish/species/salmon_sockeye/fish_salmon_sockeye.png and b/fish/species/salmon_sockeye/fish_salmon_sockeye.png differ diff --git a/fish/species/salmon_sockeye/salmon_sockeye.tres b/fish/species/salmon_sockeye/salmon_sockeye.tres index 04b75b3..7bd4b1a 100644 --- a/fish/species/salmon_sockeye/salmon_sockeye.tres +++ b/fish/species/salmon_sockeye/salmon_sockeye.tres @@ -3,7 +3,7 @@ [ext_resource type="Script" uid="uid://h7hg45b7wmst" path="res://fish/fish_data.gd" id="1_fish_data"] [ext_resource type="Resource" path="res://fishing/bass_catch_profile.tres" id="2_profile"] [ext_resource type="Script" uid="uid://bs7cqi88csolc" path="res://fish/fish_availability.gd" id="3_availability_script"] -[ext_resource type="Texture2D" uid="uid://cmokm3sra4ai8" path="res://fish/species/salmon_sockeye/fish_salmon_sockeye.png" id="4_texture"] +[ext_resource type="Texture2D" path="res://art/exported/creatures/fish_placeholder.png" id="4_texture"] [sub_resource type="Resource" id="SockeyeSalmonAvailability"] script = ExtResource("3_availability_script") @@ -18,6 +18,7 @@ active = true catalog_number = 4405 collection_group = &"Ocean-run salmon" logbook_fact = "sockeye salmon feed heavily on plankton at sea. adults turn vivid red as they return inland to spawn." +available_seasons = 6 allowed_water_types = 2 rarity = 2 base_catch_weight = 1.6 diff --git a/fish/species/sand_dollar/sand_dollar.tres b/fish/species/sand_dollar/sand_dollar.tres index fd3f73c..f780203 100644 --- a/fish/species/sand_dollar/sand_dollar.tres +++ b/fish/species/sand_dollar/sand_dollar.tres @@ -1,8 +1,9 @@ -[gd_resource type="Resource" script_class="FishData" load_steps=4 format=3] +[gd_resource type="Resource" script_class="FishData" load_steps=5 format=3] [ext_resource type="Script" path="res://fish/fish_data.gd" id="1_fish_data"] [ext_resource type="Resource" path="res://fishing/common_catch_profile.tres" id="2_profile"] [ext_resource type="Script" path="res://fish/fish_availability.gd" id="3_availability"] +[ext_resource type="Texture2D" path="res://art/exported/creatures/fish_placeholder.png" id="99_fish_placeholder"] [sub_resource type="Resource" id="Availability"] script = ExtResource("3_availability") @@ -13,10 +14,11 @@ forbid_fog = true script = ExtResource("1_fish_data") id = &"sand_dollar" display_name = "sand dollar" -active = false +active = true catalog_number = 1904 collection_group = &"Echinoderms" logbook_fact = "sand dollars burrow just beneath sandy seafloors and filter tiny food particles. the familiar star pattern marks their five-part body plan." +available_seasons = 15 allowed_water_types = 2 rarity = 1 base_catch_weight = 0.8 @@ -27,3 +29,4 @@ weight_max_lb = 0.2 sell_value_min = 4 sell_value_max = 10 sell_value_curve = 0.98 +display_texture = ExtResource("99_fish_placeholder") diff --git a/fish/species/sand_lance_american/sand_lance_american.tres b/fish/species/sand_lance_american/sand_lance_american.tres index 4f53bbb..18f16be 100644 --- a/fish/species/sand_lance_american/sand_lance_american.tres +++ b/fish/species/sand_lance_american/sand_lance_american.tres @@ -1,8 +1,9 @@ -[gd_resource type="Resource" script_class="FishData" load_steps=4 format=3] +[gd_resource type="Resource" script_class="FishData" load_steps=5 format=3] [ext_resource type="Script" path="res://fish/fish_data.gd" id="1_fish_data"] [ext_resource type="Resource" path="res://fishing/common_catch_profile.tres" id="2_profile"] [ext_resource type="Script" path="res://fish/fish_availability.gd" id="3_availability"] +[ext_resource type="Texture2D" path="res://art/exported/creatures/801.png" id="99_fish_placeholder"] [sub_resource type="Resource" id="Availability"] script = ExtResource("3_availability") @@ -12,10 +13,11 @@ allow_night = false script = ExtResource("1_fish_data") id = &"sand_lance_american" display_name = "American sand lance" -active = false +active = true catalog_number = 801 collection_group = &"Coastal schooling fish" logbook_fact = "american sand lance dive headfirst into loose sand when danger approaches. immense schools carry energy from plankton to larger predators." +available_seasons = 13 allowed_water_types = 2 rarity = 0 base_catch_weight = 3.0 @@ -26,3 +28,4 @@ weight_max_lb = 0.4 sell_value_min = 1 sell_value_max = 3 sell_value_curve = 1.0 +display_texture = ExtResource("99_fish_placeholder") diff --git a/fish/species/sardine_european/sardine_european.tres b/fish/species/sardine_european/sardine_european.tres index 3052323..54008f8 100644 --- a/fish/species/sardine_european/sardine_european.tres +++ b/fish/species/sardine_european/sardine_european.tres @@ -1,8 +1,9 @@ -[gd_resource type="Resource" script_class="FishData" load_steps=4 format=3] +[gd_resource type="Resource" script_class="FishData" load_steps=5 format=3] [ext_resource type="Script" path="res://fish/fish_data.gd" id="1_fish_data"] [ext_resource type="Resource" path="res://fishing/common_catch_profile.tres" id="2_profile"] [ext_resource type="Script" path="res://fish/fish_availability.gd" id="3_availability"] +[ext_resource type="Texture2D" path="res://art/exported/creatures/806.png" id="99_fish_placeholder"] [sub_resource type="Resource" id="Availability"] script = ExtResource("3_availability") @@ -11,10 +12,11 @@ script = ExtResource("3_availability") script = ExtResource("1_fish_data") id = &"sardine_european" display_name = "European pilchard" -active = false +active = true catalog_number = 806 collection_group = &"Coastal schooling fish" logbook_fact = "european pilchards form shimmering schools along atlantic and mediterranean coasts. they feed mainly on plankton near the surface." +available_seasons = 13 allowed_water_types = 2 rarity = 0 base_catch_weight = 3.5 @@ -25,3 +27,4 @@ weight_max_lb = 0.6 sell_value_min = 2 sell_value_max = 4 sell_value_curve = 1.0 +display_texture = ExtResource("99_fish_placeholder") diff --git a/fish/species/sardine_pacific/sardine_pacific.tres b/fish/species/sardine_pacific/sardine_pacific.tres index 3e4db3d..bea772d 100644 --- a/fish/species/sardine_pacific/sardine_pacific.tres +++ b/fish/species/sardine_pacific/sardine_pacific.tres @@ -1,8 +1,9 @@ -[gd_resource type="Resource" script_class="FishData" load_steps=4 format=3] +[gd_resource type="Resource" script_class="FishData" load_steps=5 format=3] [ext_resource type="Script" path="res://fish/fish_data.gd" id="1_fish_data"] [ext_resource type="Resource" path="res://fishing/common_catch_profile.tres" id="2_profile"] [ext_resource type="Script" path="res://fish/fish_availability.gd" id="3_availability"] +[ext_resource type="Texture2D" path="res://art/exported/creatures/fish_placeholder.png" id="99_fish_placeholder"] [sub_resource type="Resource" id="Availability"] script = ExtResource("3_availability") @@ -11,10 +12,11 @@ script = ExtResource("3_availability") script = ExtResource("1_fish_data") id = &"sardine_pacific" display_name = "Pacific sardine" -active = false +active = true catalog_number = 809 collection_group = &"Coastal schooling fish" logbook_fact = "pacific sardines follow cool, productive water in enormous schools. their movements shift as currents and plankton supplies change." +available_seasons = 15 allowed_water_types = 2 rarity = 0 base_catch_weight = 3.5 @@ -25,3 +27,4 @@ weight_max_lb = 0.5 sell_value_min = 2 sell_value_max = 4 sell_value_curve = 1.0 +display_texture = ExtResource("99_fish_placeholder") diff --git a/fish/species/sauger/fish_sauger.png b/fish/species/sauger/fish_sauger.png index c4e2763..188be07 100644 Binary files a/fish/species/sauger/fish_sauger.png and b/fish/species/sauger/fish_sauger.png differ diff --git a/fish/species/sauger/sauger.tres b/fish/species/sauger/sauger.tres index 0918236..3248bcb 100644 --- a/fish/species/sauger/sauger.tres +++ b/fish/species/sauger/sauger.tres @@ -3,11 +3,11 @@ [ext_resource type="Script" uid="uid://h7hg45b7wmst" path="res://fish/fish_data.gd" id="1_fish_data"] [ext_resource type="Resource" path="res://fishing/common_catch_profile.tres" id="2_profile"] [ext_resource type="Script" uid="uid://bs7cqi88csolc" path="res://fish/fish_availability.gd" id="3_availability_script"] -[ext_resource type="Texture2D" uid="uid://8k7qkk4juciy" path="res://fish/species/sauger/fish_sauger.png" id="4_texture"] +[ext_resource type="Texture2D" path="res://art/exported/creatures/fish_placeholder.png" id="4_texture"] [sub_resource type="Resource" id="SaugerAvailability"] script = ExtResource("3_availability_script") -allowed_location_tags = Array[StringName]([&"starter_pond"]) +allowed_location_tags = Array[StringName]([&"river"]) [resource] script = ExtResource("1_fish_data") @@ -17,6 +17,7 @@ active = true catalog_number = 3304 collection_group = &"Freshwater predators" logbook_fact = "sauger favor turbid rivers and reservoirs. their mottled backs blend into the dim, shifting light near the bottom." +available_seasons = 13 allowed_water_types = 1 rarity = 1 base_catch_weight = 0.35 diff --git a/fish/species/saugeye/fish_saugeye.png b/fish/species/saugeye/fish_saugeye.png index 0674902..d106625 100644 Binary files a/fish/species/saugeye/fish_saugeye.png and b/fish/species/saugeye/fish_saugeye.png differ diff --git a/fish/species/saugeye/saugeye.tres b/fish/species/saugeye/saugeye.tres index ac82232..d6f09cf 100644 --- a/fish/species/saugeye/saugeye.tres +++ b/fish/species/saugeye/saugeye.tres @@ -3,11 +3,11 @@ [ext_resource type="Script" uid="uid://h7hg45b7wmst" path="res://fish/fish_data.gd" id="1_fish_data"] [ext_resource type="Resource" path="res://fishing/common_catch_profile.tres" id="2_profile"] [ext_resource type="Script" uid="uid://bs7cqi88csolc" path="res://fish/fish_availability.gd" id="3_availability_script"] -[ext_resource type="Texture2D" uid="uid://lom25y0eqcw3" path="res://fish/species/saugeye/fish_saugeye.png" id="4_texture"] +[ext_resource type="Texture2D" path="res://art/exported/creatures/fish_placeholder.png" id="4_texture"] [sub_resource type="Resource" id="SaugeyeAvailability"] script = ExtResource("3_availability_script") -allowed_location_tags = Array[StringName]([&"starter_pond"]) +allowed_location_tags = Array[StringName]([&"lake"]) [resource] script = ExtResource("1_fish_data") @@ -17,6 +17,7 @@ active = true catalog_number = 3305 collection_group = &"Freshwater predators" logbook_fact = "saugeye are a fertile hybrid of sauger and walleye. they combine traits from both parent species and often grow quickly." +available_seasons = 13 allowed_water_types = 1 rarity = 2 base_catch_weight = 0.2 diff --git a/fish/species/sawfish_largetooth/sawfish_largetooth.tres b/fish/species/sawfish_largetooth/sawfish_largetooth.tres index 699c8d6..ac4680b 100644 --- a/fish/species/sawfish_largetooth/sawfish_largetooth.tres +++ b/fish/species/sawfish_largetooth/sawfish_largetooth.tres @@ -1,8 +1,9 @@ -[gd_resource type="Resource" script_class="FishData" load_steps=4 format=3] +[gd_resource type="Resource" script_class="FishData" load_steps=5 format=3] [ext_resource type="Script" path="res://fish/fish_data.gd" id="1_fish_data"] [ext_resource type="Resource" path="res://fishing/common_catch_profile.tres" id="2_profile"] [ext_resource type="Script" path="res://fish/fish_availability.gd" id="3_availability"] +[ext_resource type="Texture2D" path="res://art/exported/creatures/fish_placeholder.png" id="99_fish_placeholder"] [sub_resource type="Resource" id="Availability"] script = ExtResource("3_availability") @@ -13,10 +14,11 @@ require_rain = true script = ExtResource("1_fish_data") id = &"sawfish_largetooth" display_name = "largetooth sawfish" -active = false +active = true catalog_number = 5103 collection_group = &"Rays and skates" logbook_fact = "largetooth sawfish detect hidden prey with a long sensory rostrum. a swift sideways sweep stuns fish and exposes animals buried in mud." +available_seasons = 15 allowed_water_types = 2 rarity = 4 base_catch_weight = 0.035 @@ -27,3 +29,4 @@ weight_max_lb = 1300.0 sell_value_min = 58 sell_value_max = 135 sell_value_curve = 0.78 +display_texture = ExtResource("99_fish_placeholder") diff --git a/fish/species/scorpionfish_red/scorpionfish_red.tres b/fish/species/scorpionfish_red/scorpionfish_red.tres index eda1241..baf9046 100644 --- a/fish/species/scorpionfish_red/scorpionfish_red.tres +++ b/fish/species/scorpionfish_red/scorpionfish_red.tres @@ -1,8 +1,9 @@ -[gd_resource type="Resource" script_class="FishData" load_steps=4 format=3] +[gd_resource type="Resource" script_class="FishData" load_steps=5 format=3] [ext_resource type="Script" path="res://fish/fish_data.gd" id="1_fish_data"] [ext_resource type="Resource" path="res://fishing/common_catch_profile.tres" id="2_profile"] [ext_resource type="Script" path="res://fish/fish_availability.gd" id="3_availability"] +[ext_resource type="Texture2D" path="res://art/exported/creatures/fish_placeholder.png" id="99_fish_placeholder"] [sub_resource type="Resource" id="Availability"] script = ExtResource("3_availability") @@ -12,10 +13,11 @@ allow_day = false script = ExtResource("1_fish_data") id = &"scorpionfish_red" display_name = "red scorpionfish" -active = false +active = true catalog_number = 5202 collection_group = &"Reef ambush fish" logbook_fact = "red scorpionfish vanish against rocky reefs through mottled color and skin flaps. venomous dorsal spines punish careless predators." +available_seasons = 15 allowed_water_types = 2 rarity = 2 base_catch_weight = 0.3 @@ -26,3 +28,4 @@ weight_max_lb = 7.0 sell_value_min = 11 sell_value_max = 25 sell_value_curve = 0.9 +display_texture = ExtResource("99_fish_placeholder") diff --git a/fish/species/sea_bass_black/sea_bass_black.tres b/fish/species/sea_bass_black/sea_bass_black.tres index 0f4fca3..1c0eabd 100644 --- a/fish/species/sea_bass_black/sea_bass_black.tres +++ b/fish/species/sea_bass_black/sea_bass_black.tres @@ -1,8 +1,9 @@ -[gd_resource type="Resource" script_class="FishData" load_steps=4 format=3] +[gd_resource type="Resource" script_class="FishData" load_steps=5 format=3] [ext_resource type="Script" path="res://fish/fish_data.gd" id="1_fish_data"] [ext_resource type="Resource" path="res://fishing/common_catch_profile.tres" id="2_profile"] [ext_resource type="Script" path="res://fish/fish_availability.gd" id="3_availability"] +[ext_resource type="Texture2D" path="res://art/exported/creatures/fish_placeholder.png" id="99_fish_placeholder"] [sub_resource type="Resource" id="Availability"] script = ExtResource("3_availability") @@ -12,10 +13,11 @@ allow_night = false script = ExtResource("1_fish_data") id = &"sea_bass_black" display_name = "black sea bass" -active = false +active = true catalog_number = 6902 collection_group = &"Temperate reef fish" logbook_fact = "black sea bass shelter around reefs, piers, and wrecks. many begin life as female and later become male." +available_seasons = 13 allowed_water_types = 2 rarity = 0 base_catch_weight = 1.7 @@ -26,3 +28,4 @@ weight_max_lb = 8.0 sell_value_min = 4 sell_value_max = 10 sell_value_curve = 0.9 +display_texture = ExtResource("99_fish_placeholder") diff --git a/fish/species/sea_bass_chilean/sea_bass_chilean.tres b/fish/species/sea_bass_chilean/sea_bass_chilean.tres index c52a88c..dd9afac 100644 --- a/fish/species/sea_bass_chilean/sea_bass_chilean.tres +++ b/fish/species/sea_bass_chilean/sea_bass_chilean.tres @@ -1,8 +1,9 @@ -[gd_resource type="Resource" script_class="FishData" load_steps=4 format=3] +[gd_resource type="Resource" script_class="FishData" load_steps=5 format=3] [ext_resource type="Script" path="res://fish/fish_data.gd" id="1_fish_data"] [ext_resource type="Resource" path="res://fishing/common_catch_profile.tres" id="2_profile"] [ext_resource type="Script" path="res://fish/fish_availability.gd" id="3_availability"] +[ext_resource type="Texture2D" path="res://art/exported/creatures/fish_placeholder.png" id="99_fish_placeholder"] [sub_resource type="Resource" id="Availability"] script = ExtResource("3_availability") @@ -12,10 +13,11 @@ allow_day = false script = ExtResource("1_fish_data") id = &"sea_bass_chilean" display_name = "Patagonian toothfish" -active = false +active = true catalog_number = 1604 collection_group = &"Deep shelf fish" logbook_fact = "patagonian toothfish patrol cold, deep southern water with large canine teeth. natural antifreeze proteins protect their blood from freezing." +available_seasons = 15 allowed_water_types = 2 rarity = 3 base_catch_weight = 0.09 @@ -26,3 +28,4 @@ weight_max_lb = 220.0 sell_value_min = 32 sell_value_max = 78 sell_value_curve = 0.8 +display_texture = ExtResource("99_fish_placeholder") diff --git a/fish/species/sea_cucumber_giant_california/sea_cucumber_giant_california.tres b/fish/species/sea_cucumber_giant_california/sea_cucumber_giant_california.tres index 5670862..bc1ca41 100644 --- a/fish/species/sea_cucumber_giant_california/sea_cucumber_giant_california.tres +++ b/fish/species/sea_cucumber_giant_california/sea_cucumber_giant_california.tres @@ -1,8 +1,9 @@ -[gd_resource type="Resource" script_class="FishData" load_steps=4 format=3] +[gd_resource type="Resource" script_class="FishData" load_steps=5 format=3] [ext_resource type="Script" path="res://fish/fish_data.gd" id="1_fish_data"] [ext_resource type="Resource" path="res://fishing/common_catch_profile.tres" id="2_profile"] [ext_resource type="Script" path="res://fish/fish_availability.gd" id="3_availability"] +[ext_resource type="Texture2D" path="res://art/exported/creatures/fish_placeholder.png" id="99_fish_placeholder"] [sub_resource type="Resource" id="Availability"] script = ExtResource("3_availability") @@ -13,10 +14,11 @@ require_fog = true script = ExtResource("1_fish_data") id = &"sea_cucumber_giant_california" display_name = "giant California sea cucumber" -active = false +active = true catalog_number = 1902 collection_group = &"Echinoderms" logbook_fact = "giant california sea cucumbers sweep organic particles from the seafloor with branching tentacles. soft tube feet anchor their long bodies." +available_seasons = 15 allowed_water_types = 2 rarity = 2 base_catch_weight = 0.24 @@ -27,3 +29,4 @@ weight_max_lb = 5.0 sell_value_min = 13 sell_value_max = 29 sell_value_curve = 0.93 +display_texture = ExtResource("99_fish_placeholder") diff --git a/fish/species/sea_otter/sea_otter.tres b/fish/species/sea_otter/sea_otter.tres index c7740a3..c5f4bfc 100644 --- a/fish/species/sea_otter/sea_otter.tres +++ b/fish/species/sea_otter/sea_otter.tres @@ -1,8 +1,9 @@ -[gd_resource type="Resource" script_class="FishData" load_steps=4 format=3] +[gd_resource type="Resource" script_class="FishData" load_steps=5 format=3] [ext_resource type="Script" path="res://fish/fish_data.gd" id="1_fish_data"] [ext_resource type="Resource" path="res://fishing/common_catch_profile.tres" id="2_profile"] [ext_resource type="Script" path="res://fish/fish_availability.gd" id="3_availability"] +[ext_resource type="Texture2D" path="res://art/exported/creatures/fish_placeholder.png" id="99_fish_placeholder"] [sub_resource type="Resource" id="Availability"] script = ExtResource("3_availability") @@ -12,10 +13,11 @@ allow_night = false script = ExtResource("1_fish_data") id = &"sea_otter" display_name = "sea otter" -active = false +active = true catalog_number = 503 collection_group = &"Coastal marine mammals" logbook_fact = "sea otters float on their backs while opening shellfish with stones. dense fur traps insulating air because they lack a thick blubber layer." +available_seasons = 15 allowed_water_types = 2 rarity = 4 base_catch_weight = 0.02 @@ -26,3 +28,4 @@ weight_max_lb = 100.0 sell_value_min = 55 sell_value_max = 125 sell_value_curve = 0.84 +display_texture = ExtResource("99_fish_placeholder") diff --git a/fish/species/sea_star_crown_of_thorns/sea_star_crown_of_thorns.tres b/fish/species/sea_star_crown_of_thorns/sea_star_crown_of_thorns.tres index bfc9493..5e73beb 100644 --- a/fish/species/sea_star_crown_of_thorns/sea_star_crown_of_thorns.tres +++ b/fish/species/sea_star_crown_of_thorns/sea_star_crown_of_thorns.tres @@ -1,8 +1,9 @@ -[gd_resource type="Resource" script_class="FishData" load_steps=4 format=3] +[gd_resource type="Resource" script_class="FishData" load_steps=5 format=3] [ext_resource type="Script" path="res://fish/fish_data.gd" id="1_fish_data"] [ext_resource type="Resource" path="res://fishing/common_catch_profile.tres" id="2_profile"] [ext_resource type="Script" path="res://fish/fish_availability.gd" id="3_availability"] +[ext_resource type="Texture2D" path="res://art/exported/creatures/fish_placeholder.png" id="99_fish_placeholder"] [sub_resource type="Resource" id="Availability"] script = ExtResource("3_availability") @@ -13,10 +14,11 @@ require_rain = true script = ExtResource("1_fish_data") id = &"sea_star_crown_of_thorns" display_name = "crown-of-thorns sea star" -active = false +active = true catalog_number = 1901 collection_group = &"Echinoderms" logbook_fact = "crown-of-thorns sea stars crawl over reefs and digest coral tissue outside the body. venomous spines discourage many predators." +available_seasons = 15 allowed_water_types = 2 rarity = 3 base_catch_weight = 0.1 @@ -27,3 +29,4 @@ weight_max_lb = 7.0 sell_value_min = 23 sell_value_max = 52 sell_value_curve = 0.91 +display_texture = ExtResource("99_fish_placeholder") diff --git a/fish/species/sea_star_sunflower/sea_star_sunflower.tres b/fish/species/sea_star_sunflower/sea_star_sunflower.tres index 7409a31..6bf1dc2 100644 --- a/fish/species/sea_star_sunflower/sea_star_sunflower.tres +++ b/fish/species/sea_star_sunflower/sea_star_sunflower.tres @@ -1,8 +1,9 @@ -[gd_resource type="Resource" script_class="FishData" load_steps=4 format=3] +[gd_resource type="Resource" script_class="FishData" load_steps=5 format=3] [ext_resource type="Script" path="res://fish/fish_data.gd" id="1_fish_data"] [ext_resource type="Resource" path="res://fishing/common_catch_profile.tres" id="2_profile"] [ext_resource type="Script" path="res://fish/fish_availability.gd" id="3_availability"] +[ext_resource type="Texture2D" path="res://art/exported/creatures/fish_placeholder.png" id="99_fish_placeholder"] [sub_resource type="Resource" id="Availability"] script = ExtResource("3_availability") @@ -13,10 +14,11 @@ require_fog = true script = ExtResource("1_fish_data") id = &"sea_star_sunflower" display_name = "sunflower sea star" -active = false +active = true catalog_number = 1905 collection_group = &"Echinoderms" logbook_fact = "sunflower sea stars move quickly on thousands of tube feet and may carry many arms. they hunt urchins, clams, and other bottom animals." +available_seasons = 15 allowed_water_types = 2 rarity = 2 base_catch_weight = 0.25 @@ -27,3 +29,4 @@ weight_max_lb = 13.0 sell_value_min = 14 sell_value_max = 32 sell_value_curve = 0.89 +display_texture = ExtResource("99_fish_placeholder") diff --git a/fish/species/seadragon_leafy/seadragon_leafy.tres b/fish/species/seadragon_leafy/seadragon_leafy.tres index b137a34..1481d73 100644 --- a/fish/species/seadragon_leafy/seadragon_leafy.tres +++ b/fish/species/seadragon_leafy/seadragon_leafy.tres @@ -1,8 +1,9 @@ -[gd_resource type="Resource" script_class="FishData" load_steps=4 format=3] +[gd_resource type="Resource" script_class="FishData" load_steps=5 format=3] [ext_resource type="Script" path="res://fish/fish_data.gd" id="1_fish_data"] [ext_resource type="Resource" path="res://fishing/common_catch_profile.tres" id="2_profile"] [ext_resource type="Script" path="res://fish/fish_availability.gd" id="3_availability"] +[ext_resource type="Texture2D" path="res://art/exported/creatures/fish_placeholder.png" id="99_fish_placeholder"] [sub_resource type="Resource" id="Availability"] script = ExtResource("3_availability") @@ -13,10 +14,11 @@ forbid_fog = true script = ExtResource("1_fish_data") id = &"seadragon_leafy" display_name = "leafy seadragon" -active = false +active = true catalog_number = 6301 collection_group = &"Seahorses and seadragons" logbook_fact = "leafy seadragons drift among seaweed with elaborate skin lobes that resemble leaves. males carry eggs beneath the tail." +available_seasons = 15 allowed_water_types = 2 rarity = 3 base_catch_weight = 0.1 @@ -27,3 +29,4 @@ weight_max_lb = 0.5 sell_value_min = 24 sell_value_max = 55 sell_value_curve = 0.94 +display_texture = ExtResource("99_fish_placeholder") diff --git a/fish/species/seadragon_weedy/seadragon_weedy.tres b/fish/species/seadragon_weedy/seadragon_weedy.tres index e388f50..bc1768b 100644 --- a/fish/species/seadragon_weedy/seadragon_weedy.tres +++ b/fish/species/seadragon_weedy/seadragon_weedy.tres @@ -1,8 +1,9 @@ -[gd_resource type="Resource" script_class="FishData" load_steps=4 format=3] +[gd_resource type="Resource" script_class="FishData" load_steps=5 format=3] [ext_resource type="Script" path="res://fish/fish_data.gd" id="1_fish_data"] [ext_resource type="Resource" path="res://fishing/common_catch_profile.tres" id="2_profile"] [ext_resource type="Script" path="res://fish/fish_availability.gd" id="3_availability"] +[ext_resource type="Texture2D" path="res://art/exported/creatures/fish_placeholder.png" id="99_fish_placeholder"] [sub_resource type="Resource" id="Availability"] script = ExtResource("3_availability") @@ -13,10 +14,11 @@ require_fog = true script = ExtResource("1_fish_data") id = &"seadragon_weedy" display_name = "weedy seadragon" -active = false +active = true catalog_number = 6302 collection_group = &"Seahorses and seadragons" logbook_fact = "weedy seadragons rely on slender bodies and small leaf-like lobes for camouflage. males brood rows of eggs on the underside of the tail." +available_seasons = 15 allowed_water_types = 2 rarity = 2 base_catch_weight = 0.22 @@ -27,3 +29,4 @@ weight_max_lb = 0.6 sell_value_min = 16 sell_value_max = 38 sell_value_curve = 0.93 +display_texture = ExtResource("99_fish_placeholder") diff --git a/fish/species/seahorse_lined/seahorse_lined.tres b/fish/species/seahorse_lined/seahorse_lined.tres index 42fe3e3..0121fab 100644 --- a/fish/species/seahorse_lined/seahorse_lined.tres +++ b/fish/species/seahorse_lined/seahorse_lined.tres @@ -1,8 +1,9 @@ -[gd_resource type="Resource" script_class="FishData" load_steps=4 format=3] +[gd_resource type="Resource" script_class="FishData" load_steps=5 format=3] [ext_resource type="Script" path="res://fish/fish_data.gd" id="1_fish_data"] [ext_resource type="Resource" path="res://fishing/common_catch_profile.tres" id="2_profile"] [ext_resource type="Script" path="res://fish/fish_availability.gd" id="3_availability"] +[ext_resource type="Texture2D" path="res://art/exported/creatures/fish_placeholder.png" id="99_fish_placeholder"] [sub_resource type="Resource" id="Availability"] script = ExtResource("3_availability") @@ -13,10 +14,11 @@ forbid_rain = true script = ExtResource("1_fish_data") id = &"seahorse_lined" display_name = "lined seahorse" -active = false +active = true catalog_number = 602 collection_group = &"Coastal oddities" logbook_fact = "lined seahorses anchor to grass and coral with curling tails. the male broods eggs in a pouch and releases fully formed young." +available_seasons = 15 allowed_water_types = 2 rarity = 2 base_catch_weight = 0.28 @@ -27,3 +29,4 @@ weight_max_lb = 0.05 sell_value_min = 9 sell_value_max = 20 sell_value_curve = 1.0 +display_texture = ExtResource("99_fish_placeholder") diff --git a/fish/species/seal_harbor/seal_harbor.tres b/fish/species/seal_harbor/seal_harbor.tres index 59bdf2b..5689a14 100644 --- a/fish/species/seal_harbor/seal_harbor.tres +++ b/fish/species/seal_harbor/seal_harbor.tres @@ -1,8 +1,9 @@ -[gd_resource type="Resource" script_class="FishData" load_steps=4 format=3] +[gd_resource type="Resource" script_class="FishData" load_steps=5 format=3] [ext_resource type="Script" path="res://fish/fish_data.gd" id="1_fish_data"] [ext_resource type="Resource" path="res://fishing/common_catch_profile.tres" id="2_profile"] [ext_resource type="Script" path="res://fish/fish_availability.gd" id="3_availability"] +[ext_resource type="Texture2D" path="res://art/exported/creatures/fish_placeholder.png" id="99_fish_placeholder"] [sub_resource type="Resource" id="Availability"] script = ExtResource("3_availability") @@ -13,10 +14,11 @@ require_fog = true script = ExtResource("1_fish_data") id = &"seal_harbor" display_name = "harbor seal" -active = false +active = true catalog_number = 502 collection_group = &"Coastal marine mammals" logbook_fact = "harbor seals rest on rocky shores and sandbars between hunting trips. sensitive whiskers can trace the water trails left by moving fish." +available_seasons = 15 allowed_water_types = 2 rarity = 4 base_catch_weight = 0.018 @@ -27,3 +29,4 @@ weight_max_lb = 370.0 sell_value_min = 60 sell_value_max = 140 sell_value_curve = 0.79 +display_texture = ExtResource("99_fish_placeholder") diff --git a/fish/species/shark_blacktip/shark_blacktip.tres b/fish/species/shark_blacktip/shark_blacktip.tres index 99bc169..e7fc4e6 100644 --- a/fish/species/shark_blacktip/shark_blacktip.tres +++ b/fish/species/shark_blacktip/shark_blacktip.tres @@ -1,8 +1,9 @@ -[gd_resource type="Resource" script_class="FishData" load_steps=4 format=3] +[gd_resource type="Resource" script_class="FishData" load_steps=5 format=3] [ext_resource type="Script" path="res://fish/fish_data.gd" id="1_fish_data"] [ext_resource type="Resource" path="res://fishing/common_catch_profile.tres" id="2_profile"] [ext_resource type="Script" path="res://fish/fish_availability.gd" id="3_availability"] +[ext_resource type="Texture2D" path="res://art/exported/creatures/fish_placeholder.png" id="99_fish_placeholder"] [sub_resource type="Resource" id="Availability"] script = ExtResource("3_availability") @@ -13,10 +14,11 @@ require_rain = true script = ExtResource("1_fish_data") id = &"shark_blacktip" display_name = "blacktip shark" -active = false +active = true catalog_number = 901 collection_group = &"Coastal sharks" logbook_fact = "blacktip sharks are named for the dark markings on their fins. they hunt schooling fish in warm shallows and sometimes leap clear of the water." +available_seasons = 6 allowed_water_types = 2 rarity = 3 base_catch_weight = 0.1 @@ -27,3 +29,4 @@ weight_max_lb = 150.0 sell_value_min = 32 sell_value_max = 75 sell_value_curve = 0.8 +display_texture = ExtResource("99_fish_placeholder") diff --git a/fish/species/shark_great_hammerhead/shark_great_hammerhead.tres b/fish/species/shark_great_hammerhead/shark_great_hammerhead.tres index 65b9d96..a9b612e 100644 --- a/fish/species/shark_great_hammerhead/shark_great_hammerhead.tres +++ b/fish/species/shark_great_hammerhead/shark_great_hammerhead.tres @@ -1,8 +1,9 @@ -[gd_resource type="Resource" script_class="FishData" load_steps=4 format=3] +[gd_resource type="Resource" script_class="FishData" load_steps=5 format=3] [ext_resource type="Script" path="res://fish/fish_data.gd" id="1_fish_data"] [ext_resource type="Resource" path="res://fishing/common_catch_profile.tres" id="2_profile"] [ext_resource type="Script" path="res://fish/fish_availability.gd" id="3_availability"] +[ext_resource type="Texture2D" path="res://art/exported/creatures/fish_placeholder.png" id="99_fish_placeholder"] [sub_resource type="Resource" id="Availability"] script = ExtResource("3_availability") @@ -13,10 +14,11 @@ forbid_fog = true script = ExtResource("1_fish_data") id = &"shark_great_hammerhead" display_name = "great hammerhead shark" -active = false +active = true catalog_number = 902 collection_group = &"Coastal sharks" logbook_fact = "great hammerheads sweep their wide heads over the bottom while searching for rays. widely spaced senses help pinpoint hidden prey." +available_seasons = 6 allowed_water_types = 2 rarity = 4 base_catch_weight = 0.035 @@ -27,3 +29,4 @@ weight_max_lb = 1000.0 sell_value_min = 62 sell_value_max = 145 sell_value_curve = 0.78 +display_texture = ExtResource("99_fish_placeholder") diff --git a/fish/species/shark_great_white/shark_great_white.tres b/fish/species/shark_great_white/shark_great_white.tres index 560b596..afd1cd0 100644 --- a/fish/species/shark_great_white/shark_great_white.tres +++ b/fish/species/shark_great_white/shark_great_white.tres @@ -1,8 +1,9 @@ -[gd_resource type="Resource" script_class="FishData" load_steps=4 format=3] +[gd_resource type="Resource" script_class="FishData" load_steps=5 format=3] [ext_resource type="Script" path="res://fish/fish_data.gd" id="1_fish_data"] [ext_resource type="Resource" path="res://fishing/common_catch_profile.tres" id="2_profile"] [ext_resource type="Script" path="res://fish/fish_availability.gd" id="3_availability"] +[ext_resource type="Texture2D" path="res://art/exported/creatures/fish_placeholder.png" id="99_fish_placeholder"] [sub_resource type="Resource" id="Availability"] script = ExtResource("3_availability") @@ -12,10 +13,11 @@ allow_night = false script = ExtResource("1_fish_data") id = &"shark_great_white" display_name = "great white shark" -active = false +active = true catalog_number = 903 collection_group = &"Coastal sharks" logbook_fact = "great white sharks conserve heat in their swimming muscles while crossing cool seas. rows of serrated teeth are replaced throughout life." +available_seasons = 15 allowed_water_types = 2 rarity = 4 base_catch_weight = 0.025 @@ -26,3 +28,4 @@ weight_max_lb = 1000.0 sell_value_min = 70 sell_value_max = 150 sell_value_curve = 0.76 +display_texture = ExtResource("99_fish_placeholder") diff --git a/fish/species/shark_tiger/shark_tiger.tres b/fish/species/shark_tiger/shark_tiger.tres index a3f34f7..72e2577 100644 --- a/fish/species/shark_tiger/shark_tiger.tres +++ b/fish/species/shark_tiger/shark_tiger.tres @@ -1,8 +1,9 @@ -[gd_resource type="Resource" script_class="FishData" load_steps=4 format=3] +[gd_resource type="Resource" script_class="FishData" load_steps=5 format=3] [ext_resource type="Script" path="res://fish/fish_data.gd" id="1_fish_data"] [ext_resource type="Resource" path="res://fishing/common_catch_profile.tres" id="2_profile"] [ext_resource type="Script" path="res://fish/fish_availability.gd" id="3_availability"] +[ext_resource type="Texture2D" path="res://art/exported/creatures/fish_placeholder.png" id="99_fish_placeholder"] [sub_resource type="Resource" id="Availability"] script = ExtResource("3_availability") @@ -13,10 +14,11 @@ require_rain = true script = ExtResource("1_fish_data") id = &"shark_tiger" display_name = "tiger shark" -active = false +active = true catalog_number = 904 collection_group = &"Coastal sharks" logbook_fact = "tiger sharks carry dark vertical bars that fade as they mature. broad jaws let them investigate an unusually varied range of prey." +available_seasons = 15 allowed_water_types = 2 rarity = 3 base_catch_weight = 0.06 @@ -27,3 +29,4 @@ weight_max_lb = 1000.0 sell_value_min = 50 sell_value_max = 120 sell_value_curve = 0.8 +display_texture = ExtResource("99_fish_placeholder") diff --git a/fish/species/shark_whale/shark_whale.tres b/fish/species/shark_whale/shark_whale.tres index b0bbe19..81739db 100644 --- a/fish/species/shark_whale/shark_whale.tres +++ b/fish/species/shark_whale/shark_whale.tres @@ -1,8 +1,9 @@ -[gd_resource type="Resource" script_class="FishData" load_steps=4 format=3] +[gd_resource type="Resource" script_class="FishData" load_steps=5 format=3] [ext_resource type="Script" path="res://fish/fish_data.gd" id="1_fish_data"] [ext_resource type="Resource" path="res://fishing/common_catch_profile.tres" id="2_profile"] [ext_resource type="Script" path="res://fish/fish_availability.gd" id="3_availability"] +[ext_resource type="Texture2D" path="res://art/exported/creatures/fish_placeholder.png" id="99_fish_placeholder"] [sub_resource type="Resource" id="Availability"] script = ExtResource("3_availability") @@ -13,10 +14,11 @@ forbid_fog = true script = ExtResource("1_fish_data") id = &"shark_whale" display_name = "whale shark" -active = false +active = true catalog_number = 905 collection_group = &"Coastal sharks" logbook_fact = "whale sharks are enormous filter feeders covered in unique spot patterns. they cruise with open mouths to collect plankton and tiny fish." +available_seasons = 6 allowed_water_types = 2 rarity = 4 base_catch_weight = 0.025 @@ -27,3 +29,4 @@ weight_max_lb = 45000.0 sell_value_min = 70 sell_value_max = 160 sell_value_curve = 0.76 +display_texture = ExtResource("99_fish_placeholder") diff --git a/fish/species/sheepshead/sheepshead.tres b/fish/species/sheepshead/sheepshead.tres index df76f08..d4b8cfa 100644 --- a/fish/species/sheepshead/sheepshead.tres +++ b/fish/species/sheepshead/sheepshead.tres @@ -1,8 +1,9 @@ -[gd_resource type="Resource" script_class="FishData" load_steps=4 format=3] +[gd_resource type="Resource" script_class="FishData" load_steps=5 format=3] [ext_resource type="Script" path="res://fish/fish_data.gd" id="1_fish_data"] [ext_resource type="Resource" path="res://fishing/common_catch_profile.tres" id="2_profile"] [ext_resource type="Script" path="res://fish/fish_availability.gd" id="3_availability"] +[ext_resource type="Texture2D" path="res://art/exported/creatures/6905.png" id="99_fish_placeholder"] [sub_resource type="Resource" id="Availability"] script = ExtResource("3_availability") @@ -12,10 +13,11 @@ allow_night = false script = ExtResource("1_fish_data") id = &"sheepshead" display_name = "sheepshead" -active = false +active = true catalog_number = 6905 collection_group = &"Temperate reef fish" logbook_fact = "sheepshead carry flat human-like front teeth for biting barnacles and crabs. dark bars cross their high silver bodies." +available_seasons = 13 allowed_water_types = 2 rarity = 1 base_catch_weight = 0.75 @@ -26,3 +28,4 @@ weight_max_lb = 20.0 sell_value_min = 7 sell_value_max = 18 sell_value_curve = 0.86 +display_texture = ExtResource("99_fish_placeholder") diff --git a/fish/species/shiner_common/shiner_common.tres b/fish/species/shiner_common/shiner_common.tres index 505bb24..562daf6 100644 --- a/fish/species/shiner_common/shiner_common.tres +++ b/fish/species/shiner_common/shiner_common.tres @@ -1,8 +1,9 @@ -[gd_resource type="Resource" script_class="FishData" load_steps=4 format=3] +[gd_resource type="Resource" script_class="FishData" load_steps=5 format=3] [ext_resource type="Script" path="res://fish/fish_data.gd" id="1_fish_data"] [ext_resource type="Resource" path="res://fishing/common_catch_profile.tres" id="2_profile"] [ext_resource type="Script" path="res://fish/fish_availability.gd" id="3_availability"] +[ext_resource type="Texture2D" path="res://art/exported/creatures/fish_placeholder.png" id="99_fish_placeholder"] [sub_resource type="Resource" id="Availability"] script = ExtResource("3_availability") @@ -12,10 +13,11 @@ allow_night = false script = ExtResource("1_fish_data") id = &"shiner_common" display_name = "common shiner" -active = false +active = true catalog_number = 2801 collection_group = &"Freshwater minnows" logbook_fact = "common shiners flash silver in clear streams and small rivers. breeding males develop rosy fins and a blue-violet sheen." +available_seasons = 7 allowed_water_types = 1 rarity = 0 base_catch_weight = 4.0 @@ -26,3 +28,4 @@ weight_max_lb = 0.3 sell_value_min = 1 sell_value_max = 3 sell_value_curve = 1.0 +display_texture = ExtResource("99_fish_placeholder") diff --git a/fish/species/shiner_emerald/shiner_emerald.tres b/fish/species/shiner_emerald/shiner_emerald.tres index 7497ae6..eeb3653 100644 --- a/fish/species/shiner_emerald/shiner_emerald.tres +++ b/fish/species/shiner_emerald/shiner_emerald.tres @@ -1,8 +1,9 @@ -[gd_resource type="Resource" script_class="FishData" load_steps=4 format=3] +[gd_resource type="Resource" script_class="FishData" load_steps=5 format=3] [ext_resource type="Script" path="res://fish/fish_data.gd" id="1_fish_data"] [ext_resource type="Resource" path="res://fishing/common_catch_profile.tres" id="2_profile"] [ext_resource type="Script" path="res://fish/fish_availability.gd" id="3_availability"] +[ext_resource type="Texture2D" path="res://art/exported/creatures/fish_placeholder.png" id="99_fish_placeholder"] [sub_resource type="Resource" id="Availability"] script = ExtResource("3_availability") @@ -11,10 +12,11 @@ script = ExtResource("3_availability") script = ExtResource("1_fish_data") id = &"shiner_emerald" display_name = "emerald shiner" -active = false +active = true catalog_number = 2803 collection_group = &"Freshwater minnows" logbook_fact = "emerald shiners form bright surface schools in large lakes and rivers. slender bodies feed on plankton and drifting insects." +available_seasons = 7 allowed_water_types = 1 rarity = 0 base_catch_weight = 3.5 @@ -25,3 +27,4 @@ weight_max_lb = 0.25 sell_value_min = 1 sell_value_max = 3 sell_value_curve = 1.0 +display_texture = ExtResource("99_fish_placeholder") diff --git a/fish/species/shiner_golden/shiner_golden.tres b/fish/species/shiner_golden/shiner_golden.tres index 755bffb..5ab924f 100644 --- a/fish/species/shiner_golden/shiner_golden.tres +++ b/fish/species/shiner_golden/shiner_golden.tres @@ -1,8 +1,9 @@ -[gd_resource type="Resource" script_class="FishData" load_steps=4 format=3] +[gd_resource type="Resource" script_class="FishData" load_steps=5 format=3] [ext_resource type="Script" path="res://fish/fish_data.gd" id="1_fish_data"] [ext_resource type="Resource" path="res://fishing/common_catch_profile.tres" id="2_profile"] [ext_resource type="Script" path="res://fish/fish_availability.gd" id="3_availability"] +[ext_resource type="Texture2D" path="res://art/exported/creatures/fish_placeholder.png" id="99_fish_placeholder"] [sub_resource type="Resource" id="Availability"] script = ExtResource("3_availability") @@ -12,10 +13,11 @@ allow_night = false script = ExtResource("1_fish_data") id = &"shiner_golden" display_name = "golden shiner" -active = false +active = true catalog_number = 2806 collection_group = &"Freshwater minnows" logbook_fact = "golden shiners school around dense vegetation in warm water. an upturned mouth takes insects and plankton from near the surface." +available_seasons = 7 allowed_water_types = 1 rarity = 0 base_catch_weight = 3.8 @@ -26,3 +28,4 @@ weight_max_lb = 1.0 sell_value_min = 2 sell_value_max = 4 sell_value_curve = 1.0 +display_texture = ExtResource("99_fish_placeholder") diff --git a/fish/species/shrimp_peacock_mantis/shrimp_peacock_mantis.tres b/fish/species/shrimp_peacock_mantis/shrimp_peacock_mantis.tres index 4a12b76..daf7662 100644 --- a/fish/species/shrimp_peacock_mantis/shrimp_peacock_mantis.tres +++ b/fish/species/shrimp_peacock_mantis/shrimp_peacock_mantis.tres @@ -1,8 +1,9 @@ -[gd_resource type="Resource" script_class="FishData" load_steps=4 format=3] +[gd_resource type="Resource" script_class="FishData" load_steps=5 format=3] [ext_resource type="Script" path="res://fish/fish_data.gd" id="1_fish_data"] [ext_resource type="Resource" path="res://fishing/common_catch_profile.tres" id="2_profile"] [ext_resource type="Script" path="res://fish/fish_availability.gd" id="3_availability"] +[ext_resource type="Texture2D" path="res://art/exported/creatures/fish_placeholder.png" id="99_fish_placeholder"] [sub_resource type="Resource" id="Availability"] script = ExtResource("3_availability") @@ -13,10 +14,11 @@ require_rain = true script = ExtResource("1_fish_data") id = &"shrimp_peacock_mantis" display_name = "peacock mantis shrimp" -active = false +active = true catalog_number = 3804 collection_group = &"Lobsters and shrimp" logbook_fact = "peacock mantis shrimp strike hard-shelled prey with club-like limbs. complex eyes move independently and detect colors beyond human vision." +available_seasons = 15 allowed_water_types = 2 rarity = 3 base_catch_weight = 0.1 @@ -27,3 +29,4 @@ weight_max_lb = 0.4 sell_value_min = 22 sell_value_max = 50 sell_value_curve = 0.96 +display_texture = ExtResource("99_fish_placeholder") diff --git a/fish/species/shrimp_skunk_cleaner/shrimp_skunk_cleaner.tres b/fish/species/shrimp_skunk_cleaner/shrimp_skunk_cleaner.tres index 9ab3908..fdd6730 100644 --- a/fish/species/shrimp_skunk_cleaner/shrimp_skunk_cleaner.tres +++ b/fish/species/shrimp_skunk_cleaner/shrimp_skunk_cleaner.tres @@ -1,8 +1,9 @@ -[gd_resource type="Resource" script_class="FishData" load_steps=4 format=3] +[gd_resource type="Resource" script_class="FishData" load_steps=5 format=3] [ext_resource type="Script" path="res://fish/fish_data.gd" id="1_fish_data"] [ext_resource type="Resource" path="res://fishing/common_catch_profile.tres" id="2_profile"] [ext_resource type="Script" path="res://fish/fish_availability.gd" id="3_availability"] +[ext_resource type="Texture2D" path="res://art/exported/creatures/fish_placeholder.png" id="99_fish_placeholder"] [sub_resource type="Resource" id="Availability"] script = ExtResource("3_availability") @@ -13,10 +14,11 @@ forbid_fog = true script = ExtResource("1_fish_data") id = &"shrimp_skunk_cleaner" display_name = "skunk cleaner shrimp" -active = false +active = true catalog_number = 3805 collection_group = &"Lobsters and shrimp" logbook_fact = "skunk cleaner shrimp advertise at reef cleaning stations with bright white antennae. visiting fish pause while parasites are picked away." +available_seasons = 15 allowed_water_types = 2 rarity = 1 base_catch_weight = 0.75 @@ -27,3 +29,4 @@ weight_max_lb = 0.15 sell_value_min = 5 sell_value_max = 11 sell_value_curve = 0.98 +display_texture = ExtResource("99_fish_placeholder") diff --git a/fish/species/skate_barndoor/skate_barndoor.tres b/fish/species/skate_barndoor/skate_barndoor.tres index 013fc2f..5ccb967 100644 --- a/fish/species/skate_barndoor/skate_barndoor.tres +++ b/fish/species/skate_barndoor/skate_barndoor.tres @@ -1,8 +1,9 @@ -[gd_resource type="Resource" script_class="FishData" load_steps=4 format=3] +[gd_resource type="Resource" script_class="FishData" load_steps=5 format=3] [ext_resource type="Script" path="res://fish/fish_data.gd" id="1_fish_data"] [ext_resource type="Resource" path="res://fishing/common_catch_profile.tres" id="2_profile"] [ext_resource type="Script" path="res://fish/fish_availability.gd" id="3_availability"] +[ext_resource type="Texture2D" path="res://art/exported/creatures/fish_placeholder.png" id="99_fish_placeholder"] [sub_resource type="Resource" id="Availability"] script = ExtResource("3_availability") @@ -12,10 +13,11 @@ require_fog = true script = ExtResource("1_fish_data") id = &"skate_barndoor" display_name = "barndoor skate" -active = false +active = true catalog_number = 5101 collection_group = &"Rays and skates" logbook_fact = "barndoor skates glide over cold atlantic bottoms with broad wing-like fins. rows of thorny spines protect the back and tail." +available_seasons = 13 allowed_water_types = 2 rarity = 3 base_catch_weight = 0.1 @@ -26,3 +28,4 @@ weight_max_lb = 150.0 sell_value_min = 28 sell_value_max = 68 sell_value_curve = 0.8 +display_texture = ExtResource("99_fish_placeholder") diff --git a/fish/species/smallmouth_bass/smallmouth_bass.tres b/fish/species/smallmouth_bass/smallmouth_bass.tres index 11e876f..d840f32 100644 --- a/fish/species/smallmouth_bass/smallmouth_bass.tres +++ b/fish/species/smallmouth_bass/smallmouth_bass.tres @@ -1,8 +1,9 @@ -[gd_resource type="Resource" script_class="FishData" load_steps=4 format=3] +[gd_resource type="Resource" script_class="FishData" load_steps=5 format=3] [ext_resource type="Script" path="res://fish/fish_data.gd" id="1_fish_data"] [ext_resource type="Resource" path="res://fishing/common_catch_profile.tres" id="2_profile"] [ext_resource type="Script" path="res://fish/fish_availability.gd" id="3_availability"] +[ext_resource type="Texture2D" path="res://art/exported/creatures/fish_placeholder.png" id="99_fish_placeholder"] [sub_resource type="Resource" id="Availability"] script = ExtResource("3_availability") @@ -12,10 +13,11 @@ allow_night = false script = ExtResource("1_fish_data") id = &"smallmouth_bass" display_name = "smallmouth bass" -active = false +active = true catalog_number = 2202 collection_group = &"Freshwater bass" logbook_fact = "smallmouth bass favor clear water with rock and moving current. bronze flanks and dark vertical bars distinguish them from largemouth bass." +available_seasons = 7 allowed_water_types = 1 rarity = 1 base_catch_weight = 1.2 @@ -26,3 +28,4 @@ weight_max_lb = 12.0 sell_value_min = 6 sell_value_max = 15 sell_value_curve = 0.9 +display_texture = ExtResource("99_fish_placeholder") diff --git a/fish/species/smelt_eulachon/smelt_eulachon.tres b/fish/species/smelt_eulachon/smelt_eulachon.tres index b6d7b16..f3be455 100644 --- a/fish/species/smelt_eulachon/smelt_eulachon.tres +++ b/fish/species/smelt_eulachon/smelt_eulachon.tres @@ -1,8 +1,9 @@ -[gd_resource type="Resource" script_class="FishData" load_steps=4 format=3] +[gd_resource type="Resource" script_class="FishData" load_steps=5 format=3] [ext_resource type="Script" path="res://fish/fish_data.gd" id="1_fish_data"] [ext_resource type="Resource" path="res://fishing/common_catch_profile.tres" id="2_profile"] [ext_resource type="Script" path="res://fish/fish_availability.gd" id="3_availability"] +[ext_resource type="Texture2D" path="res://art/exported/creatures/fish_placeholder.png" id="99_fish_placeholder"] [sub_resource type="Resource" id="Availability"] script = ExtResource("3_availability") @@ -13,10 +14,11 @@ require_rain = true script = ExtResource("1_fish_data") id = &"smelt_eulachon" display_name = "eulachon" -active = false +active = true catalog_number = 4201 collection_group = &"Ocean-run forage fish" logbook_fact = "eulachon return from the pacific to spawn in coastal rivers. their oil-rich bodies once served as candles when dried and fitted with wicks." +available_seasons = 1 allowed_water_types = 3 rarity = 1 base_catch_weight = 0.9 @@ -27,3 +29,4 @@ weight_max_lb = 0.5 sell_value_min = 4 sell_value_max = 9 sell_value_curve = 0.98 +display_texture = ExtResource("99_fish_placeholder") diff --git a/fish/species/smelt_rainbow/smelt_rainbow.tres b/fish/species/smelt_rainbow/smelt_rainbow.tres index 19f1b1d..6a0d08a 100644 --- a/fish/species/smelt_rainbow/smelt_rainbow.tres +++ b/fish/species/smelt_rainbow/smelt_rainbow.tres @@ -1,8 +1,9 @@ -[gd_resource type="Resource" script_class="FishData" load_steps=4 format=3] +[gd_resource type="Resource" script_class="FishData" load_steps=5 format=3] [ext_resource type="Script" path="res://fish/fish_data.gd" id="1_fish_data"] [ext_resource type="Resource" path="res://fishing/common_catch_profile.tres" id="2_profile"] [ext_resource type="Script" path="res://fish/fish_availability.gd" id="3_availability"] +[ext_resource type="Texture2D" path="res://art/exported/creatures/fish_placeholder.png" id="99_fish_placeholder"] [sub_resource type="Resource" id="Availability"] script = ExtResource("3_availability") @@ -12,10 +13,11 @@ allow_day = false script = ExtResource("1_fish_data") id = &"smelt_rainbow" display_name = "rainbow smelt" -active = false +active = true catalog_number = 4101 collection_group = &"Migratory forage fish" logbook_fact = "rainbow smelt move between coastal water and rivers, though some remain landlocked. cucumber-like aromas cling to freshly caught fish." +available_seasons = 9 allowed_water_types = 3 rarity = 0 base_catch_weight = 2.5 @@ -26,3 +28,4 @@ weight_max_lb = 0.8 sell_value_min = 2 sell_value_max = 5 sell_value_curve = 1.0 +display_texture = ExtResource("99_fish_placeholder") diff --git a/fish/species/snakehead_giant/snakehead_giant.tres b/fish/species/snakehead_giant/snakehead_giant.tres index 44b10e3..069d723 100644 --- a/fish/species/snakehead_giant/snakehead_giant.tres +++ b/fish/species/snakehead_giant/snakehead_giant.tres @@ -1,8 +1,9 @@ -[gd_resource type="Resource" script_class="FishData" load_steps=4 format=3] +[gd_resource type="Resource" script_class="FishData" load_steps=5 format=3] [ext_resource type="Script" path="res://fish/fish_data.gd" id="1_fish_data"] [ext_resource type="Resource" path="res://fishing/common_catch_profile.tres" id="2_profile"] [ext_resource type="Script" path="res://fish/fish_availability.gd" id="3_availability"] +[ext_resource type="Texture2D" path="res://art/exported/creatures/fish_placeholder.png" id="99_fish_placeholder"] [sub_resource type="Resource" id="Availability"] script = ExtResource("3_availability") @@ -13,10 +14,11 @@ require_fog = true script = ExtResource("1_fish_data") id = &"snakehead_giant" display_name = "giant snakehead" -active = false +active = true catalog_number = 7601 collection_group = &"Tropical freshwater predators" logbook_fact = "giant snakeheads breathe air and guard schools of young near the surface. long bodies launch sudden attacks from flooded vegetation." +available_seasons = 15 allowed_water_types = 1 rarity = 3 base_catch_weight = 0.1 @@ -27,3 +29,4 @@ weight_max_lb = 45.0 sell_value_min = 28 sell_value_max = 64 sell_value_curve = 0.84 +display_texture = ExtResource("99_fish_placeholder") diff --git a/fish/species/snapper_lane/fish_snapper_lane.png b/fish/species/snapper_lane/fish_snapper_lane.png index afedbc3..a9c3270 100644 Binary files a/fish/species/snapper_lane/fish_snapper_lane.png and b/fish/species/snapper_lane/fish_snapper_lane.png differ diff --git a/fish/species/snapper_lane/snapper_lane.tres b/fish/species/snapper_lane/snapper_lane.tres index f72ab38..0288e2d 100644 --- a/fish/species/snapper_lane/snapper_lane.tres +++ b/fish/species/snapper_lane/snapper_lane.tres @@ -3,7 +3,7 @@ [ext_resource type="Script" uid="uid://h7hg45b7wmst" path="res://fish/fish_data.gd" id="1_fish_data"] [ext_resource type="Resource" path="res://fishing/common_catch_profile.tres" id="2_profile"] [ext_resource type="Script" uid="uid://bs7cqi88csolc" path="res://fish/fish_availability.gd" id="3_availability_script"] -[ext_resource type="Texture2D" uid="uid://d3d8s30bxq4tp" path="res://fish/species/snapper_lane/fish_snapper_lane.png" id="4_texture"] +[ext_resource type="Texture2D" path="res://art/exported/creatures/fish_placeholder.png" id="4_texture"] [sub_resource type="Resource" id="SnapperLaneAvailability"] script = ExtResource("3_availability_script") @@ -17,6 +17,7 @@ active = true catalog_number = 6001 collection_group = &"Reef snapper" logbook_fact = "lane snapper use reef structure for cover and hunt small crustaceans and fish when the light begins to fade." +available_seasons = 15 allowed_water_types = 2 base_catch_weight = 0.45 catch_profile = ExtResource("2_profile") diff --git a/fish/species/snapper_mangrove/fish_snapper_mangrove.png b/fish/species/snapper_mangrove/fish_snapper_mangrove.png index 758ee16..37f2850 100644 Binary files a/fish/species/snapper_mangrove/fish_snapper_mangrove.png and b/fish/species/snapper_mangrove/fish_snapper_mangrove.png differ diff --git a/fish/species/snapper_mangrove/snapper_mangrove.tres b/fish/species/snapper_mangrove/snapper_mangrove.tres index f400800..9a0ede5 100644 --- a/fish/species/snapper_mangrove/snapper_mangrove.tres +++ b/fish/species/snapper_mangrove/snapper_mangrove.tres @@ -3,7 +3,7 @@ [ext_resource type="Script" uid="uid://h7hg45b7wmst" path="res://fish/fish_data.gd" id="1_fish_data"] [ext_resource type="Resource" path="res://fishing/common_catch_profile.tres" id="2_profile"] [ext_resource type="Script" uid="uid://bs7cqi88csolc" path="res://fish/fish_availability.gd" id="3_availability_script"] -[ext_resource type="Texture2D" uid="uid://v34sdv1v7c2x" path="res://fish/species/snapper_mangrove/fish_snapper_mangrove.png" id="4_texture"] +[ext_resource type="Texture2D" path="res://art/exported/creatures/fish_placeholder.png" id="4_texture"] [sub_resource type="Resource" id="SnapperMangroveAvailability"] script = ExtResource("3_availability_script") @@ -17,6 +17,7 @@ active = true catalog_number = 6002 collection_group = &"Reef snapper" logbook_fact = "mangrove snapper shelter among roots and docks when young, then move toward reefs as they grow." +available_seasons = 15 allowed_water_types = 2 rarity = 1 base_catch_weight = 0.35 diff --git a/fish/species/snapper_mutton/fish_snapper_mutton.png b/fish/species/snapper_mutton/fish_snapper_mutton.png index f8de3ff..7c99847 100644 Binary files a/fish/species/snapper_mutton/fish_snapper_mutton.png and b/fish/species/snapper_mutton/fish_snapper_mutton.png differ diff --git a/fish/species/snapper_mutton/snapper_mutton.tres b/fish/species/snapper_mutton/snapper_mutton.tres index 37b4b24..7c5aee9 100644 --- a/fish/species/snapper_mutton/snapper_mutton.tres +++ b/fish/species/snapper_mutton/snapper_mutton.tres @@ -3,7 +3,7 @@ [ext_resource type="Script" uid="uid://h7hg45b7wmst" path="res://fish/fish_data.gd" id="1_fish_data"] [ext_resource type="Resource" path="res://fishing/common_catch_profile.tres" id="2_profile"] [ext_resource type="Script" uid="uid://bs7cqi88csolc" path="res://fish/fish_availability.gd" id="3_availability_script"] -[ext_resource type="Texture2D" uid="uid://cawvpo8aysw5i" path="res://fish/species/snapper_mutton/fish_snapper_mutton.png" id="4_texture"] +[ext_resource type="Texture2D" path="res://art/exported/creatures/fish_placeholder.png" id="4_texture"] [sub_resource type="Resource" id="SnapperMuttonAvailability"] script = ExtResource("3_availability_script") @@ -17,6 +17,7 @@ active = true catalog_number = 6003 collection_group = &"Reef snapper" logbook_fact = "mutton snapper have canine teeth that help them pick crabs, shrimp, and other hard-shelled prey from the reef." +available_seasons = 15 allowed_water_types = 2 rarity = 2 base_catch_weight = 0.2 diff --git a/fish/species/snapper_red/fish_snapper_red.png b/fish/species/snapper_red/fish_snapper_red.png index 435a95e..20285eb 100644 Binary files a/fish/species/snapper_red/fish_snapper_red.png and b/fish/species/snapper_red/fish_snapper_red.png differ diff --git a/fish/species/snapper_red/snapper_red.tres b/fish/species/snapper_red/snapper_red.tres index fabf736..247edc0 100644 --- a/fish/species/snapper_red/snapper_red.tres +++ b/fish/species/snapper_red/snapper_red.tres @@ -3,7 +3,7 @@ [ext_resource type="Script" uid="uid://h7hg45b7wmst" path="res://fish/fish_data.gd" id="1_fish_data"] [ext_resource type="Resource" path="res://fishing/common_catch_profile.tres" id="2_profile"] [ext_resource type="Script" uid="uid://bs7cqi88csolc" path="res://fish/fish_availability.gd" id="3_availability_script"] -[ext_resource type="Texture2D" uid="uid://ei5scljuqklk" path="res://fish/species/snapper_red/fish_snapper_red.png" id="4_texture"] +[ext_resource type="Texture2D" path="res://art/exported/creatures/fish_placeholder.png" id="4_texture"] [sub_resource type="Resource" id="SnapperRedAvailability"] script = ExtResource("3_availability_script") @@ -17,6 +17,7 @@ active = true catalog_number = 6004 collection_group = &"Reef snapper" logbook_fact = "red snapper gather around reefs, wrecks, and ledges. their diet includes small fish, shrimp, and squid." +available_seasons = 15 allowed_water_types = 2 rarity = 1 base_catch_weight = 0.35 diff --git a/fish/species/snook_common/snook_common.tres b/fish/species/snook_common/snook_common.tres index e810953..5b84e99 100644 --- a/fish/species/snook_common/snook_common.tres +++ b/fish/species/snook_common/snook_common.tres @@ -1,8 +1,9 @@ -[gd_resource type="Resource" script_class="FishData" load_steps=4 format=3] +[gd_resource type="Resource" script_class="FishData" load_steps=5 format=3] [ext_resource type="Script" path="res://fish/fish_data.gd" id="1_fish_data"] [ext_resource type="Resource" path="res://fishing/common_catch_profile.tres" id="2_profile"] [ext_resource type="Script" path="res://fish/fish_availability.gd" id="3_availability"] +[ext_resource type="Texture2D" path="res://art/exported/creatures/fish_placeholder.png" id="99_fish_placeholder"] [sub_resource type="Resource" id="Availability"] script = ExtResource("3_availability") @@ -13,10 +14,11 @@ require_rain = true script = ExtResource("1_fish_data") id = &"snook_common" display_name = "common snook" -active = false +active = true catalog_number = 7303 collection_group = &"Tropical estuary" logbook_fact = "common snook wait around mangrove roots and current seams to ambush prey. a bold black lateral line divides their silver flanks." +available_seasons = 15 allowed_water_types = 2 rarity = 2 base_catch_weight = 0.3 @@ -27,3 +29,4 @@ weight_max_lb = 30.0 sell_value_min = 13 sell_value_max = 32 sell_value_curve = 0.85 +display_texture = ExtResource("99_fish_placeholder") diff --git a/fish/species/sole_dover/sole_dover.tres b/fish/species/sole_dover/sole_dover.tres index 88daf9a..2b522a0 100644 --- a/fish/species/sole_dover/sole_dover.tres +++ b/fish/species/sole_dover/sole_dover.tres @@ -1,8 +1,9 @@ -[gd_resource type="Resource" script_class="FishData" load_steps=4 format=3] +[gd_resource type="Resource" script_class="FishData" load_steps=5 format=3] [ext_resource type="Script" path="res://fish/fish_data.gd" id="1_fish_data"] [ext_resource type="Resource" path="res://fishing/common_catch_profile.tres" id="2_profile"] [ext_resource type="Script" path="res://fish/fish_availability.gd" id="3_availability"] +[ext_resource type="Texture2D" path="res://art/exported/creatures/fish_placeholder.png" id="99_fish_placeholder"] [sub_resource type="Resource" id="Availability"] script = ExtResource("3_availability") @@ -12,10 +13,11 @@ allow_day = false script = ExtResource("1_fish_data") id = &"sole_dover" display_name = "Dover sole" -active = false +active = true catalog_number = 1404 collection_group = &"Cold shelf fish" logbook_fact = "dover sole glide over deep muddy bottoms of the eastern pacific. both eyes migrate to the right side as the young fish becomes flat." +available_seasons = 13 allowed_water_types = 2 rarity = 1 base_catch_weight = 0.8 @@ -26,3 +28,4 @@ weight_max_lb = 8.0 sell_value_min = 6 sell_value_max = 14 sell_value_curve = 0.9 +display_texture = ExtResource("99_fish_placeholder") diff --git a/fish/species/sprat_european/sprat_european.tres b/fish/species/sprat_european/sprat_european.tres index 20f313c..82f4876 100644 --- a/fish/species/sprat_european/sprat_european.tres +++ b/fish/species/sprat_european/sprat_european.tres @@ -1,8 +1,9 @@ -[gd_resource type="Resource" script_class="FishData" load_steps=4 format=3] +[gd_resource type="Resource" script_class="FishData" load_steps=5 format=3] [ext_resource type="Script" path="res://fish/fish_data.gd" id="1_fish_data"] [ext_resource type="Resource" path="res://fishing/common_catch_profile.tres" id="2_profile"] [ext_resource type="Script" path="res://fish/fish_availability.gd" id="3_availability"] +[ext_resource type="Texture2D" path="res://art/exported/creatures/fish_placeholder.png" id="99_fish_placeholder"] [sub_resource type="Resource" id="Availability"] script = ExtResource("3_availability") @@ -11,10 +12,11 @@ script = ExtResource("3_availability") script = ExtResource("1_fish_data") id = &"sprat_european" display_name = "European sprat" -active = false +active = true catalog_number = 1303 collection_group = &"Cold schooling fish" logbook_fact = "european sprat form compact schools in northern coastal seas. these tiny herring relatives feed on plankton near the surface." +available_seasons = 13 allowed_water_types = 2 rarity = 0 base_catch_weight = 3.2 @@ -25,3 +27,4 @@ weight_max_lb = 0.3 sell_value_min = 1 sell_value_max = 3 sell_value_curve = 1.0 +display_texture = ExtResource("99_fish_placeholder") diff --git a/fish/species/squid_bigfin_reef/squid_bigfin_reef.tres b/fish/species/squid_bigfin_reef/squid_bigfin_reef.tres index 838a6ef..68f8993 100644 --- a/fish/species/squid_bigfin_reef/squid_bigfin_reef.tres +++ b/fish/species/squid_bigfin_reef/squid_bigfin_reef.tres @@ -1,8 +1,9 @@ -[gd_resource type="Resource" script_class="FishData" load_steps=4 format=3] +[gd_resource type="Resource" script_class="FishData" load_steps=5 format=3] [ext_resource type="Script" path="res://fish/fish_data.gd" id="1_fish_data"] [ext_resource type="Resource" path="res://fishing/common_catch_profile.tres" id="2_profile"] [ext_resource type="Script" path="res://fish/fish_availability.gd" id="3_availability"] +[ext_resource type="Texture2D" path="res://art/exported/creatures/fish_placeholder.png" id="99_fish_placeholder"] [sub_resource type="Resource" id="Availability"] script = ExtResource("3_availability") @@ -13,10 +14,11 @@ forbid_fog = true script = ExtResource("1_fish_data") id = &"squid_bigfin_reef" display_name = "bigfin reef squid" -active = false +active = true catalog_number = 6501 collection_group = &"Squid" logbook_fact = "bigfin reef squid hover in coordinated groups around warm reefs. shifting colors and body patterns signal to nearby squid." +available_seasons = 15 allowed_water_types = 2 rarity = 2 base_catch_weight = 0.3 @@ -27,3 +29,4 @@ weight_max_lb = 5.0 sell_value_min = 13 sell_value_max = 30 sell_value_curve = 0.91 +display_texture = ExtResource("99_fish_placeholder") diff --git a/fish/species/squid_colossal/squid_colossal.tres b/fish/species/squid_colossal/squid_colossal.tres index 8ade0a5..4e38896 100644 --- a/fish/species/squid_colossal/squid_colossal.tres +++ b/fish/species/squid_colossal/squid_colossal.tres @@ -1,8 +1,9 @@ -[gd_resource type="Resource" script_class="FishData" load_steps=4 format=3] +[gd_resource type="Resource" script_class="FishData" load_steps=5 format=3] [ext_resource type="Script" path="res://fish/fish_data.gd" id="1_fish_data"] [ext_resource type="Resource" path="res://fishing/common_catch_profile.tres" id="2_profile"] [ext_resource type="Script" path="res://fish/fish_availability.gd" id="3_availability"] +[ext_resource type="Texture2D" path="res://art/exported/creatures/fish_placeholder.png" id="99_fish_placeholder"] [sub_resource type="Resource" id="Availability"] script = ExtResource("3_availability") @@ -13,10 +14,11 @@ require_rain = true script = ExtResource("1_fish_data") id = &"squid_colossal" display_name = "colossal squid" -active = false +active = true catalog_number = 6502 collection_group = &"Squid" logbook_fact = "colossal squid carry swiveling hooks on their arms and tentacles. enormous eyes gather faint light in the deep southern ocean." +available_seasons = 15 allowed_water_types = 2 rarity = 4 base_catch_weight = 0.015 @@ -27,3 +29,4 @@ weight_max_lb = 1100.0 sell_value_min = 82 sell_value_max = 190 sell_value_curve = 0.76 +display_texture = ExtResource("99_fish_placeholder") diff --git a/fish/species/squid_giant/squid_giant.tres b/fish/species/squid_giant/squid_giant.tres index e67af33..4f76512 100644 --- a/fish/species/squid_giant/squid_giant.tres +++ b/fish/species/squid_giant/squid_giant.tres @@ -1,8 +1,9 @@ -[gd_resource type="Resource" script_class="FishData" load_steps=4 format=3] +[gd_resource type="Resource" script_class="FishData" load_steps=5 format=3] [ext_resource type="Script" path="res://fish/fish_data.gd" id="1_fish_data"] [ext_resource type="Resource" path="res://fishing/common_catch_profile.tres" id="2_profile"] [ext_resource type="Script" path="res://fish/fish_availability.gd" id="3_availability"] +[ext_resource type="Texture2D" path="res://art/exported/creatures/fish_placeholder.png" id="99_fish_placeholder"] [sub_resource type="Resource" id="Availability"] script = ExtResource("3_availability") @@ -13,10 +14,11 @@ require_fog = true script = ExtResource("1_fish_data") id = &"squid_giant" display_name = "giant squid" -active = false +active = true catalog_number = 6503 collection_group = &"Squid" logbook_fact = "giant squid hunt deep ocean prey with two long feeding tentacles. the largest eyes in the animal world watch for movement in darkness." +available_seasons = 15 allowed_water_types = 2 rarity = 4 base_catch_weight = 0.02 @@ -27,3 +29,4 @@ weight_max_lb = 600.0 sell_value_min = 70 sell_value_max = 165 sell_value_curve = 0.77 +display_texture = ExtResource("99_fish_placeholder") diff --git a/fish/species/squid_humboldt/squid_humboldt.tres b/fish/species/squid_humboldt/squid_humboldt.tres index 038bcf8..14abcfb 100644 --- a/fish/species/squid_humboldt/squid_humboldt.tres +++ b/fish/species/squid_humboldt/squid_humboldt.tres @@ -1,8 +1,9 @@ -[gd_resource type="Resource" script_class="FishData" load_steps=4 format=3] +[gd_resource type="Resource" script_class="FishData" load_steps=5 format=3] [ext_resource type="Script" path="res://fish/fish_data.gd" id="1_fish_data"] [ext_resource type="Resource" path="res://fishing/common_catch_profile.tres" id="2_profile"] [ext_resource type="Script" path="res://fish/fish_availability.gd" id="3_availability"] +[ext_resource type="Texture2D" path="res://art/exported/creatures/fish_placeholder.png" id="99_fish_placeholder"] [sub_resource type="Resource" id="Availability"] script = ExtResource("3_availability") @@ -12,10 +13,11 @@ allow_day = false script = ExtResource("1_fish_data") id = &"squid_humboldt" display_name = "Humboldt squid" -active = false +active = true catalog_number = 6504 collection_group = &"Squid" logbook_fact = "humboldt squid flash red and white while hunting in large groups. powerful beaks and grasping suckers handle fish and other squid." +available_seasons = 15 allowed_water_types = 2 rarity = 3 base_catch_weight = 0.09 @@ -26,3 +28,4 @@ weight_max_lb = 110.0 sell_value_min = 26 sell_value_max = 64 sell_value_curve = 0.82 +display_texture = ExtResource("99_fish_placeholder") diff --git a/fish/species/stingray_ocellate_river/stingray_ocellate_river.tres b/fish/species/stingray_ocellate_river/stingray_ocellate_river.tres index 5ee7b41..10bf3dc 100644 --- a/fish/species/stingray_ocellate_river/stingray_ocellate_river.tres +++ b/fish/species/stingray_ocellate_river/stingray_ocellate_river.tres @@ -1,8 +1,9 @@ -[gd_resource type="Resource" script_class="FishData" load_steps=4 format=3] +[gd_resource type="Resource" script_class="FishData" load_steps=5 format=3] [ext_resource type="Script" path="res://fish/fish_data.gd" id="1_fish_data"] [ext_resource type="Resource" path="res://fishing/common_catch_profile.tres" id="2_profile"] [ext_resource type="Script" path="res://fish/fish_availability.gd" id="3_availability"] +[ext_resource type="Texture2D" path="res://art/exported/creatures/fish_placeholder.png" id="99_fish_placeholder"] [sub_resource type="Resource" id="Availability"] script = ExtResource("3_availability") @@ -13,10 +14,11 @@ require_rain = true script = ExtResource("1_fish_data") id = &"stingray_ocellate_river" display_name = "ocellate river stingray" -active = false +active = true catalog_number = 5104 collection_group = &"Rays and skates" logbook_fact = "ocellate river stingrays carry bright eye-like spots across a round disc. they hide beneath sand in south american rivers." +available_seasons = 15 allowed_water_types = 1 rarity = 3 base_catch_weight = 0.09 @@ -27,3 +29,4 @@ weight_max_lb = 35.0 sell_value_min = 28 sell_value_max = 65 sell_value_curve = 0.82 +display_texture = ExtResource("99_fish_placeholder") diff --git a/fish/species/stingray_southern/stingray_southern.tres b/fish/species/stingray_southern/stingray_southern.tres index ed24d11..c0b03f0 100644 --- a/fish/species/stingray_southern/stingray_southern.tres +++ b/fish/species/stingray_southern/stingray_southern.tres @@ -1,8 +1,9 @@ -[gd_resource type="Resource" script_class="FishData" load_steps=4 format=3] +[gd_resource type="Resource" script_class="FishData" load_steps=5 format=3] [ext_resource type="Script" path="res://fish/fish_data.gd" id="1_fish_data"] [ext_resource type="Resource" path="res://fishing/common_catch_profile.tres" id="2_profile"] [ext_resource type="Script" path="res://fish/fish_availability.gd" id="3_availability"] +[ext_resource type="Texture2D" path="res://art/exported/creatures/fish_placeholder.png" id="99_fish_placeholder"] [sub_resource type="Resource" id="Availability"] script = ExtResource("3_availability") @@ -12,10 +13,11 @@ allow_night = false script = ExtResource("1_fish_data") id = &"stingray_southern" display_name = "southern stingray" -active = false +active = true catalog_number = 5105 collection_group = &"Rays and skates" logbook_fact = "southern stingrays bury in warm sand with only their eyes and spiracles visible. crushing plates break open clams and crustaceans." +available_seasons = 15 allowed_water_types = 2 rarity = 2 base_catch_weight = 0.23 @@ -26,3 +28,4 @@ weight_max_lb = 80.0 sell_value_min = 15 sell_value_max = 40 sell_value_curve = 0.82 +display_texture = ExtResource("99_fish_placeholder") diff --git a/fish/species/sturgeon_lake/sturgeon_lake.png b/fish/species/sturgeon_lake/sturgeon_lake.png new file mode 100644 index 0000000..68c9a74 Binary files /dev/null and b/fish/species/sturgeon_lake/sturgeon_lake.png differ diff --git a/fish/species/sturgeon_lake/sturgeon_lake.png.import b/fish/species/sturgeon_lake/sturgeon_lake.png.import new file mode 100644 index 0000000..505b308 --- /dev/null +++ b/fish/species/sturgeon_lake/sturgeon_lake.png.import @@ -0,0 +1,40 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://515k3s5wc3ct" +path="res://.godot/imported/sturgeon_lake.png-ab8bbee2fea49b2a23bc376500df6ae1.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://fish/species/sturgeon_lake/sturgeon_lake.png" +dest_files=["res://.godot/imported/sturgeon_lake.png-ab8bbee2fea49b2a23bc376500df6ae1.ctex"] + +[params] + +compress/mode=0 +compress/high_quality=false +compress/lossy_quality=0.7 +compress/uastc_level=0 +compress/rdo_quality_loss=0.0 +compress/hdr_compression=1 +compress/normal_map=0 +compress/channel_pack=0 +mipmaps/generate=false +mipmaps/limit=-1 +roughness/mode=0 +roughness/src_normal="" +process/channel_remap/red=0 +process/channel_remap/green=1 +process/channel_remap/blue=2 +process/channel_remap/alpha=3 +process/fix_alpha_border=true +process/premult_alpha=false +process/normal_map_invert_y=false +process/hdr_as_srgb=false +process/hdr_clamp_exposure=false +process/size_limit=0 +detect_3d/compress_to=1 diff --git a/fish/species/sturgeon_lake/sturgeon_lake.tres b/fish/species/sturgeon_lake/sturgeon_lake.tres index b69a743..eef7789 100644 --- a/fish/species/sturgeon_lake/sturgeon_lake.tres +++ b/fish/species/sturgeon_lake/sturgeon_lake.tres @@ -1,8 +1,9 @@ -[gd_resource type="Resource" script_class="FishData" load_steps=4 format=3] +[gd_resource type="Resource" script_class="FishData" load_steps=5 format=3] [ext_resource type="Script" path="res://fish/fish_data.gd" id="1_fish_data"] [ext_resource type="Resource" path="res://fishing/common_catch_profile.tres" id="2_profile"] [ext_resource type="Script" path="res://fish/fish_availability.gd" id="3_availability"] +[ext_resource type="Texture2D" path="res://art/exported/creatures/102.png" id="4_texture"] [sub_resource type="Resource" id="Availability"] script = ExtResource("3_availability") @@ -12,10 +13,11 @@ allow_day = false script = ExtResource("1_fish_data") id = &"sturgeon_lake" display_name = "lake sturgeon" -active = false +active = true catalog_number = 102 collection_group = &"Ancient freshwater fish" logbook_fact = "lake sturgeon sweep the bottom with four sensitive barbels before extending a tube-like mouth to feed. they can live for decades." +available_seasons = 15 allowed_water_types = 1 rarity = 3 base_catch_weight = 0.09 @@ -26,3 +28,4 @@ weight_max_lb = 180.0 sell_value_min = 36 sell_value_max = 82 sell_value_curve = 0.8 +display_texture = ExtResource("4_texture") diff --git a/fish/species/sturgeon_shovelnose/sturgeon_shovelnose.png b/fish/species/sturgeon_shovelnose/sturgeon_shovelnose.png new file mode 100644 index 0000000..197c90a Binary files /dev/null and b/fish/species/sturgeon_shovelnose/sturgeon_shovelnose.png differ diff --git a/fish/species/sturgeon_shovelnose/sturgeon_shovelnose.png.import b/fish/species/sturgeon_shovelnose/sturgeon_shovelnose.png.import new file mode 100644 index 0000000..c66c0ec --- /dev/null +++ b/fish/species/sturgeon_shovelnose/sturgeon_shovelnose.png.import @@ -0,0 +1,40 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://d3jk1u2bkisil" +path="res://.godot/imported/sturgeon_shovelnose.png-abfc7dc07c08b02b361c4ea424ee5ece.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://fish/species/sturgeon_shovelnose/sturgeon_shovelnose.png" +dest_files=["res://.godot/imported/sturgeon_shovelnose.png-abfc7dc07c08b02b361c4ea424ee5ece.ctex"] + +[params] + +compress/mode=0 +compress/high_quality=false +compress/lossy_quality=0.7 +compress/uastc_level=0 +compress/rdo_quality_loss=0.0 +compress/hdr_compression=1 +compress/normal_map=0 +compress/channel_pack=0 +mipmaps/generate=false +mipmaps/limit=-1 +roughness/mode=0 +roughness/src_normal="" +process/channel_remap/red=0 +process/channel_remap/green=1 +process/channel_remap/blue=2 +process/channel_remap/alpha=3 +process/fix_alpha_border=true +process/premult_alpha=false +process/normal_map_invert_y=false +process/hdr_as_srgb=false +process/hdr_clamp_exposure=false +process/size_limit=0 +detect_3d/compress_to=1 diff --git a/fish/species/sturgeon_shovelnose/sturgeon_shovelnose.tres b/fish/species/sturgeon_shovelnose/sturgeon_shovelnose.tres index f62d908..9f02593 100644 --- a/fish/species/sturgeon_shovelnose/sturgeon_shovelnose.tres +++ b/fish/species/sturgeon_shovelnose/sturgeon_shovelnose.tres @@ -1,8 +1,9 @@ -[gd_resource type="Resource" script_class="FishData" load_steps=4 format=3] +[gd_resource type="Resource" script_class="FishData" load_steps=5 format=3] [ext_resource type="Script" path="res://fish/fish_data.gd" id="1_fish_data"] [ext_resource type="Resource" path="res://fishing/common_catch_profile.tres" id="2_profile"] [ext_resource type="Script" path="res://fish/fish_availability.gd" id="3_availability"] +[ext_resource type="Texture2D" path="res://art/exported/creatures/105.png" id="4_texture"] [sub_resource type="Resource" id="Availability"] script = ExtResource("3_availability") @@ -12,10 +13,11 @@ allow_day = false script = ExtResource("1_fish_data") id = &"sturgeon_shovelnose" display_name = "shovelnose sturgeon" -active = false +active = true catalog_number = 105 collection_group = &"Ancient freshwater fish" logbook_fact = "shovelnose sturgeon hug flowing river bottoms and probe for insect larvae. a flattened snout helps them hold position in strong current." +available_seasons = 15 allowed_water_types = 1 rarity = 2 base_catch_weight = 0.22 @@ -26,3 +28,4 @@ weight_max_lb = 8.0 sell_value_min = 12 sell_value_max = 25 sell_value_curve = 0.9 +display_texture = ExtResource("4_texture") diff --git a/fish/species/sturgeon_white/sturgeon_white.tres b/fish/species/sturgeon_white/sturgeon_white.tres index 9b4892c..961411d 100644 --- a/fish/species/sturgeon_white/sturgeon_white.tres +++ b/fish/species/sturgeon_white/sturgeon_white.tres @@ -1,8 +1,9 @@ -[gd_resource type="Resource" script_class="FishData" load_steps=4 format=3] +[gd_resource type="Resource" script_class="FishData" load_steps=5 format=3] [ext_resource type="Script" path="res://fish/fish_data.gd" id="1_fish_data"] [ext_resource type="Resource" path="res://fishing/common_catch_profile.tres" id="2_profile"] [ext_resource type="Script" path="res://fish/fish_availability.gd" id="3_availability"] +[ext_resource type="Texture2D" path="res://art/exported/creatures/fish_placeholder.png" id="99_fish_placeholder"] [sub_resource type="Resource" id="Availability"] script = ExtResource("3_availability") @@ -12,10 +13,11 @@ allow_day = false script = ExtResource("1_fish_data") id = &"sturgeon_white" display_name = "white sturgeon" -active = false +active = true catalog_number = 4301 collection_group = &"Ocean-run giants" logbook_fact = "white sturgeon are the largest freshwater fish in north america. armored plates line bodies built for long lives in rivers and estuaries." +available_seasons = 5 allowed_water_types = 3 rarity = 4 base_catch_weight = 0.045 @@ -26,3 +28,4 @@ weight_max_lb = 500.0 sell_value_min = 58 sell_value_max = 135 sell_value_curve = 0.78 +display_texture = ExtResource("99_fish_placeholder") diff --git a/fish/species/sucker_white/sucker_white.tres b/fish/species/sucker_white/sucker_white.tres index 1e2c2b3..ff48770 100644 --- a/fish/species/sucker_white/sucker_white.tres +++ b/fish/species/sucker_white/sucker_white.tres @@ -1,8 +1,9 @@ -[gd_resource type="Resource" script_class="FishData" load_steps=4 format=3] +[gd_resource type="Resource" script_class="FishData" load_steps=5 format=3] [ext_resource type="Script" path="res://fish/fish_data.gd" id="1_fish_data"] [ext_resource type="Resource" path="res://fishing/common_catch_profile.tres" id="2_profile"] [ext_resource type="Script" path="res://fish/fish_availability.gd" id="3_availability"] +[ext_resource type="Texture2D" path="res://art/exported/creatures/fish_placeholder.png" id="99_fish_placeholder"] [sub_resource type="Resource" id="Availability"] script = ExtResource("3_availability") @@ -11,10 +12,11 @@ script = ExtResource("3_availability") script = ExtResource("1_fish_data") id = &"sucker_white" display_name = "white sucker" -active = false +active = true catalog_number = 2305 collection_group = &"Freshwater bottom fish" logbook_fact = "white suckers vacuum insects and organic matter from cool freshwater bottoms. spring runs carry large groups into shallow streams." +available_seasons = 7 allowed_water_types = 1 rarity = 0 base_catch_weight = 2.0 @@ -25,3 +27,4 @@ weight_max_lb = 8.0 sell_value_min = 3 sell_value_max = 8 sell_value_curve = 0.9 +display_texture = ExtResource("99_fish_placeholder") diff --git a/fish/species/sunfish/fish_sunfish.png b/fish/species/sunfish/fish_sunfish.png index 4b7b084..ca8a340 100644 Binary files a/fish/species/sunfish/fish_sunfish.png and b/fish/species/sunfish/fish_sunfish.png differ diff --git a/fish/species/sunfish/sunfish.tres b/fish/species/sunfish/sunfish.tres index 9b9401d..a8e2290 100644 --- a/fish/species/sunfish/sunfish.tres +++ b/fish/species/sunfish/sunfish.tres @@ -3,7 +3,7 @@ [ext_resource type="Script" path="res://fish/fish_data.gd" id="1_fish_data"] [ext_resource type="Resource" path="res://fishing/common_catch_profile.tres" id="2_profile"] [ext_resource type="Resource" path="res://fish/day_availability.tres" id="3_availability"] -[ext_resource type="Texture2D" path="res://fish/species/sunfish/fish_sunfish.png" id="4_texture"] +[ext_resource type="Texture2D" path="res://art/exported/creatures/fish_placeholder.png" id="4_texture"] [resource] script = ExtResource("1_fish_data") @@ -13,6 +13,7 @@ active = true catalog_number = 5001 collection_group = &"Open-ocean giants" logbook_fact = "ocean sunfish are built more like enormous swimming heads than ordinary fish. they visit the surface and turn sideways to warm up." +available_seasons = 7 allowed_water_types = 2 rarity = 0 base_catch_weight = 7.0 diff --git a/fish/species/surgeonfish_blue/surgeonfish_blue.tres b/fish/species/surgeonfish_blue/surgeonfish_blue.tres index 9a21da4..d0a903e 100644 --- a/fish/species/surgeonfish_blue/surgeonfish_blue.tres +++ b/fish/species/surgeonfish_blue/surgeonfish_blue.tres @@ -1,8 +1,9 @@ -[gd_resource type="Resource" script_class="FishData" load_steps=4 format=3] +[gd_resource type="Resource" script_class="FishData" load_steps=5 format=3] [ext_resource type="Script" path="res://fish/fish_data.gd" id="1_fish_data"] [ext_resource type="Resource" path="res://fishing/common_catch_profile.tres" id="2_profile"] [ext_resource type="Script" path="res://fish/fish_availability.gd" id="3_availability"] +[ext_resource type="Texture2D" path="res://art/exported/creatures/fish_placeholder.png" id="99_fish_placeholder"] [sub_resource type="Resource" id="Availability"] script = ExtResource("3_availability") @@ -12,10 +13,11 @@ allow_night = false script = ExtResource("1_fish_data") id = &"surgeonfish_blue" display_name = "blue tang" -active = false +active = true catalog_number = 5501 collection_group = &"Reef grazers" logbook_fact = "blue tangs graze algae from coral reefs with small close-set teeth. sharp folding spines near the tail give surgeonfish their name." +available_seasons = 15 allowed_water_types = 2 rarity = 1 base_catch_weight = 0.9 @@ -26,3 +28,4 @@ weight_max_lb = 1.5 sell_value_min = 5 sell_value_max = 11 sell_value_curve = 0.95 +display_texture = ExtResource("99_fish_placeholder") diff --git a/fish/species/swordfish/fish_swordfish.png b/fish/species/swordfish/fish_swordfish.png index a43d703..3b1917b 100644 Binary files a/fish/species/swordfish/fish_swordfish.png and b/fish/species/swordfish/fish_swordfish.png differ diff --git a/fish/species/swordfish/swordfish.tres b/fish/species/swordfish/swordfish.tres index 5f776ca..24319f1 100644 --- a/fish/species/swordfish/swordfish.tres +++ b/fish/species/swordfish/swordfish.tres @@ -3,7 +3,7 @@ [ext_resource type="Script" uid="uid://h7hg45b7wmst" path="res://fish/fish_data.gd" id="1_fish_data"] [ext_resource type="Resource" path="res://fishing/common_catch_profile.tres" id="2_profile"] [ext_resource type="Script" uid="uid://bs7cqi88csolc" path="res://fish/fish_availability.gd" id="3_availability_script"] -[ext_resource type="Texture2D" uid="uid://cs1qmm4galac4" path="res://fish/species/swordfish/fish_swordfish.png" id="4_texture"] +[ext_resource type="Texture2D" path="res://art/exported/creatures/fish_placeholder.png" id="4_texture"] [sub_resource type="Resource" id="SwordfishAvailability"] script = ExtResource("3_availability_script") @@ -17,6 +17,7 @@ active = true catalog_number = 4604 collection_group = &"Oceanic billfish" logbook_fact = "swordfish are fast, wide-ranging predators with a flattened bill. they can cross deep water and warm surface layers in one day." +available_seasons = 15 allowed_water_types = 2 rarity = 4 base_catch_weight = 0.06 diff --git a/fish/species/tambaqui/tambaqui.tres b/fish/species/tambaqui/tambaqui.tres index 981d643..4bfd4a1 100644 --- a/fish/species/tambaqui/tambaqui.tres +++ b/fish/species/tambaqui/tambaqui.tres @@ -1,8 +1,9 @@ -[gd_resource type="Resource" script_class="FishData" load_steps=4 format=3] +[gd_resource type="Resource" script_class="FishData" load_steps=5 format=3] [ext_resource type="Script" path="res://fish/fish_data.gd" id="1_fish_data"] [ext_resource type="Resource" path="res://fishing/common_catch_profile.tres" id="2_profile"] [ext_resource type="Script" path="res://fish/fish_availability.gd" id="3_availability"] +[ext_resource type="Texture2D" path="res://art/exported/creatures/fish_placeholder.png" id="99_fish_placeholder"] [sub_resource type="Resource" id="Availability"] script = ExtResource("3_availability") @@ -13,10 +14,11 @@ require_rain = true script = ExtResource("1_fish_data") id = &"tambaqui" display_name = "tambaqui" -active = false +active = true catalog_number = 7509 collection_group = &"Tropical freshwater fish" logbook_fact = "tambaqui follow seasonal floods into forests to feed on fruit and seeds. strong square teeth crack tough plant material." +available_seasons = 15 allowed_water_types = 1 rarity = 3 base_catch_weight = 0.1 @@ -27,3 +29,4 @@ weight_max_lb = 80.0 sell_value_min = 30 sell_value_max = 68 sell_value_curve = 0.82 +display_texture = ExtResource("99_fish_placeholder") diff --git a/fish/species/tang_yellow/tang_yellow.tres b/fish/species/tang_yellow/tang_yellow.tres index c4facd7..501f2a3 100644 --- a/fish/species/tang_yellow/tang_yellow.tres +++ b/fish/species/tang_yellow/tang_yellow.tres @@ -1,8 +1,9 @@ -[gd_resource type="Resource" script_class="FishData" load_steps=4 format=3] +[gd_resource type="Resource" script_class="FishData" load_steps=5 format=3] [ext_resource type="Script" path="res://fish/fish_data.gd" id="1_fish_data"] [ext_resource type="Resource" path="res://fishing/common_catch_profile.tres" id="2_profile"] [ext_resource type="Script" path="res://fish/fish_availability.gd" id="3_availability"] +[ext_resource type="Texture2D" path="res://art/exported/creatures/fish_placeholder.png" id="99_fish_placeholder"] [sub_resource type="Resource" id="Availability"] script = ExtResource("3_availability") @@ -13,10 +14,11 @@ forbid_rain = true script = ExtResource("1_fish_data") id = &"tang_yellow" display_name = "yellow tang" -active = false +active = true catalog_number = 5504 collection_group = &"Reef grazers" logbook_fact = "yellow tangs browse algae across hawaiian reefs during daylight. at night their bright bodies darken and show a pale horizontal stripe." +available_seasons = 15 allowed_water_types = 2 rarity = 2 base_catch_weight = 0.35 @@ -27,3 +29,4 @@ weight_max_lb = 0.8 sell_value_min = 9 sell_value_max = 20 sell_value_curve = 0.96 +display_texture = ExtResource("99_fish_placeholder") diff --git a/fish/species/tarpon_atlantic/tarpon_atlantic.tres b/fish/species/tarpon_atlantic/tarpon_atlantic.tres index c2fbff0..0b8c6aa 100644 --- a/fish/species/tarpon_atlantic/tarpon_atlantic.tres +++ b/fish/species/tarpon_atlantic/tarpon_atlantic.tres @@ -1,8 +1,9 @@ -[gd_resource type="Resource" script_class="FishData" load_steps=4 format=3] +[gd_resource type="Resource" script_class="FishData" load_steps=5 format=3] [ext_resource type="Script" path="res://fish/fish_data.gd" id="1_fish_data"] [ext_resource type="Resource" path="res://fishing/common_catch_profile.tres" id="2_profile"] [ext_resource type="Script" path="res://fish/fish_availability.gd" id="3_availability"] +[ext_resource type="Texture2D" path="res://art/exported/creatures/fish_placeholder.png" id="99_fish_placeholder"] [sub_resource type="Resource" id="Availability"] script = ExtResource("3_availability") @@ -12,10 +13,11 @@ require_rain = true script = ExtResource("1_fish_data") id = &"tarpon_atlantic" display_name = "atlantic tarpon" -active = false +active = true catalog_number = 7301 collection_group = &"Tropical estuary" logbook_fact = "atlantic tarpon gulp air with a lung-like swim bladder when coastal water runs low on oxygen. giant silver scales flash during leaps." +available_seasons = 15 allowed_water_types = 3 rarity = 3 base_catch_weight = 0.09 @@ -26,3 +28,4 @@ weight_max_lb = 180.0 sell_value_min = 34 sell_value_max = 82 sell_value_curve = 0.8 +display_texture = ExtResource("99_fish_placeholder") diff --git a/fish/species/tautog/tautog.tres b/fish/species/tautog/tautog.tres index cbd926f..7028401 100644 --- a/fish/species/tautog/tautog.tres +++ b/fish/species/tautog/tautog.tres @@ -1,8 +1,9 @@ -[gd_resource type="Resource" script_class="FishData" load_steps=4 format=3] +[gd_resource type="Resource" script_class="FishData" load_steps=5 format=3] [ext_resource type="Script" path="res://fish/fish_data.gd" id="1_fish_data"] [ext_resource type="Resource" path="res://fishing/common_catch_profile.tres" id="2_profile"] [ext_resource type="Script" path="res://fish/fish_availability.gd" id="3_availability"] +[ext_resource type="Texture2D" path="res://art/exported/creatures/fish_placeholder.png" id="99_fish_placeholder"] [sub_resource type="Resource" id="Availability"] script = ExtResource("3_availability") @@ -12,10 +13,11 @@ allow_night = false script = ExtResource("1_fish_data") id = &"tautog" display_name = "tautog" -active = false +active = true catalog_number = 6906 collection_group = &"Temperate reef fish" logbook_fact = "tautog pry mussels and crabs from rocky structure with thick lips and strong teeth. adults return to familiar shelters year after year." +available_seasons = 13 allowed_water_types = 2 rarity = 1 base_catch_weight = 0.8 @@ -26,3 +28,4 @@ weight_max_lb = 20.0 sell_value_min = 7 sell_value_max = 18 sell_value_curve = 0.86 +display_texture = ExtResource("99_fish_placeholder") diff --git a/fish/species/tench/tench.tres b/fish/species/tench/tench.tres index 300a922..7ffe273 100644 --- a/fish/species/tench/tench.tres +++ b/fish/species/tench/tench.tres @@ -1,8 +1,9 @@ -[gd_resource type="Resource" script_class="FishData" load_steps=4 format=3] +[gd_resource type="Resource" script_class="FishData" load_steps=5 format=3] [ext_resource type="Script" path="res://fish/fish_data.gd" id="1_fish_data"] [ext_resource type="Resource" path="res://fishing/common_catch_profile.tres" id="2_profile"] [ext_resource type="Script" path="res://fish/fish_availability.gd" id="3_availability"] +[ext_resource type="Texture2D" path="res://art/exported/creatures/fish_placeholder.png" id="99_fish_placeholder"] [sub_resource type="Resource" id="Availability"] script = ExtResource("3_availability") @@ -13,10 +14,11 @@ require_fog = true script = ExtResource("1_fish_data") id = &"tench" display_name = "tench" -active = false +active = true catalog_number = 2509 collection_group = &"Freshwater coarse fish" logbook_fact = "tench browse quiet, muddy bottoms with two small mouth barbels. a thick coat of slime protects their olive-green scales." +available_seasons = 7 allowed_water_types = 1 rarity = 1 base_catch_weight = 0.75 @@ -27,3 +29,4 @@ weight_max_lb = 12.0 sell_value_min = 7 sell_value_max = 17 sell_value_curve = 0.88 +display_texture = ExtResource("99_fish_placeholder") diff --git a/fish/species/tetra_neon/tetra_neon.tres b/fish/species/tetra_neon/tetra_neon.tres index 487ef9b..da42e36 100644 --- a/fish/species/tetra_neon/tetra_neon.tres +++ b/fish/species/tetra_neon/tetra_neon.tres @@ -1,8 +1,9 @@ -[gd_resource type="Resource" script_class="FishData" load_steps=4 format=3] +[gd_resource type="Resource" script_class="FishData" load_steps=5 format=3] [ext_resource type="Script" path="res://fish/fish_data.gd" id="1_fish_data"] [ext_resource type="Resource" path="res://fishing/common_catch_profile.tres" id="2_profile"] [ext_resource type="Script" path="res://fish/fish_availability.gd" id="3_availability"] +[ext_resource type="Texture2D" path="res://art/exported/creatures/fish_placeholder.png" id="99_fish_placeholder"] [sub_resource type="Resource" id="Availability"] script = ExtResource("3_availability") @@ -12,10 +13,11 @@ allow_day = false script = ExtResource("1_fish_data") id = &"tetra_neon" display_name = "neon tetra" -active = false +active = true catalog_number = 2102 collection_group = &"Freshwater aquarium fish" logbook_fact = "neon tetras school through shaded forest streams. an iridescent blue stripe remains visible in the dim, tannin-stained water." +available_seasons = 15 allowed_water_types = 1 rarity = 1 base_catch_weight = 0.9 @@ -26,3 +28,4 @@ weight_max_lb = 0.08 sell_value_min = 4 sell_value_max = 8 sell_value_curve = 0.98 +display_texture = ExtResource("99_fish_placeholder") diff --git a/fish/species/tigerfish_goliath/tigerfish_goliath.tres b/fish/species/tigerfish_goliath/tigerfish_goliath.tres index dec9d49..f34d449 100644 --- a/fish/species/tigerfish_goliath/tigerfish_goliath.tres +++ b/fish/species/tigerfish_goliath/tigerfish_goliath.tres @@ -1,8 +1,9 @@ -[gd_resource type="Resource" script_class="FishData" load_steps=4 format=3] +[gd_resource type="Resource" script_class="FishData" load_steps=5 format=3] [ext_resource type="Script" path="res://fish/fish_data.gd" id="1_fish_data"] [ext_resource type="Resource" path="res://fishing/common_catch_profile.tres" id="2_profile"] [ext_resource type="Script" path="res://fish/fish_availability.gd" id="3_availability"] +[ext_resource type="Texture2D" path="res://art/exported/creatures/fish_placeholder.png" id="99_fish_placeholder"] [sub_resource type="Resource" id="Availability"] script = ExtResource("3_availability") @@ -12,10 +13,11 @@ allow_night = false script = ExtResource("1_fish_data") id = &"tigerfish_goliath" display_name = "goliath tigerfish" -active = false +active = true catalog_number = 2703 collection_group = &"Freshwater giants" logbook_fact = "goliath tigerfish patrol powerful african rivers with interlocking dagger-like teeth. a muscular forked tail drives sudden attacks." +available_seasons = 15 allowed_water_types = 1 rarity = 4 base_catch_weight = 0.035 @@ -26,3 +28,4 @@ weight_max_lb = 150.0 sell_value_min = 58 sell_value_max = 132 sell_value_curve = 0.8 +display_texture = ExtResource("99_fish_placeholder") diff --git a/fish/species/tilapia_nile/tilapia_nile.tres b/fish/species/tilapia_nile/tilapia_nile.tres index 3db4fb6..d7a2eed 100644 --- a/fish/species/tilapia_nile/tilapia_nile.tres +++ b/fish/species/tilapia_nile/tilapia_nile.tres @@ -1,8 +1,9 @@ -[gd_resource type="Resource" script_class="FishData" load_steps=4 format=3] +[gd_resource type="Resource" script_class="FishData" load_steps=5 format=3] [ext_resource type="Script" path="res://fish/fish_data.gd" id="1_fish_data"] [ext_resource type="Resource" path="res://fishing/common_catch_profile.tres" id="2_profile"] [ext_resource type="Script" path="res://fish/fish_availability.gd" id="3_availability"] +[ext_resource type="Texture2D" path="res://art/exported/creatures/7506.png" id="99_fish_placeholder"] [sub_resource type="Resource" id="Availability"] script = ExtResource("3_availability") @@ -12,10 +13,11 @@ allow_night = false script = ExtResource("1_fish_data") id = &"tilapia_nile" display_name = "Nile tilapia" -active = false +active = true catalog_number = 7506 collection_group = &"Tropical freshwater fish" logbook_fact = "nile tilapia thrive in warm lakes and rivers on a varied diet. females protect eggs and young inside their mouths." +available_seasons = 15 allowed_water_types = 1 rarity = 0 base_catch_weight = 2.2 @@ -26,3 +28,4 @@ weight_max_lb = 8.0 sell_value_min = 3 sell_value_max = 9 sell_value_curve = 0.9 +display_texture = ExtResource("99_fish_placeholder") diff --git a/fish/species/tilefish_blueline/tilefish_blueline.tres b/fish/species/tilefish_blueline/tilefish_blueline.tres index 53598bd..aff98b6 100644 --- a/fish/species/tilefish_blueline/tilefish_blueline.tres +++ b/fish/species/tilefish_blueline/tilefish_blueline.tres @@ -1,8 +1,9 @@ -[gd_resource type="Resource" script_class="FishData" load_steps=4 format=3] +[gd_resource type="Resource" script_class="FishData" load_steps=5 format=3] [ext_resource type="Script" path="res://fish/fish_data.gd" id="1_fish_data"] [ext_resource type="Resource" path="res://fishing/common_catch_profile.tres" id="2_profile"] [ext_resource type="Script" path="res://fish/fish_availability.gd" id="3_availability"] +[ext_resource type="Texture2D" path="res://art/exported/creatures/fish_placeholder.png" id="99_fish_placeholder"] [sub_resource type="Resource" id="Availability"] script = ExtResource("3_availability") @@ -12,10 +13,11 @@ allow_night = false script = ExtResource("1_fish_data") id = &"tilefish_blueline" display_name = "blueline tilefish" -active = false +active = true catalog_number = 1601 collection_group = &"Deep shelf fish" logbook_fact = "blueline tilefish shelter in burrows and rocky openings along deep shelves. a narrow blue stripe traces the edge of the dorsal fin." +available_seasons = 15 allowed_water_types = 2 rarity = 1 base_catch_weight = 0.7 @@ -26,3 +28,4 @@ weight_max_lb = 20.0 sell_value_min = 7 sell_value_max = 18 sell_value_curve = 0.86 +display_texture = ExtResource("99_fish_placeholder") diff --git a/fish/species/tilefish_golden/tilefish_golden.tres b/fish/species/tilefish_golden/tilefish_golden.tres index 26e9543..ed203c8 100644 --- a/fish/species/tilefish_golden/tilefish_golden.tres +++ b/fish/species/tilefish_golden/tilefish_golden.tres @@ -1,8 +1,9 @@ -[gd_resource type="Resource" script_class="FishData" load_steps=4 format=3] +[gd_resource type="Resource" script_class="FishData" load_steps=5 format=3] [ext_resource type="Script" path="res://fish/fish_data.gd" id="1_fish_data"] [ext_resource type="Resource" path="res://fishing/common_catch_profile.tres" id="2_profile"] [ext_resource type="Script" path="res://fish/fish_availability.gd" id="3_availability"] +[ext_resource type="Texture2D" path="res://art/exported/creatures/fish_placeholder.png" id="99_fish_placeholder"] [sub_resource type="Resource" id="Availability"] script = ExtResource("3_availability") @@ -12,10 +13,11 @@ allow_night = false script = ExtResource("1_fish_data") id = &"tilefish_golden" display_name = "golden tilefish" -active = false +active = true catalog_number = 1602 collection_group = &"Deep shelf fish" logbook_fact = "golden tilefish excavate burrows in soft clay along deep ocean slopes. their bright yellow spots contrast with blue-green backs." +available_seasons = 15 allowed_water_types = 2 rarity = 2 base_catch_weight = 0.22 @@ -26,3 +28,4 @@ weight_max_lb = 50.0 sell_value_min = 15 sell_value_max = 37 sell_value_curve = 0.84 +display_texture = ExtResource("99_fish_placeholder") diff --git a/fish/species/trevally_bluefin/trevally_bluefin.tres b/fish/species/trevally_bluefin/trevally_bluefin.tres index 9c06970..3cf8dee 100644 --- a/fish/species/trevally_bluefin/trevally_bluefin.tres +++ b/fish/species/trevally_bluefin/trevally_bluefin.tres @@ -1,8 +1,9 @@ -[gd_resource type="Resource" script_class="FishData" load_steps=4 format=3] +[gd_resource type="Resource" script_class="FishData" load_steps=5 format=3] [ext_resource type="Script" path="res://fish/fish_data.gd" id="1_fish_data"] [ext_resource type="Resource" path="res://fishing/common_catch_profile.tres" id="2_profile"] [ext_resource type="Script" path="res://fish/fish_availability.gd" id="3_availability"] +[ext_resource type="Texture2D" path="res://art/exported/creatures/fish_placeholder.png" id="99_fish_placeholder"] [sub_resource type="Resource" id="Availability"] script = ExtResource("3_availability") @@ -13,10 +14,11 @@ forbid_fog = true script = ExtResource("1_fish_data") id = &"trevally_bluefin" display_name = "bluefin trevally" -active = false +active = true catalog_number = 5802 collection_group = &"Reef predators" logbook_fact = "bluefin trevally hunt reef fish in coordinated groups. electric blue fins and scattered blue spots contrast with a golden body." +available_seasons = 15 allowed_water_types = 2 rarity = 2 base_catch_weight = 0.3 @@ -27,3 +29,4 @@ weight_max_lb = 25.0 sell_value_min = 14 sell_value_max = 32 sell_value_curve = 0.86 +display_texture = ExtResource("99_fish_placeholder") diff --git a/fish/species/trevally_giant/trevally_giant.tres b/fish/species/trevally_giant/trevally_giant.tres index f1acce2..62ee42b 100644 --- a/fish/species/trevally_giant/trevally_giant.tres +++ b/fish/species/trevally_giant/trevally_giant.tres @@ -1,8 +1,9 @@ -[gd_resource type="Resource" script_class="FishData" load_steps=4 format=3] +[gd_resource type="Resource" script_class="FishData" load_steps=5 format=3] [ext_resource type="Script" path="res://fish/fish_data.gd" id="1_fish_data"] [ext_resource type="Resource" path="res://fishing/common_catch_profile.tres" id="2_profile"] [ext_resource type="Script" path="res://fish/fish_availability.gd" id="3_availability"] +[ext_resource type="Texture2D" path="res://art/exported/creatures/fish_placeholder.png" id="99_fish_placeholder"] [sub_resource type="Resource" id="Availability"] script = ExtResource("3_availability") @@ -12,10 +13,11 @@ allow_night = false script = ExtResource("1_fish_data") id = &"trevally_giant" display_name = "giant trevally" -active = false +active = true catalog_number = 3603 collection_group = &"Large coastal predators" logbook_fact = "giant trevally hunt reef edges with bursts of speed and force. large individuals sometimes charge prey from surf and shallow lagoons." +available_seasons = 6 allowed_water_types = 2 rarity = 3 base_catch_weight = 0.1 @@ -26,3 +28,4 @@ weight_max_lb = 150.0 sell_value_min = 32 sell_value_max = 78 sell_value_curve = 0.8 +display_texture = ExtResource("99_fish_placeholder") diff --git a/fish/species/triggerfish_gray/triggerfish_gray.tres b/fish/species/triggerfish_gray/triggerfish_gray.tres index 9eb4a35..0b205a2 100644 --- a/fish/species/triggerfish_gray/triggerfish_gray.tres +++ b/fish/species/triggerfish_gray/triggerfish_gray.tres @@ -1,8 +1,9 @@ -[gd_resource type="Resource" script_class="FishData" load_steps=4 format=3] +[gd_resource type="Resource" script_class="FishData" load_steps=5 format=3] [ext_resource type="Script" path="res://fish/fish_data.gd" id="1_fish_data"] [ext_resource type="Resource" path="res://fishing/common_catch_profile.tres" id="2_profile"] [ext_resource type="Script" path="res://fish/fish_availability.gd" id="3_availability"] +[ext_resource type="Texture2D" path="res://art/exported/creatures/fish_placeholder.png" id="99_fish_placeholder"] [sub_resource type="Resource" id="Availability"] script = ExtResource("3_availability") @@ -12,10 +13,11 @@ allow_night = false script = ExtResource("1_fish_data") id = &"triggerfish_gray" display_name = "gray triggerfish" -active = false +active = true catalog_number = 5602 collection_group = &"Reef oddities" logbook_fact = "gray triggerfish lock a stout dorsal spine upright when wedged into shelter. strong teeth crack barnacles, crabs, and shellfish." +available_seasons = 15 allowed_water_types = 2 rarity = 1 base_catch_weight = 0.8 @@ -26,3 +28,4 @@ weight_max_lb = 12.0 sell_value_min = 7 sell_value_max = 17 sell_value_curve = 0.88 +display_texture = ExtResource("99_fish_placeholder") diff --git a/fish/species/triggerfish_queen/triggerfish_queen.tres b/fish/species/triggerfish_queen/triggerfish_queen.tres index e2de868..e747f25 100644 --- a/fish/species/triggerfish_queen/triggerfish_queen.tres +++ b/fish/species/triggerfish_queen/triggerfish_queen.tres @@ -1,8 +1,9 @@ -[gd_resource type="Resource" script_class="FishData" load_steps=4 format=3] +[gd_resource type="Resource" script_class="FishData" load_steps=5 format=3] [ext_resource type="Script" path="res://fish/fish_data.gd" id="1_fish_data"] [ext_resource type="Resource" path="res://fishing/common_catch_profile.tres" id="2_profile"] [ext_resource type="Script" path="res://fish/fish_availability.gd" id="3_availability"] +[ext_resource type="Texture2D" path="res://art/exported/creatures/fish_placeholder.png" id="99_fish_placeholder"] [sub_resource type="Resource" id="Availability"] script = ExtResource("3_availability") @@ -13,10 +14,11 @@ forbid_fog = true script = ExtResource("1_fish_data") id = &"triggerfish_queen" display_name = "queen triggerfish" -active = false +active = true catalog_number = 5605 collection_group = &"Reef oddities" logbook_fact = "queen triggerfish blow jets of water to uncover buried prey and flip sea urchins. vivid blue lines radiate across the face." +available_seasons = 15 allowed_water_types = 2 rarity = 2 base_catch_weight = 0.25 @@ -27,3 +29,4 @@ weight_max_lb = 15.0 sell_value_min = 14 sell_value_max = 32 sell_value_curve = 0.88 +display_texture = ExtResource("99_fish_placeholder") diff --git a/fish/species/tripletail/tripletail.tres b/fish/species/tripletail/tripletail.tres index e973888..7bb151b 100644 --- a/fish/species/tripletail/tripletail.tres +++ b/fish/species/tripletail/tripletail.tres @@ -1,8 +1,9 @@ -[gd_resource type="Resource" script_class="FishData" load_steps=4 format=3] +[gd_resource type="Resource" script_class="FishData" load_steps=5 format=3] [ext_resource type="Script" path="res://fish/fish_data.gd" id="1_fish_data"] [ext_resource type="Resource" path="res://fishing/common_catch_profile.tres" id="2_profile"] [ext_resource type="Script" path="res://fish/fish_availability.gd" id="3_availability"] +[ext_resource type="Texture2D" path="res://art/exported/creatures/fish_placeholder.png" id="99_fish_placeholder"] [sub_resource type="Resource" id="Availability"] script = ExtResource("3_availability") @@ -13,10 +14,11 @@ require_fog = true script = ExtResource("1_fish_data") id = &"tripletail" display_name = "tripletail" -active = false +active = true catalog_number = 604 collection_group = &"Coastal oddities" logbook_fact = "tripletail often drift sideways near floating debris, resembling a loose leaf. rounded rear fins create the three-tailed silhouette." +available_seasons = 6 allowed_water_types = 2 rarity = 2 base_catch_weight = 0.28 @@ -27,3 +29,4 @@ weight_max_lb = 30.0 sell_value_min = 13 sell_value_max = 31 sell_value_curve = 0.85 +display_texture = ExtResource("99_fish_placeholder") diff --git a/fish/species/trout_brown/trout_brown.tres b/fish/species/trout_brown/trout_brown.tres index 0e6cefd..6beb1ba 100644 --- a/fish/species/trout_brown/trout_brown.tres +++ b/fish/species/trout_brown/trout_brown.tres @@ -1,8 +1,9 @@ -[gd_resource type="Resource" script_class="FishData" load_steps=4 format=3] +[gd_resource type="Resource" script_class="FishData" load_steps=5 format=3] [ext_resource type="Script" path="res://fish/fish_data.gd" id="1_fish_data"] [ext_resource type="Resource" path="res://fishing/common_catch_profile.tres" id="2_profile"] [ext_resource type="Script" path="res://fish/fish_availability.gd" id="3_availability"] +[ext_resource type="Texture2D" path="res://art/exported/creatures/fish_placeholder.png" id="99_fish_placeholder"] [sub_resource type="Resource" id="Availability"] script = ExtResource("3_availability") @@ -12,10 +13,11 @@ allow_day = false script = ExtResource("1_fish_data") id = &"trout_brown" display_name = "brown trout" -active = false +active = true catalog_number = 1103 collection_group = &"Cold freshwater salmonids" logbook_fact = "brown trout often shelter by day and hunt more freely after dark. adaptable populations occupy streams, lakes, and even coastal water." +available_seasons = 15 allowed_water_types = 1 rarity = 1 base_catch_weight = 0.8 @@ -26,3 +28,4 @@ weight_max_lb = 25.0 sell_value_min = 7 sell_value_max = 20 sell_value_curve = 0.86 +display_texture = ExtResource("99_fish_placeholder") diff --git a/fish/species/trout_cutthroat/fish_trout_cutthroat.png b/fish/species/trout_cutthroat/fish_trout_cutthroat.png index 9e45417..9287c2f 100644 Binary files a/fish/species/trout_cutthroat/fish_trout_cutthroat.png and b/fish/species/trout_cutthroat/fish_trout_cutthroat.png differ diff --git a/fish/species/trout_cutthroat/trout_cutthroat.tres b/fish/species/trout_cutthroat/trout_cutthroat.tres index 61dc080..6ea9bff 100644 --- a/fish/species/trout_cutthroat/trout_cutthroat.tres +++ b/fish/species/trout_cutthroat/trout_cutthroat.tres @@ -3,11 +3,11 @@ [ext_resource type="Script" uid="uid://h7hg45b7wmst" path="res://fish/fish_data.gd" id="1_fish_data"] [ext_resource type="Resource" path="res://fishing/common_catch_profile.tres" id="2_profile"] [ext_resource type="Script" uid="uid://bs7cqi88csolc" path="res://fish/fish_availability.gd" id="3_availability_script"] -[ext_resource type="Texture2D" uid="uid://nowggrl8wmr" path="res://fish/species/trout_cutthroat/fish_trout_cutthroat.png" id="4_texture"] +[ext_resource type="Texture2D" path="res://art/exported/creatures/fish_placeholder.png" id="4_texture"] [sub_resource type="Resource" id="TroutCutthroatAvailability"] script = ExtResource("3_availability_script") -allowed_location_tags = Array[StringName]([&"starter_pond"]) +allowed_location_tags = Array[StringName]([&"river"]) [resource] script = ExtResource("1_fish_data") @@ -17,6 +17,7 @@ active = true catalog_number = 1104 collection_group = &"Cold freshwater salmonids" logbook_fact = "cutthroat trout take their name from the red slash beneath the jaw. many populations rely on cold, well-oxygenated streams." +available_seasons = 13 allowed_water_types = 1 rarity = 1 base_catch_weight = 0.4 diff --git a/fish/species/trout_golden/fish_trout_golden.png b/fish/species/trout_golden/fish_trout_golden.png index 209b82d..8b64101 100644 Binary files a/fish/species/trout_golden/fish_trout_golden.png and b/fish/species/trout_golden/fish_trout_golden.png differ diff --git a/fish/species/trout_golden/trout_golden.tres b/fish/species/trout_golden/trout_golden.tres index 5c3d87e..bb6732b 100644 --- a/fish/species/trout_golden/trout_golden.tres +++ b/fish/species/trout_golden/trout_golden.tres @@ -3,11 +3,11 @@ [ext_resource type="Script" uid="uid://h7hg45b7wmst" path="res://fish/fish_data.gd" id="1_fish_data"] [ext_resource type="Resource" path="res://fishing/common_catch_profile.tres" id="2_profile"] [ext_resource type="Script" uid="uid://bs7cqi88csolc" path="res://fish/fish_availability.gd" id="3_availability_script"] -[ext_resource type="Texture2D" uid="uid://b64w3kwf3wins" path="res://fish/species/trout_golden/fish_trout_golden.png" id="4_texture"] +[ext_resource type="Texture2D" path="res://art/exported/creatures/fish_placeholder.png" id="4_texture"] [sub_resource type="Resource" id="TroutGoldenAvailability"] script = ExtResource("3_availability_script") -allowed_location_tags = Array[StringName]([&"starter_pond"]) +allowed_location_tags = Array[StringName]([&"lake"]) [resource] script = ExtResource("1_fish_data") @@ -17,6 +17,7 @@ active = true catalog_number = 1105 collection_group = &"Cold freshwater salmonids" logbook_fact = "golden trout evolved in clear, high-elevation california streams. their bright flanks stand out against rocky alpine water." +available_seasons = 7 allowed_water_types = 1 rarity = 2 base_catch_weight = 0.2 diff --git a/fish/species/trout_rainbow/fish_trout_rainbow.png b/fish/species/trout_rainbow/fish_trout_rainbow.png index ff6fd06..3f4dfe4 100644 Binary files a/fish/species/trout_rainbow/fish_trout_rainbow.png and b/fish/species/trout_rainbow/fish_trout_rainbow.png differ diff --git a/fish/species/trout_rainbow/trout_rainbow.tres b/fish/species/trout_rainbow/trout_rainbow.tres index fbcdb42..69d40bd 100644 --- a/fish/species/trout_rainbow/trout_rainbow.tres +++ b/fish/species/trout_rainbow/trout_rainbow.tres @@ -3,11 +3,11 @@ [ext_resource type="Script" uid="uid://h7hg45b7wmst" path="res://fish/fish_data.gd" id="1_fish_data"] [ext_resource type="Resource" path="res://fishing/common_catch_profile.tres" id="2_profile"] [ext_resource type="Script" uid="uid://bs7cqi88csolc" path="res://fish/fish_availability.gd" id="3_availability_script"] -[ext_resource type="Texture2D" uid="uid://mfxehkoxea21" path="res://fish/species/trout_rainbow/fish_trout_rainbow.png" id="4_texture"] +[ext_resource type="Texture2D" path="res://art/exported/creatures/fish_placeholder.png" id="4_texture"] [sub_resource type="Resource" id="TroutRainbowAvailability"] script = ExtResource("3_availability_script") -allowed_location_tags = Array[StringName]([&"starter_pond"]) +allowed_location_tags = Array[StringName]([&"river"]) [resource] script = ExtResource("1_fish_data") @@ -17,6 +17,7 @@ active = true catalog_number = 1106 collection_group = &"Cold freshwater salmonids" logbook_fact = "rainbow trout are adaptable stream hunters. the pink lateral stripe is especially vivid when the fish is in breeding condition." +available_seasons = 15 allowed_water_types = 1 rarity = 1 base_catch_weight = 0.45 diff --git a/fish/species/trout_steelhead/fish_trout_steelhead.png b/fish/species/trout_steelhead/fish_trout_steelhead.png index b2600e0..45cc1b1 100644 Binary files a/fish/species/trout_steelhead/fish_trout_steelhead.png and b/fish/species/trout_steelhead/fish_trout_steelhead.png differ diff --git a/fish/species/trout_steelhead/trout_steelhead.tres b/fish/species/trout_steelhead/trout_steelhead.tres index 92f6985..ed052d9 100644 --- a/fish/species/trout_steelhead/trout_steelhead.tres +++ b/fish/species/trout_steelhead/trout_steelhead.tres @@ -3,11 +3,11 @@ [ext_resource type="Script" uid="uid://h7hg45b7wmst" path="res://fish/fish_data.gd" id="1_fish_data"] [ext_resource type="Resource" path="res://fishing/common_catch_profile.tres" id="2_profile"] [ext_resource type="Script" uid="uid://bs7cqi88csolc" path="res://fish/fish_availability.gd" id="3_availability_script"] -[ext_resource type="Texture2D" uid="uid://cabbpc55sf2gw" path="res://fish/species/trout_steelhead/fish_trout_steelhead.png" id="4_texture"] +[ext_resource type="Texture2D" path="res://art/exported/creatures/fish_placeholder.png" id="4_texture"] [sub_resource type="Resource" id="TroutSteelheadAvailability"] script = ExtResource("3_availability_script") -allowed_location_tags = Array[StringName]([&"starter_pond"]) +allowed_location_tags = Array[StringName]([&"river"]) [resource] script = ExtResource("1_fish_data") @@ -17,6 +17,7 @@ active = true catalog_number = 4501 collection_group = &"Ocean-run salmonids" logbook_fact = "steelhead are the ocean-going form of rainbow trout. adults can leave fresh water and later return to spawn." +available_seasons = 13 allowed_water_types = 1 rarity = 2 base_catch_weight = 0.2 diff --git a/fish/species/trumpetfish_atlantic/trumpetfish_atlantic.tres b/fish/species/trumpetfish_atlantic/trumpetfish_atlantic.tres index 0a99228..3ff3cc3 100644 --- a/fish/species/trumpetfish_atlantic/trumpetfish_atlantic.tres +++ b/fish/species/trumpetfish_atlantic/trumpetfish_atlantic.tres @@ -1,8 +1,9 @@ -[gd_resource type="Resource" script_class="FishData" load_steps=4 format=3] +[gd_resource type="Resource" script_class="FishData" load_steps=5 format=3] [ext_resource type="Script" path="res://fish/fish_data.gd" id="1_fish_data"] [ext_resource type="Resource" path="res://fishing/common_catch_profile.tres" id="2_profile"] [ext_resource type="Script" path="res://fish/fish_availability.gd" id="3_availability"] +[ext_resource type="Texture2D" path="res://art/exported/creatures/fish_placeholder.png" id="99_fish_placeholder"] [sub_resource type="Resource" id="Availability"] script = ExtResource("3_availability") @@ -12,10 +13,11 @@ allow_night = false script = ExtResource("1_fish_data") id = &"trumpetfish_atlantic" display_name = "atlantic trumpetfish" -active = false +active = true catalog_number = 5601 collection_group = &"Reef oddities" logbook_fact = "atlantic trumpetfish hover head-down among corals and sea fans. long tubular snouts expand suddenly to draw in small fish." +available_seasons = 15 allowed_water_types = 2 rarity = 2 base_catch_weight = 0.3 @@ -26,3 +28,4 @@ weight_max_lb = 2.0 sell_value_min = 10 sell_value_max = 24 sell_value_curve = 0.94 +display_texture = ExtResource("99_fish_placeholder") diff --git a/fish/species/tuna_albacore/fish_tuna_albacore.png b/fish/species/tuna_albacore/fish_tuna_albacore.png index 3769c08..3fde5de 100644 Binary files a/fish/species/tuna_albacore/fish_tuna_albacore.png and b/fish/species/tuna_albacore/fish_tuna_albacore.png differ diff --git a/fish/species/tuna_albacore/tuna_albacore.tres b/fish/species/tuna_albacore/tuna_albacore.tres index d0b841b..c8cdfdf 100644 --- a/fish/species/tuna_albacore/tuna_albacore.tres +++ b/fish/species/tuna_albacore/tuna_albacore.tres @@ -3,7 +3,7 @@ [ext_resource type="Script" uid="uid://h7hg45b7wmst" path="res://fish/fish_data.gd" id="1_fish_data"] [ext_resource type="Resource" path="res://fishing/bass_catch_profile.tres" id="2_profile"] [ext_resource type="Script" uid="uid://bs7cqi88csolc" path="res://fish/fish_availability.gd" id="3_availability_script"] -[ext_resource type="Texture2D" uid="uid://bxebn81i552fg" path="res://fish/species/tuna_albacore/fish_tuna_albacore.png" id="4_texture"] +[ext_resource type="Texture2D" path="res://art/exported/creatures/fish_placeholder.png" id="4_texture"] [sub_resource type="Resource" id="AlbacoreAvailability"] script = ExtResource("3_availability_script") @@ -18,6 +18,7 @@ active = true catalog_number = 4801 collection_group = &"Oceanic tuna" logbook_fact = "albacore have unusually long pectoral fins. their warm muscles help them cruise across wide stretches of open ocean." +available_seasons = 7 allowed_water_types = 2 rarity = 2 base_catch_weight = 1.5 diff --git a/fish/species/tuna_bigeye/fish_tuna_bigeye.png b/fish/species/tuna_bigeye/fish_tuna_bigeye.png index b4a36c3..ac52961 100644 Binary files a/fish/species/tuna_bigeye/fish_tuna_bigeye.png and b/fish/species/tuna_bigeye/fish_tuna_bigeye.png differ diff --git a/fish/species/tuna_bigeye/tuna_bigeye.tres b/fish/species/tuna_bigeye/tuna_bigeye.tres index 8c6c867..1c31d1a 100644 --- a/fish/species/tuna_bigeye/tuna_bigeye.tres +++ b/fish/species/tuna_bigeye/tuna_bigeye.tres @@ -3,7 +3,7 @@ [ext_resource type="Script" uid="uid://h7hg45b7wmst" path="res://fish/fish_data.gd" id="1_fish_data"] [ext_resource type="Resource" path="res://fishing/bass_catch_profile.tres" id="2_profile"] [ext_resource type="Script" uid="uid://bs7cqi88csolc" path="res://fish/fish_availability.gd" id="3_availability_script"] -[ext_resource type="Texture2D" uid="uid://bypnhqmkhnm2c" path="res://fish/species/tuna_bigeye/fish_tuna_bigeye.png" id="4_texture"] +[ext_resource type="Texture2D" path="res://art/exported/creatures/fish_placeholder.png" id="4_texture"] [sub_resource type="Resource" id="BigeyeAvailability"] script = ExtResource("3_availability_script") @@ -18,6 +18,7 @@ active = true catalog_number = 4802 collection_group = &"Oceanic tuna" logbook_fact = "bigeye tuna make daily trips between deep, cool water and warmer surface layers. their large eyes suit those dim depths." +available_seasons = 15 allowed_water_types = 2 rarity = 3 base_catch_weight = 0.55 diff --git a/fish/species/tuna_bluefin/fish_tuna_bluefin.png b/fish/species/tuna_bluefin/fish_tuna_bluefin.png index a2b3cad..9f44ad8 100644 Binary files a/fish/species/tuna_bluefin/fish_tuna_bluefin.png and b/fish/species/tuna_bluefin/fish_tuna_bluefin.png differ diff --git a/fish/species/tuna_bluefin/tuna_bluefin.tres b/fish/species/tuna_bluefin/tuna_bluefin.tres index 13e8bc2..4bf5033 100644 --- a/fish/species/tuna_bluefin/tuna_bluefin.tres +++ b/fish/species/tuna_bluefin/tuna_bluefin.tres @@ -3,7 +3,7 @@ [ext_resource type="Script" uid="uid://h7hg45b7wmst" path="res://fish/fish_data.gd" id="1_fish_data"] [ext_resource type="Resource" path="res://fishing/bass_catch_profile.tres" id="2_profile"] [ext_resource type="Script" uid="uid://bs7cqi88csolc" path="res://fish/fish_availability.gd" id="3_availability_script"] -[ext_resource type="Texture2D" uid="uid://dg7nafydp4flx" path="res://fish/species/tuna_bluefin/fish_tuna_bluefin.png" id="4_texture"] +[ext_resource type="Texture2D" path="res://art/exported/creatures/fish_placeholder.png" id="4_texture"] [sub_resource type="Resource" id="BluefinAvailability"] script = ExtResource("3_availability_script") @@ -18,6 +18,7 @@ active = true catalog_number = 4803 collection_group = &"Oceanic tuna" logbook_fact = "bluefin tuna are powerful ocean travelers. heat retained in their swimming muscles lets them thrive in surprisingly cold seas." +available_seasons = 5 allowed_water_types = 2 rarity = 4 base_catch_weight = 0.18 diff --git a/fish/species/tuna_skipjack/fish_tuna_skipjack.png b/fish/species/tuna_skipjack/fish_tuna_skipjack.png index 5a7f74d..3d0be56 100644 Binary files a/fish/species/tuna_skipjack/fish_tuna_skipjack.png and b/fish/species/tuna_skipjack/fish_tuna_skipjack.png differ diff --git a/fish/species/tuna_skipjack/tuna_skipjack.tres b/fish/species/tuna_skipjack/tuna_skipjack.tres index 4541393..cc1988e 100644 --- a/fish/species/tuna_skipjack/tuna_skipjack.tres +++ b/fish/species/tuna_skipjack/tuna_skipjack.tres @@ -3,7 +3,7 @@ [ext_resource type="Script" uid="uid://h7hg45b7wmst" path="res://fish/fish_data.gd" id="1_fish_data"] [ext_resource type="Resource" path="res://fishing/bass_catch_profile.tres" id="2_profile"] [ext_resource type="Script" uid="uid://bs7cqi88csolc" path="res://fish/fish_availability.gd" id="3_availability_script"] -[ext_resource type="Texture2D" uid="uid://vvtr81d2aojs" path="res://fish/species/tuna_skipjack/fish_tuna_skipjack.png" id="4_texture"] +[ext_resource type="Texture2D" path="res://art/exported/creatures/fish_placeholder.png" id="4_texture"] [sub_resource type="Resource" id="SkipjackAvailability"] script = ExtResource("3_availability_script") @@ -18,6 +18,7 @@ active = true catalog_number = 4804 collection_group = &"Oceanic tuna" logbook_fact = "skipjack travel in fast-moving schools and have dark stripes along their lower sides. they rarely stop swimming." +available_seasons = 15 allowed_water_types = 2 rarity = 1 base_catch_weight = 3.0 diff --git a/fish/species/tuna_yellowfin/fish_tuna_yellowfin.png b/fish/species/tuna_yellowfin/fish_tuna_yellowfin.png index a1afc81..ad47a68 100644 Binary files a/fish/species/tuna_yellowfin/fish_tuna_yellowfin.png and b/fish/species/tuna_yellowfin/fish_tuna_yellowfin.png differ diff --git a/fish/species/tuna_yellowfin/tuna_yellowfin.tres b/fish/species/tuna_yellowfin/tuna_yellowfin.tres index 5c5acc3..665228e 100644 --- a/fish/species/tuna_yellowfin/tuna_yellowfin.tres +++ b/fish/species/tuna_yellowfin/tuna_yellowfin.tres @@ -3,7 +3,7 @@ [ext_resource type="Script" uid="uid://h7hg45b7wmst" path="res://fish/fish_data.gd" id="1_fish_data"] [ext_resource type="Resource" path="res://fishing/bass_catch_profile.tres" id="2_profile"] [ext_resource type="Script" uid="uid://bs7cqi88csolc" path="res://fish/fish_availability.gd" id="3_availability_script"] -[ext_resource type="Texture2D" uid="uid://bwpdgagaysdsf" path="res://fish/species/tuna_yellowfin/fish_tuna_yellowfin.png" id="4_texture"] +[ext_resource type="Texture2D" path="res://art/exported/creatures/fish_placeholder.png" id="4_texture"] [sub_resource type="Resource" id="YellowfinAvailability"] script = ExtResource("3_availability_script") @@ -18,6 +18,7 @@ active = true catalog_number = 4805 collection_group = &"Oceanic tuna" logbook_fact = "yellowfin are named for their bright yellow fins and finlets. large schools often gather with other open-ocean hunters." +available_seasons = 15 allowed_water_types = 2 rarity = 2 catch_profile = ExtResource("2_profile") diff --git a/fish/species/turbot/turbot.tres b/fish/species/turbot/turbot.tres index 6b46871..c3ab7bd 100644 --- a/fish/species/turbot/turbot.tres +++ b/fish/species/turbot/turbot.tres @@ -1,8 +1,9 @@ -[gd_resource type="Resource" script_class="FishData" load_steps=4 format=3] +[gd_resource type="Resource" script_class="FishData" load_steps=5 format=3] [ext_resource type="Script" path="res://fish/fish_data.gd" id="1_fish_data"] [ext_resource type="Resource" path="res://fishing/common_catch_profile.tres" id="2_profile"] [ext_resource type="Script" path="res://fish/fish_availability.gd" id="3_availability"] +[ext_resource type="Texture2D" path="res://art/exported/creatures/fish_placeholder.png" id="99_fish_placeholder"] [sub_resource type="Resource" id="Availability"] script = ExtResource("3_availability") @@ -12,10 +13,11 @@ require_fog = true script = ExtResource("1_fish_data") id = &"turbot" display_name = "turbot" -active = false +active = true catalog_number = 3703 collection_group = &"Large flatfish" logbook_fact = "turbot have broad, nearly circular bodies covered with bony bumps instead of scales. they bury into sand before ambushing fish and crustaceans." +available_seasons = 13 allowed_water_types = 2 rarity = 2 base_catch_weight = 0.24 @@ -26,3 +28,4 @@ weight_max_lb = 35.0 sell_value_min = 14 sell_value_max = 34 sell_value_curve = 0.85 +display_texture = ExtResource("99_fish_placeholder") diff --git a/fish/species/turtle_green/turtle_green.tres b/fish/species/turtle_green/turtle_green.tres index 91f40cd..b1e8e71 100644 --- a/fish/species/turtle_green/turtle_green.tres +++ b/fish/species/turtle_green/turtle_green.tres @@ -1,8 +1,9 @@ -[gd_resource type="Resource" script_class="FishData" load_steps=4 format=3] +[gd_resource type="Resource" script_class="FishData" load_steps=5 format=3] [ext_resource type="Script" path="res://fish/fish_data.gd" id="1_fish_data"] [ext_resource type="Resource" path="res://fishing/common_catch_profile.tres" id="2_profile"] [ext_resource type="Script" path="res://fish/fish_availability.gd" id="3_availability"] +[ext_resource type="Texture2D" path="res://art/exported/creatures/fish_placeholder.png" id="99_fish_placeholder"] [sub_resource type="Resource" id="Availability"] script = ExtResource("3_availability") @@ -13,10 +14,11 @@ forbid_fog = true script = ExtResource("1_fish_data") id = &"turtle_green" display_name = "green sea turtle" -active = false +active = true catalog_number = 6201 collection_group = &"Sea turtles" logbook_fact = "green sea turtles graze seagrass meadows with finely serrated jaws. adults migrate long distances between feeding and nesting grounds." +available_seasons = 6 allowed_water_types = 2 rarity = 4 base_catch_weight = 0.018 @@ -27,3 +29,4 @@ weight_max_lb = 500.0 sell_value_min = 62 sell_value_max = 145 sell_value_curve = 0.78 +display_texture = ExtResource("99_fish_placeholder") diff --git a/fish/species/turtle_hawksbill/turtle_hawksbill.tres b/fish/species/turtle_hawksbill/turtle_hawksbill.tres index 5e07f77..5b5a5c8 100644 --- a/fish/species/turtle_hawksbill/turtle_hawksbill.tres +++ b/fish/species/turtle_hawksbill/turtle_hawksbill.tres @@ -1,8 +1,9 @@ -[gd_resource type="Resource" script_class="FishData" load_steps=4 format=3] +[gd_resource type="Resource" script_class="FishData" load_steps=5 format=3] [ext_resource type="Script" path="res://fish/fish_data.gd" id="1_fish_data"] [ext_resource type="Resource" path="res://fishing/common_catch_profile.tres" id="2_profile"] [ext_resource type="Script" path="res://fish/fish_availability.gd" id="3_availability"] +[ext_resource type="Texture2D" path="res://art/exported/creatures/fish_placeholder.png" id="99_fish_placeholder"] [sub_resource type="Resource" id="Availability"] script = ExtResource("3_availability") @@ -13,10 +14,11 @@ require_rain = true script = ExtResource("1_fish_data") id = &"turtle_hawksbill" display_name = "hawksbill sea turtle" -active = false +active = true catalog_number = 6202 collection_group = &"Sea turtles" logbook_fact = "hawksbill sea turtles reach into reef crevices with narrow hooked beaks. a diet rich in sponges helps shape coral communities." +available_seasons = 6 allowed_water_types = 2 rarity = 4 base_catch_weight = 0.014 @@ -27,3 +29,4 @@ weight_max_lb = 250.0 sell_value_min = 66 sell_value_max = 150 sell_value_curve = 0.8 +display_texture = ExtResource("99_fish_placeholder") diff --git a/fish/species/turtle_leatherback/turtle_leatherback.tres b/fish/species/turtle_leatherback/turtle_leatherback.tres index 1e89bee..3a8acf3 100644 --- a/fish/species/turtle_leatherback/turtle_leatherback.tres +++ b/fish/species/turtle_leatherback/turtle_leatherback.tres @@ -1,8 +1,9 @@ -[gd_resource type="Resource" script_class="FishData" load_steps=4 format=3] +[gd_resource type="Resource" script_class="FishData" load_steps=5 format=3] [ext_resource type="Script" path="res://fish/fish_data.gd" id="1_fish_data"] [ext_resource type="Resource" path="res://fishing/common_catch_profile.tres" id="2_profile"] [ext_resource type="Script" path="res://fish/fish_availability.gd" id="3_availability"] +[ext_resource type="Texture2D" path="res://art/exported/creatures/fish_placeholder.png" id="99_fish_placeholder"] [sub_resource type="Resource" id="Availability"] script = ExtResource("3_availability") @@ -13,10 +14,11 @@ require_fog = true script = ExtResource("1_fish_data") id = &"turtle_leatherback" display_name = "leatherback sea turtle" -active = false +active = true catalog_number = 6203 collection_group = &"Sea turtles" logbook_fact = "leatherback sea turtles cross entire oceans while hunting jellies. a flexible ridged shell and internal heat help them enter cold water." +available_seasons = 15 allowed_water_types = 2 rarity = 4 base_catch_weight = 0.012 @@ -27,3 +29,4 @@ weight_max_lb = 2000.0 sell_value_min = 75 sell_value_max = 175 sell_value_curve = 0.76 +display_texture = ExtResource("99_fish_placeholder") diff --git a/fish/species/turtle_loggerhead/turtle_loggerhead.tres b/fish/species/turtle_loggerhead/turtle_loggerhead.tres index 5b64995..e4bd898 100644 --- a/fish/species/turtle_loggerhead/turtle_loggerhead.tres +++ b/fish/species/turtle_loggerhead/turtle_loggerhead.tres @@ -1,8 +1,9 @@ -[gd_resource type="Resource" script_class="FishData" load_steps=4 format=3] +[gd_resource type="Resource" script_class="FishData" load_steps=5 format=3] [ext_resource type="Script" path="res://fish/fish_data.gd" id="1_fish_data"] [ext_resource type="Resource" path="res://fishing/common_catch_profile.tres" id="2_profile"] [ext_resource type="Script" path="res://fish/fish_availability.gd" id="3_availability"] +[ext_resource type="Texture2D" path="res://art/exported/creatures/fish_placeholder.png" id="99_fish_placeholder"] [sub_resource type="Resource" id="Availability"] script = ExtResource("3_availability") @@ -12,10 +13,11 @@ allow_night = false script = ExtResource("1_fish_data") id = &"turtle_loggerhead" display_name = "loggerhead sea turtle" -active = false +active = true catalog_number = 6204 collection_group = &"Sea turtles" logbook_fact = "loggerhead sea turtles crush crabs and mollusks with massive jaws. females often return near their birth beaches to nest." +available_seasons = 6 allowed_water_types = 2 rarity = 4 base_catch_weight = 0.016 @@ -26,3 +28,4 @@ weight_max_lb = 1200.0 sell_value_min = 68 sell_value_max = 155 sell_value_curve = 0.77 +display_texture = ExtResource("99_fish_placeholder") diff --git a/fish/species/urchin_purple/urchin_purple.tres b/fish/species/urchin_purple/urchin_purple.tres index 7725d3d..6546627 100644 --- a/fish/species/urchin_purple/urchin_purple.tres +++ b/fish/species/urchin_purple/urchin_purple.tres @@ -1,8 +1,9 @@ -[gd_resource type="Resource" script_class="FishData" load_steps=4 format=3] +[gd_resource type="Resource" script_class="FishData" load_steps=5 format=3] [ext_resource type="Script" path="res://fish/fish_data.gd" id="1_fish_data"] [ext_resource type="Resource" path="res://fishing/common_catch_profile.tres" id="2_profile"] [ext_resource type="Script" path="res://fish/fish_availability.gd" id="3_availability"] +[ext_resource type="Texture2D" path="res://art/exported/creatures/fish_placeholder.png" id="99_fish_placeholder"] [sub_resource type="Resource" id="Availability"] script = ExtResource("3_availability") @@ -12,10 +13,11 @@ allow_night = false script = ExtResource("1_fish_data") id = &"urchin_purple" display_name = "purple sea urchin" -active = false +active = true catalog_number = 1903 collection_group = &"Echinoderms" logbook_fact = "purple sea urchins scrape algae from rocks with a five-toothed feeding structure. dense groups can clear kelp from entire reefs." +available_seasons = 15 allowed_water_types = 2 rarity = 1 base_catch_weight = 0.75 @@ -26,3 +28,4 @@ weight_max_lb = 1.0 sell_value_min = 5 sell_value_max = 12 sell_value_curve = 0.96 +display_texture = ExtResource("99_fish_placeholder") diff --git a/fish/species/wahoo/wahoo.tres b/fish/species/wahoo/wahoo.tres index 4753b9d..9e045de 100644 --- a/fish/species/wahoo/wahoo.tres +++ b/fish/species/wahoo/wahoo.tres @@ -1,8 +1,9 @@ -[gd_resource type="Resource" script_class="FishData" load_steps=4 format=3] +[gd_resource type="Resource" script_class="FishData" load_steps=5 format=3] [ext_resource type="Script" path="res://fish/fish_data.gd" id="1_fish_data"] [ext_resource type="Resource" path="res://fishing/common_catch_profile.tres" id="2_profile"] [ext_resource type="Script" path="res://fish/fish_availability.gd" id="3_availability"] +[ext_resource type="Texture2D" path="res://art/exported/creatures/fish_placeholder.png" id="99_fish_placeholder"] [sub_resource type="Resource" id="Availability"] script = ExtResource("3_availability") @@ -12,10 +13,11 @@ allow_night = false script = ExtResource("1_fish_data") id = &"wahoo" display_name = "wahoo" -active = false +active = true catalog_number = 4703 collection_group = &"Oceanic pelagic fish" logbook_fact = "wahoo are streamlined open-ocean hunters with rows of sharp teeth. blue vertical bars flicker across their sides during fast pursuits." +available_seasons = 6 allowed_water_types = 2 rarity = 3 base_catch_weight = 0.11 @@ -26,3 +28,4 @@ weight_max_lb = 100.0 sell_value_min = 30 sell_value_max = 70 sell_value_curve = 0.82 +display_texture = ExtResource("99_fish_placeholder") diff --git a/fish/species/walleye/fish_walleye.png b/fish/species/walleye/fish_walleye.png index ed3eb96..f4fd40a 100644 Binary files a/fish/species/walleye/fish_walleye.png and b/fish/species/walleye/fish_walleye.png differ diff --git a/fish/species/walleye/walleye.tres b/fish/species/walleye/walleye.tres index 97dea01..277b3d8 100644 --- a/fish/species/walleye/walleye.tres +++ b/fish/species/walleye/walleye.tres @@ -3,11 +3,11 @@ [ext_resource type="Script" uid="uid://h7hg45b7wmst" path="res://fish/fish_data.gd" id="1_fish_data"] [ext_resource type="Resource" path="res://fishing/common_catch_profile.tres" id="2_profile"] [ext_resource type="Script" uid="uid://bs7cqi88csolc" path="res://fish/fish_availability.gd" id="3_availability_script"] -[ext_resource type="Texture2D" uid="uid://c10j6jv6fv32r" path="res://fish/species/walleye/fish_walleye.png" id="4_texture"] +[ext_resource type="Texture2D" path="res://art/exported/creatures/fish_placeholder.png" id="4_texture"] [sub_resource type="Resource" id="WalleyeAvailability"] script = ExtResource("3_availability_script") -allowed_location_tags = Array[StringName]([&"starter_pond"]) +allowed_location_tags = Array[StringName]([&"lake"]) [resource] script = ExtResource("1_fish_data") @@ -17,6 +17,7 @@ active = true catalog_number = 3306 collection_group = &"Freshwater predators" logbook_fact = "walleye have light-sensitive eyes that help them hunt in murky water and around dusk. their reflective layer gives the eyes a pale glow." +available_seasons = 13 allowed_water_types = 1 rarity = 1 base_catch_weight = 0.4 diff --git a/fish/species/walrus/walrus.tres b/fish/species/walrus/walrus.tres index 41682d5..ff74bf6 100644 --- a/fish/species/walrus/walrus.tres +++ b/fish/species/walrus/walrus.tres @@ -1,8 +1,9 @@ -[gd_resource type="Resource" script_class="FishData" load_steps=4 format=3] +[gd_resource type="Resource" script_class="FishData" load_steps=5 format=3] [ext_resource type="Script" path="res://fish/fish_data.gd" id="1_fish_data"] [ext_resource type="Resource" path="res://fishing/common_catch_profile.tres" id="2_profile"] [ext_resource type="Script" path="res://fish/fish_availability.gd" id="3_availability"] +[ext_resource type="Texture2D" path="res://art/exported/creatures/fish_placeholder.png" id="99_fish_placeholder"] [sub_resource type="Resource" id="Availability"] script = ExtResource("3_availability") @@ -13,10 +14,11 @@ require_fog = true script = ExtResource("1_fish_data") id = &"walrus" display_name = "walrus" -active = false +active = true catalog_number = 504 collection_group = &"Coastal marine mammals" logbook_fact = "walruses sweep the seafloor for clams and other soft-bodied prey. long tusks help them haul onto ice and settle disputes." +available_seasons = 9 allowed_water_types = 2 rarity = 4 base_catch_weight = 0.012 @@ -27,3 +29,4 @@ weight_max_lb = 3700.0 sell_value_min = 74 sell_value_max = 170 sell_value_curve = 0.76 +display_texture = ExtResource("99_fish_placeholder") diff --git a/fish/species/warmouth/warmouth.tres b/fish/species/warmouth/warmouth.tres index af0214f..c58e8c5 100644 --- a/fish/species/warmouth/warmouth.tres +++ b/fish/species/warmouth/warmouth.tres @@ -1,8 +1,9 @@ -[gd_resource type="Resource" script_class="FishData" load_steps=4 format=3] +[gd_resource type="Resource" script_class="FishData" load_steps=5 format=3] [ext_resource type="Script" path="res://fish/fish_data.gd" id="1_fish_data"] [ext_resource type="Resource" path="res://fishing/common_catch_profile.tres" id="2_profile"] [ext_resource type="Script" path="res://fish/fish_availability.gd" id="3_availability"] +[ext_resource type="Texture2D" path="res://art/exported/creatures/fish_placeholder.png" id="99_fish_placeholder"] [sub_resource type="Resource" id="Availability"] script = ExtResource("3_availability") @@ -13,10 +14,11 @@ require_rain = true script = ExtResource("1_fish_data") id = &"warmouth" display_name = "warmouth" -active = false +active = true catalog_number = 3106 collection_group = &"Freshwater panfish" logbook_fact = "warmouth hide in weeds, roots, and murky backwaters before ambushing prey. red eyes and dark cheek stripes frame a notably large mouth." +available_seasons = 7 allowed_water_types = 1 rarity = 1 base_catch_weight = 0.8 @@ -27,3 +29,4 @@ weight_max_lb = 2.0 sell_value_min = 5 sell_value_max = 10 sell_value_curve = 0.95 +display_texture = ExtResource("99_fish_placeholder") diff --git a/fish/species/weakfish/weakfish.tres b/fish/species/weakfish/weakfish.tres index b0072e3..83a5f11 100644 --- a/fish/species/weakfish/weakfish.tres +++ b/fish/species/weakfish/weakfish.tres @@ -1,8 +1,9 @@ -[gd_resource type="Resource" script_class="FishData" load_steps=4 format=3] +[gd_resource type="Resource" script_class="FishData" load_steps=5 format=3] [ext_resource type="Script" path="res://fish/fish_data.gd" id="1_fish_data"] [ext_resource type="Resource" path="res://fishing/common_catch_profile.tres" id="2_profile"] [ext_resource type="Script" path="res://fish/fish_availability.gd" id="3_availability"] +[ext_resource type="Texture2D" path="res://art/exported/creatures/fish_placeholder.png" id="99_fish_placeholder"] [sub_resource type="Resource" id="Availability"] script = ExtResource("3_availability") @@ -13,10 +14,11 @@ require_fog = true script = ExtResource("1_fish_data") id = &"weakfish" display_name = "weakfish" -active = false +active = true catalog_number = 6805 collection_group = &"Temperate estuary" logbook_fact = "weakfish are named for delicate mouth tissue that tears easily around a hook. iridescent spots scatter across their bronze backs." +available_seasons = 7 allowed_water_types = 2 rarity = 2 base_catch_weight = 0.32 @@ -27,3 +29,4 @@ weight_max_lb = 18.0 sell_value_min = 12 sell_value_max = 29 sell_value_curve = 0.86 +display_texture = ExtResource("99_fish_placeholder") diff --git a/fish/species/whale_blue/whale_blue.tres b/fish/species/whale_blue/whale_blue.tres index 9fab3ed..415008e 100644 --- a/fish/species/whale_blue/whale_blue.tres +++ b/fish/species/whale_blue/whale_blue.tres @@ -1,8 +1,9 @@ -[gd_resource type="Resource" script_class="FishData" load_steps=4 format=3] +[gd_resource type="Resource" script_class="FishData" load_steps=5 format=3] [ext_resource type="Script" path="res://fish/fish_data.gd" id="1_fish_data"] [ext_resource type="Resource" path="res://fishing/common_catch_profile.tres" id="2_profile"] [ext_resource type="Script" path="res://fish/fish_availability.gd" id="3_availability"] +[ext_resource type="Texture2D" path="res://art/exported/creatures/fish_placeholder.png" id="99_fish_placeholder"] [sub_resource type="Resource" id="Availability"] script = ExtResource("3_availability") @@ -13,10 +14,11 @@ forbid_fog = true script = ExtResource("1_fish_data") id = &"whale_blue" display_name = "blue whale" -active = false +active = true catalog_number = 7701 collection_group = &"Whales and dolphins" logbook_fact = "blue whales are the largest animals known to have lived. pleated throats expand around vast mouthfuls of water that baleen filters for krill." +available_seasons = 15 allowed_water_types = 2 rarity = 4 base_catch_weight = 0.005 @@ -27,3 +29,4 @@ weight_max_lb = 330000.0 sell_value_min = 120 sell_value_max = 300 sell_value_curve = 0.72 +display_texture = ExtResource("99_fish_placeholder") diff --git a/fish/species/whale_humpback/whale_humpback.tres b/fish/species/whale_humpback/whale_humpback.tres index e20e736..7ad7161 100644 --- a/fish/species/whale_humpback/whale_humpback.tres +++ b/fish/species/whale_humpback/whale_humpback.tres @@ -1,8 +1,9 @@ -[gd_resource type="Resource" script_class="FishData" load_steps=4 format=3] +[gd_resource type="Resource" script_class="FishData" load_steps=5 format=3] [ext_resource type="Script" path="res://fish/fish_data.gd" id="1_fish_data"] [ext_resource type="Resource" path="res://fishing/common_catch_profile.tres" id="2_profile"] [ext_resource type="Script" path="res://fish/fish_availability.gd" id="3_availability"] +[ext_resource type="Texture2D" path="res://art/exported/creatures/fish_placeholder.png" id="99_fish_placeholder"] [sub_resource type="Resource" id="Availability"] script = ExtResource("3_availability") @@ -13,10 +14,11 @@ require_fog = true script = ExtResource("1_fish_data") id = &"whale_humpback" display_name = "humpback whale" -active = false +active = true catalog_number = 7703 collection_group = &"Whales and dolphins" logbook_fact = "humpback whales use long pectoral fins while turning and feeding. males produce layered songs that change across breeding seasons." +available_seasons = 13 allowed_water_types = 2 rarity = 4 base_catch_weight = 0.008 @@ -27,3 +29,4 @@ weight_max_lb = 90000.0 sell_value_min = 105 sell_value_max = 260 sell_value_curve = 0.73 +display_texture = ExtResource("99_fish_placeholder") diff --git a/fish/species/whale_killer/whale_killer.tres b/fish/species/whale_killer/whale_killer.tres index b3ea92a..7952089 100644 --- a/fish/species/whale_killer/whale_killer.tres +++ b/fish/species/whale_killer/whale_killer.tres @@ -1,8 +1,9 @@ -[gd_resource type="Resource" script_class="FishData" load_steps=4 format=3] +[gd_resource type="Resource" script_class="FishData" load_steps=5 format=3] [ext_resource type="Script" path="res://fish/fish_data.gd" id="1_fish_data"] [ext_resource type="Resource" path="res://fishing/common_catch_profile.tres" id="2_profile"] [ext_resource type="Script" path="res://fish/fish_availability.gd" id="3_availability"] +[ext_resource type="Texture2D" path="res://art/exported/creatures/fish_placeholder.png" id="99_fish_placeholder"] [sub_resource type="Resource" id="Availability"] script = ExtResource("3_availability") @@ -13,10 +14,11 @@ require_rain = true script = ExtResource("1_fish_data") id = &"whale_killer" display_name = "killer whale" -active = false +active = true catalog_number = 7704 collection_group = &"Whales and dolphins" logbook_fact = "killer whales live in close family groups with distinct calls and hunting traditions. different populations specialize in different prey." +available_seasons = 13 allowed_water_types = 2 rarity = 4 base_catch_weight = 0.008 @@ -27,3 +29,4 @@ weight_max_lb = 12000.0 sell_value_min = 95 sell_value_max = 230 sell_value_curve = 0.74 +display_texture = ExtResource("99_fish_placeholder") diff --git a/fish/species/whale_sperm/whale_sperm.tres b/fish/species/whale_sperm/whale_sperm.tres index a10b923..eef3aed 100644 --- a/fish/species/whale_sperm/whale_sperm.tres +++ b/fish/species/whale_sperm/whale_sperm.tres @@ -1,8 +1,9 @@ -[gd_resource type="Resource" script_class="FishData" load_steps=4 format=3] +[gd_resource type="Resource" script_class="FishData" load_steps=5 format=3] [ext_resource type="Script" path="res://fish/fish_data.gd" id="1_fish_data"] [ext_resource type="Resource" path="res://fishing/common_catch_profile.tres" id="2_profile"] [ext_resource type="Script" path="res://fish/fish_availability.gd" id="3_availability"] +[ext_resource type="Texture2D" path="res://art/exported/creatures/fish_placeholder.png" id="99_fish_placeholder"] [sub_resource type="Resource" id="Availability"] script = ExtResource("3_availability") @@ -13,10 +14,11 @@ require_fog = true script = ExtResource("1_fish_data") id = &"whale_sperm" display_name = "sperm whale" -active = false +active = true catalog_number = 7705 collection_group = &"Whales and dolphins" logbook_fact = "sperm whales make deep dives to hunt squid with powerful echolocation clicks. their enormous square heads contain a waxy spermaceti organ." +available_seasons = 15 allowed_water_types = 2 rarity = 4 base_catch_weight = 0.006 @@ -27,3 +29,4 @@ weight_max_lb = 125000.0 sell_value_min = 115 sell_value_max = 280 sell_value_curve = 0.72 +display_texture = ExtResource("99_fish_placeholder") diff --git a/fish/species/white_perch/white_perch.tres b/fish/species/white_perch/white_perch.tres index ee06ee4..5543307 100644 --- a/fish/species/white_perch/white_perch.tres +++ b/fish/species/white_perch/white_perch.tres @@ -1,8 +1,9 @@ -[gd_resource type="Resource" script_class="FishData" load_steps=4 format=3] +[gd_resource type="Resource" script_class="FishData" load_steps=5 format=3] [ext_resource type="Script" path="res://fish/fish_data.gd" id="1_fish_data"] [ext_resource type="Resource" path="res://fishing/common_catch_profile.tres" id="2_profile"] [ext_resource type="Script" path="res://fish/fish_availability.gd" id="3_availability"] +[ext_resource type="Texture2D" path="res://art/exported/creatures/fish_placeholder.png" id="99_fish_placeholder"] [sub_resource type="Resource" id="Availability"] script = ExtResource("3_availability") @@ -11,10 +12,11 @@ script = ExtResource("3_availability") script = ExtResource("1_fish_data") id = &"white_perch" display_name = "white perch" -active = false +active = true catalog_number = 6806 collection_group = &"Temperate estuary" logbook_fact = "white perch tolerate fresh and brackish water along the atlantic coast. deep silver bodies gather in schools around river mouths." +available_seasons = 7 allowed_water_types = 3 rarity = 1 base_catch_weight = 1.1 @@ -25,3 +27,4 @@ weight_max_lb = 3.5 sell_value_min = 5 sell_value_max = 11 sell_value_curve = 0.9 +display_texture = ExtResource("99_fish_placeholder") diff --git a/fish/species/whitefish_lake/whitefish_lake.tres b/fish/species/whitefish_lake/whitefish_lake.tres index 4ad0281..51246f5 100644 --- a/fish/species/whitefish_lake/whitefish_lake.tres +++ b/fish/species/whitefish_lake/whitefish_lake.tres @@ -1,8 +1,9 @@ -[gd_resource type="Resource" script_class="FishData" load_steps=4 format=3] +[gd_resource type="Resource" script_class="FishData" load_steps=5 format=3] [ext_resource type="Script" path="res://fish/fish_data.gd" id="1_fish_data"] [ext_resource type="Resource" path="res://fishing/common_catch_profile.tres" id="2_profile"] [ext_resource type="Script" path="res://fish/fish_availability.gd" id="3_availability"] +[ext_resource type="Texture2D" path="res://art/exported/creatures/fish_placeholder.png" id="99_fish_placeholder"] [sub_resource type="Resource" id="Availability"] script = ExtResource("3_availability") @@ -11,10 +12,11 @@ script = ExtResource("3_availability") script = ExtResource("1_fish_data") id = &"whitefish_lake" display_name = "lake whitefish" -active = false +active = true catalog_number = 1003 collection_group = &"Cold freshwater fish" logbook_fact = "lake whitefish browse deep, cold bottoms with small downward-pointing mouths. large schools move toward shallows to spawn in autumn." +available_seasons = 13 allowed_water_types = 1 rarity = 0 base_catch_weight = 1.5 @@ -25,3 +27,4 @@ weight_max_lb = 12.0 sell_value_min = 4 sell_value_max = 11 sell_value_curve = 0.9 +display_texture = ExtResource("99_fish_placeholder") diff --git a/fish/species/wolffish_atlantic/wolffish_atlantic.tres b/fish/species/wolffish_atlantic/wolffish_atlantic.tres index a305cc7..ca67a92 100644 --- a/fish/species/wolffish_atlantic/wolffish_atlantic.tres +++ b/fish/species/wolffish_atlantic/wolffish_atlantic.tres @@ -1,8 +1,9 @@ -[gd_resource type="Resource" script_class="FishData" load_steps=4 format=3] +[gd_resource type="Resource" script_class="FishData" load_steps=5 format=3] [ext_resource type="Script" path="res://fish/fish_data.gd" id="1_fish_data"] [ext_resource type="Resource" path="res://fishing/common_catch_profile.tres" id="2_profile"] [ext_resource type="Script" path="res://fish/fish_availability.gd" id="3_availability"] +[ext_resource type="Texture2D" path="res://art/exported/creatures/fish_placeholder.png" id="99_fish_placeholder"] [sub_resource type="Resource" id="Availability"] script = ExtResource("3_availability") @@ -12,10 +13,11 @@ forbid_rain = true script = ExtResource("1_fish_data") id = &"wolffish_atlantic" display_name = "atlantic wolffish" -active = false +active = true catalog_number = 1201 collection_group = &"Cold reef fish" logbook_fact = "atlantic wolffish use heavy jaws and blunt teeth to crush shellfish and urchins. natural antifreeze proteins help them endure icy water." +available_seasons = 13 allowed_water_types = 2 rarity = 2 base_catch_weight = 0.25 @@ -26,3 +28,4 @@ weight_max_lb = 40.0 sell_value_min = 14 sell_value_max = 34 sell_value_curve = 0.84 +display_texture = ExtResource("99_fish_placeholder") diff --git a/fish/species/wolffish_spotted/wolffish_spotted.tres b/fish/species/wolffish_spotted/wolffish_spotted.tres index 52a1de3..36b4575 100644 --- a/fish/species/wolffish_spotted/wolffish_spotted.tres +++ b/fish/species/wolffish_spotted/wolffish_spotted.tres @@ -1,8 +1,9 @@ -[gd_resource type="Resource" script_class="FishData" load_steps=4 format=3] +[gd_resource type="Resource" script_class="FishData" load_steps=5 format=3] [ext_resource type="Script" path="res://fish/fish_data.gd" id="1_fish_data"] [ext_resource type="Resource" path="res://fishing/common_catch_profile.tres" id="2_profile"] [ext_resource type="Script" path="res://fish/fish_availability.gd" id="3_availability"] +[ext_resource type="Texture2D" path="res://art/exported/creatures/fish_placeholder.png" id="99_fish_placeholder"] [sub_resource type="Resource" id="Availability"] script = ExtResource("3_availability") @@ -12,10 +13,11 @@ require_fog = true script = ExtResource("1_fish_data") id = &"wolffish_spotted" display_name = "spotted wolffish" -active = false +active = true catalog_number = 1203 collection_group = &"Cold reef fish" logbook_fact = "spotted wolffish crush hard-shelled prey with broad molar-like teeth. their pale spots stand out against a dark cold-water body." +available_seasons = 13 allowed_water_types = 2 rarity = 3 base_catch_weight = 0.11 @@ -26,3 +28,4 @@ weight_max_lb = 50.0 sell_value_min = 26 sell_value_max = 60 sell_value_curve = 0.84 +display_texture = ExtResource("99_fish_placeholder") diff --git a/fish/species/wrasse_ballan/wrasse_ballan.tres b/fish/species/wrasse_ballan/wrasse_ballan.tres index 63cb0b6..a1beebc 100644 --- a/fish/species/wrasse_ballan/wrasse_ballan.tres +++ b/fish/species/wrasse_ballan/wrasse_ballan.tres @@ -1,8 +1,9 @@ -[gd_resource type="Resource" script_class="FishData" load_steps=4 format=3] +[gd_resource type="Resource" script_class="FishData" load_steps=5 format=3] [ext_resource type="Script" path="res://fish/fish_data.gd" id="1_fish_data"] [ext_resource type="Resource" path="res://fishing/common_catch_profile.tres" id="2_profile"] [ext_resource type="Script" path="res://fish/fish_availability.gd" id="3_availability"] +[ext_resource type="Texture2D" path="res://art/exported/creatures/fish_placeholder.png" id="99_fish_placeholder"] [sub_resource type="Resource" id="Availability"] script = ExtResource("3_availability") @@ -12,10 +13,11 @@ allow_night = false script = ExtResource("1_fish_data") id = &"wrasse_ballan" display_name = "ballan wrasse" -active = false +active = true catalog_number = 6101 collection_group = &"Reef wrasses" logbook_fact = "ballan wrasse crush shellfish and sea urchins with strong throat teeth. thick lips and mottled colors suit rocky european reefs." +available_seasons = 15 allowed_water_types = 2 rarity = 1 base_catch_weight = 0.8 @@ -26,3 +28,4 @@ weight_max_lb = 10.0 sell_value_min = 6 sell_value_max = 15 sell_value_curve = 0.9 +display_texture = ExtResource("99_fish_placeholder") diff --git a/fish/species/wrasse_cleaner/wrasse_cleaner.tres b/fish/species/wrasse_cleaner/wrasse_cleaner.tres index e22c1f0..85db0fc 100644 --- a/fish/species/wrasse_cleaner/wrasse_cleaner.tres +++ b/fish/species/wrasse_cleaner/wrasse_cleaner.tres @@ -1,8 +1,9 @@ -[gd_resource type="Resource" script_class="FishData" load_steps=4 format=3] +[gd_resource type="Resource" script_class="FishData" load_steps=5 format=3] [ext_resource type="Script" path="res://fish/fish_data.gd" id="1_fish_data"] [ext_resource type="Resource" path="res://fishing/common_catch_profile.tres" id="2_profile"] [ext_resource type="Script" path="res://fish/fish_availability.gd" id="3_availability"] +[ext_resource type="Texture2D" path="res://art/exported/creatures/fish_placeholder.png" id="99_fish_placeholder"] [sub_resource type="Resource" id="Availability"] script = ExtResource("3_availability") @@ -13,10 +14,11 @@ forbid_fog = true script = ExtResource("1_fish_data") id = &"wrasse_cleaner" display_name = "cleaner wrasse" -active = false +active = true catalog_number = 6102 collection_group = &"Reef wrasses" logbook_fact = "cleaner wrasses advertise with a bright stripe and dance at reef stations. larger fish wait while parasites are picked from skin and gills." +available_seasons = 15 allowed_water_types = 2 rarity = 2 base_catch_weight = 0.35 @@ -27,3 +29,4 @@ weight_max_lb = 0.2 sell_value_min = 9 sell_value_max = 20 sell_value_curve = 1.0 +display_texture = ExtResource("99_fish_placeholder") diff --git a/fish/species/wreckfish/wreckfish.tres b/fish/species/wreckfish/wreckfish.tres index a2121ef..345d274 100644 --- a/fish/species/wreckfish/wreckfish.tres +++ b/fish/species/wreckfish/wreckfish.tres @@ -1,8 +1,9 @@ -[gd_resource type="Resource" script_class="FishData" load_steps=4 format=3] +[gd_resource type="Resource" script_class="FishData" load_steps=5 format=3] [ext_resource type="Script" path="res://fish/fish_data.gd" id="1_fish_data"] [ext_resource type="Resource" path="res://fishing/common_catch_profile.tres" id="2_profile"] [ext_resource type="Script" path="res://fish/fish_availability.gd" id="3_availability"] +[ext_resource type="Texture2D" path="res://art/exported/creatures/fish_placeholder.png" id="99_fish_placeholder"] [sub_resource type="Resource" id="Availability"] script = ExtResource("3_availability") @@ -12,10 +13,11 @@ require_fog = true script = ExtResource("1_fish_data") id = &"wreckfish" display_name = "wreckfish" -active = false +active = true catalog_number = 1606 collection_group = &"Deep shelf fish" logbook_fact = "wreckfish gather around caves, ledges, and shipwrecks in deep water. powerful jaws let them ambush fish and large crustaceans." +available_seasons = 15 allowed_water_types = 2 rarity = 3 base_catch_weight = 0.1 @@ -26,3 +28,4 @@ weight_max_lb = 180.0 sell_value_min = 31 sell_value_max = 76 sell_value_curve = 0.8 +display_texture = ExtResource("99_fish_placeholder") diff --git a/fish/species/yellow_perch/yellow_perch.tres b/fish/species/yellow_perch/yellow_perch.tres index 3147fdd..5098a1e 100644 --- a/fish/species/yellow_perch/yellow_perch.tres +++ b/fish/species/yellow_perch/yellow_perch.tres @@ -1,8 +1,9 @@ -[gd_resource type="Resource" script_class="FishData" load_steps=4 format=3] +[gd_resource type="Resource" script_class="FishData" load_steps=5 format=3] [ext_resource type="Script" path="res://fish/fish_data.gd" id="1_fish_data"] [ext_resource type="Resource" path="res://fishing/common_catch_profile.tres" id="2_profile"] [ext_resource type="Script" path="res://fish/fish_availability.gd" id="3_availability"] +[ext_resource type="Texture2D" path="res://art/exported/creatures/fish_placeholder.png" id="99_fish_placeholder"] [sub_resource type="Resource" id="Availability"] script = ExtResource("3_availability") @@ -12,10 +13,11 @@ allow_night = false script = ExtResource("1_fish_data") id = &"yellow_perch" display_name = "yellow perch" -active = false +active = true catalog_number = 3201 collection_group = &"Freshwater perch" logbook_fact = "yellow perch travel in schools through cool lakes and slow rivers. dark vertical bars and orange lower fins make them easy to recognize." +available_seasons = 13 allowed_water_types = 1 rarity = 0 base_catch_weight = 2.2 @@ -26,3 +28,4 @@ weight_max_lb = 4.0 sell_value_min = 3 sell_value_max = 8 sell_value_curve = 0.9 +display_texture = ExtResource("99_fish_placeholder") diff --git a/fishing/catch_controller.gd b/fishing/catch_controller.gd index 7e75370..12cc431 100644 --- a/fishing/catch_controller.gd +++ b/fishing/catch_controller.gd @@ -46,7 +46,7 @@ class Barrier: # Fight movement uses one shared baseline. Species and quality difficulty comes # from barrier placement and health, while reel upgrades affect only the # player's progress speed. -const CHASE_START_DELAY: float = 1.0 +const CHASE_START_DELAY: float = 1.5 const CHASE_START_OFFSET: float = 0.04 const CHASE_SPEED: float = 0.07 diff --git a/fishing/fishing_context.gd b/fishing/fishing_context.gd index b3f1acd..d9fcdb5 100644 --- a/fishing/fishing_context.gd +++ b/fishing/fishing_context.gd @@ -1,6 +1,8 @@ class_name FishingContext extends RefCounted +const CalendarSeasonType = preload("res://world/calendar_season.gd") + var location_tags: Array[StringName] = [] var water_type: WaterType.Type = WaterType.Type.FRESH_WATER var active_event_tags: Array[StringName] = [] @@ -9,3 +11,4 @@ var is_night: bool = false var is_day_night_transition: bool = false var is_raining: bool = false var is_foggy: bool = false +var season: int = CalendarSeasonType.UNKNOWN diff --git a/fishing/fishing_spot.gd b/fishing/fishing_spot.gd index b8a0bdd..8160eec 100644 --- a/fishing/fishing_spot.gd +++ b/fishing/fishing_spot.gd @@ -41,8 +41,6 @@ const FishingSurfaceSampleType = preload( const FishingSurfaceResolverType = preload( "res://fishing/fishing_surface_resolver.gd" ) -const ArtShopStockType = preload("res://economy/art_shop_stock.gd") -const FishingShopStockType = preload("res://economy/fishing_shop_stock.gd") const WorldTimeServiceType = preload("res://world/world_time_service.gd") const WorldWeatherServiceType = preload( "res://world/world_weather_service.gd" @@ -68,6 +66,7 @@ signal showcase_changed( ) signal bite_activated signal bite_prompt_changed(is_visible: bool) +signal fishing_input_priority_changed(active: bool) signal ready_for_equipment_refresh enum FishingState { @@ -111,7 +110,9 @@ const BITE_QUICK_PROBABILITY: float = 0.30 const BITE_TYPICAL_PROBABILITY: float = 0.65 const BITE_LONG_PROBABILITY: float = 0.04 const NETWORK_INPUT_RESEND_INTERVAL_SECONDS: float = 0.1 +const ALTERNATE_REEL_ACTION: StringName = &"reel_alternate" @export_range(0.1, 10.0, 0.1) var cooldown_duration: float = 1.0 +@export_range(0.1, 5.0, 0.05) var minimum_showcase_duration: float = 0.8 @export_category("Selection") @export_range(0.0, 10.0, 0.05) var undiscovered_weight_multiplier: float = 1.5 @@ -131,6 +132,7 @@ const NETWORK_INPUT_RESEND_INTERVAL_SECONDS: float = 0.1 var state: FishingState = FishingState.READY var _external_input_blocked: bool = false var _gameplay_input_enabled: bool = false +var _fishing_environment_enabled: bool = true var _local_menu_input_owners: Dictionary[StringName, bool] = {} var _local_player: PlayerType var _local_inventory: FishInventoryType @@ -147,6 +149,7 @@ var _network_session: NetworkSessionType var _network_fishing: NetworkFishingServiceType var _world_time: WorldTimeServiceType var _world_weather: WorldWeatherServiceType +var _fishable_water_regions_resolver := Callable() var _active_player: PlayerType var _state_time_remaining: float = 0.0 var _cast_charge: float = 0.0 @@ -172,6 +175,7 @@ var _selected_fish: FishDataType var _pending_catch: FishCatchType var _showcase_ready: bool = false var _put_away_press_armed: bool = false +var _showcase_input_lock_remaining: float = 0.0 var _showcase_restore_generation: int = 0 var _showcase_outcome_completed: bool = false var _network_auto_click_accumulator: float = 0.0 @@ -179,6 +183,7 @@ var _network_active_barrier_index: int = -1 var _bite_rng: RandomNumberGenerator = RandomNumberGenerator.new() var _pending_cleanup_message: String = "" var _bite_confirmation_pending: bool = false +var _fishing_input_priority_active: bool = false var _bite_confirmation_requested: bool = false @@ -217,6 +222,7 @@ func setup( network_fishing: NetworkFishingServiceType = null, world_time: WorldTimeServiceType = null, world_weather: WorldWeatherServiceType = null, + fishable_water_regions_resolver: Callable = Callable(), ) -> void: _local_player = local_player _local_inventory = local_inventory @@ -237,6 +243,7 @@ func setup( _network_fishing = network_fishing _world_time = world_time _world_weather = world_weather + _fishable_water_regions_resolver = fishable_water_regions_resolver if ( _network_session != null and not _network_session.state_changed.is_connected( @@ -391,6 +398,22 @@ func set_gameplay_input_enabled(enabled: bool) -> void: reset_transient_state() +func set_fishing_environment_enabled(enabled: bool) -> void: + if _fishing_environment_enabled == enabled: + return + _fishing_environment_enabled = enabled + if enabled: + _new_cast_press_armed = not Input.is_action_pressed("fish_primary") + return + if _network_fishing != null and _network_fishing.has_local_attempt(): + _network_fishing.cancel_local_attempt("") + reset_transient_state() + + +func is_fishing_environment_enabled() -> bool: + return _fishing_environment_enabled + + func reset_transient_state(restore_movement: bool = true) -> void: var local_state_was_active: bool = ( state != FishingState.READY or _active_player != null @@ -414,20 +437,21 @@ func configure_accessibility_auto_click( func begin_water_recovery() -> void: _external_input_blocked = true - if state in [ - FishingState.AIMING_CAST, - FishingState.CASTING, - FishingState.WAITING_FOR_BITE, - FishingState.FIGHTING, - ]: - _cancel_attempt() - # Recovery replaces the normal rod-return presentation. Finish the local - # cleanup now so its temporary movement lock is not captured and restored - # after the player respawns. - if state != FishingState.READY: - _finalize_attempt_cleanup("") - elif state == FishingState.SHOWING_CATCH: + if state == FishingState.SHOWING_CATCH: _secure_showcase_catch_for_recovery() + elif is_fishing_sequence_active(): + if state in [ + FishingState.AIMING_CAST, + FishingState.CASTING, + FishingState.WAITING_FOR_BITE, + FishingState.FIGHTING, + ]: + _cancel_attempt() + # Recovery replaces every in-flight rod return. This includes RETURNING, + # which can be entered by Escape a frame before the water trigger fires. + # Finish cleanup now so recovery never snapshots the cast movement lock. + if state != FishingState.READY or _active_player != null: + _finalize_attempt_cleanup("") func end_water_recovery() -> void: @@ -444,6 +468,7 @@ func _secure_showcase_catch_for_recovery() -> void: _pending_catch = null _showcase_ready = false _put_away_press_armed = false + _showcase_input_lock_remaining = 0.0 showcase_changed.emit("", "", 0.0, 0, false) if _active_player != null: _active_player.end_catch_showcase(Callable(), true) @@ -453,6 +478,7 @@ func _secure_showcase_catch_for_recovery() -> void: func _exit_tree() -> void: _stop_fight_audio() _stop_reeling_audio() + _set_fishing_input_priority(false) _showcase_restore_generation += 1 if ( state == FishingState.SHOWING_CATCH @@ -473,14 +499,21 @@ func _exit_tree() -> void: _selected_fish = null _showcase_ready = false _put_away_press_armed = false + _showcase_input_lock_remaining = 0.0 func _process(delta: float) -> void: if state == FishingState.READY and not Input.is_action_pressed("fish_primary"): _new_cast_press_armed = true + if state == FishingState.SHOWING_CATCH: + _showcase_input_lock_remaining = maxf( + _showcase_input_lock_remaining - delta, + 0.0, + ) if ( state == FishingState.SHOWING_CATCH and _showcase_ready + and _showcase_input_lock_remaining <= 0.0 and not Input.is_action_pressed("fish_primary") ): _put_away_press_armed = true @@ -501,7 +534,7 @@ func _process(delta: float) -> void: _get_effective_reel_speed(), _get_effective_barrier_damage() ) - if not Input.is_action_pressed("fish_primary"): + if not _is_reel_input_pressed(): _catch_controller.set_reel_input(false) else: _resend_network_input_state(delta) @@ -515,58 +548,41 @@ func _process(delta: float) -> void: func _unhandled_input(event: InputEvent) -> void: if ( not _gameplay_input_enabled + or not _fishing_environment_enabled or _external_input_blocked or not _local_menu_input_owners.is_empty() ): return if _local_player == null or not _local_player.is_local_control_enabled(): return - if not event.is_action("fish_primary"): - return - var selected_item: ItemDataType = _get_active_item() - if ( - state == FishingState.READY - and selected_item != null - and selected_item.item_id == FishingShopStockType.CRAB_NET_ID + var primary_action: bool = event.is_action("fish_primary") + var alternate_reel: bool = event.is_action(ALTERNATE_REEL_ACTION) + if not primary_action and not ( + alternate_reel and state == FishingState.FIGHTING ): return + # Fishing owns the primary action only after a rod starts a cast, or while + # completing an already-active fishing sequence. An empty hand, decor, + # gathering tools, and other items must remain available to their own world + # interaction controllers. + if state == FishingState.READY and not has_active_fishing_rod(): + return + # A held keyboard key emits echo events. Treat the alternate reel exactly + # like a mouse button: one barrier hit per physical press, while the normal + # held-input path continues driving free reeling between barriers. + if event is InputEventKey and event.echo: + get_viewport().set_input_as_handled() + return if event.is_pressed(): match state: FishingState.READY: if not _new_cast_press_armed: return - var active_item: ItemDataType = _get_active_item() if ( - active_item != null - and ( - active_item.category == ItemDataType.Category.CONSUMABLE - or ( - active_item.item_id == PlayerItemEffectsType.FISH_FINDER_ID - ) - ) - ): - if _network_item_use != null: - _network_item_use.request_use(active_item.item_id) - elif _item_effects.use_item(active_item, _local_bag): - status_changed.emit(_item_effects.get_feedback( - active_item.item_id - )) - elif ( - active_item.item_id == PlayerItemEffectsType.FISH_FINDER_ID - ): - local_speech_requested.emit( - PlayerItemEffectsType.FISH_FINDER_DEAD_MESSAGE - ) - get_viewport().set_input_as_handled() - return - if not has_active_fishing_rod(): - get_viewport().set_input_as_handled() - return - if ( - _is_cooler_full() + _is_inventory_full() ): status_changed.emit( - "cooler full. sell fish before casting again." + "inventory full. store or sell something before casting." ) get_viewport().set_input_as_handled() return @@ -582,7 +598,11 @@ func _unhandled_input(event: InputEvent) -> void: FishingPresentationType.LineMode.TAUT ) FishingState.SHOWING_CATCH: - if _showcase_ready and _put_away_press_armed: + if ( + _showcase_ready + and _showcase_input_lock_remaining <= 0.0 + and _put_away_press_armed + ): _put_away_catch() else: return @@ -619,15 +639,51 @@ func _unhandled_input(event: InputEvent) -> void: _presentation.set_line_mode(FishingPresentationType.LineMode.SLACK) get_viewport().set_input_as_handled() elif state == FishingState.FIGHTING: + var reel_input_held: bool = _is_reel_input_pressed() if _network_fishing != null: - _network_primary_input_held = false + _network_primary_input_held = reel_input_held _network_input_resend_elapsed = 0.0 - _network_fishing.submit_local_input(false, false) + _network_fishing.submit_local_input(reel_input_held, false) else: - _catch_controller.set_reel_input(false) + _catch_controller.set_reel_input(reel_input_held) get_viewport().set_input_as_handled() +func try_use_active_non_fishing_item() -> bool: + if ( + not _gameplay_input_enabled + or _external_input_blocked + or not _local_menu_input_owners.is_empty() + or state != FishingState.READY + ): + return false + var active_item: ItemDataType = _get_active_item() + if ( + active_item == null + or ( + active_item.category != ItemDataType.Category.CONSUMABLE + and active_item.item_id != PlayerItemEffectsType.FISH_FINDER_ID + ) + ): + return false + if _network_item_use != null: + _network_item_use.request_use(active_item.item_id) + elif _item_effects.use_item(active_item, _local_bag): + status_changed.emit(_item_effects.get_feedback(active_item.item_id)) + elif active_item.item_id == PlayerItemEffectsType.FISH_FINDER_ID: + local_speech_requested.emit( + PlayerItemEffectsType.FISH_FINDER_DEAD_MESSAGE + ) + return true + + +func _is_reel_input_pressed() -> bool: + return ( + Input.is_action_pressed("fish_primary") + or Input.is_action_pressed(ALTERNATE_REEL_ACTION) + ) + + func _begin_aiming(player: PlayerType) -> void: if state != FishingState.READY or _active_player != null: return @@ -710,17 +766,15 @@ func _get_active_rod() -> FishingRodDataType: return _get_active_item() as FishingRodDataType -func _is_cooler_full() -> bool: +func _is_inventory_full() -> bool: return ( - _cooler_capacity != null - and _local_inventory != null - and _local_inventory.get_all_catches().size() - >= _cooler_capacity.get_capacity() + _local_inventory != null + and not _local_inventory.can_accept_catch() ) func _on_cooler_availability_changed() -> void: - if state == FishingState.READY and not _is_cooler_full(): + if state == FishingState.READY and not _is_inventory_full(): refresh_active_item_status() @@ -745,6 +799,11 @@ func confirm_pending_bite() -> void: func _set_bite_confirmation_pending(is_pending: bool) -> void: + if is_pending: + # The Standby deliberately pauses before the fight begins. Keep chat and + # menus available during that pause; fishing only owns input once the + # player confirms the bite and enters the actual minigame. + _set_fishing_input_priority(false) if _bite_confirmation_pending == is_pending: if not is_pending: _bite_confirmation_requested = false @@ -754,10 +813,32 @@ func _set_bite_confirmation_pending(is_pending: bool) -> void: bite_prompt_changed.emit(is_pending) +func _set_fishing_input_priority(active: bool) -> void: + if _fishing_input_priority_active == active: + return + _fishing_input_priority_active = active + fishing_input_priority_changed.emit(active) + + +func is_fishing_input_priority_active() -> bool: + return _fishing_input_priority_active + + func is_returning() -> bool: return state == FishingState.RETURNING +func is_fishing_sequence_active() -> bool: + return state in [ + FishingState.AIMING_CAST, + FishingState.CASTING, + FishingState.WAITING_FOR_BITE, + FishingState.FIGHTING, + FishingState.SHOWING_CATCH, + FishingState.RETURNING, + ] + + func refresh_active_item_status() -> void: if state == FishingState.READY and has_active_fishing_rod(): status_changed.emit("") @@ -782,6 +863,7 @@ func present_external_catch(fish_catch: FishCatchType) -> bool: _showcase_ready = true _showcase_outcome_completed = true _put_away_press_armed = false + _showcase_input_lock_remaining = minimum_showcase_duration _active_player.begin_catch_showcase(fish_catch) showcase_changed.emit( fish_catch.fish.display_name, @@ -911,7 +993,6 @@ func _on_cast_completed() -> void: if _selected_fish == null: _cleanup_attempt("nothing is biting here.", &"invalid") return - _consume_active_bait() state = FishingState.WAITING_FOR_BITE _active_player.set_fishing_visual(true) @@ -938,11 +1019,13 @@ func _on_cast_completed() -> void: status_changed.emit("") -func _consume_active_bait() -> void: +func _consume_active_bait() -> bool: if _active_player == null or _active_player.active_bait_id.is_empty(): - return + return true if _local_bag == null or not _local_bag.remove_item(_active_player.active_bait_id, 1): _active_player.unequip_bait() + return false + return true func roll_bite_wait_time() -> float: @@ -1093,15 +1176,20 @@ func _activate_bite(confirmation_override: bool = false) -> void: _presentation.show_bite() return + _set_fishing_input_priority(true) _set_bite_confirmation_pending(false) - state = FishingState.FIGHTING - _active_player.set_fighting_visual(true) - _state_time_remaining = 0.0 - _withdrawal_input_held = false _pending_catch = _fish_selector.create_catch(_selected_fish) if _pending_catch == null or not _pending_catch.is_valid(): _cancel_attempt() return + if not _consume_active_bait(): + _pending_catch = null + _cleanup_attempt("No bait available.", &"cancel") + return + state = FishingState.FIGHTING + _active_player.set_fighting_visual(true) + _state_time_remaining = 0.0 + _withdrawal_input_held = false _start_fight_audio() bite_activated.emit() status_changed.emit("fish on!") @@ -1114,7 +1202,7 @@ func _activate_bite(confirmation_override: bool = false) -> void: _pending_catch.quality, ) _catch_controller.set_reel_input( - Input.is_action_pressed("fish_primary") + _is_reel_input_pressed() ) _presentation.show_bite() @@ -1199,6 +1287,7 @@ func _on_catch_completed() -> void: _showcase_ready = false _showcase_outcome_completed = false _put_away_press_armed = false + _showcase_input_lock_remaining = 0.0 _catch_controller.reset() _presentation.set_line_mode(FishingPresentationType.LineMode.TAUT) _presentation.play_outcome(&"catch") @@ -1234,6 +1323,7 @@ func _on_outcome_completed(outcome: StringName) -> void: return _showcase_outcome_completed = true _showcase_ready = true + _showcase_input_lock_remaining = minimum_showcase_duration _active_player.begin_catch_showcase(_pending_catch) showcase_changed.emit( _pending_catch.fish.display_name, @@ -1267,6 +1357,7 @@ func _put_away_catch() -> void: _showcase_ready = false _showcase_outcome_completed = false _put_away_press_armed = false + _showcase_input_lock_remaining = 0.0 showcase_changed.emit("", "", 0.0, 0, false) _showcase_restore_generation += 1 var restore_generation: int = _showcase_restore_generation @@ -1294,7 +1385,7 @@ func _store_catch_progression(fish_catch: FishCatchType) -> void: ) ) _local_inventory.add_catch(fish_catch) - _local_collection_log.mark_quality_discovered( + _local_collection_log.record_catch( fish_catch.fish_id, fish_catch.quality, ) @@ -1340,6 +1431,7 @@ func _cleanup_attempt( _showcase_ready = false _showcase_outcome_completed = false _put_away_press_armed = false + _showcase_input_lock_remaining = 0.0 showcase_changed.emit("", "", 0.0, 0, false) _catch_controller.reset() state = FishingState.RETURNING @@ -1361,6 +1453,7 @@ func _finalize_attempt_cleanup( cooldown_message: String, restore_movement: bool = true, ) -> void: + _set_bite_confirmation_pending(false) _showcase_restore_generation += 1 if _active_player != null: _active_player.set_fighting_visual(false) @@ -1389,6 +1482,7 @@ func _finalize_attempt_cleanup( _showcase_ready = false _showcase_outcome_completed = false _put_away_press_armed = false + _showcase_input_lock_remaining = 0.0 showcase_changed.emit("", "", 0.0, 0, false) _catch_controller.reset() _presentation.cleanup() @@ -1404,6 +1498,7 @@ func _finalize_attempt_cleanup( _state_time_remaining = cooldown_duration _cooldown_status = cooldown_message status_changed.emit(_cooldown_status) + _set_fishing_input_priority(false) func _return_to_ready() -> void: @@ -1412,6 +1507,7 @@ func _return_to_ready() -> void: _cooldown_status = "" status_changed.emit("") ready_for_equipment_refresh.emit() + _set_fishing_input_priority(false) func _cancel_attempt() -> void: @@ -1574,6 +1670,7 @@ func _build_fishing_context( if _world_time != null: context.is_night = _world_time.is_night_period() context.is_day_night_transition = _world_time.is_transition() + context.season = _world_time.get_season() if _world_weather != null: context.is_raining = _world_weather.is_raining() context.is_foggy = _world_weather.is_foggy() @@ -1586,6 +1683,47 @@ func build_network_context( return _build_fishing_context(region) +func is_species_available_now(fish: FishDataType) -> bool: + if fish == null or not fish.is_selectable(): + return false + var season := ( + _world_time.get_season() + if _world_time != null + else CalendarSeason.UNKNOWN + ) + if not fish.is_available_in_season(season): + return false + if fish.collection_method != FishDataType.CollectionMethod.FISHING: + return true + for region: FishableWaterRegionType in _get_logbook_water_regions(): + if ( + region == null + or region.fish_pool == null + or region.fish_pool.get_fish_by_id(fish.id) == null + ): + continue + var context := _build_fishing_context(region) + if not fish.is_allowed_in_water(context.water_type): + continue + if fish.availability == null or fish.availability.is_available(context): + return true + return false + + +func _get_logbook_water_regions() -> Array[FishableWaterRegionType]: + var regions: Array[FishableWaterRegionType] = [] + if not _fishable_water_regions_resolver.is_valid(): + return regions + var resolved: Variant = _fishable_water_regions_resolver.call() + if resolved is not Array: + return regions + for value: Variant in resolved: + var region := value as FishableWaterRegionType + if region != null and is_instance_valid(region): + regions.append(region) + return regions + + func _get_active_bait_tags() -> Array[StringName]: if _local_player == null or _item_catalog == null: return [] @@ -1644,7 +1782,7 @@ func _build_network_evidence() -> Dictionary: "bite_multiplier": 1.0, "rarity_multipliers": rarity_multipliers, "discovered_fish_ids": discovered_ids, - "capacity_available": not _is_cooler_full(), + "capacity_available": not _is_inventory_full(), } @@ -1720,12 +1858,13 @@ func _on_network_bite_started(_attempt_id: String) -> void: if state != FishingState.WAITING_FOR_BITE: return _stop_reeling_audio() + _set_fishing_input_priority(true) _set_bite_confirmation_pending(false) state = FishingState.FIGHTING if _active_player != null: _active_player.set_fighting_visual(true) _withdrawal_input_held = false - _network_primary_input_held = Input.is_action_pressed("fish_primary") + _network_primary_input_held = _is_reel_input_pressed() _network_input_resend_elapsed = 0.0 _network_auto_click_accumulator = 0.0 _network_active_barrier_index = -1 @@ -1797,7 +1936,7 @@ func _on_network_fishing_snapshot(snapshot: Dictionary) -> void: func _update_network_auto_click(delta: float) -> void: if ( not _catch_controller.auto_click_enabled - or not Input.is_action_pressed("fish_primary") + or not _is_reel_input_pressed() or _network_active_barrier_index < 0 ): _network_auto_click_accumulator = 0.0 @@ -1824,6 +1963,7 @@ func _on_network_catch_received(fish_catch: FishCatchType) -> void: _showcase_ready = false _showcase_outcome_completed = false _put_away_press_armed = false + _showcase_input_lock_remaining = 0.0 catch_display_changed.emit( 0.0, 0.0, PackedFloat32Array(), PackedInt32Array(), PackedInt32Array(), -1, false diff --git a/fishing/remote_fishing_presentation.gd b/fishing/remote_fishing_presentation.gd index 06224de..380afdf 100644 --- a/fishing/remote_fishing_presentation.gd +++ b/fishing/remote_fishing_presentation.gd @@ -18,6 +18,8 @@ var _showcase_tween: Tween var _return_showcase_catch: FishCatch var _bobber_idle_elapsed: float = 0.0 var _bobber_base_scale: Vector3 = Vector3.ONE +var _attempt_id: String = "" +var _observer_fighting_active: bool = false func setup(owning_player: Player) -> void: @@ -43,7 +45,11 @@ func setup(owning_player: Player) -> void: cleanup() -func show_cast(origin: Vector3, target: Vector3) -> void: +func show_cast( + origin: Vector3, + target: Vector3, + attempt_id: String = "", +) -> void: if ( _owner == null or not origin.is_finite() @@ -52,6 +58,8 @@ func show_cast(origin: Vector3, target: Vector3) -> void: return _kill_cast_tween() _active = true + _attempt_id = attempt_id + _observer_fighting_active = false _bobber_base_scale = Vector3.ONE * _owner.get_character_visual_scale() _target = origin _pending_target = target @@ -86,10 +94,48 @@ func update_bobber(world_position: Vector3) -> void: _redraw_line() +func synchronize_active( + attempt_id: String, + world_position: Vector3, + fighting: bool, +) -> void: + if ( + _owner == null + or attempt_id.is_empty() + or not world_position.is_finite() + ): + return + if _active and not _attempt_id.is_empty() and _attempt_id != attempt_id: + cleanup() + if _attempt_id.is_empty(): + _attempt_id = attempt_id + if not _active: + _active = true + _bobber_base_scale = Vector3.ONE * _owner.get_character_visual_scale() + _target = world_position + _pending_target = world_position + _bobber_idle_elapsed = 0.0 + _bobber.global_position = world_position + _bobber.scale = _bobber_base_scale + _bobber.visible = true + _line.visible = true + _owner.set_active_item_is_rod(true) + _owner.set_fishing_visual(true) + _redraw_line() + else: + update_bobber(world_position) + if fighting != _observer_fighting_active: + _observer_fighting_active = fighting + _owner.set_fighting_visual(fighting) + if not fighting: + _owner.set_fishing_visual(true) + + func show_bite() -> void: if not _active: return if _owner != null and is_instance_valid(_owner): + _observer_fighting_active = true _owner.set_fighting_visual(true) var tween: Tween = create_tween() tween.tween_property(_bobber, "scale", _bobber_base_scale * 0.7, 0.08) @@ -131,6 +177,8 @@ func cleanup() -> void: _kill_return_tween() _kill_showcase_tween() _active = false + _attempt_id = "" + _observer_fighting_active = false _pending_target = Vector3.ZERO _return_showcase_catch = null _bobber_idle_elapsed = 0.0 diff --git a/gathering/catalog/beetle_stag_common.tres b/gathering/catalog/beetle_stag_common.tres new file mode 100644 index 0000000..c8b7d85 --- /dev/null +++ b/gathering/catalog/beetle_stag_common.tres @@ -0,0 +1,28 @@ +[gd_resource type="Resource" script_class="GatherableData" load_steps=3 format=3] + +[ext_resource type="Script" path="res://gathering/gatherable_data.gd" id="1_data"] +[ext_resource type="Resource" path="res://fish/species/beetle_stag_common/beetle_stag_common.tres" id="2_catch"] + +[resource] +script = ExtResource("1_data") +type_id = &"beetle_stag_common" +catch_data = ExtResource("2_catch") +required_tool_id = &"crab_net" +spawn_anchor_set_id = &"starter_reachable_tree_trunks" +population = 3 +spawn_anchor_occupancy_ratio = 0.35 +maximum_anchor_population = 64 +requires_sneaking = false +movement_speed = 0.0 +roam_radius = 0.1 +scare_radius = 0.1 +capture_radius = 0.34 +interaction_range = 2.8 +charge_duration = 1.0 +sprite_pixel_size = 0.0075 +sprite_tilt_degrees = 0.0 +capture_respawn_min_seconds = 90.0 +capture_respawn_max_seconds = 150.0 +scare_respawn_min_seconds = 0.0 +scare_respawn_max_seconds = 0.0 +minimum_respawn_spacing_seconds = 30.0 diff --git a/gathering/catalog/clam_manila.tres b/gathering/catalog/clam_manila.tres new file mode 100644 index 0000000..69a9c89 --- /dev/null +++ b/gathering/catalog/clam_manila.tres @@ -0,0 +1,27 @@ +[gd_resource type="Resource" script_class="GatherableData" load_steps=3 format=3] + +[ext_resource type="Script" path="res://gathering/gatherable_data.gd" id="1_data"] +[ext_resource type="Resource" path="res://fish/species/clam_manila/clam_manila.tres" id="2_catch"] + +[resource] +script = ExtResource("1_data") +type_id = &"clam_manila" +catch_data = ExtResource("2_catch") +required_tool_id = &"standard_shovel" +diggable_area_id = &"starter_beach" +minimum_surface_y = -0.44 +population = 3 +presentation_mode = 1 +requires_sneaking = false +active_lifetime_seconds = 10.0 +movement_speed = 0.0 +roam_radius = 0.1 +scare_radius = 0.1 +capture_radius = 0.38 +interaction_range = 2.4 +charge_duration = 0.55 +capture_respawn_min_seconds = 8.0 +capture_respawn_max_seconds = 14.0 +scare_respawn_min_seconds = 0.0 +scare_respawn_max_seconds = 0.0 +minimum_respawn_spacing_seconds = 4.0 diff --git a/gathering/catalog/crab_blue.tres b/gathering/catalog/crab_blue.tres index 9e02a04..1ccabe8 100644 --- a/gathering/catalog/crab_blue.tres +++ b/gathering/catalog/crab_blue.tres @@ -11,3 +11,4 @@ required_tool_id = &"crab_net" surface_materials = Array[StringName]([&"sand"]) minimum_surface_y = -0.8 population = 4 +sprite_pixel_size = 0.0005 diff --git a/gathering/catalog/crab_brown.tres b/gathering/catalog/crab_brown.tres index 13ac341..83d20c8 100644 --- a/gathering/catalog/crab_brown.tres +++ b/gathering/catalog/crab_brown.tres @@ -9,7 +9,7 @@ type_id = &"crab_brown" catch_data = ExtResource("2_catch") required_tool_id = &"crab_net" surface_materials = Array[StringName]([&"sand"]) -minimum_surface_y = 0.08 +minimum_surface_y = -0.44 population = 2 movement_speed = 0.35 roam_radius = 3.5 @@ -17,7 +17,7 @@ scare_radius = 2.8 capture_radius = 0.7 interaction_range = 2.6 charge_duration = 2.0 -sprite_pixel_size = 0.001 +sprite_pixel_size = 0.0005 sprite_tilt_degrees = -45.0 capture_respawn_min_seconds = 480.0 capture_respawn_max_seconds = 720.0 diff --git a/gathering/catalog/crab_dungeness.tres b/gathering/catalog/crab_dungeness.tres index e4af78f..12eb7a6 100644 --- a/gathering/catalog/crab_dungeness.tres +++ b/gathering/catalog/crab_dungeness.tres @@ -11,3 +11,4 @@ required_tool_id = &"crab_net" surface_materials = Array[StringName]([&"sand"]) minimum_surface_y = -0.5 population = 4 +sprite_pixel_size = 0.0005 diff --git a/gathering/catalog/crab_ghost.tres b/gathering/catalog/crab_ghost.tres index 557419e..62ce103 100644 --- a/gathering/catalog/crab_ghost.tres +++ b/gathering/catalog/crab_ghost.tres @@ -11,3 +11,4 @@ required_tool_id = &"crab_net" surface_materials = Array[StringName]([&"sand"]) minimum_surface_y = 0.08 population = 4 +sprite_pixel_size = 0.0005 diff --git a/gathering/catalog/gatherable_catalog.tres b/gathering/catalog/gatherable_catalog.tres index 90131fc..4ea1ff4 100644 --- a/gathering/catalog/gatherable_catalog.tres +++ b/gathering/catalog/gatherable_catalog.tres @@ -1,11 +1,13 @@ -[gd_resource type="Resource" script_class="GatherableCatalog" load_steps=6 format=3] +[gd_resource type="Resource" script_class="GatherableCatalog" load_steps=8 format=3] [ext_resource type="Script" path="res://gathering/gatherable_catalog.gd" id="1_catalog"] [ext_resource type="Resource" path="res://gathering/catalog/crab_brown.tres" id="2_brown"] [ext_resource type="Resource" path="res://gathering/catalog/crab_ghost.tres" id="3_ghost"] [ext_resource type="Resource" path="res://gathering/catalog/crab_blue.tres" id="4_blue"] [ext_resource type="Resource" path="res://gathering/catalog/crab_dungeness.tres" id="5_dungeness"] +[ext_resource type="Resource" path="res://gathering/catalog/clam_manila.tres" id="6_clam"] +[ext_resource type="Resource" path="res://gathering/catalog/beetle_stag_common.tres" id="7_beetle"] [resource] script = ExtResource("1_catalog") -entries = [ExtResource("2_brown"), ExtResource("3_ghost"), ExtResource("4_blue"), ExtResource("5_dungeness")] +entries = [ExtResource("2_brown"), ExtResource("3_ghost"), ExtResource("4_blue"), ExtResource("5_dungeness"), ExtResource("6_clam"), ExtResource("7_beetle")] diff --git a/gathering/gatherable_catalog.gd b/gathering/gatherable_catalog.gd index d71b65f..3fbb06a 100644 --- a/gathering/gatherable_catalog.gd +++ b/gathering/gatherable_catalog.gd @@ -2,6 +2,7 @@ class_name GatherableCatalog extends Resource const GatherableDataType = preload("res://gathering/gatherable_data.gd") +const CalendarSeasonType = preload("res://world/calendar_season.gd") @export var entries: Array[GatherableDataType] = [] @@ -15,9 +16,11 @@ func get_entry(type_id: StringName) -> GatherableDataType: return null -func get_available_entries() -> Array[GatherableDataType]: +func get_available_entries( + season: int = CalendarSeasonType.UNKNOWN, +) -> Array[GatherableDataType]: var available: Array[GatherableDataType] = [] for entry: GatherableDataType in entries: - if entry != null and entry.is_available(): + if entry != null and entry.is_available(season): available.append(entry) return available diff --git a/gathering/gatherable_data.gd b/gathering/gatherable_data.gd index c5164d0..d60dcc9 100644 --- a/gathering/gatherable_data.gd +++ b/gathering/gatherable_data.gd @@ -3,13 +3,29 @@ extends Resource const FishDataType = preload("res://fish/fish_data.gd") const FishQualityType = preload("res://fish/fish_quality.gd") +const CalendarSeasonType = preload("res://world/calendar_season.gd") + +enum PresentationMode { + VISIBLE_CREATURE, + WATER_SPURT, +} @export var type_id: StringName @export var catch_data: FishDataType @export var required_tool_id: StringName @export var surface_materials: Array[StringName] = [] +@export var diggable_area_id: StringName +@export var spawn_anchor_set_id: StringName @export_range(-100.0, 100.0, 0.01) var minimum_surface_y: float = 0.08 @export_range(0, 64, 1) var population: int = 0 +## Anchored gatherables can scale with authored/generated attachment geometry. +## Zero preserves the fixed population above. +@export_range(0.0, 1.0, 0.01) var spawn_anchor_occupancy_ratio := 0.0 +## Zero leaves the anchor count as the only ceiling. +@export_range(0, 256, 1) var maximum_anchor_population := 0 +@export var presentation_mode: PresentationMode = PresentationMode.VISIBLE_CREATURE +@export var requires_sneaking: bool = true +@export_range(0.0, 120.0, 0.1) var active_lifetime_seconds: float = 0.0 @export_range(0.0, 10.0, 0.05) var movement_speed: float = 0.35 @export_range(0.1, 20.0, 0.1) var roam_radius: float = 3.5 @export_range(0.1, 20.0, 0.1) var scare_radius: float = 2.8 @@ -30,7 +46,7 @@ const FishQualityType = preload("res://fish/fish_quality.gd") @export_range(0.1, 5.0, 0.05) var capture_radius: float = 0.7 @export_range(0.1, 10.0, 0.05) var interaction_range: float = 2.6 @export_range(0.1, 10.0, 0.05) var charge_duration: float = 2.0 -@export_range(0.1, 5.0, 0.01) var sprite_pixel_size: float = 0.001 +@export_range(0.0001, 0.01, 0.00005) var sprite_pixel_size: float = 0.001 @export_range(-90.0, 90.0, 1.0) var sprite_tilt_degrees: float = -45.0 @export_category("Respawn Budget") @export_range(0.0, 3600.0, 1.0) var capture_respawn_min_seconds: float = 480.0 @@ -41,17 +57,37 @@ const FishQualityType = preload("res://fish/fish_quality.gd") func is_valid() -> bool: + var uses_diggable_area: bool = not diggable_area_id.is_empty() + var uses_spawn_anchors: bool = not spawn_anchor_set_id.is_empty() + var movement_parameters_valid: bool = ( + movement_speed >= 0.0 + and ( + presentation_mode == PresentationMode.WATER_SPURT + or (roam_radius > 0.0 and scare_radius > 0.0) + ) + ) return ( not type_id.is_empty() and catch_data != null and catch_data.is_valid_catalog_entry() and catch_data.collection_method != FishDataType.CollectionMethod.FISHING and not required_tool_id.is_empty() - and not surface_materials.is_empty() + and ( + uses_diggable_area + or uses_spawn_anchors + or not surface_materials.is_empty() + ) + and ( + not uses_diggable_area + or catch_data.collection_method + == FishDataType.CollectionMethod.DIGGING + ) and population > 0 - and movement_speed >= 0.0 - and roam_radius > 0.0 - and scare_radius > 0.0 + and ( + maximum_anchor_population == 0 + or maximum_anchor_population >= population + ) + and movement_parameters_valid and _quality_multipliers_are_valid( quality_movement_speed_multipliers ) @@ -67,6 +103,33 @@ func is_valid() -> bool: ) +func is_stationary_hotspot() -> bool: + return presentation_mode == PresentationMode.WATER_SPURT + + +func is_stationary_spawn() -> bool: + return is_stationary_hotspot() or not spawn_anchor_set_id.is_empty() + + +func target_population_for_anchor_count(anchor_count: int) -> int: + if spawn_anchor_set_id.is_empty() or spawn_anchor_occupancy_ratio <= 0.0: + return population + if anchor_count <= 0: + return 0 + var target := maxi( + population, + ceili(float(anchor_count) * spawn_anchor_occupancy_ratio), + ) + target = mini(target, anchor_count) + if maximum_anchor_population > 0: + target = mini(target, maximum_anchor_population) + return target + + +func can_be_scared() -> bool: + return not is_stationary_spawn() and scare_radius > 0.0 + + func get_movement_speed_for_quality(quality: int) -> float: return movement_speed * _quality_multiplier( quality_movement_speed_multipliers, @@ -92,8 +155,13 @@ func get_respawn_delay(reason: StringName, rng: RandomNumberGenerator) -> float: return rng.randf_range(minimum_seconds, maximum_seconds) -func is_available() -> bool: - return catch_data != null and catch_data.active and is_valid() +func is_available(season: int = CalendarSeasonType.UNKNOWN) -> bool: + return ( + catch_data != null + and catch_data.active + and catch_data.is_available_in_season(season) + and is_valid() + ) func _quality_multiplier(values: Array[float], quality: int) -> float: diff --git a/gathering/gathering_controller.gd b/gathering/gathering_controller.gd index 1a7649e..c061db5 100644 --- a/gathering/gathering_controller.gd +++ b/gathering/gathering_controller.gd @@ -6,11 +6,16 @@ const FishingSpotType = preload("res://fishing/fishing_spot.gd") const NetworkWorldSpawnServiceType = preload( "res://network/network_world_spawn_service.gd" ) +const MARKER_INVALID_COLOR := Color(1.0, 1.0, 1.0, 1.0) +const MARKER_VALID_COLOR := Color(0.25, 0.9, 0.36, 1.0) +const MARKER_DISC_THICKNESS := 0.006 signal status_changed(message: String) -@export_range(0.5, 5.0, 0.05) var marker_distance: float = 1.7 -@export_range(0.1, 2.0, 0.05) var marker_radius: float = 0.7 +@export_range(0.5, 5.0, 0.05) var marker_distance: float = 0.85 +@export_range(0.025, 2.0, 0.025) var marker_radius: float = 0.175 +@export_range(0.0, 1.0, 0.01) var marker_surface_offset: float = 0.045 +@export_range(0.0, 2.0, 0.05) var forward_probe_extra_distance: float = 0.6 @export_flags_3d_physics var terrain_collision_mask: int = 1 @export_range(0.5, 20.0, 0.5) var ray_height: float = 5.0 @export_range(0.5, 20.0, 0.5) var ray_depth: float = 8.0 @@ -30,6 +35,7 @@ var _charging: bool = false var _charge_elapsed: float = 0.0 var _charge_duration: float = 2.0 var _request_id: String = "" +var _active_tool_id: StringName var _gameplay_input_enabled: bool = false @@ -71,15 +77,40 @@ func is_net_selected() -> bool: ) +func is_shovel_selected() -> bool: + return _is_owned_tool_selected(FishingShopStockType.STANDARD_SHOVEL_ID) + + +func _is_owned_tool_selected(tool_id: StringName) -> bool: + return ( + _bag != null + and _hotbar != null + and _hotbar.get_selected_item_id() == tool_id + and _bag.owns_item(tool_id) + ) + + +func _get_selected_gathering_tool_id() -> StringName: + if is_net_selected(): + return FishingShopStockType.CRAB_NET_ID + if is_shovel_selected(): + return FishingShopStockType.STANDARD_SHOVEL_ID + return StringName() + + func _process(delta: float) -> void: + var selected_tool_id := _get_selected_gathering_tool_id() var input_available: bool = ( _gameplay_input_enabled - and is_net_selected() + and not selected_tool_id.is_empty() and _player != null and _player.is_local_control_enabled() and _fishing_spot != null and _fishing_spot.can_change_hotbar_selection() ) + if _charging and selected_tool_id != _active_tool_id: + _cancel_charge() + input_available = false if not input_available: if _charging: _cancel_charge() @@ -100,7 +131,11 @@ func _process(delta: float) -> void: var valid_target: bool = ( fully_charged and not _target_entity_id.is_empty() - and _player.is_sneaking() + and ( + target_entry == null + or not target_entry.requires_sneaking + or _player.is_sneaking() + ) ) _marker.material_override = ( _marker_valid_material if valid_target else _marker_invalid_material @@ -112,10 +147,17 @@ func _unhandled_input(event: InputEvent) -> void: if not event.is_action("fish_primary"): return if event.is_pressed(): + if ( + _gameplay_input_enabled + and _player != null + and _player.release_net_strike_hold() + ): + get_viewport().set_input_as_handled() + return if ( _charging or not _gameplay_input_enabled - or not is_net_selected() + or _get_selected_gathering_tool_id().is_empty() or _fishing_spot == null or not _fishing_spot.can_change_hotbar_selection() ): @@ -124,26 +166,37 @@ func _unhandled_input(event: InputEvent) -> void: if _request_id.is_empty(): return _charging = true + _active_tool_id = _get_selected_gathering_tool_id() _charge_elapsed = 0.0 _charge_duration = maxf( _service.get_charge_duration_for_tool( - FishingShopStockType.CRAB_NET_ID + _active_tool_id ), 0.1, ) _update_marker_target() _update_target_entity() + _player.begin_net_draw_visual() get_viewport().set_input_as_handled() return if not _charging: return var fully_charged: bool = _charge_elapsed >= _charge_duration - if ( + var target_entry: GatherableData = _service.get_entry_for_entity( + _target_entity_id + ) + var valid_capture: bool = ( fully_charged and _marker_has_surface and not _target_entity_id.is_empty() - and _player.is_sneaking() - ): + and ( + target_entry == null + or not target_entry.requires_sneaking + or _player.is_sneaking() + ) + ) + _player.play_net_strike_visual() + if valid_capture: _service.finish_local_interaction( _request_id, _target_entity_id, @@ -151,6 +204,7 @@ func _unhandled_input(event: InputEvent) -> void: ) else: _service.cancel_local_interaction(_request_id) + _player.resolve_net_strike_visual(false) _reset_charge_state() get_viewport().set_input_as_handled() @@ -167,30 +221,89 @@ func _update_marker_target() -> void: if facing.is_zero_approx(): return facing = facing.normalized() + var probe_origin: Vector3 = _player.get_body_center_position() + var probe_direction: Vector3 = _get_surface_probe_direction(facing) + var forward_hit: Dictionary = _cast_marker_ray( + probe_origin, + probe_origin + + probe_direction + * (marker_distance + forward_probe_extra_distance), + ) + if _apply_marker_surface(forward_hit, facing): + return var query_center: Vector3 = _player.global_position + facing * marker_distance - var query := PhysicsRayQueryParameters3D.create( + var ground_hit: Dictionary = _cast_marker_ray( query_center + Vector3.UP * ray_height, query_center - Vector3.UP * ray_depth, + ) + _apply_marker_surface(ground_hit, facing) + + +func _get_surface_probe_direction(facing: Vector3) -> Vector3: + var vertical_aim: float = 0.0 + var camera := _player.get_active_gameplay_camera() + if camera != null: + vertical_aim = clampf((-camera.global_basis.z).y, -0.75, 0.75) + return Vector3(facing.x, vertical_aim, facing.z).normalized() + + +func _cast_marker_ray(from: Vector3, to: Vector3) -> Dictionary: + var query := PhysicsRayQueryParameters3D.create( + from, + to, terrain_collision_mask, + [_player.get_rid()], ) query.collide_with_areas = false query.collide_with_bodies = true - var hit: Dictionary = get_world_3d().direct_space_state.intersect_ray(query) + return get_world_3d().direct_space_state.intersect_ray(query) + + +func _apply_marker_surface(hit: Dictionary, facing: Vector3) -> bool: if hit.is_empty(): - return + return false var position: Variant = hit.get("position") - if typeof(position) != TYPE_VECTOR3: - return - _marker_position = (position as Vector3) + Vector3.UP * 0.045 + var normal_value: Variant = hit.get("normal") + if ( + typeof(position) != TYPE_VECTOR3 + or typeof(normal_value) != TYPE_VECTOR3 + ): + return false + var surface_normal := normal_value as Vector3 + if not surface_normal.is_finite() or surface_normal.is_zero_approx(): + return false + surface_normal = surface_normal.normalized() + _marker_position = ( + (position as Vector3) + surface_normal * marker_surface_offset + ) _marker.global_position = _marker_position + _marker.global_basis = marker_basis_for_surface(surface_normal, facing) _marker_has_surface = true + return true + + +static func marker_basis_for_surface( + surface_normal: Vector3, + facing: Vector3, +) -> Basis: + var normal := surface_normal.normalized() + var reference := Vector3.UP + if absf(normal.dot(Vector3.UP)) > 0.95: + reference = facing.normalized() + if reference.is_zero_approx() or absf(normal.dot(reference)) > 0.95: + reference = Vector3.FORWARD + var x_axis := reference.cross(normal).normalized() + if x_axis.is_zero_approx(): + x_axis = Vector3.RIGHT + var z_axis := x_axis.cross(normal).normalized() + return Basis(x_axis, normal, z_axis).orthonormalized() func _update_target_entity() -> void: _target_entity_id = ( _service.find_capture_target( _marker_position, - FishingShopStockType.CRAB_NET_ID, + _active_tool_id, ) if _marker_has_surface and _service != null else "" @@ -200,6 +313,8 @@ func _update_target_entity() -> void: func _cancel_charge() -> void: if _charging and not _request_id.is_empty() and _service != null: _service.cancel_local_interaction(_request_id) + if _charging and _player != null: + _player.cancel_net_action_visual() _reset_charge_state() @@ -207,12 +322,15 @@ func _reset_charge_state() -> void: _charging = false _charge_elapsed = 0.0 _request_id = "" + _active_tool_id = StringName() _target_entity_id = "" _marker_has_surface = false _set_marker_visible(false) func _on_interaction_finished(accepted: bool, message: String) -> void: + if _player != null: + _player.resolve_net_strike_visual(accepted) _reset_charge_state() if not accepted or not message.is_empty(): status_changed.emit(message) @@ -220,19 +338,24 @@ func _on_interaction_finished(accepted: bool, message: String) -> void: func _build_marker() -> void: _marker_invalid_material = StandardMaterial3D.new() - _marker_invalid_material.albedo_color = Color(0.86, 0.24, 0.19, 0.9) + _marker_invalid_material.albedo_color = MARKER_INVALID_COLOR _marker_invalid_material.shading_mode = BaseMaterial3D.SHADING_MODE_UNSHADED + _marker_invalid_material.roughness = 1.0 + _marker_invalid_material.no_depth_test = true _marker_valid_material = StandardMaterial3D.new() - _marker_valid_material.albedo_color = Color(0.25, 0.9, 0.36, 0.95) + _marker_valid_material.albedo_color = MARKER_VALID_COLOR _marker_valid_material.shading_mode = BaseMaterial3D.SHADING_MODE_UNSHADED - var ring := TorusMesh.new() - ring.inner_radius = marker_radius * 0.78 - ring.outer_radius = marker_radius - ring.rings = 16 - ring.ring_segments = 24 + _marker_valid_material.roughness = 1.0 + _marker_valid_material.no_depth_test = true + var disc := CylinderMesh.new() + disc.top_radius = marker_radius + disc.bottom_radius = marker_radius + disc.height = MARKER_DISC_THICKNESS + disc.radial_segments = 32 + disc.rings = 1 _marker = MeshInstance3D.new() _marker.name = "GatheringTargetMarker" - _marker.mesh = ring + _marker.mesh = disc _marker.material_override = _marker_invalid_material _marker.cast_shadow = GeometryInstance3D.SHADOW_CASTING_SETTING_OFF _marker.visible = false diff --git a/gathering/world_gatherable.gd b/gathering/world_gatherable.gd index 1dccc7a..1a71477 100644 --- a/gathering/world_gatherable.gd +++ b/gathering/world_gatherable.gd @@ -2,11 +2,18 @@ class_name WorldGatherable extends Node3D const GatherableDataType = preload("res://gathering/gatherable_data.gd") +const REFERENCE_SPRITE_PIXEL_SIZE: float = 0.001 +const REFERENCE_SPRITE_HEIGHT: float = 0.22 +const WATER_SPURT_INTERVAL_SECONDS: float = 1.15 +const WATER_SPURT_COLOR := Color(0.48, 0.82, 0.84, 1.0) +const WATER_SPURT_HOLE_COLOR := Color(0.23, 0.27, 0.24, 1.0) var entity_id: String = "" var type_id: StringName var data: GatherableDataType var _sprite: Sprite3D +var _water_spurt_root: Node3D +var _water_spurt_elapsed: float = 0.0 var _target_position: Vector3 var _target_yaw: float = 0.0 var _has_state: bool = false @@ -22,12 +29,31 @@ func configure( entity_id = configured_entity_id data = configured_data type_id = data.type_id if data != null else StringName() - _ensure_visual() - if data != null and data.catch_data != null: + # Establish the authoritative transform before constructing transient visuals. + # Effects emitted before this point would begin at the default world origin. + apply_network_state(position, yaw, true) + if data != null and data.is_stationary_hotspot(): + _ensure_water_spurt_visual() + _water_spurt_elapsed = ( + float(abs(hash(entity_id)) % 1000) / 1000.0 + * WATER_SPURT_INTERVAL_SECONDS + ) + _emit_water_spurt() + else: + _ensure_visual() + if data != null and data.catch_data != null and _sprite != null: _sprite.texture = data.catch_data.display_texture _sprite.pixel_size = data.sprite_pixel_size + _sprite.position.y = ( + 0.0 + if not data.spawn_anchor_set_id.is_empty() + else ( + REFERENCE_SPRITE_HEIGHT + * data.sprite_pixel_size + / REFERENCE_SPRITE_PIXEL_SIZE + ) + ) _sprite.rotation_degrees.x = data.sprite_tilt_degrees - apply_network_state(position, yaw, true) func apply_network_state( @@ -51,6 +77,10 @@ func play_despawn(with_dust: bool) -> void: _despawning = true if with_dust: _emit_dust() + if _water_spurt_root != null: + _water_spurt_root.visible = false + queue_free() + return var tween: Tween = create_tween() tween.set_parallel(true) tween.set_trans(Tween.TRANS_QUAD) @@ -73,6 +103,14 @@ func _process(delta: float) -> void: _target_yaw, 1.0 - exp(-8.0 * delta), ) + if _water_spurt_root != null: + _water_spurt_elapsed += delta + if _water_spurt_elapsed >= WATER_SPURT_INTERVAL_SECONDS: + _water_spurt_elapsed = fmod( + _water_spurt_elapsed, + WATER_SPURT_INTERVAL_SECONDS, + ) + _emit_water_spurt() func _ensure_visual() -> void: @@ -80,13 +118,74 @@ func _ensure_visual() -> void: return _sprite = Sprite3D.new() _sprite.name = "GatherableSprite" - _sprite.position.y = 0.22 + _sprite.position.y = REFERENCE_SPRITE_HEIGHT _sprite.shaded = false _sprite.double_sided = true + _sprite.billboard = BaseMaterial3D.BILLBOARD_ENABLED _sprite.texture_filter = BaseMaterial3D.TEXTURE_FILTER_NEAREST add_child(_sprite) +func _ensure_water_spurt_visual() -> void: + if _water_spurt_root != null: + return + _water_spurt_root = Node3D.new() + _water_spurt_root.name = "WaterSpurt" + add_child(_water_spurt_root) + var hole_material := StandardMaterial3D.new() + hole_material.albedo_color = WATER_SPURT_HOLE_COLOR + hole_material.shading_mode = BaseMaterial3D.SHADING_MODE_UNSHADED + hole_material.roughness = 1.0 + hole_material.metallic = 0.0 + var hole_mesh := CylinderMesh.new() + hole_mesh.top_radius = 0.035 + hole_mesh.bottom_radius = 0.035 + hole_mesh.height = 0.004 + hole_mesh.radial_segments = 12 + hole_mesh.rings = 1 + hole_mesh.material = hole_material + var hole := MeshInstance3D.new() + hole.name = "BurrowMark" + hole.position.y = 0.008 + hole.mesh = hole_mesh + hole.cast_shadow = GeometryInstance3D.SHADOW_CASTING_SETTING_OFF + _water_spurt_root.add_child(hole) + + +func _emit_water_spurt() -> void: + if _water_spurt_root == null or not _water_spurt_root.visible: + return + var particles := CPUParticles3D.new() + particles.name = "WaterDroplets" + particles.position.y = 0.035 + particles.amount = 6 + particles.lifetime = 0.42 + particles.one_shot = true + particles.local_coords = true + particles.explosiveness = 1.0 + particles.direction = Vector3.UP + particles.spread = 32.0 + particles.gravity = Vector3(0.0, -3.4, 0.0) + particles.initial_velocity_min = 0.8 + particles.initial_velocity_max = 1.2 + particles.scale_amount_min = 0.75 + particles.scale_amount_max = 1.0 + var water_material := StandardMaterial3D.new() + water_material.albedo_color = WATER_SPURT_COLOR + water_material.shading_mode = BaseMaterial3D.SHADING_MODE_UNSHADED + water_material.roughness = 1.0 + water_material.metallic = 0.0 + var droplet_mesh := BoxMesh.new() + droplet_mesh.size = Vector3(0.022, 0.035, 0.022) + droplet_mesh.material = water_material + particles.mesh = droplet_mesh + _water_spurt_root.add_child(particles) + particles.emitting = true + var cleanup := create_tween() + cleanup.tween_interval(0.55) + cleanup.tween_callback(particles.queue_free) + + func _emit_dust() -> void: var particles := CPUParticles3D.new() particles.name = "DustPoof" diff --git a/homes/assets/starter_motorcoach.glb b/homes/assets/starter_motorcoach.glb new file mode 100644 index 0000000..5b0d022 Binary files /dev/null and b/homes/assets/starter_motorcoach.glb differ diff --git a/homes/assets/starter_motorcoach.glb.import b/homes/assets/starter_motorcoach.glb.import new file mode 100644 index 0000000..5cba35b --- /dev/null +++ b/homes/assets/starter_motorcoach.glb.import @@ -0,0 +1,45 @@ +[remap] + +importer="scene" +importer_version=1 +type="PackedScene" +uid="uid://bhph22caipcj6" +path="res://.godot/imported/starter_motorcoach.glb-153681ef1e622a556fba4df576dc6f84.scn" + +[deps] + +source_file="res://homes/assets/starter_motorcoach.glb" +dest_files=["res://.godot/imported/starter_motorcoach.glb-153681ef1e622a556fba4df576dc6f84.scn"] + +[params] + +nodes/root_type="" +nodes/root_name="" +nodes/root_script=null +mesh_library/use_node_names_as_mesh_names=false +array_mesh/deduplicate_surfaces=true +nodes/apply_root_scale=true +nodes/root_scale=1.0 +nodes/import_as_skeleton_bones=false +nodes/use_name_suffixes=true +nodes/use_node_type_suffixes=true +meshes/ensure_tangents=true +meshes/generate_lods=true +meshes/create_shadow_meshes=true +meshes/light_baking=1 +meshes/lightmap_texel_size=0.2 +meshes/force_disable_compression=false +skins/use_named_skins=true +animation/import=true +animation/fps=30 +animation/trimming=false +animation/remove_immutable_tracks=true +animation/import_rest_as_RESET=false +import_script/path="" +materials/extract=0 +materials/extract_format=0 +materials/extract_path="" +_subresources={} +gltf/naming_version=2 +gltf/embedded_image_handling=1 +gltf/texture_map_mode=1 diff --git a/homes/decor_catalog.gd b/homes/decor_catalog.gd new file mode 100644 index 0000000..14e5e29 --- /dev/null +++ b/homes/decor_catalog.gd @@ -0,0 +1,59 @@ +class_name DecorCatalog +extends RefCounted + +const BASIC_CUBE_ID: StringName = &"basic_cube" +const MAX_OWNED_PER_PRODUCT: int = 32 + +const _PRODUCTS: Dictionary = { + BASIC_CUBE_ID: { + "display_name": "basic cube", + "description": "a simple piece of decor for testing your RV layout.", + "price": 1, + "footprint": Vector2(1.0, 0.8), + "height": 0.8, + }, +} + + +static func get_product_ids() -> Array[StringName]: + var ids: Array[StringName] = [] + for value: Variant in _PRODUCTS.keys(): + ids.append(StringName(str(value))) + ids.sort_custom(func(first: StringName, second: StringName) -> bool: + return String(first) < String(second) + ) + return ids + + +static func has_product(product_id: StringName) -> bool: + return _PRODUCTS.has(product_id) + + +static func get_product(product_id: StringName) -> Dictionary: + var value: Variant = _PRODUCTS.get(product_id) + return ( + (value as Dictionary).duplicate(true) + if typeof(value) == TYPE_DICTIONARY + else {} + ) + + +static func get_display_name(product_id: StringName) -> String: + return str(get_product(product_id).get("display_name", product_id)) + + +static func get_description(product_id: StringName) -> String: + return str(get_product(product_id).get("description", "")) + + +static func get_price(product_id: StringName) -> int: + return int(get_product(product_id).get("price", -1)) + + +static func get_footprint(product_id: StringName) -> Vector2: + var value: Variant = get_product(product_id).get("footprint", Vector2.ZERO) + return value as Vector2 if value is Vector2 else Vector2.ZERO + + +static func get_height(product_id: StringName) -> float: + return float(get_product(product_id).get("height", 0.0)) diff --git a/homes/decor_catalog.gd.uid b/homes/decor_catalog.gd.uid new file mode 100644 index 0000000..10d2530 --- /dev/null +++ b/homes/decor_catalog.gd.uid @@ -0,0 +1 @@ +uid://bvgwmexas2gps diff --git a/homes/home_decor_controller.gd b/homes/home_decor_controller.gd new file mode 100644 index 0000000..8f9aa5f --- /dev/null +++ b/homes/home_decor_controller.gd @@ -0,0 +1,499 @@ +class_name HomeDecorController +extends Node + +const DecorCatalogType = preload("res://homes/decor_catalog.gd") +const DRAG_RESPONSE: float = 22.0 +const DRAG_POSITION_EPSILON: float = 0.005 + +var _player: Player +var _hotbar: PlayerHotbar +var _bag: PlayerBag +var _home_state: PlayerHomeState +var _network_home: NetworkHomeService +var _home_world: HomeWorldService +var _fishing_spot: FishingSpot +var _toolbar: HomeDecorToolbar +var _mode: PlayerHomeState.PlacementMode = PlayerHomeState.PlacementMode.GRID +var _selected_instance_id: String = "" +var _drag_instance_id: String = "" +var _drag_owner_fingerprint: String = "" +var _drag_pointer_offset: Vector3 = Vector3.ZERO +var _drag_original_position: Vector3 = Vector3.ZERO +var _drag_original_yaw: float = 0.0 +var _drag_target_position: Vector3 = Vector3.ZERO +var _drag_target_yaw: float = 0.0 +var _drag_target_valid: bool = false + + +func setup( + player: Player, + hotbar: PlayerHotbar, + bag: PlayerBag, + home_state: PlayerHomeState, + network_home: NetworkHomeService, + home_world: HomeWorldService, + fishing_spot: FishingSpot, + toolbar: HomeDecorToolbar, +) -> void: + _player = player + _hotbar = hotbar + _bag = bag + _home_state = home_state + _network_home = network_home + _home_world = home_world + _fishing_spot = fishing_spot + _toolbar = toolbar + if not _network_home.local_space_changed.is_connected( + _on_local_space_changed + ): + _network_home.local_space_changed.connect(_on_local_space_changed) + if not _network_home.local_manifest_rejected.is_connected( + _on_local_manifest_rejected + ): + _network_home.local_manifest_rejected.connect( + _on_local_manifest_rejected + ) + if not _home_state.changed.is_connected(_on_home_changed): + _home_state.changed.connect(_on_home_changed) + if not _toolbar.placement_mode_requested.is_connected( + _on_placement_mode_requested + ): + _toolbar.placement_mode_requested.connect( + _on_placement_mode_requested + ) + _toolbar.rotate_requested.connect(_rotate_selected) + _toolbar.store_requested.connect(_store_selected) + _toolbar.cancel_requested.connect(_clear_selection) + _toolbar.set_mode(_mode) + _refresh_toolbar() + + +func begin_decorating() -> void: + _refresh_toolbar() + if _toolbar.visible: + _toolbar.report_status( + "use held decor to place it; click or drag placed decor" + ) + + +func _input(event: InputEvent) -> void: + if _drag_instance_id.is_empty(): + return + var pointer_motion := event as InputEventMouseMotion + if pointer_motion != null: + _update_drag(pointer_motion.position) + get_viewport().set_input_as_handled() + return + var pointer_button := event as InputEventMouseButton + if ( + pointer_button != null + and pointer_button.button_index == MOUSE_BUTTON_LEFT + and not pointer_button.pressed + ): + # A gameplay menu can take ownership between the press and release. Do + # not let that release finalize decor behind the menu; preserve the + # original transform instead. + if _can_decorate(): + _finish_drag() + else: + _cancel_drag() + get_viewport().set_input_as_handled() + + +func _unhandled_input(event: InputEvent) -> void: + var pointer_button := event as InputEventMouseButton + if ( + pointer_button != null + and pointer_button.button_index == MOUSE_BUTTON_LEFT + ): + if not pointer_button.pressed or not _can_decorate(): + return + if _begin_drag(pointer_button.position): + get_viewport().set_input_as_handled() + return + var pointer_decor_id: StringName = _get_selected_decor_id() + if ( + not pointer_decor_id.is_empty() + and _bag.get_quantity(pointer_decor_id) > 0 + ): + _place_carried_decor(pointer_decor_id) + get_viewport().set_input_as_handled() + return + if not _can_decorate() or not event.is_action_pressed("fish_primary"): + return + if event is InputEventKey and event.echo: + return + var decor_id: StringName = _get_selected_decor_id() + if not decor_id.is_empty() and _bag.get_quantity(decor_id) > 0: + _place_carried_decor(decor_id) + get_viewport().set_input_as_handled() + + +func _process(delta: float) -> void: + if _drag_instance_id.is_empty(): + return + # Menus and other gameplay input handoffs must cancel an active drag before + # evaluating a held/released pointer. This prevents a same-frame TAB press + # followed by left-button release from committing a move behind the UI. + if not _can_decorate(): + _cancel_drag() + return + if not Input.is_mouse_button_pressed(MOUSE_BUTTON_LEFT): + _finish_drag() + return + if not _drag_target_valid: + return + var current: Dictionary = _home_world.get_decor_preview_transform( + _drag_owner_fingerprint, _drag_instance_id + ) + if current.is_empty(): + _cancel_drag() + return + var current_position: Vector3 = current["position"] + var current_yaw: float = float(current["yaw"]) + var blend: float = 1.0 - exp(-DRAG_RESPONSE * delta) + _home_world.set_decor_preview_transform( + _drag_owner_fingerprint, + _drag_instance_id, + current_position.lerp(_drag_target_position, blend), + lerp_angle(current_yaw, _drag_target_yaw, blend), + ) + + +func _begin_drag(screen_position: Vector2) -> bool: + if _network_home.has_pending_local_decor_mutation(): + _toolbar.report_status("waiting for the previous decor update") + return false + var owner_fingerprint: String = ( + _network_home.get_local_home_owner_fingerprint() + ) + var camera: Camera3D = _player.get_active_gameplay_camera() + var clicked_instance: String = _home_world.find_decor_instance_at_screen( + owner_fingerprint, camera, screen_position + ) + if clicked_instance.is_empty(): + return false + var placement: Dictionary = _home_state.get_placement(clicked_instance) + if placement.is_empty(): + return false + var original_position: Vector3 = _placement_position(placement) + if not original_position.is_finite(): + return false + if not _home_world.set_decor_manipulation_active( + owner_fingerprint, clicked_instance, true + ): + return false + var pointer_position: Vector3 = _home_world.get_floor_position_from_screen( + owner_fingerprint, camera, screen_position + ) + _drag_instance_id = clicked_instance + _drag_owner_fingerprint = owner_fingerprint + _drag_original_position = original_position + _drag_original_yaw = float(placement.get("yaw", 0.0)) + _drag_target_position = original_position + _drag_target_yaw = _drag_original_yaw + _drag_target_valid = true + _drag_pointer_offset = ( + original_position - pointer_position + if pointer_position.is_finite() + else Vector3.ZERO + ) + _drag_pointer_offset.y = 0.0 + _select_instance(clicked_instance) + _toolbar.report_status("drag decor, then release to place it") + return true + + +func _update_drag(screen_position: Vector2) -> void: + if not _can_decorate(): + _cancel_drag() + return + var camera: Camera3D = _player.get_active_gameplay_camera() + var pointer_position: Vector3 = _home_world.get_floor_position_from_screen( + _drag_owner_fingerprint, camera, screen_position + ) + if not pointer_position.is_finite(): + # Keep the most recent valid target when the pointer briefly leaves the + # RV floor. Releasing there should place at that target, not throw the + # decor all the way back to where the drag began. + _toolbar.report_status("keep the pointer over the RV floor") + return + var placement: Dictionary = _home_state.get_placement(_drag_instance_id) + if placement.is_empty(): + _clear_selection() + return + var candidate: Vector3 = pointer_position + _drag_pointer_offset + candidate.y = 0.0 + var normalized: Dictionary = _network_home.get_valid_local_decor_transform( + _drag_instance_id, + candidate, + float(placement.get("yaw", _drag_original_yaw)), + _mode, + ) + if normalized.is_empty(): + # A densely furnished area may have no nearby solution. Preserve the + # last valid preview so the interaction remains stable while the player + # moves the pointer toward open space. + _toolbar.report_status("holding at the nearest available position") + return + _drag_target_position = normalized["position"] + _drag_target_yaw = float(normalized["yaw"]) + _drag_target_valid = true + _toolbar.report_status("release to place decor") + + +func _finish_drag() -> void: + var instance_id: String = _drag_instance_id + var owner_fingerprint: String = _drag_owner_fingerprint + var original_position: Vector3 = _drag_original_position + var original_yaw: float = _drag_original_yaw + var target_position: Vector3 = _drag_target_position + var target_yaw: float = _drag_target_yaw + var target_valid: bool = _drag_target_valid + var placement: Dictionary = _home_state.get_placement(instance_id) + var decor_id := StringName(str(placement.get("decor_id", ""))) + if ( + not target_valid + or decor_id.is_empty() + or not _home_world.is_decor_placement_clear_of_players( + owner_fingerprint, decor_id, target_position, target_yaw + ) + ): + _home_world.set_decor_preview_transform( + owner_fingerprint, + instance_id, + original_position, + original_yaw, + ) + _home_world.set_decor_manipulation_active( + owner_fingerprint, instance_id, false + ) + _reset_drag_state() + _toolbar.report_status( + "a player is in the way" + if target_valid + else "that space is not available" + ) + return + _home_world.set_decor_preview_transform( + owner_fingerprint, instance_id, target_position, target_yaw + ) + if ( + original_position.distance_to(target_position) + <= DRAG_POSITION_EPSILON + and is_zero_approx(angle_difference(original_yaw, target_yaw)) + ): + _home_world.set_decor_manipulation_active( + owner_fingerprint, instance_id, false + ) + _reset_drag_state() + _select_instance(instance_id) + return + if _network_home.update_local_decor( + instance_id, target_position, target_yaw, _mode + ): + _home_world.set_decor_manipulation_active( + owner_fingerprint, instance_id, false + ) + _reset_drag_state() + _toolbar.report_status("decor moved") + return + _home_world.set_decor_preview_transform( + owner_fingerprint, + instance_id, + original_position, + original_yaw, + ) + _home_world.set_decor_manipulation_active( + owner_fingerprint, instance_id, false + ) + _reset_drag_state() + _toolbar.report_status("that space is not available") + + +func _cancel_drag() -> void: + if _drag_instance_id.is_empty(): + return + _home_world.set_decor_preview_transform( + _drag_owner_fingerprint, + _drag_instance_id, + _drag_original_position, + _drag_original_yaw, + ) + _home_world.set_decor_manipulation_active( + _drag_owner_fingerprint, _drag_instance_id, false + ) + _reset_drag_state() + + +func _reset_drag_state() -> void: + _drag_instance_id = "" + _drag_owner_fingerprint = "" + _drag_pointer_offset = Vector3.ZERO + _drag_original_position = Vector3.ZERO + _drag_original_yaw = 0.0 + _drag_target_position = Vector3.ZERO + _drag_target_yaw = 0.0 + _drag_target_valid = false + + +static func _placement_position(placement: Dictionary) -> Vector3: + if placement.is_empty(): + return Vector3.INF + var values: Array = placement.get("position", []) + if values.size() != 3: + return Vector3.INF + return Vector3( + float(values[0]), float(values[1]), float(values[2]) + ) + + +func _place_carried_decor(decor_id: StringName) -> void: + if _network_home.has_pending_local_decor_mutation(): + _toolbar.report_status("waiting for the previous decor update") + return + var owner_fingerprint: String = ( + _network_home.get_local_home_owner_fingerprint() + ) + # RV transitions keep the gameplay root axis-aligned so its transform can be + # synchronized independently from the presentation. Use the visual facing + # direction instead; otherwise carried decor is always placed along world -Z + # instead of in front of the character the player sees. + var forward: Vector3 = _player.get_facing_direction() + var global_position: Vector3 = _player.global_position + forward * 1.45 + var local_position: Vector3 = _home_world.interior_global_to_local( + owner_fingerprint, global_position + ) + var placement_yaw: float = atan2(-forward.x, -forward.z) + var instance_id: String = _network_home.place_local_decor( + decor_id, local_position, placement_yaw, _mode + ) + if instance_id.is_empty(): + _toolbar.report_status("make room in front of you to place this decor") + return + # A local host can reject its own optimistic manifest synchronously. Do not + # claim success after that rollback or leave the player looking for decor that + # was never accepted into the room. + if _home_state.get_placement(instance_id).is_empty(): + _toolbar.report_status("decor placement was not accepted") + return + _select_instance(instance_id) + _toolbar.report_status("decor placed") + + +func _select_instance(instance_id: String) -> void: + var placement: Dictionary = _home_state.get_placement(instance_id) + if placement.is_empty(): + _clear_selection() + return + _selected_instance_id = instance_id + var decor_id := StringName(str(placement.get("decor_id", ""))) + _toolbar.set_selection( + instance_id, DecorCatalogType.get_display_name(decor_id) + ) + + +func _rotate_selected() -> void: + if not _can_decorate() or _selected_instance_id.is_empty(): + return + if _network_home.has_pending_local_decor_mutation(): + _toolbar.report_status("waiting for the previous decor update") + return + var placement: Dictionary = _home_state.get_placement( + _selected_instance_id + ) + if placement.is_empty(): + _clear_selection() + return + var values: Array = placement.get("position", []) + if values.size() != 3: + return + var position := Vector3( + float(values[0]), float(values[1]), float(values[2]) + ) + if _network_home.update_local_decor( + _selected_instance_id, + position, + float(placement.get("yaw", 0.0)) + PI * 0.5, + _mode, + ): + _toolbar.report_status("decor rotated") + else: + _toolbar.report_status("not enough room to rotate here") + + +func _store_selected() -> void: + if _selected_instance_id.is_empty(): + return + if _network_home.has_pending_local_decor_mutation(): + _toolbar.report_status("waiting for the previous decor update") + return + if _network_home.remove_local_decor(_selected_instance_id): + _clear_selection() + _toolbar.report_status("decor packed into storage") + else: + _toolbar.report_status("inventory and storage are full") + + +func _clear_selection() -> void: + _cancel_drag() + _selected_instance_id = "" + if _toolbar != null: + _toolbar.set_selection("") + + +func _on_placement_mode_requested(mode: int) -> void: + _mode = mode as PlayerHomeState.PlacementMode + + +func _on_local_space_changed( + _space_id: StringName, + _owner_fingerprint: String, +) -> void: + _clear_selection() + _refresh_toolbar() + + +func _on_local_manifest_rejected(message: String) -> void: + _clear_selection() + if _toolbar != null and _toolbar.visible: + _toolbar.report_status(message) + + +func _on_home_changed() -> void: + if ( + not _selected_instance_id.is_empty() + and _home_state.get_placement(_selected_instance_id).is_empty() + ): + _clear_selection() + _refresh_toolbar() + + +func _refresh_toolbar() -> void: + if _toolbar == null: + return + _toolbar.set_active(_can_decorate()) + if not _toolbar.visible: + _clear_selection() + + +func _can_decorate() -> bool: + return ( + _player != null + and _network_home != null + and _network_home.can_local_decorate() + and _fishing_spot != null + and _fishing_spot.can_open_fishing_shop() + and _player.is_movement_enabled() + ) + + +func _get_selected_decor_id() -> StringName: + if ( + _hotbar == null + or _hotbar.get_selected_assignment_kind() + != PlayerHotbar.AssignmentKind.ITEM + ): + return StringName() + var item_id: StringName = _hotbar.get_selected_item_id() + return item_id if DecorCatalogType.has_product(item_id) else StringName() diff --git a/homes/home_decor_controller.gd.uid b/homes/home_decor_controller.gd.uid new file mode 100644 index 0000000..1778125 --- /dev/null +++ b/homes/home_decor_controller.gd.uid @@ -0,0 +1 @@ +uid://b5j0mqcvhmi54 diff --git a/homes/home_world_service.gd b/homes/home_world_service.gd new file mode 100644 index 0000000..fd02d93 --- /dev/null +++ b/homes/home_world_service.gd @@ -0,0 +1,1209 @@ +class_name HomeWorldService +extends Node3D + +const NetworkHomeProtocolType = preload( + "res://network/network_home_protocol.gd" +) +const PlayerHomeStateType = preload("res://homes/player_home_state.gd") +const DecorCatalogType = preload("res://homes/decor_catalog.gd") +const STARTER_MOTORCOACH_SCENE: PackedScene = preload( + "res://homes/assets/starter_motorcoach.glb" +) + +const EXTERIOR_BODY_SIZE := Vector3(5.6, 2.5, 2.35) +const EXTERIOR_DOOR_LOCAL := Vector3(-0.2, 0.85, 1.48) +const EXTERIOR_SPAWN_LOCAL := Vector3(-0.2, 0.25, 2.45) +const EXTERIOR_INTERACTION_DISTANCE: float = 2.7 +const INTERIOR_EXIT_DISTANCE: float = 2.1 +const INTERIOR_ORIGIN := Vector3(1000.0, 300.0, 1000.0) +const INTERIOR_SPACING: float = 14.0 +const INTERIOR_MAX_SPAWN_SLOTS: int = 64 +const INTERIOR_FLOOR_SIZE := Vector3(8.0, 0.18, 4.5) +const INTERIOR_WALL_HEIGHT: float = 2.7 +const MIN_EXTERIOR_TRIANGLE_AREA: float = 1.0 +const MIN_EXTERIOR_SEPARATION: float = 9.0 +const EXTERIOR_FOOTPRINT_HALF_EXTENTS := Vector2(3.85, 2.55) +const EXTERIOR_SURFACE_INDEX_CELL_SIZE: float = 5.0 +const EXTERIOR_MAX_SURFACE_HEIGHT_DELTA: float = 0.24 +const EXTERIOR_CLEARANCE_HEIGHT: float = 2.7 +const WORLD_GEOMETRY_COLLISION_LAYER: int = 1 +const DECOR_SELECTION_COLLISION_LAYER: int = 1 << 8 +# Includes the player's 0.45 m capsule radius plus enough movement margin for +# a full low-tick-rate frame before a newly solid placement can be reached. +const PLAYER_DECOR_CLEARANCE_RADIUS: float = 0.8 +const BASIC_CUBE_SIZE := Vector3(1.0, 0.8, 0.8) + +var _world: TestWorld +var _spawn_service: PlayerSpawnService +var _session: NetworkSession +var _dedicated_runtime: bool = false +var _exteriors_root: Node3D +var _interiors_root: Node3D +var _presentations_by_fingerprint: Dictionary[String, Dictionary] = {} +var _local_space: StringName = NetworkHomeProtocolType.WORLD_SPACE +var _decor_under_manipulation: Dictionary[String, bool] = {} +var _pending_solid_decor: Dictionary[String, Dictionary] = {} + + +func setup( + world: TestWorld, + spawn_service: PlayerSpawnService, + session: NetworkSession, + dedicated_runtime: bool, +) -> void: + _world = world + _spawn_service = spawn_service + _session = session + _dedicated_runtime = dedicated_runtime + _ensure_roots() + set_process(true) + + +func is_world_ready() -> bool: + return _world != null and _world.is_world_ready() + + +func clear_presentations() -> void: + _presentations_by_fingerprint.clear() + _decor_under_manipulation.clear() + _pending_solid_decor.clear() + if is_instance_valid(_exteriors_root): + for child: Node in _exteriors_root.get_children(): + child.queue_free() + if is_instance_valid(_interiors_root): + for child: Node in _interiors_root.get_children(): + child.queue_free() + + +func remove_presentation(owner_fingerprint: String) -> void: + var presentation: Dictionary = _presentations_by_fingerprint.get( + owner_fingerprint, {} + ) + if presentation.is_empty(): + return + _clear_decor_collision_tracking(owner_fingerprint) + _free_presentation_nodes(presentation) + _presentations_by_fingerprint.erase(owner_fingerprint) + + +func apply_manifest(data: Dictionary) -> bool: + if ( + not is_world_ready() + or not NetworkHomeProtocolType.validate_manifest_broadcast(data) + ): + return false + _ensure_roots() + var fingerprint: String = str(data["owner_fingerprint"]) + var prior: Dictionary = _presentations_by_fingerprint.get(fingerprint, {}) + var prior_instance_ids: Dictionary[String, bool] = {} + if not prior.is_empty(): + var prior_home: Dictionary = prior.get("home", {}) + for value: Variant in prior_home.get("placements", []): + if typeof(value) == TYPE_DICTIONARY: + prior_instance_ids[str( + (value as Dictionary).get("instance_id", "") + )] = true + if not prior.is_empty(): + _clear_decor_collision_tracking(fingerprint) + _free_presentation_nodes(prior) + var exterior_transform := NetworkHomeProtocolType.array_to_transform( + data["exterior_transform"] + ) + var interior_index: int = int(data["interior_index"]) + var home_data: Dictionary = PlayerHomeStateType.sanitize_save_data( + data["home"] + ) + var exterior := _build_exterior(fingerprint, exterior_transform) + var interior := _build_interior(fingerprint, interior_index, home_data) + var presentation: Dictionary = { + "owner_peer_id": int(data["owner_peer_id"]), + "fingerprint": fingerprint, + "home": home_data, + "exterior_transform": exterior_transform, + "interior_index": interior_index, + "exterior": exterior, + "interior": interior, + } + _presentations_by_fingerprint[fingerprint] = presentation + _refresh_local_visibility() + if not prior.is_empty(): + for value: Variant in home_data.get("placements", []): + if typeof(value) != TYPE_DICTIONARY: + continue + var instance_id: String = str( + (value as Dictionary).get("instance_id", "") + ) + if not instance_id.is_empty() and not prior_instance_ids.has( + instance_id + ): + call_deferred( + "_spawn_decor_poof", fingerprint, instance_id + ) + return true + + +func choose_exterior_transform( + owner_peer_id: int, + reserved_transforms: Array[Transform3D], +) -> Transform3D: + var spawn_transform: Transform3D = ( + _world.get_player_spawn_transform() + if _world != null else Transform3D.IDENTITY + ) + var triangles: Array[PackedVector3Array] = ( + _world.get_spawn_surface_triangles( + [&"grass_lite", &"grass", &"sand"], -0.5 + ) + if _world != null else [] + ) + if not triangles.is_empty(): + var surface_index: Dictionary = _build_surface_index(triangles) + var strict_result: Transform3D = _find_exterior_transform( + owner_peer_id, + triangles, + surface_index, + spawn_transform, + reserved_transforms, + true, + true, + ) + if strict_result != Transform3D.IDENTITY: + return strict_result + var relaxed_result: Transform3D = _find_exterior_transform( + owner_peer_id, + triangles, + surface_index, + spawn_transform, + reserved_transforms, + false, + true, + ) + if relaxed_result != Transform3D.IDENTITY: + return relaxed_result + var dry_result: Transform3D = _find_exterior_transform( + owner_peer_id, + triangles, + surface_index, + spawn_transform, + reserved_transforms, + false, + false, + ) + if dry_result != Transform3D.IDENTITY: + push_warning( + "RV exterior used a dry fallback with obstructed clearance." + ) + return dry_result + push_error("No dry, level RV exterior footprint was available.") + var fallback: Transform3D = spawn_transform + var column: int = posmod(owner_peer_id - 1, 4) + var row: int = maxi(floori(float(owner_peer_id - 1) / 4.0), 0) + fallback.origin += Vector3( + -12.0 + float(column) * 8.0, + 0.0, + 8.0 + float(row) * 7.0, + ) + return fallback + + +func _find_exterior_transform( + owner_peer_id: int, + triangles: Array[PackedVector3Array], + surface_index: Dictionary, + spawn_transform: Transform3D, + reserved_transforms: Array[Transform3D], + require_spawn_clearance: bool, + require_obstacle_clearance: bool, +) -> Transform3D: + var triangle_count: int = triangles.size() + var start: int = posmod(owner_peer_id * 37, triangle_count) + var step: int = _coprime_step(triangle_count, 29) + for offset: int in triangle_count: + var triangle: PackedVector3Array = triangles[ + (start + offset * step) % triangle_count + ] + if not _is_exterior_candidate_triangle(triangle): + continue + var position: Vector3 = ( + triangle[0] + triangle[1] + triangle[2] + ) / 3.0 + if ( + require_spawn_clearance + and position.distance_to(spawn_transform.origin) < 6.0 + ): + continue + if _too_close_to_reserved(position, reserved_transforms): + continue + var yaw: float = float(posmod(owner_peer_id + offset, 4)) * PI * 0.5 + var grounded_position: Vector3 = _ground_exterior_footprint( + position, yaw, triangles, surface_index + ) + if not grounded_position.is_finite(): + continue + if ( + require_obstacle_clearance + and not _exterior_volume_is_clear(grounded_position, yaw) + ): + continue + return Transform3D(Basis(Vector3.UP, yaw), grounded_position) + return Transform3D.IDENTITY + + +func _is_exterior_candidate_triangle(triangle: PackedVector3Array) -> bool: + if triangle.size() != 3: + return false + var normal: Vector3 = (triangle[1] - triangle[0]).cross( + triangle[2] - triangle[0] + ) + var area: float = normal.length() * 0.5 + return ( + area >= MIN_EXTERIOR_TRIANGLE_AREA + and absf(normal.normalized().y) >= 0.94 + ) + + +func _ground_exterior_footprint( + position: Vector3, + yaw: float, + triangles: Array[PackedVector3Array], + surface_index: Dictionary, +) -> Vector3: + var heights: Array[float] = [] + for local_sample: Vector2 in _exterior_footprint_samples(): + var rotated_sample: Vector3 = Vector3( + local_sample.x, 0.0, local_sample.y + ).rotated(Vector3.UP, yaw) + var sample := Vector2( + position.x + rotated_sample.x, + position.z + rotated_sample.z, + ) + var height: float = _surface_height_at( + sample, position.y, triangles, surface_index + ) + if not is_finite(height): + return Vector3.INF + heights.append(height) + var minimum_height: float = heights.min() + var maximum_height: float = heights.max() + if maximum_height - minimum_height > EXTERIOR_MAX_SURFACE_HEIGHT_DELTA: + return Vector3.INF + return Vector3(position.x, maximum_height, position.z) + + +func _exterior_footprint_samples() -> Array[Vector2]: + var samples: Array[Vector2] = [] + for x_factor: float in [-1.0, -0.5, 0.0, 0.5, 1.0]: + for z_factor: float in [-1.0, 0.0, 1.0]: + samples.append(Vector2( + EXTERIOR_FOOTPRINT_HALF_EXTENTS.x * x_factor, + EXTERIOR_FOOTPRINT_HALF_EXTENTS.y * z_factor, + )) + return samples + + +func _build_surface_index( + triangles: Array[PackedVector3Array], +) -> Dictionary: + var result: Dictionary = {} + for triangle_index: int in triangles.size(): + var triangle: PackedVector3Array = triangles[triangle_index] + if triangle.size() != 3: + continue + var minimum_x: float = minf( + triangle[0].x, minf(triangle[1].x, triangle[2].x) + ) + var maximum_x: float = maxf( + triangle[0].x, maxf(triangle[1].x, triangle[2].x) + ) + var minimum_z: float = minf( + triangle[0].z, minf(triangle[1].z, triangle[2].z) + ) + var maximum_z: float = maxf( + triangle[0].z, maxf(triangle[1].z, triangle[2].z) + ) + var minimum_cell := Vector2i( + floori(minimum_x / EXTERIOR_SURFACE_INDEX_CELL_SIZE), + floori(minimum_z / EXTERIOR_SURFACE_INDEX_CELL_SIZE), + ) + var maximum_cell := Vector2i( + floori(maximum_x / EXTERIOR_SURFACE_INDEX_CELL_SIZE), + floori(maximum_z / EXTERIOR_SURFACE_INDEX_CELL_SIZE), + ) + for cell_x: int in range(minimum_cell.x, maximum_cell.x + 1): + for cell_y: int in range(minimum_cell.y, maximum_cell.y + 1): + var cell := Vector2i(cell_x, cell_y) + var bucket: Array = result.get(cell, []) + bucket.append(triangle_index) + result[cell] = bucket + return result + + +func _surface_height_at( + point: Vector2, + preferred_height: float, + triangles: Array[PackedVector3Array], + surface_index: Dictionary, +) -> float: + var cell := Vector2i( + floori(point.x / EXTERIOR_SURFACE_INDEX_CELL_SIZE), + floori(point.y / EXTERIOR_SURFACE_INDEX_CELL_SIZE), + ) + var best_height: float = INF + var best_delta: float = INF + for value: Variant in surface_index.get(cell, []): + var triangle: PackedVector3Array = triangles[int(value)] + var height: float = _triangle_height_at(point, triangle) + if not is_finite(height): + continue + var delta: float = absf(height - preferred_height) + if delta < best_delta: + best_delta = delta + best_height = height + return best_height + + +func _triangle_height_at( + point: Vector2, + triangle: PackedVector3Array, +) -> float: + var a := Vector2(triangle[0].x, triangle[0].z) + var b := Vector2(triangle[1].x, triangle[1].z) + var c := Vector2(triangle[2].x, triangle[2].z) + var denominator: float = ( + (b.y - c.y) * (a.x - c.x) + + (c.x - b.x) * (a.y - c.y) + ) + if absf(denominator) <= 0.000001: + return INF + var weight_a: float = ( + (b.y - c.y) * (point.x - c.x) + + (c.x - b.x) * (point.y - c.y) + ) / denominator + var weight_b: float = ( + (c.y - a.y) * (point.x - c.x) + + (a.x - c.x) * (point.y - c.y) + ) / denominator + var weight_c: float = 1.0 - weight_a - weight_b + const EDGE_EPSILON: float = 0.001 + if ( + weight_a < -EDGE_EPSILON + or weight_b < -EDGE_EPSILON + or weight_c < -EDGE_EPSILON + ): + return INF + return ( + weight_a * triangle[0].y + + weight_b * triangle[1].y + + weight_c * triangle[2].y + ) + + +func _exterior_volume_is_clear(position: Vector3, yaw: float) -> bool: + if not is_inside_tree() or get_world_3d() == null: + return true + var shape := BoxShape3D.new() + shape.size = Vector3( + EXTERIOR_FOOTPRINT_HALF_EXTENTS.x * 2.0, + EXTERIOR_CLEARANCE_HEIGHT, + EXTERIOR_FOOTPRINT_HALF_EXTENTS.y * 2.0, + ) + var query := PhysicsShapeQueryParameters3D.new() + query.shape = shape + query.transform = Transform3D( + Basis(Vector3.UP, yaw), + position + Vector3.UP * (EXTERIOR_CLEARANCE_HEIGHT * 0.5 + 0.2), + ) + query.collision_mask = 1 + query.collide_with_areas = false + query.collide_with_bodies = true + return get_world_3d().direct_space_state.intersect_shape(query, 1).is_empty() + + +func _coprime_step(value: int, preferred_step: int) -> int: + var step: int = mini(preferred_step, maxi(value - 1, 1)) + while step > 1 and _greatest_common_divisor(step, value) != 1: + step -= 1 + return step + + +func _greatest_common_divisor(first: int, second: int) -> int: + var a: int = absi(first) + var b: int = absi(second) + while b != 0: + var remainder: int = a % b + a = b + b = remainder + return a + + +func get_exterior_transform(owner_fingerprint: String) -> Transform3D: + var presentation: Dictionary = _presentations_by_fingerprint.get( + owner_fingerprint, {} + ) + return presentation.get("exterior_transform", Transform3D.IDENTITY) + + +func get_exterior_prompt_position(owner_fingerprint: String) -> Vector3: + return get_exterior_transform(owner_fingerprint) * EXTERIOR_DOOR_LOCAL + + +func get_exterior_spawn_transform(owner_fingerprint: String) -> Transform3D: + var exterior_transform: Transform3D = get_exterior_transform( + owner_fingerprint + ) + return Transform3D( + exterior_transform.basis, + exterior_transform * EXTERIOR_SPAWN_LOCAL, + ) + + +func get_interior_spawn_transform( + owner_fingerprint: String, + visitor_offset: int = 0, +) -> Transform3D: + var anchor: Vector3 = get_interior_anchor(owner_fingerprint) + # `visitor_offset` is allocated by the host as a compact room-local slot. + # Keep it bounded as a last line of defense if a future caller accidentally + # supplies an engine peer ID instead of a slot. + var visitor_slot: int = posmod(visitor_offset, INTERIOR_MAX_SPAWN_SLOTS) + # Build the origin as a value rather than mutating Transform3D.origin. + var spawn_origin: Vector3 = anchor + Vector3( + -1.0 + float(posmod(visitor_slot, 4)) * 0.65, + 0.25, + 0.4 + float(floori(float(visitor_slot) / 4.0)) * 0.55, + ) + return Transform3D(Basis.IDENTITY, spawn_origin) + + +func get_interior_anchor(owner_fingerprint: String) -> Vector3: + var presentation: Dictionary = _presentations_by_fingerprint.get( + owner_fingerprint, {} + ) + var index: int = int(presentation.get("interior_index", 0)) + return INTERIOR_ORIGIN + Vector3(float(index) * INTERIOR_SPACING, 0.0, 0.0) + + +func is_avatar_near_exterior(avatar: Player, owner_fingerprint: String) -> bool: + if avatar == null or not _presentations_by_fingerprint.has(owner_fingerprint): + return false + var transform: Transform3D = get_exterior_transform(owner_fingerprint) + var door_position: Vector3 = transform * EXTERIOR_DOOR_LOCAL + return avatar.global_position.distance_to(door_position) <= ( + EXTERIOR_INTERACTION_DISTANCE + ) + + +func is_avatar_near_interior_exit( + avatar: Player, + owner_fingerprint: String, +) -> bool: + if avatar == null: + return false + return avatar.global_position.distance_to( + get_interior_exit_position(owner_fingerprint) + ) <= INTERIOR_EXIT_DISTANCE + + +func get_interior_exit_position(owner_fingerprint: String) -> Vector3: + return get_interior_anchor(owner_fingerprint) + Vector3( + -INTERIOR_FLOOR_SIZE.x * 0.5 + 0.6, + 0.35, + 0.0, + ) + + +func get_interior_prompt_position(owner_fingerprint: String) -> Vector3: + return get_interior_exit_position(owner_fingerprint) + Vector3.UP * 1.2 + + +func interior_local_to_global( + owner_fingerprint: String, + local_position: Vector3, +) -> Vector3: + return get_interior_anchor(owner_fingerprint) + local_position + + +func interior_global_to_local( + owner_fingerprint: String, + global_position: Vector3, +) -> Vector3: + return global_position - get_interior_anchor(owner_fingerprint) + + +func get_floor_position_from_screen( + owner_fingerprint: String, + camera: Camera3D, + screen_position: Vector2, +) -> Vector3: + if camera == null or owner_fingerprint.is_empty(): + return Vector3.INF + var ray_origin: Vector3 = camera.project_ray_origin(screen_position) + var ray_direction: Vector3 = camera.project_ray_normal(screen_position) + if absf(ray_direction.y) <= 0.0001: + return Vector3.INF + var floor_y: float = get_interior_anchor(owner_fingerprint).y + 0.1 + var distance: float = (floor_y - ray_origin.y) / ray_direction.y + if distance <= 0.0: + return Vector3.INF + return interior_global_to_local( + owner_fingerprint, + ray_origin + ray_direction * distance, + ) + + +func find_decor_instance_at_screen( + owner_fingerprint: String, + camera: Camera3D, + screen_position: Vector2, +) -> String: + if camera == null or owner_fingerprint.is_empty(): + return "" + var ray_origin: Vector3 = camera.project_ray_origin(screen_position) + var ray_end: Vector3 = ray_origin + camera.project_ray_normal( + screen_position + ) * 50.0 + var query := PhysicsRayQueryParameters3D.create(ray_origin, ray_end) + query.collision_mask = DECOR_SELECTION_COLLISION_LAYER + query.collide_with_areas = false + var result: Dictionary = camera.get_world_3d().direct_space_state.intersect_ray( + query + ) + var collider: Object = result.get("collider") + if collider is Node and (collider as Node).has_meta(&"decor_instance_id"): + if str((collider as Node).get_meta(&"decor_owner_fingerprint")) == ( + owner_fingerprint + ): + return str((collider as Node).get_meta(&"decor_instance_id")) + return "" + + +func get_decor_preview_transform( + owner_fingerprint: String, + instance_id: String, +) -> Dictionary: + var decor: Node3D = _get_decor_presentation( + owner_fingerprint, instance_id + ) + if decor == null: + return {} + return { + "position": Vector3(decor.position.x, 0.0, decor.position.z), + "yaw": decor.rotation.y, + } + + +func set_decor_preview_transform( + owner_fingerprint: String, + instance_id: String, + position: Vector3, + yaw_radians: float, +) -> bool: + var decor: Node3D = _get_decor_presentation( + owner_fingerprint, instance_id + ) + if decor == null or not position.is_finite() or not is_finite(yaw_radians): + return false + decor.position = Vector3(position.x, 0.18, position.z) + decor.rotation.y = yaw_radians + return true + + +func set_decor_manipulation_active( + owner_fingerprint: String, + instance_id: String, + active: bool, +) -> bool: + var decor: Node3D = _get_decor_presentation( + owner_fingerprint, instance_id + ) + if decor == null: + return false + var body: StaticBody3D = decor.get_node_or_null( + "BasicCubeCollision" + ) as StaticBody3D + if body == null: + return false + var key: String = _decor_collision_key( + owner_fingerprint, instance_id + ) + if active: + _decor_under_manipulation[key] = true + _pending_solid_decor.erase(key) + body.collision_layer = DECOR_SELECTION_COLLISION_LAYER + return true + _decor_under_manipulation.erase(key) + _queue_decor_world_collision( + owner_fingerprint, + instance_id, + StringName(str(decor.get_meta(&"decor_id", ""))), + body, + ) + return true + + +func is_decor_placement_clear_of_players( + owner_fingerprint: String, + decor_id: StringName, + local_position: Vector3, + yaw_radians: float, +) -> bool: + if ( + owner_fingerprint.is_empty() + or not DecorCatalogType.has_product(decor_id) + or not local_position.is_finite() + or not is_finite(yaw_radians) + ): + return false + if _spawn_service == null: + return true + var global_center: Vector3 = interior_local_to_global( + owner_fingerprint, local_position + ) + var half_size: Vector2 = DecorCatalogType.get_footprint(decor_id) * 0.5 + for peer_id: int in _spawn_service.get_peer_ids(): + var avatar: Player = _spawn_service.get_avatar(peer_id) + if avatar == null or not is_instance_valid(avatar): + continue + var offset := Vector2( + avatar.global_position.x - global_center.x, + avatar.global_position.z - global_center.z, + ).rotated(-yaw_radians) + var nearest := Vector2( + clampf(offset.x, -half_size.x, half_size.x), + clampf(offset.y, -half_size.y, half_size.y), + ) + if offset.distance_squared_to(nearest) < ( + PLAYER_DECOR_CLEARANCE_RADIUS + * PLAYER_DECOR_CLEARANCE_RADIUS + ): + return false + return true + + +func _get_decor_presentation( + owner_fingerprint: String, + instance_id: String, +) -> Node3D: + if owner_fingerprint.is_empty() or instance_id.is_empty(): + return null + var presentation: Dictionary = _presentations_by_fingerprint.get( + owner_fingerprint, {} + ) + var interior: Node3D = presentation.get("interior") + if not is_instance_valid(interior): + return null + return interior.get_node_or_null( + "Decor/%s" % instance_id + ) as Node3D + + +func find_nearby_exterior_owner(avatar: Player) -> String: + if avatar == null: + return "" + var closest: String = "" + var closest_distance: float = EXTERIOR_INTERACTION_DISTANCE + for fingerprint: String in _presentations_by_fingerprint: + var transform: Transform3D = get_exterior_transform(fingerprint) + var distance: float = avatar.global_position.distance_to( + transform * EXTERIOR_DOOR_LOCAL + ) + if distance <= closest_distance: + closest = fingerprint + closest_distance = distance + return closest + + +func set_local_space(space_id: StringName) -> void: + _local_space = space_id + _refresh_local_visibility() + + +func get_manifest(owner_fingerprint: String) -> Dictionary: + var presentation: Dictionary = _presentations_by_fingerprint.get( + owner_fingerprint, {} + ) + return (presentation.get("home", {}) as Dictionary).duplicate(true) + + +func _process(_delta: float) -> void: + _refresh_pending_decor_collisions() + if not _dedicated_runtime: + _refresh_nearest_wall() + + +func _queue_decor_world_collision( + owner_fingerprint: String, + instance_id: String, + decor_id: StringName, + body: StaticBody3D, +) -> void: + if ( + owner_fingerprint.is_empty() + or instance_id.is_empty() + or not DecorCatalogType.has_product(decor_id) + or body == null + ): + return + var key: String = _decor_collision_key( + owner_fingerprint, instance_id + ) + body.collision_layer = DECOR_SELECTION_COLLISION_LAYER + _pending_solid_decor[key] = { + "owner_fingerprint": owner_fingerprint, + "instance_id": instance_id, + "decor_id": decor_id, + "body": body, + } + + +func _refresh_pending_decor_collisions() -> void: + if _pending_solid_decor.is_empty(): + return + var keys: Array[String] = [] + keys.assign(_pending_solid_decor.keys()) + for key: String in keys: + if _decor_under_manipulation.has(key): + continue + var pending: Dictionary = _pending_solid_decor.get(key, {}) + var body: StaticBody3D = pending.get("body") as StaticBody3D + var owner_fingerprint: String = str( + pending.get("owner_fingerprint", "") + ) + var instance_id: String = str(pending.get("instance_id", "")) + var decor_id := StringName(str(pending.get("decor_id", ""))) + var decor: Node3D = _get_decor_presentation( + owner_fingerprint, instance_id + ) + if body == null or decor == null or not is_instance_valid(body): + _pending_solid_decor.erase(key) + continue + if not is_decor_placement_clear_of_players( + owner_fingerprint, + decor_id, + Vector3(decor.position.x, 0.0, decor.position.z), + decor.rotation.y, + ): + continue + body.collision_layer = ( + WORLD_GEOMETRY_COLLISION_LAYER + | DECOR_SELECTION_COLLISION_LAYER + ) + _pending_solid_decor.erase(key) + + +func _clear_decor_collision_tracking(owner_fingerprint: String) -> void: + var prefix: String = "%s/" % owner_fingerprint + for key: String in _decor_under_manipulation.keys(): + if key.begins_with(prefix): + _decor_under_manipulation.erase(key) + for key: String in _pending_solid_decor.keys(): + if key.begins_with(prefix): + _pending_solid_decor.erase(key) + + +static func _decor_collision_key( + owner_fingerprint: String, + instance_id: String, +) -> String: + return "%s/%s" % [owner_fingerprint, instance_id] + + +func _ensure_roots() -> void: + if not is_instance_valid(_exteriors_root): + _exteriors_root = Node3D.new() + _exteriors_root.name = "RVExteriors" + add_child(_exteriors_root) + if not is_instance_valid(_interiors_root): + _interiors_root = Node3D.new() + _interiors_root.name = "RVInteriors" + add_child(_interiors_root) + + +func _build_exterior( + fingerprint: String, + world_transform: Transform3D, +) -> Node3D: + var root := Node3D.new() + root.name = "RV_%s" % fingerprint.left(8) + _exteriors_root.add_child(root) + root.global_transform = world_transform + if not _dedicated_runtime: + var motorcoach: Node3D = STARTER_MOTORCOACH_SCENE.instantiate() as Node3D + if motorcoach != null: + motorcoach.name = "StarterMotorcoach" + root.add_child(motorcoach) + else: + push_error("The starter motorcoach exterior could not be instantiated.") + _add_box_collision( + root, + "Body", + EXTERIOR_BODY_SIZE, + Vector3(0.0, 1.35, 0.0), + ) + root.visible = not _dedicated_runtime + return root + + +func _build_interior( + fingerprint: String, + interior_index: int, + home_data: Dictionary, +) -> Node3D: + var root := Node3D.new() + root.name = "RVInterior_%s" % fingerprint.left(8) + root.position = INTERIOR_ORIGIN + Vector3( + float(interior_index) * INTERIOR_SPACING, 0.0, 0.0 + ) + var half_width: float = INTERIOR_FLOOR_SIZE.x * 0.5 + var half_depth: float = INTERIOR_FLOOR_SIZE.z * 0.5 + var wall_center_y: float = INTERIOR_WALL_HEIGHT * 0.5 + _interiors_root.add_child(root) + _add_box( + root, "Floor", INTERIOR_FLOOR_SIZE, Vector3.ZERO, + Color("a6754e"), true, + ) + _add_wall( + root, "WallNorth", + Vector3(INTERIOR_FLOOR_SIZE.x, INTERIOR_WALL_HEIGHT, 0.18), + Vector3(0.0, wall_center_y, -half_depth), + ) + _add_wall( + root, "WallSouth", + Vector3(INTERIOR_FLOOR_SIZE.x, INTERIOR_WALL_HEIGHT, 0.18), + Vector3(0.0, wall_center_y, half_depth), + ) + _add_wall( + root, "WallWest", + Vector3(0.18, INTERIOR_WALL_HEIGHT, INTERIOR_FLOOR_SIZE.z), + Vector3(-half_width, wall_center_y, 0.0), + ) + _add_wall( + root, "WallEast", + Vector3(0.18, INTERIOR_WALL_HEIGHT, INTERIOR_FLOOR_SIZE.z), + Vector3(half_width, wall_center_y, 0.0), + ) + for x_position: float in [-1.75, 1.75]: + _add_box( + root, "WallNorthWindow%s" % ("Left" if x_position < 0.0 else "Right"), + Vector3(1.65, 0.95, 0.04), + Vector3(x_position, 1.55, -half_depth + 0.11), + Color("153640"), false, + ) + _add_box( + root, "WallSouthWindow%s" % ("Left" if x_position < 0.0 else "Right"), + Vector3(1.65, 0.95, 0.04), + Vector3(x_position, 1.55, half_depth - 0.11), + Color("153640"), false, + ) + _add_box( + root, "WallEastWindow", Vector3(0.04, 0.95, 1.55), + Vector3(half_width - 0.11, 1.55, 0.0), Color("153640"), false, + ) + _add_box( + root, "WallWestDoor", Vector3(0.04, 1.9, 1.25), + Vector3(-half_width + 0.11, 1.0, 0.0), Color("2897a8"), false, + ) + var decor := Node3D.new() + decor.name = "Decor" + root.add_child(decor) + _rebuild_decor(decor, home_data, fingerprint) + root.visible = false + if _dedicated_runtime: + _set_geometry_visible(root, false) + return root + + +func _rebuild_decor( + parent: Node3D, + home_data: Dictionary, + owner_fingerprint: String, +) -> void: + for value: Variant in home_data.get("placements", []): + if typeof(value) != TYPE_DICTIONARY: + continue + var placement: Dictionary = value + var decor_id := StringName(str(placement["decor_id"])) + if decor_id != DecorCatalogType.BASIC_CUBE_ID: + continue + var position_values: Array = placement["position"] + var placement_root := Node3D.new() + placement_root.name = str(placement["instance_id"]) + placement_root.position = Vector3( + float(position_values[0]), 0.18, float(position_values[2]) + ) + placement_root.rotation.y = float(placement["yaw"]) + placement_root.set_meta( + &"decor_instance_id", str(placement["instance_id"]) + ) + placement_root.set_meta( + &"decor_owner_fingerprint", owner_fingerprint + ) + placement_root.set_meta(&"decor_id", String(decor_id)) + parent.add_child(placement_root) + var body := _add_box( + placement_root, "BasicCube", BASIC_CUBE_SIZE, + Vector3(0.0, BASIC_CUBE_SIZE.y * 0.5, 0.0), + Color("b77a55"), true, + ) + if body != null: + body.collision_layer = DECOR_SELECTION_COLLISION_LAYER + body.set_meta( + &"decor_instance_id", str(placement["instance_id"]) + ) + body.set_meta( + &"decor_owner_fingerprint", owner_fingerprint + ) + body.set_meta(&"decor_id", String(decor_id)) + _queue_decor_world_collision( + owner_fingerprint, + str(placement["instance_id"]), + decor_id, + body, + ) + _add_box( + placement_root, + "BasicCubeFront", + Vector3(BASIC_CUBE_SIZE.x * 0.82, BASIC_CUBE_SIZE.y * 0.68, 0.025), + Vector3( + 0.0, + BASIC_CUBE_SIZE.y * 0.5, + -BASIC_CUBE_SIZE.z * 0.5 - 0.013, + ), + Color("2897a8"), + false, + ) + + +func _add_wall( + parent: Node3D, + node_name: String, + size: Vector3, + position: Vector3, +) -> void: + _add_box(parent, node_name, size, position, Color("d6caaa"), true) + + +func _add_box( + parent: Node3D, + node_name: String, + size: Vector3, + position: Vector3, + color: Color, + with_collision: bool, + invert_faces: bool = false, +) -> StaticBody3D: + var mesh_instance := MeshInstance3D.new() + mesh_instance.name = node_name + var mesh := BoxMesh.new() + mesh.size = size + mesh.material = _material(color) + if invert_faces: + mesh.flip_faces = true + mesh_instance.mesh = mesh + mesh_instance.position = position + parent.add_child(mesh_instance) + if with_collision: + return _add_box_collision(parent, node_name, size, position) + return null + + +func _add_box_collision( + parent: Node3D, + node_name: String, + size: Vector3, + position: Vector3, +) -> StaticBody3D: + var body := StaticBody3D.new() + body.name = "%sCollision" % node_name + body.position = position + var collision := CollisionShape3D.new() + var shape := BoxShape3D.new() + shape.size = size + collision.shape = shape + body.add_child(collision) + parent.add_child(body) + return body + + +func _spawn_decor_poof( + owner_fingerprint: String, + instance_id: String, +) -> void: + var presentation: Dictionary = _presentations_by_fingerprint.get( + owner_fingerprint, {} + ) + var interior: Node3D = presentation.get("interior") + if not is_instance_valid(interior): + return + var placement_root: Node3D = interior.get_node_or_null( + "Decor/%s" % instance_id + ) + if placement_root == null: + return + var poof := CPUParticles3D.new() + poof.name = "DecorPoof" + poof.amount = 12 + poof.lifetime = 0.45 + poof.one_shot = true + poof.explosiveness = 0.9 + poof.direction = Vector3.UP + poof.spread = 80.0 + poof.initial_velocity_min = 0.7 + poof.initial_velocity_max = 1.5 + poof.scale_amount_min = 0.08 + poof.scale_amount_max = 0.16 + var particle_mesh := SphereMesh.new() + particle_mesh.radius = 0.06 + particle_mesh.height = 0.12 + particle_mesh.material = _material(Color("d9c5a3")) + poof.mesh = particle_mesh + placement_root.add_child(poof) + poof.emitting = true + get_tree().create_timer(poof.lifetime + 0.1).timeout.connect( + poof.queue_free + ) + + +func _material(color: Color) -> StandardMaterial3D: + var material := StandardMaterial3D.new() + material.albedo_color = color + material.roughness = 1.0 + material.shading_mode = BaseMaterial3D.SHADING_MODE_PER_VERTEX + return material + + +func _free_presentation_nodes(presentation: Dictionary) -> void: + for key: String in ["exterior", "interior"]: + var node: Node = presentation.get(key) + if is_instance_valid(node): + node.queue_free() + + +func _refresh_local_visibility() -> void: + var active_fingerprint: String = "" + if String(_local_space).begins_with("rv:"): + active_fingerprint = String(_local_space).trim_prefix("rv:") + if _world != null: + _world.set_local_home_interior_presentation_active( + not active_fingerprint.is_empty() + ) + for fingerprint: String in _presentations_by_fingerprint: + var presentation: Dictionary = _presentations_by_fingerprint[fingerprint] + var interior: Node3D = presentation.get("interior") + if is_instance_valid(interior): + interior.visible = ( + not _dedicated_runtime and fingerprint == active_fingerprint + ) + var exterior: Node3D = presentation.get("exterior") + if is_instance_valid(exterior): + exterior.visible = ( + not _dedicated_runtime and active_fingerprint.is_empty() + ) + var local_player: Player = ( + _spawn_service.get_local_player() + if _spawn_service != null else null + ) + if local_player == null: + return + var excluded_wall_rids: Array[RID] = [] + if not active_fingerprint.is_empty(): + var active: Dictionary = _presentations_by_fingerprint.get( + active_fingerprint, {} + ) + var active_interior: Node3D = active.get("interior") + if is_instance_valid(active_interior): + for wall_name: String in [ + "WallNorth", "WallSouth", "WallWest", "WallEast", + ]: + var body: StaticBody3D = active_interior.get_node_or_null( + "%sCollision" % wall_name + ) + if body != null: + excluded_wall_rids.append(body.get_rid()) + local_player.set_rv_interior_camera_mode( + not active_fingerprint.is_empty(), excluded_wall_rids + ) + + +func _refresh_nearest_wall() -> void: + if not String(_local_space).begins_with("rv:") or _spawn_service == null: + return + var fingerprint: String = String(_local_space).trim_prefix("rv:") + var presentation: Dictionary = _presentations_by_fingerprint.get( + fingerprint, {} + ) + var interior: Node3D = presentation.get("interior") + var player: Player = _spawn_service.get_local_player() + if not is_instance_valid(interior) or player == null: + return + var camera: Camera3D = player.get_active_gameplay_camera() + if camera == null: + return + var local_camera: Vector3 = interior.to_local(camera.global_position) + var local_view_direction: Vector3 = ( + interior.global_basis.inverse() * -camera.global_basis.z + ).normalized() + var horizontal_view_weight: float = absf(local_view_direction.x) + var depth_view_weight: float = absf(local_view_direction.z) + var hidden_walls: Dictionary[String, bool] = {} + var outside_horizontal_wall: bool = ( + absf(local_camera.x) >= INTERIOR_FLOOR_SIZE.x * 0.5 - 0.05 + ) + var outside_depth_wall: bool = ( + absf(local_camera.z) >= INTERIOR_FLOOR_SIZE.z * 0.5 - 0.05 + ) + # At a diagonal, both near walls occupy the view. Use the camera's viewing + # direction to hide both instead of choosing only the dominant position + # axis and leaving the adjacent wall across the screen. + if ( + outside_horizontal_wall + and horizontal_view_weight >= depth_view_weight * 0.35 + ): + hidden_walls[ + "WallEast" if local_camera.x >= 0.0 else "WallWest" + ] = true + if ( + outside_depth_wall + and depth_view_weight >= horizontal_view_weight * 0.35 + ): + hidden_walls[ + "WallSouth" if local_camera.z >= 0.0 else "WallNorth" + ] = true + if hidden_walls.is_empty(): + var fallback_wall: String = ( + "WallEast" if local_camera.x >= 0.0 else "WallWest" + ) + if depth_view_weight > horizontal_view_weight: + fallback_wall = ( + "WallSouth" if local_camera.z >= 0.0 else "WallNorth" + ) + hidden_walls[fallback_wall] = true + for wall_name: String in [ + "WallNorth", "WallSouth", "WallWest", "WallEast", + ]: + var wall: MeshInstance3D = interior.get_node_or_null(wall_name) + if wall != null: + wall.visible = not hidden_walls.has(wall_name) + for child: Node in interior.get_children(): + if ( + child is GeometryInstance3D + and String(child.name).begins_with(wall_name) + ): + (child as GeometryInstance3D).visible = ( + not hidden_walls.has(wall_name) + ) + + +func _too_close_to_reserved( + position: Vector3, + reserved_transforms: Array[Transform3D], +) -> bool: + for transform: Transform3D in reserved_transforms: + if position.distance_to(transform.origin) < MIN_EXTERIOR_SEPARATION: + return true + return false + + +func _set_geometry_visible(root: Node, visible: bool) -> void: + for node: Node in root.find_children("*", "GeometryInstance3D", true, false): + (node as GeometryInstance3D).visible = visible diff --git a/homes/home_world_service.gd.uid b/homes/home_world_service.gd.uid new file mode 100644 index 0000000..5505d06 --- /dev/null +++ b/homes/home_world_service.gd.uid @@ -0,0 +1 @@ +uid://cy2kjoxhwxujd diff --git a/homes/player_home_state.gd b/homes/player_home_state.gd new file mode 100644 index 0000000..decd34a --- /dev/null +++ b/homes/player_home_state.gd @@ -0,0 +1,786 @@ +class_name PlayerHomeState +extends Node + +signal changed + +const DecorCatalogType = preload("res://homes/decor_catalog.gd") + +const HOME_SCHEMA_VERSION: int = 1 +const STARTER_TIER: int = 0 +const STARTER_EXTERIOR_ID: StringName = &"starter_motorcoach" +const MAX_TIER: int = 8 +const MAX_PLACEMENTS: int = 128 +const MAX_INSTANCE_ID_LENGTH: int = 96 +const MAX_REVISION: int = 2147483647 +const GRID_SIZE: float = 0.5 +const FREE_PLACEMENT_SEARCH_STEP: float = 0.1 +const FREE_PLACEMENT_SEARCH_ANGLES: int = 24 +const NEAREST_PLACEMENT_SEARCH_DISTANCE: float = 2.0 +# The starter RV is intentionally cramped. Later RV tiers can replace these +# bounds with larger layouts when tiered interiors are introduced. +# The starter interior is 8.0 m by 4.5 m with 0.18 m walls. These bounds +# follow the walls' inner faces, with a small visual gap to avoid z-fighting. +const INTERIOR_HALF_EXTENTS := Vector2(3.91, 2.16) +const PLACEMENT_EDGE_PADDING: float = 0.02 + +enum Privacy { + OPEN, + CLOSED, +} + +enum PlacementMode { + GRID, + FREE, +} + +var _tier: int = STARTER_TIER +var _exterior_id: StringName = STARTER_EXTERIOR_ID +var _privacy: Privacy = Privacy.OPEN +var _owned_decor: Dictionary[StringName, int] = {} +var _placements: Array[Dictionary] = [] +var _revision: int = 0 +var _next_instance_sequence: int = 1 + + +func get_tier() -> int: + return _tier + + +func get_exterior_id() -> StringName: + return _exterior_id + + +func get_privacy() -> Privacy: + return _privacy + + +func get_revision() -> int: + return _revision + + +func get_owned_count(decor_id: StringName) -> int: + return int(_owned_decor.get(decor_id, 0)) + + +func get_placed_count(decor_id: StringName) -> int: + var count: int = 0 + for placement: Dictionary in _placements: + if StringName(str(placement.get("decor_id", ""))) == decor_id: + count += 1 + return count + + +func get_available_count(decor_id: StringName) -> int: + return maxi( + get_owned_count(decor_id) - get_placed_count(decor_id), + 0, + ) + + +func get_owned_decor() -> Dictionary[StringName, int]: + return _owned_decor.duplicate() + + +func get_placements() -> Array[Dictionary]: + var result: Array[Dictionary] = [] + for placement: Dictionary in _placements: + result.append(placement.duplicate(true)) + return result + + +func get_placement(instance_id: String) -> Dictionary: + var index: int = _placement_index(instance_id) + return _placements[index].duplicate(true) if index >= 0 else {} + + +func can_place_decor( + decor_id: StringName, + position: Vector3, + yaw_radians: float, + mode: PlacementMode, +) -> bool: + if ( + get_available_count(decor_id) <= 0 + or _placements.size() >= MAX_PLACEMENTS + or not _valid_mode(mode) + ): + return false + return not get_nearest_valid_placement_transform( + decor_id, + position, + yaw_radians, + mode, + "", + ).is_empty() + + +func set_privacy(value: Privacy) -> bool: + if value < Privacy.OPEN or value > Privacy.CLOSED: + return false + if _privacy == value: + return true + _privacy = value + _touch() + return true + + +func add_owned_decor( + decor_id: StringName, + quantity: int = 1, +) -> bool: + if ( + not DecorCatalogType.has_product(decor_id) + or quantity <= 0 + ): + return false + var current: int = get_owned_count(decor_id) + if current + quantity > DecorCatalogType.MAX_OWNED_PER_PRODUCT: + return false + _owned_decor[decor_id] = current + quantity + _touch() + return true + + +func remove_owned_decor( + decor_id: StringName, + quantity: int = 1, +) -> bool: + if quantity <= 0: + return false + var current: int = get_owned_count(decor_id) + if current - quantity < get_placed_count(decor_id): + return false + var remaining: int = current - quantity + if remaining < 0: + return false + if remaining == 0: + _owned_decor.erase(decor_id) + else: + _owned_decor[decor_id] = remaining + _touch() + return true + + +func place_decor( + decor_id: StringName, + position: Vector3, + yaw_radians: float, + mode: PlacementMode, +) -> String: + if ( + get_available_count(decor_id) <= 0 + or _placements.size() >= MAX_PLACEMENTS + or not _valid_mode(mode) + ): + return "" + var normalized := get_nearest_valid_placement_transform( + decor_id, + position, + yaw_radians, + mode, + "", + ) + if normalized.is_empty(): + return "" + var instance_id := _make_instance_id() + var placement: Dictionary = { + "instance_id": instance_id, + "decor_id": String(decor_id), + "mode": int(mode), + "position": _vector3_to_array(normalized["position"]), + "yaw": float(normalized["yaw"]), + } + _placements.append(placement) + _touch() + return instance_id + + +func update_placement( + instance_id: String, + position: Vector3, + yaw_radians: float, + mode: PlacementMode, +) -> bool: + var index: int = _placement_index(instance_id) + var normalized: Dictionary = get_valid_update_transform( + instance_id, position, yaw_radians, mode + ) + if index < 0 or normalized.is_empty(): + return false + var placement: Dictionary = _placements[index].duplicate(true) + placement["mode"] = int(mode) + placement["position"] = _vector3_to_array(normalized["position"]) + placement["yaw"] = float(normalized["yaw"]) + _placements[index] = placement + _touch() + return true + + +func get_valid_update_transform( + instance_id: String, + position: Vector3, + yaw_radians: float, + mode: PlacementMode, + candidate_validator: Callable = Callable(), +) -> Dictionary: + var index: int = _placement_index(instance_id) + if index < 0 or not _valid_mode(mode): + return {} + var decor_id := StringName( + str(_placements[index].get("decor_id", "")) + ) + return get_nearest_valid_placement_transform( + decor_id, + position, + yaw_radians, + mode, + instance_id, + candidate_validator, + ) + + +func get_nearest_valid_placement_transform( + decor_id: StringName, + position: Vector3, + yaw_radians: float, + mode: PlacementMode, + ignored_instance_id: String = "", + candidate_validator: Callable = Callable(), +) -> Dictionary: + var normalized: Dictionary = normalized_placement_transform( + decor_id, position, yaw_radians, mode + ) + if normalized.is_empty(): + return {} + if ( + not _overlaps_existing( + decor_id, normalized, ignored_instance_id + ) + and _candidate_is_accepted(normalized, candidate_validator) + ): + return normalized + return ( + _find_nearest_grid_transform( + decor_id, + normalized, + ignored_instance_id, + candidate_validator, + ) + if mode == PlacementMode.GRID + else _find_nearest_free_transform( + decor_id, + normalized, + ignored_instance_id, + candidate_validator, + ) + ) + + +func remove_placement(instance_id: String) -> bool: + var index: int = _placement_index(instance_id) + if index < 0: + return false + _placements.remove_at(index) + _touch() + return true + + +func reset_to_defaults() -> void: + _tier = STARTER_TIER + _exterior_id = STARTER_EXTERIOR_ID + _privacy = Privacy.OPEN + _owned_decor.clear() + _placements.clear() + _revision = 0 + _next_instance_sequence = 1 + changed.emit() + + +func to_save_data() -> Dictionary: + var owned: Dictionary = {} + var ids: Array[StringName] = [] + ids.assign(_owned_decor.keys()) + ids.sort_custom(func(first: StringName, second: StringName) -> bool: + return String(first) < String(second) + ) + for decor_id: StringName in ids: + owned[String(decor_id)] = _owned_decor[decor_id] + return { + "schema_version": HOME_SCHEMA_VERSION, + "tier": _tier, + "exterior_id": String(_exterior_id), + "privacy": int(_privacy), + "owned_decor": owned, + "placements": get_placements(), + "revision": _revision, + "next_instance_sequence": _next_instance_sequence, + } + + +func restore_from_save_data(data: Dictionary) -> bool: + var sanitized: Dictionary = sanitize_save_data(data) + if sanitized.is_empty(): + return false + _tier = int(sanitized["tier"]) + _exterior_id = StringName(str(sanitized["exterior_id"])) + _privacy = int(sanitized["privacy"]) + _owned_decor.clear() + for key: Variant in (sanitized["owned_decor"] as Dictionary): + _owned_decor[StringName(str(key))] = int( + (sanitized["owned_decor"] as Dictionary)[key] + ) + _placements.clear() + for value: Variant in sanitized["placements"] as Array: + _placements.append((value as Dictionary).duplicate(true)) + _revision = int(sanitized["revision"]) + _next_instance_sequence = int(sanitized["next_instance_sequence"]) + changed.emit() + return true + + +static func default_save_data() -> Dictionary: + return { + "schema_version": HOME_SCHEMA_VERSION, + "tier": STARTER_TIER, + "exterior_id": String(STARTER_EXTERIOR_ID), + "privacy": int(Privacy.OPEN), + "owned_decor": {}, + "placements": [], + "revision": 0, + "next_instance_sequence": 1, + } + + +static func sanitize_save_data(data: Dictionary) -> Dictionary: + if ( + not _is_integer_value(data.get("schema_version")) + or int(data.get("schema_version", -1)) != HOME_SCHEMA_VERSION + or not _is_integer_value(data.get("tier")) + or typeof(data.get("exterior_id")) not in [ + TYPE_STRING, TYPE_STRING_NAME, + ] + or not _is_integer_value(data.get("privacy")) + or typeof(data.get("owned_decor")) != TYPE_DICTIONARY + or typeof(data.get("placements")) != TYPE_ARRAY + or not _is_integer_value(data.get("revision")) + or not _is_integer_value(data.get("next_instance_sequence")) + ): + return {} + var tier: int = int(data["tier"]) + var exterior_id: String = str(data["exterior_id"]) + var privacy: int = int(data["privacy"]) + var revision: int = int(data["revision"]) + var next_sequence: int = int(data["next_instance_sequence"]) + if ( + tier < STARTER_TIER + or tier > MAX_TIER + or exterior_id.is_empty() + or exterior_id.length() > 96 + or privacy < Privacy.OPEN + or privacy > Privacy.CLOSED + or revision < 0 + or revision > MAX_REVISION + or next_sequence < 1 + or next_sequence > MAX_REVISION + ): + return {} + var sanitized_owned: Dictionary = {} + var owned: Dictionary = data["owned_decor"] + for key: Variant in owned: + if typeof(key) not in [TYPE_STRING, TYPE_STRING_NAME]: + return {} + var decor_id := StringName(str(key)) + var quantity_value: Variant = owned[key] + if ( + not DecorCatalogType.has_product(decor_id) + or not _is_integer_value(quantity_value) + or int(quantity_value) <= 0 + or int(quantity_value) > DecorCatalogType.MAX_OWNED_PER_PRODUCT + ): + return {} + sanitized_owned[String(decor_id)] = int(quantity_value) + var values: Array = data["placements"] + if values.size() > MAX_PLACEMENTS: + return {} + var sanitized_placements: Array[Dictionary] = [] + var seen_instance_ids: Dictionary[String, bool] = {} + var placed_counts: Dictionary[StringName, int] = {} + for value: Variant in values: + if typeof(value) != TYPE_DICTIONARY: + return {} + var sanitized: Dictionary = sanitize_placement(value) + if sanitized.is_empty(): + return {} + var instance_id: String = str(sanitized["instance_id"]) + var decor_id := StringName(str(sanitized["decor_id"])) + if seen_instance_ids.has(instance_id): + return {} + seen_instance_ids[instance_id] = true + placed_counts[decor_id] = int( + placed_counts.get(decor_id, 0) + ) + 1 + if ( + int(placed_counts[decor_id]) + > int(sanitized_owned.get(String(decor_id), 0)) + ): + return {} + for previous: Dictionary in sanitized_placements: + if placements_overlap(previous, sanitized): + return {} + sanitized_placements.append(sanitized) + return { + "schema_version": HOME_SCHEMA_VERSION, + "tier": tier, + "exterior_id": exterior_id, + "privacy": privacy, + "owned_decor": sanitized_owned, + "placements": sanitized_placements, + "revision": revision, + "next_instance_sequence": next_sequence, + } + + +static func sanitize_placement(value: Dictionary) -> Dictionary: + for key: String in [ + "instance_id", "decor_id", "mode", "position", "yaw", + ]: + if not value.has(key): + return {} + if ( + typeof(value["instance_id"]) != TYPE_STRING + or typeof(value["decor_id"]) not in [ + TYPE_STRING, TYPE_STRING_NAME, + ] + or not _is_integer_value(value["mode"]) + or typeof(value["position"]) != TYPE_ARRAY + or typeof(value["yaw"]) not in [TYPE_FLOAT, TYPE_INT] + ): + return {} + var instance_id: String = value["instance_id"] + var decor_id := StringName(str(value["decor_id"])) + var mode: int = int(value["mode"]) + var position_values: Array = value["position"] + var yaw: float = float(value["yaw"]) + if ( + instance_id.is_empty() + or instance_id.length() > MAX_INSTANCE_ID_LENGTH + or not DecorCatalogType.has_product(decor_id) + or not _valid_mode(mode) + or position_values.size() != 3 + or not is_finite(yaw) + ): + return {} + for component: Variant in position_values: + if typeof(component) not in [TYPE_FLOAT, TYPE_INT]: + return {} + var position := Vector3( + float(position_values[0]), + float(position_values[1]), + float(position_values[2]), + ) + var normalized := normalized_placement_transform( + decor_id, + position, + yaw, + mode as PlacementMode, + ) + if normalized.is_empty(): + return {} + return { + "instance_id": instance_id, + "decor_id": String(decor_id), + "mode": mode, + "position": _vector3_to_array(normalized["position"]), + "yaw": float(normalized["yaw"]), + } + + +static func _is_integer_value(value: Variant) -> bool: + if typeof(value) == TYPE_INT: + return true + if typeof(value) != TYPE_FLOAT: + return false + var number: float = float(value) + return is_finite(number) and is_equal_approx(number, roundf(number)) + + +static func normalized_placement_transform( + decor_id: StringName, + position: Vector3, + yaw_radians: float, + mode: PlacementMode, +) -> Dictionary: + if ( + not DecorCatalogType.has_product(decor_id) + or not position.is_finite() + or not is_finite(yaw_radians) + or not _valid_mode(mode) + ): + return {} + var normalized_position := Vector3(position.x, 0.0, position.z) + var normalized_yaw: float = wrapf(yaw_radians, -PI, PI) + if mode == PlacementMode.GRID: + normalized_position.x = snappedf(normalized_position.x, GRID_SIZE) + normalized_position.z = snappedf(normalized_position.z, GRID_SIZE) + normalized_yaw = snappedf(normalized_yaw, PI * 0.5) + var footprint: Vector2 = DecorCatalogType.get_footprint(decor_id) + var cosine: float = absf(cos(normalized_yaw)) + var sine: float = absf(sin(normalized_yaw)) + var half_size := Vector2( + (footprint.x * cosine + footprint.y * sine) * 0.5, + (footprint.x * sine + footprint.y * cosine) * 0.5, + ) + var maximum_x: float = ( + INTERIOR_HALF_EXTENTS.x - half_size.x - PLACEMENT_EDGE_PADDING + ) + var maximum_z: float = ( + INTERIOR_HALF_EXTENTS.y - half_size.y - PLACEMENT_EDGE_PADDING + ) + if maximum_x < 0.0 or maximum_z < 0.0: + return {} + # Clamp after grid snapping so a grid-placed item can still sit flush at a + # wall even when the wall itself is not on an exact grid interval. + normalized_position.x = clampf( + normalized_position.x, -maximum_x, maximum_x + ) + normalized_position.z = clampf( + normalized_position.z, -maximum_z, maximum_z + ) + return { + "position": normalized_position, + "yaw": normalized_yaw, + } + + +func _find_nearest_grid_transform( + decor_id: StringName, + origin: Dictionary, + ignored_instance_id: String, + candidate_validator: Callable, +) -> Dictionary: + var origin_position: Vector3 = origin["position"] + var yaw: float = float(origin["yaw"]) + var maximum_ring: int = ceili( + NEAREST_PLACEMENT_SEARCH_DISTANCE / GRID_SIZE + ) + var seen: Dictionary[String, bool] = {} + for ring: int in range(1, maximum_ring + 1): + var nearest: Dictionary = {} + var nearest_distance_squared: float = INF + for x_offset: int in range(-ring, ring + 1): + for z_offset: int in range(-ring, ring + 1): + if maxi(absi(x_offset), absi(z_offset)) != ring: + continue + var candidate: Dictionary = normalized_placement_transform( + decor_id, + origin_position + Vector3( + float(x_offset) * GRID_SIZE, + 0.0, + float(z_offset) * GRID_SIZE, + ), + yaw, + PlacementMode.GRID, + ) + if candidate.is_empty() or not _mark_candidate_unseen( + candidate, seen + ): + continue + if _overlaps_existing( + decor_id, candidate, ignored_instance_id + ) or not _candidate_is_accepted( + candidate, candidate_validator + ): + continue + var candidate_position: Vector3 = candidate["position"] + var distance_squared: float = origin_position.distance_squared_to( + candidate_position + ) + if distance_squared < nearest_distance_squared: + nearest = candidate + nearest_distance_squared = distance_squared + if not nearest.is_empty(): + return nearest + return {} + + +func _find_nearest_free_transform( + decor_id: StringName, + origin: Dictionary, + ignored_instance_id: String, + candidate_validator: Callable, +) -> Dictionary: + var origin_position: Vector3 = origin["position"] + var yaw: float = float(origin["yaw"]) + var maximum_ring: int = ceili( + NEAREST_PLACEMENT_SEARCH_DISTANCE / FREE_PLACEMENT_SEARCH_STEP + ) + var seen: Dictionary[String, bool] = {} + for ring: int in range(1, maximum_ring + 1): + var radius: float = float(ring) * FREE_PLACEMENT_SEARCH_STEP + var nearest: Dictionary = {} + var nearest_distance_squared: float = INF + for angle_index: int in FREE_PLACEMENT_SEARCH_ANGLES: + var angle: float = ( + TAU * float(angle_index) / float(FREE_PLACEMENT_SEARCH_ANGLES) + ) + var candidate: Dictionary = normalized_placement_transform( + decor_id, + origin_position + Vector3( + cos(angle) * radius, 0.0, sin(angle) * radius + ), + yaw, + PlacementMode.FREE, + ) + if candidate.is_empty() or not _mark_candidate_unseen( + candidate, seen + ): + continue + if _overlaps_existing( + decor_id, candidate, ignored_instance_id + ) or not _candidate_is_accepted( + candidate, candidate_validator + ): + continue + var candidate_position: Vector3 = candidate["position"] + var distance_squared: float = origin_position.distance_squared_to( + candidate_position + ) + if distance_squared < nearest_distance_squared: + nearest = candidate + nearest_distance_squared = distance_squared + if not nearest.is_empty(): + return nearest + return {} + + +static func _mark_candidate_unseen( + candidate: Dictionary, + seen: Dictionary[String, bool], +) -> bool: + var position: Vector3 = candidate["position"] + var key := "%d:%d" % [ + roundi(position.x * 10000.0), + roundi(position.z * 10000.0), + ] + if seen.has(key): + return false + seen[key] = true + return true + + +static func _candidate_is_accepted( + candidate: Dictionary, + validator: Callable, +) -> bool: + return not validator.is_valid() or bool(validator.call(candidate)) + + +static func placements_overlap(first: Dictionary, second: Dictionary) -> bool: + var first_id := StringName(str(first.get("decor_id", ""))) + var second_id := StringName(str(second.get("decor_id", ""))) + if ( + not DecorCatalogType.has_product(first_id) + or not DecorCatalogType.has_product(second_id) + ): + return true + var first_position: Vector3 = _array_to_vector3(first.get("position", [])) + var second_position: Vector3 = _array_to_vector3(second.get("position", [])) + var first_yaw: float = float(first.get("yaw", 0.0)) + var second_yaw: float = float(second.get("yaw", 0.0)) + var first_half: Vector2 = ( + DecorCatalogType.get_footprint(first_id) * 0.5 + ) + var second_half: Vector2 = ( + DecorCatalogType.get_footprint(second_id) * 0.5 + ) + var first_axes: Array[Vector2] = _placement_axes(first_yaw) + var second_axes: Array[Vector2] = _placement_axes(second_yaw) + var delta := Vector2( + second_position.x - first_position.x, + second_position.z - first_position.z, + ) + for axis: Vector2 in [ + first_axes[0], first_axes[1], second_axes[0], second_axes[1], + ]: + var first_radius: float = ( + absf(axis.dot(first_axes[0])) * first_half.x + + absf(axis.dot(first_axes[1])) * first_half.y + ) + var second_radius: float = ( + absf(axis.dot(second_axes[0])) * second_half.x + + absf(axis.dot(second_axes[1])) * second_half.y + ) + if absf(delta.dot(axis)) >= ( + first_radius + second_radius - 0.001 + ): + return false + return true + + +func _make_instance_id() -> String: + var result := "decor-%d-%d" % [ + Time.get_ticks_usec(), + _next_instance_sequence, + ] + _next_instance_sequence = mini( + _next_instance_sequence + 1, + MAX_REVISION, + ) + return result + + +func _placement_index(instance_id: String) -> int: + if instance_id.is_empty(): + return -1 + for index: int in _placements.size(): + if str(_placements[index].get("instance_id", "")) == instance_id: + return index + return -1 + + +func _overlaps_existing( + decor_id: StringName, + normalized: Dictionary, + ignored_instance_id: String, +) -> bool: + var candidate: Dictionary = { + "decor_id": String(decor_id), + "position": _vector3_to_array(normalized["position"]), + "yaw": float(normalized["yaw"]), + } + for placement: Dictionary in _placements: + if str(placement.get("instance_id", "")) == ignored_instance_id: + continue + if placements_overlap(candidate, placement): + return true + return false + + +func _touch() -> void: + _revision = mini(_revision + 1, MAX_REVISION) + changed.emit() + + +static func _valid_mode(value: int) -> bool: + return value >= PlacementMode.GRID and value <= PlacementMode.FREE + + +static func _vector3_to_array(value: Vector3) -> Array[float]: + return [value.x, value.y, value.z] + + +static func _array_to_vector3(value: Variant) -> Vector3: + if typeof(value) != TYPE_ARRAY or (value as Array).size() != 3: + return Vector3.INF + var components: Array = value + return Vector3( + float(components[0]), + float(components[1]), + float(components[2]), + ) + + +static func _placement_axes(yaw: float) -> Array[Vector2]: + var cosine: float = cos(yaw) + var sine: float = sin(yaw) + return [Vector2(cosine, sine), Vector2(-sine, cosine)] diff --git a/homes/player_home_state.gd.uid b/homes/player_home_state.gd.uid new file mode 100644 index 0000000..37836c6 --- /dev/null +++ b/homes/player_home_state.gd.uid @@ -0,0 +1 @@ +uid://ggfdoak2ixxx diff --git a/inventory/fish_inventory.gd b/inventory/fish_inventory.gd index a4052f5..9318457 100644 --- a/inventory/fish_inventory.gd +++ b/inventory/fish_inventory.gd @@ -9,6 +9,7 @@ signal catches_changed var _catches: Array[FishCatchType] = [] var _next_catch_sequence: int = 1 var _reservation_service: PlayerAssetReservationService +var _inventory_layout: PlayerInventoryLayout func set_reservation_service( @@ -17,11 +18,24 @@ func set_reservation_service( _reservation_service = reservation_service -func add_catch(fish_catch: FishCatchType) -> void: +func set_inventory_layout(layout: PlayerInventoryLayout) -> void: + _inventory_layout = layout + + +func can_accept_catch(catch_id: StringName = StringName()) -> bool: + return ( + _inventory_layout == null + or _inventory_layout.can_accept_catch(catch_id) + ) + + +func add_catch(fish_catch: FishCatchType) -> bool: if fish_catch == null or not fish_catch.is_valid(): - return + return false if get_catch_by_id(fish_catch.catch_id) != null: - return + return false + if not can_accept_catch(fish_catch.catch_id): + return false if fish_catch.catch_sequence <= 0: fish_catch.catch_sequence = _next_catch_sequence _next_catch_sequence = maxi( @@ -34,6 +48,7 @@ func add_catch(fish_catch: FishCatchType) -> void: get_count(fish_catch.fish_id) ) catches_changed.emit() + return true func get_count(fish_id: StringName) -> int: diff --git a/inventory/player_bag.gd b/inventory/player_bag.gd index ffb734d..d94845d 100644 --- a/inventory/player_bag.gd +++ b/inventory/player_bag.gd @@ -6,10 +6,21 @@ const ItemDataType = preload("res://items/item_data.gd") const OwnedItemType = preload("res://items/owned_item.gd") const DEFAULT_UNLOCKED_BAIT_IDS: Array[StringName] = [&"worms"] +const MIN_STORAGE_SLOT_COUNT: int = 15 +const MAX_STORAGE_SLOT_INDEX: int = 254 + +enum StorageGroup { + NONE, + EQUIPMENT, + ITEMS, + BAIT, + LURES, +} signal contents_changed var _catalog: ItemCatalogType +var _inventory_layout: PlayerInventoryLayout var _items: Array[OwnedItemType] = [] var _unlocked_bait_ids: Array[StringName] = ( DEFAULT_UNLOCKED_BAIT_IDS.duplicate() @@ -20,17 +31,28 @@ func setup(catalog: ItemCatalogType) -> void: _catalog = catalog +func set_inventory_layout(layout: PlayerInventoryLayout) -> void: + _inventory_layout = layout + + func add_item(item_id: StringName, quantity: int = 1) -> bool: if not can_add_item(item_id, quantity): return false var item: ItemDataType = _resolve_valid_item(item_id) var existing: OwnedItemType = get_owned_item(item_id) + if ( + existing == null + and _inventory_layout != null + and not _inventory_layout.can_accept_item(item_id) + ): + return false if existing != null: existing.quantity += quantity else: var owned := OwnedItemType.new() owned.item_id = item_id owned.quantity = quantity + owned.storage_slot = _first_available_storage_slot(item, _items) _items.append(owned) if item.is_bait() and not _unlocked_bait_ids.has(item_id): _unlocked_bait_ids.append(item_id) @@ -38,6 +60,28 @@ func add_item(item_id: StringName, quantity: int = 1) -> bool: return true +func add_item_to_storage(item_id: StringName, quantity: int = 1) -> bool: + var existing: OwnedItemType = get_owned_item(item_id) + if existing != null: + return add_item(item_id, quantity) + var item: ItemDataType = _resolve_available_item(item_id) + if ( + item == null + or quantity <= 0 + or quantity > (item.max_stack if item.stackable else 1) + or _inventory_layout == null + or not _inventory_layout.can_accept_item_in_storage(item_id) + ): + return false + var owned := OwnedItemType.new() + owned.item_id = item_id + owned.quantity = quantity + owned.storage_slot = _first_available_storage_slot(item, _items) + _items.append(owned) + contents_changed.emit() + return true + + func can_add_item(item_id: StringName, quantity: int = 1) -> bool: var item: ItemDataType = _resolve_available_item(item_id) if item == null or quantity <= 0: @@ -48,6 +92,11 @@ func can_add_item(item_id: StringName, quantity: int = 1) -> bool: item.stackable and existing.quantity + quantity <= item.max_stack ) + if ( + _inventory_layout != null + and not _inventory_layout.can_accept_item(item_id) + ): + return false return quantity <= (item.max_stack if item.stackable else 1) @@ -92,6 +141,42 @@ func get_all_items() -> Array[OwnedItemType]: return result +func get_storage_slot(item_id: StringName) -> int: + var owned: OwnedItemType = get_owned_item(item_id) + return owned.storage_slot if owned != null else -1 + + +func move_item_to_storage_slot(item_id: StringName, target_slot: int) -> bool: + if target_slot < 0 or target_slot > MAX_STORAGE_SLOT_INDEX: + return false + var owned: OwnedItemType = get_owned_item(item_id) + var item: ItemDataType = _resolve_valid_item(item_id) + var group: StorageGroup = _storage_group_for_item(item) + if owned == null or group == StorageGroup.NONE: + return false + if owned.storage_slot == target_slot: + return true + var displaced: OwnedItemType + for candidate: OwnedItemType in _items: + if candidate == null or candidate == owned: + continue + var candidate_item: ItemDataType = _resolve_valid_item( + candidate.item_id + ) + if ( + _storage_group_for_item(candidate_item) == group + and candidate.storage_slot == target_slot + ): + displaced = candidate + break + var previous_slot: int = owned.storage_slot + owned.storage_slot = target_slot + if displaced != null: + displaced.storage_slot = previous_slot + contents_changed.emit() + return true + + func get_unlocked_bait_ids() -> Array[StringName]: return _unlocked_bait_ids.duplicate() @@ -146,11 +231,84 @@ func replace_all_items(items: Array[OwnedItemType]) -> bool: return false seen[owned.item_id] = true validated.append(owned.duplicate_record()) + _normalize_storage_slots(validated) _items = validated contents_changed.emit() return true +func _normalize_storage_slots(items: Array[OwnedItemType]) -> void: + var occupied: Dictionary[String, bool] = {} + for owned: OwnedItemType in items: + var item: ItemDataType = _resolve_valid_item(owned.item_id) + var group: StorageGroup = _storage_group_for_item(item) + if group == StorageGroup.NONE: + owned.storage_slot = -1 + continue + var key := _storage_slot_key(group, owned.storage_slot) + if ( + owned.storage_slot < 0 + or owned.storage_slot > MAX_STORAGE_SLOT_INDEX + or occupied.has(key) + ): + owned.storage_slot = -1 + continue + occupied[key] = true + for owned: OwnedItemType in items: + if owned.storage_slot >= 0: + continue + var item: ItemDataType = _resolve_valid_item(owned.item_id) + var group: StorageGroup = _storage_group_for_item(item) + if group == StorageGroup.NONE: + continue + for slot_index: int in range(MAX_STORAGE_SLOT_INDEX + 1): + var key := _storage_slot_key(group, slot_index) + if occupied.has(key): + continue + owned.storage_slot = slot_index + occupied[key] = true + break + + +func _first_available_storage_slot( + item: ItemDataType, + items: Array[OwnedItemType], +) -> int: + var group: StorageGroup = _storage_group_for_item(item) + if group == StorageGroup.NONE: + return -1 + var occupied: Dictionary[int, bool] = {} + for owned: OwnedItemType in items: + var owned_item: ItemDataType = _resolve_valid_item(owned.item_id) + if ( + _storage_group_for_item(owned_item) == group + and owned.storage_slot >= 0 + ): + occupied[owned.storage_slot] = true + for slot_index: int in range(MAX_STORAGE_SLOT_INDEX + 1): + if not occupied.has(slot_index): + return slot_index + return -1 + + +func _storage_group_for_item(item: ItemDataType) -> StorageGroup: + if item == null: + return StorageGroup.NONE + if item.is_bait(): + return StorageGroup.BAIT + if item.is_lure(): + return StorageGroup.LURES + return ( + StorageGroup.ITEMS + if item.category == ItemDataType.Category.CONSUMABLE + else StorageGroup.EQUIPMENT + ) + + +func _storage_slot_key(group: StorageGroup, slot_index: int) -> String: + return "%d:%d" % [int(group), slot_index] + + func _resolve_valid_item(item_id: StringName) -> ItemDataType: if _catalog == null: return null diff --git a/inventory/player_hotbar.gd b/inventory/player_hotbar.gd index a71ab68..36068ea 100644 --- a/inventory/player_hotbar.gd +++ b/inventory/player_hotbar.gd @@ -24,6 +24,7 @@ signal selected_assignment_changed( var _bag: PlayerBagType var _catalog: ItemCatalogType var _fish_inventory: FishInventoryType +var _inventory_layout: PlayerInventoryLayout var _slots: Array[StringName] = [] var _fish_slots: Array[StringName] = [] var _selected_slot: int = 0 @@ -40,10 +41,12 @@ func setup( bag: PlayerBagType, catalog: ItemCatalogType, fish_inventory: FishInventoryType = null, + inventory_layout: PlayerInventoryLayout = null, ) -> void: _bag = bag _catalog = catalog _fish_inventory = fish_inventory + _inventory_layout = inventory_layout if _bag != null and not _bag.contents_changed.is_connected( _on_bag_contents_changed ): @@ -55,6 +58,11 @@ func setup( ) ): _fish_inventory.catches_changed.connect(_on_fish_inventory_changed) + if ( + _inventory_layout != null + and not _inventory_layout.layout_changed.is_connected(_validate_assignments) + ): + _inventory_layout.layout_changed.connect(_validate_assignments) _validate_assignments() @@ -63,13 +71,26 @@ func assign_item(slot_index: int, item_id: StringName) -> bool: return false if _slots[slot_index] == item_id: return true + var source_index: int = _slots.find(item_id) + var displaced_item: StringName = _slots[slot_index] + var displaced_fish: StringName = _fish_slots[slot_index] + if ( + _inventory_layout != null + and not _inventory_layout.move_entry( + PlayerInventoryLayout.EntryKind.ITEM, + item_id, + PlayerInventoryLayout.InventoryContainer.HOTBAR, + slot_index, + ) + ): + return false var selected_slot_was_affected: bool = slot_index == _selected_slot - for index: int in range(SLOT_COUNT): - if index != slot_index and _slots[index] == item_id: - _slots[index] = StringName() - selected_slot_was_affected = ( - selected_slot_was_affected or index == _selected_slot - ) + if source_index >= 0 and source_index != slot_index: + _slots[source_index] = displaced_item + _fish_slots[source_index] = displaced_fish + selected_slot_was_affected = ( + selected_slot_was_affected or source_index == _selected_slot + ) _slots[slot_index] = item_id _fish_slots[slot_index] = StringName() slots_changed.emit() @@ -83,13 +104,26 @@ func assign_fish(slot_index: int, catch_id: StringName) -> bool: return false if _fish_slots[slot_index] == catch_id: return true + var source_index: int = _fish_slots.find(catch_id) + var displaced_item: StringName = _slots[slot_index] + var displaced_fish: StringName = _fish_slots[slot_index] + if ( + _inventory_layout != null + and not _inventory_layout.move_entry( + PlayerInventoryLayout.EntryKind.CATCH, + catch_id, + PlayerInventoryLayout.InventoryContainer.HOTBAR, + slot_index, + ) + ): + return false var selected_slot_was_affected: bool = slot_index == _selected_slot - for index: int in range(SLOT_COUNT): - if index != slot_index and _fish_slots[index] == catch_id: - _fish_slots[index] = StringName() - selected_slot_was_affected = ( - selected_slot_was_affected or index == _selected_slot - ) + if source_index >= 0 and source_index != slot_index: + _slots[source_index] = displaced_item + _fish_slots[source_index] = displaced_fish + selected_slot_was_affected = ( + selected_slot_was_affected or source_index == _selected_slot + ) _slots[slot_index] = StringName() _fish_slots[slot_index] = catch_id slots_changed.emit() @@ -107,6 +141,11 @@ func clear_slot(slot_index: int) -> bool: ) ): return false + if ( + _inventory_layout != null + and not _inventory_layout.return_hotbar_entry_to_inventory(slot_index) + ): + return false _slots[slot_index] = StringName() _fish_slots[slot_index] = StringName() slots_changed.emit() @@ -122,6 +161,39 @@ func swap_slots(from_index: int, to_index: int) -> bool: or from_index == to_index ): return false + if _inventory_layout != null: + var kind: PlayerInventoryLayout.EntryKind + var identity: StringName + if not _fish_slots[from_index].is_empty(): + kind = PlayerInventoryLayout.EntryKind.CATCH + identity = _fish_slots[from_index] + elif not _slots[from_index].is_empty(): + kind = PlayerInventoryLayout.EntryKind.ITEM + identity = _slots[from_index] + else: + kind = ( + PlayerInventoryLayout.EntryKind.CATCH + if not _fish_slots[to_index].is_empty() + else PlayerInventoryLayout.EntryKind.ITEM + ) + identity = ( + _fish_slots[to_index] + if not _fish_slots[to_index].is_empty() + else _slots[to_index] + ) + var temporary_index: int = from_index + from_index = to_index + to_index = temporary_index + if ( + identity.is_empty() + or not _inventory_layout.move_entry( + kind, + identity, + PlayerInventoryLayout.InventoryContainer.HOTBAR, + to_index, + ) + ): + return false var temporary: StringName = _slots[from_index] _slots[from_index] = _slots[to_index] _slots[to_index] = temporary @@ -134,6 +206,50 @@ func swap_slots(from_index: int, to_index: int) -> bool: return true +func move_slot_to_container( + slot_index: int, + target_container: int, + target_slot: int, +) -> bool: + if not _is_slot_valid(slot_index) or _inventory_layout == null: + return false + var kind: PlayerInventoryLayout.EntryKind + var identity: StringName + if not _fish_slots[slot_index].is_empty(): + kind = PlayerInventoryLayout.EntryKind.CATCH + identity = _fish_slots[slot_index] + elif not _slots[slot_index].is_empty(): + kind = PlayerInventoryLayout.EntryKind.ITEM + identity = _slots[slot_index] + else: + return false + if not _inventory_layout.move_entry( + kind, + identity, + target_container, + target_slot, + ): + return false + _slots[slot_index] = StringName() + _fish_slots[slot_index] = StringName() + var replacement := _inventory_layout.get_entry_at( + PlayerInventoryLayout.InventoryContainer.HOTBAR, + slot_index, + ) + if not replacement.is_empty(): + var replacement_identity := StringName( + str(replacement.get("identity", "")) + ) + if int(replacement.get("kind", -1)) == PlayerInventoryLayout.EntryKind.CATCH: + _fish_slots[slot_index] = replacement_identity + else: + _slots[slot_index] = replacement_identity + slots_changed.emit() + if slot_index == _selected_slot: + _emit_selected_assignment() + return true + + func select_slot(slot_index: int) -> bool: if not _is_slot_valid(slot_index): return false @@ -198,11 +314,36 @@ func get_fish_slots() -> Array[StringName]: return _fish_slots.duplicate() +func find_item_slot(item_id: StringName) -> int: + return _slots.find(item_id) + + +func find_first_empty_slot() -> int: + for slot_index: int in SLOT_COUNT: + if get_assignment_kind(slot_index) != AssignmentKind.EMPTY: + continue + if ( + _inventory_layout == null + or _inventory_layout.get_key_at( + PlayerInventoryLayout.InventoryContainer.HOTBAR, + slot_index, + ).is_empty() + ): + return slot_index + return -1 + + func replace_state( slots: Array[StringName], selected_slot: int, fish_slots: Array[StringName] = [], + synchronize_layout: bool = true, ) -> bool: + if ( + synchronize_layout and _inventory_layout != null + and not _inventory_layout.return_all_hotbar_entries_to_inventory() + ): + return false var normalized: Array[StringName] = [] normalized.resize(SLOT_COUNT) normalized.fill(StringName()) @@ -227,6 +368,22 @@ func replace_state( seen_fish[catch_id] = true _slots = normalized _fish_slots = normalized_fish + if _inventory_layout != null and synchronize_layout: + for index: int in SLOT_COUNT: + if not _slots[index].is_empty(): + _inventory_layout.move_entry( + PlayerInventoryLayout.EntryKind.ITEM, + _slots[index], + PlayerInventoryLayout.InventoryContainer.HOTBAR, + index, + ) + elif not _fish_slots[index].is_empty(): + _inventory_layout.move_entry( + PlayerInventoryLayout.EntryKind.CATCH, + _fish_slots[index], + PlayerInventoryLayout.InventoryContainer.HOTBAR, + index, + ) _selected_slot = clampi(selected_slot, 0, SLOT_COUNT - 1) slots_changed.emit() _emit_selected_assignment() @@ -249,7 +406,17 @@ func _can_assign(item_id: StringName) -> bool: if _catalog == null: return false var item: ItemDataType = _catalog.get_item_by_id(item_id) - return item != null and item.is_available() and item.hotbar_allowed + return ( + item != null + and item.is_available() + and item.hotbar_allowed + and ( + _inventory_layout == null + or _inventory_layout.get_container( + PlayerInventoryLayout.EntryKind.ITEM, item_id + ) >= 0 + ) + ) func _can_assign_fish(catch_id: StringName) -> bool: @@ -257,6 +424,12 @@ func _can_assign_fish(catch_id: StringName) -> bool: not catch_id.is_empty() and _fish_inventory != null and _fish_inventory.contains_catch_id(catch_id) + and ( + _inventory_layout == null + or _inventory_layout.get_container( + PlayerInventoryLayout.EntryKind.CATCH, catch_id + ) >= 0 + ) ) diff --git a/inventory/player_inventory_layout.gd b/inventory/player_inventory_layout.gd new file mode 100644 index 0000000..bce726e --- /dev/null +++ b/inventory/player_inventory_layout.gd @@ -0,0 +1,599 @@ +class_name PlayerInventoryLayout +extends Node + +const ItemCatalogType = preload("res://items/item_catalog.gd") +const ItemDataType = preload("res://items/item_data.gd") +const PlayerBagType = preload("res://inventory/player_bag.gd") +const FishInventoryType = preload("res://inventory/fish_inventory.gd") +const PlayerCoolerCapacityType = preload( + "res://progression/player_cooler_capacity.gd" +) +const PlayerWalletType = preload("res://economy/player_wallet.gd") + +const INVENTORY_COLUMNS: int = 9 +const INVENTORY_CAPACITIES: Array[int] = [9, 18, 27, 36] +const BACKPACK_EXPANSION_COSTS: Array[int] = [1500, 4500, 9000] +const MAX_BACKPACK_LEVEL: int = 3 +const MAX_INVENTORY_SLOT_COUNT: int = 36 +const MAX_STORAGE_SLOT_COUNT: int = PlayerCoolerCapacityType.MAX_CAPACITY +const HOTBAR_SLOT_COUNT: int = 9 + +enum EntryKind { + ITEM, + CATCH, +} + +enum InventoryContainer { + INVENTORY, + STORAGE, + HOTBAR, +} + +signal layout_changed +signal backpack_capacity_changed(level: int, capacity: int) + +var _bag: PlayerBagType +var _fish_inventory: FishInventoryType +var _item_catalog: ItemCatalogType +var _storage_capacity: PlayerCoolerCapacityType +var _placements: Dictionary[String, Dictionary] = {} +var _prepared_item_placements: Dictionary[String, Dictionary] = {} +var _reconciling: bool = false +var _backpack_level: int = 0 + + +func setup( + bag: PlayerBagType, + fish_inventory: FishInventoryType, + item_catalog: ItemCatalogType, + storage_capacity: PlayerCoolerCapacityType, +) -> void: + _bag = bag + _fish_inventory = fish_inventory + _item_catalog = item_catalog + _storage_capacity = storage_capacity + if _bag != null and not _bag.contents_changed.is_connected(_on_contents_changed): + _bag.contents_changed.connect(_on_contents_changed) + if ( + _fish_inventory != null + and not _fish_inventory.catches_changed.is_connected(_on_contents_changed) + ): + _fish_inventory.catches_changed.connect(_on_contents_changed) + if ( + _storage_capacity != null + and not _storage_capacity.capacity_changed.is_connected( + _on_storage_capacity_changed + ) + ): + _storage_capacity.capacity_changed.connect(_on_storage_capacity_changed) + _reconcile(true) + + +func can_accept_item(item_id: StringName) -> bool: + if not is_managed_item(item_id): + return true + var key := item_key(item_id) + return ( + _placements.has(key) + or _is_prepared_item_placement_available(key) + or _first_free_slot(InventoryContainer.INVENTORY) >= 0 + ) + + +func prepare_new_item_placement( + item_id: StringName, + target_container: InventoryContainer, + target_slot: int, +) -> bool: + if not is_managed_item(item_id): + return false + var key := item_key(item_id) + if ( + _placements.has(key) + or not _is_slot_valid(target_container, target_slot) + or not _key_at(target_container, target_slot).is_empty() + or _prepared_slot_is_occupied(target_container, target_slot) + ): + return false + _prepared_item_placements[key] = { + "container": int(target_container), + "slot": target_slot, + } + return true + + +func cancel_prepared_item_placement(item_id: StringName) -> void: + _prepared_item_placements.erase(item_key(item_id)) + + +func can_accept_item_in_storage(item_id: StringName) -> bool: + if not is_managed_item(item_id): + return true + var key := item_key(item_id) + return _placements.has(key) or _first_free_slot(InventoryContainer.STORAGE) >= 0 + + +func can_accept_catch(catch_id: StringName = StringName()) -> bool: + if not catch_id.is_empty() and _placements.has(catch_key(catch_id)): + return true + return _first_free_slot(InventoryContainer.INVENTORY) >= 0 + + +func is_managed_item(item_id: StringName) -> bool: + var item: ItemDataType = ( + _item_catalog.get_item_by_id(item_id) + if _item_catalog != null else null + ) + return item != null and not item.is_bait() and not item.is_lure() + + +func is_item_in_inventory(item_id: StringName) -> bool: + return _is_entry_in_container(item_key(item_id), InventoryContainer.INVENTORY) + + +func is_catch_in_inventory(catch_id: StringName) -> bool: + return _is_entry_in_container(catch_key(catch_id), InventoryContainer.INVENTORY) + + +func is_item_carried(item_id: StringName) -> bool: + return _is_entry_carried(item_key(item_id)) + + +func is_catch_carried(catch_id: StringName) -> bool: + return _is_entry_carried(catch_key(catch_id)) + + +func get_inventory_count() -> int: + return get_entries(InventoryContainer.INVENTORY).size() + + +func get_inventory_capacity() -> int: + return INVENTORY_CAPACITIES[_backpack_level] + + +func get_backpack_level() -> int: + return _backpack_level + + +func get_next_inventory_capacity() -> int: + if _backpack_level >= MAX_BACKPACK_LEVEL: + return -1 + return INVENTORY_CAPACITIES[_backpack_level + 1] + + +func get_next_backpack_cost() -> int: + if _backpack_level >= MAX_BACKPACK_LEVEL: + return -1 + return BACKPACK_EXPANSION_COSTS[_backpack_level] + + +func can_purchase_backpack(wallet: PlayerWalletType) -> bool: + var cost := get_next_backpack_cost() + return wallet != null and cost >= 0 and wallet.can_afford(cost) + + +func purchase_backpack(wallet: PlayerWalletType) -> bool: + if not can_purchase_backpack(wallet): + return false + var cost := get_next_backpack_cost() + if not wallet.debit(cost): + return false + _backpack_level += 1 + backpack_capacity_changed.emit(_backpack_level, get_inventory_capacity()) + layout_changed.emit() + return true + + +func restore_backpack_level(level: int) -> bool: + var validated := clampi(level, 0, MAX_BACKPACK_LEVEL) + var changed := _backpack_level != validated + _backpack_level = validated + if changed: + backpack_capacity_changed.emit(_backpack_level, get_inventory_capacity()) + _reconcile(changed) + return true + + +func get_storage_count() -> int: + return get_entries(InventoryContainer.STORAGE).size() + + +func get_hotbar_count() -> int: + return get_entries(InventoryContainer.HOTBAR).size() + + +func get_storage_capacity() -> int: + return _storage_capacity.get_capacity() if _storage_capacity != null else 0 + + +func get_entries(container: InventoryContainer) -> Array[Dictionary]: + var entries: Array[Dictionary] = [] + for key: String in _placements: + var placement: Dictionary = _placements[key] + if int(placement.get("container", -1)) != int(container): + continue + var entry: Dictionary = placement.duplicate(true) + entry["key"] = key + entries.append(entry) + entries.sort_custom( + func(left: Dictionary, right: Dictionary) -> bool: + return int(left.get("slot", -1)) < int(right.get("slot", -1)) + ) + return entries + + +func get_entry(kind: EntryKind, identity: StringName) -> Dictionary: + var key := _entry_key(kind, identity) + return _placements.get(key, {}).duplicate(true) + + +func get_container(kind: EntryKind, identity: StringName) -> int: + return int( + get_entry(kind, identity).get("container", -1) + ) + + +func get_key_at(container: InventoryContainer, slot: int) -> String: + return _key_at(container, slot) + + +func get_entry_at(container: InventoryContainer, slot: int) -> Dictionary: + var key := _key_at(container, slot) + if key.is_empty(): + return {} + var entry: Dictionary = _placements[key].duplicate(true) + entry["key"] = key + return entry + + +func move_entry( + kind: EntryKind, + identity: StringName, + target_container: InventoryContainer, + target_slot: int, +) -> bool: + var key := _entry_key(kind, identity) + if not _placements.has(key) or not _is_slot_valid(target_container, target_slot): + return false + var source: Dictionary = _placements[key] + if ( + int(source.get("container", -1)) == int(target_container) + and int(source.get("slot", -1)) == target_slot + ): + return true + var displaced_key := _key_at(target_container, target_slot) + var source_container: int = int(source.get("container", InventoryContainer.INVENTORY)) + var source_slot: int = int(source.get("slot", -1)) + source["container"] = int(target_container) + source["slot"] = target_slot + _placements[key] = source + if not displaced_key.is_empty(): + var displaced: Dictionary = _placements[displaced_key] + displaced["container"] = source_container + displaced["slot"] = source_slot + _placements[displaced_key] = displaced + layout_changed.emit() + return true + + +func move_entry_to_first_free( + kind: EntryKind, + identity: StringName, + target_container: InventoryContainer, +) -> bool: + var slot := _first_free_slot(target_container) + return slot >= 0 and move_entry(kind, identity, target_container, slot) + + +func return_hotbar_entry_to_inventory(slot: int) -> bool: + var key := _key_at(InventoryContainer.HOTBAR, slot) + if key.is_empty(): + return true + var placement: Dictionary = _placements[key] + return move_entry_to_first_free( + int(placement.get("kind", -1)) as EntryKind, + StringName(str(placement.get("identity", ""))), + InventoryContainer.INVENTORY, + ) + + +func return_all_hotbar_entries_to_inventory() -> bool: + var entries := get_entries(InventoryContainer.HOTBAR) + if get_inventory_count() + entries.size() > get_inventory_capacity(): + return false + for entry: Dictionary in entries: + if not move_entry_to_first_free( + int(entry.get("kind", -1)) as EntryKind, + StringName(str(entry.get("identity", ""))), + InventoryContainer.INVENTORY, + ): + return false + return true + + +func to_save_data() -> Dictionary: + var serialized: Array[Dictionary] = [] + var keys: Array[String] = [] + keys.assign(_placements.keys()) + keys.sort() + for key: String in keys: + var placement: Dictionary = _placements[key] + serialized.append({ + "kind": int(placement.get("kind", EntryKind.ITEM)), + "identity": str(placement.get("identity", "")), + "container": int(placement.get("container", InventoryContainer.INVENTORY)), + "slot": int(placement.get("slot", -1)), + }) + return { + "backpack_level": _backpack_level, + "placements": serialized, + } + + +func restore_from_save_data(data: Dictionary) -> bool: + var level_value: Variant = data.get("backpack_level", 0) + if ( + typeof(level_value) not in [TYPE_INT, TYPE_FLOAT] + or not is_equal_approx(float(level_value), floorf(float(level_value))) + ): + return false + _backpack_level = clampi(int(level_value), 0, MAX_BACKPACK_LEVEL) + var restored: Dictionary[String, Dictionary] = {} + var values: Variant = data.get("placements", []) + if typeof(values) != TYPE_ARRAY: + return false + for value: Variant in values as Array: + if typeof(value) != TYPE_DICTIONARY: + continue + var record := value as Dictionary + var kind: int = int(record.get("kind", -1)) + var identity := StringName(str(record.get("identity", ""))) + var container: int = int(record.get("container", -1)) + var slot: int = int(record.get("slot", -1)) + if ( + kind not in [EntryKind.ITEM, EntryKind.CATCH] + or identity.is_empty() + or container not in [ + InventoryContainer.INVENTORY, + InventoryContainer.STORAGE, + InventoryContainer.HOTBAR, + ] + or not _is_slot_valid(container as InventoryContainer, slot) + ): + continue + var key := _entry_key(kind as EntryKind, identity) + if restored.has(key) or _placement_slot_occupied(restored, container, slot): + continue + restored[key] = { + "kind": kind, + "identity": identity, + "container": container, + "slot": slot, + } + _prepared_item_placements.clear() + _placements = restored + _reconcile(true) + return true + + +func reset_to_defaults() -> void: + var capacity_changed := _backpack_level != 0 + _backpack_level = 0 + _prepared_item_placements.clear() + _placements.clear() + _reconcile(true) + if capacity_changed: + backpack_capacity_changed.emit(_backpack_level, get_inventory_capacity()) + + +static func item_key(item_id: StringName) -> String: + return "item:%s" % String(item_id) + + +static func catch_key(catch_id: StringName) -> String: + return "catch:%s" % String(catch_id) + + +func _entry_key(kind: EntryKind, identity: StringName) -> String: + return item_key(identity) if kind == EntryKind.ITEM else catch_key(identity) + + +func _is_entry_in_container(key: String, container: InventoryContainer) -> bool: + var placement: Dictionary = _placements.get(key, {}) + return int(placement.get("container", -1)) == int(container) + + +func _is_entry_carried(key: String) -> bool: + var placement: Dictionary = _placements.get(key, {}) + var container: int = int(placement.get("container", -1)) + return container in [InventoryContainer.INVENTORY, InventoryContainer.HOTBAR] + + +func _on_contents_changed() -> void: + _reconcile(false) + + +func _on_storage_capacity_changed(_level: int, _capacity: int) -> void: + _reconcile(true) + + +func _reconcile(force_signal: bool) -> void: + if _reconciling or _bag == null or _fish_inventory == null: + return + _reconciling = true + var expected: Dictionary[String, Dictionary] = {} + for owned in _bag.get_all_items(): + if owned == null or not is_managed_item(owned.item_id): + continue + var key := item_key(owned.item_id) + expected[key] = {"kind": EntryKind.ITEM, "identity": owned.item_id} + for fish_catch in _fish_inventory.get_all_catches(): + if fish_catch == null or not fish_catch.is_valid(): + continue + var key := catch_key(fish_catch.catch_id) + expected[key] = {"kind": EntryKind.CATCH, "identity": fish_catch.catch_id} + var changed: bool = false + for key: String in _placements.keys(): + if expected.has(key): + continue + _placements.erase(key) + changed = true + _normalize_existing_placements() + for key: String in expected: + if _placements.has(key): + continue + var prepared: Dictionary = _prepared_item_placements.get(key, {}) + var target_container := InventoryContainer.INVENTORY + var target_slot: int = -1 + if _is_prepared_item_placement_available(key): + target_container = int( + prepared["container"] + ) as InventoryContainer + target_slot = int(prepared["slot"]) + _prepared_item_placements.erase(key) + if target_slot < 0: + target_slot = _first_free_slot(target_container) + if target_slot < 0: + target_container = InventoryContainer.STORAGE + target_slot = _first_free_slot(target_container) + if target_slot < 0: + push_error("Inventory and storage cannot fit owned entry '%s'." % key) + continue + var placement: Dictionary = expected[key].duplicate(true) + placement["container"] = int(target_container) + placement["slot"] = target_slot + _placements[key] = placement + changed = true + _reconciling = false + if changed or force_signal: + layout_changed.emit() + + +func _normalize_existing_placements() -> void: + var occupied_inventory: Dictionary[int, bool] = {} + var occupied_storage: Dictionary[int, bool] = {} + var occupied_hotbar: Dictionary[int, bool] = {} + var invalid_keys: Array[String] = [] + var keys: Array[String] = [] + keys.assign(_placements.keys()) + keys.sort() + for key: String in keys: + var placement: Dictionary = _placements[key] + var container: int = int(placement.get("container", -1)) + var slot: int = int(placement.get("slot", -1)) + var occupied: Dictionary[int, bool] + match container: + InventoryContainer.INVENTORY: + occupied = occupied_inventory + InventoryContainer.STORAGE: + occupied = occupied_storage + InventoryContainer.HOTBAR: + occupied = occupied_hotbar + _: + occupied = {} + if ( + container not in [ + InventoryContainer.INVENTORY, + InventoryContainer.STORAGE, + InventoryContainer.HOTBAR, + ] + or not _is_slot_valid(container as InventoryContainer, slot) + or occupied.has(slot) + ): + invalid_keys.append(key) + continue + occupied[slot] = true + for key: String in invalid_keys: + # Invalid records must stop occupying their old slot before free-space + # lookup. Otherwise a duplicate can incorrectly reserve a valid slot. + var placement: Dictionary = _placements[key] + _placements.erase(key) + var target := InventoryContainer.INVENTORY + var slot := _first_free_slot(target) + if slot < 0: + target = InventoryContainer.STORAGE + slot = _first_free_slot(target) + if slot < 0: + _placements.erase(key) + continue + placement["container"] = int(target) + placement["slot"] = slot + _placements[key] = placement + + +func _first_free_slot(container: InventoryContainer) -> int: + var capacity := ( + get_inventory_capacity() if container == InventoryContainer.INVENTORY + else HOTBAR_SLOT_COUNT if container == InventoryContainer.HOTBAR + else get_storage_capacity() + ) + for slot: int in capacity: + if _key_at(container, slot).is_empty(): + return slot + return -1 + + +func _is_prepared_item_placement_available(key: String) -> bool: + var placement: Dictionary = _prepared_item_placements.get(key, {}) + if placement.is_empty(): + return false + var container: int = int(placement.get("container", -1)) + var slot: int = int(placement.get("slot", -1)) + if ( + container not in [ + InventoryContainer.INVENTORY, + InventoryContainer.STORAGE, + InventoryContainer.HOTBAR, + ] + or not _is_slot_valid(container as InventoryContainer, slot) + ): + return false + return _key_at(container as InventoryContainer, slot).is_empty() + + +func _prepared_slot_is_occupied( + container: InventoryContainer, + slot: int, +) -> bool: + for placement: Dictionary in _prepared_item_placements.values(): + if ( + int(placement.get("container", -1)) == int(container) + and int(placement.get("slot", -1)) == slot + ): + return true + return false + + +func _key_at(container: InventoryContainer, slot: int) -> String: + for key: String in _placements: + var placement: Dictionary = _placements[key] + if ( + int(placement.get("container", -1)) == int(container) + and int(placement.get("slot", -1)) == slot + ): + return key + return "" + + +func _is_slot_valid(container: InventoryContainer, slot: int) -> bool: + if slot < 0: + return false + return slot < ( + get_inventory_capacity() if container == InventoryContainer.INVENTORY + else HOTBAR_SLOT_COUNT if container == InventoryContainer.HOTBAR + else get_storage_capacity() + ) + + +func _placement_slot_occupied( + placements: Dictionary[String, Dictionary], + container: int, + slot: int, +) -> bool: + for placement: Dictionary in placements.values(): + if ( + int(placement.get("container", -1)) == container + and int(placement.get("slot", -1)) == slot + ): + return true + return false diff --git a/inventory/player_inventory_layout.gd.uid b/inventory/player_inventory_layout.gd.uid new file mode 100644 index 0000000..debd549 --- /dev/null +++ b/inventory/player_inventory_layout.gd.uid @@ -0,0 +1 @@ +uid://c5cku54c6qgmw diff --git a/items/catalog/basic_cube.tres b/items/catalog/basic_cube.tres new file mode 100644 index 0000000..86a2cf9 --- /dev/null +++ b/items/catalog/basic_cube.tres @@ -0,0 +1,17 @@ +[gd_resource type="Resource" script_class="ItemData" load_steps=3 format=3] + +[ext_resource type="Script" path="res://items/item_data.gd" id="1_item"] +[ext_resource type="Texture2D" path="res://ui/icons/pictograms/x_light.png" id="2_icon"] + +[resource] +script = ExtResource("1_item") +item_id = &"basic_cube" +display_name = "basic cube" +description = "a simple piece of decor for testing your RV layout." +category = 6 +icon = ExtResource("2_icon") +stackable = true +max_stack = 32 +usable = false +equippable = true +hotbar_allowed = true diff --git a/items/catalog/crab_net.tres b/items/catalog/crab_net.tres index 2ed3cb0..a6e26b0 100644 --- a/items/catalog/crab_net.tres +++ b/items/catalog/crab_net.tres @@ -1,7 +1,7 @@ [gd_resource type="Resource" script_class="ItemData" load_steps=3 format=3] [ext_resource type="Script" path="res://items/item_data.gd" id="1_item"] -[ext_resource type="Texture2D" path="res://items/icons/equipment/temp_net.png" id="2_icon"] +[ext_resource type="Texture2D" path="res://items/icons/equipment/net.png" id="2_icon"] [resource] script = ExtResource("1_item") diff --git a/items/catalog/fishing_net.tres b/items/catalog/fishing_net.tres new file mode 100644 index 0000000..04b1919 --- /dev/null +++ b/items/catalog/fishing_net.tres @@ -0,0 +1,16 @@ +[gd_resource type="Resource" script_class="ItemData" load_steps=2 format=3] + +[ext_resource type="Script" path="res://items/item_data.gd" id="1_item"] + +[resource] +script = ExtResource("1_item") +item_id = &"fishing_net" +display_name = "fishing net" +description = "a placeable water net reserved for a future passive fishing system." +active = true +category = 1 +stackable = false +max_stack = 1 +usable = false +equippable = false +hotbar_allowed = false diff --git a/items/catalog/item_catalog.tres b/items/catalog/item_catalog.tres index 1715678..2f15e0a 100644 --- a/items/catalog/item_catalog.tres +++ b/items/catalog/item_catalog.tres @@ -1,4 +1,4 @@ -[gd_resource type="Resource" script_class="ItemCatalog" load_steps=39 format=3] +[gd_resource type="Resource" script_class="ItemCatalog" load_steps=42 format=3] [ext_resource type="Script" path="res://items/item_catalog.gd" id="1_script"] [ext_resource type="Resource" path="res://items/catalog/basic_fishing_rod.tres" id="2_rod"] @@ -38,7 +38,10 @@ [ext_resource type="Resource" path="res://items/catalog/rods/aurora_rod.tres" id="37_aurora"] [ext_resource type="Resource" path="res://items/catalog/magnet.tres" id="38_magnet"] [ext_resource type="Resource" path="res://items/catalog/crab_net.tres" id="39_crab_net"] +[ext_resource type="Resource" path="res://items/catalog/standard_shovel.tres" id="40_shovel"] +[ext_resource type="Resource" path="res://items/catalog/fishing_net.tres" id="41_fishing_net"] +[ext_resource type="Resource" path="res://items/catalog/basic_cube.tres" id="42_basic_cube"] [resource] script = ExtResource("1_script") -items = [ExtResource("2_rod"), ExtResource("3_coffee"), ExtResource("4_energy"), ExtResource("5_snack"), ExtResource("6_finder"), ExtResource("8_art_kit"), ExtResource("9_worms"), ExtResource("10_snails"), ExtResource("11_shrimp"), ExtResource("12_squid"), ExtResource("14_sardine"), ExtResource("13_anchovy"), ExtResource("15_roe"), ExtResource("16_standby"), ExtResource("17_batteries"), ExtResource("18_cardboard"), ExtResource("19_pond"), ExtResource("20_river"), ExtResource("21_lake"), ExtResource("22_salt"), ExtResource("23_whisker"), ExtResource("24_reef"), ExtResource("25_moonbeam"), ExtResource("26_sun"), ExtResource("27_rain"), ExtResource("28_fog"), ExtResource("29_guide"), ExtResource("30_small"), ExtResource("31_heavy"), ExtResource("32_rocket"), ExtResource("33_lucky"), ExtResource("34_showboat"), ExtResource("35_deep"), ExtResource("36_oddity"), ExtResource("37_aurora"), ExtResource("38_magnet"), ExtResource("39_crab_net")] +items = [ExtResource("2_rod"), ExtResource("3_coffee"), ExtResource("4_energy"), ExtResource("5_snack"), ExtResource("6_finder"), ExtResource("8_art_kit"), ExtResource("9_worms"), ExtResource("10_snails"), ExtResource("11_shrimp"), ExtResource("12_squid"), ExtResource("14_sardine"), ExtResource("13_anchovy"), ExtResource("15_roe"), ExtResource("16_standby"), ExtResource("17_batteries"), ExtResource("18_cardboard"), ExtResource("19_pond"), ExtResource("20_river"), ExtResource("21_lake"), ExtResource("22_salt"), ExtResource("23_whisker"), ExtResource("24_reef"), ExtResource("25_moonbeam"), ExtResource("26_sun"), ExtResource("27_rain"), ExtResource("28_fog"), ExtResource("29_guide"), ExtResource("30_small"), ExtResource("31_heavy"), ExtResource("32_rocket"), ExtResource("33_lucky"), ExtResource("34_showboat"), ExtResource("35_deep"), ExtResource("36_oddity"), ExtResource("37_aurora"), ExtResource("38_magnet"), ExtResource("39_crab_net"), ExtResource("40_shovel"), ExtResource("41_fishing_net"), ExtResource("42_basic_cube")] diff --git a/items/catalog/standard_shovel.tres b/items/catalog/standard_shovel.tres new file mode 100644 index 0000000..b30589c --- /dev/null +++ b/items/catalog/standard_shovel.tres @@ -0,0 +1,18 @@ +[gd_resource type="Resource" script_class="ItemData" load_steps=3 format=3] + +[ext_resource type="Script" path="res://items/item_data.gd" id="1_item"] +[ext_resource type="Texture2D" path="res://items/icons/equipment/shovel.png" id="2_icon"] + +[resource] +script = ExtResource("1_item") +item_id = &"standard_shovel" +display_name = "standard shovel" +description = "a sturdy shovel for digging up buried finds on the beach." +active = true +category = 1 +icon = ExtResource("2_icon") +stackable = false +max_stack = 1 +usable = false +equippable = true +hotbar_allowed = true diff --git a/items/icons/equipment/64_cooler_plus.png b/items/icons/equipment/64_cooler_plus.png deleted file mode 100644 index f81648d..0000000 Binary files a/items/icons/equipment/64_cooler_plus.png and /dev/null differ diff --git a/items/icons/equipment/net.png b/items/icons/equipment/net.png new file mode 100644 index 0000000..522dd65 Binary files /dev/null and b/items/icons/equipment/net.png differ diff --git a/items/icons/equipment/net.png.import b/items/icons/equipment/net.png.import new file mode 100644 index 0000000..e32d295 --- /dev/null +++ b/items/icons/equipment/net.png.import @@ -0,0 +1,40 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://c026rqygllmst" +path="res://.godot/imported/net.png-695e6b1511b4d1d2f6c885df7ccf0412.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://items/icons/equipment/net.png" +dest_files=["res://.godot/imported/net.png-695e6b1511b4d1d2f6c885df7ccf0412.ctex"] + +[params] + +compress/mode=0 +compress/high_quality=false +compress/lossy_quality=0.7 +compress/uastc_level=0 +compress/rdo_quality_loss=0.0 +compress/hdr_compression=1 +compress/normal_map=0 +compress/channel_pack=0 +mipmaps/generate=false +mipmaps/limit=-1 +roughness/mode=0 +roughness/src_normal="" +process/channel_remap/red=0 +process/channel_remap/green=1 +process/channel_remap/blue=2 +process/channel_remap/alpha=3 +process/fix_alpha_border=true +process/premult_alpha=false +process/normal_map_invert_y=false +process/hdr_as_srgb=false +process/hdr_clamp_exposure=false +process/size_limit=0 +detect_3d/compress_to=1 diff --git a/items/icons/equipment/shovel.png b/items/icons/equipment/shovel.png new file mode 100644 index 0000000..089f30c Binary files /dev/null and b/items/icons/equipment/shovel.png differ diff --git a/items/icons/equipment/shovel.png.import b/items/icons/equipment/shovel.png.import new file mode 100644 index 0000000..093a093 --- /dev/null +++ b/items/icons/equipment/shovel.png.import @@ -0,0 +1,40 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://cabeaw2e0glu" +path="res://.godot/imported/shovel.png-cdfb898e33414742110b8f36a05aceb3.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://items/icons/equipment/shovel.png" +dest_files=["res://.godot/imported/shovel.png-cdfb898e33414742110b8f36a05aceb3.ctex"] + +[params] + +compress/mode=0 +compress/high_quality=false +compress/lossy_quality=0.7 +compress/uastc_level=0 +compress/rdo_quality_loss=0.0 +compress/hdr_compression=1 +compress/normal_map=0 +compress/channel_pack=0 +mipmaps/generate=false +mipmaps/limit=-1 +roughness/mode=0 +roughness/src_normal="" +process/channel_remap/red=0 +process/channel_remap/green=1 +process/channel_remap/blue=2 +process/channel_remap/alpha=3 +process/fix_alpha_border=true +process/premult_alpha=false +process/normal_map_invert_y=false +process/hdr_as_srgb=false +process/hdr_clamp_exposure=false +process/size_limit=0 +detect_3d/compress_to=1 diff --git a/items/icons/shop/64_power_plus.png b/items/icons/shop/64_power_plus.png deleted file mode 100644 index 7daf62f..0000000 Binary files a/items/icons/shop/64_power_plus.png and /dev/null differ diff --git a/items/icons/shop/64_speed_plus.png b/items/icons/shop/64_speed_plus.png deleted file mode 100644 index de74e81..0000000 Binary files a/items/icons/shop/64_speed_plus.png and /dev/null differ diff --git a/items/owned_item.gd b/items/owned_item.gd index ead5b34..ade8cd1 100644 --- a/items/owned_item.gd +++ b/items/owned_item.gd @@ -1,12 +1,20 @@ class_name OwnedItem extends Resource +const MAX_STORAGE_SLOT_INDEX: int = 254 + @export var item_id: StringName @export var quantity: int = 1 +@export var storage_slot: int = -1 func is_valid() -> bool: - return not item_id.is_empty() and quantity > 0 + return ( + not item_id.is_empty() + and quantity > 0 + and storage_slot >= -1 + and storage_slot <= MAX_STORAGE_SLOT_INDEX + ) func duplicate_record(): @@ -17,4 +25,5 @@ func to_save_dict() -> Dictionary: return { "item_id": String(item_id), "quantity": quantity, + "storage_slot": storage_slot, } diff --git a/jobs/job_catalog.gd b/jobs/job_catalog.gd index 0b9c717..eb3ea02 100644 --- a/jobs/job_catalog.gd +++ b/jobs/job_catalog.gd @@ -14,6 +14,9 @@ enum Kind { REACH_LEVEL, DISCOVER_SPECIES, MASTER_QUALITIES, + CATCH_CREATURE_GROUP, + DISCOVER_CREATURE_GROUP, + MASTER_CREATURE_GROUP, } const DAILY_JOB_COUNT: int = 4 @@ -23,6 +26,8 @@ const WEATHER_SEGMENT_HOURS: float = ( const WEATHER_SEGMENT_COUNT: int = ( WorldWeatherService.DAILY_PLAN_SEGMENT_COUNT ) +const LEGACY_WEATHER_SEGMENT_HOURS: float = 2.0 +const LEGACY_WEATHER_SEGMENT_COUNT: int = 12 const MAX_JOB_REWARD_COINS: int = 100000 const MAX_JOB_REWARD_EXPERIENCE: int = 10000 @@ -109,6 +114,28 @@ static func generate_daily_jobs( 50, {"fish_id": String(selected.id)}, )) + if _has_creature_group(candidates, FishDataType.CreatureGroup.INSECT): + optional.append(_job( + "insect_roundup", + "bug hunt", + "catch 3 insects", + Kind.CATCH_CREATURE_GROUP, + 3, + 40, + 50, + {"creature_group": int(FishDataType.CreatureGroup.INSECT)}, + )) + if _has_creature_group(candidates, FishDataType.CreatureGroup.SHELLFISH): + optional.append(_job( + "shellfish_search", + "shore patrol", + "catch 3 shellfish", + Kind.CATCH_CREATURE_GROUP, + 3, + 45, + 50, + {"creature_group": int(FishDataType.CreatureGroup.SHELLFISH)}, + )) _shuffle(optional, rng) while jobs.size() < DAILY_JOB_COUNT and not optional.is_empty(): jobs.append(optional.pop_back()) @@ -170,6 +197,8 @@ static func generate_weather_schedule( static func lifetime_chains( registered_species_count: int, + registered_insect_count: int = 0, + registered_shellfish_count: int = 0, ) -> Array[Dictionary]: var chains: Array[Dictionary] = [ _chain("catch", Kind.CATCH_TOTAL, [100, 1000, 5000], [ @@ -195,15 +224,33 @@ static func lifetime_chains( [registered_species_count], [[1500, 2000]], )) + _append_creature_lifetime_chains( + chains, + "insect", + FishDataType.CreatureGroup.INSECT, + registered_insect_count, + ) + _append_creature_lifetime_chains( + chains, + "shellfish", + FishDataType.CreatureGroup.SHELLFISH, + registered_shellfish_count, + ) return chains static func visible_lifetime_jobs( registered_species_count: int, claimed_ids: Array[String], + registered_insect_count: int = 0, + registered_shellfish_count: int = 0, ) -> Array[Dictionary]: var visible: Array[Dictionary] = [] - for chain: Dictionary in lifetime_chains(registered_species_count): + for chain: Dictionary in lifetime_chains( + registered_species_count, + registered_insect_count, + registered_shellfish_count, + ): var targets: Array = chain.get("targets", []) var rewards: Array = chain.get("rewards", []) for tier_index: int in targets.size(): @@ -214,6 +261,9 @@ static func visible_lifetime_jobs( if job_id in claimed_ids: continue var reward: Array = rewards[tier_index] + var extra: Dictionary = {} + if chain.has("creature_group"): + extra["creature_group"] = int(chain["creature_group"]) visible.append(_job( job_id, _lifetime_title(str(chain.get("id", "")), int(targets[tier_index])), @@ -224,6 +274,7 @@ static func visible_lifetime_jobs( int(targets[tier_index]), int(reward[0]), int(reward[1]), + extra, )) break return visible @@ -254,10 +305,10 @@ static func is_valid_job(value: Variant) -> bool: and typeof(job.get("description")) == TYPE_STRING and str(job["description"]).length() <= 160 and is_bounded_integer( - job.get("kind"), Kind.CATCH_TOTAL, Kind.MASTER_QUALITIES + job.get("kind"), Kind.CATCH_TOTAL, Kind.MASTER_CREATURE_GROUP ) and kind >= Kind.CATCH_TOTAL - and kind <= Kind.MASTER_QUALITIES + and kind <= Kind.MASTER_CREATURE_GROUP and is_bounded_integer(job.get("target"), 1, 1000000000) and is_bounded_integer( job.get("fish_coin"), 0, MAX_JOB_REWARD_COINS @@ -316,6 +367,12 @@ static func is_valid_job(value: Variant) -> bool: and not str(job.get("fish_id", "")).is_empty() and str(job.get("fish_id", "")).length() <= 96 ) + Kind.CATCH_CREATURE_GROUP, Kind.DISCOVER_CREATURE_GROUP, Kind.MASTER_CREATURE_GROUP: + return is_bounded_integer( + job.get("creature_group"), + FishDataType.CreatureGroup.FISH, + FishDataType.CreatureGroup.SHELLFISH, + ) return true @@ -341,6 +398,36 @@ static func is_valid_weather_schedule(value: Variant) -> bool: return WorldWeatherService.is_valid_daily_plan_schedule(value) +static func is_valid_legacy_weather_schedule(value: Variant) -> bool: + if typeof(value) != TYPE_ARRAY: + return false + var schedule: Array = value + if schedule.size() != LEGACY_WEATHER_SEGMENT_COUNT: + return false + for index: int in schedule.size(): + if typeof(schedule[index]) != TYPE_DICTIONARY: + return false + var entry: Dictionary = schedule[index] + var expected_hour: float = fposmod( + WorldTimeService.DAY_START_HOUR + + float(index) * LEGACY_WEATHER_SEGMENT_HOURS, + WorldTimeService.HOURS_PER_DAY, + ) + if ( + typeof(entry.get("start_hour")) not in [TYPE_FLOAT, TYPE_INT] + or not is_equal_approx( + float(entry.get("start_hour", -1.0)), expected_hour + ) + or not is_bounded_integer( + entry.get("weather"), + WorldWeatherService.Weather.SUNNY, + WorldWeatherService.Weather.FOGGY, + ) + ): + return false + return true + + static func _job( id: String, title: String, @@ -369,13 +456,16 @@ static func _chain( kind: Kind, targets: Array[int], rewards: Array, + extra: Dictionary = {}, ) -> Dictionary: - return { + var result: Dictionary = { "id": id, "kind": int(kind), "targets": targets, "rewards": rewards, } + result.merge(extra, true) + return result static func _lifetime_title(chain_id: String, target: int) -> String: @@ -390,6 +480,18 @@ static func _lifetime_title(chain_id: String, target: int) -> String: return "complete the catalog" "master": return "quality master" + "insect_catch": + return "seasoned bug catcher" + "insect_discover": + return "complete the insect catalog" + "insect_master": + return "insect quality master" + "shellfish_catch": + return "seasoned beachcomber" + "shellfish_discover": + return "complete the shellfish catalog" + "shellfish_master": + return "shellfish quality master" return "long-term job" @@ -405,9 +507,67 @@ static func _lifetime_description(chain_id: String, target: int) -> String: return "discover all %d cataloged fish" % target "master": return "collect every quality of all %d fish" % target + "insect_catch": + return "catch %d insects" % target + "insect_discover": + return "discover all %d cataloged insects" % target + "insect_master": + return "collect every quality of all %d insects" % target + "shellfish_catch": + return "catch %d shellfish" % target + "shellfish_discover": + return "discover all %d cataloged shellfish" % target + "shellfish_master": + return "collect every quality of all %d shellfish" % target return "keep fishing" +static func _has_creature_group( + candidates: Array[FishDataType], + creature_group: FishDataType.CreatureGroup, +) -> bool: + for fish: FishDataType in candidates: + if ( + fish != null + and fish.is_selectable() + and fish.get_creature_group() == creature_group + ): + return true + return false + + +static func _append_creature_lifetime_chains( + chains: Array[Dictionary], + id_prefix: String, + creature_group: FishDataType.CreatureGroup, + registered_count: int, +) -> void: + if registered_count <= 0: + return + var group_data := {"creature_group": int(creature_group)} + chains.append(_chain( + "%s_catch" % id_prefix, + Kind.CATCH_CREATURE_GROUP, + [10, 50, 250], + [[75, 100], [250, 350], [900, 1100]], + group_data, + )) + chains.append(_chain( + "%s_discover" % id_prefix, + Kind.DISCOVER_CREATURE_GROUP, + [registered_count], + [[250, 350]], + group_data, + )) + chains.append(_chain( + "%s_master" % id_prefix, + Kind.MASTER_CREATURE_GROUP, + [registered_count], + [[750, 1000]], + group_data, + )) + + static func _shuffle(values: Array[Dictionary], rng: RandomNumberGenerator) -> void: for index: int in range(values.size() - 1, 0, -1): var swap_index: int = rng.randi_range(0, index) diff --git a/jobs/player_job_service.gd b/jobs/player_job_service.gd index 684c5ea..7ede866 100644 --- a/jobs/player_job_service.gd +++ b/jobs/player_job_service.gd @@ -25,6 +25,7 @@ var _session: NetworkSession var _save_manager: PlayerSaveManager var _network_fishing: NetworkFishingService var _network_sale: NetworkSaleService +var _network_world_spawns: NetworkWorldSpawnService var _progression_ready: bool = false var _host_board: Dictionary = {} @@ -35,6 +36,8 @@ var _daily_completions: Dictionary[String, int] = {} var _pending_rewards: Array[Dictionary] = [] var _lifetime_claimed: Array[String] = [] var _total_catches: int = 0 +var _total_insects: int = 0 +var _total_shellfish: int = 0 var _total_sold: int = 0 var _daily_clock_hour: float = WorldTimeService.DEFAULT_START_HOUR @@ -65,9 +68,11 @@ func setup( func bind_authoritative_services( network_fishing: NetworkFishingService, network_sale: NetworkSaleService, + network_world_spawns: NetworkWorldSpawnService, ) -> void: _network_fishing = network_fishing _network_sale = network_sale + _network_world_spawns = network_world_spawns if not _network_fishing.local_catch_received.is_connected( _on_authoritative_catch ): @@ -78,6 +83,12 @@ func bind_authoritative_services( _network_sale.local_sale_finished.connect( _on_authoritative_sale_finished ) + if not _network_world_spawns.local_capture_received.is_connected( + _on_authoritative_catch + ): + _network_world_spawns.local_capture_received.connect( + _on_authoritative_catch + ) func set_save_manager(save_manager: PlayerSaveManager) -> void: @@ -123,7 +134,10 @@ func get_daily_jobs() -> Array[Dictionary]: func get_lifetime_jobs() -> Array[Dictionary]: var result: Array[Dictionary] = JobCatalog.visible_lifetime_jobs( - _registered_species_count(), _lifetime_claimed + _registered_species_count(), + _lifetime_claimed, + _registered_creature_count(FishDataType.CreatureGroup.INSECT), + _registered_creature_count(FishDataType.CreatureGroup.SHELLFISH), ) for job: Dictionary in result: var progress: int = _lifetime_progress(job) @@ -236,6 +250,8 @@ func to_save_data() -> Dictionary: "lifetime_claimed": _lifetime_claimed.duplicate(), "statistics": { "fish_caught": _total_catches, + "insects_caught": _total_insects, + "shellfish_caught": _total_shellfish, "fish_sold": _total_sold, }, } @@ -245,16 +261,30 @@ func restore_from_save_data(data: Dictionary) -> bool: if not validate_save_data(data): return false var received_board: Dictionary = _active_board.duplicate(true) - _host_board = (data.get("host_board", {}) as Dictionary).duplicate(true) - _active_plan_id = str(data.get("active_plan_id", "")) + var saved_host_board: Dictionary = data.get("host_board", {}) + var legacy_weather_board: bool = ( + not saved_host_board.is_empty() + and not validate_board(saved_host_board) + and _validate_legacy_board(saved_host_board) + ) + _host_board = ( + {} + if legacy_weather_board + else saved_host_board.duplicate(true) + ) + _active_plan_id = ( + "" if legacy_weather_board else str(data.get("active_plan_id", "")) + ) _daily_progress.clear() var progress: Dictionary = data.get("daily_progress", {}) - for key: Variant in progress: - _daily_progress[str(key)] = int(progress[key]) + if not legacy_weather_board: + for key: Variant in progress: + _daily_progress[str(key)] = int(progress[key]) _daily_completions.clear() var completions: Dictionary = data.get("daily_completions", {}) - for key: Variant in completions: - _daily_completions[str(key)] = mini(int(completions[key]), 1) + if not legacy_weather_board: + for key: Variant in completions: + _daily_completions[str(key)] = mini(int(completions[key]), 1) _daily_clock_hour = float(data.get( "daily_clock_hour", _world_time.get_time_hours() @@ -280,6 +310,8 @@ func restore_from_save_data(data: Dictionary) -> bool: _lifetime_claimed.append(str(value)) var statistics: Dictionary = data.get("statistics", {}) _total_catches = int(statistics.get("fish_caught", 0)) + _total_insects = int(statistics.get("insects_caught", 0)) + _total_shellfish = int(statistics.get("shellfish_caught", 0)) _total_sold = int(statistics.get("fish_sold", 0)) if _session != null and _session.is_host(): _active_board = _host_board.duplicate(true) @@ -304,6 +336,8 @@ func reset_to_defaults() -> void: _pending_rewards.clear() _lifetime_claimed.clear() _total_catches = 0 + _total_insects = 0 + _total_shellfish = 0 _total_sold = 0 _daily_clock_hour = WorldTimeService.DEFAULT_START_HOUR changed.emit() @@ -319,7 +353,12 @@ static func default_save_data() -> Dictionary: "daily_clock_hour": WorldTimeService.DEFAULT_START_HOUR, "pending_rewards": [], "lifetime_claimed": [], - "statistics": {"fish_caught": 0, "fish_sold": 0}, + "statistics": { + "fish_caught": 0, + "insects_caught": 0, + "shellfish_caught": 0, + "fish_sold": 0, + }, } @@ -345,6 +384,14 @@ static func validate_board(value: Variant) -> bool: ) ): return false + if ( + board.has("calendar_cycle_id") + and ( + typeof(board["calendar_cycle_id"]) != TYPE_STRING + or str(board["calendar_cycle_id"]).length() != 10 + ) + ): + return false var jobs: Array = board.get("jobs", []) if jobs.is_empty() or jobs.size() > 8: return false @@ -378,7 +425,11 @@ static func validate_save_data(value: Variant) -> bool: ): return false var host_board: Dictionary = data.get("host_board", {}) - if not host_board.is_empty() and not validate_board(host_board): + if ( + not host_board.is_empty() + and not validate_board(host_board) + and not _validate_legacy_board(host_board) + ): return false if ( data.has("daily_clock_hour") @@ -430,15 +481,55 @@ static func validate_save_data(value: Variant) -> bool: JobCatalog.is_bounded_integer( statistics.get("fish_caught"), 0, MAX_PROGRESS_VALUE ) + and JobCatalog.is_bounded_integer( + statistics.get("insects_caught", 0), 0, MAX_PROGRESS_VALUE + ) + and JobCatalog.is_bounded_integer( + statistics.get("shellfish_caught", 0), 0, MAX_PROGRESS_VALUE + ) and JobCatalog.is_bounded_integer( statistics.get("fish_sold"), 0, MAX_PROGRESS_VALUE ) ) +static func _validate_legacy_board(value: Variant) -> bool: + if typeof(value) != TYPE_DICTIONARY: + return false + var board: Dictionary = value + if ( + typeof(board.get("plan_id")) != TYPE_STRING + or str(board.get("plan_id", "")).is_empty() + or str(board.get("plan_id", "")).length() > 96 + or not JobCatalog.is_bounded_integer( + board.get("cycle"), 0, MAX_PROGRESS_VALUE + ) + or not JobCatalog.is_bounded_integer( + board.get("schedule_anchor_index"), + 0, + JobCatalog.LEGACY_WEATHER_SEGMENT_COUNT - 1, + ) + or typeof(board.get("jobs")) != TYPE_ARRAY + or not JobCatalog.is_valid_legacy_weather_schedule( + board.get("weather_schedule", []) + ) + ): + return false + var jobs: Array = board.get("jobs", []) + if jobs.is_empty() or jobs.size() > 8: + return false + for job: Variant in jobs: + if not JobCatalog.is_valid_job(job): + return false + return true + + func _activate_host_board() -> void: - if _host_board.is_empty(): - _generate_host_board(0) + if _world_time != null: + _daily_clock_hour = _world_time.get_time_hours() + if _host_board.is_empty() or _host_board_is_stale(): + var next_cycle: int = int(_host_board.get("cycle", -1)) + 1 + _generate_host_board(maxi(next_cycle, 0)) else: _active_board = _host_board.duplicate(true) _switch_plan(str(_host_board.get("plan_id", ""))) @@ -454,7 +545,7 @@ func _generate_host_board(cycle: int) -> void: var candidates: Array[FishDataType] = [] if _catalog != null: for fish: FishDataType in _catalog.candidates: - if fish != null and fish.is_fishable(): + if fish != null and fish.is_selectable(): candidates.append(fish) var schedule_anchor_index: int = _current_weather_segment() var allow_weather_jobs: bool = ( @@ -472,6 +563,11 @@ func _generate_host_board(cycle: int) -> void: plan_id, jobs, schedule_anchor_index ), } + var calendar_cycle_id: String = _world_time.get_calendar_cycle_id( + DAILY_REFRESH_HOUR + ) + if not calendar_cycle_id.is_empty(): + _host_board["calendar_cycle_id"] = calendar_cycle_id _active_board = _host_board.duplicate(true) _switch_plan(plan_id) _apply_host_weather_plan() @@ -514,7 +610,10 @@ func _on_natural_time_advanced(hours: float) -> void: _progression_ready and _session != null and _session.is_host() - and _crossed_daily_refresh(previous_hour, _daily_clock_hour) + and ( + hours >= WorldTimeService.HOURS_PER_DAY + or _crossed_daily_refresh(previous_hour, _daily_clock_hour) + ) ): var cycle: int = int(_host_board.get("cycle", -1)) + 1 _generate_host_board(maxi(cycle, 0)) @@ -540,7 +639,13 @@ func _on_session_state_changed(state: NetworkSession.State) -> void: func _on_authoritative_catch(fish_catch: FishCatchType) -> void: if not _progression_ready or fish_catch == null or not fish_catch.is_valid(): return - _total_catches = mini(_total_catches + 1, MAX_PROGRESS_VALUE) + match fish_catch.fish.get_creature_group(): + FishDataType.CreatureGroup.FISH: + _total_catches = mini(_total_catches + 1, MAX_PROGRESS_VALUE) + FishDataType.CreatureGroup.INSECT: + _total_insects = mini(_total_insects + 1, MAX_PROGRESS_VALUE) + FishDataType.CreatureGroup.SHELLFISH: + _total_shellfish = mini(_total_shellfish + 1, MAX_PROGRESS_VALUE) _update_daily_for_catch(fish_catch) changed.emit() @@ -562,23 +667,40 @@ func _on_authoritative_sale_finished( func _update_daily_for_catch(fish_catch: FishCatchType) -> void: + var creature_group: int = int(fish_catch.fish.get_creature_group()) + var is_fish: bool = creature_group == FishDataType.CreatureGroup.FISH for job: Dictionary in get_daily_jobs(): var matches: bool = false match int(job.get("kind", -1)): JobCatalog.Kind.CATCH_TOTAL: - matches = true + matches = is_fish JobCatalog.Kind.CATCH_WATER: - matches = fish_catch.fish.is_allowed_in_water( + matches = is_fish and fish_catch.fish.is_allowed_in_water( int(job.get("water_type", WaterType.Type.OTHER)) as WaterType.Type ) JobCatalog.Kind.CATCH_QUALITY: - matches = fish_catch.quality >= int(job.get("minimum_quality", 0)) + matches = ( + is_fish + and fish_catch.quality >= int(job.get("minimum_quality", 0)) + ) JobCatalog.Kind.CATCH_PHASE: - matches = int(_world_time.get_phase()) == int(job.get("phase", -1)) + matches = ( + is_fish + and int(_world_time.get_phase()) == int(job.get("phase", -1)) + ) JobCatalog.Kind.CATCH_WEATHER: - matches = int(_world_weather.get_weather()) == int(job.get("weather", -1)) + matches = ( + is_fish + and int(_world_weather.get_weather()) + == int(job.get("weather", -1)) + ) JobCatalog.Kind.CATCH_SPECIES: - matches = String(fish_catch.fish_id) == str(job.get("fish_id", "")) + matches = ( + is_fish + and String(fish_catch.fish_id) == str(job.get("fish_id", "")) + ) + JobCatalog.Kind.CATCH_CREATURE_GROUP: + matches = creature_group == int(job.get("creature_group", -1)) if matches: _advance_daily(job, 1) @@ -673,26 +795,74 @@ func _lifetime_progress(job: Dictionary) -> int: JobCatalog.Kind.REACH_LEVEL: return _experience.get_level() if _experience != null else 0 JobCatalog.Kind.DISCOVER_SPECIES: - return _collection.get_discovered_ids().size() if _collection != null else 0 + return _collection_progress( + FishDataType.CreatureGroup.FISH, false + ) JobCatalog.Kind.MASTER_QUALITIES: - var mastered: int = 0 - if _collection != null and _catalog != null: - for fish: FishDataType in _catalog.candidates: - if fish != null and _collection.has_mastered(fish.id): - mastered += 1 - return mastered + return _collection_progress( + FishDataType.CreatureGroup.FISH, true + ) + JobCatalog.Kind.CATCH_CREATURE_GROUP: + match int(job.get("creature_group", -1)): + FishDataType.CreatureGroup.INSECT: + return _total_insects + FishDataType.CreatureGroup.SHELLFISH: + return _total_shellfish + JobCatalog.Kind.DISCOVER_CREATURE_GROUP: + return _collection_progress( + int(job.get("creature_group", -1)) as FishDataType.CreatureGroup, + false, + ) + JobCatalog.Kind.MASTER_CREATURE_GROUP: + return _collection_progress( + int(job.get("creature_group", -1)) as FishDataType.CreatureGroup, + true, + ) return 0 func _registered_species_count() -> int: + return _registered_creature_count(FishDataType.CreatureGroup.FISH) + + +func _registered_creature_count( + creature_group: FishDataType.CreatureGroup, +) -> int: var count: int = 0 if _catalog != null: for fish: FishDataType in _catalog.candidates: - if fish != null and fish.is_fishable(): + if ( + fish != null + and fish.is_selectable() + and fish.get_creature_group() == creature_group + ): count += 1 return count +func _collection_progress( + creature_group: FishDataType.CreatureGroup, + require_mastery: bool, +) -> int: + var progress: int = 0 + if _collection == null or _catalog == null: + return progress + for fish: FishDataType in _catalog.candidates: + if ( + fish == null + or not fish.is_selectable() + or fish.get_creature_group() != creature_group + ): + continue + if ( + _collection.has_mastered(fish.id) + if require_mastery + else _collection.has_discovered(fish.id) + ): + progress += 1 + return progress + + func _expire_incomplete_daily_jobs() -> void: _daily_progress.clear() _daily_completions.clear() @@ -727,7 +897,7 @@ func _matches_canonical_board(board: Dictionary) -> bool: var candidates: Array[FishDataType] = [] if _catalog != null: for fish: FishDataType in _catalog.candidates: - if fish != null and fish.is_fishable(): + if fish != null and fish.is_selectable(): candidates.append(fish) var anchor_index: int = int(board.get("schedule_anchor_index", -1)) var allow_weather_jobs: bool = ( @@ -759,6 +929,19 @@ func _current_weather_segment() -> int: ) +func _host_board_is_stale() -> bool: + if _world_time == null: + return false + var current_cycle_id: String = _world_time.get_calendar_cycle_id( + DAILY_REFRESH_HOUR + ) + return ( + not current_cycle_id.is_empty() + and str(_host_board.get("calendar_cycle_id", "")) + != current_cycle_id + ) + + static func _daily_claim_id( plan_id: String, job_id: String, diff --git a/main/main.gd b/main/main.gd index 5d9268e..00d2b40 100644 --- a/main/main.gd +++ b/main/main.gd @@ -6,12 +6,16 @@ const FishPoolType = preload("res://fish/fish_pool.gd") const GameUIType = preload("res://ui/game_ui.gd") const PlayerType = preload("res://player/player.gd") const TestWorldType = preload("res://world/test_world.gd") +const WorldLayoutType = preload("res://world/world_layout.gd") const WaterRecoveryControllerType = preload( "res://world/water_recovery_controller.gd" ) const PlayerSaveManagerType = preload( "res://save/player_save_manager.gd" ) +const PlayerSaveSlotCatalogType = preload( + "res://save/player_save_slot_catalog.gd" +) const PlayerSettingsManagerType = preload( "res://settings/player_settings_manager.gd" ) @@ -33,6 +37,12 @@ const FishingShopType = preload("res://ui/fishing_shop.gd") const FishingShopInteractionType = preload( "res://world/fishing_shop_interaction.gd" ) +const DecorShopInteractionType = preload( + "res://world/decor_shop_interaction.gd" +) +const PlayerStorageInteractionType = preload( + "res://world/player_storage_interaction.gd" +) const UIPixelationPresenterType = preload( "res://ui/ui_pixelation_presenter.gd" ) @@ -63,6 +73,7 @@ const NetworkFishingServiceType = preload( "res://network/network_fishing_service.gd" ) const PlayerHotbarType = preload("res://inventory/player_hotbar.gd") +const DecorCatalogType = preload("res://homes/decor_catalog.gd") const NetworkSaleServiceType = preload( "res://network/network_sale_service.gd" ) @@ -116,12 +127,27 @@ const GatheringControllerType = preload( const NetworkWorldSpawnServiceType = preload( "res://network/network_world_spawn_service.gd" ) +const PlayerHomeStateType = preload("res://homes/player_home_state.gd") +const HomeWorldServiceType = preload("res://homes/home_world_service.gd") +const NetworkHomeServiceType = preload( + "res://network/network_home_service.gd" +) +const HomeDecorControllerType = preload( + "res://homes/home_decor_controller.gd" +) const TITLE_MUSIC_SILENCE_DB: float = -80.0 +const TITLE_MUSIC_PATH: String = ( + "res://audio/music/title/as_in_four_wolves.ogg" +) +const NEW_GAME_MUSIC_PATH: String = "res://audio/music/world/tulips.wav" +const DUSK_MUSIC_PATH: String = "res://audio/music/world/craft.mp3" const TIME_CROSSING_EPSILON_HOURS: float = 0.000001 const PLAYER_MENU_PATTERN_SCALE: float = 0.85 const PLAYER_MENU_PATTERN_SCROLL_VELOCITY := Vector2(-7.0, -5.0) const SHOP_PATTERN_SCALE: float = 1.75 +const DEDICATED_IDLE_PHYSICS_TICKS_PER_SECOND: int = 10 +const DEDICATED_ACTIVE_PHYSICS_TICKS_PER_SECOND: int = 30 @export var fish_catalog: FishPoolType @export var pelican_buyer_profile: FishBuyerProfileType @@ -131,6 +157,7 @@ const SHOP_PATTERN_SCALE: float = 1.75 @export_category("Title Music") @export_range(-40.0, 0.0, 0.5) var title_music_volume_db: float = -6.0 @export_range(0.0, 10.0, 0.05) var title_music_fade_out_seconds: float = 5.0 +@export_range(-40.0, 0.0, 0.5) var new_game_music_volume_db: float = -6.0 @onready var _test_world: TestWorldType = $TestWorld @onready var _player: PlayerType = %Player @@ -138,6 +165,7 @@ const SHOP_PATTERN_SCALE: float = 1.75 @onready var _game_ui: GameUIType = %GameUI @onready var _water_recovery: WaterRecoveryControllerType = %WaterRecovery @onready var _save_manager: PlayerSaveManagerType = %PlayerSaveManager +@onready var _home_state: PlayerHomeStateType = %PlayerHomeState @onready var _settings_manager: PlayerSettingsManagerType = %PlayerSettingsManager @onready var _controller_mapping_manager: ControllerMappingManagerType = ( %ControllerMappingManager @@ -147,6 +175,7 @@ const SHOP_PATTERN_SCALE: float = 1.75 ) @onready var _interface_fonts: InterfaceFontController = %InterfaceFontController @onready var _title_music: AudioStreamPlayer = %TitleMusic +@onready var _new_game_music: AudioStreamPlayer = %NewGameMusic @onready var _dusk_music: AudioStreamPlayer = %DuskMusic @onready var _ui_pixelation: UIPixelationPresenterType = %UIPresentation @onready var _pixelation_reset: PixelationResetOverlayType = ( @@ -196,6 +225,10 @@ const SHOP_PATTERN_SCALE: float = 1.75 ) @onready var _network_sale: NetworkSaleServiceType = %NetworkSaleService @onready var _network_shop: NetworkShopServiceType = %NetworkShopService +@onready var _network_home: NetworkHomeServiceType = %NetworkHomeService +@onready var _home_decor_controller: HomeDecorControllerType = ( + %HomeDecorController +) @onready var _network_item_use: NetworkItemUseServiceType = ( %NetworkItemUseService ) @@ -218,12 +251,16 @@ const SHOP_PATTERN_SCALE: float = 1.75 @onready var _players_root: Node3D = $Players @onready var _surface_drawings_root: Node3D = $SurfaceDrawings @onready var _world_gatherables_root: Node3D = $WorldGatherables +@onready var _home_world: HomeWorldServiceType = %HomeWorldService @onready var _title_background: ColorRect = %TitleBackground @onready var _player_menu_backdrop: ColorRect = %PlayerMenuBackdrop @onready var _shop_backdrop: ColorRect = %ShopBackdrop var _gameplay_started: bool = false +var _save_slots := PlayerSaveSlotCatalogType.new() var _shop_interaction: FishingShopInteractionType +var _decor_shop_interaction: DecorShopInteractionType +var _storage_interaction: PlayerStorageInteractionType var _title_music_tween: Tween var _title_music_transition_generation: int = 0 var _title_music_requested: bool = false @@ -234,6 +271,10 @@ var _join_requested_from_pause: bool = false var _player_menu_backdrop_tween: Tween var _shop_backdrop_tween: Tween var _pending_join_endpoint: String = "" +var _social_prompt_queue: Array[Dictionary] = [] +var _active_social_prompt: Dictionary = {} +var _pending_social_invite_join: bool = false +var _pending_social_invite_gameplay: bool = false var _server_trust_dialog: ConfirmationDialog var _pending_trust_changed: bool = false var _identity_notice_dialog: AcceptDialog @@ -248,15 +289,20 @@ var _performance_profile: RuntimePerformanceProfileType var _pending_existing_root_path := "" var _local_recovery_attempt_id: String = "" var _dedicated_runtime: bool = false +var _dedicated_metrics_accumulator: float = 0.0 @onready var _shoreline_ambience: ShorelineAmbience = %ShorelineAmbience var _rain_ambience: RainAmbienceType func _ready() -> void: + _data_root.prepare_legacy_user_data() _performance_profile = RuntimePerformanceProfileType.from_environment() _dedicated_runtime = _is_dedicated_server_runtime() if _dedicated_runtime: + Engine.max_fps = 30 + Engine.physics_ticks_per_second = 30 + _disable_dedicated_presentation_tree() call_deferred("_start_dedicated_server") return _world_pixelation.set_light_performance_profile( @@ -268,11 +314,12 @@ func _ready() -> void: _configure_presentation_performance_profile( _performance_profile.is_light() ) - DisplayServer.window_set_title("NETfishing") + DisplayServer.window_set_title("straywild") _rain_ambience = RainAmbienceType.new() _rain_ambience.name = "RainAmbience" add_child(_rain_ambience) _rain_ambience.configure(_world_weather) + _configure_audio_performance_profile(_performance_profile.is_light()) _shoreline_ambience.configure( _player, _test_world.get_saltwater_shoreline_mesh(), @@ -297,9 +344,12 @@ func _ready() -> void: func _configure_presentation_performance_profile(light_profile: bool) -> void: - var title_water_material := _title_background.material as ShaderMaterial - if title_water_material != null: - title_water_material.set_shader_parameter( + _game_ui.set_light_performance_profile(light_profile) + var title_background_material := ( + _title_background.material as ShaderMaterial + ) + if title_background_material != null: + title_background_material.set_shader_parameter( "animation_enabled", not light_profile, ) @@ -343,22 +393,105 @@ func _configure_presentation_performance_profile(light_profile: bool) -> void: ) +func _configure_audio_performance_profile(light_profile: bool) -> void: + _title_music.stream = _load_optional_audio_stream(TITLE_MUSIC_PATH) + _new_game_music.stream = _load_optional_audio_stream(NEW_GAME_MUSIC_PATH) + _dusk_music.stream = _load_optional_audio_stream(DUSK_MUSIC_PATH) + if light_profile: + _shoreline_ambience.set_audio_enabled(false) + _rain_ambience.set_audio_enabled(false) + return + _shoreline_ambience.set_audio_enabled(true) + _rain_ambience.set_audio_enabled(true) + + +func _load_optional_audio_stream(path: String) -> AudioStream: + if not ResourceLoader.exists(path, "AudioStream"): + return null + return load(path) as AudioStream + + func _is_dedicated_server_runtime() -> bool: if OS.has_feature("dedicated_server"): return true return "--dedicated-server" in OS.get_cmdline_user_args() +func _disable_dedicated_presentation_tree() -> void: + for path: NodePath in [ + NodePath("TitleBackgroundLayer"), + NodePath("PlayerMenuBackdrop"), + NodePath("ShopBackdrop"), + NodePath("WorldPixelationPostprocess"), + NodePath("UIPresentation"), + NodePath("PixelationResetOverlay"), + NodePath("WorldTimeVisualController"), + NodePath("GatheringController"), + NodePath("FishingSpot"), + NodePath("WaterRecovery"), + NodePath("ControllerMappingManager"), + NodePath("KeyboardMouseMappingManager"), + ]: + var presentation_node: Node = get_node_or_null(path) + if presentation_node == null: + continue + presentation_node.process_mode = Node.PROCESS_MODE_DISABLED + if presentation_node is CanvasItem: + (presentation_node as CanvasItem).visible = false + elif presentation_node is CanvasLayer: + (presentation_node as CanvasLayer).visible = false + for audio_path: NodePath in [ + NodePath("TitleMusic"), + NodePath("NewGameMusic"), + NodePath("DuskMusic"), + NodePath("ShorelineAmbience"), + ]: + var audio_node: Node = get_node_or_null(audio_path) + if audio_node == null: + continue + if audio_node.has_method("stop"): + audio_node.call("stop") + audio_node.process_mode = Node.PROCESS_MODE_DISABLED + + +func _print_dedicated_metrics() -> void: + var metrics: Dictionary = { + "players": _network_session.get_player_count(), + "fps": Engine.get_frames_per_second(), + "frame_process_ms": Performance.get_monitor( + Performance.TIME_PROCESS + ) * 1000.0, + "frame_physics_ms": Performance.get_monitor( + Performance.TIME_PHYSICS_PROCESS + ) * 1000.0, + "memory_mib": Performance.get_monitor( + Performance.MEMORY_STATIC + ) / (1024.0 * 1024.0), + "nodes": int(Performance.get_monitor(Performance.OBJECT_NODE_COUNT)), + "physics_active_objects": int(Performance.get_monitor( + Performance.PHYSICS_3D_ACTIVE_OBJECTS + )), + "physics_collision_pairs": int(Performance.get_monitor( + Performance.PHYSICS_3D_COLLISION_PAIRS + )), + "movement": _network_session.get_movement_metrics(), + } + if _network_fishing.has_method("get_network_metrics"): + metrics["fishing"] = _network_fishing.call("get_network_metrics") + if _network_world_spawns.has_method("get_network_metrics"): + metrics["gatherables"] = _network_world_spawns.call( + "get_network_metrics" + ) + print("straywild server metrics: %s" % JSON.stringify(metrics)) + + func _start_dedicated_server() -> void: var config: DedicatedServerConfigType = DedicatedServerConfigType.from_runtime() if not config.is_valid(): _fail_dedicated_server(config.error_message) return var data_path: String = config.data_directory - var manifest_path: String = data_path.path_join( - PlayerDataRoot.MANIFEST_FILENAME - ) - if not FileAccess.file_exists(manifest_path): + if not _data_root.has_data_manifest(data_path): var created: Dictionary = _data_root.create_unbound_root(data_path) if not bool(created.get("ok", false)): _fail_dedicated_server(str(created.get( @@ -381,16 +514,45 @@ func _start_dedicated_server() -> void: ): _fail_dedicated_server("The server operator list is invalid.") return + if not _network_chat.configure_dedicated_history( + config.chat_logging, + config.chat_log_path, + ): + _fail_dedicated_server( + "The dedicated-server chat privacy configuration is invalid." + ) + return + if not _apply_world( + WorldLayoutType.GENERATED, + config.world_seed, + false, + ): + _fail_dedicated_server("The configured world seed could not be generated.") + return + _test_world.set_dedicated_simulation(true) + if not _network_session.set_host_world( + WorldLayoutType.GENERATED, + config.world_seed, + ): + _fail_dedicated_server("The configured world seed is invalid.") + return _configure_portable_stores() if not _discovery.configure_dedicated_runtime(config.server_name): _fail_dedicated_server("The server room name is invalid.") return _initialize_application(true) _player.set_local_control(false) + _player.set_network_simulation_only(true) _player.visible = false _player.collision_layer = 0 _player.collision_mask = 0 _player.set_physics_process(false) + if not _network_session.peer_count_changed.is_connected( + _on_dedicated_peer_count_changed + ): + _network_session.peer_count_changed.connect( + _on_dedicated_peer_count_changed + ) if not _network_session.start_dedicated_host( config.port, config.max_players, @@ -402,19 +564,24 @@ func _start_dedicated_server() -> void: if not _network_session.set_host_open(true): _fail_dedicated_server("Could not open the dedicated server.") return + _on_dedicated_peer_count_changed( + _network_session.get_player_count(), + config.max_players, + ) _player_jobs.begin_progression_session() if config.public_listing and not _discovery.set_discoverable(true): _network_session.disconnect_session("Discovery setup failed.") _fail_dedicated_server(_discovery.get_host_status_message()) return print( - "NETfishing dedicated server ready: %s on %s:%d (%d players, %s)" + "straywild dedicated server ready: %s on %s:%d (%d players, %s, timezone %s)" % [ config.server_name, config.bind_address, config.port, config.max_players, "public" if config.public_listing else "unlisted", + str(Time.get_time_zone_from_system().get("name", "local")), ] ) print( @@ -423,15 +590,34 @@ func _start_dedicated_server() -> void: ) +func _on_dedicated_peer_count_changed( + player_count: int, + _max_players: int, +) -> void: + if not _dedicated_runtime: + return + Engine.physics_ticks_per_second = ( + DEDICATED_ACTIVE_PHYSICS_TICKS_PER_SECOND + if player_count > 0 + else DEDICATED_IDLE_PHYSICS_TICKS_PER_SECOND + ) + + func _fail_dedicated_server(message: String) -> void: push_error("Dedicated server startup failed: %s" % message) get_tree().quit(1) func _configure_portable_stores() -> void: - _save_manager.configure_storage( - _data_root.path_for(&"player_save"), _data_root - ) + if _dedicated_runtime: + _save_manager.configure_storage( + _data_root.path_for(&"player_save"), _data_root + ) + elif not _save_slots.configure(_data_root, _save_manager): + push_error( + "Save-slot catalog setup failed: %s" + % _save_slots.get_error_message() + ) _network_profile.configure_storage( _data_root.path_for(&"network_profile"), _data_root ) @@ -468,7 +654,8 @@ func _initialize_application(dedicated: bool) -> void: _player_spawn_service.setup( _players_root, _player, - _test_world.get_player_spawn_transform() + _test_world.get_player_spawn_transform(), + dedicated, ) _network_session.setup( _network_profile, @@ -481,7 +668,7 @@ func _initialize_application(dedicated: bool) -> void: _host_bans, dedicated, ) - _discovery.setup(_network_session) + _discovery.setup(_network_session, _relationships) if not dedicated: _world_time_visuals.setup( _world_time, @@ -557,8 +744,23 @@ func _initialize_application(dedicated: bool) -> void: _asset_reservations ) _player.bag.setup(item_catalog) - _player.hotbar.setup(_player.bag, item_catalog, _player.inventory) + _player.inventory_layout.setup( + _player.bag, + _player.inventory, + item_catalog, + _player.cooler_capacity, + ) + _player.bag.set_inventory_layout(_player.inventory_layout) + _player.inventory.set_inventory_layout(_player.inventory_layout) + _player.hotbar.setup( + _player.bag, + item_catalog, + _player.inventory, + _player.inventory_layout, + ) _shop_interaction = _test_world.get_fishing_shop() + _decor_shop_interaction = _test_world.get_decor_shop() + _storage_interaction = _test_world.get_player_storage() if not dedicated: _shop_interaction.setup_local_player(_player) _shop_interaction.local_player_range_changed.connect( @@ -567,6 +769,14 @@ func _initialize_application(dedicated: bool) -> void: _game_ui.set_shop_npc_player_in_range( _shop_interaction.is_local_player_in_range() ) + _decor_shop_interaction.setup_local_player(_player) + _decor_shop_interaction.local_player_range_changed.connect( + _on_decor_shop_range_changed + ) + _storage_interaction.setup_local_player(_player) + _storage_interaction.local_player_range_changed.connect( + _on_storage_range_changed + ) _save_manager.setup( _player.inventory, _player.collection_log, @@ -574,6 +784,7 @@ func _initialize_application(dedicated: bool) -> void: fish_catalog, _player.bag, _player.hotbar, + _player.inventory_layout, item_catalog, _player.fishing_upgrades, _player.cooler_capacity, @@ -582,6 +793,24 @@ func _initialize_application(dedicated: bool) -> void: _world_time, _world_weather, _player_jobs, + _player, + _home_state, + ) + _home_world.setup( + _test_world, + _player_spawn_service, + _network_session, + dedicated, + ) + _network_home.setup( + _network_session, + _player_spawn_service, + _home_state, + _save_manager, + _home_world, + _player.bag, + _player.inventory_layout, + _player.hotbar, ) _player_jobs.set_save_manager(_save_manager) _save_manager.set_autosave_enabled(false) @@ -623,6 +852,8 @@ func _initialize_application(dedicated: bool) -> void: _player.experience, _save_manager, _network_item_use, + _world_time, + not dedicated, ) _gathering_controller.setup( _player, @@ -653,11 +884,12 @@ func _initialize_application(dedicated: bool) -> void: _player.bag, _player.hotbar, _player.art_unlocks, + _data_root, ) _network_player_list.set_surface_drawing_service( _network_surface_drawing ) - _network_chat.setup(_network_session, _world_time, _world_weather) + _network_chat.setup(_network_session) _network_fishing.setup( _network_session, _player_spawn_service, @@ -670,7 +902,8 @@ func _initialize_application(dedicated: bool) -> void: _save_manager, item_catalog, fish_catalog, - _network_item_use + _network_item_use, + not dedicated, ) var sale_buyers: Array[FishBuyerProfileType] = [ pelican_buyer_profile, @@ -682,14 +915,21 @@ func _initialize_application(dedicated: bool) -> void: _network_fishing, _shop_interaction, _player.inventory, + _player.bag, + item_catalog, _player.wallet, _player.fish_sale_service, _save_manager, fish_catalog, sale_buyers, - _asset_reservations + _asset_reservations, + _player.inventory_layout, + ) + _player_jobs.bind_authoritative_services( + _network_fishing, + _network_sale, + _network_world_spawns, ) - _player_jobs.bind_authoritative_services(_network_fishing, _network_sale) _network_shop.setup( _network_session, _player_spawn_service, @@ -702,7 +942,11 @@ func _initialize_application(dedicated: bool) -> void: _player.cooler_capacity, _player.art_unlocks, _save_manager, - _asset_reservations + _asset_reservations, + _player.inventory_layout, + _home_state, + _network_home, + _decor_shop_interaction, ) _fishing_spot.setup( _player, @@ -720,6 +964,7 @@ func _initialize_application(dedicated: bool) -> void: _network_fishing, _world_time, _world_weather, + Callable(_test_world, "get_fishable_water_regions"), ) if dedicated: return @@ -735,15 +980,19 @@ func _initialize_application(dedicated: bool) -> void: _fishing_spot, _player.bag, _player.hotbar, + _player.inventory_layout, item_catalog, main_shop_buyer_profile, _player.fishing_upgrades, _shop_interaction, + _storage_interaction, + _decor_shop_interaction, _player.item_effects, _player.cooler_capacity, _network_session, _network_sale, _network_shop, + _home_state, _network_chat, _network_profile, _player_spawn_service, @@ -761,6 +1010,21 @@ func _initialize_application(dedicated: bool) -> void: _test_world.get_world_environment(), _test_world.get_sun(), ) + _home_decor_controller.setup( + _player, + _player.hotbar, + _player.bag, + _home_state, + _network_home, + _home_world, + _fishing_spot, + _game_ui.get_home_decor_toolbar(), + ) + _game_ui.get_player_storage().decorate_requested.connect( + _home_decor_controller.begin_decorating + ) + _network_home.local_space_changed.connect(_on_local_home_space_changed) + _game_ui.rv_storage_requested.connect(_on_rv_storage_requested) _game_ui.setup_data_and_identity( _data_root, _identity_backups, @@ -769,10 +1033,23 @@ func _initialize_application(dedicated: bool) -> void: _network_session, _interface_fonts, ) + _game_ui.data_root_changed.connect(_on_data_root_changed) _game_ui.setup_controller_mapping(_controller_mapping_manager) + _ui_pixelation.setup_controller_mapping(_controller_mapping_manager) _game_ui.setup_keyboard_mouse_mapping(_keyboard_mouse_mapping_manager) + _network_player_list.friend_request_received.connect( + _on_friend_request_received + ) + _discovery.friend_invite_received.connect(_on_friend_invite_received) + _discovery.public_join_prepared.connect( + _on_social_public_join_prepared + ) + _discovery.public_join_status_changed.connect( + _on_social_public_join_status_changed + ) + _game_ui.social_prompt_accepted.connect(_on_social_prompt_accepted) + _game_ui.social_prompt_declined.connect(_on_social_prompt_declined) _data_root.conflict_detected.connect(_on_portable_conflict) - _data_root.status_changed.connect(_on_data_root_status) if ( PortableFileGuard.has_syncthing_conflict( _data_root.root_path.path_join("player") @@ -791,7 +1068,8 @@ func _initialize_application(dedicated: bool) -> void: _game_ui, _game_ui.get_screen_fade(), _test_world.get_player_water_triggers(), - _test_world.get_safe_respawn_points() + _test_world.get_safe_respawn_points(), + Callable(_test_world, "get_water_recovery_position"), ) _ui_pixelation.effective_pixel_size_changed.connect( _on_effective_ui_pixel_size_changed @@ -821,16 +1099,19 @@ func _initialize_application(dedicated: bool) -> void: _apply_runtime_settings(_settings_manager.current_settings) _set_gameplay_active(false) var title_screen: TitleScreenType = _game_ui.get_title_screen() - title_screen.new_game_requested.connect(_on_new_game_requested) - title_screen.continue_game_requested.connect(_on_continue_game_requested) + title_screen.slot_play_requested.connect(_on_slot_play_requested) + title_screen.new_slot_requested.connect(_on_new_slot_requested) title_screen.quit_requested.connect(_on_quit_requested) title_screen.setup( _save_manager, + _save_slots, _settings_manager, _network_session, _saved_servers, _server_trust, _discovery, + _data_root, + _interface_fonts, ) var pause_menu: PauseMenuType = _game_ui.get_pause_menu() pause_menu.setup( @@ -878,7 +1159,7 @@ func _initialize_application(dedicated: bool) -> void: func _show_data_root_setup() -> void: if _data_setup_dialog == null: _data_setup_dialog = ConfirmationDialog.new() - _data_setup_dialog.title = "NETfishing player data" + _data_setup_dialog.title = "straywild player data" _data_setup_dialog.ok_button_text = "Use This Folder" _data_setup_dialog.cancel_button_text = "Quit" _data_setup_dialog.confirmed.connect(_use_default_data_root) @@ -895,14 +1176,14 @@ func _show_data_root_setup() -> void: var default_path: String = _data_root.default_visible_path() var legacy: bool = PortableDataMigration.legacy_files_present() _data_setup_dialog.dialog_text = ( - ("Move your existing NETfishing data to an easy-to-find folder." - if legacy else "Choose where NETfishing stores your player data.") + ("Move your existing straywild data to an easy-to-find folder." + if legacy else "Choose where straywild stores your player data.") + "\n\n%s\n\nYou can choose a Syncthing folder." % (default_path if not default_path.is_empty() else "Choose a folder") ) _data_setup_dialog.ok_button_text = ( ( - "Move to Documents/NETFISHING" + "Move to Documents/straywild" if legacy else "Use This Folder" ) if not default_path.is_empty() @@ -911,7 +1192,7 @@ func _show_data_root_setup() -> void: _data_setup_current_button.visible = not default_path.is_empty() if not _data_root.error_message.is_empty(): _data_setup_dialog.dialog_text = ( - "Your NETfishing data folder is unavailable.\n\n%s" + "Your straywild data folder is unavailable.\n\n%s" % _data_root.error_message ) _data_setup_dialog.popup_centered(Vector2i(640, 360)) @@ -1047,11 +1328,11 @@ func _activate_selected_data_path(path: String, app_data: bool = false) -> void: func _show_existing_root_choice(path: String) -> void: _pending_existing_root_path = path var dialog: ConfirmationDialog = ConfirmationDialog.new() - dialog.title = "Existing NETfishing data" + dialog.title = "Existing straywild data" dialog.ok_button_text = "Use Data Already in Selected Folder" dialog.cancel_button_text = "Cancel" dialog.dialog_text = ( - "This folder already contains NETfishing player data.\n\n" + "This folder already contains straywild player data.\n\n" + "Choose which complete data set to use. Data is never merged automatically." ) dialog.add_button( @@ -1102,11 +1383,7 @@ func _on_portable_conflict(message: String, _path: String) -> void: dialog.dialog_text = ( message + "\n\nDo not play the same profile on two devices at the same time." - ) - dialog.add_button("Open Data Folder", false, "open") - dialog.custom_action.connect(func(action: StringName) -> void: - if action == &"open": - _data_root.open_folder() + + "\n\nThe data folder can be opened from Settings > Data." ) dialog.confirmed.connect(dialog.queue_free) _game_ui.add_child(dialog) @@ -1120,11 +1397,8 @@ func _on_data_root_status(message: String) -> void: var dialog: AcceptDialog = AcceptDialog.new() _interface_fonts.apply_utility_theme(dialog) dialog.title = "Synced data needs review" - dialog.dialog_text = message - dialog.add_button("Open Data Folder", false, "open") - dialog.custom_action.connect(func(action: StringName) -> void: - if action == &"open": - _data_root.open_folder() + dialog.dialog_text = ( + message + "\n\nThe data folder can be opened from Settings > Data." ) dialog.confirmed.connect(dialog.queue_free) _game_ui.add_child(dialog) @@ -1132,6 +1406,18 @@ func _on_data_root_status(message: String) -> void: _configure_popup_dialog.call_deferred(dialog, dialog.get_ok_button()) +func _on_data_root_changed() -> void: + _save_manager.set_autosave_enabled(false) + _save_manager.cancel_pending_autosave() + _configure_portable_stores() + if not _network_profile_service.reload_persisted_profile(): + push_warning("The selected data folder's player profile could not be loaded.") + _network_session.set_local_appearance_snapshot( + _appearance_store.get_snapshot() + ) + _game_ui.get_title_screen().refresh_after_data_root_change() + + func _on_server_trust_required( endpoint: String, expected_fingerprint: String, @@ -1224,6 +1510,10 @@ func _configure_popup_dialog( func _input(event: InputEvent) -> void: + # Do not let controller aliases close or manipulate the world/menu behind + # the modal on-screen keyboard. The keyboard consumes the event itself. + if _game_ui.is_controller_text_entry_open(): + return if _handle_data_root_controller_input(event): get_viewport().set_input_as_handled() return @@ -1243,6 +1533,12 @@ func _input(event: InputEvent) -> void: return var pause_menu: PauseMenuType = _game_ui.get_pause_menu() var fishing_shop: FishingShopType = _game_ui.get_fishing_shop() + if _game_ui.get_player_storage().consume_escape(): + get_viewport().set_input_as_handled() + return + if _game_ui.get_decor_shop().consume_escape(): + get_viewport().set_input_as_handled() + return if fishing_shop.consume_escape(): get_viewport().set_input_as_handled() return @@ -1323,18 +1619,13 @@ func _handle_data_root_controller_input(event: InputEvent) -> bool: if picker_visible else _data_setup_dialog.gui_get_focus_owner() ) - var focused_button := focused as BaseButton - if focused_button != null and not focused_button.disabled: - focused_button.pressed.emit() - return true if ( (focused is LineEdit or focused is TextEdit) and _game_ui.request_controller_text_entry_for(focused) ): return true - if setup_visible: - _data_setup_dialog.get_ok_button().pressed.emit() - return true + # Buttons are activated once through Godot's native ui_accept path. This + # handler only owns modal back behavior and controller text entry. return false @@ -1346,12 +1637,52 @@ func _is_pause_open_request(event: InputEvent) -> bool: func _unhandled_input(event: InputEvent) -> void: + if ( + _gameplay_started + and event.is_action_pressed("fish_primary") + and not (event is InputEventKey and event.echo) + and _fishing_spot.try_use_active_non_fishing_item() + ): + get_viewport().set_input_as_handled() + return if ( not _gameplay_started or not event.is_action_pressed("interact") or (event is InputEventKey and event.echo) ): return + var home_owner: String = _network_home.get_local_home_owner_fingerprint() + if not home_owner.is_empty(): + if _home_world.is_avatar_near_interior_exit(_player, home_owner): + if _network_home.request_exit(): + _game_ui.set_storage_prompt_visible(false) + get_viewport().set_input_as_handled() + return + if ( + _network_home.can_local_decorate() + and _fishing_spot.can_open_fishing_shop() + and _game_ui.get_player_storage().open_storage_from_home(true) + ): + _game_ui.set_storage_prompt_visible(false) + get_viewport().set_input_as_handled() + return + var nearby_home_owner: String = _home_world.find_nearby_exterior_owner( + _player + ) + if not nearby_home_owner.is_empty(): + if _network_home.request_enter(nearby_home_owner): + _game_ui.set_storage_prompt_visible(false) + get_viewport().set_input_as_handled() + return + if ( + _decor_shop_interaction != null + and _decor_shop_interaction.is_local_player_in_range() + and _fishing_spot.can_open_fishing_shop() + and _game_ui.get_decor_shop().open_shop() + ): + _game_ui.set_shop_prompt_visible(false) + get_viewport().set_input_as_handled() + return if ( _shop_interaction != null and _shop_interaction.is_local_player_in_range() @@ -1360,35 +1691,54 @@ func _unhandled_input(event: InputEvent) -> void: ): _game_ui.set_shop_prompt_visible(false) get_viewport().set_input_as_handled() - elif event is InputEventJoypadButton and _player != null: - _player.hotbar.clear_slot(_player.hotbar.get_selected_slot()) - get_viewport().set_input_as_handled() -func _process(_delta: float) -> void: +func _process(delta: float) -> void: if _dedicated_runtime: + _dedicated_metrics_accumulator += delta + if _dedicated_metrics_accumulator >= 60.0: + _dedicated_metrics_accumulator = fmod( + _dedicated_metrics_accumulator, + 60.0, + ) + _print_dedicated_metrics() return - var show_shop_prompt := _can_show_shop_prompt() + var show_decor_shop_prompt := _can_show_decor_shop_prompt() + var show_shop_prompt := show_decor_shop_prompt or _can_show_shop_prompt() var shop_prompt_anchor := ( - _shop_interaction.get_prompt_anchor_position() - if _shop_interaction != null - else Vector3.ZERO + _decor_shop_interaction.get_prompt_anchor_position() + if show_decor_shop_prompt + else ( + _shop_interaction.get_prompt_anchor_position() + if _shop_interaction != null else Vector3.ZERO + ) ) _game_ui.set_shop_prompt_visible( show_shop_prompt, shop_prompt_anchor, ) + var home_prompt := _get_home_prompt() + _game_ui.set_storage_prompt_visible( + not home_prompt.is_empty(), + home_prompt.get("anchor", Vector3.ZERO), + str(home_prompt.get("label", "enter RV")), + ) + _game_ui.set_rv_storage_button_visible( + _can_show_rv_storage_button() + ) func _apply_runtime_settings(settings: PlayerSettingsType) -> void: if settings == null: return - var requested_window_mode: DisplayServer.WindowMode = ( - DisplayServer.WINDOW_MODE_FULLSCREEN - if settings.fullscreen_enabled - else DisplayServer.WINDOW_MODE_WINDOWED + var current_window_mode: DisplayServer.WindowMode = ( + DisplayServer.window_get_mode() ) - if DisplayServer.window_get_mode() != requested_window_mode: + var requested_window_mode: DisplayServer.WindowMode = resolve_window_mode( + settings.fullscreen_enabled, + current_window_mode, + ) + if current_window_mode != requested_window_mode: DisplayServer.window_set_mode(requested_window_mode) _apply_world_pixelation(settings.world_pixel_size) _ui_pixelation.set_pixel_size(settings.ui_pixel_size) @@ -1401,7 +1751,8 @@ func _apply_runtime_settings(settings: PlayerSettingsType) -> void: _player.apply_camera_settings( settings.mouse_camera_sensitivity, settings.controller_camera_sensitivity, - settings.invert_camera_y + settings.invert_camera_y, + settings.swap_hotbar_camera_scroll, ) _fishing_spot.configure_accessibility_auto_click( settings.auto_click_enabled, @@ -1414,6 +1765,25 @@ func _apply_runtime_settings(settings: PlayerSettingsType) -> void: ) +static func resolve_window_mode( + fullscreen_enabled: bool, + current_mode: DisplayServer.WindowMode, +) -> DisplayServer.WindowMode: + var is_fullscreen: bool = current_mode in [ + DisplayServer.WINDOW_MODE_FULLSCREEN, + DisplayServer.WINDOW_MODE_EXCLUSIVE_FULLSCREEN, + ] + if fullscreen_enabled: + return ( + current_mode + if is_fullscreen + else DisplayServer.WINDOW_MODE_FULLSCREEN + ) + if is_fullscreen: + return DisplayServer.WINDOW_MODE_WINDOWED + return current_mode + + func _apply_world_pixelation(pixel_size: int) -> void: var root_viewport: Viewport = get_viewport() root_viewport.scaling_3d_mode = Viewport.SCALING_3D_MODE_NEAREST @@ -1499,7 +1869,11 @@ func _on_natural_time_advanced(advanced_hours: float) -> void: ) ): _dusk_music_played_for_natural_day = true - _dusk_music.play(0.0) + if ( + _dusk_music.stream != null + and not _new_game_music.playing + ): + _dusk_music.play(0.0) static func _natural_interval_crosses_hour( @@ -1599,16 +1973,34 @@ func _resize_native_overlays() -> void: _shop_backdrop.size = Vector2(get_window().size) -func _on_new_game_requested() -> void: +func _on_new_game_requested( + world_layout: StringName, + world_seed: int, +) -> void: if _gameplay_started or _quit_in_progress: return + _start_new_game_music() + if not _apply_world(world_layout, world_seed, true): + _show_title_music(true) + _game_ui.get_title_screen().report_network_error( + "Could not prepare that world. Try another seed or the starter island." + ) + return + if not _prepare_host_world(world_layout, world_seed): + _show_title_music(true) + _game_ui.get_title_screen().report_network_error( + "Could not prepare that world for hosting." + ) + return if not _prepare_private_host(): + _show_title_music(true) return if ( not _save_manager.delete_progression_save() - or not _save_manager.initialize_new_game() + or not _save_manager.initialize_new_game(world_seed, world_layout) ): _network_session.disconnect_session("New Game setup failed.") + _show_title_music(true) _game_ui.get_title_screen().report_network_error( "Could not initialize local progression. Existing data was preserved where possible." ) @@ -1619,14 +2011,114 @@ func _on_new_game_requested() -> void: func _on_continue_game_requested() -> void: if _gameplay_started or _quit_in_progress: return - if not _prepare_private_host(): - return if not _save_manager.load_player_data(): - _network_session.disconnect_session("Continue failed.") _game_ui.get_title_screen().report_network_error( "Failed to load save. The original was preserved." ) return + var world_layout: StringName = _save_manager.get_world_layout() + var world_seed: int = _save_manager.get_world_seed() + if ( + not _apply_world(world_layout, world_seed, true) + or not _prepare_host_world(world_layout, world_seed) + ): + _game_ui.get_title_screen().report_network_error( + "The saved world could not be loaded. The save was preserved." + ) + return + if not _prepare_private_host(): + return + _enter_gameplay() + + +func _on_slot_play_requested(slot_id: String) -> void: + if _gameplay_started or _quit_in_progress: + return + if not _save_slots.activate_slot(slot_id): + _game_ui.get_title_screen().report_network_error( + "The selected save slot could not be opened." + ) + return + if not _save_manager.load_player_data(): + _game_ui.get_title_screen().report_network_error( + "Failed to load that save slot. The original was preserved." + ) + return + var world_layout: StringName = _save_manager.get_world_layout() + var world_seed: int = _save_manager.get_world_seed() + if ( + not _apply_world(world_layout, world_seed, true) + or not _prepare_host_world(world_layout, world_seed) + ): + _game_ui.get_title_screen().report_network_error( + "The saved world could not be loaded. The save was preserved." + ) + return + if not _prepare_private_host(): + return + _save_slots.mark_played(slot_id) + _enter_gameplay() + + +func _on_new_slot_requested( + display_name: String, + world_layout: StringName, + world_seed: int, + duplicate_source_slot_id: String, +) -> void: + if _gameplay_started or _quit_in_progress: + return + var created: Dictionary = ( + _save_slots.duplicate_slot( + duplicate_source_slot_id, + display_name, + world_layout, + world_seed, + ) + if not duplicate_source_slot_id.is_empty() + else _save_slots.create_empty_slot(display_name) + ) + if not bool(created.get("ok", false)): + _game_ui.get_title_screen().report_network_error( + str(created.get("message", "The save slot could not be created.")) + ) + return + var slot_id: String = str(created.get("slot_id", "")) + if not _save_slots.activate_slot(slot_id): + _game_ui.get_title_screen().report_network_error( + "The new save slot could not be selected." + ) + return + if not duplicate_source_slot_id.is_empty(): + _on_slot_play_requested(slot_id) + return + _start_new_game_music() + if not _apply_world(world_layout, world_seed, true): + _show_title_music(true) + _game_ui.get_title_screen().report_network_error( + "Could not prepare that world. Try another seed or the starter island." + ) + return + if not _prepare_host_world(world_layout, world_seed): + _show_title_music(true) + _game_ui.get_title_screen().report_network_error( + "Could not prepare that world for hosting." + ) + return + if not _prepare_private_host(): + _show_title_music(true) + return + if ( + not _save_manager.delete_progression_save() + or not _save_manager.initialize_new_game(world_seed, world_layout) + ): + _network_session.disconnect_session("New Game setup failed.") + _show_title_music(true) + _game_ui.get_title_screen().report_network_error( + "Could not initialize local progression." + ) + return + _save_slots.mark_played(slot_id) _enter_gameplay() @@ -1649,6 +2141,18 @@ func _prepare_private_host() -> bool: return true +func _prepare_host_world( + world_layout: StringName, + world_seed: int, +) -> bool: + if _network_session.state in [ + NetworkSessionType.State.CONNECTION_FAILED, + NetworkSessionType.State.SERVER_LOST, + ]: + _network_session.reset_failure() + return _network_session.set_host_world(world_layout, world_seed) + + func _enter_gameplay() -> void: _fade_out_title_music() _game_ui.get_title_screen().hide() @@ -1674,6 +2178,12 @@ func _on_return_to_title_requested() -> void: func _on_title_join_game_requested(endpoint: String) -> void: if _quit_in_progress or _gameplay_started: return + var active_slot: Dictionary = _save_slots.ensure_active_slot() + if not bool(active_slot.get("ok", false)): + _game_ui.get_title_screen().report_network_error( + str(active_slot.get("message", "Local progression is unavailable.")) + ) + return if _network_session.state != NetworkSessionType.State.INACTIVE: _network_session.disconnect_session("Preparing direct connection.") _join_requested_from_title = true @@ -1707,6 +2217,135 @@ func _on_pause_join_game_requested(endpoint: String) -> void: ) +func _on_friend_request_received( + request_id: String, + fingerprint: String, + display_name: String, +) -> void: + _queue_social_prompt({ + "kind": "friend_request", + "request_id": request_id, + "fingerprint": fingerprint, + "display_name": display_name, + }) + + +func _on_friend_invite_received( + fingerprint: String, + display_name: String, + room: Dictionary, +) -> void: + if ( + not _relationships.is_friend(fingerprint) + or _relationships.is_blocked(fingerprint) + ): + return + _queue_social_prompt({ + "kind": "friend_invite", + "fingerprint": fingerprint, + "display_name": display_name, + "room": room.duplicate(true), + }) + + +func _queue_social_prompt(details: Dictionary) -> void: + _social_prompt_queue.append(details.duplicate(true)) + _show_next_social_prompt() + + +func _show_next_social_prompt() -> void: + if ( + not _active_social_prompt.is_empty() + or _game_ui.is_social_prompt_open() + or _social_prompt_queue.is_empty() + ): + return + _active_social_prompt = _social_prompt_queue.pop_front() + var kind := str(_active_social_prompt.get("kind", "")) + var display_name := str( + _active_social_prompt.get("display_name", "Player") + ) + var shown: bool = false + if kind == "friend_request": + shown = _game_ui.show_social_prompt( + "%s wants to add you as a friend.\n" % display_name + + "Friendships are saved on this device.", + "accept", + "decline", + ) + elif kind == "friend_invite": + var room: Dictionary = _active_social_prompt.get("room", {}) + var room_name := str(room.get("room_name", "their room")) + shown = _game_ui.show_social_prompt( + "%s invited you to join %s." % [display_name, room_name], + "join", + "not now", + ) + if not shown: + _active_social_prompt.clear() + call_deferred("_show_next_social_prompt") + + +func _on_social_prompt_accepted() -> void: + var details: Dictionary = _active_social_prompt.duplicate(true) + _active_social_prompt.clear() + match str(details.get("kind", "")): + "friend_request": + _network_player_list.respond_friend_request( + str(details.get("request_id", "")), true + ) + "friend_invite": + var room: Dictionary = details.get("room", {}) + _pending_social_invite_join = true + _pending_social_invite_gameplay = _gameplay_started + if room.is_empty() or not _discovery.prepare_public_join(room): + _pending_social_invite_join = false + _report_social_join_error( + "This person needs to be online to do this." + ) + call_deferred("_show_next_social_prompt") + + +func _on_social_prompt_declined() -> void: + var details: Dictionary = _active_social_prompt.duplicate(true) + _active_social_prompt.clear() + if str(details.get("kind", "")) == "friend_request": + _network_player_list.respond_friend_request( + str(details.get("request_id", "")), false + ) + call_deferred("_show_next_social_prompt") + + +func _on_social_public_join_prepared(endpoint: String) -> void: + if not _pending_social_invite_join: + return + var from_gameplay := _pending_social_invite_gameplay + _pending_social_invite_join = false + _pending_social_invite_gameplay = false + if from_gameplay: + _on_pause_join_game_requested(endpoint) + else: + _on_title_join_game_requested(endpoint) + + +func _on_social_public_join_status_changed( + message: String, + is_error: bool, +) -> void: + if not _pending_social_invite_join or not is_error: + return + _pending_social_invite_join = false + _pending_social_invite_gameplay = false + _report_social_join_error(message) + + +func _report_social_join_error(message: String) -> void: + if _gameplay_started: + _game_ui.get_pause_menu().report_network_error(message) + else: + _game_ui.get_title_screen().report_network_error(message) + + func _on_network_join_authenticated() -> void: var connected_endpoint: ConnectionEndpoint = ( _network_session.get_current_endpoint() @@ -1738,10 +2377,15 @@ func _on_network_join_authenticated() -> void: ) _join_requested_from_title = false return + _save_slots.mark_played(_save_slots.get_active_slot_id()) + if not _apply_joined_world(server_metadata): + return _fade_out_title_music() _game_ui.get_title_screen().hide() _set_gameplay_active(true) elif _join_requested_from_pause: + if not _apply_joined_world(server_metadata): + return _set_gameplay_active(true) _join_requested_from_title = false _join_requested_from_pause = false @@ -1821,17 +2465,9 @@ func _on_remote_recovery_requested( peer_id, "Fishing attempt ended." ) - var target_position: Vector3 = _test_world.get_player_spawn_transform().origin - var nearest_distance: float = INF - for point: SafeRespawnPoint in _test_world.get_safe_respawn_points(): - if point == null or not point.enabled: - continue - var distance: float = point.get_horizontal_distance_squared( - entry_position - ) - if distance < nearest_distance: - nearest_distance = distance - target_position = point.global_position + var target_position := _test_world.get_water_recovery_position( + entry_position + ) target_position.y += _water_recovery.respawn_height_offset avatar.global_position = target_position avatar.velocity = Vector3.ZERO @@ -1845,7 +2481,15 @@ func _on_reset_progress_requested() -> void: if not _save_manager.delete_progression_save(): pause_menu.report_reset_failure() return - if not _save_manager.initialize_new_game(): + var world_seed: int = PlayerSaveManager.roll_world_seed() + if not _save_manager.initialize_new_game( + world_seed, + WorldLayoutType.GENERATED, + ): + pause_menu.report_reset_failure() + return + _network_session.disconnect_session("Progress reset.") + if not _apply_world(WorldLayoutType.GENERATED, world_seed, true): pause_menu.report_reset_failure() return pause_menu.close_for_title_transition() @@ -1854,6 +2498,127 @@ func _on_reset_progress_requested() -> void: _show_title_music(true) +func _apply_joined_world(server_metadata: Dictionary) -> bool: + var world_layout: StringName = WorldLayoutType.normalized( + server_metadata.get( + "world_layout", + String(WorldLayoutType.GENERATED), + ), + &"", + ) + var world_seed: int = int(server_metadata.get("world_seed", 0)) + if ( + not world_layout.is_empty() + and _apply_world(world_layout, world_seed, true) + ): + return true + _network_session.disconnect_session("World generation failed.") + _join_requested_from_title = false + _join_requested_from_pause = false + _set_gameplay_active(false) + var title_screen: TitleScreenType = _game_ui.get_title_screen() + title_screen.reopen_to_menu() + title_screen.report_network_error( + "The host's world could not be built locally." + ) + _show_title_music(true) + return false + + +func _apply_world( + world_layout: StringName, + world_seed: int, + reposition_player: bool, +) -> bool: + if not _test_world.activate_world(world_layout, world_seed): + return false + var spawn_transform: Transform3D = _test_world.get_player_spawn_transform() + _player_spawn_service.set_spawn_transform(spawn_transform) + if reposition_player: + _player.global_transform = spawn_transform + _player.velocity = Vector3.ZERO + if _application_initialized: + _refresh_active_world_bindings() + _network_world_spawns.refresh_world_context() + _network_home.refresh_world_presentations() + if _application_initialized and not _dedicated_runtime: + _water_recovery.update_world_context( + spawn_transform, + _test_world.get_player_water_triggers(), + _test_world.get_safe_respawn_points(), + Callable(_test_world, "get_water_recovery_position"), + ) + _shoreline_ambience.configure( + _player, + _test_world.get_saltwater_shoreline_mesh(), + ) + return true + + +func _refresh_active_world_bindings() -> void: + if is_instance_valid(_shop_interaction): + if _shop_interaction.local_player_range_changed.is_connected( + _on_shop_range_changed + ): + _shop_interaction.local_player_range_changed.disconnect( + _on_shop_range_changed + ) + if is_instance_valid(_storage_interaction): + if _storage_interaction.local_player_range_changed.is_connected( + _on_storage_range_changed + ): + _storage_interaction.local_player_range_changed.disconnect( + _on_storage_range_changed + ) + if is_instance_valid(_decor_shop_interaction): + if _decor_shop_interaction.local_player_range_changed.is_connected( + _on_decor_shop_range_changed + ): + _decor_shop_interaction.local_player_range_changed.disconnect( + _on_decor_shop_range_changed + ) + _shop_interaction = _test_world.get_fishing_shop() + _decor_shop_interaction = _test_world.get_decor_shop() + _storage_interaction = _test_world.get_player_storage() + _network_sale.set_shop_interaction(_shop_interaction) + _network_shop.set_shop_interaction(_shop_interaction) + _network_shop.set_decor_shop_interaction(_decor_shop_interaction) + if _dedicated_runtime: + return + if _shop_interaction != null: + _shop_interaction.setup_local_player(_player) + _shop_interaction.local_player_range_changed.connect( + _on_shop_range_changed + ) + if _storage_interaction != null: + _storage_interaction.setup_local_player(_player) + _storage_interaction.local_player_range_changed.connect( + _on_storage_range_changed + ) + if _decor_shop_interaction != null: + _decor_shop_interaction.setup_local_player(_player) + _decor_shop_interaction.local_player_range_changed.connect( + _on_decor_shop_range_changed + ) + _game_ui.set_world_interactions( + _shop_interaction, + _storage_interaction, + _decor_shop_interaction, + ) + _on_shop_range_changed( + _shop_interaction != null + and _shop_interaction.is_local_player_in_range() + ) + _on_storage_range_changed( + _storage_interaction != null + and _storage_interaction.is_local_player_in_range() + ) + _on_decor_shop_range_changed( + _decor_shop_interaction != null + and _decor_shop_interaction.is_local_player_in_range() + ) + + func _on_water_recovery_starting() -> void: _local_recovery_attempt_id = ( "recovery:%s" @@ -1865,6 +2630,8 @@ func _on_water_recovery_starting() -> void: _game_ui.close_player_menu_for_water_recovery() _game_ui.get_pause_menu().close_for_water_recovery() _game_ui.get_fishing_shop().close_for_water_recovery() + _game_ui.get_decor_shop().close_for_water_recovery() + _game_ui.get_player_storage().close_for_water_recovery() func _on_water_recovery_finished() -> void: @@ -1919,6 +2686,18 @@ func _on_active_hotbar_item_changed( and item.is_available() and _player.bag.owns_item(item_id) ) + var active_is_shovel: bool = ( + item_id == FishingShopStockType.STANDARD_SHOVEL_ID + and item != null + and item.is_available() + and _player.bag.owns_item(item_id) + ) + var active_is_decor: bool = ( + DecorCatalogType.has_product(item_id) + and item != null + and item.is_available() + and _player.bag.owns_item(item_id) + ) _player.set_active_fishing_rod( item as FishingRodDataType if active_is_rod else null, true, @@ -1928,6 +2707,8 @@ func _on_active_hotbar_item_changed( active_is_art_kit, ) _player.set_active_catching_net(active_is_catching_net) + _player.set_active_shovel(active_is_shovel) + _player.set_active_decor_package(active_is_decor) _game_ui.set_surface_drawing_hotbar_selected(active_is_art_kit) _network_item_use.submit_local_equipped(item_id, active_is_rod or ( item != null and _player.bag.owns_item(item_id) @@ -1965,8 +2746,11 @@ func _on_quit_requested() -> void: func _show_title_music(restart_from_beginning: bool = false) -> void: + _new_game_music.stop() _title_music_requested = true _replace_title_music_transition() + if _title_music.stream == null: + return if restart_from_beginning: _title_music.stop() _title_music.volume_db = title_music_volume_db @@ -1974,6 +2758,19 @@ func _show_title_music(restart_from_beginning: bool = false) -> void: _title_music.play(0.0) +func _start_new_game_music() -> void: + if _new_game_music.stream == null: + return + _title_music_requested = false + _replace_title_music_transition() + _title_music.stop() + _title_music.volume_db = title_music_volume_db + _dusk_music.stop() + _new_game_music.stop() + _new_game_music.volume_db = new_game_music_volume_db + _new_game_music.play(0.0) + + func _fade_out_title_music(on_complete: Callable = Callable()) -> void: _title_music_requested = false var generation: int = _replace_title_music_transition() @@ -2039,24 +2836,142 @@ func _exit_tree() -> void: if is_instance_valid(_title_music): _title_music.stop() _title_music.stream = null + if is_instance_valid(_new_game_music): + _new_game_music.stop() + _new_game_music.stream = null if is_instance_valid(_dusk_music): _dusk_music.stop() _dusk_music.stream = null func _on_shop_range_changed(in_range: bool) -> void: - _game_ui.set_shop_npc_player_in_range(in_range) + _game_ui.set_shop_npc_player_in_range( + in_range + or ( + _decor_shop_interaction != null + and _decor_shop_interaction.is_local_player_in_range() + ) + ) if not in_range: _game_ui.get_fishing_shop().close_for_range_exit() _game_ui.set_shop_prompt_visible(_can_show_shop_prompt()) +func _on_storage_range_changed(in_range: bool) -> void: + if not in_range: + _game_ui.get_player_storage().close_for_range_exit() + var prompt := _get_home_prompt() + _game_ui.set_storage_prompt_visible( + not prompt.is_empty(), + prompt.get("anchor", Vector3.ZERO), + str(prompt.get("label", "enter RV")), + ) + _game_ui.set_rv_storage_button_visible( + _can_show_rv_storage_button() + ) + + +func _on_decor_shop_range_changed(in_range: bool) -> void: + _game_ui.set_shop_npc_player_in_range( + in_range + or ( + _shop_interaction != null + and _shop_interaction.is_local_player_in_range() + ) + ) + if not in_range: + _game_ui.get_decor_shop().close_for_range_exit() + _game_ui.set_shop_prompt_visible( + _can_show_shop_prompt() or _can_show_decor_shop_prompt() + ) + + +func _on_local_home_space_changed( + space_id: StringName, + _owner_fingerprint: String, +) -> void: + var inside_rv: bool = String(space_id).begins_with("rv:") + _fishing_spot.set_fishing_environment_enabled(not inside_rv) + _game_ui.set_rv_interior_camera_mode( + inside_rv + ) + _game_ui.set_rv_storage_button_visible( + _can_show_rv_storage_button() + ) + + +func _on_rv_storage_requested() -> void: + if not _can_show_rv_storage_button(): + return + _game_ui.get_player_storage().open_storage_from_home(true) + + func _can_show_shop_prompt() -> bool: return ( _gameplay_started and _shop_interaction != null and _shop_interaction.is_local_player_in_range() and not _game_ui.get_fishing_shop().visible + and not _game_ui.get_decor_shop().visible and not _water_recovery.is_recovery_active() and _fishing_spot.can_open_fishing_shop() ) + + +func _can_show_decor_shop_prompt() -> bool: + return ( + _gameplay_started + and _decor_shop_interaction != null + and _decor_shop_interaction.is_local_player_in_range() + and not _game_ui.get_decor_shop().visible + and not _game_ui.get_fishing_shop().visible + and not _water_recovery.is_recovery_active() + and _fishing_spot.can_open_fishing_shop() + ) + + +func _can_show_storage_prompt() -> bool: + return not _get_home_prompt().is_empty() + + +func _can_show_rv_storage_button() -> bool: + return ( + _gameplay_started + and not _network_home.get_local_home_owner_fingerprint().is_empty() + and _network_home.can_local_decorate() + and not _water_recovery.is_recovery_active() + and _fishing_spot.can_open_fishing_shop() + ) + + +func _get_home_prompt() -> Dictionary: + if ( + not _gameplay_started + or _game_ui.get_player_storage().visible + or _game_ui.get_fishing_shop().visible + or _game_ui.get_decor_shop().visible + or _water_recovery.is_recovery_active() + or not _fishing_spot.can_open_fishing_shop() + ): + return {} + var owner_fingerprint: String = ( + _network_home.get_local_home_owner_fingerprint() + ) + if not owner_fingerprint.is_empty(): + if _home_world.is_avatar_near_interior_exit( + _player, owner_fingerprint + ): + return { + "label": "leave RV", + "anchor": _home_world.get_interior_prompt_position( + owner_fingerprint + ), + } + return {} + var nearby_owner: String = _home_world.find_nearby_exterior_owner(_player) + if nearby_owner.is_empty(): + return {} + return { + "label": "enter RV", + "anchor": _home_world.get_exterior_prompt_position(nearby_owner), + } diff --git a/main/main.tscn b/main/main.tscn index ee846d6..778a1d4 100644 --- a/main/main.tscn +++ b/main/main.tscn @@ -12,7 +12,6 @@ [ext_resource type="Script" uid="uid://dwv3nvfke5xtu" path="res://settings/player_settings_manager.gd" id="10_settings"] [ext_resource type="Resource" path="res://items/catalog/item_catalog.tres" id="11_items"] [ext_resource type="Resource" path="res://economy/buyers/main_fishing_shop.tres" id="12_main_shop"] -[ext_resource type="AudioStream" uid="uid://bgkfluumuen4m" path="res://audio/music/title/as_in_four_wolves.ogg" id="13_title_music"] [ext_resource type="Script" uid="uid://bdtb05vkiicd" path="res://ui/ui_pixelation_presenter.gd" id="14_pixelation"] [ext_resource type="PackedScene" path="res://ui/pixelation_reset_overlay.tscn" id="15_reset"] [ext_resource type="PackedScene" path="res://main/world_pixelation_postprocess.tscn" id="16_world_pixelation"] @@ -39,7 +38,7 @@ [ext_resource type="Script" uid="uid://dpiv6wttry0j4" path="res://network/player_data_root.gd" id="37_data_root"] [ext_resource type="Script" uid="uid://bu5q4a8jfvxkf" path="res://network/identity_backup_service.gd" id="38_identity_backup"] [ext_resource type="Script" uid="uid://djmxy6jibi5y3" path="res://ui/interface_font_controller.gd" id="39_fonts"] -[ext_resource type="Shader" uid="uid://c8s1g7tn771du" path="res://ui/title_water_background.gdshader" id="40_title_water"] +[ext_resource type="Texture2D" uid="uid://doju2lbj2ghwa" path="res://world/generation/chunks/assets/chunk_0000_grass_lite.png" id="40_title_grass"] [ext_resource type="Texture2D" uid="uid://f8a0cs0s7ler" path="res://art/patterns/pattern_tealdot.png" id="41_menu_pattern"] [ext_resource type="Shader" uid="uid://byw3iub66qvog" path="res://ui/player_menu_pattern.gdshader" id="42_menu_pattern"] [ext_resource type="Texture2D" uid="uid://b6xws1d2dnbnn" path="res://art/patterns/pattern_moneyfish.png" id="43_shop_pattern"] @@ -53,27 +52,23 @@ [ext_resource type="Script" uid="uid://daqtje84gqgu0" path="res://jobs/player_job_service.gd" id="52_player_jobs"] [ext_resource type="Script" uid="uid://drlyytr2o3uw8" path="res://network/network_job_service.gd" id="53_network_jobs"] [ext_resource type="Script" uid="uid://b0c3o2vy76fg3" path="res://world/shoreline_ambience.gd" id="54_shoreline_ambience"] -[ext_resource type="AudioStream" uid="uid://dck3tf8qkadea" path="res://audio/ambience/waves.wav" id="55_waves"] [ext_resource type="Script" uid="uid://c80x8jkdnx0xy" path="res://settings/controller_mapping_manager.gd" id="56_controller_mapping"] [ext_resource type="Script" path="res://settings/keyboard_mouse_mapping_manager.gd" id="keyboard_mouse_mapping"] [ext_resource type="Script" uid="uid://d0jv8n2nfqia0" path="res://network/discovery_client.gd" id="57_discovery"] -[ext_resource type="AudioStream" uid="uid://c4y8puv0n6xk8" path="res://audio/music/world/craft.mp3" id="dusk_music"] [ext_resource type="Resource" path="res://gathering/catalog/gatherable_catalog.tres" id="58_gatherable_catalog"] [ext_resource type="Script" path="res://network/network_world_spawn_service.gd" id="59_world_spawns"] [ext_resource type="Script" path="res://gathering/gathering_controller.gd" id="60_gathering_controller"] +[ext_resource type="Script" path="res://homes/player_home_state.gd" id="61_home_state"] +[ext_resource type="Script" path="res://homes/home_world_service.gd" id="62_home_world"] +[ext_resource type="Script" path="res://network/network_home_service.gd" id="63_network_home"] +[ext_resource type="Script" path="res://homes/home_decor_controller.gd" id="64_home_decor_controller"] -[sub_resource type="ShaderMaterial" id="ShaderMaterial_title_water_native"] -shader = ExtResource("40_title_water") -shader_parameter/surface_color = Color(0.1, 0.45, 0.62, 1) -shader_parameter/middle_color = Color(0.055, 0.285, 0.4, 1) -shader_parameter/depth_color = Color(0.02, 0.16, 0.27, 1) -shader_parameter/virtual_pixel_density = Vector2(320, 180) -shader_parameter/color_step_count = 14.0 -shader_parameter/continuous_depth_blend = 0.12 -shader_parameter/wave_speed = 0.1 -shader_parameter/wave_scale = 2.4 -shader_parameter/wave_strength = 0.012 -shader_parameter/caustic_strength = 0.018 +[sub_resource type="ShaderMaterial" id="ShaderMaterial_title_grass_native"] +shader = ExtResource("42_menu_pattern") +shader_parameter/pattern_texture = ExtResource("40_title_grass") +shader_parameter/source_tile_size = Vector2(128, 128) +shader_parameter/display_scale = 1.0 +shader_parameter/scroll_velocity_pixels = Vector2(-7.5, -7.5) [sub_resource type="ShaderMaterial" id="ShaderMaterial_player_menu_pattern"] shader = ExtResource("42_menu_pattern") @@ -142,7 +137,7 @@ layer = -1 [node name="TitleBackground" type="ColorRect" parent="TitleBackgroundLayer" unique_id=1768697365] unique_name_in_owner = true -material = SubResource("ShaderMaterial_title_water_native") +material = SubResource("ShaderMaterial_title_grass_native") anchors_preset = 15 anchor_right = 1.0 anchor_bottom = 1.0 @@ -268,6 +263,14 @@ script = ExtResource("22_network_sale") unique_name_in_owner = true script = ExtResource("23_network_shop") +[node name="NetworkHomeService" type="Node" parent="."] +unique_name_in_owner = true +script = ExtResource("63_network_home") + +[node name="HomeDecorController" type="Node" parent="."] +unique_name_in_owner = true +script = ExtResource("64_home_decor_controller") + [node name="NetworkItemUseService" type="Node" parent="." unique_id=255154670] unique_name_in_owner = true script = ExtResource("24_network_item") @@ -301,48 +304,11 @@ unique_name_in_owner = true script = ExtResource("36_player_list") [node name="TestWorld" parent="." unique_id=1334932296 instance=ExtResource("1_world")] -transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -2.4475808, 0, -1.8959346) +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0) [node name="Sun" parent="TestWorld/Environment" index="1"] transform = Transform3D(0.8480481, 0.4287137, -0.31147876, 0, 0.5877853, 0.809017, 0.52991927, -0.68608534, 0.49847022, 0, 0, 0) -[node name="Shape" parent="TestWorld/Regions/StarterIslandRegion/Terrain/Collision" index="0" unique_id=674742331] -shape = SubResource("ConcavePolygonShape3D_hifdc") - -[node name="Pond" parent="TestWorld/Regions/StarterIslandRegion/WaterBodies" index="0" unique_id=995477450] -transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -9.4, 2.51, 2.1) - -[node name="VisualWater" parent="TestWorld/Regions/StarterIslandRegion/WaterBodies/Pond" index="0" unique_id=1034265960] -mesh = SubResource("PlaneMesh_7ny4s") - -[node name="Shape" parent="TestWorld/Regions/StarterIslandRegion/WaterBodies/Pond/FishingRegion" index="0" unique_id=1185360438] -transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -2, 0) -shape = SubResource("BoxShape3D_agj3o") - -[node name="Shape" parent="TestWorld/Regions/StarterIslandRegion/WaterBodies/Pond/RecoveryRegion" index="0" unique_id=1718808476] -shape = SubResource("BoxShape3D_l6210") - -[node name="VisualWater" parent="TestWorld/Regions/StarterIslandRegion/WaterBodies/Ocean" index="0" unique_id=1176408937] -mesh = SubResource("PlaneMesh_6upbg") - -[node name="Shape" parent="TestWorld/Regions/StarterIslandRegion/WaterBodies/Ocean/FishingRegions/OceanFishingRegion" index="0" unique_id=357406062] -shape = SubResource("BoxShape3D_umo15") - -[node name="WestShape" parent="TestWorld/Regions/StarterIslandRegion/WaterBodies/Ocean/RecoveryRegions/OceanRecoveryRegion" index="0" unique_id=1183368645] -shape = SubResource("BoxShape3D_1fdkm") - -[node name="EastShape" parent="TestWorld/Regions/StarterIslandRegion/WaterBodies/Ocean/RecoveryRegions/OceanRecoveryRegion" index="1" unique_id=1742419808] -shape = SubResource("BoxShape3D_y2c0j") - -[node name="NorthShape" parent="TestWorld/Regions/StarterIslandRegion/WaterBodies/Ocean/RecoveryRegions/OceanRecoveryRegion" index="2" unique_id=1844920260] -shape = SubResource("BoxShape3D_uwwqy") - -[node name="SouthShape" parent="TestWorld/Regions/StarterIslandRegion/WaterBodies/Ocean/RecoveryRegions/OceanRecoveryRegion" index="3" unique_id=1316495770] -shape = SubResource("BoxShape3D_hf28p") - -[node name="FishingShopWorld" parent="TestWorld/Regions/StarterIslandRegion/Interactables" index="0" unique_id=1255373524] -transform = Transform3D(-0.9976046, 0, -0.06917416, 0, 1, 0, 0.06917416, 0, -0.9976046, 7.3292284, 3.4012775, 14.888193) - [node name="BelowWorldFailsafe" parent="TestWorld/Safety" index="0"] transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 12, -7, 0) @@ -368,6 +334,10 @@ transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 3.3999481, 12.07081) [node name="WorldGatherables" type="Node3D" parent="."] +[node name="HomeWorldService" type="Node3D" parent="."] +unique_name_in_owner = true +script = ExtResource("62_home_world") + [node name="GatheringController" type="Node3D" parent="."] unique_name_in_owner = true script = ExtResource("60_gathering_controller") @@ -384,6 +354,10 @@ script = ExtResource("8_recovery") unique_name_in_owner = true script = ExtResource("9_save") +[node name="PlayerHomeState" type="Node" parent="."] +unique_name_in_owner = true +script = ExtResource("61_home_state") + [node name="PlayerSettingsManager" type="Node" parent="." unique_id=906991991] unique_name_in_owner = true script = ExtResource("10_settings") @@ -398,13 +372,15 @@ script = ExtResource("keyboard_mouse_mapping") [node name="TitleMusic" type="AudioStreamPlayer" parent="." unique_id=1292939956] unique_name_in_owner = true -stream = ExtResource("13_title_music") volume_db = -80.0 bus = &"Music" +[node name="NewGameMusic" type="AudioStreamPlayer" parent="."] +unique_name_in_owner = true +bus = &"Music" + [node name="DuskMusic" type="AudioStreamPlayer" parent="." unique_id=992744241] unique_name_in_owner = true -stream = ExtResource("dusk_music") bus = &"Music" [node name="ShorelineAmbience" type="Node" parent="." unique_id=1948037177] @@ -413,7 +389,6 @@ script = ExtResource("54_shoreline_ambience") [node name="WavesAudio" type="AudioStreamPlayer" parent="ShorelineAmbience" unique_id=193530658] unique_name_in_owner = true -stream = ExtResource("55_waves") bus = &"Environment" [node name="WorldPixelationPostprocess" parent="." unique_id=344378000 instance=ExtResource("16_world_pixelation")] @@ -442,4 +417,3 @@ unique_name_in_owner = true unique_name_in_owner = true [editable path="TestWorld"] -[editable path="TestWorld/Regions/StarterIslandRegion"] diff --git a/main/runtime_performance_profile.gd b/main/runtime_performance_profile.gd index cd6395e..f18e63a 100644 --- a/main/runtime_performance_profile.gd +++ b/main/runtime_performance_profile.gd @@ -2,21 +2,35 @@ class_name RuntimePerformanceProfile extends RefCounted const PROFILE_ENVIRONMENT_VARIABLE: String = ( + "straywild_PERFORMANCE_PROFILE" +) +const LEGACY_LIGHT_ENVIRONMENT_VARIABLE: String = "straywild_LOW_END" +const NETFISHING_PROFILE_ENVIRONMENT_VARIABLE := ( "NETFISHING_PERFORMANCE_PROFILE" ) -const LEGACY_LIGHT_ENVIRONMENT_VARIABLE: String = "NETFISHING_LOW_END" +const NETFISHING_LIGHT_ENVIRONMENT_VARIABLE := "NETFISHING_LOW_END" const NORMAL_PROFILE: StringName = &"normal" const LIGHT_PROFILE: StringName = &"light" const NORMAL_WORLD_RENDER_SCALE: float = 1.0 -const LIGHT_WORLD_RENDER_SCALE: float = 0.5 +const LIGHT_WORLD_RENDER_SCALE: float = 0.375 var _profile_name: StringName = NORMAL_PROFILE static func from_environment() -> RuntimePerformanceProfile: + var profile_name: String = OS.get_environment( + PROFILE_ENVIRONMENT_VARIABLE + ) + if profile_name.is_empty(): + profile_name = OS.get_environment( + NETFISHING_PROFILE_ENVIRONMENT_VARIABLE + ) return from_name( - StringName(OS.get_environment(PROFILE_ENVIRONMENT_VARIABLE)), - OS.get_environment(LEGACY_LIGHT_ENVIRONMENT_VARIABLE) == "1", + StringName(profile_name), + ( + OS.get_environment(LEGACY_LIGHT_ENVIRONMENT_VARIABLE) == "1" + or OS.get_environment(NETFISHING_LIGHT_ENVIRONMENT_VARIABLE) == "1" + ), ) diff --git a/main/texture_sampling_policy.gd b/main/texture_sampling_policy.gd index 3d041d0..35a92a0 100644 --- a/main/texture_sampling_policy.gd +++ b/main/texture_sampling_policy.gd @@ -1,6 +1,6 @@ extends Node -## Enforces NETfishing's nearest-neighbor-only artwork policy at runtime. +## Enforces straywild's nearest-neighbor-only artwork policy at runtime. ## ## Godot uses separate texture-filter enums for CanvasItem and 3D materials. ## Applying both here prevents imported models, dynamically created controls, @@ -15,8 +15,12 @@ func _enter_tree() -> void: func _on_node_added(node: Node) -> void: enforce_node(node) # Some runtime presenters assign their mesh or material immediately after - # add_child(). Recheck once deferred so those resources are covered too. - call_deferred("_enforce_deferred_node", weakref(node)) + # add_child(). Recheck those 3D resource owners once deferred so the newly + # assigned resources are covered too. CanvasItems keep their filter setting + # when their texture changes, so deferring every dynamic UI node only floods + # the message queue during large inventory and catalog refreshes. + if _needs_deferred_resource_check(node): + call_deferred("_enforce_deferred_node", weakref(node)) func _enforce_existing_tree() -> void: @@ -29,6 +33,15 @@ func _enforce_deferred_node(node_ref: WeakRef) -> void: enforce_node(node) +static func _needs_deferred_resource_check(node: Node) -> bool: + return ( + node is GeometryInstance3D + or node is MultiMeshInstance3D + or node is GPUParticles3D + or node is CPUParticles3D + ) + + static func enforce_subtree(node: Node) -> void: enforce_node(node) for child: Node in node.get_children(): diff --git a/network/discovery_client.gd b/network/discovery_client.gd index bf15bbf..d8e602a 100644 --- a/network/discovery_client.gd +++ b/network/discovery_client.gd @@ -9,14 +9,24 @@ signal host_state_changed(state: int) signal public_join_prepared(endpoint: String) signal public_join_status_changed(message: String, is_error: bool) signal public_join_state_changed(state: int) +signal friend_presence_updated(friends: Array[Dictionary]) +signal presence_sharing_changed(enabled: bool) +signal social_status_changed(message: String, is_error: bool) +signal friend_invite_received( + fingerprint: String, + display_name: String, + room: Dictionary, +) +signal friend_invite_finished(success: bool, message: String) const BASE_URL_SETTING: String = "network/discovery/base_url" -const BASE_URL_ENVIRONMENT: String = "NETFISHING_DISCOVERY_URL" +const BASE_URL_ENVIRONMENT: String = "straywild_DISCOVERY_URL" +const LEGACY_BASE_URL_ENVIRONMENT: String = "NETFISHING_DISCOVERY_URL" const SETTINGS_PATH: String = "user://network_discovery.cfg" const DEFAULT_ROOM_NAME: String = "Player's Server" -const LEGACY_DEFAULT_ROOM_NAME: String = "NETfishing Room" +const LEGACY_DEFAULT_ROOM_NAME: String = "straywild Room" const LEGACY_DEDICATED_DEFAULT_ROOM_NAME: String = ( - "NETfishing Dedicated Server" + "straywild Dedicated Server" ) const ROOM_NAME_SUFFIX: String = "'s Server" const MAX_ROOM_NAME_LENGTH: int = 48 @@ -24,10 +34,11 @@ const HEARTBEAT_INTERVAL_SECONDS: float = 15.0 const REQUEST_TIMEOUT_SECONDS: float = 8.0 const TRAVERSAL_POLL_INTERVAL_SECONDS: float = 1.0 const JOIN_PROBE_INTERVAL_SECONDS: float = 0.35 -const TRAVERSAL_PACKET_PREFIX: String = "NETFISHING_TRAVERSAL_V1 " +const TRAVERSAL_PACKET_PREFIX: String = "straywild_TRAVERSAL_V1 " const UPNP_MAPPING_DURATION_SECONDS: int = 3600 const UPNP_RENEW_INTERVAL_SECONDS: float = 2700.0 const UPNP_RETRY_INTERVAL_SECONDS: float = 300.0 +const SOCIAL_POLL_INTERVAL_SECONDS: float = 5.0 enum HostState { UNAVAILABLE, @@ -55,6 +66,7 @@ enum HostRequestKind { } var _session: NetworkSession +var _relationships: PlayerRelationshipStore var _base_url: String = "" var _room_name: String = DEFAULT_ROOM_NAME var _room_name_uses_default: bool = true @@ -92,6 +104,18 @@ var _upnp_operation_is_renewal: bool = false var _upnp_renew_timer: Timer var _upnp: UPNP var _upnp_mapped_port: int = 0 +var _presence_sharing: bool = false +var _social_timer: Timer +var _presence_request: HTTPRequest +var _presence_query_request: HTTPRequest +var _invitation_poll_request: HTTPRequest +var _invitation_send_request: HTTPRequest +var _friend_presence: Dictionary[String, Dictionary] = {} +var _published_presence_tokens: PackedStringArray = PackedStringArray() +var _pending_presence_online: bool = false +var _pending_presence_tokens: PackedStringArray = PackedStringArray() +var _pending_invite_fingerprint: String = "" +var _joined_public_room_id: String = "" func _ready() -> void: @@ -147,16 +171,48 @@ func _ready() -> void: _join_probe_timer.one_shot = false add_child(_join_probe_timer) _join_probe_timer.timeout.connect(_send_pending_join_probe) + + _presence_request = _make_social_request( + "FriendPresencePublish", _on_presence_request_completed + ) + _presence_query_request = _make_social_request( + "FriendPresenceQuery", _on_presence_query_completed + ) + _invitation_poll_request = _make_social_request( + "FriendInvitationPoll", _on_invitation_poll_completed + ) + _invitation_send_request = _make_social_request( + "FriendInvitationSend", _on_invitation_send_completed + ) + _social_timer = Timer.new() + _social_timer.name = "FriendPresencePoll" + _social_timer.wait_time = SOCIAL_POLL_INTERVAL_SECONDS + _social_timer.one_shot = false + add_child(_social_timer) + _social_timer.timeout.connect(_refresh_social_state) _load_settings() _base_url = _configured_base_url() -func setup(session: NetworkSession) -> void: +func setup( + session: NetworkSession, + relationships: PlayerRelationshipStore = null, +) -> void: _session = session + _relationships = relationships if _room_name_uses_default: _room_name = _default_room_name(_session.get_local_display_name()) _save_settings() _session.set_session_display_name(_room_name) + if ( + _relationships != null + and not _relationships.relationship_changed.is_connected( + _on_social_relationship_changed + ) + ): + _relationships.relationship_changed.connect( + _on_social_relationship_changed + ) if not _session.state_changed.is_connected(_on_session_state_changed): _session.state_changed.connect(_on_session_state_changed) if not _session.peer_count_changed.is_connected(_on_peer_count_changed): @@ -173,6 +229,9 @@ func setup(session: NetworkSession) -> void: else: _set_host_state(HostState.CLOSED) _set_host_status("Open the game before listing it publicly.", false) + if is_configured() and _relationships != null: + _social_timer.start() + call_deferred("_refresh_social_state") func is_configured() -> bool: @@ -183,6 +242,112 @@ func get_base_url() -> String: return _base_url +func is_presence_sharing() -> bool: + return _presence_sharing + + +func set_presence_sharing(enabled: bool) -> bool: + if enabled and (not is_configured() or _relationships == null): + social_status_changed.emit( + "Friend presence is not configured in this build.", true + ) + return false + if _presence_sharing == enabled: + return true + _presence_sharing = enabled + _save_settings() + presence_sharing_changed.emit(enabled) + _refresh_social_state() + return true + + +func get_friend_presence() -> Array[Dictionary]: + var result: Array[Dictionary] = [] + if _relationships == null: + return result + for friend: Dictionary in _relationships.get_friends(): + var fingerprint := str(friend.get("fingerprint", "")) + var live: Dictionary = _friend_presence.get(fingerprint, {}) + result.append({ + "fingerprint": fingerprint, + "display_name": str( + friend.get("last_known_display_name", "Player") + ), + "online": bool(live.get("online", false)), + "room": ( + live.get("room", {}).duplicate(true) + if typeof(live.get("room", {})) == TYPE_DICTIONARY + else {} + ), + }) + result.sort_custom(func(a: Dictionary, b: Dictionary) -> bool: + if bool(a["online"]) != bool(b["online"]): + return bool(a["online"]) + return str(a["display_name"]).naturalnocasecmp_to( + str(b["display_name"]) + ) < 0 + ) + return result + + +func request_friend_presence() -> bool: + if not is_configured() or _relationships == null: + friend_presence_updated.emit(get_friend_presence()) + return false + _refresh_social_state() + return true + + +func send_friend_invite(fingerprint: String) -> bool: + if ( + _relationships == null + or not _relationships.is_friend(fingerprint) + or _relationships.is_blocked(fingerprint) + or not is_configured() + ): + friend_invite_finished.emit( + false, "This person needs to be online to do this." + ) + return false + if ( + _session == null + or not _session.is_host() + or not _host_verified + or _lease_room_id.is_empty() + ): + friend_invite_finished.emit( + false, + "List your open room in discovery before inviting friends.", + ) + return false + if ( + not _pending_invite_fingerprint.is_empty() + or _invitation_send_request.get_http_client_status() + != HTTPClient.STATUS_DISCONNECTED + ): + return false + var friend: Dictionary = _relationships.get_friend_record(fingerprint) + var inbox_token := str(friend.get("remote_invite_token", "")) + if inbox_token.is_empty(): + friend_invite_finished.emit(false, "Friend invitation is unavailable.") + return false + var error := _post_social_json( + _invitation_send_request, + "/v1/invitations", + { + "inbox_token": inbox_token, + "room_id": _lease_room_id, + }, + ) + if error != OK: + friend_invite_finished.emit( + false, "Friend invitation could not be sent." + ) + return false + _pending_invite_fingerprint = fingerprint + return true + + func set_base_url_override(value: String) -> bool: var normalized: String = value.strip_edges() while normalized.ends_with("/"): @@ -345,7 +510,7 @@ func prepare_public_join(room: Dictionary) -> bool: func request_rooms() -> bool: if not is_configured(): - rooms_updated.emit([]) + rooms_updated.emit(_empty_rooms()) browse_status_changed.emit( "Public room discovery is not configured in this build.", true ) @@ -362,7 +527,7 @@ func request_rooms() -> bool: ] var error: Error = _browse_request.request(url) if error != OK: - rooms_updated.emit([]) + rooms_updated.emit(_empty_rooms()) browse_status_changed.emit("Could not request public rooms.", true) return false _browse_request_in_flight = true @@ -389,6 +554,10 @@ func is_own_room(room: Dictionary) -> bool: func _configured_base_url() -> String: var value: String = OS.get_environment(BASE_URL_ENVIRONMENT).strip_edges() + if value.is_empty(): + value = OS.get_environment( + LEGACY_BASE_URL_ENVIRONMENT + ).strip_edges() if value.is_empty(): value = str(ProjectSettings.get_setting(BASE_URL_SETTING, "")).strip_edges() while value.ends_with("/"): @@ -396,7 +565,7 @@ func _configured_base_url() -> String: if not value.is_empty() and not ( value.begins_with("https://") or value.begins_with("http://") ): - push_warning("Ignored invalid NETfishing discovery URL.") + push_warning("Ignored invalid straywild discovery URL.") return "" return value @@ -645,7 +814,7 @@ func _on_traversal_request_completed( var port: int = int(endpoint.get("port", 0)) if address.is_empty() or port < 1 or port > 65535: continue - var punch: PackedByteArray = "NETFISHING_PUNCH_V1".to_utf8_buffer() + var punch: PackedByteArray = "straywild_PUNCH_V1".to_utf8_buffer() for _attempt: int in 3: _session.send_traversal_packet(address, port, punch) @@ -731,13 +900,13 @@ func _configure_upnp_mapping(port: int) -> Dictionary: var mapping_result: int = upnp.add_port_mapping( port, port, - "NETfishing", + "straywild", "UDP", UPNP_MAPPING_DURATION_SECONDS, ) if mapping_result == UPNP.UPNP_RESULT_ONLY_PERMANENT_LEASE_SUPPORTED: mapping_result = upnp.add_port_mapping( - port, port, "NETfishing", "UDP", 0 + port, port, "straywild", "UDP", 0 ) return { "success": mapping_result == UPNP.UPNP_RESULT_SUCCESS, @@ -813,12 +982,12 @@ func _on_browse_request_completed( _browse_request_in_flight = false var response: Dictionary = _parse_response_dictionary(body) if result != HTTPRequest.RESULT_SUCCESS or response_code != HTTPClient.RESPONSE_OK: - rooms_updated.emit([]) + rooms_updated.emit(_empty_rooms()) browse_status_changed.emit(_request_failure(response), true) return var raw_rooms: Variant = response.get("rooms", []) if typeof(raw_rooms) != TYPE_ARRAY: - rooms_updated.emit([]) + rooms_updated.emit(_empty_rooms()) browse_status_changed.emit("Discovery returned an invalid room list.", true) return var rooms: Array[Dictionary] = [] @@ -873,6 +1042,309 @@ func _valid_json_integer(value: Variant, minimum: int, maximum: int) -> bool: ) +func _make_social_request(name: String, callback: Callable) -> HTTPRequest: + var request := HTTPRequest.new() + request.name = name + request.timeout = REQUEST_TIMEOUT_SECONDS + add_child(request) + request.request_completed.connect(callback) + return request + + +func _social_payload(fields: Dictionary = {}) -> Dictionary: + var payload: Dictionary = fields.duplicate(true) + payload["game_version"] = NetworkProtocol.game_version() + payload["protocol_version"] = NetworkProtocol.PROTOCOL_VERSION + return payload + + +func _post_social_json( + request: HTTPRequest, + path: String, + fields: Dictionary, +) -> Error: + return request.request( + _base_url + path, + PackedStringArray(["Content-Type: application/json"]), + HTTPClient.METHOD_POST, + JSON.stringify(_social_payload(fields)), + ) + + +func _refresh_social_state() -> void: + if not is_configured() or _relationships == null: + return + _publish_friend_presence() + _query_friend_presence() + _poll_friend_invitations() + + +func _publish_friend_presence() -> void: + if ( + _presence_request.get_http_client_status() + != HTTPClient.STATUS_DISCONNECTED + ): + return + var current_tokens := _friend_social_values( + "local_presence_write_token" + ) + var online := _presence_sharing and not current_tokens.is_empty() + var publish_online := online + var tokens := PackedStringArray() + if online: + # Revoke removed or blocked friendships before refreshing the remaining + # capabilities. This makes status disappear on the next request instead of + # waiting for the server's short presence TTL. + tokens = _presence_tokens_not_in( + _published_presence_tokens, current_tokens + ) + if not tokens.is_empty(): + publish_online = false + else: + tokens = current_tokens + else: + tokens = _published_presence_tokens + if tokens.is_empty(): + return + var error := _post_social_json( + _presence_request, + "/v1/presence", + { + "display_name": _session.get_local_display_name(), + "room_id": _current_presence_room_id(), + "online": publish_online, + "write_tokens": Array(tokens), + }, + ) + if error == OK: + _pending_presence_online = publish_online + _pending_presence_tokens = tokens.duplicate() + else: + social_status_changed.emit("Could not update friend presence.", true) + + +func _query_friend_presence() -> void: + if ( + _presence_query_request.get_http_client_status() + != HTTPClient.STATUS_DISCONNECTED + ): + return + var channels := _friend_social_values("remote_presence_channel") + if channels.is_empty(): + var had_presence := not _friend_presence.is_empty() + _friend_presence.clear() + if had_presence: + friend_presence_updated.emit(get_friend_presence()) + return + var error := _post_social_json( + _presence_query_request, + "/v1/presence/query", + {"channels": Array(channels)}, + ) + if error != OK: + social_status_changed.emit("Could not refresh friend status.", true) + + +func _poll_friend_invitations() -> void: + if ( + _invitation_poll_request.get_http_client_status() + != HTTPClient.STATUS_DISCONNECTED + ): + return + var tokens := _friend_social_values("local_invite_token") + if tokens.is_empty(): + return + var error := _post_social_json( + _invitation_poll_request, + "/v1/invitations/poll", + {"inbox_tokens": Array(tokens)}, + ) + if error != OK: + social_status_changed.emit("Could not check friend invitations.", true) + + +func _friend_social_values(key: String) -> PackedStringArray: + var result := PackedStringArray() + if _relationships == null: + return result + for friend: Dictionary in _relationships.get_friends(): + var value := str(friend.get(key, "")) + if not value.is_empty() and value not in result: + result.append(value) + return result + + +func _current_presence_room_id() -> String: + if _session == null: + return "" + if _session.is_host() and _host_verified: + return _lease_room_id + if _session.is_joined_client(): + return _joined_public_room_id + return "" + + +func _on_presence_request_completed( + result: int, + response_code: int, + _headers: PackedStringArray, + body: PackedByteArray, +) -> void: + var published_online := _pending_presence_online + var request_tokens := _pending_presence_tokens.duplicate() + _pending_presence_online = false + _pending_presence_tokens = PackedStringArray() + var response := _parse_response_dictionary(body) + if result != HTTPRequest.RESULT_SUCCESS or response_code != HTTPClient.RESPONSE_OK: + social_status_changed.emit(_request_failure(response), true) + return + if published_online: + for token: String in request_tokens: + if token not in _published_presence_tokens: + _published_presence_tokens.append(token) + else: + for token: String in request_tokens: + var index := _published_presence_tokens.find(token) + if index >= 0: + _published_presence_tokens.remove_at(index) + if _presence_publish_needs_follow_up(): + call_deferred("_publish_friend_presence") + + +func _presence_publish_needs_follow_up() -> bool: + var desired := ( + _friend_social_values("local_presence_write_token") + if _presence_sharing + else PackedStringArray() + ) + return ( + not _presence_tokens_not_in( + _published_presence_tokens, desired + ).is_empty() + or not _presence_tokens_not_in( + desired, _published_presence_tokens + ).is_empty() + ) + + +func _presence_tokens_not_in( + first: PackedStringArray, + second: PackedStringArray, +) -> PackedStringArray: + var result := PackedStringArray() + for token: String in first: + if token not in second: + result.append(token) + return result + + +func _on_presence_query_completed( + result: int, + response_code: int, + _headers: PackedStringArray, + body: PackedByteArray, +) -> void: + var response := _parse_response_dictionary(body) + if result != HTTPRequest.RESULT_SUCCESS or response_code != HTTPClient.RESPONSE_OK: + social_status_changed.emit(_request_failure(response), true) + return + var by_channel: Dictionary[String, String] = {} + for friend: Dictionary in _relationships.get_friends(): + by_channel[str(friend.get("remote_presence_channel", ""))] = str( + friend.get("fingerprint", "") + ) + var next_presence: Dictionary[String, Dictionary] = {} + var raw_presence: Variant = response.get("presence", []) + if typeof(raw_presence) == TYPE_ARRAY: + for value: Variant in raw_presence: + if typeof(value) != TYPE_DICTIONARY: + continue + var presence: Dictionary = value + var fingerprint := str( + by_channel.get(str(presence.get("channel", "")), "") + ) + if fingerprint.is_empty() or _relationships.is_blocked(fingerprint): + continue + var room: Dictionary = {} + var raw_room: Variant = presence.get("room", {}) + if typeof(raw_room) == TYPE_DICTIONARY and _valid_public_room(raw_room): + room = (raw_room as Dictionary).duplicate(true) + next_presence[fingerprint] = { + "online": true, + "room": room, + } + if next_presence == _friend_presence: + return + _friend_presence = next_presence + friend_presence_updated.emit(get_friend_presence()) + + +func _on_invitation_poll_completed( + result: int, + response_code: int, + _headers: PackedStringArray, + body: PackedByteArray, +) -> void: + var response := _parse_response_dictionary(body) + if result != HTTPRequest.RESULT_SUCCESS or response_code != HTTPClient.RESPONSE_OK: + return + var by_inbox: Dictionary[String, Dictionary] = {} + for friend: Dictionary in _relationships.get_friends(): + var token := str(friend.get("local_invite_token", "")) + if not token.is_empty(): + by_inbox[PlayerRelationshipStore.invite_inbox_id(token)] = friend + var invitations: Variant = response.get("invitations", []) + if typeof(invitations) != TYPE_ARRAY: + return + for value: Variant in invitations: + if typeof(value) != TYPE_DICTIONARY: + continue + var invitation: Dictionary = value + var friend: Dictionary = by_inbox.get( + str(invitation.get("inbox_id", "")), {} + ) + var raw_room: Variant = invitation.get("room", {}) + if friend.is_empty() or typeof(raw_room) != TYPE_DICTIONARY: + continue + var room := raw_room as Dictionary + if not _valid_public_room(room): + continue + var fingerprint := str(friend.get("fingerprint", "")) + if _relationships.is_blocked(fingerprint): + continue + friend_invite_received.emit( + fingerprint, + str(friend.get("last_known_display_name", "Player")), + room.duplicate(true), + ) + + +func _on_invitation_send_completed( + result: int, + response_code: int, + _headers: PackedStringArray, + body: PackedByteArray, +) -> void: + _pending_invite_fingerprint = "" + var response := _parse_response_dictionary(body) + var success := ( + result == HTTPRequest.RESULT_SUCCESS + and response_code == HTTPClient.RESPONSE_CREATED + ) + friend_invite_finished.emit( + success, + "Invitation sent." if success else _request_failure(response), + ) + + +func _on_social_relationship_changed(_fingerprint: String) -> void: + for fingerprint: String in _friend_presence.keys(): + if not _relationships.is_friend(fingerprint): + _friend_presence.erase(fingerprint) + friend_presence_updated.emit(get_friend_presence()) + call_deferred("_refresh_social_state") + + func _parse_response_dictionary(body: PackedByteArray) -> Dictionary: if body.is_empty(): return {} @@ -907,23 +1379,38 @@ func _discovery_version_mismatch_message(required_version: String) -> String: match rejection: NetworkProtocol.RejectionCode.CLIENT_OUTDATED: return ( - "Your NETfishing version is out of date. Update to %s to " + "Your straywild version is out of date. Update to %s to " + "enable public discovery. This room will not be listed " + "until you update." ) % required_version NetworkProtocol.RejectionCode.SERVER_OUTDATED: return ( - "Public discovery is still on NETfishing %s. This room " + "Public discovery is still on straywild %s. This room " + "will not be listed until discovery is updated for %s." ) % [required_version, local_version] _: return ( - "Public discovery requires NETfishing %s. This room will " + "Public discovery requires straywild %s. This room will " + "not be listed until both versions match." ) % required_version func _on_session_state_changed(state: NetworkSession.State) -> void: + if state == NetworkSession.State.JOINED_CLIENT: + if not _pending_join_room_id.is_empty(): + _joined_public_room_id = _pending_join_room_id + elif state in [ + NetworkSession.State.PRIVATE_HOST, + NetworkSession.State.OPEN_HOST, + NetworkSession.State.SERVER_LOST, + NetworkSession.State.CONNECTION_FAILED, + ]: + _joined_public_room_id = "" + elif ( + state == NetworkSession.State.INACTIVE + and not _preserve_pending_join_on_inactive + ): + _joined_public_room_id = "" if state == NetworkSession.State.CONNECTING and not _pending_join_token.is_empty(): _preserve_pending_join_on_inactive = false _set_public_join_state(PublicJoinState.CONNECTING) @@ -979,6 +1466,7 @@ func _on_session_state_changed(state: NetworkSession.State) -> void: _set_host_status("Open the game before listing it publicly.", false) else: _set_host_state(HostState.CLOSED) + call_deferred("_refresh_social_state") func _on_host_openness_changed(is_open: bool) -> void: @@ -1039,6 +1527,10 @@ func _set_public_join_state(state: PublicJoinState) -> void: public_join_state_changed.emit(int(state)) +func _empty_rooms() -> Array[Dictionary]: + return [] + + func _sanitize_room_name(value: String) -> String: var cleaned: String = value.strip_edges().replace("\n", " ").replace("\r", " ") cleaned = cleaned.replace("\t", " ") @@ -1065,7 +1557,7 @@ func _load_settings() -> void: ) if not saved_name.is_empty(): _room_name = saved_name - _room_name_uses_default = bool(config.get_value( + _room_name_uses_default = bool(config.get_value( "host", "room_name_uses_default", saved_name in [ @@ -1073,6 +1565,9 @@ func _load_settings() -> void: LEGACY_DEFAULT_ROOM_NAME, LEGACY_DEDICATED_DEFAULT_ROOM_NAME, ], + )) + _presence_sharing = bool(config.get_value( + "social", "share_presence", false )) @@ -1084,6 +1579,7 @@ func _save_settings() -> void: config.set_value( "host", "room_name_uses_default", _room_name_uses_default ) + config.set_value("social", "share_presence", _presence_sharing) var error: Error = config.save(SETTINGS_PATH) if error != OK: - push_warning("Could not save the local NETfishing room name.") + push_warning("Could not save local straywild discovery settings.") diff --git a/network/host_ban_store.gd b/network/host_ban_store.gd index f8c4bf9..1251846 100644 --- a/network/host_ban_store.gd +++ b/network/host_ban_store.gd @@ -17,6 +17,10 @@ var _data_root: PlayerDataRoot func configure_storage(path: String, data_root: PlayerDataRoot) -> void: _store_path = path _data_root = data_root + _namespaces.clear() + _loaded = false + _write_blocked = false + _expected_hash = "" func is_banned(host_fingerprint: String, target_fingerprint: String) -> bool: diff --git a/network/identity_backup_service.gd b/network/identity_backup_service.gd index ff7396c..c383e7b 100644 --- a/network/identity_backup_service.gd +++ b/network/identity_backup_service.gd @@ -3,7 +3,8 @@ extends Node signal operation_finished(success: bool, message: String) -const MAGIC := "NETFISHING_IDENTITY_BACKUP" +const MAGIC := "straywild_IDENTITY_BACKUP" +const LEGACY_MAGIC := "NETFISHING_IDENTITY_BACKUP" const FORMAT_VERSION := 1 const MAX_BACKUP_BYTES := 256 * 1024 const MIN_PASSPHRASE_LENGTH := 12 @@ -110,8 +111,9 @@ func inspect_backup( if json.parse(text) != OK or typeof(json.data) != TYPE_DICTIONARY: return {"ok": false} var data: Dictionary = json.data + var legacy_backup: bool = data.get("magic") == LEGACY_MAGIC if ( - data.get("magic") != MAGIC + data.get("magic") not in [MAGIC, LEGACY_MAGIC] or data.get("format_version") != FORMAT_VERSION or data.get("identity_type") != expected_type or data.get("algorithm") != NetworkIdentityCrypto.ALGORITHM @@ -134,12 +136,23 @@ func inspect_backup( var signature: PackedByteArray = Marshalls.base64_to_raw( str(data.get("self_signature", "")) ) - if not NetworkIdentityCrypto.verify_fields( - NetworkIdentityCrypto.load_public_key(public_pem), - "identity_backup_self_test", - [expected_type, fingerprint], - signature, - ): + var public_key: CryptoKey = NetworkIdentityCrypto.load_public_key(public_pem) + var backup_signature_valid: bool = ( + NetworkIdentityCrypto.verify_legacy_fields( + public_key, + "identity_backup_self_test", + [expected_type, fingerprint], + signature, + ) + if legacy_backup + else NetworkIdentityCrypto.verify_fields( + public_key, + "identity_backup_self_test", + [expected_type, fingerprint], + signature, + ) + ) + if not backup_signature_valid: return {"ok": false} var fresh: PackedByteArray = NetworkIdentityCrypto.sign_fields( key, "identity_import_self_test", [fingerprint] @@ -189,7 +202,7 @@ func import_backup( ) _finish( bool(result.get("ok", false)), - "Identity imported. Restart NETfishing before multiplayer." + "Identity imported. Restart straywild before multiplayer." if bool(result.get("ok", false)) else "Could not install this identity backup.", ) diff --git a/network/known_player_store.gd b/network/known_player_store.gd index 0c6b859..1118656 100644 --- a/network/known_player_store.gd +++ b/network/known_player_store.gd @@ -15,6 +15,10 @@ var _data_root: PlayerDataRoot func configure_storage(path: String, data_root: PlayerDataRoot) -> void: _store_path = path _data_root = data_root + _records.clear() + _loaded = false + _write_blocked = false + _expected_hash = "" func observe(fingerprint: String, display_name: String) -> String: diff --git a/network/network_chat_protocol.gd b/network/network_chat_protocol.gd index ef7294d..2e91432 100644 --- a/network/network_chat_protocol.gd +++ b/network/network_chat_protocol.gd @@ -9,6 +9,13 @@ const MAX_HISTORY: int = 100 const LATE_JOIN_HISTORY: int = 50 const MAX_ID_LENGTH: int = 96 +static var _invisible_edge_pattern: RegEx = RegEx.create_from_string( + "^[\\s\\p{Z}\\p{Cf}\\x{2800}]+|[\\s\\p{Z}\\p{Cf}\\x{2800}]+$" +) +static var _visible_content_pattern: RegEx = RegEx.create_from_string( + "[^\\s\\p{Z}\\p{Cf}\\x{2800}]" +) + enum Kind { PLAYER, SYSTEM } @@ -16,8 +23,13 @@ static func sanitize_body(value: Variant) -> String: if typeof(value) != TYPE_STRING: return "" var result: String = str(value).replace("\r", " ").replace("\n", " ") - result = result.replace("\t", " ").strip_edges() - if result.is_empty() or result.length() > MAX_VISIBLE_CHARACTERS: + result = result.replace("\t", " ") + result = _invisible_edge_pattern.sub(result, "", true) + if ( + result.is_empty() + or _visible_content_pattern.search(result) == null + or result.length() > MAX_VISIBLE_CHARACTERS + ): return "" if result.to_utf8_buffer().size() > MAX_UTF8_BYTES: return "" diff --git a/network/network_chat_service.gd b/network/network_chat_service.gd index 50c47d3..55ba768 100644 --- a/network/network_chat_service.gd +++ b/network/network_chat_service.gd @@ -4,8 +4,11 @@ extends Node const BURST_COUNT: int = 3 const WINDOW_COUNT: int = 5 const WINDOW_SECONDS: float = 10.0 -const CALL_COOLDOWN_MILLISECONDS: int = 180 -const WORLD_COMMAND_COOLDOWN_MILLISECONDS: int = 500 +const CALL_COOLDOWN_MILLISECONDS: int = 90 +const MAX_PENDING_MESSAGES_PER_PEER: int = 8 +const DEDICATED_CHAT_WARNING: String = ( + "Privacy notice: This dedicated server records and retains chat messages." +) const CALL_PITCH_VARIANTS: Array[float] = [ 0.96, 1.03, @@ -23,7 +26,6 @@ signal message_received(message: Dictionary) signal local_message_confirmed(message: Dictionary) signal send_rejected(message: String) signal history_replaced(messages: Array[Dictionary]) -signal world_command_finished(success: bool, message: String) signal character_call_received( peer_id: int, call_id: String, @@ -37,22 +39,40 @@ var _request_ledgers: Dictionary[int, Dictionary] = {} var _rate_times: Dictionary[int, Array] = {} var _last_call_msec: Dictionary[int, int] = {} var _call_variant_indices: Dictionary[int, int] = {} -var _last_world_command_msec: Dictionary[int, int] = {} var _sequence: int = 0 var _peer_names: Dictionary[int, String] = {} +var _pending_peer_messages: Dictionary[int, Array] = {} var _relationships: PlayerRelationshipStore -var _world_time: WorldTimeService -var _world_weather: WorldWeatherService +var _dedicated_history_enabled: bool = false +var _chat_log_path: String = "" -func setup( - session: NetworkSession, - world_time: WorldTimeService, - world_weather: WorldWeatherService, -) -> void: +func configure_dedicated_history(enabled: bool, log_path: String) -> bool: + _dedicated_history_enabled = false + _chat_log_path = "" + if not enabled: + return true + var normalized_path: String = log_path.strip_edges() + if normalized_path.is_empty() or not normalized_path.is_absolute_path(): + return false + var directory: String = normalized_path.get_base_dir() + if DirAccess.make_dir_recursive_absolute(directory) != OK: + return false + var file: FileAccess + if FileAccess.file_exists(normalized_path): + file = FileAccess.open(normalized_path, FileAccess.READ_WRITE) + else: + file = FileAccess.open(normalized_path, FileAccess.WRITE) + if file == null: + return false + file.close() + _dedicated_history_enabled = true + _chat_log_path = normalized_path + return true + + +func setup(session: NetworkSession) -> void: _session = session - _world_time = world_time - _world_weather = world_weather _session.peer_authenticated.connect(_on_peer_authenticated) _session.peer_removed.connect(_on_peer_removed) _session.state_changed.connect(_on_session_state_changed) @@ -77,7 +97,11 @@ func is_sender_filtered(fingerprint: String) -> bool: ) -func send_local_message(body: String) -> bool: +func send_local_message( + body: String, + voice_id: String = VoiceProfilesType.DEFAULT_ID, + sample_set_id: String = VoiceProfilesType.DEFAULT_SAMPLE_SET_ID, +) -> bool: if ( _session == null or not _session.is_gameplay_session_active() @@ -99,6 +123,10 @@ func send_local_message(body: String) -> bool: "session_id": _session.get_session_id(), "body": clean, "sender_fingerprint": _session.get_local_identity_fingerprint(), + "voice_id": VoiceProfilesType.sanitized_id(voice_id), + "sample_set_id": VoiceProfilesType.sanitized_sample_set_id( + sample_set_id + ), } request["sender_signature"] = _session.sign_local_action( "chat_send", NetworkChatProtocol.signature_fields(request) @@ -253,188 +281,6 @@ func broadcast_system_message(body: String) -> bool: return true -func request_world_time_change(phase_name: String) -> bool: - var normalized: String = phase_name.strip_edges().to_lower() - if not _valid_time_phase(normalized) or _session == null: - return false - if _session.is_host(): - return _apply_world_time_change(normalized) - if ( - not _session.is_joined_client() - or not _session.is_local_operator() - or not _session.supports_server_capability( - NetworkProtocol.WORLD_TIME_CAPABILITY - ) - ): - return false - submit_world_time_command.rpc_id(1, normalized) - return true - - -func request_world_weather_change(weather_name: String) -> bool: - var normalized: String = _normalized_weather_name(weather_name) - if normalized.is_empty() or _session == null: - return false - if _session.is_host(): - return _apply_world_weather_change(normalized) - if ( - not _session.is_joined_client() - or not _session.is_local_operator() - or not _session.supports_server_capability( - NetworkProtocol.WORLD_WEATHER_CAPABILITY - ) - ): - return false - submit_world_weather_command.rpc_id(1, normalized) - return true - - -@rpc("any_peer", "call_remote", "reliable", NetworkChatProtocol.RELIABLE_CHANNEL) -func submit_world_time_command(phase_name: String) -> void: - var sender_id: int = multiplayer.get_remote_sender_id() - if not _valid_world_command_sender(sender_id): - _send_world_command_result( - sender_id, false, "Only the host or an operator can change world time." - ) - return - if not _consume_world_command_rate(sender_id): - _send_world_command_result(sender_id, false, "Slow down.") - return - var success: bool = _apply_world_time_change( - phase_name.strip_edges().to_lower() - ) - _send_world_command_result( - sender_id, - success, - "" if success else "World time could not be changed.", - ) - - -@rpc("any_peer", "call_remote", "reliable", NetworkChatProtocol.RELIABLE_CHANNEL) -func submit_world_weather_command(weather_name: String) -> void: - var sender_id: int = multiplayer.get_remote_sender_id() - if not _valid_world_command_sender(sender_id): - _send_world_command_result( - sender_id, - false, - "Only the host or an operator can change world weather.", - ) - return - if not _consume_world_command_rate(sender_id): - _send_world_command_result(sender_id, false, "Slow down.") - return - var success: bool = _apply_world_weather_change( - _normalized_weather_name(weather_name) - ) - _send_world_command_result( - sender_id, - success, - "" if success else "World weather could not be changed.", - ) - - -@rpc("authority", "call_remote", "reliable", NetworkChatProtocol.RELIABLE_CHANNEL) -func receive_world_command_result(success: bool, message: String) -> void: - if _session == null or not _session.is_joined_client(): - return - world_command_finished.emit(success, message.left(120)) - - -func _valid_world_command_sender(peer_id: int) -> bool: - return ( - _session != null - and _session.is_host() - and peer_id > 1 - and _session.is_authenticated_peer(peer_id) - and _session.is_peer_operator(peer_id) - ) - - -func _apply_world_time_change(phase_name: String) -> bool: - if _world_time == null or not _valid_time_phase(phase_name): - return false - var target_hour: float = _time_phase_hour(phase_name) - if not _world_time.set_authoritative_time(target_hour): - return false - broadcast_system_message( - "World time set to %s (%s)." - % [phase_name, _world_time.get_clock_text()] - ) - return true - - -func _apply_world_weather_change(weather_name: String) -> bool: - if _world_weather == null: - return false - var normalized: String = _normalized_weather_name(weather_name) - if normalized.is_empty(): - return false - var target_weather: WorldWeatherService.Weather = ( - _weather_for_name(normalized) - ) - if not _world_weather.set_authoritative_weather(target_weather): - return false - broadcast_system_message("World weather set to %s." % normalized) - return true - - -func _send_world_command_result( - peer_id: int, - success: bool, - message: String, -) -> void: - if peer_id > 1 and _session.is_authenticated_peer(peer_id): - receive_world_command_result.rpc_id(peer_id, success, message.left(120)) - - -func _consume_world_command_rate(peer_id: int) -> bool: - var now_msec: int = Time.get_ticks_msec() - var last_msec: int = _last_world_command_msec.get( - peer_id, now_msec - WORLD_COMMAND_COOLDOWN_MILLISECONDS - ) - if now_msec - last_msec < WORLD_COMMAND_COOLDOWN_MILLISECONDS: - return false - _last_world_command_msec[peer_id] = now_msec - return true - - -static func _valid_time_phase(phase_name: String) -> bool: - return phase_name in ["dawn", "day", "dusk", "night"] - - -static func _time_phase_hour(phase_name: String) -> float: - match phase_name: - "dawn": - return WorldTimeService.DAWN_START_HOUR - "day": - return WorldTimeService.DAWN_END_HOUR - "dusk": - return WorldTimeService.DUSK_START_HOUR - "night": - return WorldTimeService.DUSK_END_HOUR - return -1.0 - - -static func _normalized_weather_name(weather_name: String) -> String: - var normalized: String = weather_name.strip_edges().to_lower() - return "clear" if normalized == "sunny" else normalized if normalized in [ - "clear", "cloudy", "rainy", "foggy" - ] else "" - - -static func _weather_for_name( - weather_name: String, -) -> WorldWeatherService.Weather: - match weather_name: - "cloudy": - return WorldWeatherService.Weather.CLOUDY - "rainy": - return WorldWeatherService.Weather.RAINY - "foggy": - return WorldWeatherService.Weather.FOGGY - return WorldWeatherService.Weather.SUNNY - - func get_history() -> Array[Dictionary]: var result: Array[Dictionary] = [] for message: Dictionary in _history: @@ -473,7 +319,8 @@ func _handle_request(peer_id: int, data: Dictionary) -> void: var request_id: String = data["request_id"] var ledger: Dictionary = _request_ledgers.get(peer_id, {}) if ledger.has(request_id): - _send_message(peer_id, ledger[request_id]) + if typeof(ledger[request_id]) == TYPE_DICTIONARY: + _send_message(peer_id, ledger[request_id]) return if not _consume_rate(peer_id): _send_rejection(peer_id, "Slow down.") @@ -482,12 +329,22 @@ func _handle_request(peer_id: int, data: Dictionary) -> void: NetworkChatProtocol.Kind.PLAYER, peer_id, record.display_name, - NetworkChatProtocol.sanitize_body(data["body"]) + NetworkChatProtocol.sanitize_body(data["body"]), + VoiceProfilesType.sanitized_id(str(data.get( + "voice_id", VoiceProfilesType.DEFAULT_ID + ))), + VoiceProfilesType.sanitized_sample_set_id(str(data.get( + "sample_set_id", VoiceProfilesType.DEFAULT_SAMPLE_SET_ID + ))), ) message["request_id"] = request_id message["sender_fingerprint"] = data["sender_fingerprint"] message["sender_signature"] = data["sender_signature"] - ledger[request_id] = message.duplicate(true) + ledger[request_id] = ( + message.duplicate(true) + if _should_store_host_history() + else true + ) while ledger.size() > 64: ledger.erase(ledger.keys().front()) _request_ledgers[peer_id] = ledger @@ -499,6 +356,8 @@ func _make_message( peer_id: int, display_name: String, body: String, + voice_id: String = VoiceProfilesType.DEFAULT_ID, + sample_set_id: String = VoiceProfilesType.DEFAULT_SAMPLE_SET_ID, ) -> Dictionary: _sequence += 1 var message := { @@ -511,6 +370,10 @@ func _make_message( "sender_display_name": display_name.left(24), "body": body, "sender_fingerprint": _session.get_host_identity_fingerprint(), + "voice_id": VoiceProfilesType.sanitized_id(voice_id), + "sample_set_id": VoiceProfilesType.sanitized_sample_set_id( + sample_set_id + ), } if kind == NetworkChatProtocol.Kind.SYSTEM: message["sender_signature"] = _session.sign_host_action( @@ -536,7 +399,10 @@ func receive_chat_message(data: Dictionary) -> void: _apply_message(data) -func _apply_message(data: Dictionary) -> void: +func _apply_message( + data: Dictionary, + emit_live_signals: bool = true, +) -> void: if ( not NetworkChatProtocol.validate_message(data) or str(data["session_id"]) != _session.get_session_id() @@ -554,9 +420,11 @@ func _apply_message(data: Dictionary) -> void: else: var sender_id := int(data["sender_peer_id"]) var record := _session.get_peer_record(sender_id) + if record == null: + _queue_pending_peer_message(sender_id, data, emit_live_signals) + return valid_signature = ( - record != null - and record.identity_fingerprint == str(data["sender_fingerprint"]) + record.identity_fingerprint == str(data["sender_fingerprint"]) and _session.verify_peer_action( sender_id, "chat_send", @@ -574,10 +442,13 @@ func _apply_message(data: Dictionary) -> void: kind == NetworkChatProtocol.Kind.PLAYER and is_sender_filtered(str(data.get("sender_fingerprint", ""))) ) - _history.append(stored_message) - while _history.size() > NetworkChatProtocol.MAX_HISTORY: - _history.pop_front() - if _message_is_visible(stored_message): + if _should_store_local_history(): + _history.append(stored_message) + while _history.size() > NetworkChatProtocol.MAX_HISTORY: + _history.pop_front() + if _should_log_message(stored_message): + _append_chat_log(stored_message) + if emit_live_signals and _message_is_visible(stored_message): message_received.emit(stored_message.duplicate(true)) if ( kind == NetworkChatProtocol.Kind.PLAYER @@ -599,12 +470,70 @@ func receive_chat_rejection(message: String) -> void: send_rejected.emit(message.left(80)) +func _queue_pending_peer_message( + peer_id: int, + message: Dictionary, + emit_live_signals: bool, +) -> void: + if peer_id <= 0: + return + var pending: Array = _pending_peer_messages.get(peer_id, []) + var message_id := str(message.get("message_id", "")) + for value: Variant in pending: + if ( + typeof(value) == TYPE_DICTIONARY + and str(value.get("message", {}).get("message_id", "")) == message_id + ): + return + pending.append({ + "message": message.duplicate(true), + "emit_live_signals": emit_live_signals, + }) + while pending.size() > MAX_PENDING_MESSAGES_PER_PEER: + pending.pop_front() + _pending_peer_messages[peer_id] = pending + + +func _flush_pending_peer_messages(peer_id: int) -> void: + var pending: Array = _pending_peer_messages.get(peer_id, []) + _pending_peer_messages.erase(peer_id) + for value: Variant in pending: + if typeof(value) != TYPE_DICTIONARY: + continue + var queued: Dictionary = value + if typeof(queued.get("message")) != TYPE_DICTIONARY: + continue + _apply_message( + queued["message"], + bool(queued.get("emit_live_signals", true)), + ) + + func _on_peer_authenticated(peer_id: int, display_name: String) -> void: + _flush_pending_peer_messages(peer_id) if not _session.is_host(): return _peer_names[peer_id] = display_name - var start := maxi(0, _history.size() - NetworkChatProtocol.LATE_JOIN_HISTORY) - receive_chat_history.rpc_id(peer_id, _history.slice(start)) + var history: Array[Dictionary] = [] + if _dedicated_history_enabled and _session.is_dedicated_host(): + var start := maxi( + 0, + _history.size() - NetworkChatProtocol.LATE_JOIN_HISTORY, + ) + history = _history.slice(start) + # An explicit empty replacement is intentional for player-hosted rooms and + # dedicated servers without logging. It destroys any stale client scrollback + # instead of replaying another player's live-session chat on reconnect. + receive_chat_history.rpc_id(peer_id, history) + if _dedicated_history_enabled and _session.is_dedicated_host(): + # Deliver the disclosure as a live system message after scrollback. This + # raises the normal unread indicator without creating speech or audio. + _send_message(peer_id, _make_message( + NetworkChatProtocol.Kind.SYSTEM, + 0, + "", + DEDICATED_CHAT_WARNING, + )) _broadcast(_make_message( NetworkChatProtocol.Kind.SYSTEM, 0, "", "%s joined." % display_name )) @@ -615,7 +544,7 @@ func _on_peer_removed(peer_id: int) -> void: _rate_times.erase(peer_id) _last_call_msec.erase(peer_id) _call_variant_indices.erase(peer_id) - _last_world_command_msec.erase(peer_id) + _pending_peer_messages.erase(peer_id) if not _session.is_host(): return var display_name: String = _peer_names.get(peer_id, "Player") @@ -633,7 +562,10 @@ func receive_chat_history(values: Array) -> void: _seen_messages.clear() for value: Variant in values: if NetworkChatProtocol.validate_message(value): - _apply_message(value) + # Late-join history belongs in the scrollback, but it is not a live + # event. In particular, do not recreate speech bubbles or replay + # animalese for every stored player message when joining a room. + _apply_message(value, false) history_replaced.emit(get_history()) @@ -662,6 +594,44 @@ func _consume_rate(peer_id: int) -> bool: return true +func _should_store_host_history() -> bool: + return ( + _session == null + or not _session.is_dedicated_host() + or _dedicated_history_enabled + ) + + +func _should_store_local_history() -> bool: + return _should_store_host_history() + + +func _should_log_message(message: Dictionary) -> bool: + return ( + _dedicated_history_enabled + and not _chat_log_path.is_empty() + and _session != null + and _session.is_dedicated_host() + and int(message.get("kind", -1)) == NetworkChatProtocol.Kind.PLAYER + ) + + +func _append_chat_log(message: Dictionary) -> void: + var file := FileAccess.open(_chat_log_path, FileAccess.READ_WRITE) + if file == null: + push_error("The configured dedicated-server chat log is unavailable.") + return + file.seek_end() + file.store_line(JSON.stringify({ + "recorded_at_utc": ( + Time.get_datetime_string_from_system(true, false) + "Z" + ), + "sender_display_name": str(message.get("sender_display_name", "")), + "body": str(message.get("body", "")), + })) + file.close() + + func _on_session_state_changed(state: NetworkSession.State) -> void: if state in [ NetworkSession.State.INACTIVE, @@ -675,8 +645,8 @@ func _on_session_state_changed(state: NetworkSession.State) -> void: _rate_times.clear() _last_call_msec.clear() _call_variant_indices.clear() - _last_world_command_msec.clear() _peer_names.clear() + _pending_peer_messages.clear() _sequence = 0 history_replaced.emit([]) diff --git a/network/network_fish_showcase_protocol.gd b/network/network_fish_showcase_protocol.gd index d69e9dd..2ecd1ee 100644 --- a/network/network_fish_showcase_protocol.gd +++ b/network/network_fish_showcase_protocol.gd @@ -2,7 +2,7 @@ class_name NetworkFishShowcaseProtocol extends RefCounted const CAPABILITY: StringName = &"fish_showcase_v1" -const RELIABLE_CHANNEL: int = NetworkProtocol.ITEM_RELIABLE_CHANNEL +const RELIABLE_CHANNEL: int = NetworkProtocol.SHOWCASE_RELIABLE_CHANNEL const MAX_SESSION_ID_LENGTH: int = 96 const MAX_FISH_ID_LENGTH: int = 96 const MAX_WEIGHT_LB: float = 1000.0 diff --git a/network/network_fish_showcase_service.gd b/network/network_fish_showcase_service.gd index 068ee7d..d956240 100644 --- a/network/network_fish_showcase_service.gd +++ b/network/network_fish_showcase_service.gd @@ -7,6 +7,7 @@ const FishCatchType = preload("res://fish/fish_catch.gd") const FishQualityType = preload("res://fish/fish_quality.gd") const FishInventoryType = preload("res://inventory/fish_inventory.gd") const PlayerHotbarType = preload("res://inventory/player_hotbar.gd") +const LOCAL_STATE_RETRY_SECONDS: float = 0.75 var _session: NetworkSession var _spawn_service: PlayerSpawnService @@ -15,6 +16,8 @@ var _local_inventory: FishInventoryType var _local_hotbar: PlayerHotbarType var _states: Dictionary[int, Dictionary] = {} var _local_revision: int = 0 +var _local_acknowledged_revision: int = -1 +var _local_state_retry_elapsed: float = 0.0 var _local_visible: bool = false var _local_catch_id: StringName @@ -54,6 +57,30 @@ func setup( ) +func _process(delta: float) -> void: + if ( + _session == null + or not _session.is_joined_client() + or _local_revision <= 0 + or _local_revision <= _local_acknowledged_revision + ): + _local_state_retry_elapsed = 0.0 + return + _local_state_retry_elapsed += delta + if _local_state_retry_elapsed < LOCAL_STATE_RETRY_SECONDS: + return + var fish_catch: FishCatchType + if _local_visible: + fish_catch = _local_inventory.get_catch_by_id(_local_catch_id) + if fish_catch == null or not fish_catch.is_valid(): + _submit_local_state(null, false) + return + # A client can finish a generated-world transition on the same frame that + # its local showcase changes. Republish until the authoritative echo arrives + # so that one early application-level miss cannot leave held fish out of sync. + _submit_local_state(fish_catch, _local_visible) + + func toggle_selected_fish() -> bool: if _local_hotbar == null or _local_inventory == null: return false @@ -78,6 +105,7 @@ func get_local_showcase_catch_id() -> StringName: func _submit_local_state(fish_catch: FishCatchType, should_show: bool) -> void: _local_revision += 1 + _local_state_retry_elapsed = 0.0 var local_peer_id: int = ( _session.get_local_peer_id() if _session != null else 1 ) @@ -166,6 +194,11 @@ func receive_showcase_state(data: Dictionary) -> void: ): return var peer_id: int = int(data["owner_peer_id"]) + if peer_id == _session.get_local_peer_id(): + _local_acknowledged_revision = maxi( + _local_acknowledged_revision, + int(data["revision"]), + ) var previous: Dictionary = _states.get(peer_id, {}) if int(data["revision"]) <= int(previous.get("revision", -1)): return @@ -267,6 +300,8 @@ func _on_session_state_changed(state: NetworkSession.State) -> void: _states.clear() _local_visible = false _local_catch_id = StringName() + _local_acknowledged_revision = -1 + _local_state_retry_elapsed = 0.0 var local_avatar: Player = _spawn_service.get_avatar( _session.get_local_peer_id() ) diff --git a/network/network_fishing_attempt.gd b/network/network_fishing_attempt.gd index 84511db..638b4da 100644 --- a/network/network_fishing_attempt.gd +++ b/network/network_fishing_attempt.gd @@ -22,6 +22,7 @@ var target: Vector3 var bobber_position: Vector3 var fish_id: StringName var rod_id: StringName +var bait_id: StringName var bait_tags: Array[StringName] = [] var lure_effects: Array[StringName] = [] var encounter_seed: int = 0 diff --git a/network/network_fishing_protocol.gd b/network/network_fishing_protocol.gd index 2e9a342..7f15fdd 100644 --- a/network/network_fishing_protocol.gd +++ b/network/network_fishing_protocol.gd @@ -5,9 +5,11 @@ const MAX_ID_LENGTH: int = 96 const MAX_EVIDENCE_FISH_IDS: int = 256 const MAX_CAST_DISTANCE: float = 30.0 const MAX_REEL_SPEED: float = 10.0 -const MAX_BARRIER_DAMAGE: int = 100 +const MAX_BARRIER_DAMAGE: int = 128 const INPUT_CHANNEL: int = 3 const SNAPSHOT_CHANNEL: int = 4 +const OBSERVER_SNAPSHOT_CHANNEL: int = 10 +const RELIABLE_CHANNEL: int = NetworkProtocol.FISHING_RELIABLE_CHANNEL const INPUT_RATE: float = 1.0 / 30.0 const SNAPSHOT_RATE: float = 1.0 / 20.0 @@ -35,6 +37,7 @@ static func validate_cast_request(data: Variant) -> String: "rarity_multipliers", "discovered_fish_ids", "capacity_available", + "movement_sequence", ]: if not payload.has(key): return "Malformed fishing request." @@ -51,11 +54,16 @@ static func validate_cast_request(data: Variant) -> String: or typeof(payload["rarity_multipliers"]) != TYPE_ARRAY or typeof(payload["discovered_fish_ids"]) != TYPE_ARRAY or typeof(payload["capacity_available"]) != TYPE_BOOL + or typeof(payload["movement_sequence"]) != TYPE_INT ): return "Malformed fishing request." - if payload.has("bait_id") and typeof(payload["bait_id"]) not in [TYPE_STRING, TYPE_STRING_NAME]: + if payload.has("bait_id") and typeof(payload["bait_id"]) not in [ + TYPE_STRING, TYPE_STRING_NAME + ]: return "Malformed fishing request." - if payload.has("lure_id") and typeof(payload["lure_id"]) not in [TYPE_STRING, TYPE_STRING_NAME]: + if payload.has("lure_id") and typeof(payload["lure_id"]) not in [ + TYPE_STRING, TYPE_STRING_NAME + ]: return "Malformed fishing request." var request_id: String = payload["request_id"] var session_id: String = payload["session_id"] @@ -92,6 +100,8 @@ static func validate_cast_request(data: Variant) -> String: or str(payload["rod_id"]).is_empty() or str(payload["rod_id"]).length() > 96 or str(payload.get("lure_id", "")).length() > 96 + or int(payload["movement_sequence"]) < 0 + or int(payload["movement_sequence"]) > 2147483647 ): return "Fishing request values are outside allowed limits." for value: Variant in rarity: diff --git a/network/network_fishing_service.gd b/network/network_fishing_service.gd index f7e1623..8c9c798 100644 --- a/network/network_fishing_service.gd +++ b/network/network_fishing_service.gd @@ -21,6 +21,8 @@ const MAX_LEDGER_ENTRIES_PER_PEER: int = 64 const CAST_ORIGIN_TOLERANCE: float = 2.5 const CAPACITY_RESPONSE_TIMEOUT: float = 5.0 const MIN_CAST_INTERVAL: float = 0.25 +const OBSERVER_SNAPSHOT_INTERVAL: float = 0.1 +const OBSERVER_RELEVANCE_DISTANCE: float = 96.0 signal local_cast_accepted(attempt_id: String, target: Vector3) signal local_cast_rejected(message: String) @@ -51,7 +53,13 @@ var _last_input_time: Dictionary[int, float] = {} var _remote_presentations: Dictionary[int, RemoteFishingPresentation] = {} var _pending_local_bait_by_request: Dictionary[String, StringName] = {} var _snapshot_accumulator: float = 0.0 +var _observer_snapshot_accumulator: float = 0.0 var _local_input_sequence: int = 0 +var _presentation_enabled: bool = true +var _owner_snapshot_packets_sent: int = 0 +var _owner_snapshot_states_sent: int = 0 +var _observer_snapshot_packets_sent: int = 0 +var _observer_snapshot_states_sent: int = 0 func setup( @@ -67,6 +75,7 @@ func setup( item_catalog: ItemCatalog, fish_catalog: FishPoolType, item_use: NetworkItemUseService, + presentation_enabled: bool = true, ) -> void: _session = session _spawn_service = spawn_service @@ -80,6 +89,7 @@ func setup( _item_catalog = item_catalog _fish_catalog = fish_catalog _item_use = item_use + _presentation_enabled = presentation_enabled if not _session.peer_removed.is_connected(_on_peer_removed): _session.peer_removed.connect(_on_peer_removed) if not _session.state_changed.is_connected(_on_session_state_changed): @@ -130,6 +140,7 @@ func request_local_cast( "capacity_available": bool(evidence.get("capacity_available", false)), "bait_id": str(bait_id), "lure_id": str(lure_id), + "movement_sequence": _session.get_latest_movement_input_sequence(), } if _session.is_host(): _handle_cast_request(_session.get_local_peer_id(), data) @@ -168,6 +179,7 @@ func cancel_local_attempt(reason: String = "Fishing attempt ended.") -> void: if _session.is_host(): _cancel_attempt(peer_id, reason) else: + _pending_local_bait_by_request.erase(attempt.request_id) submit_cancel_request.rpc_id(1, attempt.attempt_id) @@ -212,15 +224,27 @@ func _process(delta: float) -> void: if now >= attempt.capacity_deadline: _cancel_attempt(peer_id, "Fishing attempt ended.") _snapshot_accumulator += delta + _observer_snapshot_accumulator += delta if _snapshot_accumulator >= NetworkFishingProtocol.SNAPSHOT_RATE: _snapshot_accumulator = fmod( _snapshot_accumulator, NetworkFishingProtocol.SNAPSHOT_RATE ) - _broadcast_snapshots() + _broadcast_owner_snapshots() + if _observer_snapshot_accumulator >= OBSERVER_SNAPSHOT_INTERVAL: + _observer_snapshot_accumulator = fmod( + _observer_snapshot_accumulator, + OBSERVER_SNAPSHOT_INTERVAL, + ) + _broadcast_observer_snapshots() -@rpc("any_peer", "call_remote", "reliable", 0) +@rpc( + "any_peer", + "call_remote", + "reliable", + NetworkFishingProtocol.RELIABLE_CHANNEL, +) func submit_cast_request(data: Dictionary) -> void: var sender_id: int = multiplayer.get_remote_sender_id() if not _session.is_host() or not _session.is_authenticated_peer(sender_id): @@ -253,7 +277,7 @@ func _handle_cast_request(peer_id: int, data: Dictionary) -> void: _record_and_reject(peer_id, request_id, "Already fishing.") return if not bool(data["capacity_available"]): - _record_and_reject(peer_id, request_id, "Cooler is full.") + _record_and_reject(peer_id, request_id, "Inventory is full.") return var rod := _item_catalog.get_item_by_id( StringName(str(data["rod_id"])) @@ -267,7 +291,13 @@ func _handle_cast_request(peer_id: int, data: Dictionary) -> void: return var origin: Vector3 = NetworkFishingProtocol.array_to_vector3(data["origin"]) var target: Vector3 = NetworkFishingProtocol.array_to_vector3(data["target"]) - var authoritative_origin: Vector3 = avatar.get_cast_origin_position() + var movement_state: Dictionary = avatar.get_lag_compensated_movement_state( + int(data.get("movement_sequence", 0)) + ) + var authoritative_origin: Vector3 = movement_state.get( + "cast_origin", + avatar.get_cast_origin_position(), + ) if origin.distance_to(authoritative_origin) > CAST_ORIGIN_TOLERANCE: _record_and_reject(peer_id, request_id, "Cannot fish here.") return @@ -278,7 +308,10 @@ func _handle_cast_request(peer_id: int, data: Dictionary) -> void: _fishing_spot.maximum_cast_distance, float(data["charge"]) ) - var facing: Vector3 = avatar.get_facing_direction() + var facing: Vector3 = movement_state.get( + "facing", + avatar.get_facing_direction(), + ) facing.y = 0.0 if ( cast_offset.length() < _fishing_spot.minimum_cast_distance - 0.25 @@ -361,7 +394,7 @@ func _handle_cast_request(peer_id: int, data: Dictionary) -> void: owns_authoritative_bag and ( avatar_bag == null - or not avatar_bag.remove_item(bait_id, 1) + or not avatar_bag.owns_item(bait_id) ) ) ): @@ -378,6 +411,7 @@ func _handle_cast_request(peer_id: int, data: Dictionary) -> void: attempt.bobber_position = authoritative_target attempt.fish_id = selected_fish.id attempt.rod_id = rod.item_id + attempt.bait_id = bait_id attempt.bait_tags = _bait_tags_for_request(data) attempt.lure_effects.clear() if lure != null: @@ -564,7 +598,6 @@ func _start_bite(attempt: NetworkFishingAttempt) -> void: _cancel_attempt(attempt.owner_peer_id, "Fishing attempt ended.") return attempt.bite_confirmation_pending = false - attempt.phase = NetworkFishingAttempt.Phase.FIGHTING attempt.encounter_seed = _new_seed() var selector := FishSelectorType.new() selector.active_rod = rod @@ -575,6 +608,17 @@ func _start_bite(attempt: NetworkFishingAttempt) -> void: if fish_catch == null or not fish_catch.is_valid(): _cancel_attempt(attempt.owner_peer_id, "Fishing attempt ended.") return + if ( + attempt.owner_peer_id == _session.get_local_peer_id() + and not attempt.bait_id.is_empty() + and ( + _local_bag == null + or not _local_bag.remove_item(attempt.bait_id, 1) + ) + ): + _cancel_attempt(attempt.owner_peer_id, "No bait available.") + return + attempt.phase = NetworkFishingAttempt.Phase.FIGHTING attempt.catch_payload = fish_catch.to_network_dict() attempt.controller.start_authoritative_encounter( fish.catch_profile, @@ -630,7 +674,12 @@ func _handle_fishing_input(peer_id: int, data: Dictionary) -> void: attempt.controller.handle_primary_pressed() -@rpc("any_peer", "call_remote", "reliable", 0) +@rpc( + "any_peer", + "call_remote", + "reliable", + NetworkFishingProtocol.RELIABLE_CHANNEL, +) func submit_cancel_request(attempt_id: String) -> void: var sender_id: int = multiplayer.get_remote_sender_id() var attempt: NetworkFishingAttempt = _attempts.get(sender_id) @@ -675,16 +724,59 @@ func _on_encounter_updated( }) -func _broadcast_snapshots() -> void: - var snapshots: Array[Dictionary] = [] +func _broadcast_owner_snapshots() -> void: for attempt: NetworkFishingAttempt in _attempts.values(): var snapshot: Dictionary = attempt.get_meta("snapshot", {}) - if not snapshot.is_empty(): - snapshots.append(snapshot) - if snapshots.is_empty(): + if snapshot.is_empty(): + continue + var owner_peer_id: int = attempt.owner_peer_id + if owner_peer_id == _session.get_local_peer_id(): + _apply_snapshots([snapshot]) + elif owner_peer_id > 1: + receive_fishing_snapshots.rpc_id(owner_peer_id, [snapshot]) + _owner_snapshot_packets_sent += 1 + _owner_snapshot_states_sent += 1 + + +func _broadcast_observer_snapshots() -> void: + if _attempts.is_empty(): return - _apply_snapshots(snapshots) - receive_fishing_snapshots.rpc(snapshots) + var observer_ids: Array[int] = _session.get_authenticated_peer_ids() + for observer_peer_id: int in observer_ids: + var observer_avatar: Player = _spawn_service.get_avatar(observer_peer_id) + if observer_avatar == null: + continue + var summaries: Array = [] + for attempt: NetworkFishingAttempt in _attempts.values(): + if attempt.owner_peer_id == observer_peer_id: + continue + var owner_avatar: Player = _spawn_service.get_avatar( + attempt.owner_peer_id + ) + if ( + owner_avatar == null + or observer_avatar.global_position.distance_squared_to( + owner_avatar.global_position + ) > OBSERVER_RELEVANCE_DISTANCE * OBSERVER_RELEVANCE_DISTANCE + ): + continue + summaries.append([ + attempt.attempt_id, + attempt.owner_peer_id, + attempt.bobber_position, + int(attempt.phase), + ]) + if summaries.is_empty(): + continue + if observer_peer_id == _session.get_local_peer_id(): + _apply_observer_snapshots(summaries) + elif observer_peer_id > 1: + receive_fishing_observer_snapshots.rpc_id( + observer_peer_id, + summaries, + ) + _observer_snapshot_packets_sent += 1 + _observer_snapshot_states_sent += summaries.size() @rpc("authority", "call_remote", "unreliable_ordered", 4) @@ -692,6 +784,55 @@ func receive_fishing_snapshots(snapshots: Array) -> void: _apply_snapshots(snapshots) +@rpc( + "authority", + "call_remote", + "unreliable_ordered", + NetworkFishingProtocol.OBSERVER_SNAPSHOT_CHANNEL, +) +func receive_fishing_observer_snapshots(summaries: Array) -> void: + _apply_observer_snapshots(summaries) + + +func _apply_observer_snapshots(summaries: Array) -> void: + if not _presentation_enabled or summaries.size() > 128: + return + for value: Variant in summaries: + if typeof(value) != TYPE_ARRAY: + continue + var fields: Array = value + if ( + fields.size() != 4 + or typeof(fields[0]) != TYPE_STRING + or str(fields[0]).is_empty() + or str(fields[0]).length() > NetworkFishingProtocol.MAX_ID_LENGTH + or typeof(fields[1]) != TYPE_INT + or int(fields[1]) <= 0 + or typeof(fields[2]) != TYPE_VECTOR3 + or typeof(fields[3]) != TYPE_INT + or not (fields[2] as Vector3).is_finite() + or int(fields[3]) not in [ + NetworkFishingAttempt.Phase.WAITING_FOR_BITE, + NetworkFishingAttempt.Phase.FIGHTING, + NetworkFishingAttempt.Phase.PENDING_CAPACITY, + ] + ): + continue + var owner_peer_id: int = int(fields[1]) + if owner_peer_id == _session.get_local_peer_id(): + continue + var presentation := _get_remote_presentation(owner_peer_id) + if presentation != null: + presentation.synchronize_active( + str(fields[0]), + fields[2], + int(fields[3]) in [ + NetworkFishingAttempt.Phase.FIGHTING, + NetworkFishingAttempt.Phase.PENDING_CAPACITY, + ], + ) + + func _apply_snapshots(snapshots: Array) -> void: var local_peer_id: int = _session.get_local_peer_id() for value: Variant in snapshots: @@ -798,7 +939,12 @@ func _on_attempt_caught(peer_id: int) -> void: receive_capacity_probe.rpc_id(peer_id, probe) -@rpc("authority", "call_remote", "reliable", 0) +@rpc( + "authority", + "call_remote", + "reliable", + NetworkFishingProtocol.RELIABLE_CHANNEL, +) func receive_capacity_probe(data: Dictionary) -> void: _handle_local_capacity_probe(data) @@ -812,11 +958,8 @@ func _handle_local_capacity_probe(data: Dictionary) -> void: return var can_accept: bool = ( _local_inventory != null - and _local_capacity != null - and ( - _local_inventory.contains_catch_id(StringName(data["catch_id"])) - or _local_inventory.get_all_catches().size() - < _local_capacity.get_capacity() + and _local_inventory.can_accept_catch( + StringName(data["catch_id"]) ) ) if _session.is_host(): @@ -835,7 +978,12 @@ func _handle_local_capacity_probe(data: Dictionary) -> void: ) -@rpc("any_peer", "call_remote", "reliable", 0) +@rpc( + "any_peer", + "call_remote", + "reliable", + NetworkFishingProtocol.RELIABLE_CHANNEL, +) func submit_capacity_response( attempt_id: String, capacity_nonce: String, @@ -864,7 +1012,7 @@ func _handle_capacity_response( ): return if not can_accept: - _cancel_attempt(peer_id, "Cooler is full.") + _cancel_attempt(peer_id, "Inventory is full.") return _finalize_catch(attempt) @@ -893,7 +1041,12 @@ func _finalize_catch(attempt: NetworkFishingAttempt) -> void: _dispose_attempt(attempt.owner_peer_id) -@rpc("authority", "call_remote", "reliable", 0) +@rpc( + "authority", + "call_remote", + "reliable", + NetworkFishingProtocol.RELIABLE_CHANNEL, +) func receive_target_outcome(data: Dictionary) -> void: _apply_target_outcome(data) @@ -915,11 +1068,7 @@ func _apply_target_outcome(data: Dictionary) -> void: if fish_catch == null: return var already_owned: bool = _local_inventory.contains_catch_id(catch_id) - if ( - not already_owned - and _local_inventory.get_all_catches().size() - >= _local_capacity.get_capacity() - ): + if not already_owned and not _local_inventory.can_accept_catch(catch_id): return if not already_owned: var experience_award: int = ( @@ -929,7 +1078,7 @@ func _apply_target_outcome(data: Dictionary) -> void: ) ) _local_inventory.add_catch(fish_catch) - _local_collection.mark_quality_discovered( + _local_collection.record_catch( fish_id, fish_catch.quality, ) @@ -965,7 +1114,12 @@ func _acknowledge_result(result_id: String, catch_id: StringName) -> void: acknowledge_fishing_result.rpc_id(1, result_id, str(catch_id)) -@rpc("any_peer", "call_remote", "reliable", 0) +@rpc( + "any_peer", + "call_remote", + "reliable", + NetworkFishingProtocol.RELIABLE_CHANNEL, +) func acknowledge_fishing_result(result_id: String, catch_id: String) -> void: var sender_id: int = multiplayer.get_remote_sender_id() if ( @@ -1022,7 +1176,12 @@ func _broadcast_public_outcome( receive_public_outcome.rpc(data) -@rpc("authority", "call_remote", "reliable", 0) +@rpc( + "authority", + "call_remote", + "reliable", + NetworkFishingProtocol.RELIABLE_CHANNEL, +) func receive_public_outcome(data: Dictionary) -> void: _apply_public_outcome(data) @@ -1038,6 +1197,13 @@ func _apply_public_outcome(data: Dictionary) -> void: if peer_id == _session.get_local_peer_id(): if str(data["outcome"]) != "catch": if not _session.is_host(): + var local_attempt: NetworkFishingAttempt = _attempts.get( + peer_id + ) + if local_attempt != null: + _pending_local_bait_by_request.erase( + local_attempt.request_id + ) _attempts.erase(peer_id) local_attempt_ended.emit( StringName(str(data["outcome"])), @@ -1067,7 +1233,12 @@ func _broadcast_cast_accepted(data: Dictionary) -> void: receive_cast_accepted.rpc(data) -@rpc("authority", "call_remote", "reliable", 0) +@rpc( + "authority", + "call_remote", + "reliable", + NetworkFishingProtocol.RELIABLE_CHANNEL, +) func receive_cast_accepted(data: Dictionary) -> void: _apply_cast_accepted(data) @@ -1098,28 +1269,23 @@ func _apply_cast_accepted(data: Dictionary) -> void: # On the host this replaces the same authoritative value with itself. if not _session.is_host(): _attempts[peer_id] = attempt - var pending_bait_id: StringName = ( - _pending_local_bait_by_request.get( - attempt.request_id, - StringName(), - ) - ) - _pending_local_bait_by_request.erase(attempt.request_id) - if not pending_bait_id.is_empty() and ( - _local_bag == null - or not _local_bag.remove_item(pending_bait_id, 1) - ): - cancel_local_attempt("No bait available.") - local_cast_rejected.emit("No bait available.") - return local_cast_accepted.emit(attempt.attempt_id, target) else: var presentation := _get_remote_presentation(peer_id) if presentation != null: - presentation.show_cast(origin, target) + presentation.show_cast( + origin, + target, + str(data["attempt_id"]), + ) -@rpc("authority", "call_remote", "reliable", 0) +@rpc( + "authority", + "call_remote", + "reliable", + NetworkFishingProtocol.RELIABLE_CHANNEL, +) func receive_bite_pending(data: Dictionary) -> void: _apply_bite_pending(data) @@ -1134,7 +1300,12 @@ func _apply_bite_pending(data: Dictionary) -> void: local_bite_pending.emit(str(data["attempt_id"])) -@rpc("authority", "call_remote", "reliable", 0) +@rpc( + "authority", + "call_remote", + "reliable", + NetworkFishingProtocol.RELIABLE_CHANNEL, +) func receive_bite_started(data: Dictionary) -> void: _apply_bite_started(data) @@ -1147,6 +1318,22 @@ func _apply_bite_started(data: Dictionary) -> void: return var peer_id: int = data["owner_peer_id"] if peer_id == _session.get_local_peer_id(): + if not _session.is_host(): + var attempt: NetworkFishingAttempt = _attempts.get(peer_id) + var pending_bait_id := StringName() + if attempt != null: + pending_bait_id = _pending_local_bait_by_request.get( + attempt.request_id, + StringName(), + ) + _pending_local_bait_by_request.erase(attempt.request_id) + if not pending_bait_id.is_empty() and ( + _local_bag == null + or not _local_bag.remove_item(pending_bait_id, 1) + ): + cancel_local_attempt("No bait available.") + local_cast_rejected.emit("No bait available.") + return local_bite_started.emit(str(data["attempt_id"])) else: var presentation := _get_remote_presentation(peer_id) @@ -1179,7 +1366,12 @@ func _send_cast_rejected( receive_cast_rejected.rpc_id(peer_id, request_id, message.left(128)) -@rpc("authority", "call_remote", "reliable", 0) +@rpc( + "authority", + "call_remote", + "reliable", + NetworkFishingProtocol.RELIABLE_CHANNEL, +) func receive_cast_rejected(request_id: String, message: String) -> void: _pending_local_bait_by_request.erase(request_id) local_cast_rejected.emit(message) @@ -1214,6 +1406,8 @@ func _resend_request_response(peer_id: int, response: Dictionary) -> void: func _get_remote_presentation( peer_id: int, ) -> RemoteFishingPresentation: + if not _presentation_enabled: + return null var existing: RemoteFishingPresentation = _remote_presentations.get(peer_id) if existing != null and is_instance_valid(existing): return existing @@ -1267,12 +1461,12 @@ func _dispose_attempt(peer_id: int) -> void: attempt.controller.reset() attempt.controller.queue_free() var avatar: Player = _spawn_service.get_avatar(peer_id) - var local_return_is_active: bool = ( + var local_fishing_sequence_is_active: bool = ( peer_id == _session.get_local_peer_id() and _fishing_spot != null - and _fishing_spot.is_returning() + and _fishing_spot.is_fishing_sequence_active() ) - if avatar != null and not local_return_is_active: + if avatar != null and not local_fishing_sequence_is_active: avatar.set_movement_enabled(true) @@ -1314,10 +1508,23 @@ func _clear_all() -> void: _result_acknowledgements.clear() _last_cast_time.clear() _last_input_time.clear() + _pending_local_bait_by_request.clear() _snapshot_accumulator = 0.0 + _observer_snapshot_accumulator = 0.0 _local_input_sequence = 0 +func get_network_metrics() -> Dictionary: + return { + "active_attempts": _attempts.size(), + "remote_presentations": _remote_presentations.size(), + "owner_snapshot_packets_sent": _owner_snapshot_packets_sent, + "owner_snapshot_states_sent": _owner_snapshot_states_sent, + "observer_snapshot_packets_sent": _observer_snapshot_packets_sent, + "observer_snapshot_states_sent": _observer_snapshot_states_sent, + } + + func _bound_result_ledger() -> void: while _result_ledgers.size() > MAX_LEDGER_ENTRIES_PER_PEER: _result_ledgers.erase(_result_ledgers.keys().front()) diff --git a/network/network_home_protocol.gd b/network/network_home_protocol.gd new file mode 100644 index 0000000..96756e9 --- /dev/null +++ b/network/network_home_protocol.gd @@ -0,0 +1,188 @@ +class_name NetworkHomeProtocol +extends RefCounted + +const PlayerHomeStateType = preload("res://homes/player_home_state.gd") + +const CAPABILITY: StringName = &"portable_home_v1" +const RELIABLE_CHANNEL: int = NetworkProtocol.HOME_RELIABLE_CHANNEL +const MAX_ID_LENGTH: int = 96 +const MAX_MESSAGE_LENGTH: int = 160 +const MAX_TRANSITION_COORDINATE: float = 10000.0 +const WORLD_SPACE: StringName = &"world" + +enum TransitionAction { + ENTER, + EXIT, +} + + +static func make_space_id(owner_fingerprint: String) -> StringName: + return StringName("rv:%s" % owner_fingerprint) + + +static func manifest_digest(home_data: Dictionary) -> String: + var sanitized: Dictionary = PlayerHomeStateType.sanitize_save_data(home_data) + if sanitized.is_empty(): + return "" + var canonical_owned: Array[Dictionary] = [] + var owned: Dictionary = sanitized["owned_decor"] + var owned_ids: Array[String] = [] + for value: Variant in owned.keys(): + owned_ids.append(str(value)) + owned_ids.sort() + for decor_id: String in owned_ids: + canonical_owned.append({ + "id": decor_id, + "quantity": int(owned[decor_id]), + }) + var placements: Array[Dictionary] = [] + for value: Variant in sanitized["placements"]: + placements.append((value as Dictionary).duplicate(true)) + placements.sort_custom(func(first: Dictionary, second: Dictionary) -> bool: + return str(first["instance_id"]) < str(second["instance_id"]) + ) + var canonical: Dictionary = { + "schema_version": int(sanitized["schema_version"]), + "tier": int(sanitized["tier"]), + "exterior_id": str(sanitized["exterior_id"]), + "privacy": int(sanitized["privacy"]), + "owned": canonical_owned, + "placements": placements, + "revision": int(sanitized["revision"]), + "next_instance_sequence": int(sanitized["next_instance_sequence"]), + } + return JSON.stringify(canonical).sha256_text() + + +static func manifest_signature_fields(data: Dictionary) -> Array: + return [ + str(data.get("session_id", "")), + str(data.get("request_id", "")), + str(data.get("owner_fingerprint", "")), + int((data.get("home", {}) as Dictionary).get("revision", -1)), + str(data.get("digest", "")), + ] + + +static func validate_manifest_request(value: Variant) -> bool: + if typeof(value) != TYPE_DICTIONARY: + return false + var data: Dictionary = value + if ( + not _valid_id(data.get("request_id")) + or not _valid_id(data.get("session_id")) + or not NetworkIdentityCrypto.valid_fingerprint( + data.get("owner_fingerprint") + ) + or typeof(data.get("home")) != TYPE_DICTIONARY + or typeof(data.get("digest")) != TYPE_STRING + or str(data["digest"]).length() != 64 + or typeof(data.get("sender_signature")) != TYPE_PACKED_BYTE_ARRAY + ): + return false + var sanitized: Dictionary = PlayerHomeStateType.sanitize_save_data( + data["home"] + ) + return ( + not sanitized.is_empty() + and manifest_digest(sanitized) == str(data["digest"]) + ) + + +static func validate_manifest_broadcast(value: Variant) -> bool: + if typeof(value) != TYPE_DICTIONARY: + return false + var data: Dictionary = value + return ( + typeof(data.get("owner_peer_id")) == TYPE_INT + and int(data["owner_peer_id"]) > 0 + and NetworkIdentityCrypto.valid_fingerprint( + data.get("owner_fingerprint") + ) + and typeof(data.get("home")) == TYPE_DICTIONARY + and not PlayerHomeStateType.sanitize_save_data(data["home"]).is_empty() + and _valid_transform(data.get("exterior_transform")) + and typeof(data.get("interior_index")) == TYPE_INT + and int(data["interior_index"]) >= 0 + and int(data["interior_index"]) < 128 + ) + + +static func transition_signature_fields(data: Dictionary) -> Array: + return [ + str(data.get("session_id", "")), + str(data.get("request_id", "")), + int(data.get("action", -1)), + str(data.get("owner_fingerprint", "")), + ] + + +static func validate_transition_request(value: Variant) -> bool: + if typeof(value) != TYPE_DICTIONARY: + return false + var data: Dictionary = value + return ( + _valid_id(data.get("request_id")) + and _valid_id(data.get("session_id")) + and typeof(data.get("action")) == TYPE_INT + and int(data["action"]) >= TransitionAction.ENTER + and int(data["action"]) <= TransitionAction.EXIT + and NetworkIdentityCrypto.valid_fingerprint( + data.get("owner_fingerprint") + ) + and typeof(data.get("sender_signature")) == TYPE_PACKED_BYTE_ARRAY + ) + + +static func transform_to_array(value: Transform3D) -> Array[float]: + return [ + value.basis.x.x, value.basis.x.y, value.basis.x.z, + value.basis.y.x, value.basis.y.y, value.basis.y.z, + value.basis.z.x, value.basis.z.y, value.basis.z.z, + value.origin.x, value.origin.y, value.origin.z, + ] + + +static func array_to_transform(value: Variant) -> Transform3D: + if not validate_transition_transform(value): + return Transform3D() + var fields: Array = value + return Transform3D( + Basis( + Vector3(float(fields[0]), float(fields[1]), float(fields[2])), + Vector3(float(fields[3]), float(fields[4]), float(fields[5])), + Vector3(float(fields[6]), float(fields[7]), float(fields[8])), + ), + Vector3(float(fields[9]), float(fields[10]), float(fields[11])), + ) + + +static func validate_transition_transform(value: Variant) -> bool: + if not _valid_transform(value): + return false + var fields: Array = value + return ( + absf(float(fields[9])) <= MAX_TRANSITION_COORDINATE + and absf(float(fields[10])) <= MAX_TRANSITION_COORDINATE + and absf(float(fields[11])) <= MAX_TRANSITION_COORDINATE + ) + + +static func _valid_transform(value: Variant) -> bool: + if typeof(value) != TYPE_ARRAY or (value as Array).size() != 12: + return false + for component: Variant in value: + if ( + typeof(component) not in [TYPE_FLOAT, TYPE_INT] + or not is_finite(float(component)) + ): + return false + return true + + +static func _valid_id(value: Variant) -> bool: + return ( + typeof(value) == TYPE_STRING + and not str(value).is_empty() + and str(value).length() <= MAX_ID_LENGTH + ) diff --git a/network/network_home_protocol.gd.uid b/network/network_home_protocol.gd.uid new file mode 100644 index 0000000..24b6aae --- /dev/null +++ b/network/network_home_protocol.gd.uid @@ -0,0 +1 @@ +uid://fl3qwiluejhm diff --git a/network/network_home_service.gd b/network/network_home_service.gd new file mode 100644 index 0000000..33fa6ee --- /dev/null +++ b/network/network_home_service.gd @@ -0,0 +1,1390 @@ +class_name NetworkHomeService +extends Node + +const NetworkHomeProtocolType = preload( + "res://network/network_home_protocol.gd" +) +const PlayerHomeStateType = preload("res://homes/player_home_state.gd") +const DecorCatalogType = preload("res://homes/decor_catalog.gd") +const OwnedItemType = preload("res://items/owned_item.gd") + +signal local_transition_finished(accepted: bool, message: String) +signal local_space_changed(space_id: StringName, owner_fingerprint: String) +signal local_manifest_rejected(message: String) + +const MAX_MANIFESTS: int = 128 +const MAX_PENDING_LOCAL_DECOR_TRANSACTIONS: int = 16 + +var _session: NetworkSession +var _spawn_service: PlayerSpawnService +var _local_home: PlayerHomeStateType +var _save_manager: PlayerSaveManager +var _world_service: HomeWorldService +var _bag: PlayerBag +var _inventory_layout: PlayerInventoryLayout +var _hotbar: PlayerHotbar +var _manifests_by_fingerprint: Dictionary[String, Dictionary] = {} +var _fingerprint_by_peer: Dictionary[int, String] = {} +var _authorized_owned_counts: Dictionary[int, Dictionary] = {} +var _authorization_result_owner: Dictionary[String, int] = {} +var _interior_slots_by_space: Dictionary[StringName, Dictionary] = {} +var _next_interior_index: int = 0 +var _suppress_local_submission: bool = false +var _publish_queued: bool = false +var _last_submitted_local_home_revision: int = -1 +var _pending_local_decor_transactions: Dictionary[int, Dictionary] = {} + + +func setup( + session: NetworkSession, + spawn_service: PlayerSpawnService, + local_home: PlayerHomeStateType, + save_manager: PlayerSaveManager, + world_service: HomeWorldService, + bag: PlayerBag, + inventory_layout: PlayerInventoryLayout, + hotbar: PlayerHotbar, +) -> void: + _session = session + _spawn_service = spawn_service + _local_home = local_home + _save_manager = save_manager + _world_service = world_service + _bag = bag + _inventory_layout = inventory_layout + _hotbar = hotbar + if not _session.state_changed.is_connected(_on_session_state_changed): + _session.state_changed.connect(_on_session_state_changed) + if not _session.join_authenticated.is_connected(_on_join_authenticated): + _session.join_authenticated.connect(_on_join_authenticated) + if not _session.peer_authenticated.is_connected(_on_peer_authenticated): + _session.peer_authenticated.connect(_on_peer_authenticated) + if not _session.peer_removed.is_connected(_on_peer_removed): + _session.peer_removed.connect(_on_peer_removed) + if not _local_home.changed.is_connected(_on_local_home_changed): + _local_home.changed.connect(_on_local_home_changed) + + +func get_local_space() -> StringName: + if _session == null or not _session.is_gameplay_session_active(): + return NetworkHomeProtocolType.WORLD_SPACE + return _session.get_peer_space(_session.get_local_peer_id()) + + +func get_local_home_owner_fingerprint() -> String: + var space_id: String = String(get_local_space()) + return space_id.trim_prefix("rv:") if space_id.begins_with("rv:") else "" + + +func can_local_decorate() -> bool: + return ( + get_local_home_owner_fingerprint() + == _session.get_local_identity_fingerprint() + ) + + +func has_pending_local_decor_mutation() -> bool: + return not _pending_local_decor_transactions.is_empty() + + +func get_authoritative_owned_count( + peer_id: int, + decor_id: StringName, +) -> int: + var authorized: Dictionary = _authorized_owned_counts.get(peer_id, {}) + if authorized.has(String(decor_id)): + return int(authorized[String(decor_id)]) + var fingerprint: String = _fingerprint_for_peer(peer_id) + var manifest: Dictionary = _manifests_by_fingerprint.get(fingerprint, {}) + if manifest.is_empty(): + return -1 + var home: Dictionary = manifest.get("home", {}) + var owned: Dictionary = home.get("owned_decor", {}) + return int(owned.get(String(decor_id), 0)) + + +func place_local_decor( + decor_id: StringName, + position: Vector3, + yaw_radians: float, + mode: PlayerHomeStateType.PlacementMode, +) -> String: + if ( + not can_local_decorate() + or has_pending_local_decor_mutation() + or _bag == null + or _bag.get_quantity(decor_id) <= 0 + or _world_service == null + ): + return "" + var owner_fingerprint: String = ( + _session.get_local_identity_fingerprint() + ) + var normalized: Dictionary = ( + _local_home.get_nearest_valid_placement_transform( + decor_id, + position, + yaw_radians, + mode, + "", + Callable( + self, "_candidate_clear_of_players" + ).bind(owner_fingerprint, decor_id), + ) + ) + if normalized.is_empty(): + return "" + var transaction: Dictionary = _capture_local_decor_transaction() + if transaction.is_empty(): + return "" + _suppress_local_submission = true + var instance_id: String = _local_home.place_decor( + decor_id, + normalized["position"], + float(normalized["yaw"]), + mode, + ) + if instance_id.is_empty(): + _suppress_local_submission = false + return "" + if not _bag.remove_item(decor_id, 1): + _local_home.remove_placement(instance_id) + _suppress_local_submission = false + return "" + _suppress_local_submission = false + if not _commit_local_decor_transaction(transaction): + return "" + return instance_id + + +func remove_local_decor(instance_id: String) -> bool: + if ( + not can_local_decorate() + or has_pending_local_decor_mutation() + or _bag == null + or _inventory_layout == null + or _hotbar == null + ): + return false + var placement: Dictionary = _local_home.get_placement(instance_id) + if placement.is_empty(): + return false + var transaction: Dictionary = _capture_local_decor_transaction() + if transaction.is_empty(): + return false + var decor_id := StringName(str(placement["decor_id"])) + var target_hotbar_slot: int = _hotbar.find_item_slot(decor_id) + if target_hotbar_slot < 0: + target_hotbar_slot = _hotbar.find_first_empty_slot() + var prepared_hotbar_placement: bool = false + if ( + target_hotbar_slot >= 0 + and _inventory_layout.get_container( + PlayerInventoryLayout.EntryKind.ITEM, + decor_id, + ) < 0 + ): + prepared_hotbar_placement = ( + _inventory_layout.prepare_new_item_placement( + decor_id, + PlayerInventoryLayout.InventoryContainer.HOTBAR, + target_hotbar_slot, + ) + ) + var returned_to_inventory: bool = _bag.add_item(decor_id, 1) + if not returned_to_inventory: + if prepared_hotbar_placement: + _inventory_layout.cancel_prepared_item_placement(decor_id) + returned_to_inventory = _bag.add_item_to_storage(decor_id, 1) + if not returned_to_inventory: + if prepared_hotbar_placement: + _inventory_layout.cancel_prepared_item_placement(decor_id) + return false + if target_hotbar_slot >= 0: + _hotbar.assign_item(target_hotbar_slot, decor_id) + _hotbar.select_slot(target_hotbar_slot) + _suppress_local_submission = true + if not _local_home.remove_placement(instance_id): + _suppress_local_submission = false + _restore_local_decor_transaction(transaction) + return false + _suppress_local_submission = false + if not _commit_local_decor_transaction(transaction): + return false + return true + + +func update_local_decor( + instance_id: String, + position: Vector3, + yaw_radians: float, + mode: PlayerHomeStateType.PlacementMode, +) -> bool: + if has_pending_local_decor_mutation(): + return false + var normalized: Dictionary = get_valid_local_decor_transform( + instance_id, position, yaw_radians, mode + ) + if normalized.is_empty(): + return false + var transaction: Dictionary = _capture_local_decor_transaction() + if transaction.is_empty(): + return false + _suppress_local_submission = true + if not _local_home.update_placement( + instance_id, + normalized["position"], + float(normalized["yaw"]), + mode, + ): + _suppress_local_submission = false + return false + _suppress_local_submission = false + if not _commit_local_decor_transaction(transaction): + return false + return true + + +func get_valid_local_decor_transform( + instance_id: String, + position: Vector3, + yaw_radians: float, + mode: PlayerHomeStateType.PlacementMode, +) -> Dictionary: + if not can_local_decorate() or _world_service == null: + return {} + var placement: Dictionary = _local_home.get_placement(instance_id) + if placement.is_empty(): + return {} + var decor_id := StringName(str(placement.get("decor_id", ""))) + return _local_home.get_valid_update_transform( + instance_id, + position, + yaw_radians, + mode, + Callable( + self, "_candidate_clear_of_players" + ).bind( + _session.get_local_identity_fingerprint(), decor_id + ), + ) + + +func _candidate_clear_of_players( + candidate: Dictionary, + owner_fingerprint: String, + decor_id: StringName, +) -> bool: + return ( + _world_service != null + and _world_service.is_decor_placement_clear_of_players( + owner_fingerprint, + decor_id, + candidate["position"], + float(candidate["yaw"]), + ) + ) + + +func request_enter(owner_fingerprint: String) -> bool: + if ( + _session == null + or not _session.is_gameplay_session_active() + or not _manifests_by_fingerprint.has(owner_fingerprint) + or get_local_space() != NetworkHomeProtocolType.WORLD_SPACE + ): + return false + return _submit_transition( + NetworkHomeProtocolType.TransitionAction.ENTER, + owner_fingerprint, + ) + + +func request_exit() -> bool: + var owner_fingerprint: String = get_local_home_owner_fingerprint() + if owner_fingerprint.is_empty(): + return false + return _submit_transition( + NetworkHomeProtocolType.TransitionAction.EXIT, + owner_fingerprint, + ) + + +func authorize_decor_purchase( + peer_id: int, + product_id: StringName, + resulting_count: int, + result_id: String, +) -> void: + if not _session.is_host() or peer_id <= 0 or result_id.is_empty(): + return + var counts: Dictionary = _authorized_owned_counts.get(peer_id, {}) + counts[String(product_id)] = resulting_count + _authorized_owned_counts[peer_id] = counts + _authorization_result_owner[result_id] = peer_id + + +func finalize_decor_purchase( + peer_id: int, + result_id: String, + applied: bool, +) -> void: + if _authorization_result_owner.get(result_id, 0) != peer_id: + return + _authorization_result_owner.erase(result_id) + if applied: + return + _authorized_owned_counts.erase(peer_id) + + +func refresh_world_presentations() -> void: + if _world_service == null: + return + _world_service.clear_presentations() + if not _world_service.is_world_ready(): + return + if not _session.is_host(): + for manifest: Dictionary in _manifests_by_fingerprint.values(): + _world_service.apply_manifest(manifest) + return + var local_fingerprint: String = _session.get_local_identity_fingerprint() + if ( + not _session.is_dedicated_host() + and not _manifests_by_fingerprint.has(local_fingerprint) + ): + publish_local_home() + var fingerprints: Array[String] = [] + fingerprints.assign(_manifests_by_fingerprint.keys()) + fingerprints.sort() + var reserved: Array[Transform3D] = [] + for fingerprint: String in fingerprints: + var manifest: Dictionary = _manifests_by_fingerprint[fingerprint] + var transform: Transform3D = _world_service.choose_exterior_transform( + int(manifest["owner_peer_id"]), reserved + ) + reserved.append(transform) + manifest["exterior_transform"] = ( + NetworkHomeProtocolType.transform_to_array(transform) + ) + _manifests_by_fingerprint[fingerprint] = manifest + _broadcast_manifest(manifest) + for fingerprint: String in fingerprints: + var manifest: Dictionary = _manifests_by_fingerprint[fingerprint] + _spawn_peer_at_exterior( + int(manifest["owner_peer_id"]), fingerprint + ) + + +func publish_local_home( + allow_pending_decor_transaction: bool = false, +) -> bool: + if ( + _session == null + or not _session.is_gameplay_session_active() + or _session.is_dedicated_host() + or _local_home == null + ): + return false + # A purchase can update the owned decor count while an optimistic placement + # is waiting on the host. Hold that follow-up manifest until the placement is + # accepted or rolled back; otherwise it can carry the still-unverified + # placement and turn one rejection into a second stale rejection. + if ( + not allow_pending_decor_transaction + and has_pending_local_decor_mutation() + ): + _publish_queued = true + return true + if _session.is_host() and ( + _world_service == null or not _world_service.is_world_ready() + ): + return false + var home_data: Dictionary = _local_home.to_save_data() + var revision: int = int(home_data.get("revision", -1)) + if revision >= 0 and revision == _last_submitted_local_home_revision: + return true + var request: Dictionary = { + "request_id": _new_id("home"), + "session_id": _session.get_session_id(), + "owner_fingerprint": _session.get_local_identity_fingerprint(), + "home": home_data, + "digest": NetworkHomeProtocolType.manifest_digest(home_data), + } + request["sender_signature"] = _session.sign_local_action( + "portable_home_manifest", + NetworkHomeProtocolType.manifest_signature_fields(request), + ) + _last_submitted_local_home_revision = revision + if _session.is_host(): + _process_manifest_request(_session.get_local_peer_id(), request) + else: + submit_home_manifest.rpc_id(1, request) + return true + + +@rpc( + "any_peer", "call_remote", "reliable", + NetworkHomeProtocolType.RELIABLE_CHANNEL, +) +func submit_home_manifest(data: Dictionary) -> void: + var sender_id: int = multiplayer.get_remote_sender_id() + if ( + _session == null + or not _session.is_host() + or not _session.is_authenticated_peer(sender_id) + ): + return + _process_manifest_request(sender_id, data) + + +func _process_manifest_request(peer_id: int, data: Dictionary) -> void: + if ( + not NetworkHomeProtocolType.validate_manifest_request(data) + or str(data["session_id"]) != _session.get_session_id() + ): + _reject_manifest(peer_id, "The RV update was invalid.") + return + var record := _session.get_peer_record(peer_id) + var fingerprint: String = str(data["owner_fingerprint"]) + if ( + record == null + or record.identity_fingerprint != fingerprint + or not _session.verify_peer_action( + peer_id, + "portable_home_manifest", + NetworkHomeProtocolType.manifest_signature_fields(data), + data["sender_signature"], + ) + ): + _reject_manifest(peer_id, "The RV owner could not be verified.") + return + var home_data: Dictionary = PlayerHomeStateType.sanitize_save_data( + data["home"] + ) + var prior: Dictionary = _manifests_by_fingerprint.get(fingerprint, {}) + var is_first_manifest: bool = prior.is_empty() + if not _valid_manifest_revision(peer_id, prior, home_data): + _reject_manifest(peer_id, "The RV update was rejected by the host.") + return + if not _moved_decor_clear_of_players(fingerprint, prior, home_data): + _reject_manifest(peer_id, "A player is in the way of that decor.") + return + var manifest: Dictionary + if prior.is_empty(): + if _manifests_by_fingerprint.size() >= MAX_MANIFESTS: + _reject_manifest(peer_id, "This room cannot place another RV.") + return + var reserved: Array[Transform3D] = [] + for existing: Dictionary in _manifests_by_fingerprint.values(): + reserved.append(NetworkHomeProtocolType.array_to_transform( + existing["exterior_transform"] + )) + var exterior_transform: Transform3D = ( + _world_service.choose_exterior_transform(peer_id, reserved) + ) + manifest = { + "owner_peer_id": peer_id, + "owner_fingerprint": fingerprint, + "home": home_data, + "exterior_transform": ( + NetworkHomeProtocolType.transform_to_array(exterior_transform) + ), + "interior_index": _next_interior_index, + } + _next_interior_index += 1 + else: + manifest = prior.duplicate(true) + manifest["home"] = home_data + manifest["owner_peer_id"] = peer_id + _manifests_by_fingerprint[fingerprint] = manifest + _fingerprint_by_peer[peer_id] = fingerprint + _consume_owned_authorizations(peer_id, home_data) + if peer_id == _session.get_local_peer_id(): + _discard_local_decor_transactions_through( + int(home_data.get("revision", -1)) + ) + if _last_submitted_local_home_revision == int( + home_data.get("revision", -1) + ): + _last_submitted_local_home_revision = -1 + _flush_queued_local_home_publish() + _broadcast_manifest(manifest) + if is_first_manifest: + _spawn_peer_at_exterior(peer_id, fingerprint) + + +func _valid_manifest_revision( + peer_id: int, + prior_manifest: Dictionary, + home_data: Dictionary, +) -> bool: + if prior_manifest.is_empty(): + # A portable RV is owned by the player's signed local save. A new host has + # no prior room ledger with which to compare its first manifest. + return true + var prior_home: Dictionary = prior_manifest["home"] + if ( + int(home_data["revision"]) <= int(prior_home["revision"]) + or int(home_data["tier"]) != int(prior_home["tier"]) + or str(home_data["exterior_id"]) != str(prior_home["exterior_id"]) + ): + return false + var prior_owned: Dictionary = prior_home["owned_decor"] + var next_owned: Dictionary = home_data["owned_decor"] + var all_ids: Dictionary[String, bool] = {} + for value: Variant in prior_owned.keys(): + all_ids[str(value)] = true + for value: Variant in next_owned.keys(): + all_ids[str(value)] = true + var authorized: Dictionary = _authorized_owned_counts.get(peer_id, {}) + for product_id: String in all_ids: + var prior_count: int = int(prior_owned.get(product_id, 0)) + var next_count: int = int(next_owned.get(product_id, 0)) + if prior_count == next_count: + continue + if next_count < prior_count or int(authorized.get(product_id, -1)) != next_count: + return false + return true + + +func _moved_decor_clear_of_players( + owner_fingerprint: String, + prior_manifest: Dictionary, + home_data: Dictionary, +) -> bool: + if _world_service == null: + return false + var prior_by_instance: Dictionary[String, Dictionary] = {} + if not prior_manifest.is_empty(): + var prior_home: Dictionary = prior_manifest.get("home", {}) + for value: Variant in prior_home.get("placements", []): + if typeof(value) != TYPE_DICTIONARY: + continue + var prior_placement: Dictionary = value + prior_by_instance[str( + prior_placement.get("instance_id", "") + )] = prior_placement + for value: Variant in home_data.get("placements", []): + if typeof(value) != TYPE_DICTIONARY: + return false + var placement: Dictionary = value + var instance_id: String = str(placement.get("instance_id", "")) + var prior_placement: Dictionary = prior_by_instance.get( + instance_id, {} + ) + if ( + not prior_placement.is_empty() + and _same_decor_transform(prior_placement, placement) + ): + continue + var decor_id := StringName(str(placement.get("decor_id", ""))) + var position: Vector3 = _placement_position(placement) + if ( + not position.is_finite() + or not _world_service.is_decor_placement_clear_of_players( + owner_fingerprint, + decor_id, + position, + float(placement.get("yaw", 0.0)), + ) + ): + return false + return true + + +static func _same_decor_transform( + first: Dictionary, + second: Dictionary, +) -> bool: + if str(first.get("decor_id", "")) != str(second.get("decor_id", "")): + return false + var first_position: Vector3 = _placement_position(first) + var second_position: Vector3 = _placement_position(second) + return ( + first_position.is_equal_approx(second_position) + and is_equal_approx( + float(first.get("yaw", 0.0)), + float(second.get("yaw", 0.0)), + ) + ) + + +static func _placement_position(placement: Dictionary) -> Vector3: + var values: Array = placement.get("position", []) + if values.size() != 3: + return Vector3.INF + return Vector3( + float(values[0]), float(values[1]), float(values[2]) + ) + + +func _consume_owned_authorizations(peer_id: int, home_data: Dictionary) -> void: + var authorized: Dictionary = _authorized_owned_counts.get(peer_id, {}) + if authorized.is_empty(): + return + var owned: Dictionary = home_data["owned_decor"] + for product_id: String in authorized.keys(): + if int(owned.get(product_id, -1)) == int(authorized[product_id]): + authorized.erase(product_id) + if authorized.is_empty(): + _authorized_owned_counts.erase(peer_id) + else: + _authorized_owned_counts[peer_id] = authorized + + +func _broadcast_manifest(manifest: Dictionary) -> void: + if _world_service != null and _world_service.is_world_ready(): + _world_service.apply_manifest(manifest) + for peer_id: int in _session.get_authenticated_peer_ids(): + if peer_id == 1: + continue + receive_home_manifest.rpc_id(peer_id, manifest) + + +@rpc( + "authority", "call_remote", "reliable", + NetworkHomeProtocolType.RELIABLE_CHANNEL, +) +func receive_home_manifest(data: Dictionary) -> void: + if not NetworkHomeProtocolType.validate_manifest_broadcast(data): + return + var fingerprint: String = str(data["owner_fingerprint"]) + _manifests_by_fingerprint[fingerprint] = data.duplicate(true) + _fingerprint_by_peer[int(data["owner_peer_id"])] = fingerprint + if fingerprint == _session.get_local_identity_fingerprint(): + var home: Dictionary = data.get("home", {}) + _discard_local_decor_transactions_through( + int(home.get("revision", -1)) + ) + if _last_submitted_local_home_revision == int( + home.get("revision", -1) + ): + _last_submitted_local_home_revision = -1 + _flush_queued_local_home_publish() + if _world_service != null and _world_service.is_world_ready(): + _world_service.apply_manifest(data) + + +func _reject_manifest(peer_id: int, message: String) -> void: + var fingerprint: String = _fingerprint_for_peer(peer_id) + var canonical: Dictionary = _manifests_by_fingerprint.get(fingerprint, {}) + if peer_id == _session.get_local_peer_id(): + _apply_manifest_rejection(message, canonical) + else: + receive_home_manifest_rejection.rpc_id(peer_id, message, canonical) + + +@rpc( + "authority", "call_remote", "reliable", + NetworkHomeProtocolType.RELIABLE_CHANNEL, +) +func receive_home_manifest_rejection( + message: String, + canonical: Dictionary, +) -> void: + _apply_manifest_rejection(message, canonical) + + +func _apply_manifest_rejection(message: String, canonical: Dictionary) -> void: + _last_submitted_local_home_revision = -1 + var canonical_home: Dictionary = canonical.get("home", {}) + var canonical_revision: int = int(canonical_home.get("revision", -1)) + var transaction: Dictionary = _get_local_decor_rejection_transaction( + canonical_revision + ) + if canonical.is_empty() or not NetworkHomeProtocolType.validate_manifest_broadcast(canonical): + if not transaction.is_empty(): + _restore_local_decor_transaction(transaction) + _pending_local_decor_transactions.clear() + if _save_manager != null and not _save_manager.save_if_dirty(): + push_warning("Unable to save the restored RV decor state.") + _flush_queued_local_home_publish() + local_manifest_rejected.emit(message) + return + # A shop result can be accepted locally while its own home manifest is still + # in flight. A delayed rejection for an earlier placement must not erase that + # accepted purchase just because the host's canonical manifest predates it. + var locally_owned_decor: Dictionary[StringName, int] = ( + _capture_local_owned_decor_counts() + ) + # Only carry ownership forward across an actual pending decor-action + # rejection. A standalone rejected manifest must remain authoritative rather + # than repeatedly re-submitting an unverified owned-count increase. + var has_owned_decor_increase: bool = ( + not transaction.is_empty() + and _has_local_owned_decor_increase( + locally_owned_decor, + canonical_home, + ) + ) + _suppress_local_submission = true + var restored: bool = _local_home.restore_from_save_data(canonical_home) + var owned_decor_restored: bool = ( + restored + and ( + not has_owned_decor_increase + or _restore_local_owned_decor_increases(locally_owned_decor) + ) + ) + var reconciled: bool = ( + restored + and owned_decor_restored + and _reconcile_local_decor_inventory(transaction) + ) + _suppress_local_submission = false + _discard_local_decor_transactions_after(canonical_revision) + if not reconciled: + push_error("Unable to reconcile RV decor after a host rejection.") + elif _save_manager != null and not _save_manager.save_if_dirty(): + push_warning("Unable to save the restored RV decor state.") + receive_home_manifest(canonical) + if reconciled and has_owned_decor_increase: + # Submit the preserved purchase as a fresh revision after applying the + # canonical placement rollback. This is deliberately separate from the + # rejected action, so the host can validate the already-authorized count. + if not publish_local_home(): + push_warning("Unable to publish the restored RV decor ownership.") + local_manifest_rejected.emit(message) + + +func _capture_local_decor_transaction() -> Dictionary: + if ( + _local_home == null + or _bag == null + or _inventory_layout == null + or _hotbar == null + ): + return {} + var saved_items: Array[OwnedItemType] = [] + for item: OwnedItemType in _bag.get_all_items(): + saved_items.append(item.duplicate_record()) + return { + "home": _local_home.to_save_data(), + "bag_items": saved_items, + "layout": _inventory_layout.to_save_data(), + "hotbar_slots": _hotbar.get_slots(), + "hotbar_fish_slots": _hotbar.get_fish_slots(), + "selected_hotbar_slot": _hotbar.get_selected_slot(), + } + + +func _capture_local_owned_decor_counts() -> Dictionary[StringName, int]: + var counts: Dictionary[StringName, int] = {} + if _local_home == null: + return counts + for decor_id: StringName in DecorCatalogType.get_product_ids(): + counts[decor_id] = _local_home.get_owned_count(decor_id) + return counts + + +func _has_local_owned_decor_increase( + local_counts: Dictionary[StringName, int], + canonical_home: Dictionary, +) -> bool: + var canonical_owned: Dictionary = canonical_home.get("owned_decor", {}) + for decor_id: StringName in DecorCatalogType.get_product_ids(): + if int(local_counts.get(decor_id, 0)) > int( + canonical_owned.get(String(decor_id), 0) + ): + return true + return false + + +func _restore_local_owned_decor_increases( + local_counts: Dictionary[StringName, int], +) -> bool: + if _local_home == null: + return false + for decor_id: StringName in DecorCatalogType.get_product_ids(): + var local_count: int = int(local_counts.get(decor_id, 0)) + var canonical_count: int = _local_home.get_owned_count(decor_id) + while canonical_count < local_count: + if not _local_home.add_owned_decor(decor_id, 1): + return false + canonical_count += 1 + return true + + +func _commit_local_decor_transaction(transaction: Dictionary) -> bool: + if _save_manager == null or not _save_manager.save_if_dirty(): + _restore_local_decor_transaction(transaction) + return false + var revision: int = _local_home.get_revision() + _pending_local_decor_transactions[revision] = transaction.duplicate(true) + _trim_pending_local_decor_transactions() + if publish_local_home(true): + return true + _pending_local_decor_transactions.erase(revision) + _restore_local_decor_transaction(transaction) + _flush_queued_local_home_publish() + # The optimistic mutation was already written before we attempted to publish + # it. If the session ended or could not accept the manifest, immediately + # persist the restored state so a restart cannot resurrect the rejected + # placement or consume its decor item. + if _save_manager != null and not _save_manager.save_if_dirty(): + push_warning("Unable to save the restored RV decor state.") + return false + + +func _restore_local_decor_transaction(transaction: Dictionary) -> bool: + if ( + transaction.is_empty() + or _local_home == null + or _bag == null + or _inventory_layout == null + or _hotbar == null + ): + return false + var home_data: Variant = transaction.get("home", {}) + var layout_data: Variant = transaction.get("layout", {}) + var stored_items: Variant = transaction.get("bag_items", []) + var stored_slots: Variant = transaction.get("hotbar_slots", []) + var stored_fish_slots: Variant = transaction.get("hotbar_fish_slots", []) + if ( + typeof(home_data) != TYPE_DICTIONARY + or typeof(layout_data) != TYPE_DICTIONARY + or typeof(stored_items) != TYPE_ARRAY + or typeof(stored_slots) != TYPE_ARRAY + or typeof(stored_fish_slots) != TYPE_ARRAY + ): + return false + var items: Array[OwnedItemType] = [] + for value: Variant in stored_items as Array: + if not value is OwnedItemType: + return false + items.append((value as OwnedItemType).duplicate_record()) + var slots: Array[StringName] = [] + for value: Variant in stored_slots as Array: + slots.append(StringName(str(value))) + var fish_slots: Array[StringName] = [] + for value: Variant in stored_fish_slots as Array: + fish_slots.append(StringName(str(value))) + var was_suppressed: bool = _suppress_local_submission + _suppress_local_submission = true + var home_restored: bool = _local_home.restore_from_save_data( + home_data as Dictionary + ) + var bag_restored: bool = _bag.replace_all_items(items) + var layout_restored: bool = _inventory_layout.restore_from_save_data( + layout_data as Dictionary + ) + var hotbar_restored: bool = _hotbar.replace_state( + slots, + int(transaction.get("selected_hotbar_slot", 0)), + fish_slots, + false, + ) + _suppress_local_submission = was_suppressed + return home_restored and bag_restored and layout_restored and hotbar_restored + + +func _reconcile_local_decor_inventory(transaction: Dictionary) -> bool: + if _bag == null or _local_home == null: + return false + var preferred_slots: Dictionary[StringName, int] = ( + _decor_hotbar_slots_from_transaction(transaction) + ) + for decor_id: StringName in DecorCatalogType.get_product_ids(): + var target_quantity: int = _local_home.get_available_count(decor_id) + var current_quantity: int = _bag.get_quantity(decor_id) + if current_quantity > target_quantity: + if not _bag.remove_item( + decor_id, current_quantity - target_quantity + ): + return false + continue + while current_quantity < target_quantity: + var preferred_slot: int = int( + preferred_slots.get(decor_id, -1) + ) + if not _restore_decor_item_to_bag(decor_id, preferred_slot): + return false + current_quantity += 1 + return true + + +func _decor_hotbar_slots_from_transaction( + transaction: Dictionary, +) -> Dictionary[StringName, int]: + var result: Dictionary[StringName, int] = {} + var stored_slots: Variant = transaction.get("hotbar_slots", []) + if typeof(stored_slots) != TYPE_ARRAY: + return result + for slot_index: int in range((stored_slots as Array).size()): + var decor_id := StringName(str((stored_slots as Array)[slot_index])) + if DecorCatalogType.has_product(decor_id): + result[decor_id] = slot_index + return result + + +func _restore_decor_item_to_bag( + decor_id: StringName, + preferred_hotbar_slot: int, +) -> bool: + if _bag == null: + return false + var prepared_slot: int = -1 + if ( + _inventory_layout != null + and _hotbar != null + and _inventory_layout.get_container( + PlayerInventoryLayout.EntryKind.ITEM, decor_id + ) < 0 + ): + var candidate_slot: int = preferred_hotbar_slot + if candidate_slot < 0: + candidate_slot = _hotbar.find_first_empty_slot() + if candidate_slot >= 0 and _inventory_layout.prepare_new_item_placement( + decor_id, + PlayerInventoryLayout.InventoryContainer.HOTBAR, + candidate_slot, + ): + prepared_slot = candidate_slot + var restored: bool = _bag.add_item(decor_id, 1) + if not restored: + if prepared_slot >= 0: + _inventory_layout.cancel_prepared_item_placement(decor_id) + if _bag.get_owned_item(decor_id) == null: + restored = _bag.add_item_to_storage(decor_id, 1) + if restored and prepared_slot >= 0: + _hotbar.assign_item(prepared_slot, decor_id) + _hotbar.select_slot(prepared_slot) + return restored + + +func _get_local_decor_rejection_transaction( + canonical_revision: int, +) -> Dictionary: + var revisions: Array[int] = [] + revisions.assign(_pending_local_decor_transactions.keys()) + revisions.sort() + for revision: int in revisions: + if canonical_revision < 0 or revision > canonical_revision: + return _pending_local_decor_transactions[revision].duplicate(true) + return {} + + +func _discard_local_decor_transactions_through(revision: int) -> void: + for pending_revision: int in _pending_local_decor_transactions.keys(): + if pending_revision <= revision: + _pending_local_decor_transactions.erase(pending_revision) + + +func _discard_local_decor_transactions_after(revision: int) -> void: + for pending_revision: int in _pending_local_decor_transactions.keys(): + if pending_revision > revision: + _pending_local_decor_transactions.erase(pending_revision) + + +func _trim_pending_local_decor_transactions() -> void: + var revisions: Array[int] = [] + revisions.assign(_pending_local_decor_transactions.keys()) + revisions.sort() + while revisions.size() > MAX_PENDING_LOCAL_DECOR_TRANSACTIONS: + _pending_local_decor_transactions.erase(revisions.pop_front()) + + +func _submit_transition(action: int, owner_fingerprint: String) -> bool: + var request: Dictionary = { + "request_id": _new_id("home_transition"), + "session_id": _session.get_session_id(), + "action": action, + "owner_fingerprint": owner_fingerprint, + } + request["sender_signature"] = _session.sign_local_action( + "portable_home_transition", + NetworkHomeProtocolType.transition_signature_fields(request), + ) + if _session.is_host(): + _process_transition_request(_session.get_local_peer_id(), request) + else: + submit_home_transition.rpc_id(1, request) + return true + + +@rpc( + "any_peer", "call_remote", "reliable", + NetworkHomeProtocolType.RELIABLE_CHANNEL, +) +func submit_home_transition(data: Dictionary) -> void: + var sender_id: int = multiplayer.get_remote_sender_id() + if ( + not _session.is_host() + or not _session.is_authenticated_peer(sender_id) + ): + return + _process_transition_request(sender_id, data) + + +func _process_transition_request(peer_id: int, data: Dictionary) -> void: + if ( + not NetworkHomeProtocolType.validate_transition_request(data) + or str(data["session_id"]) != _session.get_session_id() + or not _session.verify_peer_action( + peer_id, + "portable_home_transition", + NetworkHomeProtocolType.transition_signature_fields(data), + data["sender_signature"], + ) + ): + _send_transition_rejection(peer_id, "The RV transition was invalid.") + return + var owner_fingerprint: String = str(data["owner_fingerprint"]) + var action: int = int(data["action"]) + var avatar: Player = _spawn_service.get_avatar(peer_id) + var manifest: Dictionary = _manifests_by_fingerprint.get( + owner_fingerprint, {} + ) + if avatar == null or manifest.is_empty(): + _send_transition_rejection(peer_id, "That RV is unavailable.") + return + if action == NetworkHomeProtocolType.TransitionAction.ENTER: + var record := _session.get_peer_record(peer_id) + var owner_is_local: bool = ( + record != null and record.identity_fingerprint == owner_fingerprint + ) + var privacy: int = int((manifest["home"] as Dictionary)["privacy"]) + if ( + (not owner_is_local and privacy != PlayerHomeStateType.Privacy.OPEN) + or _session.get_peer_space(peer_id) + != NetworkHomeProtocolType.WORLD_SPACE + or not _world_service.is_avatar_near_exterior( + avatar, owner_fingerprint + ) + ): + _send_transition_rejection(peer_id, "You cannot enter that RV.") + return + var interior_space: StringName = ( + NetworkHomeProtocolType.make_space_id(owner_fingerprint) + ) + var visitor_slot: int = _reserve_interior_slot( + interior_space, peer_id + ) + _apply_host_transition( + peer_id, + interior_space, + owner_fingerprint, + _world_service.get_interior_spawn_transform( + owner_fingerprint, visitor_slot + ), + ) + return + if ( + _session.get_peer_space(peer_id) + != NetworkHomeProtocolType.make_space_id(owner_fingerprint) + or not _world_service.is_avatar_near_interior_exit( + avatar, owner_fingerprint + ) + ): + _send_transition_rejection(peer_id, "Move closer to the RV door.") + return + _apply_host_transition( + peer_id, + NetworkHomeProtocolType.WORLD_SPACE, + owner_fingerprint, + _world_service.get_exterior_spawn_transform(owner_fingerprint), + ) + + +func _spawn_peer_at_exterior( + peer_id: int, + owner_fingerprint: String, +) -> void: + if ( + not _session.is_host() + or _session.get_peer_space(peer_id) + != NetworkHomeProtocolType.WORLD_SPACE + or _spawn_service.get_avatar(peer_id) == null + ): + return + _apply_host_transition( + peer_id, + NetworkHomeProtocolType.WORLD_SPACE, + owner_fingerprint, + _world_service.get_exterior_spawn_transform(owner_fingerprint), + ) + + +func _apply_host_transition( + peer_id: int, + space_id: StringName, + owner_fingerprint: String, + transform: Transform3D, +) -> void: + var avatar: Player = _spawn_service.get_avatar(peer_id) + var movement_sequence: int = 0 + if avatar != null: + movement_sequence = int( + avatar.make_network_snapshot(peer_id).get( + "acknowledged_input", 0 + ) + ) + var transform_data: Array[float] = ( + NetworkHomeProtocolType.transform_to_array(transform) + ) + if not NetworkHomeProtocolType.validate_transition_transform( + transform_data + ): + push_error("Refused an out-of-bounds RV transition transform.") + return + var previous_space: StringName = _session.get_peer_space(peer_id) + if ( + String(previous_space).begins_with("rv:") + and previous_space != space_id + ): + _release_interior_slot(previous_space, peer_id) + var result: Dictionary = { + "peer_id": peer_id, + "space_id": String(space_id), + "owner_fingerprint": owner_fingerprint, + "transform": transform_data, + "movement_sequence": movement_sequence, + } + _apply_transition_result(result) + for recipient_id: int in _session.get_authenticated_peer_ids(): + if recipient_id == 1: + continue + receive_home_transition.rpc_id(recipient_id, result) + + +@rpc( + "authority", "call_remote", "reliable", + NetworkHomeProtocolType.RELIABLE_CHANNEL, +) +func receive_home_transition(data: Dictionary) -> void: + if ( + typeof(data.get("peer_id")) != TYPE_INT + or typeof(data.get("space_id")) not in [TYPE_STRING, TYPE_STRING_NAME] + or typeof(data.get("movement_sequence", 0)) != TYPE_INT + or int(data.get("movement_sequence", 0)) < 0 + or not NetworkIdentityCrypto.valid_fingerprint( + data.get("owner_fingerprint") + ) + or not NetworkHomeProtocolType.validate_transition_transform( + data.get("transform") + ) + ): + return + _apply_transition_result(data) + + +func _apply_transition_result(data: Dictionary) -> void: + var peer_id: int = int(data["peer_id"]) + var space_id := StringName(str(data["space_id"])) + if not NetworkHomeProtocolType.validate_transition_transform( + data.get("transform") + ): + return + var target_transform: Transform3D = ( + NetworkHomeProtocolType.array_to_transform(data["transform"]) + ) + if not _session.set_peer_space(peer_id, space_id): + return + if not _session.apply_authoritative_space_transition( + peer_id, + target_transform, + int(data.get("movement_sequence", 0)), + ): + return + if peer_id == _session.get_local_peer_id(): + _world_service.set_local_space(space_id) + local_space_changed.emit(space_id, str(data["owner_fingerprint"])) + local_transition_finished.emit(true, "") + _refresh_peer_visibility() + + +func _send_transition_rejection(peer_id: int, message: String) -> void: + if peer_id == _session.get_local_peer_id(): + local_transition_finished.emit(false, message) + else: + receive_home_transition_rejection.rpc_id(peer_id, message) + + +@rpc( + "authority", "call_remote", "reliable", + NetworkHomeProtocolType.RELIABLE_CHANNEL, +) +func receive_home_transition_rejection(message: String) -> void: + local_transition_finished.emit( + false, message.left(NetworkHomeProtocolType.MAX_MESSAGE_LENGTH) + ) + + +func _refresh_peer_visibility() -> void: + var local_peer_id: int = _session.get_local_peer_id() + if local_peer_id <= 0: + return + for peer_id: int in _spawn_service.get_peer_ids(): + if peer_id == local_peer_id: + continue + _spawn_service.set_peer_presentation_visible( + peer_id, _session.peers_share_space(local_peer_id, peer_id) + ) + + +func _on_local_home_changed() -> void: + if _suppress_local_submission or _publish_queued: + return + _publish_queued = true + call_deferred("_publish_queued_home") + + +func _publish_queued_home() -> void: + if has_pending_local_decor_mutation(): + return + _publish_queued = false + if _save_manager != null: + _save_manager.save_if_dirty() + publish_local_home() + + +func _flush_queued_local_home_publish() -> void: + if not _publish_queued or has_pending_local_decor_mutation(): + return + call_deferred("_publish_queued_home") + + +func _on_join_authenticated() -> void: + publish_local_home() + + +func _on_peer_authenticated(peer_id: int, _display_name: String) -> void: + if not _session.is_host(): + return + for manifest: Dictionary in _manifests_by_fingerprint.values(): + receive_home_manifest.rpc_id(peer_id, manifest) + for existing_peer_id: int in _session.get_authenticated_peer_ids(): + if existing_peer_id == peer_id: + continue + var avatar: Player = _spawn_service.get_avatar(existing_peer_id) + if avatar == null: + continue + var space_id: StringName = _session.get_peer_space(existing_peer_id) + var owner_fingerprint: String = ( + String(space_id).trim_prefix("rv:") + if String(space_id).begins_with("rv:") + else _fingerprint_for_peer(existing_peer_id) + ) + if owner_fingerprint.is_empty(): + continue + receive_home_transition.rpc_id(peer_id, { + "peer_id": existing_peer_id, + "space_id": String(space_id), + "owner_fingerprint": owner_fingerprint, + "transform": NetworkHomeProtocolType.transform_to_array( + avatar.global_transform + ), + }) + + +func _on_peer_removed(peer_id: int) -> void: + _release_peer_interior_slots(peer_id) + var fingerprint: String = _fingerprint_by_peer.get(peer_id, "") + _fingerprint_by_peer.erase(peer_id) + _authorized_owned_counts.erase(peer_id) + if fingerprint.is_empty(): + return + if _session.is_host(): + for occupant_id: int in _session.get_authenticated_peer_ids(): + if ( + occupant_id == peer_id + or _session.get_peer_space(occupant_id) + != NetworkHomeProtocolType.make_space_id(fingerprint) + ): + continue + _apply_host_transition( + occupant_id, + NetworkHomeProtocolType.WORLD_SPACE, + fingerprint, + _world_service.get_exterior_spawn_transform(fingerprint), + ) + _manifests_by_fingerprint.erase(fingerprint) + _world_service.remove_presentation(fingerprint) + if _session.is_host(): + for recipient_id: int in _session.get_authenticated_peer_ids(): + if recipient_id != 1: + receive_home_removed.rpc_id(recipient_id, fingerprint) + + +@rpc( + "authority", "call_remote", "reliable", + NetworkHomeProtocolType.RELIABLE_CHANNEL, +) +func receive_home_removed(owner_fingerprint: String) -> void: + if not NetworkIdentityCrypto.valid_fingerprint(owner_fingerprint): + return + _manifests_by_fingerprint.erase(owner_fingerprint) + _world_service.remove_presentation(owner_fingerprint) + + +func _on_session_state_changed(state: NetworkSession.State) -> void: + if state in [NetworkSession.State.PRIVATE_HOST, NetworkSession.State.OPEN_HOST]: + if ( + not _session.is_dedicated_host() + and _world_service != null + and _world_service.is_world_ready() + ): + publish_local_home() + return + if state in [ + NetworkSession.State.INACTIVE, + NetworkSession.State.DISCONNECTING, + NetworkSession.State.CONNECTION_FAILED, + NetworkSession.State.SERVER_LOST, + ]: + _manifests_by_fingerprint.clear() + _fingerprint_by_peer.clear() + _authorized_owned_counts.clear() + _authorization_result_owner.clear() + _publish_queued = false + _last_submitted_local_home_revision = -1 + _pending_local_decor_transactions.clear() + _interior_slots_by_space.clear() + _next_interior_index = 0 + _world_service.clear_presentations() + _world_service.set_local_space(NetworkHomeProtocolType.WORLD_SPACE) + local_space_changed.emit(NetworkHomeProtocolType.WORLD_SPACE, "") + + +func _fingerprint_for_peer(peer_id: int) -> String: + if _fingerprint_by_peer.has(peer_id): + return _fingerprint_by_peer[peer_id] + var record := _session.get_peer_record(peer_id) + return record.identity_fingerprint if record != null else "" + + +func _reserve_interior_slot(space_id: StringName, peer_id: int) -> int: + var slots: Dictionary = _interior_slots_by_space.get(space_id, {}) + if slots.has(peer_id): + return int(slots[peer_id]) + var used_slots: Dictionary[int, bool] = {} + for value: Variant in slots.values(): + used_slots[int(value)] = true + var slot: int = 0 + while used_slots.has(slot): + slot += 1 + slots[peer_id] = slot + _interior_slots_by_space[space_id] = slots + return slot + + +func _release_interior_slot(space_id: StringName, peer_id: int) -> void: + var slots: Dictionary = _interior_slots_by_space.get(space_id, {}) + if slots.is_empty(): + return + slots.erase(peer_id) + if slots.is_empty(): + _interior_slots_by_space.erase(space_id) + else: + _interior_slots_by_space[space_id] = slots + + +func _release_peer_interior_slots(peer_id: int) -> void: + for space_id: StringName in _interior_slots_by_space.keys(): + _release_interior_slot(space_id, peer_id) + + +func _new_id(prefix: String) -> String: + return "%s:%s" % [ + prefix, Crypto.new().generate_random_bytes(16).hex_encode(), + ] diff --git a/network/network_home_service.gd.uid b/network/network_home_service.gd.uid new file mode 100644 index 0000000..be233ed --- /dev/null +++ b/network/network_home_service.gd.uid @@ -0,0 +1 @@ +uid://ong8kug36ku7 diff --git a/network/network_identity_crypto.gd b/network/network_identity_crypto.gd index 4886cca..9d4f09c 100644 --- a/network/network_identity_crypto.gd +++ b/network/network_identity_crypto.gd @@ -5,7 +5,8 @@ const ALGORITHM: String = "RSA-3072-SHA256" const FINGERPRINT_LENGTH: int = 64 const MAX_PUBLIC_KEY_BYTES: int = 8192 const MAX_SIGNATURE_BYTES: int = 1024 -const DOMAIN_PREFIX: String = "NETFISHING" +const DOMAIN_PREFIX: String = "straywild" +const LEGACY_DOMAIN_PREFIX: String = "NETFISHING" const IDENTITY_VERSION: String = "identity_v1" @@ -50,8 +51,16 @@ static func secure_id(byte_count: int = 16) -> String: static func canonical_bytes(domain: String, fields: Array) -> PackedByteArray: + return canonical_bytes_for_prefix(DOMAIN_PREFIX, domain, fields) + + +static func canonical_bytes_for_prefix( + prefix: String, + domain: String, + fields: Array, +) -> PackedByteArray: var output := PackedByteArray() - _append_string(output, DOMAIN_PREFIX) + _append_string(output, prefix) _append_string(output, IDENTITY_VERSION) _append_string(output, domain) for value: Variant in fields: @@ -117,6 +126,37 @@ static func verify_fields( ) +static func verify_legacy_fields( + public_key: CryptoKey, + domain: String, + fields: Array, + signature: PackedByteArray, +) -> bool: + if ( + public_key == null + or signature.is_empty() + or signature.size() > MAX_SIGNATURE_BYTES + ): + return false + var bytes: PackedByteArray = canonical_bytes_for_prefix( + LEGACY_DOMAIN_PREFIX, + domain, + fields, + ) + if bytes.is_empty(): + return false + var context := HashingContext.new() + if context.start(HashingContext.HASH_SHA256) != OK: + return false + context.update(bytes) + return Crypto.new().verify( + HashingContext.HASH_SHA256, + context.finish(), + signature, + public_key, + ) + + static func load_public_key(public_pem: String) -> CryptoKey: var normalized := normalize_public_pem(public_pem) if normalized.is_empty() or normalized.to_utf8_buffer().size() > MAX_PUBLIC_KEY_BYTES: diff --git a/network/network_item_use_service.gd b/network/network_item_use_service.gd index 1777c51..024eca9 100644 --- a/network/network_item_use_service.gd +++ b/network/network_item_use_service.gd @@ -5,6 +5,7 @@ const FishingRodDataType = preload("res://items/fishing_rod_data.gd") const ArtShopStockType = preload("res://economy/art_shop_stock.gd") const FishingShopStockType = preload("res://economy/fishing_shop_stock.gd") +const DecorCatalogType = preload("res://homes/decor_catalog.gd") const MAX_LEDGER_ENTRIES: int = 64 @@ -47,6 +48,7 @@ func setup( _session.peer_removed.connect(_on_peer_removed) _session.state_changed.connect(_on_session_state_changed) _session.peer_authenticated.connect(_on_peer_authenticated) + _spawn_service.avatar_spawned.connect(_on_avatar_spawned) func request_use(item_id: StringName) -> String: @@ -389,6 +391,14 @@ func _apply_equipped(data: Dictionary) -> void: item_id == FishingShopStockType.CRAB_NET_ID and bool(data["owns_item"]), ) + avatar.set_active_shovel( + item_id == FishingShopStockType.STANDARD_SHOVEL_ID + and bool(data["owns_item"]), + ) + avatar.set_active_decor_package( + DecorCatalogType.has_product(item_id) + and bool(data["owns_item"]), + ) equipped_state_changed.emit( peer_id, StringName(str(data["item_id"])), int(data["category"]) ) @@ -432,6 +442,12 @@ func _on_peer_authenticated(peer_id: int, _display_name: String) -> void: receive_equipped_state.rpc_id(peer_id, state) +func _on_avatar_spawned(peer_id: int, _avatar: Player) -> void: + var state: Dictionary = _equipped_states.get(peer_id, {}) + if not state.is_empty(): + _apply_equipped(state) + + func _on_peer_removed(peer_id: int) -> void: _requests.erase(peer_id) _pending_by_peer.erase(peer_id) diff --git a/network/network_mail_service.gd b/network/network_mail_service.gd index eb9fe0f..675a5aa 100644 --- a/network/network_mail_service.gd +++ b/network/network_mail_service.gd @@ -928,7 +928,9 @@ func _can_receive(attachment: Dictionary) -> bool: return _wallet.can_credit(int(attachment["amount"])) PlayerAssetReservationService.AttachmentType.FISH: return ( - _inventory.get_all_catches().size() < _cooler_capacity.get_capacity() + _inventory.can_accept_catch( + StringName(str(attachment["catch_id"])) + ) and not _inventory.contains_catch_id( StringName(str(attachment["catch_id"])) ) diff --git a/network/network_player_animation_protocol.gd b/network/network_player_animation_protocol.gd index b27cb9d..40fe1c8 100644 --- a/network/network_player_animation_protocol.gd +++ b/network/network_player_animation_protocol.gd @@ -9,6 +9,7 @@ const MAX_ACTION_ELAPSED_SECONDS: float = 86400.0 const LOCOMOTION_IDLE: StringName = &"idle" const LOCOMOTION_WALKING: StringName = &"walking" const LOCOMOTION_RUNNING: StringName = &"running" +const LOCOMOTION_SNEAKING: StringName = &"sneaking" static func make_state( @@ -17,13 +18,17 @@ static func make_state( action_id: StringName = &"", action_sequence: int = 0, action_elapsed: float = 0.0, + action_paused: bool = false, ) -> Dictionary: return { "format_version": FORMAT_VERSION, "locomotion_id": String(locomotion_id), "grounded": grounded, "action": make_action_state( - action_id, action_sequence, action_elapsed + action_id, + action_sequence, + action_elapsed, + action_paused, ), } @@ -32,11 +37,13 @@ static func make_action_state( action_id: StringName = &"", action_sequence: int = 0, action_elapsed: float = 0.0, + paused: bool = false, ) -> Dictionary: return { "id": String(action_id), "sequence": action_sequence, "elapsed": action_elapsed, + "paused": paused, } @@ -61,6 +68,7 @@ static func validate_action_state(value: Variant) -> bool: not valid_state_id(action.get("id"), true) or typeof(action.get("sequence")) != TYPE_INT or typeof(action.get("elapsed")) not in [TYPE_FLOAT, TYPE_INT] + or typeof(action.get("paused", false)) != TYPE_BOOL ): return false var sequence: int = int(action["sequence"]) diff --git a/network/network_player_list_service.gd b/network/network_player_list_service.gd index 4742d14..677df05 100644 --- a/network/network_player_list_service.gd +++ b/network/network_player_list_service.gd @@ -3,6 +3,15 @@ extends Node signal entries_changed signal moderation_finished(success: bool, message: String) +signal friend_request_received( + request_id: String, + fingerprint: String, + display_name: String, +) +signal friend_action_finished(success: bool, message: String) + +const MAX_PENDING_FRIEND_REQUESTS := 16 +const FRIEND_REQUEST_ID_LENGTH := 32 var _session: NetworkSession var _relationships: PlayerRelationshipStore @@ -18,6 +27,9 @@ var _peer_fingerprints: Dictionary[int, String] = {} var _remote_bans: Array[Dictionary] = [] var _ban_snapshot_requested: bool = false var _ban_snapshot_loaded: bool = false +var _pending_outgoing_friends: Dictionary[String, Dictionary] = {} +var _pending_incoming_friends: Dictionary[String, Dictionary] = {} +var _host_friend_routes: Dictionary[String, Dictionary] = {} func setup( @@ -74,6 +86,18 @@ func get_entries() -> Array[PlayerListEntry]: entry.ping_to_host_ms = _session.get_peer_rtt_ms(peer_id) entry.muted = _relationships.is_muted(record.identity_fingerprint) entry.blocked = blocked + entry.is_friend = _relationships.is_friend(record.identity_fingerprint) + entry.can_request_friend = ( + not entry.is_local_player + and not entry.is_friend + and not entry.blocked + and _session.supports_server_capability( + NetworkProtocol.FRIENDS_CAPABILITY + ) + and _session.peer_supports_capability( + peer_id, NetworkProtocol.FRIENDS_CAPABILITY + ) + ) entry.can_kick = ( _session.can_local_moderate() and peer_id != local_id @@ -81,6 +105,7 @@ func get_entries() -> Array[PlayerListEntry]: and (_session.is_host() or not entry.is_operator) ) entry.can_ban = entry.can_kick + entry.can_clear_art = entry.can_kick entry.can_manage_operator = ( _session.can_manage_operators() and peer_id != local_id @@ -124,6 +149,10 @@ func get_relationships() -> Array[Dictionary]: return _relationships.get_records() +func get_friends() -> Array[Dictionary]: + return _relationships.get_friends() + + func get_bans() -> Array[Dictionary]: if _session.is_host(): return _bans.get_bans(_session.get_host_identity_fingerprint()) @@ -179,6 +208,160 @@ func set_blocked(fingerprint: String, display_name: String, value: bool) -> bool return _relationships.set_blocked(fingerprint, display_name, value) +func remove_friend(fingerprint: String, display_name: String) -> bool: + if fingerprint == _session.get_local_identity_fingerprint(): + return false + var ok := _relationships.remove_friend(fingerprint, display_name) + friend_action_finished.emit( + ok, + "Friend removed." if ok else "Friend could not be removed.", + ) + return ok + + +func send_friend_request( + peer_id: int, + fingerprint: String, + display_name: String, +) -> bool: + if ( + _pending_outgoing_friends.size() >= MAX_PENDING_FRIEND_REQUESTS + or fingerprint == _session.get_local_identity_fingerprint() + or _relationships.is_blocked(fingerprint) + or _relationships.is_friend(fingerprint) + or not _valid_friend_target(peer_id, fingerprint) + ): + friend_action_finished.emit( + false, "This person needs to be online to do this." + ) + return false + var local_capabilities: Dictionary = ( + _relationships.create_friend_capabilities() + ) + if local_capabilities.is_empty(): + friend_action_finished.emit(false, "Friend request could not be created.") + return false + var request_id := NetworkIdentityCrypto.secure_id(16) + _pending_outgoing_friends[request_id] = { + "target_peer_id": peer_id, + "target_fingerprint": fingerprint, + "target_display_name": display_name, + "local_capabilities": local_capabilities, + } + var public_capabilities := _public_friend_capabilities(local_capabilities) + if _session.is_host(): + _route_friend_request( + _session.get_local_peer_id(), peer_id, request_id, public_capabilities + ) + else: + request_friendship.rpc_id( + 1, peer_id, request_id, public_capabilities + ) + friend_action_finished.emit(true, "Friend request sent.") + return true + + +func respond_friend_request(request_id: String, accepted: bool) -> bool: + var pending: Dictionary = _pending_incoming_friends.get(request_id, {}) + if pending.is_empty(): + friend_action_finished.emit( + false, "This friend request is no longer available." + ) + return false + _pending_incoming_friends.erase(request_id) + var local_capabilities: Dictionary = {} + var public_capabilities: Dictionary = {} + var response_accepted := accepted + if accepted: + local_capabilities = _relationships.create_friend_capabilities() + response_accepted = ( + not local_capabilities.is_empty() + and _relationships.add_friend( + str(pending["requester_fingerprint"]), + str(pending["requester_display_name"]), + local_capabilities, + pending["remote_capabilities"], + ) + ) + if response_accepted: + public_capabilities = _public_friend_capabilities(local_capabilities) + if _session.is_host(): + _route_friend_response( + _session.get_local_peer_id(), + request_id, + response_accepted, + public_capabilities, + ) + else: + respond_friendship.rpc_id( + 1, request_id, response_accepted, public_capabilities + ) + friend_action_finished.emit( + response_accepted or not accepted, + "Friend added." + if response_accepted + else "Friend request declined." + if not accepted + else "Friend could not be saved.", + ) + return response_accepted or not accepted + + +@rpc("any_peer", "call_remote", "reliable", 0) +func request_friendship( + target_peer_id: int, + request_id: String, + public_capabilities: Dictionary, +) -> void: + _route_friend_request( + multiplayer.get_remote_sender_id(), + target_peer_id, + request_id, + public_capabilities, + ) + + +@rpc("authority", "call_remote", "reliable", 0) +func receive_friend_request( + request_id: String, + requester_fingerprint: String, + requester_display_name: String, + public_capabilities: Dictionary, +) -> void: + _receive_friend_request_local( + request_id, + requester_fingerprint, + requester_display_name, + public_capabilities, + ) + + +@rpc("any_peer", "call_remote", "reliable", 0) +func respond_friendship( + request_id: String, + accepted: bool, + public_capabilities: Dictionary, +) -> void: + _route_friend_response( + multiplayer.get_remote_sender_id(), + request_id, + accepted, + public_capabilities, + ) + + +@rpc("authority", "call_remote", "reliable", 0) +func receive_friend_result( + request_id: String, + accepted: bool, + public_capabilities: Dictionary, + message: String, +) -> void: + _receive_friend_result_local( + request_id, accepted, public_capabilities, message + ) + + func kick(peer_id: int, fingerprint: String, revision: int) -> bool: if _session.is_host(): return _kick_on_host(peer_id, fingerprint, revision, true) @@ -189,6 +372,20 @@ func kick(peer_id: int, fingerprint: String, revision: int) -> bool: return true +func clear_art(peer_id: int, fingerprint: String, revision: int) -> bool: + if _session.is_host(): + return _clear_art_on_host( + peer_id, fingerprint, revision, true + ) + if not _session.is_local_operator(): + moderation_finished.emit( + false, "Only the host or an operator can clear player artwork." + ) + return false + request_clear_art.rpc_id(1, peer_id, fingerprint) + return true + + func ban( peer_id: int, fingerprint: String, @@ -257,6 +454,23 @@ func request_kick(peer_id: int, fingerprint: String) -> void: ) +@rpc("any_peer", "call_remote", "reliable", 0) +func request_clear_art(peer_id: int, fingerprint: String) -> void: + var sender_id: int = multiplayer.get_remote_sender_id() + if not _valid_operator_sender(sender_id): + return + var ok: bool = _clear_art_on_host( + peer_id, fingerprint, -1, false + ) + _send_moderation_result( + sender_id, + ok, + "Player artwork cleared." + if ok + else "Player artwork could not be cleared.", + ) + + @rpc("any_peer", "call_remote", "reliable", 0) func request_ban(peer_id: int, fingerprint: String) -> void: var sender_id: int = multiplayer.get_remote_sender_id() @@ -422,6 +636,32 @@ func _on_peer_removed(peer_id: int) -> void: for key: String in _host_block_pairs.keys(): if fingerprint in key.split(":"): _host_block_pairs.erase(key) + for request_id: String in _host_friend_routes.keys(): + var route: Dictionary = _host_friend_routes[request_id] + if int(route.get("target_peer_id", 0)) == peer_id: + _send_friend_result_to_peer( + int(route.get("requester_peer_id", 0)), + request_id, + false, + {}, + "This person needs to be online to do this.", + ) + if ( + int(route.get("target_peer_id", 0)) == peer_id + or int(route.get("requester_peer_id", 0)) == peer_id + ): + _host_friend_routes.erase(request_id) + for request_id: String in _pending_outgoing_friends.keys(): + var pending: Dictionary = _pending_outgoing_friends[request_id] + if str(pending.get("target_fingerprint", "")) == fingerprint: + _pending_outgoing_friends.erase(request_id) + friend_action_finished.emit( + false, "This person needs to be online to do this." + ) + for request_id: String in _pending_incoming_friends.keys(): + var pending: Dictionary = _pending_incoming_friends[request_id] + if str(pending.get("requester_fingerprint", "")) == fingerprint: + _pending_incoming_friends.erase(request_id) _changed() @@ -437,6 +677,9 @@ func _on_session_state_changed(state: NetworkSession.State) -> void: _remote_bans.clear() _ban_snapshot_requested = false _ban_snapshot_loaded = false + _pending_outgoing_friends.clear() + _pending_incoming_friends.clear() + _host_friend_routes.clear() elif state == NetworkSession.State.JOINED_CLIENT: _request_ban_snapshot() _changed() @@ -474,6 +717,245 @@ func _peer_for_fingerprint(fingerprint: String) -> int: return 0 +func _valid_friend_target(peer_id: int, fingerprint: String) -> bool: + if ( + not _session.is_gameplay_session_active() + or not _session.supports_server_capability( + NetworkProtocol.FRIENDS_CAPABILITY + ) + or not _session.peer_supports_capability( + peer_id, NetworkProtocol.FRIENDS_CAPABILITY + ) + ): + return false + var record: PeerRegistry.PeerRecord = _session.get_peer_record(peer_id) + return ( + record != null + and record.identity_authenticated + and record.identity_fingerprint == fingerprint + ) + + +func _route_friend_request( + requester_peer_id: int, + target_peer_id: int, + request_id: String, + public_capabilities: Dictionary, +) -> void: + if ( + not _session.is_host() + or not _valid_friend_request_id(request_id) + or not _valid_public_friend_capabilities(public_capabilities) + or not _session.is_authenticated_peer(requester_peer_id) + ): + return + var requester: PeerRegistry.PeerRecord = ( + _session.get_peer_record(requester_peer_id) + ) + var target: PeerRegistry.PeerRecord = _session.get_peer_record(target_peer_id) + var can_route := ( + requester != null + and target != null + and requester_peer_id != target_peer_id + and _valid_friend_target( + target_peer_id, target.identity_fingerprint + ) + and _session.peer_supports_capability( + requester_peer_id, NetworkProtocol.FRIENDS_CAPABILITY + ) + and not pair_is_blocked( + requester.identity_fingerprint, target.identity_fingerprint + ) + and _host_friend_routes.size() < ( + MAX_PENDING_FRIEND_REQUESTS * 8 + ) + ) + if not can_route: + _send_friend_result_to_peer( + requester_peer_id, + request_id, + false, + {}, + "This person needs to be online to do this.", + ) + return + var requester_pending_count := 0 + for route: Dictionary in _host_friend_routes.values(): + if int(route.get("requester_peer_id", 0)) == requester_peer_id: + requester_pending_count += 1 + if requester_pending_count >= MAX_PENDING_FRIEND_REQUESTS: + _send_friend_result_to_peer( + requester_peer_id, + request_id, + false, + {}, + "Too many friend requests are pending.", + ) + return + _host_friend_routes[request_id] = { + "requester_peer_id": requester_peer_id, + "target_peer_id": target_peer_id, + } + if target_peer_id == _session.get_local_peer_id(): + _receive_friend_request_local( + request_id, + requester.identity_fingerprint, + requester.display_name, + public_capabilities, + ) + else: + receive_friend_request.rpc_id( + target_peer_id, + request_id, + requester.identity_fingerprint, + requester.display_name, + public_capabilities, + ) + + +func _receive_friend_request_local( + request_id: String, + requester_fingerprint: String, + requester_display_name: String, + public_capabilities: Dictionary, +) -> void: + if ( + not _valid_friend_request_id(request_id) + or not _valid_public_friend_capabilities(public_capabilities) + or not NetworkIdentityCrypto.valid_fingerprint(requester_fingerprint) + or not NetworkProfilePreferences.is_valid_display_name( + requester_display_name + ) + or _pending_incoming_friends.size() + >= MAX_PENDING_FRIEND_REQUESTS + or _relationships.is_blocked(requester_fingerprint) + or _relationships.is_friend(requester_fingerprint) + ): + _decline_friend_request(request_id) + return + _pending_incoming_friends[request_id] = { + "requester_fingerprint": requester_fingerprint, + "requester_display_name": requester_display_name, + "remote_capabilities": public_capabilities.duplicate(true), + } + friend_request_received.emit( + request_id, requester_fingerprint, requester_display_name + ) + + +func _decline_friend_request(request_id: String) -> void: + if _session.is_host(): + _route_friend_response( + _session.get_local_peer_id(), request_id, false, {} + ) + elif _session.is_joined_client(): + respond_friendship.rpc_id(1, request_id, false, {}) + + +func _route_friend_response( + responder_peer_id: int, + request_id: String, + accepted: bool, + public_capabilities: Dictionary, +) -> void: + if not _session.is_host(): + return + var route: Dictionary = _host_friend_routes.get(request_id, {}) + if ( + route.is_empty() + or int(route.get("target_peer_id", 0)) != responder_peer_id + ): + return + _host_friend_routes.erase(request_id) + var response_accepted := ( + accepted and _valid_public_friend_capabilities(public_capabilities) + ) + _send_friend_result_to_peer( + int(route["requester_peer_id"]), + request_id, + response_accepted, + public_capabilities if response_accepted else {}, + "Friend request accepted." + if response_accepted + else "Friend request declined." + if not accepted + else "Friend request could not be completed.", + ) + + +func _send_friend_result_to_peer( + peer_id: int, + request_id: String, + accepted: bool, + public_capabilities: Dictionary, + message: String, +) -> void: + if peer_id == _session.get_local_peer_id(): + _receive_friend_result_local( + request_id, accepted, public_capabilities, message + ) + elif _session.is_authenticated_peer(peer_id): + receive_friend_result.rpc_id( + peer_id, + request_id, + accepted, + public_capabilities, + message.left(120), + ) + + +func _receive_friend_result_local( + request_id: String, + accepted: bool, + public_capabilities: Dictionary, + message: String, +) -> void: + var pending: Dictionary = _pending_outgoing_friends.get(request_id, {}) + if pending.is_empty(): + return + _pending_outgoing_friends.erase(request_id) + var success := false + if accepted and _valid_public_friend_capabilities(public_capabilities): + success = _relationships.add_friend( + str(pending["target_fingerprint"]), + str(pending["target_display_name"]), + pending["local_capabilities"], + public_capabilities, + ) + message = "Friend added." if success else "Friend could not be saved." + friend_action_finished.emit(success, message.left(120)) + + +func _public_friend_capabilities(capabilities: Dictionary) -> Dictionary: + return { + "presence_channel": str(capabilities.get("presence_channel", "")), + "invite_token": str(capabilities.get("invite_token", "")), + } + + +func _valid_public_friend_capabilities(capabilities: Dictionary) -> bool: + return ( + _valid_friend_hex(str(capabilities.get("presence_channel", ""))) + and _valid_friend_hex(str(capabilities.get("invite_token", ""))) + ) + + +func _valid_friend_request_id(request_id: String) -> bool: + return _valid_friend_hex(request_id, FRIEND_REQUEST_ID_LENGTH) + + +func _valid_friend_hex( + value: String, + expected_length: int = PlayerRelationshipStore.SOCIAL_TOKEN_LENGTH, +) -> bool: + if value.length() != expected_length: + return false + for character: String in value: + if character not in "0123456789abcdef": + return false + return true + + func _valid_moderation_target( peer_id: int, fingerprint: String, @@ -551,12 +1033,54 @@ func _ban_on_host( if local_host_request: moderation_finished.emit(false, "Ban could not be saved.") return false + if _surface_drawing != null: + _surface_drawing.clear_artwork_by_fingerprint(fingerprint) var ok: bool = _session.kick_authenticated_peer(peer_id, fingerprint, true) if local_host_request: moderation_finished.emit(ok, "Player banned." if ok else "Ban saved.") return true +func _clear_art_on_host( + peer_id: int, + fingerprint: String, + revision: int, + local_host_request: bool, +) -> bool: + if not _valid_moderation_target( + peer_id, + fingerprint, + revision, + local_host_request, + local_host_request, + ): + if local_host_request: + moderation_finished.emit( + false, "That player is no longer connected." + ) + return false + if _surface_drawing == null: + if local_host_request: + moderation_finished.emit( + false, "Player artwork could not be cleared." + ) + return false + var affected_layers: int = ( + _surface_drawing.clear_artwork_by_fingerprint(fingerprint) + ) + var ok: bool = affected_layers >= 0 + if local_host_request: + moderation_finished.emit( + ok, + "Player artwork cleared." + if affected_layers > 0 + else "No shared artwork from that player was found." + if ok + else "Player artwork could not be cleared.", + ) + return ok + + func _reset_session_artwork_on_host( emit_local_result: bool = true, ) -> bool: diff --git a/network/network_profile_preferences.gd b/network/network_profile_preferences.gd index 5ecb6fd..b6cac63 100644 --- a/network/network_profile_preferences.gd +++ b/network/network_profile_preferences.gd @@ -10,6 +10,7 @@ var display_name: String = "Player" var voice_id: String = VoiceProfilesType.DEFAULT_ID var speech_speed_id: String = VoiceProfilesType.DEFAULT_SPEED_ID var call_id: String = VoiceProfilesType.DEFAULT_CALL_ID +var sample_set_id: String = VoiceProfilesType.DEFAULT_SAMPLE_SET_ID var created_at_unix: int = 0 var _profile_path := "" var _expected_hash := "" @@ -20,6 +21,8 @@ var _future_version := false func configure_storage(path: String, data_root: PlayerDataRoot) -> void: _profile_path = path _data_root = data_root + _expected_hash = "" + _future_version = false func _temp_path() -> String: @@ -57,12 +60,19 @@ func load_or_create() -> bool: voice_id = VoiceProfilesType.DEFAULT_ID speech_speed_id = VoiceProfilesType.DEFAULT_SPEED_ID call_id = VoiceProfilesType.DEFAULT_CALL_ID + sample_set_id = VoiceProfilesType.DEFAULT_SAMPLE_SET_ID created_at_unix = int(Time.get_unix_time_from_system()) return _save_atomic() func set_display_name(value: String) -> bool: - return set_profile_identity(value, voice_id, speech_speed_id, call_id) + return set_profile_identity( + value, + voice_id, + speech_speed_id, + call_id, + sample_set_id, + ) func set_profile_identity( @@ -70,6 +80,7 @@ func set_profile_identity( selected_voice_id: String, selected_speech_speed_id: String, selected_call_id: String, + selected_sample_set_id: String = VoiceProfilesType.DEFAULT_SAMPLE_SET_ID, ) -> bool: var clean_name: String = value.strip_edges() if ( @@ -77,22 +88,26 @@ func set_profile_identity( or not VoiceProfilesType.is_valid(selected_voice_id) or not VoiceProfilesType.is_valid_speed(selected_speech_speed_id) or not VoiceProfilesType.is_valid_call(selected_call_id) + or not VoiceProfilesType.is_valid_sample_set(selected_sample_set_id) ): return false var previous_name: String = display_name var previous_voice_id: String = voice_id var previous_speech_speed_id: String = speech_speed_id var previous_call_id: String = call_id + var previous_sample_set_id: String = sample_set_id display_name = clean_name voice_id = selected_voice_id speech_speed_id = selected_speech_speed_id call_id = selected_call_id + sample_set_id = selected_sample_set_id if _save_atomic(): return true display_name = previous_name voice_id = previous_voice_id speech_speed_id = previous_speech_speed_id call_id = previous_call_id + sample_set_id = previous_sample_set_id return false @@ -150,6 +165,12 @@ func _load_existing() -> bool: call_id = VoiceProfilesType.sanitized_call_id( str(data.get("call_id", VoiceProfilesType.DEFAULT_CALL_ID)) ) + sample_set_id = VoiceProfilesType.sanitized_sample_set_id( + str(data.get( + "sample_set_id", + VoiceProfilesType.DEFAULT_SAMPLE_SET_ID, + )) + ) created_at_unix = int(data["created_at_unix"]) return true @@ -162,6 +183,7 @@ func _save_atomic() -> bool: "voice_id": voice_id, "speech_speed_id": speech_speed_id, "call_id": call_id, + "sample_set_id": sample_set_id, "created_at_unix": created_at_unix, } var result := PortableFileGuard.write_guarded( diff --git a/network/network_profile_service.gd b/network/network_profile_service.gd index 029af65..ff967f1 100644 --- a/network/network_profile_service.gd +++ b/network/network_profile_service.gd @@ -25,6 +25,7 @@ var _pending_apply: Dictionary[String, Dictionary] = {} var _pending_voice_ids: Dictionary[String, String] = {} var _pending_speech_speed_ids: Dictionary[String, String] = {} var _pending_call_ids: Dictionary[String, String] = {} +var _pending_sample_set_ids: Dictionary[String, String] = {} var _host_pending_apply: Dictionary[String, Dictionary] = {} var _latest_check_id: String = "" var _latest_check_name: String = "" @@ -50,6 +51,17 @@ func setup( _apply_local_voice_to_avatar() +func reload_persisted_profile() -> bool: + if ( + not _preferences.load_or_create() + or not _appearance_store.load_preferences() + ): + return false + _apply_to_avatar(1, _appearance_store.get_snapshot()) + _apply_local_voice_to_avatar() + return true + + func get_persisted_name() -> String: return _preferences.display_name @@ -70,6 +82,10 @@ func get_persisted_call_id() -> String: return _preferences.call_id +func get_persisted_sample_set_id() -> String: + return _preferences.sample_set_id + + func get_identity_fingerprint() -> String: return ( _session.get_local_identity_fingerprint() @@ -92,6 +108,10 @@ func preview_appearance(appearance: Dictionary) -> bool: _preferences.display_name, snapshot, ) + var authorization := _make_appearance_preview_authorization(snapshot) + var local_record := _session.get_peer_record(local_peer_id) + if local_record != null: + local_record.profile_authorization = authorization.duplicate(true) if _session.is_host(): _broadcast_appearance_preview_to_supported_peers( local_peer_id, @@ -100,20 +120,27 @@ func preview_appearance(appearance: Dictionary) -> bool: elif _session.supports_server_capability( NetworkProtocol.APPEARANCE_PREVIEW_CAPABILITY ): - var request: Dictionary = { - "request_id": _new_id(), - "session_id": _session.get_session_id(), - "appearance": snapshot.duplicate(true), - "sender_fingerprint": _session.get_local_identity_fingerprint(), - } - request["sender_signature"] = _session.sign_local_action( - "appearance_preview", - NetworkProfileProtocol.appearance_preview_signature_fields(request), - ) - submit_appearance_preview.rpc_id(1, request) + submit_appearance_preview.rpc_id(1, authorization) return true +func _make_appearance_preview_authorization( + appearance: Dictionary, +) -> Dictionary: + var request: Dictionary = { + "domain": "appearance_preview", + "request_id": _new_id(), + "session_id": _session.get_session_id(), + "appearance": appearance.duplicate(true), + "sender_fingerprint": _session.get_local_identity_fingerprint(), + } + request["sender_signature"] = _session.sign_local_action( + "appearance_preview", + NetworkProfileProtocol.appearance_preview_signature_fields(request), + ) + return request + + func restore_persisted_appearance() -> void: preview_appearance(_appearance_store.get_snapshot()) @@ -151,6 +178,7 @@ func apply_profile( voice_id: String = VoiceProfilesType.DEFAULT_ID, speech_speed_id: String = VoiceProfilesType.DEFAULT_SPEED_ID, call_id: String = VoiceProfilesType.DEFAULT_CALL_ID, + sample_set_id: String = VoiceProfilesType.DEFAULT_SAMPLE_SET_ID, ) -> bool: var clean_name := display_name.strip_edges() if ( @@ -159,6 +187,7 @@ func apply_profile( or not VoiceProfilesType.is_valid(voice_id) or not VoiceProfilesType.is_valid_speed(speech_speed_id) or not VoiceProfilesType.is_valid_call(call_id) + or not VoiceProfilesType.is_valid_sample_set(sample_set_id) ): apply_finished.emit(false, "Check the player name and appearance choices.") return false @@ -178,6 +207,7 @@ func apply_profile( _pending_voice_ids[request_id] = voice_id _pending_speech_speed_ids[request_id] = speech_speed_id _pending_call_ids[request_id] = call_id + _pending_sample_set_ids[request_id] = sample_set_id if _session == null or not _session.is_gameplay_session_active(): _apply_local_result(request_id, true, "", false, PackedStringArray()) elif _session.is_host(): @@ -266,6 +296,9 @@ func submit_appearance_preview(data: Dictionary) -> void: var appearance := CharacterCustomizationCatalog.sanitized_snapshot( data["appearance"] ) + var authorization := data.duplicate(true) + authorization["domain"] = "appearance_preview" + record.profile_authorization = authorization _session.apply_canonical_profile( sender_id, record.display_name, @@ -371,6 +404,7 @@ func _apply_local_result( _pending_voice_ids.erase(request_id) _pending_speech_speed_ids.erase(request_id) _pending_call_ids.erase(request_id) + _pending_sample_set_ids.erase(request_id) conflict_result.emit(request_id, conflict, suggestions) apply_finished.emit(false, message) return @@ -378,6 +412,7 @@ func _apply_local_result( var previous_voice_id := _preferences.voice_id var previous_speech_speed_id := _preferences.speech_speed_id var previous_call_id := _preferences.call_id + var previous_sample_set_id := _preferences.sample_set_id var requested_voice_id: String = _pending_voice_ids.get( request_id, VoiceProfilesType.DEFAULT_ID, @@ -390,16 +425,22 @@ func _apply_local_result( request_id, VoiceProfilesType.DEFAULT_CALL_ID, ) + var requested_sample_set_id: String = _pending_sample_set_ids.get( + request_id, + VoiceProfilesType.DEFAULT_SAMPLE_SET_ID, + ) if not _preferences.set_profile_identity( str(request["display_name"]), requested_voice_id, requested_speech_speed_id, requested_call_id, + requested_sample_set_id, ): _pending_apply.erase(request_id) _pending_voice_ids.erase(request_id) _pending_speech_speed_ids.erase(request_id) _pending_call_ids.erase(request_id) + _pending_sample_set_ids.erase(request_id) apply_finished.emit(false, "Profile could not be saved.") return if not _appearance_store.save_snapshot(request["appearance"]): @@ -408,17 +449,20 @@ func _apply_local_result( previous_voice_id, previous_speech_speed_id, previous_call_id, + previous_sample_set_id, ) _pending_apply.erase(request_id) _pending_voice_ids.erase(request_id) _pending_speech_speed_ids.erase(request_id) _pending_call_ids.erase(request_id) + _pending_sample_set_ids.erase(request_id) apply_finished.emit(false, "Profile could not be saved.") return _pending_apply.erase(request_id) _pending_voice_ids.erase(request_id) _pending_speech_speed_ids.erase(request_id) _pending_call_ids.erase(request_id) + _pending_sample_set_ids.erase(request_id) if _session != null: _session.set_local_appearance_snapshot(_appearance_store.get_snapshot()) if _session != null and _session.is_gameplay_session_active(): @@ -463,23 +507,16 @@ func broadcast_profile_snapshot( or not CharacterCustomizationCatalog.validate_snapshot(appearance) ): return - if not authorization.is_empty(): - var signed := authorization.duplicate(true) - signed["display_name"] = display_name - signed["appearance"] = appearance - var record := _session.get_peer_record(peer_id) - if ( - record == null - or record.identity_fingerprint - != str(signed.get("sender_fingerprint", "")) - or not _session.verify_peer_action( - peer_id, - "profile_update", - NetworkProfileProtocol.signature_fields(signed), - signed.get("sender_signature", PackedByteArray()), - ) - ): - return + if ( + not authorization.is_empty() + and not _session.verify_profile_authorization( + peer_id, + display_name, + appearance, + authorization, + ) + ): + return _session.apply_canonical_profile(peer_id, display_name, appearance) _apply_to_avatar(peer_id, appearance) profile_snapshot_changed.emit(peer_id, display_name, appearance.duplicate(true)) @@ -600,11 +637,21 @@ func _on_session_state_changed(state: NetworkSession.State) -> void: _pending_voice_ids.clear() _pending_speech_speed_ids.clear() _pending_call_ids.clear() + _pending_sample_set_ids.clear() _host_pending_apply.clear() _latest_check_id = "" _latest_check_name = "" _session.set_local_appearance_snapshot(_appearance_store.get_snapshot()) _apply_to_avatar(1, _appearance_store.get_snapshot()) + return + if state in [ + NetworkSession.State.PRIVATE_HOST, + NetworkSession.State.OPEN_HOST, + NetworkSession.State.JOINED_CLIENT, + ]: + var local_peer_id := _session.get_local_peer_id() + _apply_to_avatar(local_peer_id, _appearance_store.get_snapshot()) + _apply_local_voice_to_avatar() func _emit_conflict_result(data: Dictionary) -> void: @@ -676,6 +723,7 @@ func _apply_local_voice_to_avatar() -> void: var avatar := _spawn_service.get_avatar(local_peer_id) if avatar != null: avatar.apply_animalese_voice_id(_preferences.voice_id) + avatar.apply_animalese_sample_set_id(_preferences.sample_set_id) func _new_id() -> String: diff --git a/network/network_protocol.gd b/network/network_protocol.gd index c4496f3..49aca95 100644 --- a/network/network_protocol.gd +++ b/network/network_protocol.gd @@ -1,7 +1,9 @@ class_name NetworkProtocol extends RefCounted -const PROTOCOL_VERSION: int = 6 +const WorldLayoutType = preload("res://world/world_layout.gd") + +const PROTOCOL_VERSION: int = 12 const GAME_BUILD: String = "prealpha" const MAX_GAME_VERSION_LENGTH: int = 64 const MAX_DISPLAY_NAME_LENGTH: int = 24 @@ -11,22 +13,42 @@ const MAX_PUBLIC_KEY_LENGTH: int = 8192 const MAX_SIGNATURE_LENGTH: int = 2048 # ENet channels: 0 reliable lifecycle, 1 movement input, 2 movement # snapshots, 3 fishing input, 4 fishing snapshots, 5 reliable sales, -# 6 reliable shop transactions, 7 reliable item/equipment/showcase/drawing, -# 8 reliable ordered session chat, 9 reliable private session mail. +# 6 reliable shop transactions, 7 reliable item/equipment, +# 8 reliable ordered session chat, 9 reliable private session mail, +# 10 observer-only fishing summaries, 11 reliable movement animation state, +# 12 reliable fish showcase state, 13 reliable world-spawn events, +# 14 reliable artwork state, 15 world-spawn snapshots, 16 reliable fishing +# lifecycle, and 17 reliable portable-home state. Bulk world/art payloads must +# not head-of-line block held items, fishing, animation, or home transitions. const SALE_RELIABLE_CHANNEL: int = 5 const SHOP_RELIABLE_CHANNEL: int = 6 const ITEM_RELIABLE_CHANNEL: int = 7 const CHAT_RELIABLE_CHANNEL: int = 8 const MAIL_RELIABLE_CHANNEL: int = 9 -const ENET_CHANNEL_COUNT: int = 10 +const MOVEMENT_ANIMATION_CHANNEL: int = 11 +const SHOWCASE_RELIABLE_CHANNEL: int = 12 +const WORLD_SPAWN_RELIABLE_CHANNEL: int = 13 +const DRAWING_RELIABLE_CHANNEL: int = 14 +const FISHING_RELIABLE_CHANNEL: int = 16 +const HOME_RELIABLE_CHANNEL: int = 17 +const ENET_CHANNEL_COUNT: int = 18 const SURFACE_DRAWING_CAPABILITY: String = "surface_drawing_v2" const ART_SHOP_CAPABILITY: String = "art_shop_v1" -const WORLD_TIME_CAPABILITY: String = "world_time_v1" +const BACKPACK_SHOP_CAPABILITY: String = "backpack_shop_v1" +const WORLD_TIME_CAPABILITY: String = "world_time_v2" const WORLD_WEATHER_CAPABILITY: String = "world_weather_v1" const FISH_QUALITY_CAPABILITY: String = "fish_quality_v1" const JOBS_CAPABILITY: String = "jobs_v1" const WORLD_SPAWN_CAPABILITY: String = "world_spawn_envelope_v1" const APPEARANCE_PREVIEW_CAPABILITY: String = "appearance_preview_v1" +const WORLD_GENERATION_CAPABILITY: String = "world_generation_v1" +const WORLD_LAYOUT_CAPABILITY: String = "world_layout_v1" +const FRIENDS_CAPABILITY: String = "friends_v1" +const MOVEMENT_RECONCILIATION_CAPABILITY: String = "movement_reconciliation_v2" +const FISHING_REPLICATION_CAPABILITY: String = "fishing_replication_v2" +const HOME_CAPABILITY: String = "portable_home_v1" +const DEFAULT_WORLD_SEED: int = 13001 +const MAX_WORLD_SEED: int = 2147483646 enum RejectionCode { NONE, @@ -176,6 +198,13 @@ static func make_client_hello( JOBS_CAPABILITY, WORLD_SPAWN_CAPABILITY, APPEARANCE_PREVIEW_CAPABILITY, + BACKPACK_SHOP_CAPABILITY, + WORLD_GENERATION_CAPABILITY, + WORLD_LAYOUT_CAPABILITY, + FRIENDS_CAPABILITY, + MOVEMENT_RECONCILIATION_CAPABILITY, + FISHING_REPLICATION_CAPABILITY, + HOME_CAPABILITY, ]), "cosmetic_snapshot": cosmetic_snapshot, "identity_fingerprint": identity_fingerprint, @@ -278,7 +307,9 @@ static func make_server_hello( assigned_peer_id: int, player_count: int, max_players: int, - server_display_name: String = "NETfishing", + server_display_name: String = "straywild", + world_seed: int = DEFAULT_WORLD_SEED, + world_layout: StringName = WorldLayoutType.GENERATED, ) -> Dictionary: return { "accepted": accepted, @@ -290,12 +321,15 @@ static func make_server_hello( "server_display_name": server_display_name, "player_count": player_count, "max_players": max_players, + "world_seed": world_seed, + "world_layout": String(world_layout), "capability_flags": PackedStringArray([ "movement_v1", "fishing_v1", "sale_v1", "shop_v1", ART_SHOP_CAPABILITY, + BACKPACK_SHOP_CAPABILITY, "item_use_v1", "equipment_v1", "fish_showcase_v1", @@ -306,6 +340,12 @@ static func make_server_hello( JOBS_CAPABILITY, WORLD_SPAWN_CAPABILITY, APPEARANCE_PREVIEW_CAPABILITY, + WORLD_GENERATION_CAPABILITY, + WORLD_LAYOUT_CAPABILITY, + FRIENDS_CAPABILITY, + MOVEMENT_RECONCILIATION_CAPABILITY, + FISHING_REPLICATION_CAPABILITY, + HOME_CAPABILITY, "chat_v1", "mail_v1", "profile_v1", @@ -336,17 +376,17 @@ static func rejection_text(code: int) -> String: return "You are not permitted to join this server." RejectionCode.CLIENT_OUTDATED: return ( - "Your NETfishing version is out of date. " + "Your straywild version is out of date. " + "Update the game to join this server." ) RejectionCode.SERVER_OUTDATED: return ( "This server is out of date. " - + "The host needs to update NETfishing." + + "The host needs to update straywild." ) RejectionCode.VERSION_MISMATCH: return ( - "This game and server use different NETfishing versions. " + "This game and server use different straywild versions. " + "Update both to the latest release." ) _: diff --git a/network/network_sale_protocol.gd b/network/network_sale_protocol.gd index 3b80de6..190b718 100644 --- a/network/network_sale_protocol.gd +++ b/network/network_sale_protocol.gd @@ -6,6 +6,8 @@ const RELIABLE_CHANNEL: int = NetworkProtocol.SALE_RELIABLE_CHANNEL const MAX_ID_LENGTH: int = 96 const MAX_CATCH_ID_LENGTH: int = 160 const MAX_CATCHES_PER_REQUEST: int = 64 +const MAX_ITEM_STACKS_PER_REQUEST: int = 20 +const MAX_ITEM_QUANTITY: int = 999 const MAX_MESSAGE_LENGTH: int = 160 enum Rejection { @@ -40,6 +42,7 @@ static func validate_request(data: Variant) -> String: var session_id: String = payload["session_id"] var buyer_id: String = str(payload["buyer_id"]) var catches: Array = payload["catches"] + var items: Array = payload.get("items", []) if ( request_id.is_empty() or request_id.length() > MAX_ID_LENGTH @@ -47,8 +50,10 @@ static func validate_request(data: Variant) -> String: or session_id.length() > MAX_ID_LENGTH or buyer_id.is_empty() or buyer_id.length() > MAX_ID_LENGTH - or catches.is_empty() + or typeof(items) != TYPE_ARRAY + or (catches.is_empty() and items.is_empty()) or catches.size() > MAX_CATCHES_PER_REQUEST + or items.size() > MAX_ITEM_STACKS_PER_REQUEST ): return "Sale could not be completed." var seen: Dictionary[String, bool] = {} @@ -74,6 +79,23 @@ static func validate_request(data: Variant) -> String: ): return "Sale could not be completed." seen[catch_id] = true + var seen_items: Dictionary[String, bool] = {} + for value: Variant in items: + if typeof(value) != TYPE_DICTIONARY: + return "Sale could not be completed." + var item: Dictionary = value + var item_id := str(item.get("item_id", "")) + var quantity := int(item.get("quantity", 0)) + if ( + item_id.is_empty() + or item_id.length() > MAX_ID_LENGTH + or seen_items.has(item_id) + or typeof(item.get("quantity")) != TYPE_INT + or quantity < 1 + or quantity > MAX_ITEM_QUANTITY + ): + return "Sale could not be completed." + seen_items[item_id] = true return "" @@ -93,6 +115,8 @@ static func validate_result(data: Variant) -> bool: and typeof(payload.get("accepted")) == TYPE_BOOL and typeof(payload.get("catch_ids")) == TYPE_ARRAY and payload["catch_ids"].size() <= MAX_CATCHES_PER_REQUEST + and typeof(payload.get("items", [])) == TYPE_ARRAY + and payload.get("items", []).size() <= MAX_ITEM_STACKS_PER_REQUEST and typeof(payload.get("payout")) == TYPE_INT and int(payload["payout"]) >= 0 and typeof(payload.get("base_value")) == TYPE_INT @@ -119,4 +143,20 @@ static func validate_result(data: Variant) -> bool: ): return false seen[catch_id] = true + var seen_items: Dictionary[String, bool] = {} + for value: Variant in payload.get("items", []): + if typeof(value) != TYPE_DICTIONARY: + return false + var item := value as Dictionary + var item_id := str(item.get("item_id", "")) + if ( + item_id.is_empty() + or item_id.length() > MAX_ID_LENGTH + or seen_items.has(item_id) + or typeof(item.get("quantity")) != TYPE_INT + or int(item["quantity"]) < 1 + or int(item["quantity"]) > MAX_ITEM_QUANTITY + ): + return false + seen_items[item_id] = true return true diff --git a/network/network_sale_service.gd b/network/network_sale_service.gd index 11a499c..a80f221 100644 --- a/network/network_sale_service.gd +++ b/network/network_sale_service.gd @@ -8,8 +8,13 @@ const FishPoolType = preload("res://fish/fish_pool.gd") const FishBuyerProfileType = preload("res://economy/fish_buyer_profile.gd") const FishSaleServiceType = preload("res://economy/fish_sale_service.gd") const FishSaleResultType = preload("res://economy/fish_sale_result.gd") +const ItemDataType = preload("res://items/item_data.gd") +const ItemCatalogType = preload("res://items/item_catalog.gd") +const PlayerBagType = preload("res://inventory/player_bag.gd") +const ItemResalePolicyType = preload("res://economy/item_resale_policy.gd") const MAX_LEDGER_ENTRIES_PER_PEER: int = 64 +const LOCAL_REQUEST_RETRY_SECONDS: float = 2.0 const PELICAN_BUYER_ID: StringName = &"pelicans" const MAIN_SHOP_BUYER_ID: StringName = &"main_fishing_shop" @@ -27,6 +32,8 @@ var _spawn_service: PlayerSpawnService var _network_fishing: NetworkFishingService var _shop_interaction: FishingShopInteraction var _inventory: FishInventory +var _bag: PlayerBagType +var _item_catalog: ItemCatalogType var _wallet: PlayerWallet var _sale_service: FishSaleServiceType var _save_manager: PlayerSaveManager @@ -39,9 +46,32 @@ var _acknowledged_results: Dictionary[String, bool] = {} var _applied_results: Dictionary[String, bool] = {} var _received_results: Dictionary[String, bool] = {} var _pending_local_request_id: String = "" +var _pending_local_request: Dictionary = {} +var _local_request_retry_elapsed: float = 0.0 var _pending_local_catch_ids: Array[StringName] = [] +var _pending_local_items: Array[Dictionary] = [] var _pending_local_buyer_id: StringName var _reservations: PlayerAssetReservationService +var _inventory_layout: PlayerInventoryLayout + + +func _process(delta: float) -> void: + if ( + _pending_local_request.is_empty() + or _session == null + or not _session.is_joined_client() + ): + _local_request_retry_elapsed = 0.0 + return + _local_request_retry_elapsed += delta + if _local_request_retry_elapsed < LOCAL_REQUEST_RETRY_SECONDS: + return + _local_request_retry_elapsed = 0.0 + # The request ID is stable and the host ledger is idempotent, so an + # application-level retry cannot apply a sale twice. This covers the narrow + # transition where a generated client has authenticated but is only just + # resuming regular multiplayer polling. + submit_sale_request.rpc_id(1, _pending_local_request) func setup( @@ -50,18 +80,23 @@ func setup( network_fishing: NetworkFishingService, shop_interaction: FishingShopInteraction, inventory: FishInventory, + bag: PlayerBagType, + item_catalog: ItemCatalogType, wallet: PlayerWallet, sale_service: FishSaleServiceType, save_manager: PlayerSaveManager, fish_catalog: FishPoolType, buyers: Array[FishBuyerProfileType], reservations: PlayerAssetReservationService, + inventory_layout: PlayerInventoryLayout = null, ) -> void: _session = session _spawn_service = spawn_service _network_fishing = network_fishing _shop_interaction = shop_interaction _inventory = inventory + _bag = bag + _item_catalog = item_catalog _wallet = wallet _sale_service = sale_service _save_manager = save_manager @@ -71,12 +106,17 @@ func setup( if buyer != null and buyer.is_valid(): _buyers[buyer.id] = buyer _reservations = reservations + _inventory_layout = inventory_layout if not _session.peer_removed.is_connected(_on_peer_removed): _session.peer_removed.connect(_on_peer_removed) if not _session.state_changed.is_connected(_on_session_state_changed): _session.state_changed.connect(_on_session_state_changed) +func set_shop_interaction(interaction: FishingShopInteraction) -> void: + _shop_interaction = interaction + + func is_local_sale_pending() -> bool: return not _pending_local_request_id.is_empty() @@ -102,6 +142,15 @@ func can_request_sale( func request_local_sale( catch_ids: Array[StringName], buyer_id: StringName = PELICAN_BUYER_ID, +) -> String: + var no_items: Dictionary[StringName, int] = {} + return request_local_mixed_sale(catch_ids, no_items, buyer_id) + + +func request_local_mixed_sale( + catch_ids: Array[StringName], + item_quantities: Dictionary[StringName, int], + buyer_id: StringName = MAIN_SHOP_BUYER_ID, ) -> String: for catch_id: StringName in catch_ids: if _reservations != null and _reservations.is_fish_reserved(catch_id): @@ -123,7 +172,12 @@ func request_local_sale( 0 ) return "" - if catch_ids.is_empty() or _inventory == null: + if ( + (catch_ids.is_empty() and item_quantities.is_empty()) + or _inventory == null + or _bag == null + or _item_catalog == null + ): local_sale_finished.emit( "", false, "Sale could not be completed.", _empty_catch_ids(), 0 ) @@ -143,15 +197,43 @@ func request_local_sale( ) return "" evidence.append(fish_catch.to_network_dict()) + var item_evidence: Array[Dictionary] = [] + var item_ids: Array[StringName] = [] + item_ids.assign(item_quantities.keys()) + item_ids.sort_custom( + func(left: StringName, right: StringName) -> bool: + return str(left) < str(right) + ) + for item_id: StringName in item_ids: + var quantity := int(item_quantities.get(item_id, 0)) + var item: ItemDataType = _item_catalog.get_item_by_id(item_id) + if ( + quantity < 1 + or not ItemResalePolicyType.is_sellable(item) + or quantity > _bag.get_quantity(item_id) + or ( + _reservations != null + and quantity > _reservations.get_available_item_quantity(item_id) + ) + ): + local_sale_finished.emit( + "", false, "That item is no longer available.", _empty_catch_ids(), 0 + ) + return "" + item_evidence.append({"item_id": str(item_id), "quantity": quantity}) var request_id: String = _new_id("sale") var request: Dictionary = { "request_id": request_id, "session_id": _session.get_session_id(), "buyer_id": str(buyer.id), "catches": evidence, + "items": item_evidence, } _pending_local_request_id = request_id + _pending_local_request = request.duplicate(true) + _local_request_retry_elapsed = 0.0 _pending_local_catch_ids = catch_ids.duplicate() + _pending_local_items = item_evidence.duplicate(true) _pending_local_buyer_id = buyer.id local_sale_pending.emit(request_id) if _session.is_host(): @@ -219,7 +301,11 @@ func _handle_sale_request(peer_id: int, data: Dictionary) -> void: )) return var result: Dictionary = _build_authoritative_result( - peer_id, request_id, data["catches"], buyer + peer_id, + request_id, + data["catches"], + data.get("items", []), + buyer, ) _pending_by_peer[peer_id] = request_id _record_and_send(peer_id, result) @@ -229,9 +315,14 @@ func _build_authoritative_result( peer_id: int, request_id: String, evidence_values: Array, + item_values: Array, buyer: FishBuyerProfileType, ) -> Dictionary: - if _fish_catalog == null or buyer == null: + if ( + buyer == null + or (not evidence_values.is_empty() and _fish_catalog == null) + or (not item_values.is_empty() and _item_catalog == null) + ): return _rejected_result( request_id, "The buyer is unavailable." ) @@ -283,6 +374,27 @@ func _build_authoritative_result( base_value += decoded.sale_value payout += offer catch_ids.append(str(decoded.catch_id)) + var items: Array[Dictionary] = [] + if not item_values.is_empty() and buyer.id != MAIN_SHOP_BUYER_ID: + return _rejected_result(request_id, "This buyer only accepts catches.") + for value: Variant in item_values: + var evidence := value as Dictionary + var item_id := StringName(str(evidence.get("item_id", ""))) + var quantity := int(evidence.get("quantity", 0)) + var item: ItemDataType = _item_catalog.get_item_by_id(item_id) + var unit_value := ItemResalePolicyType.get_unit_value(item) + if quantity < 1 or unit_value < 0: + return _rejected_result(request_id, "That item cannot be sold.") + var item_value := unit_value * quantity + if ( + item_value < 0 + or base_value > 9223372036854775807 - item_value + or payout > 9223372036854775807 - item_value + ): + return _rejected_result(request_id, "Sale could not be completed.") + base_value += item_value + payout += item_value + items.append({"item_id": str(item_id), "quantity": quantity}) return { "result_id": _new_id("sale_result"), "request_id": request_id, @@ -291,6 +403,7 @@ func _build_authoritative_result( "buyer_id": str(buyer.id), "accepted": true, "catch_ids": catch_ids, + "items": items, "payout": payout, "base_value": base_value, "message": "Sale complete.", @@ -313,6 +426,7 @@ func _rejected_result(request_id: String, message: String) -> Dictionary: "target_peer_id": 0, "accepted": false, "catch_ids": [], + "items": [], "payout": 0, "base_value": 0, "message": message.left(NetworkSaleProtocol.MAX_MESSAGE_LENGTH), @@ -388,6 +502,12 @@ func _apply_sale_result(data: Dictionary) -> void: if catch_ids != _pending_local_catch_ids: _fail_local_apply(data, "Sale could not be completed.") return + var items: Array[Dictionary] = [] + for value: Variant in data.get("items", []): + items.append((value as Dictionary).duplicate(true)) + if items != _pending_local_items: + _fail_local_apply(data, "Sale could not be completed.") + return for catch_id: StringName in catch_ids: if _reservations != null and _reservations.is_fish_reserved(catch_id): _fail_local_apply(data, "Reserved in a letter.") @@ -396,10 +516,12 @@ func _apply_sale_result(data: Dictionary) -> void: if buyer == null or not buyer.is_valid(): _fail_local_apply(data, "The buyer is unavailable.") return - var preview: FishSaleResultType = _sale_service.preview_batch( - catch_ids, buyer - ) - if not preview.is_success(): + var catch_payout: int = 0 + var catch_base_value: int = 0 + var preview: FishSaleResultType + if not catch_ids.is_empty(): + preview = _sale_service.preview_batch(catch_ids, buyer) + if preview != null and not preview.is_success(): var message: String = ( "Favorite catches cannot be sold." if preview.status == FishSaleResultType.Status.FAVORITED @@ -407,22 +529,63 @@ func _apply_sale_result(data: Dictionary) -> void: ) _fail_local_apply(data, message) return + if preview != null: + catch_payout = preview.payout + catch_base_value = preview.base_value + var item_payout: int = 0 + for record: Dictionary in items: + var item_id := StringName(str(record.get("item_id", ""))) + var quantity := int(record.get("quantity", 0)) + var item: ItemDataType = _item_catalog.get_item_by_id(item_id) + var unit_value := ItemResalePolicyType.get_unit_value(item) + if ( + quantity < 1 + or unit_value < 0 + or quantity > _bag.get_quantity(item_id) + or ( + _reservations != null + and quantity > _reservations.get_available_item_quantity(item_id) + ) + ): + _fail_local_apply(data, "That item is no longer available.") + return + item_payout += unit_value * quantity if ( - preview.payout != int(data["payout"]) - or preview.base_value != int(data["base_value"]) + catch_payout + item_payout != int(data["payout"]) + or catch_base_value + item_payout != int(data["base_value"]) ): _fail_local_apply(data, "Sale could not be completed.") return var inventory_snapshot: Array[FishCatch] = _inventory.get_all_catches() var sequence_snapshot: int = _inventory.get_next_catch_sequence() - var wallet_snapshot: int = _wallet.get_balance() - var local_result: FishSaleResultType = _sale_service.sell_batch( - catch_ids, buyer + var bag_snapshot := _bag.get_all_items() + var layout_snapshot: Dictionary = ( + _inventory_layout.to_save_data() + if _inventory_layout != null else {} ) - if not local_result.is_success() or not _save_manager.save_if_dirty(): + var wallet_snapshot: int = _wallet.get_balance() + var applied: bool = true + if not catch_ids.is_empty(): + applied = ( + _inventory.remove_catches_by_ids(catch_ids).size() + == catch_ids.size() + ) + if applied: + for record: Dictionary in items: + if not _bag.remove_item( + StringName(str(record["item_id"])), int(record["quantity"]) + ): + applied = false + break + if applied: + applied = _wallet.credit(int(data["payout"])) + if not applied or not _save_manager.save_if_dirty(): _inventory.replace_all_catches( inventory_snapshot, sequence_snapshot ) + _bag.replace_all_items(bag_snapshot) + if _inventory_layout != null: + _inventory_layout.restore_from_save_data(layout_snapshot) _wallet.restore_balance(wallet_snapshot) _save_manager.save_if_dirty() _fail_local_apply(data, "Sale could not be completed.") @@ -456,7 +619,10 @@ func _finish_local_sale( payout: int, ) -> void: _pending_local_request_id = "" + _pending_local_request.clear() + _local_request_retry_elapsed = 0.0 _pending_local_catch_ids.clear() + _pending_local_items.clear() _pending_local_buyer_id = StringName() local_sale_finished.emit( request_id, accepted, message, catch_ids, payout @@ -590,7 +756,10 @@ func _clear_session_state() -> void: _applied_results.clear() _received_results.clear() _pending_local_request_id = "" + _pending_local_request.clear() + _local_request_retry_elapsed = 0.0 _pending_local_catch_ids.clear() + _pending_local_items.clear() _pending_local_buyer_id = StringName() diff --git a/network/network_session.gd b/network/network_session.gd index 8d7205a..66d5101 100644 --- a/network/network_session.gd +++ b/network/network_session.gd @@ -7,12 +7,51 @@ const DEFAULT_SESSION_MAX_PLAYERS: int = 8 const DEFAULT_TRANSPORT_MAX_CLIENTS: int = 31 const CONNECTION_TIMEOUT_SECONDS: float = 10.0 const AUTHENTICATION_TIMEOUT_SECONDS: float = 60.0 +const ENET_TIMEOUT_LIMIT: int = 32 +const ENET_TIMEOUT_MINIMUM_MS: int = 10000 +const ENET_TIMEOUT_MAXIMUM_MS: int = 120000 const INPUT_INTERVAL: float = 1.0 / 30.0 +const IDLE_INPUT_INTERVAL: float = 1.0 / 5.0 const SNAPSHOT_INTERVAL: float = 1.0 / 30.0 +const OWNER_SNAPSHOT_DIVISOR: int = 3 +const NEAR_REMOTE_SNAPSHOT_DIVISOR: int = 2 +const FAR_REMOTE_SNAPSHOT_DIVISOR: int = 6 +const DISTANT_REMOTE_SNAPSHOT_DIVISOR: int = 8 +const NEAR_REMOTE_DISTANCE: float = 48.0 +const FAR_REMOTE_DISTANCE: float = 96.0 const MOVEMENT_SNAPSHOT_BATCH_SIZE: int = 8 -const MOVEMENT_SNAPSHOT_FIELD_COUNT: int = 12 +const MOVEMENT_INPUT_FIELD_COUNT: int = 8 +const MOVEMENT_SNAPSHOT_FIELD_COUNT: int = 6 +const MOVEMENT_ANIMATION_FIELD_COUNT: int = 7 +const MOVEMENT_ANIMATION_ACTION_FIELD_COUNT: int = 5 +const MAX_PENDING_MOVEMENT_INPUTS: int = 96 +const ANIMATION_REFRESH_INTERVAL: float = 1.0 const MAX_MOVEMENT_INPUT_SEQUENCE: int = 2147483647 const MAX_MOVEMENT_ONE_WAY_TRANSIT_SECONDS: float = 0.25 +const SPACE_TRANSITION_SNAPSHOT_GUARD_DISTANCE: float = 12.0 + +const MOVEMENT_FLAG_JUMP: int = 1 << 0 +const MOVEMENT_FLAG_SPRINT: int = 1 << 1 +const MOVEMENT_FLAG_SNEAK: int = 1 << 2 +const MOVEMENT_FLAG_SLOW_WALK: int = 1 << 3 +const MOVEMENT_FLAG_SITTING: int = 1 << 4 +const MOVEMENT_FLAG_CASTING: int = 1 << 5 +const MOVEMENT_ALLOWED_FLAGS: int = ( + MOVEMENT_FLAG_JUMP + | MOVEMENT_FLAG_SPRINT + | MOVEMENT_FLAG_SNEAK + | MOVEMENT_FLAG_SLOW_WALK + | MOVEMENT_FLAG_SITTING + | MOVEMENT_FLAG_CASTING +) +const SNAPSHOT_FLAG_GROUNDED: int = 1 << 0 +const SNAPSHOT_FLAG_SITTING: int = 1 << 1 +const SNAPSHOT_FLAG_CASTING: int = 1 << 2 +const SNAPSHOT_ALLOWED_FLAGS: int = ( + SNAPSHOT_FLAG_GROUNDED + | SNAPSHOT_FLAG_SITTING + | SNAPSHOT_FLAG_CASTING +) signal state_changed(state: State) signal status_message_changed(message: String) @@ -80,12 +119,33 @@ var _client_nonce: String = "" var _current_route: ConnectionRoute var _input_sequence: int = 0 var _input_accumulator: float = 0.0 +var _idle_input_accumulator: float = 0.0 +var _last_input_state_hash: int = 0 +var _pending_movement_inputs: Array[Dictionary] = [] var _snapshot_accumulator: float = 0.0 +var _movement_snapshot_tick: int = 0 +var _last_local_snapshot_received_msec: int = 0 +var _local_space_transition_guard_active: bool = false +var _local_space_transition_guard_position: Vector3 = Vector3.ZERO +var _local_space_transition_minimum_ack: int = 0 +var _animation_refresh_accumulator: float = 0.0 +var _last_animation_state_by_peer: Dictionary[int, Dictionary] = {} +var _pending_animation_state_by_peer: Dictionary[int, Dictionary] = {} +var _last_local_animation_action_signature: Array = [] +var _movement_inputs_sent: int = 0 +var _movement_inputs_received: int = 0 +var _movement_snapshot_packets_sent: int = 0 +var _movement_snapshot_states_sent: int = 0 +var _movement_animation_packets_sent: int = 0 +var _movement_animation_states_sent: int = 0 var _last_server_max_players: int = DEFAULT_SESSION_MAX_PLAYERS var _last_server_player_count: int = 0 var _last_server_display_name: String = "" var _last_server_protocol_version: int = 0 +var _last_server_world_seed: int = NetworkProtocol.DEFAULT_WORLD_SEED +var _last_server_world_layout: StringName = WorldLayout.GENERATED var _server_capabilities: PackedStringArray = PackedStringArray() +var _peer_space_ids: Dictionary[int, StringName] = {} var _profile_ready: bool = false var _player_identity: PlayerIdentityStore var _host_identity: HostIdentityStore @@ -105,12 +165,14 @@ var _local_appearance_snapshot: Dictionary = ( ) var _moderation_disconnect_message := "" var _host_port: int = 0 -var _session_display_name: String = "NETfishing Room" +var _session_display_name: String = "straywild Room" var _dedicated_host: bool = false var _configured_operator_fingerprints: Dictionary[String, bool] = {} var _session_operator_fingerprints: Dictionary[String, bool] = {} var _operator_peer_ids: Dictionary[int, bool] = {} var _local_operator: bool = false +var _host_world_seed: int = NetworkProtocol.DEFAULT_WORLD_SEED +var _host_world_layout: StringName = WorldLayout.GENERATED func _ready() -> void: @@ -271,6 +333,13 @@ func _register_player_host() -> void: NetworkProtocol.WORLD_WEATHER_CAPABILITY, NetworkProtocol.JOBS_CAPABILITY, NetworkProtocol.WORLD_SPAWN_CAPABILITY, + NetworkProtocol.BACKPACK_SHOP_CAPABILITY, + NetworkProtocol.WORLD_GENERATION_CAPABILITY, + NetworkProtocol.WORLD_LAYOUT_CAPABILITY, + NetworkProtocol.FRIENDS_CAPABILITY, + NetworkProtocol.MOVEMENT_RECONCILIATION_CAPABILITY, + NetworkProtocol.FISHING_REPLICATION_CAPABILITY, + NetworkProtocol.HOME_CAPABILITY, ]), ) _registry.update_appearance(1, _local_appearance_snapshot) @@ -369,7 +438,7 @@ func set_peer_operator( func set_session_display_name(value: String) -> void: var cleaned: String = value.strip_edges().left(48) if cleaned.is_empty(): - cleaned = "NETfishing Room" + cleaned = "straywild Room" if cleaned == _session_display_name: return _session_display_name = cleaned @@ -526,9 +595,40 @@ func get_last_server_metadata() -> Dictionary: "protocol_version": _last_server_protocol_version, "player_count": _last_server_player_count, "max_players": _last_server_max_players, + "world_seed": _last_server_world_seed, + "world_layout": String(_last_server_world_layout), } +func set_host_world_seed(seed: int) -> bool: + return set_host_world(WorldLayout.GENERATED, seed) + + +func set_host_world(world_layout: StringName, seed: int) -> bool: + if ( + state != State.INACTIVE + or not WorldLayout.is_valid(world_layout) + or seed <= 0 + or seed > NetworkProtocol.MAX_WORLD_SEED + ): + return false + _host_world_layout = world_layout + _host_world_seed = seed + return true + + +func get_authoritative_world_layout() -> StringName: + return ( + _last_server_world_layout + if is_joined_client() + else _host_world_layout + ) + + +func get_authoritative_world_seed() -> int: + return _last_server_world_seed if is_joined_client() else _host_world_seed + + func can_use_host_gameplay() -> bool: return is_host() @@ -554,6 +654,7 @@ func supports_server_capability(capability: StringName) -> bool: return str(capability) in PackedStringArray([ "movement_v1", "fishing_v1", "sale_v1", "shop_v1", NetworkProtocol.ART_SHOP_CAPABILITY, + NetworkProtocol.BACKPACK_SHOP_CAPABILITY, "item_use_v1", "equipment_v1", "fish_showcase_v1", NetworkProtocol.FISH_QUALITY_CAPABILITY, NetworkProtocol.SURFACE_DRAWING_CAPABILITY, @@ -561,6 +662,12 @@ func supports_server_capability(capability: StringName) -> bool: NetworkProtocol.WORLD_WEATHER_CAPABILITY, NetworkProtocol.WORLD_SPAWN_CAPABILITY, NetworkProtocol.APPEARANCE_PREVIEW_CAPABILITY, + NetworkProtocol.WORLD_GENERATION_CAPABILITY, + NetworkProtocol.WORLD_LAYOUT_CAPABILITY, + NetworkProtocol.FRIENDS_CAPABILITY, + NetworkProtocol.MOVEMENT_RECONCILIATION_CAPABILITY, + NetworkProtocol.FISHING_REPLICATION_CAPABILITY, + NetworkProtocol.HOME_CAPABILITY, "chat_v1", "mail_v1", "profile_v1", @@ -585,6 +692,55 @@ func get_authenticated_peer_ids() -> Array[int]: return _registry.get_peer_ids() +func set_peer_space(peer_id: int, space_id: StringName) -> bool: + if not _registry.has_peer(peer_id) or space_id.is_empty(): + return false + _peer_space_ids[peer_id] = space_id + return true + + +func get_peer_space(peer_id: int) -> StringName: + return _peer_space_ids.get(peer_id, &"world") + + +func peers_share_space(first_peer_id: int, second_peer_id: int) -> bool: + return get_peer_space(first_peer_id) == get_peer_space(second_peer_id) + + +func apply_authoritative_space_transition( + peer_id: int, + target_transform: Transform3D, + acknowledged_input: int, +) -> bool: + if not target_transform.origin.is_finite(): + return false + var local_peer_id: int = get_local_peer_id() + var local_transition: bool = peer_id == local_peer_id + var avatar: Player = _spawn_service.get_avatar(peer_id) + # Remote home transitions can arrive before their player-spawn message. Keep + # the new space assignment so the later spawn inherits correct visibility; + # only a missing local avatar is a transition failure. + if avatar == null: + return not local_transition + avatar.apply_network_space_transition(target_transform, local_transition) + if ( + local_transition + and state == State.JOINED_CLIENT + ): + # Movement snapshots use another ENet channel and a pre-transition audit + # can therefore arrive after the reliable home transition. Clear local + # prediction and reject those old-world snapshots until the host publishes + # its first audit from the new space. + _pending_movement_inputs.clear() + _last_local_snapshot_received_msec = 0 + _last_input_state_hash = 0 + _idle_input_accumulator = IDLE_INPUT_INTERVAL + _local_space_transition_guard_active = true + _local_space_transition_guard_position = target_transform.origin + _local_space_transition_minimum_ack = maxi(acknowledged_input, 0) + return true + + func get_peer_rtt_ms(peer_id: int) -> int: if peer_id == 1: return 0 @@ -608,6 +764,18 @@ func get_peer_rtt_ms(peer_id: int) -> int: return int(packet_peer.get_statistic(ENetPacketPeer.PEER_ROUND_TRIP_TIME)) +func get_movement_metrics() -> Dictionary: + return { + "inputs_sent": _movement_inputs_sent, + "inputs_received": _movement_inputs_received, + "snapshot_packets_sent": _movement_snapshot_packets_sent, + "snapshot_states_sent": _movement_snapshot_states_sent, + "animation_packets_sent": _movement_animation_packets_sent, + "animation_states_sent": _movement_animation_states_sent, + "pending_local_inputs": _pending_movement_inputs.size(), + } + + func kick_authenticated_peer( peer_id: int, fingerprint: String, @@ -772,6 +940,10 @@ func get_local_peer_id() -> int: return multiplayer.get_unique_id() if is_gameplay_session_active() else 0 +func get_latest_movement_input_sequence() -> int: + return _input_sequence if state == State.JOINED_CLIENT else 0 + + func _process(delta: float) -> void: var now: float = Time.get_ticks_msec() / 1000.0 if ( @@ -792,9 +964,13 @@ func _process(delta: float) -> void: return _input_accumulator += delta _snapshot_accumulator += delta + _animation_refresh_accumulator += delta if state == State.JOINED_CLIENT and _input_accumulator >= INPUT_INTERVAL: + var elapsed_input_time: float = _input_accumulator _input_accumulator = fmod(_input_accumulator, INPUT_INTERVAL) - _send_local_input() + _idle_input_accumulator += elapsed_input_time + _maybe_send_local_animation_action() + _maybe_send_local_input() if is_host() and _snapshot_accumulator >= SNAPSHOT_INTERVAL: _snapshot_accumulator = fmod(_snapshot_accumulator, SNAPSHOT_INTERVAL) _broadcast_movement_snapshots() @@ -832,6 +1008,7 @@ func _on_peer_connected(peer_id: int) -> void: if state != State.OPEN_HOST: multiplayer.multiplayer_peer.disconnect_peer(peer_id) return + _configure_enet_peer_timeout(peer_id) _pending_authentication[peer_id] = ( Time.get_ticks_msec() / 1000.0 + AUTHENTICATION_TIMEOUT_SECONDS ) @@ -840,6 +1017,7 @@ func _on_peer_connected(peer_id: int) -> void: func _on_connected_to_server() -> void: if state != State.CONNECTING: return + _configure_enet_peer_timeout(1) _set_state(State.AUTHENTICATING, "Authenticating...") _client_nonce = NetworkIdentityCrypto.secure_id(32) _client_identity_attempt = NetworkProtocol.make_identity_hello( @@ -851,6 +1029,24 @@ func _on_connected_to_server() -> void: submit_identity_hello.rpc_id(1, _client_identity_attempt) +func _configure_enet_peer_timeout(peer_id: int) -> void: + var enet := multiplayer.multiplayer_peer as ENetMultiplayerPeer + if enet == null: + return + var packet_peer: ENetPacketPeer = enet.get_peer(peer_id) + if packet_peer == null: + return + # A deterministic generated world can temporarily occupy the client's main + # thread during the authenticated join transition. Keep that bounded load + # from looking like a dead connection while retaining normal ENet liveness + # checks once the client resumes polling. + packet_peer.set_timeout( + ENET_TIMEOUT_LIMIT, + ENET_TIMEOUT_MINIMUM_MS, + ENET_TIMEOUT_MAXIMUM_MS, + ) + + func _on_connection_failed() -> void: if state not in [ State.CONNECTING, @@ -890,6 +1086,9 @@ func _on_peer_disconnected(peer_id: int) -> void: _pending_identity_challenges.erase(peer_id) _authenticated_identity_cache.erase(peer_id) _operator_peer_ids.erase(peer_id) + _peer_space_ids.erase(peer_id) + _last_animation_state_by_peer.erase(peer_id) + _pending_animation_state_by_peer.erase(peer_id) var recovery_attempt: String = _recovery_attempts.get(peer_id, "") if not recovery_attempt.is_empty(): _recovery_attempts.erase(peer_id) @@ -1045,7 +1244,7 @@ func resolve_server_trust(accepted: bool) -> void: if not _server_trust.trust( get_current_endpoint(), str(_pending_server_proof["server_fingerprint"]), - "NETfishing", + "straywild", ): _fail_identity("The server identity could not be pinned.") return @@ -1162,6 +1361,32 @@ func submit_client_hello(data: Dictionary) -> void: NetworkProtocol.RejectionCode.UNSUPPORTED_CLIENT, ) return + if NetworkProtocol.WORLD_GENERATION_CAPABILITY not in client_capabilities: + _reject_peer( + sender_id, + NetworkProtocol.RejectionCode.UNSUPPORTED_CLIENT, + ) + return + for required_capability: String in [ + NetworkProtocol.MOVEMENT_RECONCILIATION_CAPABILITY, + NetworkProtocol.FISHING_REPLICATION_CAPABILITY, + NetworkProtocol.HOME_CAPABILITY, + ]: + if required_capability not in client_capabilities: + _reject_peer( + sender_id, + NetworkProtocol.RejectionCode.UNSUPPORTED_CLIENT, + ) + return + if ( + _host_world_layout == WorldLayout.STARTER_ISLAND + and NetworkProtocol.WORLD_LAYOUT_CAPABILITY not in client_capabilities + ): + _reject_peer( + sender_id, + NetworkProtocol.RejectionCode.UNSUPPORTED_CLIENT, + ) + return var identity: Dictionary = _authenticated_identity_cache.get(sender_id, {}) if identity.is_empty(): _reject_peer(sender_id, NetworkProtocol.RejectionCode.INVALID_IDENTITY_PROOF) @@ -1249,6 +1474,8 @@ func submit_client_hello(data: Dictionary) -> void: _registry.size(), session_max_players, _session_display_name, + _host_world_seed, + _host_world_layout, ) ) receive_spawn_list.rpc_id(sender_id, _build_spawn_list()) @@ -1302,6 +1529,10 @@ func receive_server_hello(data: Dictionary) -> void: or typeof(data.get("protocol_version")) != TYPE_INT or typeof(data.get("game_version")) != TYPE_STRING or typeof(data.get("rejection_code")) != TYPE_INT + or typeof(data.get("world_seed")) != TYPE_INT + or typeof( + data.get("world_layout", String(WorldLayout.GENERATED)) + ) not in [TYPE_STRING, TYPE_STRING_NAME] ): _teardown_peer() _fail("The server sent an invalid handshake response.") @@ -1327,6 +1558,19 @@ func receive_server_hello(data: Dictionary) -> void: _teardown_peer() _fail("The server uses a different network protocol.") return + var received_world_seed := int(data["world_seed"]) + if received_world_seed <= 0 or received_world_seed > NetworkProtocol.MAX_WORLD_SEED: + _teardown_peer() + _fail("The server sent an invalid world seed.") + return + var received_world_layout := WorldLayout.normalized( + data.get("world_layout", String(WorldLayout.GENERATED)), + &"", + ) + if received_world_layout.is_empty(): + _teardown_peer() + _fail("The server sent an invalid world layout.") + return _session_id = str(data.get("session_id", "")) _last_server_max_players = int(data.get( "max_players", @@ -1337,6 +1581,8 @@ func receive_server_hello(data: Dictionary) -> void: _last_server_protocol_version = int(data.get( "protocol_version", NetworkProtocol.PROTOCOL_VERSION )) + _last_server_world_seed = received_world_seed + _last_server_world_layout = received_world_layout _server_capabilities = PackedStringArray() var advertised_capabilities: Variant = data.get( "capability_flags", PackedStringArray() @@ -1351,6 +1597,26 @@ func receive_server_hello(data: Dictionary) -> void: _teardown_peer() _fail("This server does not support fish quality data.") return + if NetworkProtocol.WORLD_GENERATION_CAPABILITY not in _server_capabilities: + _teardown_peer() + _fail("This server does not support generated worlds.") + return + for required_capability: String in [ + NetworkProtocol.MOVEMENT_RECONCILIATION_CAPABILITY, + NetworkProtocol.FISHING_REPLICATION_CAPABILITY, + NetworkProtocol.HOME_CAPABILITY, + ]: + if required_capability not in _server_capabilities: + _teardown_peer() + _fail("This server is missing required network capabilities.") + return + if ( + received_world_layout == WorldLayout.STARTER_ISLAND + and NetworkProtocol.WORLD_LAYOUT_CAPABILITY not in _server_capabilities + ): + _teardown_peer() + _fail("This server does not support selectable world layouts.") + return var local_peer_id: int = multiplayer.get_unique_id() _registry.clear() _registry.add_peer( @@ -1365,6 +1631,13 @@ func receive_server_hello(data: Dictionary) -> void: NetworkProtocol.SURFACE_DRAWING_CAPABILITY, NetworkProtocol.WORLD_TIME_CAPABILITY, NetworkProtocol.WORLD_WEATHER_CAPABILITY, + NetworkProtocol.BACKPACK_SHOP_CAPABILITY, + NetworkProtocol.WORLD_GENERATION_CAPABILITY, + NetworkProtocol.WORLD_LAYOUT_CAPABILITY, + NetworkProtocol.FRIENDS_CAPABILITY, + NetworkProtocol.MOVEMENT_RECONCILIATION_CAPABILITY, + NetworkProtocol.FISHING_REPLICATION_CAPABILITY, + NetworkProtocol.HOME_CAPABILITY, ]), ) _registry.update_appearance(local_peer_id, _local_appearance_snapshot) @@ -1410,6 +1683,9 @@ func receive_peer_despawn(peer_id: int) -> void: if state != State.JOINED_CLIENT: return _operator_peer_ids.erase(peer_id) + _peer_space_ids.erase(peer_id) + _last_animation_state_by_peer.erase(peer_id) + _pending_animation_state_by_peer.erase(peer_id) _registry.remove_peer(peer_id) _spawn_service.remove_peer(peer_id) peer_removed.emit(peer_id) @@ -1451,6 +1727,10 @@ func _apply_spawn_entry(entry: Dictionary) -> void: or typeof(entry.get("display_name")) != TYPE_STRING or typeof(entry.get("position")) != TYPE_ARRAY or typeof(entry.get("yaw")) not in [TYPE_FLOAT, TYPE_INT] + or typeof(entry.get("sitting")) != TYPE_BOOL + or not NetworkPlayerAnimationProtocol.validate_state( + entry.get("animation_state") + ) ): return if not _verify_spawn_identity(entry): @@ -1466,10 +1746,12 @@ func _apply_spawn_entry(entry: Dictionary) -> void: ) own_snapshot["position"] = own_position own_snapshot["visual_yaw"] = float(entry["yaw"]) + own_snapshot["sitting"] = bool(entry["sitting"]) own_avatar.apply_network_teleport(own_snapshot) return + var peer_was_added: bool = false if not _registry.has_peer(peer_id): - _registry.add_peer( + if not _registry.add_peer( peer_id, entry["profile_id"], entry["display_name"], @@ -1477,8 +1759,14 @@ func _apply_spawn_entry(entry: Dictionary) -> void: str(entry.get("identity_fingerprint", "")), str(entry.get("identity_public_key", "")), _sanitized_capabilities(entry.get("capability_flags", [])), - ) + ): + return + peer_was_added = true var added_record := _registry.get_peer(peer_id) + if added_record != null: + added_record.profile_authorization = Dictionary( + entry.get("profile_authorization", {}) + ).duplicate(true) if added_record != null and added_record.identity_authenticated: _archive_authenticated_identity(added_record) var status := _known_players.observe( @@ -1505,6 +1793,20 @@ func _apply_spawn_entry(entry: Dictionary) -> void: var record := _registry.get_peer(peer_id) if avatar != null and record != null: avatar.apply_appearance_snapshot(record.appearance_snapshot) + # Lifecycle and animation updates use separate reliable ENet channels. + # Include the current authoritative state in the spawn record so a peer + # joining during an action presents it immediately, regardless of which + # channel arrives first. + avatar.apply_network_animation_state(entry["animation_state"]) + avatar.apply_network_sitting_state(bool(entry["sitting"])) + var pending_animation: Dictionary = ( + _pending_animation_state_by_peer.get(peer_id, {}) + ) + if not pending_animation.is_empty(): + avatar.apply_network_animation_state(pending_animation) + _pending_animation_state_by_peer.erase(peer_id) + if peer_was_added and record != null: + peer_authenticated.emit(peer_id, record.display_name) func _build_spawn_list() -> Array[Dictionary]: @@ -1527,6 +1829,15 @@ func _make_spawn_entry( transform: Transform3D, ) -> Dictionary: var record: PeerRegistry.PeerRecord = _registry.get_peer(peer_id) + var avatar: Player = _spawn_service.get_avatar(peer_id) + var animation_state: Dictionary = ( + avatar.make_network_animation_state() + if avatar != null + else NetworkPlayerAnimationProtocol.make_state( + NetworkPlayerAnimationProtocol.LOCOMOTION_IDLE, + true, + ) + ) return { "peer_id": peer_id, "profile_id": record.profile_id if record != null else "", @@ -1537,6 +1848,12 @@ func _make_spawn_entry( transform.origin.z, ], "yaw": transform.basis.get_euler().y, + "sitting": ( + avatar.get_network_sitting_state() + if avatar != null + else false + ), + "animation_state": animation_state, "appearance": ( record.appearance_snapshot.duplicate(true) if record != null @@ -1604,25 +1921,62 @@ func _update_local_operator() -> void: _local_operator = bool(_operator_peer_ids.get(local_peer_id, false)) -func _verify_spawn_identity(entry: Dictionary) -> bool: - var fingerprint := str(entry.get("identity_fingerprint", "")) - var public_pem := NetworkIdentityCrypto.normalize_public_pem( - str(entry.get("identity_public_key", "")) - ) - if ( - NetworkIdentityCrypto.fingerprint_public_pem(public_pem) != fingerprint - or typeof(entry.get("profile_authorization")) != TYPE_DICTIONARY - ): +func verify_profile_authorization( + peer_id: int, + display_name: String, + appearance: Dictionary, + authorization: Dictionary, +) -> bool: + var record := _registry.get_peer(peer_id) + if record == null: + return false + return _verify_profile_authorization_fields( + peer_id, + record.profile_id, + display_name, + appearance, + record.identity_fingerprint, + record.identity_public_key, + authorization, + ) + + +func _verify_spawn_identity(entry: Dictionary) -> bool: + if typeof(entry.get("profile_authorization")) != TYPE_DICTIONARY: + return false + return _verify_profile_authorization_fields( + int(entry.get("peer_id", 0)), + str(entry.get("profile_id", "")), + str(entry.get("display_name", "")), + Dictionary(entry.get("appearance", {})), + str(entry.get("identity_fingerprint", "")), + str(entry.get("identity_public_key", "")), + Dictionary(entry.get("profile_authorization", {})), + ) + + +func _verify_profile_authorization_fields( + peer_id: int, + profile_id: String, + display_name: String, + appearance: Dictionary, + fingerprint: String, + identity_public_key: String, + authorization: Dictionary, +) -> bool: + var public_pem := NetworkIdentityCrypto.normalize_public_pem( + identity_public_key + ) + if NetworkIdentityCrypto.fingerprint_public_pem(public_pem) != fingerprint: return false - var authorization: Dictionary = entry["profile_authorization"] if authorization.is_empty(): - return int(entry.get("peer_id", 0)) == 1 + return peer_id == 1 if authorization.get("domain") == "handshake_client_profile": var hello := NetworkProtocol.make_client_hello( - str(entry.get("profile_id", "")), - str(entry.get("display_name", "")), + profile_id, + display_name, str(authorization.get("client_nonce", "")), - Dictionary(entry.get("appearance", {})), + appearance, fingerprint, authorization.get("signature", PackedByteArray()), ) @@ -1632,10 +1986,23 @@ func _verify_spawn_identity(entry: Dictionary) -> bool: NetworkProtocol.client_profile_fields(hello), hello["identity_signature"], ) + if authorization.get("domain") == "appearance_preview": + if str(authorization.get("sender_fingerprint", "")) != fingerprint: + return false + var preview := authorization.duplicate(true) + preview["appearance"] = appearance + return NetworkIdentityCrypto.verify_fields( + NetworkIdentityCrypto.load_public_key(public_pem), + "appearance_preview", + NetworkProfileProtocol.appearance_preview_signature_fields(preview), + preview.get("sender_signature", PackedByteArray()), + ) if authorization.has("sender_signature"): + if str(authorization.get("sender_fingerprint", "")) != fingerprint: + return false var signed := authorization.duplicate(true) - signed["display_name"] = entry.get("display_name", "") - signed["appearance"] = entry.get("appearance", {}) + signed["display_name"] = display_name + signed["appearance"] = appearance return NetworkIdentityCrypto.verify_fields( NetworkIdentityCrypto.load_public_key(public_pem), "profile_update", @@ -1712,14 +2079,69 @@ func _fail_identity(message: String) -> void: _fail(message) +func _maybe_send_local_input() -> void: + var peer_id: int = multiplayer.get_unique_id() + var avatar: Player = _spawn_service.get_avatar(peer_id) + if avatar == null: + return + var state_hash: int = avatar.get_network_input_state_hash() + var state_changed: bool = state_hash != _last_input_state_hash + if ( + avatar.has_active_network_input() + or state_changed + or _idle_input_accumulator >= IDLE_INPUT_INTERVAL + ): + _send_local_input() + _last_input_state_hash = state_hash + _idle_input_accumulator = 0.0 + + func _send_local_input() -> void: var peer_id: int = multiplayer.get_unique_id() var avatar: Player = _spawn_service.get_avatar(peer_id) if avatar == null: return - _input_sequence += 1 + _input_sequence = ( + 1 + if _input_sequence >= MAX_MOVEMENT_INPUT_SEQUENCE + else _input_sequence + 1 + ) var input: Dictionary = avatar.capture_network_input(_input_sequence) - submit_movement_input.rpc_id(1, input) + var encoded: Array = _encode_movement_input(input) + if encoded.is_empty(): + return + _pending_movement_inputs.append(input.duplicate(true)) + while _pending_movement_inputs.size() > MAX_PENDING_MOVEMENT_INPUTS: + _pending_movement_inputs.pop_front() + _movement_inputs_sent += 1 + submit_movement_input.rpc_id(1, encoded) + + +func _maybe_send_local_animation_action() -> void: + var peer_id: int = multiplayer.get_unique_id() + var avatar: Player = _spawn_service.get_avatar(peer_id) + if avatar == null: + return + var state: Dictionary = avatar.make_network_animation_state() + var action: Dictionary = state.get("action", {}) + if not NetworkPlayerAnimationProtocol.validate_action_state(action): + return + var signature: Array = [ + str(action["id"]), + int(action["sequence"]), + bool(action.get("paused", false)), + avatar.get_network_sitting_intent(), + ] + if signature == _last_local_animation_action_signature: + return + var encoded: Array = _encode_movement_animation_action( + action, + avatar.get_network_sitting_intent(), + ) + if encoded.is_empty(): + return + _last_local_animation_action_signature = signature + submit_movement_animation_action.rpc_id(1, encoded) func submit_neutral_local_movement() -> void: @@ -1729,17 +2151,112 @@ func submit_neutral_local_movement() -> void: @rpc("any_peer", "call_remote", "unreliable_ordered", 1) -func submit_movement_input(data: Dictionary) -> void: +func submit_movement_input(encoded: Array) -> void: var sender_id: int = multiplayer.get_remote_sender_id() if not is_host() or not _registry.has_peer(sender_id): return var avatar: Player = _spawn_service.get_avatar(sender_id) - if avatar == null or not _is_valid_movement_input(data): + var data: Dictionary = _decode_movement_input(encoded) + if avatar == null or data.is_empty(): return - avatar.apply_authoritative_network_input(data) + _movement_inputs_received += 1 + avatar.apply_authoritative_network_input( + data, + Player.resolve_network_input_stale_timeout_seconds( + get_peer_rtt_ms(sender_id) + ), + ) -func _is_valid_movement_input(data: Dictionary) -> bool: +@rpc( + "any_peer", + "call_remote", + "reliable", + NetworkProtocol.MOVEMENT_ANIMATION_CHANNEL, +) +func submit_movement_animation_action(encoded: Array) -> void: + var sender_id: int = multiplayer.get_remote_sender_id() + if not is_host() or not _registry.has_peer(sender_id): + return + var avatar: Player = _spawn_service.get_avatar(sender_id) + var state: Dictionary = _decode_movement_animation_action(encoded) + if avatar == null or state.is_empty(): + return + avatar.apply_authoritative_network_animation_action(state["action"]) + avatar.apply_authoritative_network_sitting_state(bool(state["sitting"])) + + +static func _encode_movement_input(data: Dictionary) -> Array: + if not _is_valid_movement_input(data): + return [] + var axis: Array = data["axis"] + var flags: int = 0 + if bool(data["jump"]): + flags |= MOVEMENT_FLAG_JUMP + if bool(data["sprint"]): + flags |= MOVEMENT_FLAG_SPRINT + if bool(data["sneak"]): + flags |= MOVEMENT_FLAG_SNEAK + if bool(data["slow_walk"]): + flags |= MOVEMENT_FLAG_SLOW_WALK + if bool(data["sitting"]): + flags |= MOVEMENT_FLAG_SITTING + if bool(data["casting"]): + flags |= MOVEMENT_FLAG_CASTING + var action: Dictionary = data["animation_action"] + return [ + int(data["sequence"]), + Vector2(float(axis[0]), float(axis[1])), + float(data["camera_yaw"]), + flags, + str(action["id"]), + int(action["sequence"]), + float(action["elapsed"]), + bool(action.get("paused", false)), + ] + + +static func _decode_movement_input(value: Variant) -> Dictionary: + if typeof(value) != TYPE_ARRAY: + return {} + var fields: Array = value + if ( + fields.size() != MOVEMENT_INPUT_FIELD_COUNT + or typeof(fields[0]) != TYPE_INT + or typeof(fields[1]) != TYPE_VECTOR2 + or typeof(fields[2]) not in [TYPE_FLOAT, TYPE_INT] + or typeof(fields[3]) != TYPE_INT + or typeof(fields[4]) not in [TYPE_STRING, TYPE_STRING_NAME] + or typeof(fields[5]) != TYPE_INT + or typeof(fields[6]) not in [TYPE_FLOAT, TYPE_INT] + or typeof(fields[7]) != TYPE_BOOL + ): + return {} + var axis: Vector2 = fields[1] + var flags: int = int(fields[3]) + if flags < 0 or flags & ~MOVEMENT_ALLOWED_FLAGS != 0: + return {} + var decoded: Dictionary = { + "sequence": int(fields[0]), + "axis": [axis.x, axis.y], + "camera_yaw": float(fields[2]), + "jump": bool(flags & MOVEMENT_FLAG_JUMP), + "sprint": bool(flags & MOVEMENT_FLAG_SPRINT), + "sneak": bool(flags & MOVEMENT_FLAG_SNEAK), + "slow_walk": bool(flags & MOVEMENT_FLAG_SLOW_WALK), + "sitting": bool(flags & MOVEMENT_FLAG_SITTING), + "casting": bool(flags & MOVEMENT_FLAG_CASTING), + "animation_action": NetworkPlayerAnimationProtocol.make_action_state( + StringName(str(fields[4])), + int(fields[5]), + float(fields[6]), + bool(fields[7]), + ), + } + return decoded if _is_valid_movement_input(decoded) else {} + + +static func _is_valid_movement_input(data: Dictionary) -> bool: if ( typeof(data.get("sequence")) != TYPE_INT or typeof(data.get("axis")) != TYPE_ARRAY @@ -1779,49 +2296,153 @@ func _is_valid_movement_input(data: Dictionary) -> bool: func _broadcast_movement_snapshots() -> void: - var snapshots: Array = [] - for peer_id: int in _registry.get_peer_ids(): - var avatar: Player = _spawn_service.get_avatar(peer_id) - if avatar == null: + _movement_snapshot_tick += 1 + var peer_ids: Array[int] = _registry.get_peer_ids() + for recipient_id: int in peer_ids: + # Peer 1 is the local listen-server player. Dedicated servers do not + # register a peer 1, so every remaining record is a remote recipient. + if recipient_id == 1: continue - var encoded: Array = _encode_movement_snapshot( - avatar.make_network_snapshot(peer_id) - ) - if not encoded.is_empty(): - snapshots.append(encoded) - # The compact v5 representation keeps a normal eight-player update near - # 1 KiB instead of the roughly 3.7 KiB dictionary representation. Rooms - # configured above the normal cap are divided into the same safe size. + var recipient_avatar: Player = _spawn_service.get_avatar(recipient_id) + if recipient_avatar == null: + continue + var snapshots: Array = [] + for subject_id: int in peer_ids: + if not peers_share_space(recipient_id, subject_id): + continue + var subject_avatar: Player = _spawn_service.get_avatar(subject_id) + if subject_avatar == null: + continue + if subject_id == recipient_id: + # The owner already simulates locally. Its authoritative state is + # an audit and acknowledgement, not a presentation stream, so it + # does not need the full 30 Hz observer snapshot rate. + if _movement_snapshot_tick % OWNER_SNAPSHOT_DIVISOR != 0: + continue + elif not _should_send_remote_snapshot( + recipient_avatar.global_position, + subject_avatar.global_position, + ): + continue + var encoded: Array = _encode_movement_snapshot( + subject_avatar.make_network_snapshot(subject_id) + ) + if not encoded.is_empty(): + snapshots.append(encoded) + _send_movement_snapshot_batches(recipient_id, snapshots) + _broadcast_movement_animation_updates(peer_ids) + + +func _should_send_remote_snapshot( + recipient_position: Vector3, + subject_position: Vector3, +) -> bool: + var distance_squared: float = recipient_position.distance_squared_to( + subject_position + ) + var divisor: int = DISTANT_REMOTE_SNAPSHOT_DIVISOR + if distance_squared <= NEAR_REMOTE_DISTANCE * NEAR_REMOTE_DISTANCE: + divisor = NEAR_REMOTE_SNAPSHOT_DIVISOR + elif distance_squared <= FAR_REMOTE_DISTANCE * FAR_REMOTE_DISTANCE: + divisor = FAR_REMOTE_SNAPSHOT_DIVISOR + return _movement_snapshot_tick % divisor == 0 + + +func _send_movement_snapshot_batches( + recipient_id: int, + snapshots: Array, +) -> void: for start_index: int in range( 0, snapshots.size(), MOVEMENT_SNAPSHOT_BATCH_SIZE, ): - receive_movement_snapshots.rpc( - snapshots.slice( - start_index, - mini( - start_index + MOVEMENT_SNAPSHOT_BATCH_SIZE, - snapshots.size(), - ), - ) + var batch: Array = snapshots.slice( + start_index, + mini( + start_index + MOVEMENT_SNAPSHOT_BATCH_SIZE, + snapshots.size(), + ), ) + receive_movement_snapshots.rpc_id(recipient_id, batch) + _movement_snapshot_packets_sent += 1 + _movement_snapshot_states_sent += batch.size() + + +func _broadcast_movement_animation_updates(peer_ids: Array[int]) -> void: + var refresh_all: bool = ( + _animation_refresh_accumulator >= ANIMATION_REFRESH_INTERVAL + ) + if refresh_all: + _animation_refresh_accumulator = fmod( + _animation_refresh_accumulator, + ANIMATION_REFRESH_INTERVAL, + ) + var updates_by_subject: Dictionary[int, Array] = {} + for subject_id: int in peer_ids: + var avatar: Player = _spawn_service.get_avatar(subject_id) + if avatar == null: + continue + var state: Dictionary = avatar.make_network_animation_state() + var previous: Dictionary = _last_animation_state_by_peer.get( + subject_id, {} + ) + if ( + not refresh_all + and _movement_animation_signature(state) + == _movement_animation_signature(previous) + ): + continue + _last_animation_state_by_peer[subject_id] = state.duplicate(true) + var encoded: Array = _encode_movement_animation(subject_id, state) + if not encoded.is_empty(): + updates_by_subject[subject_id] = encoded + if updates_by_subject.is_empty(): + return + for recipient_id: int in peer_ids: + if recipient_id == 1: + continue + var updates: Array = [] + for subject_id: int in updates_by_subject: + if peers_share_space(recipient_id, subject_id): + updates.append(updates_by_subject[subject_id]) + if updates.is_empty(): + continue + receive_movement_animations.rpc_id(recipient_id, updates) + _movement_animation_packets_sent += 1 + _movement_animation_states_sent += updates.size() + + +static func _movement_animation_signature(state: Dictionary) -> Array: + if not NetworkPlayerAnimationProtocol.validate_state(state): + return [] + var action: Dictionary = state["action"] + return [ + str(state["locomotion_id"]), + bool(state["grounded"]), + str(action["id"]), + int(action["sequence"]), + bool(action.get("paused", false)), + ] static func _encode_movement_snapshot(snapshot: Dictionary) -> Array: var position: Variant = snapshot.get("position") var snapshot_velocity: Variant = snapshot.get("velocity") - var animation_value: Variant = snapshot.get("animation_state") if ( typeof(position) != TYPE_ARRAY or position.size() != 3 or typeof(snapshot_velocity) != TYPE_ARRAY or snapshot_velocity.size() != 3 - or not NetworkPlayerAnimationProtocol.validate_state(animation_value) ): return [] - var animation: Dictionary = animation_value - var action: Dictionary = animation["action"] + var flags: int = 0 + if bool(snapshot.get("grounded", false)): + flags |= SNAPSHOT_FLAG_GROUNDED + if bool(snapshot.get("sitting", false)): + flags |= SNAPSHOT_FLAG_SITTING + if bool(snapshot.get("casting", false)): + flags |= SNAPSHOT_FLAG_CASTING return [ int(snapshot.get("peer_id", 0)), int(snapshot.get("acknowledged_input", 0)), @@ -1832,13 +2453,7 @@ static func _encode_movement_snapshot(snapshot: Dictionary) -> Array: float(snapshot_velocity[2]), ), float(snapshot.get("visual_yaw", 0.0)), - str(animation["locomotion_id"]), - bool(animation["grounded"]), - str(action["id"]), - int(action["sequence"]), - float(action["elapsed"]), - bool(snapshot.get("sitting", false)), - bool(snapshot.get("casting", false)), + flags, ] @@ -1853,17 +2468,22 @@ static func _decode_movement_snapshot(value: Variant) -> Dictionary: or typeof(fields[2]) != TYPE_VECTOR3 or typeof(fields[3]) != TYPE_VECTOR3 or typeof(fields[4]) not in [TYPE_FLOAT, TYPE_INT] - or typeof(fields[5]) not in [TYPE_STRING, TYPE_STRING_NAME] - or typeof(fields[6]) != TYPE_BOOL - or typeof(fields[7]) not in [TYPE_STRING, TYPE_STRING_NAME] - or typeof(fields[8]) != TYPE_INT - or typeof(fields[9]) not in [TYPE_FLOAT, TYPE_INT] - or typeof(fields[10]) != TYPE_BOOL - or typeof(fields[11]) != TYPE_BOOL + or typeof(fields[5]) != TYPE_INT ): return {} var position: Vector3 = fields[2] var snapshot_velocity: Vector3 = fields[3] + var flags: int = int(fields[5]) + if ( + int(fields[0]) <= 0 + or int(fields[1]) < 0 + or not position.is_finite() + or not snapshot_velocity.is_finite() + or not is_finite(float(fields[4])) + or flags < 0 + or flags & ~SNAPSHOT_ALLOWED_FLAGS != 0 + ): + return {} return { "peer_id": int(fields[0]), "acknowledged_input": int(fields[1]), @@ -1874,18 +2494,100 @@ static func _decode_movement_snapshot(value: Variant) -> Dictionary: snapshot_velocity.z, ], "visual_yaw": float(fields[4]), - "animation_state": NetworkPlayerAnimationProtocol.make_state( - StringName(str(fields[5])), - bool(fields[6]), - StringName(str(fields[7])), - int(fields[8]), - float(fields[9]), - ), - "sitting": bool(fields[10]), - "casting": bool(fields[11]), + "grounded": bool(flags & SNAPSHOT_FLAG_GROUNDED), + "sitting": bool(flags & SNAPSHOT_FLAG_SITTING), + "casting": bool(flags & SNAPSHOT_FLAG_CASTING), } +static func _encode_movement_animation( + peer_id: int, + state: Dictionary, +) -> Array: + if not NetworkPlayerAnimationProtocol.validate_state(state): + return [] + var action: Dictionary = state["action"] + return [ + peer_id, + str(state["locomotion_id"]), + bool(state["grounded"]), + str(action["id"]), + int(action["sequence"]), + float(action["elapsed"]), + bool(action.get("paused", false)), + ] + + +static func _decode_movement_animation(value: Variant) -> Dictionary: + if typeof(value) != TYPE_ARRAY: + return {} + var fields: Array = value + if ( + fields.size() != MOVEMENT_ANIMATION_FIELD_COUNT + or typeof(fields[0]) != TYPE_INT + or typeof(fields[1]) not in [TYPE_STRING, TYPE_STRING_NAME] + or typeof(fields[2]) != TYPE_BOOL + or typeof(fields[3]) not in [TYPE_STRING, TYPE_STRING_NAME] + or typeof(fields[4]) != TYPE_INT + or typeof(fields[5]) not in [TYPE_FLOAT, TYPE_INT] + or typeof(fields[6]) != TYPE_BOOL + ): + return {} + var state: Dictionary = NetworkPlayerAnimationProtocol.make_state( + StringName(str(fields[1])), + bool(fields[2]), + StringName(str(fields[3])), + int(fields[4]), + float(fields[5]), + bool(fields[6]), + ) + if ( + int(fields[0]) <= 0 + or not NetworkPlayerAnimationProtocol.validate_state(state) + ): + return {} + return {"peer_id": int(fields[0]), "state": state} + + +static func _encode_movement_animation_action( + action: Dictionary, + sitting: bool, +) -> Array: + if not NetworkPlayerAnimationProtocol.validate_action_state(action): + return [] + return [ + str(action["id"]), + int(action["sequence"]), + float(action["elapsed"]), + bool(action.get("paused", false)), + sitting, + ] + + +static func _decode_movement_animation_action(value: Variant) -> Dictionary: + if typeof(value) != TYPE_ARRAY: + return {} + var fields: Array = value + if ( + fields.size() != MOVEMENT_ANIMATION_ACTION_FIELD_COUNT + or typeof(fields[0]) not in [TYPE_STRING, TYPE_STRING_NAME] + or typeof(fields[1]) != TYPE_INT + or typeof(fields[2]) not in [TYPE_FLOAT, TYPE_INT] + or typeof(fields[3]) != TYPE_BOOL + or typeof(fields[4]) != TYPE_BOOL + ): + return {} + var action: Dictionary = NetworkPlayerAnimationProtocol.make_action_state( + StringName(str(fields[0])), + int(fields[1]), + float(fields[2]), + bool(fields[3]), + ) + if not NetworkPlayerAnimationProtocol.validate_action_state(action): + return {} + return {"action": action, "sitting": bool(fields[4])} + + @rpc("authority", "call_remote", "unreliable_ordered", 2) func receive_movement_snapshots(encoded_snapshots: Array) -> void: if state != State.JOINED_CLIENT: @@ -1905,11 +2607,17 @@ func receive_movement_snapshots(encoded_snapshots: Array) -> void: if avatar == null: continue if peer_id == local_peer_id: + if _reject_stale_space_transition_snapshot(snapshot): + continue + _discard_acknowledged_movement_inputs( + int(snapshot.get("acknowledged_input", 0)) + ) avatar.apply_local_prediction_correction( snapshot, _input_sequence, INPUT_INTERVAL, estimated_transit_seconds, + _local_snapshot_delta_seconds(), ) else: avatar.push_network_snapshot( @@ -1918,6 +2626,80 @@ func receive_movement_snapshots(encoded_snapshots: Array) -> void: ) +func _reject_stale_space_transition_snapshot(snapshot: Dictionary) -> bool: + if not _local_space_transition_guard_active: + return false + var position_values: Array = snapshot.get("position", []) + if position_values.size() != 3: + return true + var position := Vector3( + float(position_values[0]), + float(position_values[1]), + float(position_values[2]), + ) + var acknowledged_input: int = int( + snapshot.get("acknowledged_input", 0) + ) + if acknowledged_input < _local_space_transition_minimum_ack: + return true + if acknowledged_input > _local_space_transition_minimum_ack: + _local_space_transition_guard_active = false + return false + if position.distance_to(_local_space_transition_guard_position) > ( + SPACE_TRANSITION_SNAPSHOT_GUARD_DISTANCE + ): + return true + _local_space_transition_guard_active = false + return false + + +func _discard_acknowledged_movement_inputs(acknowledged_sequence: int) -> void: + while ( + not _pending_movement_inputs.is_empty() + and int(_pending_movement_inputs[0].get("sequence", 0)) + <= acknowledged_sequence + ): + _pending_movement_inputs.pop_front() + + +func _local_snapshot_delta_seconds() -> float: + var now_msec: int = Time.get_ticks_msec() + if _last_local_snapshot_received_msec <= 0: + _last_local_snapshot_received_msec = now_msec + return 0.0 + var elapsed_seconds: float = clampf( + float(now_msec - _last_local_snapshot_received_msec) / 1000.0, + 0.0, + Player.LOCAL_PREDICTION_MAX_AUDIT_DELTA_SECONDS, + ) + _last_local_snapshot_received_msec = now_msec + return elapsed_seconds + + +@rpc( + "authority", + "call_remote", + "reliable", + NetworkProtocol.MOVEMENT_ANIMATION_CHANNEL, +) +func receive_movement_animations(encoded_states: Array) -> void: + if state != State.JOINED_CLIENT: + return + for value: Variant in encoded_states: + var decoded: Dictionary = _decode_movement_animation(value) + if decoded.is_empty(): + continue + var avatar: Player = _spawn_service.get_avatar( + int(decoded["peer_id"]) + ) + if avatar == null: + _pending_animation_state_by_peer[int(decoded["peer_id"])] = ( + Dictionary(decoded["state"]).duplicate(true) + ) + continue + avatar.apply_network_animation_state(decoded["state"]) + + func _estimated_movement_transit_seconds() -> float: if state != State.JOINED_CLIENT: return -1.0 @@ -2193,8 +2975,21 @@ func _teardown_peer() -> void: _connection_deadline = 0.0 _input_sequence = 0 _input_accumulator = 0.0 + _idle_input_accumulator = 0.0 + _last_input_state_hash = 0 + _pending_movement_inputs.clear() _snapshot_accumulator = 0.0 + _movement_snapshot_tick = 0 + _last_local_snapshot_received_msec = 0 + _local_space_transition_guard_active = false + _local_space_transition_guard_position = Vector3.ZERO + _local_space_transition_minimum_ack = 0 + _animation_refresh_accumulator = 0.0 + _last_animation_state_by_peer.clear() + _pending_animation_state_by_peer.clear() + _last_local_animation_action_signature.clear() _server_capabilities = PackedStringArray() + _peer_space_ids.clear() _server_identity_fingerprint = "" _server_identity_public_key = "" _session_identity_keys.clear() diff --git a/network/network_shop_protocol.gd b/network/network_shop_protocol.gd index 11900e9..da9419a 100644 --- a/network/network_shop_protocol.gd +++ b/network/network_shop_protocol.gd @@ -3,6 +3,8 @@ extends RefCounted const CAPABILITY: StringName = &"shop_v1" const ART_CAPABILITY: StringName = &"art_shop_v1" +const BACKPACK_CAPABILITY: StringName = &"backpack_shop_v1" +const DECOR_CAPABILITY: StringName = &"portable_home_v1" const RELIABLE_CHANNEL: int = NetworkProtocol.SHOP_RELIABLE_CHANNEL const MAX_ID_LENGTH: int = 96 const MAX_MESSAGE_LENGTH: int = 160 @@ -16,6 +18,8 @@ enum ProductCategory { COOLER_CAPACITY_UPGRADE, ART_KIT, ART_UPGRADE, + BACKPACK_CAPACITY_UPGRADE, + DECOR, } diff --git a/network/network_shop_service.gd b/network/network_shop_service.gd index 0f26553..8294b53 100644 --- a/network/network_shop_service.gd +++ b/network/network_shop_service.gd @@ -8,11 +8,14 @@ const ItemDataType = preload("res://items/item_data.gd") const FishingRodDataType = preload("res://items/fishing_rod_data.gd") const OwnedItemType = preload("res://items/owned_item.gd") const ArtShopStockType = preload("res://economy/art_shop_stock.gd") +const DecorCatalogType = preload("res://homes/decor_catalog.gd") -const SHOP_ID: StringName = &"main_fishing_shop" +const FISHING_SHOP_ID: StringName = &"main_fishing_shop" +const DECOR_SHOP_ID: StringName = &"rv_decor_shop" const REEL_PRODUCT_ID: StringName = &"reel_speed_upgrade" const BARRIER_PRODUCT_ID: StringName = &"barrier_power_upgrade" const COOLER_PRODUCT_ID: StringName = &"cooler_capacity_upgrade" +const BACKPACK_PRODUCT_ID: StringName = &"backpack_capacity_upgrade" const MAX_LEDGER_ENTRIES_PER_PEER: int = 64 signal local_purchase_pending(request_id: String) @@ -30,11 +33,13 @@ var _session: NetworkSession var _spawn_service: PlayerSpawnService var _network_fishing: NetworkFishingService var _interaction: FishingShopInteraction +var _decor_interaction: DecorShopInteraction var _wallet: PlayerWallet var _bag: PlayerBag var _item_catalog: ItemCatalog var _upgrades: PlayerFishingUpgrades var _cooler_capacity: PlayerCoolerCapacity +var _inventory_layout: PlayerInventoryLayout var _art_unlocks: PlayerArtUnlocks var _save_manager: PlayerSaveManager var _request_ledgers: Dictionary[int, Dictionary] = {} @@ -45,6 +50,8 @@ var _received_results: Dictionary[String, bool] = {} var _applied_results: Dictionary[String, bool] = {} var _pending_local_request: Dictionary = {} var _reservations: PlayerAssetReservationService +var _home_state: PlayerHomeState +var _network_home: NetworkHomeService func setup( @@ -60,6 +67,10 @@ func setup( art_unlocks: PlayerArtUnlocks, save_manager: PlayerSaveManager, reservations: PlayerAssetReservationService, + inventory_layout: PlayerInventoryLayout = null, + home_state: PlayerHomeState = null, + network_home: NetworkHomeService = null, + decor_interaction: DecorShopInteraction = null, ) -> void: _session = session _spawn_service = spawn_service @@ -73,12 +84,26 @@ func setup( _art_unlocks = art_unlocks _save_manager = save_manager _reservations = reservations + _inventory_layout = inventory_layout + _home_state = home_state + _network_home = network_home + _decor_interaction = decor_interaction if not _session.peer_removed.is_connected(_on_peer_removed): _session.peer_removed.connect(_on_peer_removed) if not _session.state_changed.is_connected(_on_session_state_changed): _session.state_changed.connect(_on_session_state_changed) +func set_shop_interaction(interaction: FishingShopInteraction) -> void: + _interaction = interaction + + +func set_decor_shop_interaction( + interaction: DecorShopInteraction, +) -> void: + _decor_interaction = interaction + + func can_request_purchase() -> bool: return ( _session != null @@ -104,6 +129,31 @@ func can_request_art_purchase() -> bool: ) +func can_request_backpack_purchase() -> bool: + return ( + can_request_purchase() + and ( + _session.is_host() + or _session.supports_server_capability( + NetworkShopProtocol.BACKPACK_CAPABILITY + ) + ) + ) + + +func can_request_decor_purchase() -> bool: + return ( + can_request_purchase() + and _home_state != null + and ( + _session.is_host() + or _session.supports_server_capability( + NetworkShopProtocol.DECOR_CAPABILITY + ) + ) + ) + + func is_local_purchase_pending() -> bool: return not _pending_local_request.is_empty() @@ -163,6 +213,25 @@ func request_cooler_capacity_upgrade() -> String: ) +func request_backpack_capacity_upgrade() -> String: + return _request_purchase( + BACKPACK_PRODUCT_ID, + NetworkShopProtocol.ProductCategory.BACKPACK_CAPACITY_UPGRADE, + 1, + _inventory_layout.get_backpack_level() + if _inventory_layout != null else 0, + ) + + +func request_decor(product_id: StringName) -> String: + return _request_purchase( + product_id, + NetworkShopProtocol.ProductCategory.DECOR, + 1, + _home_state.get_owned_count(product_id) if _home_state != null else 0, + ) + + func request_art_kit() -> String: return _request_purchase( ArtShopStockType.ART_KIT_ITEM_ID, @@ -230,11 +299,34 @@ func _request_purchase( product_id, category, 0, 0, ) return "" + if ( + category == NetworkShopProtocol.ProductCategory.BACKPACK_CAPACITY_UPGRADE + and not can_request_backpack_purchase() + ): + local_purchase_finished.emit( + "", false, "Backpack upgrades require a newer server.", + product_id, category, 0, 0, + ) + return "" + if ( + category == NetworkShopProtocol.ProductCategory.DECOR + and not can_request_decor_purchase() + ): + local_purchase_finished.emit( + "", false, "Decor require a newer server.", + product_id, category, 0, 0, + ) + return "" var request_id: String = _new_id("shop") + var shop_id: StringName = ( + DECOR_SHOP_ID + if category == NetworkShopProtocol.ProductCategory.DECOR + else FISHING_SHOP_ID + ) var request: Dictionary = { "request_id": request_id, "session_id": _session.get_session_id(), - "shop_id": str(SHOP_ID), + "shop_id": str(shop_id), "product_id": str(product_id), "category": category, "quantity": quantity, @@ -306,16 +398,34 @@ func _handle_purchase_request(peer_id: int, data: Dictionary) -> void: _rejected_result(data, "A purchase is already pending.") ) return - if not _is_shop_available_for_peer(peer_id): + var requested_shop_id := StringName(str(data["shop_id"])) + if not _is_shop_available_for_peer(peer_id, requested_shop_id): var avatar: Player = _spawn_service.get_avatar(peer_id) + var requested_interaction: FishingShopInteraction = ( + _decor_interaction + if requested_shop_id == DECOR_SHOP_ID + else _interaction + ) var message: String = ( "The shop is unavailable." - if avatar == null or _interaction == null + if avatar == null or requested_interaction == null else "Move closer to the shop." ) _record_and_send(peer_id, _rejected_result(data, message)) return var result: Dictionary = _build_authoritative_result(peer_id, data) + if ( + bool(result.get("accepted", false)) + and int(result.get("category", -1)) + == NetworkShopProtocol.ProductCategory.DECOR + and _network_home != null + ): + _network_home.authorize_decor_purchase( + peer_id, + StringName(str(result["product_id"])), + int(result["resulting_state"]), + str(result["result_id"]), + ) _pending_by_peer[peer_id] = request_id _record_and_send(peer_id, result) @@ -329,10 +439,24 @@ func _build_authoritative_result( var quantity: int = request["quantity"] var wallet_balance: int = request["wallet_balance"] var current_state: int = request["current_state"] + if ( + category == NetworkShopProtocol.ProductCategory.DECOR + and _network_home != null + ): + var authoritative_count: int = ( + _network_home.get_authoritative_owned_count(peer_id, product_id) + ) + if authoritative_count >= 0: + current_state = authoritative_count var cost: int = -1 var resulting_state: int = current_state var rejection: String = "" - if StringName(str(request["shop_id"])) != SHOP_ID: + var expected_shop_id: StringName = ( + DECOR_SHOP_ID + if category == NetworkShopProtocol.ProductCategory.DECOR + else FISHING_SHOP_ID + ) + if StringName(str(request["shop_id"])) != expected_shop_id: rejection = "The shop is unavailable." elif quantity < 1: rejection = "Purchase could not be completed." @@ -372,7 +496,7 @@ func _build_authoritative_result( or current_state + quantity > item.max_stack ): rejection = ( - "Your Bag is full." + "Your inventory is full." if item != null and current_state >= item.max_stack else "Purchase could not be completed." ) @@ -458,6 +582,17 @@ func _build_authoritative_result( ] ) resulting_state = current_state + 1 + NetworkShopProtocol.ProductCategory.BACKPACK_CAPACITY_UPGRADE: + if ( + product_id != BACKPACK_PRODUCT_ID + or current_state >= PlayerInventoryLayout.MAX_BACKPACK_LEVEL + ): + rejection = "Upgrade is already at maximum." + else: + cost = PlayerInventoryLayout.BACKPACK_EXPANSION_COSTS[ + current_state + ] + resulting_state = current_state + 1 NetworkShopProtocol.ProductCategory.ART_KIT: var art_item: ItemDataType = _item_catalog.get_item_by_id( product_id @@ -495,6 +630,19 @@ func _build_authoritative_result( resulting_state = PlayerArtUnlocks.resulting_mask( current_state, product_id ) + NetworkShopProtocol.ProductCategory.DECOR: + cost = DecorCatalogType.get_price(product_id) + if ( + not DecorCatalogType.has_product(product_id) + or quantity != 1 + or current_state < 0 + or current_state + >= DecorCatalogType.MAX_OWNED_PER_PRODUCT + or cost < 0 + ): + rejection = "Decor is unavailable." + else: + resulting_state = current_state + 1 if rejection.is_empty() and (cost < 0 or wallet_balance < cost): rejection = "Insufficient funds." if not rejection.is_empty(): @@ -612,14 +760,25 @@ func _apply_purchase_result(data: Dictionary) -> void: var reel_snapshot: int = _upgrades.get_reel_speed_level() var barrier_snapshot: int = _upgrades.get_barrier_power_level() var cooler_snapshot: int = _cooler_capacity.get_level() + var backpack_snapshot: int = ( + _inventory_layout.get_backpack_level() + if _inventory_layout != null else 0 + ) var art_snapshot: int = _art_unlocks.get_unlock_mask() + var home_snapshot: Dictionary = ( + _home_state.to_save_data() if _home_state != null else {} + ) var applied: bool = _apply_local_product(data) if not applied or not _save_manager.save_if_dirty(): _bag.replace_all_items(bag_snapshot) _bag.replace_unlocked_bait_ids(bait_unlock_snapshot) _upgrades.restore_levels(reel_snapshot, barrier_snapshot) _cooler_capacity.restore_level(cooler_snapshot) + if _inventory_layout != null: + _inventory_layout.restore_backpack_level(backpack_snapshot) _art_unlocks.restore_mask(art_snapshot) + if _home_state != null and not home_snapshot.is_empty(): + _home_state.restore_from_save_data(home_snapshot) _wallet.restore_balance(wallet_snapshot) _save_manager.save_if_dirty() _fail_local_apply(data, "Purchase could not be completed.") @@ -640,6 +799,7 @@ func _validate_local_result(data: Dictionary) -> String: or _cooler_capacity == null or _art_unlocks == null or _save_manager == null + or _home_state == null or _wallet.get_balance() != int(data["expected_wallet"]) or str(data["product_id"]) != str(_pending_local_request.get("product_id", "")) @@ -687,7 +847,7 @@ func _validate_local_result(data: Dictionary) -> String: ): return "Purchase could not be completed." if not _bag.can_add_item(product_id, data["quantity"]): - return "Your Bag is full." + return "Your inventory is full." NetworkShopProtocol.ProductCategory.ROD: var rod := ( _item_catalog.get_item_by_id(product_id) @@ -719,6 +879,13 @@ func _validate_local_result(data: Dictionary) -> String: return "Purchase could not be completed." if _cooler_capacity.get_next_cost() != cost: return "Purchase could not be completed." + NetworkShopProtocol.ProductCategory.BACKPACK_CAPACITY_UPGRADE: + if ( + _inventory_layout == null + or _inventory_layout.get_backpack_level() != expected_state + or _inventory_layout.get_next_backpack_cost() != cost + ): + return "Purchase could not be completed." NetworkShopProtocol.ProductCategory.ART_KIT: var art_item: ItemDataType = ( _item_catalog.get_item_by_id(product_id) @@ -743,6 +910,20 @@ func _validate_local_result(data: Dictionary) -> String: or cost != ArtShopStockType.UPGRADE_PRICE ): return "Purchase could not be completed." + NetworkShopProtocol.ProductCategory.DECOR: + if ( + not DecorCatalogType.has_product(product_id) + or _home_state.get_owned_count(product_id) != expected_state + or resulting_state != expected_state + 1 + or cost != DecorCatalogType.get_price(product_id) + or expected_state >= DecorCatalogType.MAX_OWNED_PER_PRODUCT + or not _bag.can_add_item(product_id, 1) + ): + return ( + "Your inventory is full." + if not _bag.can_add_item(product_id, 1) + else "Purchase could not be completed." + ) _: return "Purchase could not be completed." return "" @@ -768,6 +949,11 @@ func _apply_local_product(data: Dictionary) -> bool: return _upgrades.purchase_barrier_power(_wallet) NetworkShopProtocol.ProductCategory.COOLER_CAPACITY_UPGRADE: return _cooler_capacity.purchase(_wallet) + NetworkShopProtocol.ProductCategory.BACKPACK_CAPACITY_UPGRADE: + return ( + _inventory_layout != null + and _inventory_layout.purchase_backpack(_wallet) + ) NetworkShopProtocol.ProductCategory.ART_KIT: return ( _wallet.debit(int(data["total_cost"])) @@ -777,6 +963,12 @@ func _apply_local_product(data: Dictionary) -> bool: return _art_unlocks.purchase_product( product_id, _wallet, int(data["total_cost"]) ) + NetworkShopProtocol.ProductCategory.DECOR: + return ( + _wallet.debit(int(data["total_cost"])) + and _bag.add_item(product_id, 1) + and _home_state.add_owned_decor(product_id, 1) + ) return false @@ -853,7 +1045,7 @@ func _handle_acknowledgement( peer_id: int, result_id: String, request_id: String, - _applied: bool, + applied: bool, message: String, ) -> void: if ( @@ -865,20 +1057,32 @@ func _handle_acknowledgement( or _result_owners.get(result_id, 0) != peer_id ): return + if _network_home != null: + _network_home.finalize_decor_purchase( + peer_id, result_id, applied + ) _acknowledged_results[result_id] = true _bound_dictionary(_acknowledged_results) if _pending_by_peer.get(peer_id, "") == request_id: _pending_by_peer.erase(peer_id) -func _is_shop_available_for_peer(peer_id: int) -> bool: +func _is_shop_available_for_peer( + peer_id: int, + shop_id: StringName, +) -> bool: + var interaction: FishingShopInteraction = ( + _decor_interaction + if shop_id == DECOR_SHOP_ID + else _interaction + ) if ( _session == null or not _session.is_host() or not _session.is_gameplay_session_active() or _spawn_service == null - or _interaction == null - or not is_instance_valid(_interaction) + or interaction == null + or not is_instance_valid(interaction) ): return false var avatar: Player = _spawn_service.get_avatar(peer_id) @@ -889,7 +1093,7 @@ func _is_shop_available_for_peer(peer_id: int) -> bool: _network_fishing == null or not _network_fishing.has_peer_attempt(peer_id) ) - and _interaction.is_avatar_in_range(avatar) + and interaction.is_avatar_in_range(avatar) ) diff --git a/network/network_surface_drawing_service.gd b/network/network_surface_drawing_service.gd index e42519c..485dfaa 100644 --- a/network/network_surface_drawing_service.gd +++ b/network/network_surface_drawing_service.gd @@ -27,6 +27,9 @@ const MAX_REQUESTS_PER_WINDOW: int = 32 const MAX_RECENT_REQUEST_IDS: int = 64 const GRID_PREVIEW_SURFACE_OFFSET: float = 0.03 const POINTER_EDGE_MARGIN: float = 2.0 +const ARTWORK_DIRECTORY_NAME: String = "artwork" +const STAMP_ALPHA_THRESHOLD: float = 0.5 +const STAMP_COLOR_TOLERANCE: float = 0.012 const INVALID_POINTER_SCREEN_POSITION := Vector2(-1.0, -1.0) enum GuideAction { @@ -43,17 +46,26 @@ var _local_player: Player var _bag: PlayerBag var _hotbar: PlayerHotbar var _art_unlocks: PlayerArtUnlocks +var _data_root: PlayerDataRoot var _drawing_root: Node3D var _canvas_states: Dictionary[String, Dictionary] = {} var _canvas_nodes: Dictionary[String, SurfaceDrawingCanvas] = {} var _selected_canvas_id: String = "" +var _hovered_canvas_id: String = "" +var _last_hovered_canvas_id: String = "" var _brush_preview: MultiMeshInstance3D var _brush_preview_multimesh: MultiMesh var _brush_preview_material: ShaderMaterial var _placement_preview: MeshInstance3D var _placement_preview_material: StandardMaterial3D +var _stamp_preview: MeshInstance3D +var _stamp_preview_material: StandardMaterial3D var _active: bool = false var _placing_grid: bool = false +var _stamp_mode: bool = false +var _stamp_path: String = "" +var _stamp_pixels := PackedByteArray() +var _stamp_image: Image var _brush_size: int = 1 var _grid_size: int = SurfaceDrawingProtocol.DEFAULT_GRID_SIZE var _color_ids: Array[StringName] = [] @@ -90,6 +102,7 @@ func setup( bag: PlayerBag, hotbar: PlayerHotbar, art_unlocks: PlayerArtUnlocks, + data_root: PlayerDataRoot = null, ) -> void: _session = session _spawn_service = spawn_service @@ -99,6 +112,7 @@ func setup( _bag = bag _hotbar = hotbar _art_unlocks = art_unlocks + _data_root = data_root _refresh_local_unlocks() if _session != null: _session.state_changed.connect(_on_session_state_changed) @@ -178,6 +192,8 @@ func handle_input( if mouse_event.pressed: if _armed_guide_action != GuideAction.NONE: _execute_armed_guide_action() + elif _stamp_mode: + _request_stamp_at_aim() elif mouse_event.shift_pressed and mouse_event.ctrl_pressed: _finalize_selected_guide() elif mouse_event.shift_pressed: @@ -221,6 +237,8 @@ func activate( return _active = true _placing_grid = false + _last_hovered_canvas_id = "" + _clear_stamp_mode() _eraser_mode = false _clear_armed_guide_action(false) _refresh_local_unlocks() @@ -232,7 +250,11 @@ func activate( _pointer_screen_position = _clamped_pointer_position( initial_pointer_position ) - _prior_mouse_mode = Input.mouse_mode + # Art-kit activation can occur while the prior right-click camera drag is + # still held. Stop that drag before recording a return mode, then restore + # normal camera availability so right-click continues to work while drawing. + _stop_camera_drag_for_art_kit() + _prior_mouse_mode = _get_restorable_mouse_mode(Input.mouse_mode) Input.mouse_mode = Input.MOUSE_MODE_VISIBLE _update_aim() _refresh_stencil_visibility() @@ -244,18 +266,39 @@ func deactivate() -> void: return _active = false _placing_grid = false + _clear_stamp_mode() _eraser_mode = false _clear_armed_guide_action(false) _camera_look_active = false + # Do not leave a drag captured when drawing is closed by a menu, hotbar + # change, or session transition. The next camera drag must start on a fresh + # physical right-click press. + _stop_camera_drag_for_art_kit() _reset_stroke() _selected_canvas_id = "" + _hovered_canvas_id = "" + _last_hovered_canvas_id = "" _aim_hit.clear() _hide_previews() _refresh_stencil_visibility() - Input.mouse_mode = _prior_mouse_mode + Input.mouse_mode = _get_restorable_mouse_mode(_prior_mouse_mode) _emit_hud_state("") +func _stop_camera_drag_for_art_kit() -> void: + if _local_player == null or not is_instance_valid(_local_player): + return + var camera_input_enabled: bool = _local_player.is_camera_input_enabled() + _local_player.set_camera_input_enabled(false) + _local_player.set_camera_input_enabled(camera_input_enabled) + + +func _get_restorable_mouse_mode(mouse_mode: Input.MouseMode) -> Input.MouseMode: + if mouse_mode == Input.MOUSE_MODE_CAPTURED: + return Input.MOUSE_MODE_VISIBLE + return mouse_mode + + func is_active() -> bool: return _active @@ -281,6 +324,7 @@ func set_color_id(color_id: StringName) -> bool: if color_index < 0: return false _clear_armed_guide_action(true) + _clear_stamp_mode() _eraser_mode = false _color_index = color_index _reset_stroke() @@ -292,6 +336,7 @@ func set_eraser_mode(enabled: bool) -> void: if not _active: return _clear_armed_guide_action(true) + _clear_stamp_mode() _eraser_mode = enabled if _eraser_mode and _placing_grid: _placing_grid = false @@ -318,6 +363,7 @@ func arm_guide_action(action: int) -> bool: if _armed_guide_action == GuideAction.NONE: _armed_return_placement_mode = _placing_grid _armed_return_eraser_mode = _eraser_mode + _clear_stamp_mode() _armed_guide_action = action _placing_grid = true _eraser_mode = false @@ -349,6 +395,7 @@ func set_grid_size(value: int) -> bool: return false if _grid_size == value: return true + _clear_stamp_mode() _grid_size = value _rebuild_placement_preview() _update_previews() @@ -476,6 +523,28 @@ func _peer_can_place_grid(peer_id: int, grid_size: int) -> bool: ) +func _peer_can_stamp(peer_id: int, request: Dictionary) -> bool: + var entitlement: Dictionary = _peer_entitlement(peer_id) + var unlock_mask: int = int(entitlement.get("unlock_mask", 0)) + if ( + not bool(entitlement.get("has_kit", false)) + or not _mask_owns_product( + unlock_mask, PlayerArtUnlocks.STAMP_PRODUCT_ID + ) + or not _mask_unlocks_grid(unlock_mask, int(request["width"])) + ): + return false + var palette_ids: Array[StringName] = SurfaceDrawingPalette.get_color_ids() + var pixels: PackedByteArray = request["pixels"] + for palette_index: int in pixels: + if palette_index <= 0: + continue + var color_id: StringName = palette_ids[palette_index - 1] + if not _mask_unlocks_color(unlock_mask, color_id): + return false + return true + + func _peer_can_edit(peer_id: int, request: Dictionary) -> bool: var entitlement: Dictionary = _peer_entitlement(peer_id) if not bool(entitlement.get("has_kit", false)): @@ -564,6 +633,42 @@ func request_canvas_at_surface( return true +func request_stamp_at_surface( + origin: Vector3, + normal: Vector3, + tangent: Vector3, +) -> bool: + if ( + not can_activate() + or not _stamp_mode + or _stamp_pixels.size() != _grid_size * _grid_size + or _art_unlocks == null + or not _art_unlocks.is_stamp_unlocked() + or not _art_unlocks.is_grid_size_unlocked(_grid_size) + or normal.is_zero_approx() + or tangent.is_zero_approx() + ): + return false + var data: Dictionary = { + "request_id": _new_request_id("stamp"), + "session_id": _session.get_session_id(), + "origin": SurfaceDrawingProtocol.vector_to_array(origin), + "normal": SurfaceDrawingProtocol.vector_to_array(normal.normalized()), + "tangent": SurfaceDrawingProtocol.vector_to_array(tangent.normalized()), + "width": _grid_size, + "height": _grid_size, + "cell_size": SurfaceDrawingProtocol.CELL_SIZE, + "pixels": _stamp_pixels, + } + if not SurfaceDrawingProtocol.validate_stamp_request(data): + return false + if _session.is_host(): + _handle_stamp_request(_session.get_local_peer_id(), data) + else: + submit_stamp_request.rpc_id(1, data) + return true + + func request_cell_edits( canvas_id: String, edits: Array[Dictionary], @@ -670,6 +775,29 @@ func clear_session_artwork() -> bool: return true +func clear_artwork_by_fingerprint(fingerprint: String) -> int: + if ( + not _drawing_available() + or not _session.is_host() + or not NetworkIdentityCrypto.valid_fingerprint(fingerprint) + ): + return -1 + var affected_layers: int = _apply_artwork_fingerprint_clear(fingerprint) + for peer_id: int in _session.get_authenticated_peer_ids(): + if ( + peer_id != _session.get_local_peer_id() + and _session.peer_supports_capability( + peer_id, SurfaceDrawingProtocol.CAPABILITY + ) + ): + receive_artwork_fingerprint_clear.rpc_id( + peer_id, + _session.get_session_id(), + fingerprint, + ) + return affected_layers + + func get_canvas_ids() -> Array[String]: var result: Array[String] = [] for canvas_id: String in _canvas_states: @@ -682,6 +810,224 @@ func get_canvas_state(canvas_id: String) -> Dictionary: return Dictionary(_canvas_states.get(canvas_id, {})).duplicate(true) +func is_stamp_mode() -> bool: + return _stamp_mode + + +func get_saved_stamp_entries() -> Array[Dictionary]: + var result: Array[Dictionary] = [] + var directory: String = _artwork_directory() + if directory.is_empty() or not DirAccess.dir_exists_absolute(directory): + return result + var file_names: PackedStringArray = DirAccess.get_files_at(directory) + file_names.sort() + file_names.reverse() + for file_name: String in file_names: + if file_name.get_extension().to_lower() != "png": + continue + var entry: Dictionary = _decode_stamp_file( + directory.path_join(file_name) + ) + if entry.is_empty(): + continue + entry["available"] = _stamp_entry_is_unlocked(entry) + result.append(entry) + if result.size() >= 64: + break + return result + + +func select_saved_stamp(path: String) -> bool: + if ( + not _active + or _art_unlocks == null + or not _art_unlocks.is_stamp_unlocked() + ): + _emit_hud_state("unlock the stamp tool in Art Supplies") + return false + var entry: Dictionary = _decode_stamp_file(path) + if entry.is_empty(): + _emit_hud_state("this artwork PNG cannot be used as a stamp") + return false + if not _stamp_entry_is_unlocked(entry): + _emit_hud_state("this stamp uses an art supply that is still locked") + return false + _clear_armed_guide_action(true) + _stamp_path = str(entry["path"]) + _stamp_pixels = entry["pixels"] + _stamp_image = entry["image"] + _stamp_mode = true + _placing_grid = true + _eraser_mode = false + _grid_size = int(entry["grid_size"]) + _reset_stroke() + _selected_canvas_id = "" + _rebuild_placement_preview() + _rebuild_stamp_preview() + _update_aim() + _refresh_stencil_visibility() + _emit_hud_state( + "stamp selected • click a solid surface to place finalized artwork" + ) + return true + + +func export_aimed_canvas() -> String: + _update_aim() + var canvas_id: String = ( + _hovered_canvas_id + if not _hovered_canvas_id.is_empty() + else _last_hovered_canvas_id + ) + var canvas: SurfaceDrawingCanvas = _canvas_nodes.get(canvas_id) + if ( + canvas_id.is_empty() + or canvas == null + or not is_instance_valid(canvas) + or canvas.is_hidden_by_relationship() + ): + _last_hovered_canvas_id = "" + _emit_hud_state("aim at artwork before exporting") + return "" + return export_canvas_png(canvas_id) + + +func export_canvas_png(canvas_id: String) -> String: + var canvas: SurfaceDrawingCanvas = _canvas_nodes.get(canvas_id) + if canvas == null or not is_instance_valid(canvas): + _emit_hud_state("artwork is no longer available") + return "" + if canvas.get_rendered_pixel_count() <= 0: + _emit_hud_state("paint something before exporting") + return "" + if _data_root == null or _data_root.root_path.is_empty(): + _emit_hud_state("choose a straywild data folder before exporting") + return "" + var export_directory: String = _artwork_directory() + if DirAccess.make_dir_recursive_absolute(export_directory) != OK: + _emit_hud_state("the artwork folder could not be created") + return "" + var image: Image = canvas.get_export_image() + if image == null or image.is_empty(): + _emit_hud_state("the artwork image could not be prepared") + return "" + var export_path: String = _next_artwork_export_path(export_directory) + if image.save_png(export_path) != OK: + _emit_hud_state("the artwork PNG could not be saved") + return "" + print("Art Kit artwork exported: ", export_path) + _emit_hud_state("artwork exported to the data folder • artwork") + return export_path + + +func _artwork_directory() -> String: + if _data_root == null or _data_root.root_path.is_empty(): + return "" + return _data_root.root_path.path_join(ARTWORK_DIRECTORY_NAME) + + +func _decode_stamp_file(path: String) -> Dictionary: + var directory: String = _artwork_directory() + if directory.is_empty(): + return {} + var normalized_directory: String = directory.simplify_path().trim_suffix( + "/" + ) + var normalized_path: String = path.simplify_path() + if not normalized_path.begins_with(normalized_directory + "/"): + return {} + if normalized_path.get_extension().to_lower() != "png": + return {} + var image: Image = Image.load_from_file(normalized_path) + if image == null or image.is_empty(): + return {} + if ( + image.get_width() != image.get_height() + or image.get_width() not in SurfaceDrawingProtocol.GRID_SIZES + ): + return {} + if image.is_compressed() and image.decompress() != OK: + return {} + image.convert(Image.FORMAT_RGBA8) + var grid_size: int = image.get_width() + var pixels := PackedByteArray() + pixels.resize(grid_size * grid_size) + var used_color_ids: Array[StringName] = [] + var painted_count: int = 0 + for cell_y: int in range(grid_size): + var image_y: int = grid_size - 1 - cell_y + for x: int in range(grid_size): + var color: Color = image.get_pixel(x, image_y) + var palette_index: int = 0 + if color.a >= STAMP_ALPHA_THRESHOLD: + palette_index = _stamp_palette_index(color) + if palette_index <= 0: + return {} + painted_count += 1 + var color_id: StringName = SurfaceDrawingPalette.get_color_ids()[ + palette_index - 1 + ] + if color_id not in used_color_ids: + used_color_ids.append(color_id) + pixels[cell_y * grid_size + x] = palette_index + if painted_count <= 0: + return {} + return { + "path": normalized_path, + "file_name": normalized_path.get_file(), + "grid_size": grid_size, + "painted_count": painted_count, + "used_color_ids": used_color_ids, + "pixels": pixels, + "image": image, + } + + +func _stamp_palette_index(color: Color) -> int: + var palette_ids: Array[StringName] = SurfaceDrawingPalette.get_color_ids() + for index: int in range(palette_ids.size()): + var palette_color: Color = SurfaceDrawingPalette.get_color( + palette_ids[index] + ) + var difference := Vector3( + color.r - palette_color.r, + color.g - palette_color.g, + color.b - palette_color.b, + ) + if difference.length() <= STAMP_COLOR_TOLERANCE: + return index + 1 + return 0 + + +func _stamp_entry_is_unlocked(entry: Dictionary) -> bool: + if _art_unlocks == null or not _art_unlocks.is_stamp_unlocked(): + return false + if not _art_unlocks.is_grid_size_unlocked(int(entry.get("grid_size", 0))): + return false + for color_id: StringName in entry.get("used_color_ids", []): + if not _art_unlocks.is_color_unlocked(color_id): + return false + return true + + +func _next_artwork_export_path(directory: String) -> String: + var date_time: Dictionary = Time.get_datetime_dict_from_system() + var stem: String = "straywild-artwork-%04d%02d%02d-%02d%02d%02d" % [ + int(date_time.get("year", 0)), + int(date_time.get("month", 0)), + int(date_time.get("day", 0)), + int(date_time.get("hour", 0)), + int(date_time.get("minute", 0)), + int(date_time.get("second", 0)), + ] + var candidate: String = directory.path_join(stem + ".png") + var suffix: int = 2 + while FileAccess.file_exists(candidate): + candidate = directory.path_join("%s-%d.png" % [stem, suffix]) + suffix += 1 + return candidate + + func _process(_delta: float) -> void: if not _active: return @@ -714,26 +1060,55 @@ func _update_aim() -> void: _aim_hit = _raycast_from_pointer() var previous_canvas_id: String = _selected_canvas_id var found_canvas_id: String = "" + var found_hovered_canvas_id: String = "" var nearest_plane_distance: float = INF + var nearest_hovered_plane_distance: float = INF + var selected_layer: int = -1 + var hovered_layer: int = -1 if not _aim_hit.is_empty(): var hit_position: Vector3 = _aim_hit["position"] for canvas_id: String in _canvas_nodes: var canvas: SurfaceDrawingCanvas = _canvas_nodes[canvas_id] - if canvas.is_finalized(): + if canvas.is_hidden_by_relationship(): continue var plane_distance: float = canvas.get_surface_plane_distance( hit_position ) + if not canvas.contains_world_point( + hit_position, + SurfaceDrawingCanvas.SURFACE_SAMPLE_DEPTH + 0.05, + ): + continue + var state: Dictionary = _canvas_states.get(canvas_id, {}) + var layer: int = int(state.get("layer", 0)) if ( - canvas.contains_world_point( - hit_position, - SurfaceDrawingCanvas.SURFACE_SAMPLE_DEPTH + 0.05, + plane_distance < nearest_hovered_plane_distance + or ( + is_equal_approx( + plane_distance, nearest_hovered_plane_distance + ) + and layer > hovered_layer + ) + ): + found_hovered_canvas_id = canvas_id + nearest_hovered_plane_distance = plane_distance + hovered_layer = layer + if canvas.is_finalized(): + continue + if ( + plane_distance < nearest_plane_distance + or ( + is_equal_approx(plane_distance, nearest_plane_distance) + and layer > selected_layer ) - and plane_distance < nearest_plane_distance ): found_canvas_id = canvas_id nearest_plane_distance = plane_distance + selected_layer = layer _selected_canvas_id = found_canvas_id + _hovered_canvas_id = found_hovered_canvas_id + if not _hovered_canvas_id.is_empty(): + _last_hovered_canvas_id = _hovered_canvas_id if previous_canvas_id != _selected_canvas_id: _reset_stroke() _update_previews() @@ -771,6 +1146,8 @@ func _update_previews() -> void: return if _placement_preview != null: _placement_preview.hide() + if _stamp_preview != null: + _stamp_preview.hide() _update_brush_preview() @@ -778,6 +1155,8 @@ func _update_placement_preview() -> void: if _placement_preview == null or _aim_hit.is_empty(): if _placement_preview != null: _placement_preview.hide() + if _stamp_preview != null: + _stamp_preview.hide() return var placement: Dictionary = _resolved_placement() var normal: Vector3 = placement["normal"] @@ -788,6 +1167,11 @@ func _update_placement_preview() -> void: Basis(tangent, bitangent, normal), hit_position + normal * GRID_PREVIEW_SURFACE_OFFSET, ) + if _stamp_preview != null: + _stamp_preview.global_transform = Transform3D( + Basis(tangent, bitangent, normal), + hit_position + normal * (GRID_PREVIEW_SURFACE_OFFSET + 0.001), + ) if _placement_preview_material != null: _placement_preview_material.albedo_color = ( Color(0.34, 1.0, 0.72, 0.88) @@ -795,6 +1179,8 @@ func _update_placement_preview() -> void: else Color(0.46, 0.91, 0.95, 0.72) ) _placement_preview.show() + if _stamp_preview != null: + _stamp_preview.visible = _stamp_mode func _update_brush_preview() -> void: @@ -841,6 +1227,8 @@ func _hide_previews() -> void: _hide_brush_preview() if _placement_preview != null: _placement_preview.hide() + if _stamp_preview != null: + _stamp_preview.hide() func _resolved_placement() -> Dictionary: @@ -889,6 +1277,20 @@ func _request_canvas_at_aim() -> void: ) +func _request_stamp_at_aim() -> void: + if _aim_hit.is_empty(): + _emit_hud_state("aim at a solid surface before placing a stamp") + return + var placement: Dictionary = _resolved_placement() + var normal: Vector3 = placement["normal"] + var origin: Vector3 = placement["origin"] + if _overlaps_existing_canvas(origin, normal, _grid_size): + _emit_hud_state("an active shared grid already covers this area") + return + if request_stamp_at_surface(origin, normal, placement["tangent"]): + _emit_hud_state("placing finalized stamp...") + + @rpc( "any_peer", "call_remote", @@ -969,6 +1371,7 @@ func _handle_canvas_request(peer_id: int, data: Dictionary) -> void: "finalized": false, "layer": _canvas_sequence, "creator_fingerprint": record.identity_fingerprint, + "participant_fingerprints": [record.identity_fingerprint], "cells": [], } _apply_canvas_state(state) @@ -976,6 +1379,117 @@ func _handle_canvas_request(peer_id: int, data: Dictionary) -> void: _emit_hud_state("shared grid placed • everyone can draw here") +@rpc( + "any_peer", + "call_remote", + "reliable", + SurfaceDrawingProtocol.RELIABLE_CHANNEL, +) +func submit_stamp_request(data: Dictionary) -> void: + var sender_id: int = multiplayer.get_remote_sender_id() + if _session.is_host() and _session.is_authenticated_peer(sender_id): + _handle_stamp_request(sender_id, data) + + +func _handle_stamp_request(peer_id: int, data: Dictionary) -> void: + var requested_size: int = int(data.get("width", 0)) + if ( + not _session.is_host() + or not SurfaceDrawingProtocol.validate_stamp_request(data) + or str(data["session_id"]) != _session.get_session_id() + or not _accept_request(peer_id, str(data["request_id"])) + or not _peer_can_stamp(peer_id, data) + or _canvas_states.size() >= SurfaceDrawingProtocol.MAX_CANVASES + or _allocated_grid_cells() + requested_size * requested_size + > SurfaceDrawingProtocol.MAX_SESSION_GRID_CELLS + ): + return + var avatar: Player = _spawn_service.get_avatar(peer_id) + var requested_origin: Vector3 = SurfaceDrawingProtocol.array_to_vector( + data["origin"] + ) + if ( + avatar == null + or avatar.global_position.distance_to(requested_origin) + > MAX_DRAW_DISTANCE + 2.0 + ): + return + var requested_normal: Vector3 = SurfaceDrawingProtocol.array_to_vector( + data["normal"] + ).normalized() + var surface_hit: Dictionary = _validate_surface( + requested_origin, requested_normal + ) + if surface_hit.is_empty(): + return + var normal: Vector3 = _normalized_or( + surface_hit.get("normal", requested_normal), requested_normal + ) + if _overlaps_existing_canvas( + surface_hit["position"], normal, requested_size + ): + return + var tangent: Vector3 = SurfaceDrawingProtocol.array_to_vector( + data["tangent"] + ) + tangent = (tangent - normal * tangent.dot(normal)).normalized() + if tangent.is_zero_approx(): + tangent = _surface_tangent(normal) + var record: PeerRegistry.PeerRecord = _session.get_peer_record(peer_id) + if record == null or not record.identity_authenticated: + return + _canvas_sequence += 1 + var canvas_id: String = "%s-%d" % [ + _session.get_session_id().left(16), _canvas_sequence, + ] + var state: Dictionary = { + "session_id": _session.get_session_id(), + "canvas_id": canvas_id, + "origin": SurfaceDrawingProtocol.vector_to_array( + surface_hit["position"] + ), + "normal": SurfaceDrawingProtocol.vector_to_array(normal), + "tangent": SurfaceDrawingProtocol.vector_to_array(tangent), + "width": requested_size, + "height": requested_size, + "cell_size": SurfaceDrawingProtocol.CELL_SIZE, + "revision": 1, + "guide_visible": false, + "finalized": true, + "layer": _canvas_sequence, + "creator_fingerprint": record.identity_fingerprint, + "participant_fingerprints": [record.identity_fingerprint], + "cells": _stamp_cells( + data["pixels"], requested_size, record.identity_fingerprint + ), + "stamp": true, + } + _apply_canvas_state(state) + _broadcast_canvas_state(state) + _emit_hud_state("stamp placed • finalized artwork shared with everyone") + + +func _stamp_cells( + pixels: PackedByteArray, + grid_size: int, + author_fingerprint: String, +) -> Array[Dictionary]: + var result: Array[Dictionary] = [] + var palette_ids: Array[StringName] = SurfaceDrawingPalette.get_color_ids() + for cell_key: int in range(pixels.size()): + var palette_index: int = pixels[cell_key] + if palette_index <= 0: + continue + var cell_y: int = floori(float(cell_key) / float(grid_size)) + result.append({ + "x": cell_key % grid_size, + "y": cell_y, + "color_id": str(palette_ids[palette_index - 1]), + "author_fingerprint": author_fingerprint, + }) + return result + + @rpc( "any_peer", "call_remote", @@ -1000,7 +1514,13 @@ func _handle_guide_request(peer_id: int, data: Dictionary) -> void: var canvas_id: String = str(data["canvas_id"]) var state: Dictionary = _canvas_states.get(canvas_id, {}) var avatar: Player = _spawn_service.get_avatar(peer_id) - if state.is_empty() or avatar == null: + var record: PeerRegistry.PeerRecord = _session.get_peer_record(peer_id) + if ( + state.is_empty() + or avatar == null + or record == null + or not record.identity_authenticated + ): return var origin: Vector3 = SurfaceDrawingProtocol.array_to_vector(state["origin"]) if avatar.global_position.distance_to(origin) > MAX_DRAW_DISTANCE + 2.0: @@ -1015,6 +1535,11 @@ func _handle_guide_request(peer_id: int, data: Dictionary) -> void: and was_finalized == finalized ): return + if not _register_canvas_participant( + canvas_id, record.identity_fingerprint + ): + return + state = _canvas_states.get(canvas_id, {}) state["revision"] = int(state["revision"]) + 1 state["guide_visible"] = guide_visible state["finalized"] = finalized @@ -1025,6 +1550,9 @@ func _handle_guide_request(peer_id: int, data: Dictionary) -> void: "revision": int(state["revision"]), "guide_visible": guide_visible, "finalized": finalized, + "participant_fingerprints": state.get( + "participant_fingerprints", [] + ), } var canvas: SurfaceDrawingCanvas = _canvas_nodes.get(canvas_id) if canvas != null: @@ -1205,6 +1733,15 @@ func _queue_cell_mutation( var next: Dictionary = _cell_value_from_edit(edit) if _same_cell_value(current, next): return + var record: PeerRegistry.PeerRecord = _session.get_peer_record(peer_id) + if ( + record == null + or not record.identity_authenticated + or not _register_canvas_participant( + canvas_id, record.identity_fingerprint + ) + ): + return _record_stroke_change( peer_id, stroke_id, canvas_id, x, y, current, next ) @@ -1346,12 +1883,18 @@ func _publish_cell_mutations( continue state["revision"] = int(state["revision"]) + 1 state["cells"] = _sorted_cells(cells) + state["participant_fingerprints"] = _merged_participants( + state, {"edits": edits} + ) _canvas_states[canvas_id] = state var update: Dictionary = { "session_id": _session.get_session_id(), "canvas_id": canvas_id, "revision": int(state["revision"]), "edits": edits, + "participant_fingerprints": state.get( + "participant_fingerprints", [] + ), } var local_canvas: SurfaceDrawingCanvas = _canvas_nodes.get(canvas_id) if local_canvas != null: @@ -1489,6 +2032,23 @@ func receive_session_artwork_reset(session_id: String) -> void: _clear_session_artwork_state() +@rpc( + "authority", + "call_remote", + "reliable", + SurfaceDrawingProtocol.RELIABLE_CHANNEL, +) +func receive_artwork_fingerprint_clear( + session_id: String, + fingerprint: String, +) -> void: + if ( + session_id == _session.get_session_id() + and NetworkIdentityCrypto.valid_fingerprint(fingerprint) + ): + _apply_artwork_fingerprint_clear(fingerprint) + + @rpc( "any_peer", "call_remote", @@ -1525,7 +2085,28 @@ func _apply_canvas_state(data: Dictionary) -> void: and int(data["revision"]) <= int(previous_state["revision"]) ): return - _canvas_states[canvas_id] = data.duplicate(true) + var normalized_state: Dictionary = data.duplicate(true) + normalized_state["participant_fingerprints"] = _state_participants( + normalized_state + ) + _canvas_states[canvas_id] = normalized_state + _rebuild_canvas_node(normalized_state) + _refresh_stencil_visibility() + _emit_artwork_changed() + if ( + _active + and str(normalized_state.get("creator_fingerprint", "")) + == _session.get_local_identity_fingerprint() + ): + _emit_hud_state( + "stamp placed • move and click to place another" + if bool(normalized_state.get("stamp", false)) + else "shared grid placed • move and click to place another" + ) + + +func _rebuild_canvas_node(data: Dictionary) -> void: + var canvas_id: String = str(data["canvas_id"]) var previous_canvas: SurfaceDrawingCanvas = _canvas_nodes.get(canvas_id) if previous_canvas != null: previous_canvas.queue_free() @@ -1536,14 +2117,6 @@ func _apply_canvas_state(data: Dictionary) -> void: canvas.queue_free() return _canvas_nodes[canvas_id] = canvas - _refresh_stencil_visibility() - _emit_artwork_changed() - if ( - _active - and str(data.get("creator_fingerprint", "")) - == _session.get_local_identity_fingerprint() - ): - _emit_hud_state("shared grid placed • move and click to place another") func _apply_canvas_update(data: Dictionary) -> void: @@ -1575,6 +2148,9 @@ func _apply_canvas_update(data: Dictionary) -> void: cells[key] = edit.duplicate(true) state["revision"] = int(data["revision"]) state["cells"] = _sorted_cells(cells) + state["participant_fingerprints"] = _merged_participants( + state, data + ) _canvas_states[canvas_id] = state canvas.apply_update(data) _emit_artwork_changed() @@ -1600,6 +2176,9 @@ func _apply_guide_update(data: Dictionary) -> void: state["guide_visible"] = ( bool(data["guide_visible"]) and not bool(data["finalized"]) ) + state["participant_fingerprints"] = _merged_participants( + state, data + ) _canvas_states[canvas_id] = state canvas.apply_guide_update(data) if _active: @@ -1834,10 +2413,46 @@ func _rebuild_placement_preview() -> void: _drawing_root.add_child(_placement_preview) +func _rebuild_stamp_preview() -> void: + if _stamp_preview != null: + _stamp_preview.queue_free() + _stamp_preview = null + _stamp_preview_material = null + if ( + _drawing_root == null + or not _stamp_mode + or _stamp_image == null + or _stamp_image.is_empty() + ): + return + var quad := QuadMesh.new() + quad.size = Vector2.ONE * ( + float(_grid_size) * SurfaceDrawingProtocol.CELL_SIZE + ) + _stamp_preview_material = StandardMaterial3D.new() + _stamp_preview_material.shading_mode = BaseMaterial3D.SHADING_MODE_UNSHADED + _stamp_preview_material.transparency = BaseMaterial3D.TRANSPARENCY_ALPHA + _stamp_preview_material.texture_filter = BaseMaterial3D.TEXTURE_FILTER_NEAREST + _stamp_preview_material.cull_mode = BaseMaterial3D.CULL_DISABLED + _stamp_preview_material.albedo_color = Color(1.0, 1.0, 1.0, 0.72) + _stamp_preview_material.albedo_texture = ImageTexture.create_from_image( + _stamp_image + ) + quad.material = _stamp_preview_material + _stamp_preview = MeshInstance3D.new() + _stamp_preview.name = "ArtworkStampPlacementPreview" + _stamp_preview.mesh = quad + _stamp_preview.cast_shadow = GeometryInstance3D.SHADOW_CASTING_SETTING_OFF + _stamp_preview.hide() + _drawing_root.add_child(_stamp_preview) + + func _set_placement_mode(enabled: bool) -> void: if not _active: return _clear_armed_guide_action(true) + if _stamp_mode: + _clear_stamp_mode() if _placing_grid == enabled: _emit_hud_state("") return @@ -1855,6 +2470,17 @@ func _set_placement_mode(enabled: bool) -> void: ) +func _clear_stamp_mode() -> void: + _stamp_mode = false + _stamp_path = "" + _stamp_pixels = PackedByteArray() + _stamp_image = null + if _stamp_preview != null: + _stamp_preview.queue_free() + _stamp_preview = null + _stamp_preview_material = null + + func _execute_armed_guide_action() -> void: var action: int = _armed_guide_action match action: @@ -2013,7 +2639,11 @@ func _current_color() -> Color: func _emit_hud_state(status: String) -> void: hud_state_changed.emit( _active, - "place grid" if _placing_grid else "marker", + ( + "stamp" + if _stamp_mode + else "place grid" if _placing_grid else "marker" + ), SurfaceDrawingPalette.get_display_name(_current_color_id()), _current_color(), _brush_size, @@ -2074,6 +2704,68 @@ func _state_cell(state: Dictionary, x: int, y: int) -> Dictionary: ).duplicate(true) +func _register_canvas_participant( + canvas_id: String, + fingerprint: String, +) -> bool: + if not NetworkIdentityCrypto.valid_fingerprint(fingerprint): + return false + var state: Dictionary = _canvas_states.get(canvas_id, {}) + if state.is_empty(): + return false + var participants: Array[String] = _state_participants(state) + if fingerprint in participants: + return true + if participants.size() >= SurfaceDrawingProtocol.MAX_PARTICIPANTS: + return false + participants.append(fingerprint) + state["participant_fingerprints"] = participants + _canvas_states[canvas_id] = state + return true + + +func _merged_participants( + state: Dictionary, + update: Dictionary, +) -> Array[String]: + var result: Array[String] = _state_participants(state) + for value: Variant in update.get("participant_fingerprints", []): + _append_participant(result, str(value)) + for edit_value: Variant in update.get("edits", []): + var edit: Dictionary = edit_value + _append_participant( + result, str(edit.get("author_fingerprint", "")) + ) + return result + + +func _state_participants(state: Dictionary) -> Array[String]: + var result: Array[String] = [] + _append_participant( + result, str(state.get("creator_fingerprint", "")) + ) + for value: Variant in state.get("participant_fingerprints", []): + _append_participant(result, str(value)) + for cell_value: Variant in state.get("cells", []): + var cell: Dictionary = cell_value + _append_participant( + result, str(cell.get("author_fingerprint", "")) + ) + return result + + +func _append_participant( + participants: Array[String], + fingerprint: String, +) -> void: + if ( + NetworkIdentityCrypto.valid_fingerprint(fingerprint) + and fingerprint not in participants + and participants.size() < SurfaceDrawingProtocol.MAX_PARTICIPANTS + ): + participants.append(fingerprint) + + func _cell_value_from_edit(edit: Dictionary) -> Dictionary: if edit.is_empty() or str(edit.get("color_id", "")).is_empty(): return {} @@ -2211,6 +2903,8 @@ func _clear_session_artwork_state() -> void: _canvas_nodes.clear() _canvas_sequence = 0 _selected_canvas_id = "" + _hovered_canvas_id = "" + _last_hovered_canvas_id = "" _stroke_history_by_peer.clear() _cell_last_stroke.clear() _last_local_stroke_id = "" @@ -2218,6 +2912,38 @@ func _clear_session_artwork_state() -> void: _emit_artwork_changed() +func _apply_artwork_fingerprint_clear(fingerprint: String) -> int: + var affected_canvas_ids: Array[String] = [] + for canvas_id: String in _canvas_states: + var state: Dictionary = _canvas_states[canvas_id] + if fingerprint in _state_participants(state): + affected_canvas_ids.append(canvas_id) + if affected_canvas_ids.is_empty(): + return 0 + for canvas_id: String in affected_canvas_ids: + _remove_canvas_state(canvas_id) + _stroke_history_by_peer.clear() + _cell_last_stroke.clear() + _last_local_stroke_id = "" + _hide_previews() + _emit_artwork_changed() + return affected_canvas_ids.size() + + +func _remove_canvas_state(canvas_id: String) -> void: + _canvas_states.erase(canvas_id) + var canvas: SurfaceDrawingCanvas = _canvas_nodes.get(canvas_id) + if canvas != null: + canvas.queue_free() + _canvas_nodes.erase(canvas_id) + if _selected_canvas_id == canvas_id: + _selected_canvas_id = "" + if _hovered_canvas_id == canvas_id: + _hovered_canvas_id = "" + if _last_hovered_canvas_id == canvas_id: + _last_hovered_canvas_id = "" + + func _emit_artwork_changed() -> void: session_artwork_changed.emit( get_canvas_count(), get_painted_cell_count() diff --git a/network/network_transport.gd b/network/network_transport.gd index ce68172..5aed6ca 100644 --- a/network/network_transport.gd +++ b/network/network_transport.gd @@ -22,6 +22,25 @@ func connect_to_route(_route: ConnectionRoute) -> Error: func disconnect_transport() -> void: if _peer != null: + # Give ENet one poll cycle to emit its graceful disconnect packets before + # closing the socket. This keeps a host from retaining a departed player + # until the extended generated-world liveness timeout expires. + if ( + _peer is ENetMultiplayerPeer + and _peer.get_connection_status() + == MultiplayerPeer.CONNECTION_CONNECTED + ): + var enet_peer := _peer as ENetMultiplayerPeer + # A host explicitly notifies each still-live client before closing. + # Clients rely on ENetMultiplayerPeer.close(); their cached SceneTree + # peer list can briefly outlive the underlying ENet peer after a remote + # disconnect, making disconnect_peer() race and report an engine error. + if enet_peer.get_unique_id() == 1: + for peer_id: int in multiplayer.get_peers(): + if enet_peer.get_peer(peer_id) != null: + enet_peer.disconnect_peer(peer_id, false) + if enet_peer.host != null: + enet_peer.host.flush() _peer.close() _peer = null _route_description = "" diff --git a/network/network_world_spawn_protocol.gd b/network/network_world_spawn_protocol.gd index 4d0a55d..4bd15b0 100644 --- a/network/network_world_spawn_protocol.gd +++ b/network/network_world_spawn_protocol.gd @@ -3,8 +3,8 @@ extends RefCounted const CAPABILITY: StringName = &"world_spawn_envelope_v1" const ENVELOPE_VERSION: int = 1 -const RELIABLE_CHANNEL: int = NetworkProtocol.ITEM_RELIABLE_CHANNEL -const SNAPSHOT_CHANNEL: int = 4 +const RELIABLE_CHANNEL: int = NetworkProtocol.WORLD_SPAWN_RELIABLE_CHANNEL +const SNAPSHOT_CHANNEL: int = 15 const MAX_SESSION_ID_LENGTH: int = 96 const MAX_EVENT_ID_LENGTH: int = 48 const MAX_ENTITY_ID_LENGTH: int = 128 diff --git a/network/network_world_spawn_service.gd b/network/network_world_spawn_service.gd index 35f7eba..a45ad37 100644 --- a/network/network_world_spawn_service.gd +++ b/network/network_world_spawn_service.gd @@ -11,11 +11,14 @@ const GatherableCatalogType = preload("res://gathering/gatherable_catalog.gd") const GatherableDataType = preload("res://gathering/gatherable_data.gd") const WorldGatherableType = preload("res://gathering/world_gatherable.gd") const TestWorldType = preload("res://world/test_world.gd") +const CalendarSeasonType = preload("res://world/calendar_season.gd") signal local_capture_received(fish_catch: FishCatch) signal local_interaction_finished(accepted: bool, message: String) -const SNAPSHOT_INTERVAL_SECONDS: float = 0.2 +const SIMULATION_INTERVAL_SECONDS: float = 1.0 / 15.0 +const SNAPSHOT_INTERVAL_SECONDS: float = 0.1 +const PLAYER_SPATIAL_CELL_SIZE: float = 8.0 const CAPACITY_RESPONSE_TIMEOUT_SECONDS: float = 3.0 const MAX_REQUEST_ID_LENGTH: int = 128 const MAX_LEDGER_ENTRIES: int = 96 @@ -24,6 +27,7 @@ var _session: NetworkSession var _spawn_service: PlayerSpawnService var _world: TestWorldType var _world_root: Node3D +var _world_time: WorldTimeService var _catalog: GatherableCatalogType var _fish_catalog: FishPoolType var _local_inventory: FishInventory @@ -39,6 +43,7 @@ var _entity_revisions: Dictionary = {} var _surface_triangles: Dictionary = {} var _surface_areas: Dictionary = {} var _surface_total_areas: Dictionary = {} +var _spawn_anchor_positions: Dictionary = {} var _respawns: Array[Dictionary] = [] var _next_respawn_by_type: Dictionary[StringName, float] = {} var _charge_requests: Dictionary = {} @@ -46,8 +51,16 @@ var _pending_captures: Dictionary = {} var _received_results: Dictionary = {} var _showcase_deadlines: Dictionary = {} var _envelope_sequence: int = 0 +var _simulation_elapsed: float = 0.0 var _snapshot_elapsed: float = 0.0 var _population_session_id: String = "" +var _dirty_entity_ids: Dictionary[String, bool] = {} +var _moving_players_by_cell: Dictionary[Vector2i, Array] = {} +var _presentation_enabled: bool = true +var _spawn_events_sent: int = 0 +var _despawn_events_sent: int = 0 +var _snapshot_packets_sent: int = 0 +var _snapshot_states_sent: int = 0 var _rng := RandomNumberGenerator.new() @@ -64,6 +77,8 @@ func setup( local_experience: PlayerExperience, save_manager: PlayerSaveManager, item_use: NetworkItemUseService, + world_time: WorldTimeService = null, + presentation_enabled: bool = true, ) -> void: _session = session _spawn_service = spawn_service @@ -77,10 +92,19 @@ func setup( _local_experience = local_experience _save_manager = save_manager _item_use = item_use + _world_time = world_time + _presentation_enabled = presentation_enabled _rng.randomize() _session.peer_authenticated.connect(_on_peer_authenticated) _session.peer_removed.connect(_on_peer_removed) _session.state_changed.connect(_on_session_state_changed) + if ( + _world_time != null + and not _world_time.calendar_date_changed.is_connected( + _on_calendar_date_changed + ) + ): + _world_time.calendar_date_changed.connect(_on_calendar_date_changed) set_physics_process(true) _begin_population_if_ready.call_deferred() @@ -124,6 +148,7 @@ func finish_local_interaction( "target_position": NetworkWorldSpawnProtocol.vector3_to_array( target_position ), + "movement_sequence": _session.get_latest_movement_input_sequence(), } if _session.is_host(): _handle_interaction_finish(_session.get_local_peer_id(), data) @@ -151,10 +176,9 @@ func find_entity_near( if bool(state.get("locked", false)): continue var entity_position: Vector3 = state.get("position", Vector3.ZERO) - var distance_squared: float = Vector2( - entity_position.x - position.x, - entity_position.z - position.z, - ).length_squared() + var distance_squared: float = entity_position.distance_squared_to( + position + ) if distance_squared <= best_distance_squared: best_distance_squared = distance_squared best_id = entity_id @@ -177,10 +201,9 @@ func find_capture_target( if entry == null or entry.required_tool_id != tool_id: continue var entity_position: Vector3 = state.get("position", Vector3.ZERO) - var distance_squared: float = Vector2( - entity_position.x - position.x, - entity_position.z - position.z, - ).length_squared() + var distance_squared: float = entity_position.distance_squared_to( + position + ) if ( distance_squared <= entry.capture_radius * entry.capture_radius and distance_squared <= best_distance_squared @@ -194,7 +217,9 @@ func get_charge_duration_for_tool(tool_id: StringName) -> float: var duration: float = 0.0 if _catalog == null or tool_id.is_empty(): return duration - for entry: GatherableDataType in _catalog.get_available_entries(): + for entry: GatherableDataType in _catalog.get_available_entries( + _current_season() + ): if entry.required_tool_id == tool_id: duration = maxf(duration, entry.charge_duration) return duration @@ -205,6 +230,13 @@ func get_entry_for_entity(entity_id: String) -> GatherableDataType: return state.get("data") as GatherableDataType +func refresh_world_context() -> void: + _clear_world() + _population_session_id = "" + if _session != null and _session.is_gameplay_session_active(): + _begin_population_if_ready.call_deferred() + + func _physics_process(delta: float) -> void: if ( _session == null @@ -213,11 +245,27 @@ func _physics_process(delta: float) -> void: ): return _begin_population_if_ready() + # There is no gameplay state to advance while a dedicated server has no + # spawned players. Pausing the roaming/respawn loop also prevents idle + # gatherables from producing a continuous stream of snapshots to nobody. + if _spawn_service == null or _spawn_service.get_peer_ids().is_empty(): + _simulation_elapsed = 0.0 + _snapshot_elapsed = 0.0 + return + _simulation_elapsed += delta + _snapshot_elapsed += delta + if _simulation_elapsed < SIMULATION_INTERVAL_SECONDS: + return + var simulation_delta: float = minf(_simulation_elapsed, 0.2) + _simulation_elapsed = fmod( + _simulation_elapsed, + SIMULATION_INTERVAL_SECONDS, + ) _update_pending_capture_timeouts() _update_respawns() _update_showcase_deadlines() - _update_host_entities(delta) - _snapshot_elapsed += delta + _rebuild_moving_player_spatial_index() + _update_host_entities(simulation_delta) if _snapshot_elapsed >= SNAPSHOT_INTERVAL_SECONDS: _snapshot_elapsed = fmod( _snapshot_elapsed, @@ -234,6 +282,7 @@ func _begin_population_if_ready() -> void: or _catalog == null or _world == null or _world_root == null + or not _world.is_world_ready() ): return var session_id: String = _session.get_session_id() @@ -241,21 +290,42 @@ func _begin_population_if_ready() -> void: return _clear_world() _population_session_id = session_id - for entry: GatherableDataType in _catalog.get_available_entries(): + for entry: GatherableDataType in _catalog.get_available_entries( + _current_season() + ): _cache_spawn_surface(entry) - for _spawn_index: int in entry.population: + for _spawn_index: int in _target_population(entry): _spawn_entity(entry) func _cache_spawn_surface(entry: GatherableDataType) -> void: - if entry == null or _surface_triangles.has(entry.type_id): + if ( + entry == null + or _surface_triangles.has(entry.type_id) + or _spawn_anchor_positions.has(entry.type_id) + ): return - var triangles: Array[PackedVector3Array] = ( - _world.get_spawn_surface_triangles( + if not entry.spawn_anchor_set_id.is_empty(): + var anchor_positions: PackedVector3Array = ( + _world.get_gatherable_spawn_positions(entry.spawn_anchor_set_id) + ) + _spawn_anchor_positions[entry.type_id] = anchor_positions + if ( + anchor_positions.is_empty() + and _world.get_world_layout() == WorldLayout.GENERATED + ): + push_warning( + "No gatherable spawn anchors were found for %s." % entry.type_id + ) + return + var triangles: Array[PackedVector3Array] + if not entry.diggable_area_id.is_empty(): + triangles = _world.get_diggable_area_triangles(entry.diggable_area_id) + else: + triangles = _world.get_spawn_surface_triangles( entry.surface_materials, entry.minimum_surface_y, ) - ) var areas := PackedFloat32Array() var total_area: float = 0.0 for triangle: PackedVector3Array in triangles: @@ -269,7 +339,10 @@ func _cache_spawn_surface(entry: GatherableDataType) -> void: _surface_triangles[entry.type_id] = triangles _surface_areas[entry.type_id] = areas _surface_total_areas[entry.type_id] = total_area - if triangles.is_empty(): + if ( + triangles.is_empty() + and _world.get_world_layout() == WorldLayout.GENERATED + ): push_warning( "No valid spawn surface was found for %s." % entry.type_id ) @@ -279,6 +352,11 @@ func _spawn_entity(entry: GatherableDataType) -> void: var position: Vector3 = _sample_surface_position(entry) if not position.is_finite(): return + var target: Vector3 = ( + position + if entry.is_stationary_spawn() + else _sample_surface_position(entry, position, entry.roam_radius) + ) var quality: int = FishQualityType.roll(_rng) var entity_id: String = _new_id("world") var state: Dictionary = { @@ -286,11 +364,16 @@ func _spawn_entity(entry: GatherableDataType) -> void: "type_id": entry.type_id, "data": entry, "position": position, - "target": _sample_surface_position(entry, position, entry.roam_radius), + "target": target, "yaw": _rng.randf_range(-PI, PI), "quality": quality, "revision": 1, "locked": false, + "expires_at": ( + _now() + entry.active_lifetime_seconds + if entry.active_lifetime_seconds > 0.0 + else INF + ), } if not (state["target"] as Vector3).is_finite(): state["target"] = position @@ -301,6 +384,7 @@ func _spawn_entity(entry: GatherableDataType) -> void: ) _apply_envelope(envelope) receive_world_envelope.rpc(envelope) + _spawn_events_sent += 1 func _update_host_entities(delta: float) -> void: @@ -311,6 +395,11 @@ func _update_host_entities(delta: float) -> void: var entry := state.get("data") as GatherableDataType if entry == null: continue + if _now() >= float(state.get("expires_at", INF)): + _despawn_entity(entity_id, &"expired", false, true) + continue + if entry.is_stationary_spawn(): + continue var quality: int = _get_state_quality(state) var position: Vector3 = state["position"] var target: Vector3 = state["target"] @@ -347,9 +436,11 @@ func _update_host_entities(delta: float) -> void: minf(step / maxf(horizontal_delta.length(), 0.001), 1.0), ) state["yaw"] = atan2(-direction.x, -direction.z) + state["revision"] = int(state["revision"]) + 1 + _dirty_entity_ids[entity_id] = true state["position"] = position _entities[entity_id] = state - if _should_scare(entry, position, quality): + if entry.can_be_scared() and _should_scare(entry, position, quality): _despawn_entity(entity_id, &"scared", true, true) @@ -360,6 +451,34 @@ func _should_scare( ) -> bool: var scare_radius: float = entry.get_scare_radius_for_quality(quality) var radius_squared: float = scare_radius * scare_radius + var center_cell := _player_spatial_cell(position) + var cell_radius: int = ceili(scare_radius / PLAYER_SPATIAL_CELL_SIZE) + for cell_x: int in range( + center_cell.x - cell_radius, + center_cell.x + cell_radius + 1, + ): + for cell_y: int in range( + center_cell.y - cell_radius, + center_cell.y + cell_radius + 1, + ): + for value: Variant in _moving_players_by_cell.get( + Vector2i(cell_x, cell_y), + [], + ): + var avatar := value as Player + if avatar == null: + continue + var player_delta := Vector2( + avatar.global_position.x - position.x, + avatar.global_position.z - position.z, + ) + if player_delta.length_squared() <= radius_squared: + return true + return false + + +func _rebuild_moving_player_spatial_index() -> void: + _moving_players_by_cell.clear() for peer_id: int in _spawn_service.get_peer_ids(): var avatar: Player = _spawn_service.get_avatar(peer_id) if ( @@ -368,13 +487,17 @@ func _should_scare( or avatar.is_sneaking() ): continue - var delta := Vector2( - avatar.global_position.x - position.x, - avatar.global_position.z - position.z, - ) - if delta.length_squared() <= radius_squared: - return true - return false + var cell: Vector2i = _player_spatial_cell(avatar.global_position) + var players: Array = _moving_players_by_cell.get(cell, []) + players.append(avatar) + _moving_players_by_cell[cell] = players + + +static func _player_spatial_cell(position: Vector3) -> Vector2i: + return Vector2i( + floori(position.x / PLAYER_SPATIAL_CELL_SIZE), + floori(position.z / PLAYER_SPATIAL_CELL_SIZE), + ) func _sample_surface_position( @@ -383,6 +506,8 @@ func _sample_surface_position( maximum_distance: float = INF, ) -> Vector3: _cache_spawn_surface(entry) + if not entry.spawn_anchor_set_id.is_empty(): + return _sample_anchor_position(entry, origin, maximum_distance) var triangles: Array = _surface_triangles.get(entry.type_id, []) var cumulative_areas: PackedFloat32Array = _surface_areas.get( entry.type_id, @@ -393,7 +518,12 @@ func _sample_surface_position( ) if triangles.is_empty() or total_area <= 0.0: return Vector3(INF, INF, INF) - var attempts: int = 48 if is_finite(maximum_distance) else 1 + var validates_diggable_surface := not entry.diggable_area_id.is_empty() + var attempts: int = ( + 48 + if validates_diggable_surface or is_finite(maximum_distance) + else 1 + ) var fallback: Vector3 = Vector3(INF, INF, INF) for _attempt: int in attempts: var roll: float = _rng.randf() * total_area @@ -409,40 +539,129 @@ func _sample_surface_position( + triangle[2] * barycentric_c ) fallback = point - if ( + var within_requested_distance := ( not is_finite(maximum_distance) or Vector2(point.x - origin.x, point.z - origin.z).length() <= maximum_distance - ): + ) + var valid_diggable_surface := ( + not validates_diggable_surface + or _world.is_diggable_surface_point_valid( + entry.diggable_area_id, + point, + ) + ) + if within_requested_distance and valid_diggable_surface: return point + if validates_diggable_surface: + return Vector3(INF, INF, INF) if origin.is_finite() and is_finite(maximum_distance): return origin return fallback +func _sample_anchor_position( + entry: GatherableDataType, + origin: Vector3, + maximum_distance: float, +) -> Vector3: + var anchors: PackedVector3Array = _spawn_anchor_positions.get( + entry.type_id, + PackedVector3Array(), + ) + var candidates := PackedVector3Array() + for anchor: Vector3 in anchors: + if not anchor.is_finite() or _anchor_is_occupied(entry.type_id, anchor): + continue + if ( + origin.is_finite() + and is_finite(maximum_distance) + and anchor.distance_to(origin) > maximum_distance + ): + continue + candidates.append(anchor) + if candidates.is_empty(): + return Vector3(INF, INF, INF) + return candidates[_rng.randi_range(0, candidates.size() - 1)] + + +func _anchor_is_occupied(type_id: StringName, anchor: Vector3) -> bool: + for state: Dictionary in _entities.values(): + if StringName(state.get("type_id", StringName())) != type_id: + continue + var position: Variant = state.get("position") + if ( + typeof(position) == TYPE_VECTOR3 + and (position as Vector3).distance_squared_to(anchor) <= 0.0001 + ): + return true + return false + + func _broadcast_entity_snapshots() -> void: - if _entities.is_empty(): + if _dirty_entity_ids.is_empty() or not _can_broadcast_snapshots(): return + var has_remote_recipients: bool = _has_authenticated_remote_peers() var snapshots: Array[Dictionary] = [] - for entity_id: String in _entities: - var state: Dictionary = _entities[entity_id] - state["revision"] = int(state["revision"]) + 1 - _entities[entity_id] = state - snapshots.append(_state_to_network(state)) - while not snapshots.is_empty(): + for entity_id: String in _dirty_entity_ids: + var state: Dictionary = _entities.get(entity_id, {}) + if not state.is_empty(): + snapshots.append(_state_to_network(state)) + _dirty_entity_ids.clear() + var maximum_chunk_size: int = ( + NetworkWorldSpawnProtocol.SNAPSHOT_ENTITIES_PER_ENVELOPE + ) + for start_index: int in range( + 0, + snapshots.size(), + maximum_chunk_size, + ): var chunk: Array[Dictionary] = [] - var chunk_size: int = mini( - NetworkWorldSpawnProtocol.SNAPSHOT_ENTITIES_PER_ENVELOPE, - snapshots.size(), - ) - for _index: int in chunk_size: - chunk.append(snapshots.pop_front()) + for value: Dictionary in snapshots.slice( + start_index, + mini(start_index + maximum_chunk_size, snapshots.size()), + ): + chunk.append(value) var envelope: Dictionary = _make_envelope( &"snapshot", {"entities": chunk}, ) _apply_envelope(envelope) + if not has_remote_recipients: + continue + # A peer-disconnected callback can resume validation/gameplay code and + # close the host while this physics update is still unwinding. Never send + # through the replacement OfflineMultiplayerPeer in that narrow window. + if not _can_broadcast_snapshots(): + return receive_world_snapshot_envelope.rpc(envelope) + _snapshot_packets_sent += 1 + _snapshot_states_sent += chunk.size() + + +func _has_authenticated_remote_peers() -> bool: + if _session == null: + return false + var local_peer_id: int = _session.get_local_peer_id() + for peer_id: int in _session.get_authenticated_peer_ids(): + if peer_id != local_peer_id: + return true + return false + + +func _can_broadcast_snapshots() -> bool: + if ( + _session == null + or not _session.is_host() + or not _session.is_gameplay_session_active() + ): + return false + var peer: MultiplayerPeer = multiplayer.multiplayer_peer + return ( + peer != null + and peer.get_connection_status() + == MultiplayerPeer.CONNECTION_CONNECTED + ) func _despawn_entity( @@ -456,6 +675,7 @@ func _despawn_entity( return var entry := state.get("data") as GatherableDataType _entities.erase(entity_id) + _dirty_entity_ids.erase(entity_id) var envelope: Dictionary = _make_envelope( &"despawn", { @@ -466,6 +686,7 @@ func _despawn_entity( ) _apply_envelope(envelope) receive_world_envelope.rpc(envelope) + _despawn_events_sent += 1 if schedule_respawn and entry != null: _respawns.append({ "type_id": entry.type_id, @@ -487,7 +708,7 @@ func _update_respawns() -> void: var entry: GatherableDataType = _catalog.get_entry( type_id ) - if entry != null and entry.is_available(): + if entry != null and entry.is_available(_current_season()): _spawn_entity(entry) _next_respawn_by_type[type_id] = ( now + entry.minimum_respawn_spacing_seconds @@ -515,7 +736,9 @@ func _handle_interaction_begin(peer_id: int, data: Dictionary) -> void: or request_id.length() > MAX_REQUEST_ID_LENGTH or _pending_captures.has(peer_id) ): - _send_interaction_result(peer_id, request_id, false, "Cannot use the net now.") + _send_interaction_result( + peer_id, request_id, false, "Cannot use that gathering tool now." + ) return _charge_requests[peer_id] = { "request_id": request_id, @@ -546,6 +769,7 @@ func _handle_interaction_finish(peer_id: int, data: Dictionary) -> void: var state: Dictionary = _entities.get(entity_id, {}) var entry := state.get("data") as GatherableDataType var avatar: Player = _spawn_service.get_avatar(peer_id) + var movement_sequence_value: Variant = data.get("movement_sequence", null) var error: String = "" if ( str(data.get("session_id", "")) != _session.get_session_id() @@ -553,30 +777,46 @@ func _handle_interaction_finish(peer_id: int, data: Dictionary) -> void: or request_id.length() > MAX_REQUEST_ID_LENGTH or str(charge.get("request_id", "")) != request_id or not target_position.is_finite() + or typeof(movement_sequence_value) != TYPE_INT + or int(movement_sequence_value) < 0 + or int(movement_sequence_value) > 2147483647 ): error = "The catch attempt was invalid." elif state.is_empty() or entry == null or bool(state.get("locked", false)): - error = "That animal is no longer there." + error = "That gathering spot is no longer there." elif _now() - float(charge.get("started", _now())) + 0.05 < entry.charge_duration: - error = "Pull the net all the way back first." + error = "Finish readying the tool first." elif _item_use.get_equipped_item_id(peer_id) != entry.required_tool_id: error = "Equip the correct gathering tool." - elif avatar == null or not avatar.is_sneaking(): - error = "Sneak closer before swinging the net." + elif avatar == null: + error = "The player is unavailable." else: + var movement_state: Dictionary = ( + avatar.get_lag_compensated_movement_state( + int(movement_sequence_value) + ) + ) + if entry.requires_sneaking and not bool( + movement_state.get("sneaking", avatar.is_sneaking()) + ): + error = "Sneak closer before using the tool." + if not error.is_empty(): + _send_interaction_result(peer_id, request_id, false, error) + return var entity_position: Vector3 = state["position"] - var target_distance: float = Vector2( - entity_position.x - target_position.x, - entity_position.z - target_position.z, - ).length() + var target_distance: float = entity_position.distance_to(target_position) + var compensated_position: Vector3 = movement_state.get( + "position", + avatar.global_position, + ) var player_distance: float = Vector2( - avatar.global_position.x - entity_position.x, - avatar.global_position.z - entity_position.z, + compensated_position.x - entity_position.x, + compensated_position.z - entity_position.z, ).length() if target_distance > entry.capture_radius: - error = "The net missed." + error = "The gathering tool missed." elif player_distance > entry.interaction_range: - error = "Move closer before swinging the net." + error = "Move closer before using the tool." if not error.is_empty(): _send_interaction_result(peer_id, request_id, false, error) return @@ -670,12 +910,7 @@ func _handle_local_capacity_probe(data: Dictionary) -> void: var catch_id := StringName(str(data.get("catch_id", ""))) var can_accept: bool = ( _local_inventory != null - and _local_capacity != null - and ( - _local_inventory.contains_catch_id(catch_id) - or _local_inventory.get_all_catches().size() - < _local_capacity.get_capacity() - ) + and _local_inventory.can_accept_catch(catch_id) ) if _session.is_host(): _handle_capacity_response( @@ -728,7 +963,7 @@ func _handle_capacity_response( ): return if not can_accept: - _reject_pending_capture(peer_id, "Cooler is full.") + _reject_pending_capture(peer_id, "Inventory is full.") return _pending_captures.erase(peer_id) var entity_id: String = str(pending["entity_id"]) @@ -813,8 +1048,7 @@ func _apply_capture_result(data: Dictionary) -> void: ) if ( not already_owned - and _local_inventory.get_all_catches().size() - >= _local_capacity.get_capacity() + and not _local_inventory.can_accept_catch(fish_catch.catch_id) ): return if not already_owned: @@ -823,7 +1057,7 @@ func _apply_capture_result(data: Dictionary) -> void: _local_collection, ) _local_inventory.add_catch(fish_catch) - _local_collection.mark_quality_discovered( + _local_collection.record_catch( fish_catch.fish_id, fish_catch.quality, ) @@ -998,6 +1232,9 @@ func _apply_entity_state(value: Variant, immediate: bool) -> void: var position: Vector3 = NetworkWorldSpawnProtocol.array_to_vector3( state["position"] ) + if not _presentation_enabled: + _entity_revisions[entity_id] = revision + return var presentation := _presentations.get(entity_id) as WorldGatherableType if presentation == null or not is_instance_valid(presentation): presentation = WorldGatherableType.new() @@ -1047,6 +1284,8 @@ func _remove_presentation(entity_id: String, with_dust: bool) -> void: func _apply_showcase(payload: Dictionary) -> void: + if not _presentation_enabled: + return if ( typeof(payload.get("owner_peer_id")) != TYPE_INT or typeof(payload.get("visible")) != TYPE_BOOL @@ -1128,24 +1367,106 @@ func _on_session_state_changed(_state: NetworkSession.State) -> void: _population_session_id = "" +func _on_calendar_date_changed(_date_id: String) -> void: + if ( + _session == null + or not _session.is_host() + or not _session.is_gameplay_session_active() + or _population_session_id.is_empty() + ): + return + _reconcile_seasonal_population() + + +func _reconcile_seasonal_population() -> void: + if _catalog == null: + return + var season: int = _current_season() + for entity_id: String in _entities.keys(): + var state: Dictionary = _entities.get(entity_id, {}) + var entry := state.get("data") as GatherableDataType + if entry != null and not entry.is_available(season): + _despawn_entity(entity_id, &"season_changed", false, false) + var retained_respawns: Array[Dictionary] = [] + for respawn: Dictionary in _respawns: + var entry: GatherableDataType = _catalog.get_entry( + StringName(str(respawn.get("type_id", ""))) + ) + if entry != null and entry.is_available(season): + retained_respawns.append(respawn) + _respawns = retained_respawns + for entry: GatherableDataType in _catalog.get_available_entries(season): + _cache_spawn_surface(entry) + var current_population: int = _population_for_type(entry.type_id) + var target_population := _target_population(entry) + while current_population < target_population: + _spawn_entity(entry) + current_population += 1 + + +func _target_population(entry: GatherableDataType) -> int: + if entry == null or entry.spawn_anchor_set_id.is_empty(): + return entry.population if entry != null else 0 + var anchors: PackedVector3Array = _spawn_anchor_positions.get( + entry.type_id, + PackedVector3Array(), + ) + return entry.target_population_for_anchor_count(anchors.size()) + + +func _population_for_type(type_id: StringName) -> int: + var count: int = 0 + for state: Dictionary in _entities.values(): + if StringName(str(state.get("type_id", ""))) == type_id: + count += 1 + for respawn: Dictionary in _respawns: + if StringName(str(respawn.get("type_id", ""))) == type_id: + count += 1 + return count + + +func _current_season() -> int: + return ( + _world_time.get_season() + if _world_time != null + else CalendarSeasonType.UNKNOWN + ) + + func _clear_world() -> void: for presentation: WorldGatherableType in _presentations.values(): if presentation != null and is_instance_valid(presentation): presentation.queue_free() _entities.clear() + _dirty_entity_ids.clear() + _moving_players_by_cell.clear() _presentations.clear() _entity_revisions.clear() _surface_triangles.clear() _surface_areas.clear() _surface_total_areas.clear() + _spawn_anchor_positions.clear() _respawns.clear() _next_respawn_by_type.clear() _charge_requests.clear() _pending_captures.clear() _showcase_deadlines.clear() + _simulation_elapsed = 0.0 _snapshot_elapsed = 0.0 +func get_network_metrics() -> Dictionary: + return { + "entities": _entities.size(), + "presentations": _presentations.size(), + "dirty_entities": _dirty_entity_ids.size(), + "spawn_events_sent": _spawn_events_sent, + "despawn_events_sent": _despawn_events_sent, + "snapshot_packets_sent": _snapshot_packets_sent, + "snapshot_states_sent": _snapshot_states_sent, + } + + func _bound(values: Dictionary) -> void: while values.size() > MAX_LEDGER_ENTRIES: values.erase(values.keys().front()) diff --git a/network/network_world_time_service.gd b/network/network_world_time_service.gd index 246af77..9cbd990 100644 --- a/network/network_world_time_service.gd +++ b/network/network_world_time_service.gd @@ -23,6 +23,12 @@ func setup(session: NetworkSession, world_time: WorldTimeService) -> void: _world_time.authoritative_time_set.connect( _on_authoritative_time_set ) + if not _world_time.calendar_date_changed.is_connected( + _on_authoritative_calendar_date_changed + ): + _world_time.calendar_date_changed.connect( + _on_authoritative_calendar_date_changed + ) set_process(true) @@ -45,20 +51,16 @@ func _on_session_state_changed(state: NetworkSession.State) -> void: _sequence = 0 _last_received_sequence = -1 _sync_elapsed = 0.0 - _world_time.set_persistence_tracking_enabled(true) - _world_time.begin_session( - _world_time.get_persistent_time_hours() - ) + _world_time.begin_authoritative_session() return if state == NetworkSession.State.JOINED_CLIENT: _active_session_id = _session.get_session_id() _last_received_sequence = -1 _sync_elapsed = 0.0 - _world_time.set_persistence_tracking_enabled(false) if _session.supports_server_capability( NetworkProtocol.WORLD_TIME_CAPABILITY ): - _world_time.begin_session() + _world_time.begin_remote_session() else: _world_time.end_session() return @@ -72,7 +74,6 @@ func _on_session_state_changed(state: NetworkSession.State) -> void: _sequence = 0 _last_received_sequence = -1 _sync_elapsed = 0.0 - _world_time.set_persistence_tracking_enabled(false) _world_time.end_session() @@ -95,6 +96,13 @@ func _on_authoritative_time_set(_time_hours: float) -> void: _broadcast_snapshot() +func _on_authoritative_calendar_date_changed(_date_id: String) -> void: + if _session == null or not _session.is_host(): + return + _sync_elapsed = 0.0 + _broadcast_snapshot() + + func _broadcast_snapshot() -> void: if _session == null or not _session.is_host(): return @@ -112,6 +120,7 @@ func _send_snapshot(peer_id: int) -> void: receive_world_time_snapshot.rpc_id(peer_id, { "session_id": _session.get_session_id(), "time_hours": _world_time.get_time_hours(), + "calendar_date_id": _world_time.get_calendar_date_id(), "sequence": _sequence, }) @@ -133,7 +142,10 @@ func receive_world_time_snapshot(data: Dictionary) -> void: if sequence <= _last_received_sequence: return _last_received_sequence = sequence - _world_time.synchronize_time(float(data["time_hours"])) + _world_time.synchronize_calendar_time( + float(data["time_hours"]), + str(data["calendar_date_id"]), + ) static func validate_snapshot(data: Variant) -> bool: @@ -148,6 +160,10 @@ static func validate_snapshot(data: Variant) -> bool: and is_finite(float(value["time_hours"])) and float(value["time_hours"]) >= 0.0 and float(value["time_hours"]) < WorldTimeService.HOURS_PER_DAY + and typeof(value.get("calendar_date_id")) == TYPE_STRING + and WorldTimeService.is_valid_calendar_date_id( + str(value["calendar_date_id"]) + ) and typeof(value.get("sequence")) == TYPE_INT and int(value["sequence"]) >= 0 ) diff --git a/network/network_world_weather_service.gd b/network/network_world_weather_service.gd index 43d5762..ba0e6e2 100644 --- a/network/network_world_weather_service.gd +++ b/network/network_world_weather_service.gd @@ -3,7 +3,7 @@ extends Node const SYNC_INTERVAL_SECONDS: float = 15.0 const MAX_SESSION_ID_LENGTH: int = 96 -const MAX_REMAINING_SECONDS: float = 1800.0 +const MAX_REMAINING_SECONDS: float = WorldWeatherService.WEATHER_PERIOD_SECONDS var _session: NetworkSession var _world_weather: WorldWeatherService @@ -44,7 +44,6 @@ func _on_session_state_changed(state: NetworkSession.State) -> void: _sequence = 0 _last_received_sequence = -1 _sync_elapsed = 0.0 - _world_weather.set_persistence_tracking_enabled(true) _world_weather.begin_authoritative_session( _active_session_id.hash() ) @@ -53,7 +52,6 @@ func _on_session_state_changed(state: NetworkSession.State) -> void: _active_session_id = _session.get_session_id() _last_received_sequence = -1 _sync_elapsed = 0.0 - _world_weather.set_persistence_tracking_enabled(false) if _session.supports_server_capability( NetworkProtocol.WORLD_WEATHER_CAPABILITY ): @@ -71,7 +69,6 @@ func _on_session_state_changed(state: NetworkSession.State) -> void: _sequence = 0 _last_received_sequence = -1 _sync_elapsed = 0.0 - _world_weather.set_persistence_tracking_enabled(false) _world_weather.end_session() diff --git a/network/player_data_root.gd b/network/player_data_root.gd index 525c545..e173577 100644 --- a/network/player_data_root.gd +++ b/network/player_data_root.gd @@ -9,11 +9,42 @@ const BOOTSTRAP_TEMP_PATH := "user://data_root_bootstrap.json.tmp" const BOOTSTRAP_VERSION := 1 const MANIFEST_VERSION := 1 const LAYOUT_VERSION := 1 -const MANIFEST_FILENAME := "netfishing_data.json" +const MANIFEST_FILENAME := "straywild_data.json" +const LEGACY_MANIFEST_FILENAME := "netfishing_data.json" const README_FILENAME := "README.txt" -const ENVIRONMENT_VARIABLE := "NETFISHING_DATA_DIR" -const APPLICATION_ID := "netfishing" +const ENVIRONMENT_VARIABLE := "straywild_DATA_DIR" +const CREATE_ENVIRONMENT_VARIABLE := "straywild_CREATE_DATA_DIR" +const LEGACY_ENVIRONMENT_VARIABLE := "NETFISHING_DATA_DIR" +const LEGACY_CREATE_ENVIRONMENT_VARIABLE := "NETFISHING_CREATE_DATA_DIR" +const APPLICATION_ID := "straywild" +const LEGACY_APPLICATION_ID := "netfishing" const APP_DATA_PORTABLE_PATH := "user://portable-data" +const LEGACY_USER_DIRECTORY_NAME := "NETFISHING" +const LEGACY_USER_FILES := [ + "data_root_bootstrap.json", + "data_root_bootstrap.json.backup", + "network_discovery.cfg", + "player_settings.json", + "player_settings.json.backup", + "controller_mappings.json", + "controller_mappings.json.backup", + "keyboard_mouse_bindings.json", + "keyboard_mouse_bindings.json.backup", + "player_save.json", + "network_profile.json", + "player_appearance.json", + "saved_servers.json", + "known_players.json", + "player_relationships.json", + "server_trust.json", + "host_bans.json", + "player_identity.key", + "player_identity.pub", + "player_identity.json", + "host_identity.key", + "host_identity.pub", + "host_identity.json", +] const PATH_ALLOWED: StringName = &"allowed" const PATH_SOURCE_PROJECT: StringName = &"source_project" const PATH_INSTALLATION: StringName = &"installation" @@ -36,18 +67,33 @@ var override_active := false func resolve() -> bool: + prepare_legacy_user_data() _load_bootstrap_identity() var command_line: String = _command_line_override() if not command_line.is_empty(): override_active = true mode = Mode.COMMAND_LINE_OVERRIDE return _activate_existing(command_line, "", false) - if OS.has_environment(ENVIRONMENT_VARIABLE): + var environment_variable: String = _available_environment_variable( + ENVIRONMENT_VARIABLE, + LEGACY_ENVIRONMENT_VARIABLE, + ) + if not environment_variable.is_empty(): override_active = true mode = Mode.ENVIRONMENT_OVERRIDE - var environment_path: String = OS.get_environment(ENVIRONMENT_VARIABLE) + var environment_path: String = OS.get_environment(environment_variable) if not environment_path.is_absolute_path(): - return _fail("NETFISHING_DATA_DIR must be an absolute path.") + return _fail("straywild_DATA_DIR must be an absolute path.") + if ( + _environment_flag( + CREATE_ENVIRONMENT_VARIABLE, + LEGACY_CREATE_ENVIRONMENT_VARIABLE, + ) + and not has_data_manifest(environment_path) + ): + var created: Dictionary = create_unbound_root(environment_path) + if not bool(created.get("ok", false)): + return false return _activate_existing(environment_path, "", false) var bootstrap: Dictionary = _read_json(BOOTSTRAP_PATH, 64 * 1024) if bootstrap.is_empty() and FileAccess.file_exists(BOOTSTRAP_PATH + ".backup"): @@ -70,11 +116,35 @@ func resolve() -> bool: return false +func prepare_legacy_user_data() -> void: + var current_root: String = _normalize( + ProjectSettings.globalize_path("user://") + ) + if current_root.is_empty(): + return + var legacy_root: String = _normalize( + current_root.get_base_dir().path_join(LEGACY_USER_DIRECTORY_NAME) + ) + if legacy_root == current_root or not DirAccess.dir_exists_absolute(legacy_root): + return + for filename: String in LEGACY_USER_FILES: + var destination: String = current_root.path_join(filename) + if FileAccess.file_exists(destination): + continue + var source: String = legacy_root.path_join(filename) + if FileAccess.file_exists(source): + _copy_legacy_user_file(source, destination) + + +func has_data_manifest(path: String) -> bool: + return not _existing_manifest_path(_normalize(path)).is_empty() + + func default_visible_path() -> String: var documents: String = OS.get_system_dir(OS.SYSTEM_DIR_DOCUMENTS) if documents.is_empty(): return "" - var candidate: String = _normalize(documents.path_join("NETFISHING")) + var candidate: String = _normalize(documents.path_join("straywild")) if not candidate.is_absolute_path(): return "" var classification: StringName = classify_candidate_path( @@ -95,20 +165,22 @@ func select_new_root(path: String, app_data: bool = false) -> bool: normalized = ProjectSettings.globalize_path(APP_DATA_PORTABLE_PATH) if not _validate_candidate(normalized, true): return false - var manifest_path: String = normalized.path_join(MANIFEST_FILENAME) - if FileAccess.file_exists(manifest_path): + var manifest_path: String = _existing_manifest_path(normalized) + if not manifest_path.is_empty(): var manifest: Dictionary = _read_json(manifest_path) if not _valid_manifest(manifest): - return _fail("The selected folder has a malformed NETfishing manifest.") + return _fail("The selected folder has a malformed straywild manifest.") root_id = str(manifest["root_id"]) + if not _upgrade_legacy_manifest(normalized, manifest, manifest_path): + return _fail("The legacy data-folder manifest could not be upgraded.") else: if not _directory_is_empty(normalized) and not app_data: return _fail( - "Choose an empty folder or an existing NETfishing data folder." + "Choose an empty folder or an existing straywild data folder." ) root_id = Crypto.new().generate_random_bytes(16).hex_encode() if not _create_layout(normalized, root_id): - return _fail("The NETfishing data folder could not be created.") + return _fail("The straywild data folder could not be created.") if not _write_bootstrap(normalized, root_id): return _fail("The data-folder pointer could not be saved.") root_path = normalized @@ -135,14 +207,14 @@ func create_app_data_layout_for_migration(path: String) -> Dictionary: var normalized: String = _normalize(path) if not _validate_candidate(normalized, false): return {"ok": false, "message": error_message} - var manifest_path: String = normalized.path_join(MANIFEST_FILENAME) - if FileAccess.file_exists(manifest_path): + var manifest_path: String = _existing_manifest_path(normalized) + if not manifest_path.is_empty(): var manifest: Dictionary = _read_json(manifest_path) - return ( - {"ok": true, "root_id": str(manifest.get("root_id", ""))} - if _valid_manifest(manifest) - else {"ok": false, "message": "The app-data manifest is malformed."} - ) + if not _valid_manifest(manifest): + return {"ok": false, "message": "The app-data manifest is malformed."} + if not _upgrade_legacy_manifest(normalized, manifest, manifest_path): + return {"ok": false, "message": "The app-data manifest could not be upgraded."} + return {"ok": true, "root_id": str(manifest.get("root_id", ""))} var id: String = Crypto.new().generate_random_bytes(16).hex_encode() if not _create_layout(normalized, id): return {"ok": false, "message": "The app-data layout could not be created."} @@ -178,7 +250,8 @@ func activate_process_root(path: String) -> bool: func path_for(store_owner: StringName) -> String: var relative: String = { - &"player_save": "player/player_save.json", + &"player_save": "player/player_save.nfsave", + &"save_slots": "player/save_slots.json", &"network_profile": "player/network_profile.json", &"player_appearance": "player/player_appearance.json", &"saved_servers": "social/saved_servers.json", @@ -198,6 +271,10 @@ func identity_backup_directory() -> String: return root_path.path_join("identity-backups") +func progression_backup_directory() -> String: + return root_path.path_join("progression-backups") + + func migration_backup_directory() -> String: return root_path.path_join("backups/migrations") @@ -211,10 +288,6 @@ func storage_mode_text() -> String: }.get(mode, "Unavailable") -func open_folder() -> bool: - return not root_path.is_empty() and OS.shell_open(root_path) == OK - - func report_conflict(message: String, conflict_path: String) -> void: error_message = message conflict_detected.emit(message, conflict_path) @@ -225,17 +298,19 @@ func _activate_existing(path: String, expected_id: String, permit_creation: bool var normalized: String = _normalize(path) if not _validate_candidate(normalized, permit_creation): return false - var manifest_path: String = normalized.path_join(MANIFEST_FILENAME) - if not FileAccess.file_exists(manifest_path): - return _fail("The selected folder is not a NETfishing data folder.") + var manifest_path: String = _existing_manifest_path(normalized) + if manifest_path.is_empty(): + return _fail("The selected folder is not a straywild data folder.") var manifest: Dictionary = _read_json(manifest_path) if not _valid_manifest(manifest): - return _fail("The NETfishing data-folder manifest is malformed.") + return _fail("The straywild data-folder manifest is malformed.") + if not _upgrade_legacy_manifest(normalized, manifest, manifest_path): + return _fail("The legacy data-folder manifest could not be upgraded.") var found_id: String = str(manifest["root_id"]) if not expected_id.is_empty() and expected_id != found_id: return _fail("The selected data folder does not match this device pointer.") if not _test_writable(normalized): - return _fail("The NETfishing data folder is unavailable or unwritable.") + return _fail("The straywild data folder is unavailable or unwritable.") root_path = normalized root_id = found_id requires_selection = false @@ -328,7 +403,7 @@ static func _is_same_or_child_path(candidate: String, reference: String) -> bool func _test_writable(path: String) -> bool: var probe: String = path.path_join( - ".netfishing-write-%s.tmp" % device_id.left(12) + ".straywild-write-%s.tmp" % device_id.left(12) ) var file: FileAccess = FileAccess.open(probe, FileAccess.WRITE) if file == null: @@ -340,8 +415,8 @@ func _test_writable(path: String) -> bool: func _create_layout(path: String, id: String) -> bool: for relative: String in [ - "player", "social", "backups/saves", "backups/migrations", - "backups/conflicts", "identity-backups", + "player", "player/saves", "social", "backups/saves", "backups/migrations", + "backups/conflicts", "identity-backups", "progression-backups", ]: if DirAccess.make_dir_recursive_absolute(path.path_join(relative)) != OK: return false @@ -359,10 +434,11 @@ func _create_layout(path: String, id: String) -> bool: ): return false var readme: String = ( - "NETfishing player data\n\n" + "straywild player data\n\n" + "This folder is safe to synchronize with tools such as Syncthing.\n" + "Active private identity keys remain device-local.\n" + "Encrypted identity backups require their passphrase.\n" + + "Progression exports do not contain identity keys or social data.\n" + "Chat and Session Mail are not stored here.\n" + "Do not play the same profile on two devices at the same time.\n" + "Conflicting edits are preserved under backups/conflicts; they are not merged.\n" @@ -410,12 +486,71 @@ func _valid_manifest(data: Dictionary) -> bool: return ( data.get("format_version") == MANIFEST_VERSION and data.get("layout_version") == LAYOUT_VERSION - and data.get("application") == APPLICATION_ID + and data.get("application") in [APPLICATION_ID, LEGACY_APPLICATION_ID] and typeof(data.get("root_id")) == TYPE_STRING and str(data["root_id"]).length() == 32 ) +func _existing_manifest_path(path: String) -> String: + var current: String = path.path_join(MANIFEST_FILENAME) + if FileAccess.file_exists(current): + return current + var legacy: String = path.path_join(LEGACY_MANIFEST_FILENAME) + return legacy if FileAccess.file_exists(legacy) else "" + + +func _upgrade_legacy_manifest( + path: String, + manifest: Dictionary, + manifest_path: String, +) -> bool: + if ( + manifest_path.get_file() == MANIFEST_FILENAME + and manifest.get("application") == APPLICATION_ID + ): + return true + var upgraded: Dictionary = manifest.duplicate(true) + upgraded["application"] = APPLICATION_ID + upgraded["last_opened_at_unix"] = int(Time.get_unix_time_from_system()) + return _write_text_atomic( + path.path_join(MANIFEST_FILENAME), + JSON.stringify(upgraded, "\t"), + ) + + +func _available_environment_variable(primary: String, legacy: String) -> String: + if OS.has_environment(primary): + return primary + return legacy if OS.has_environment(legacy) else "" + + +func _environment_flag(primary: String, legacy: String) -> bool: + var variable: String = _available_environment_variable(primary, legacy) + return not variable.is_empty() and OS.get_environment(variable) == "1" + + +func _copy_legacy_user_file(source: String, destination: String) -> bool: + var bytes: PackedByteArray = PortableFileGuard.read_bytes( + source, + 16 * 1024 * 1024, + ) + if bytes.is_empty() and FileAccess.get_open_error() != OK: + return false + if DirAccess.make_dir_recursive_absolute(destination.get_base_dir()) != OK: + return false + var file: FileAccess = FileAccess.open(destination, FileAccess.WRITE) + if file == null: + return false + file.store_buffer(bytes) + file.flush() + var copied: bool = file.get_error() == OK + file.close() + if copied and source.ends_with(".key"): + FileAccess.set_unix_permissions(destination, 384) + return copied + + func _directory_is_empty(path: String) -> bool: var access: DirAccess = DirAccess.open(path) if access == null: diff --git a/network/player_list_entry.gd b/network/player_list_entry.gd index f401da6..c75832a 100644 --- a/network/player_list_entry.gd +++ b/network/player_list_entry.gd @@ -12,7 +12,10 @@ var continuity_state := "" var ping_to_host_ms := -1 var muted := false var blocked := false +var is_friend := false +var can_request_friend := false var can_kick := false var can_ban := false +var can_clear_art := false var can_manage_operator := false var revision := 0 diff --git a/network/player_relationship_store.gd b/network/player_relationship_store.gd index 2ea4502..de04d49 100644 --- a/network/player_relationship_store.gd +++ b/network/player_relationship_store.gd @@ -3,8 +3,12 @@ extends Node signal relationship_changed(fingerprint: String) -const FORMAT_VERSION := 1 +const FORMAT_VERSION := 2 const MAX_RECORDS := 500 +const MAX_FRIENDS := 200 +const SOCIAL_TOKEN_LENGTH := 64 +const PRESENCE_CHANNEL_DOMAIN := "straywild_PRESENCE_V1:" +const INVITE_INBOX_DOMAIN := "straywild_INVITE_V1:" var _records: Dictionary = {} var _loaded := false @@ -17,6 +21,10 @@ var _data_root: PlayerDataRoot func configure_storage(path: String, data_root: PlayerDataRoot) -> void: _store_path = path _data_root = data_root + _records.clear() + _loaded = false + _write_blocked = false + _expected_hash = "" func is_muted(fingerprint: String) -> bool: @@ -29,6 +37,11 @@ func is_blocked(fingerprint: String) -> bool: return bool(_records.get(fingerprint, {}).get("blocked", false)) +func is_friend(fingerprint: String) -> bool: + _ensure_loaded() + return bool(_records.get(fingerprint, {}).get("friend", false)) + + func set_muted(fingerprint: String, display_name: String, value: bool) -> bool: if not _valid_target(fingerprint, display_name): return false @@ -48,20 +61,101 @@ func set_blocked(fingerprint: String, display_name: String, value: bool) -> bool # fresh visibility boundary for future messages; already suppressed # messages retain their immutable local suppression flag. record["muted"] = value + if value: + _clear_friend_fields(record) return _commit(fingerprint, record) +func create_friend_capabilities() -> Dictionary: + var presence_write_token := NetworkIdentityCrypto.secure_id(32) + var invite_token := NetworkIdentityCrypto.secure_id(32) + if not _valid_social_token(presence_write_token) or not _valid_social_token(invite_token): + return {} + return { + "local_presence_write_token": presence_write_token, + "local_invite_token": invite_token, + "presence_channel": presence_channel_for_write_token( + presence_write_token + ), + "invite_token": invite_token, + } + + +func add_friend( + fingerprint: String, + display_name: String, + local_capabilities: Dictionary, + remote_capabilities: Dictionary, +) -> bool: + if ( + not _valid_target(fingerprint, display_name) + or is_blocked(fingerprint) + or not _valid_local_capabilities(local_capabilities) + or not _valid_public_capabilities(remote_capabilities) + ): + return false + _ensure_loaded() + if not is_friend(fingerprint) and get_friends().size() >= MAX_FRIENDS: + return false + var record := _record(fingerprint, display_name) + var now := int(Time.get_unix_time_from_system()) + record["friend"] = true + record["friend_since_unix"] = int(record.get("friend_since_unix", now)) + record["local_presence_write_token"] = str( + local_capabilities["local_presence_write_token"] + ) + record["local_invite_token"] = str( + local_capabilities["local_invite_token"] + ) + record["remote_presence_channel"] = str( + remote_capabilities["presence_channel"] + ) + record["remote_invite_token"] = str( + remote_capabilities["invite_token"] + ) + return _commit(fingerprint, record) + + +func remove_friend(fingerprint: String, display_name: String) -> bool: + if not _valid_target(fingerprint, display_name): + return false + _ensure_loaded() + var record := _record(fingerprint, display_name) + _clear_friend_fields(record) + return _commit(fingerprint, record) + + +func get_friend_record(fingerprint: String) -> Dictionary: + _ensure_loaded() + var record: Dictionary = _records.get(fingerprint, {}) + return record.duplicate(true) if bool(record.get("friend", false)) else {} + + +func get_friends() -> Array[Dictionary]: + _ensure_loaded() + var result: Array[Dictionary] = [] + for value: Dictionary in _records.values(): + if bool(value.get("friend", false)): + result.append(value.duplicate(true)) + _sort_records(result) + return result + + +static func presence_channel_for_write_token(write_token: String) -> String: + return (PRESENCE_CHANNEL_DOMAIN + write_token).sha256_text() + + +static func invite_inbox_id(invite_token: String) -> String: + return (INVITE_INBOX_DOMAIN + invite_token).sha256_text() + + func get_records() -> Array[Dictionary]: _ensure_loaded() var result: Array[Dictionary] = [] for value: Dictionary in _records.values(): if bool(value.get("muted", false)) or bool(value.get("blocked", false)): result.append(value.duplicate(true)) - result.sort_custom(func(a: Dictionary, b: Dictionary) -> bool: - return str(a.get("last_known_display_name", "")).naturalnocasecmp_to( - str(b.get("last_known_display_name", "")) - ) < 0 - ) + _sort_records(result) return result @@ -72,6 +166,7 @@ func _record(fingerprint: String, display_name: String) -> Dictionary: "created_unix": now, "muted": false, "blocked": false, + "friend": false, }) record["last_known_display_name"] = display_name record["updated_unix"] = now @@ -82,7 +177,11 @@ func _commit(fingerprint: String, record: Dictionary) -> bool: if _write_blocked: return false var previous: Dictionary = _records.duplicate(true) - if not bool(record["muted"]) and not bool(record["blocked"]): + if ( + not bool(record.get("muted", false)) + and not bool(record.get("blocked", false)) + and not bool(record.get("friend", false)) + ): _records.erase(fingerprint) else: _records[fingerprint] = record @@ -115,7 +214,8 @@ func _ensure_loaded() -> void: if json.parse(file.get_as_text()) != OK or typeof(json.data) != TYPE_DICTIONARY: return var data: Dictionary = json.data - if data.get("format_version") != FORMAT_VERSION: + var format_version: int = int(data.get("format_version", 0)) + if format_version not in [1, FORMAT_VERSION]: _write_blocked = true return for value: Variant in data.get("records", []): @@ -127,6 +227,13 @@ func _ensure_loaded() -> void: continue record["blocked"] = bool(record.get("blocked", false)) record["muted"] = bool(record.get("muted", false)) or record["blocked"] + record["friend"] = ( + bool(record.get("friend", false)) + and not record["blocked"] + and _valid_stored_friend_capabilities(record) + ) + if not record["friend"]: + _clear_friend_fields(record) _records[fingerprint] = record.duplicate(true) _expected_hash = PortableFileGuard.hash_file(_store_path) @@ -145,3 +252,69 @@ func _save() -> bool: if bool(result.get("ok", false)): _expected_hash = str(result["hash"]) return bool(result.get("ok", false)) + + +func _clear_friend_fields(record: Dictionary) -> void: + record["friend"] = false + for key: String in [ + "friend_since_unix", + "local_presence_write_token", + "local_invite_token", + "remote_presence_channel", + "remote_invite_token", + ]: + record.erase(key) + + +func _valid_local_capabilities(value: Dictionary) -> bool: + var write_token := str(value.get("local_presence_write_token", "")) + var invite_token := str(value.get("local_invite_token", "")) + return ( + _valid_social_token(write_token) + and _valid_social_token(invite_token) + and str(value.get("presence_channel", "")) + == presence_channel_for_write_token(write_token) + and str(value.get("invite_token", "")) == invite_token + ) + + +func _valid_public_capabilities(value: Dictionary) -> bool: + return ( + _valid_social_token(str(value.get("presence_channel", ""))) + and _valid_social_token(str(value.get("invite_token", ""))) + ) + + +func _valid_stored_friend_capabilities(record: Dictionary) -> bool: + var local: Dictionary = { + "local_presence_write_token": str( + record.get("local_presence_write_token", "") + ), + "local_invite_token": str(record.get("local_invite_token", "")), + "presence_channel": presence_channel_for_write_token(str( + record.get("local_presence_write_token", "") + )), + "invite_token": str(record.get("local_invite_token", "")), + } + var remote: Dictionary = { + "presence_channel": str(record.get("remote_presence_channel", "")), + "invite_token": str(record.get("remote_invite_token", "")), + } + return _valid_local_capabilities(local) and _valid_public_capabilities(remote) + + +func _valid_social_token(value: String) -> bool: + if value.length() != SOCIAL_TOKEN_LENGTH: + return false + for character: String in value: + if character not in "0123456789abcdef": + return false + return true + + +func _sort_records(records: Array[Dictionary]) -> void: + records.sort_custom(func(a: Dictionary, b: Dictionary) -> bool: + return str(a.get("last_known_display_name", "")).naturalnocasecmp_to( + str(b.get("last_known_display_name", "")) + ) < 0 + ) diff --git a/network/player_spawn_service.gd b/network/player_spawn_service.gd index ae6ee00..1d1c292 100644 --- a/network/player_spawn_service.gd +++ b/network/player_spawn_service.gd @@ -11,16 +11,23 @@ var _local_player: Player var _spawn_transform: Transform3D var _avatars: Dictionary[int, Player] = {} var _local_peer_id: int = 1 +var _dedicated_runtime: bool = false func setup( players_root: Node3D, local_player: Player, spawn_transform: Transform3D, + dedicated_runtime: bool = false, ) -> void: _players_root = players_root _local_player = local_player _spawn_transform = spawn_transform + _dedicated_runtime = dedicated_runtime + + +func set_spawn_transform(spawn_transform: Transform3D) -> void: + _spawn_transform = spawn_transform func register_local_player(peer_id: int) -> void: @@ -52,7 +59,10 @@ func spawn_remote_player( avatar.set_network_peer_id(peer_id) _players_root.add_child(avatar) avatar.global_transform = transform - avatar.configure_network_remote(authoritative_simulation) + avatar.configure_network_remote( + authoritative_simulation, + _dedicated_runtime and authoritative_simulation, + ) _avatars[peer_id] = avatar avatar_spawned.emit(peer_id, avatar) return avatar diff --git a/network/portable_data_migration.gd b/network/portable_data_migration.gd index ab8f21d..2de0acb 100644 --- a/network/portable_data_migration.gd +++ b/network/portable_data_migration.gd @@ -26,19 +26,16 @@ static func migrate_legacy_to( ) -> Dictionary: var normalized: String = destination.simplify_path().trim_suffix("/") if DirAccess.dir_exists_absolute(normalized): - var existing_manifest: String = normalized.path_join( - PlayerDataRoot.MANIFEST_FILENAME - ) - if FileAccess.file_exists(existing_manifest): + if data_root.has_data_manifest(normalized): return { "ok": false, "requires_existing_root_decision": true, - "message": "The selected folder already contains NETfishing data.", + "message": "The selected folder already contains straywild data.", } if not _directory_empty(normalized): return { "ok": false, - "message": "Choose an empty folder or create a NETfishing subfolder.", + "message": "Choose an empty folder or create a straywild subfolder.", } var staging: String = "%s.migration-%s" % [ normalized, Crypto.new().generate_random_bytes(8).hex_encode() @@ -100,18 +97,22 @@ static func migrate_active_to( ) -> Dictionary: var normalized: String = destination.simplify_path().trim_suffix("/") if normalized == data_root.root_path: - return {"ok": true, "message": "This data folder is already active."} + return { + "ok": true, + "changed": false, + "message": "This data folder is already active.", + } if DirAccess.dir_exists_absolute(normalized) and not _directory_empty(normalized): - if FileAccess.file_exists(normalized.path_join(PlayerDataRoot.MANIFEST_FILENAME)): + if data_root.has_data_manifest(normalized): return { "ok": false, "requires_existing_root_decision": true, "message": ( - "The selected folder already contains NETfishing data. " + "The selected folder already contains straywild data. " + "Choose it through the existing-data recovery flow." ), } - return {"ok": false, "message": "Choose an empty folder or a NETfishing subfolder."} + return {"ok": false, "message": "Choose an empty folder or a straywild subfolder."} var staging: String = "%s.migration-%s" % [ normalized, Crypto.new().generate_random_bytes(8).hex_encode() ] @@ -122,7 +123,9 @@ static func migrate_active_to( _remove_tree(staging) return {"ok": false, "message": str(created.get("message", ""))} for relative: String in [ + "player/player_save.nfsave", "player/player_save.json", + "player/save_slots.json", "player/network_profile.json", "player/player_appearance.json", "social/saved_servers.json", @@ -134,9 +137,23 @@ static func migrate_active_to( var source: String = data_root.root_path.path_join(relative) if not FileAccess.file_exists(source): continue - if not bool(_copy_verified_json(source, staging.path_join(relative)).get("ok", false)): + if not bool( + _copy_verified_owned_file( + source, staging.path_join(relative) + ).get("ok", false) + ): _remove_tree(staging) return {"ok": false, "message": "Migration validation failed for %s." % relative} + var source_slots: String = data_root.root_path.path_join("player/saves") + if ( + DirAccess.dir_exists_absolute(source_slots) + and not _copy_progression_slots( + source_slots, + staging.path_join("player/saves"), + ) + ): + _remove_tree(staging) + return {"ok": false, "message": "Migration validation failed for save slots."} if DirAccess.dir_exists_absolute(normalized): DirAccess.remove_absolute(normalized) if DirAccess.rename_absolute(staging, normalized) != OK: @@ -147,6 +164,7 @@ static func migrate_active_to( return {"ok": false, "message": "Migration copied data but did not change the pointer."} return { "ok": true, + "changed": true, "message": "Data folder changed. Previous data was preserved.", "previous_root": old_root, } @@ -186,9 +204,8 @@ static func replace_existing_with_legacy( destination: String, ) -> Dictionary: var normalized: String = destination.simplify_path().trim_suffix("/") - var manifest: String = normalized.path_join(PlayerDataRoot.MANIFEST_FILENAME) - if not FileAccess.file_exists(manifest): - return {"ok": false, "message": "The selected folder is not a NETfishing data root."} + if not data_root.has_data_manifest(normalized): + return {"ok": false, "message": "The selected folder is not a straywild data root."} var recovery: String = ProjectSettings.globalize_path( "user://migration-recovery" ).path_join( @@ -208,8 +225,8 @@ static func replace_existing_with_active( destination: String, ) -> Dictionary: var normalized: String = destination.simplify_path().trim_suffix("/") - if not FileAccess.file_exists(normalized.path_join(PlayerDataRoot.MANIFEST_FILENAME)): - return {"ok": false, "message": "The selected folder is not a NETfishing data root."} + if not data_root.has_data_manifest(normalized): + return {"ok": false, "message": "The selected folder is not a straywild data root."} var recovery: String = ProjectSettings.globalize_path( "user://migration-recovery" ).path_join( @@ -248,16 +265,70 @@ static func _copy_verified_json(source: String, destination: String) -> Dictiona } +static func _copy_verified_owned_file( + source: String, + destination: String, +) -> Dictionary: + if source.get_extension().to_lower() != "nfsave": + return _copy_verified_json(source, destination) + var decoded: Dictionary = ProgressionSaveCodec.read_local_save(source) + if not bool(decoded.get("ok", false)): + return {"ok": false} + var save_data: Dictionary = decoded["data"] + var version: int = int(save_data.get("save_version", -1)) + if version < 1 or version > PlayerSaveManager.SAVE_VERSION: + return {"ok": false} + var bytes: PackedByteArray = PortableFileGuard.read_bytes(source) + if bytes.is_empty() or not _write_bytes(destination, bytes): + return {"ok": false} + return { + "ok": ( + PortableFileGuard.hash_file(destination) + == PortableFileGuard.hash_bytes(bytes) + ) + } + + static func _valid_owned_data(filename: String, data: Dictionary) -> bool: if filename == "player_save.json": var version: int = int(data.get("save_version", -1)) return version >= 1 and version <= PlayerSaveManager.SAVE_VERSION + if filename == "save_slots.json": + return ( + int(data.get("format_version", -1)) == PlayerSaveSlotCatalog.FORMAT_VERSION + and typeof(data.get("active_slot_id")) == TYPE_STRING + and typeof(data.get("slots")) == TYPE_ARRAY + ) return ( filename not in LEGACY_FILES or int(data.get("format_version", -1)) == 1 ) +static func _copy_progression_slots(source: String, destination: String) -> bool: + if DirAccess.make_dir_recursive_absolute(destination) != OK: + return false + var access := DirAccess.open(source) + if access == null: + return false + access.list_dir_begin() + var filename: String = access.get_next() + while not filename.is_empty(): + if ( + not access.current_is_dir() + and filename.get_extension().to_lower() == "nfsave" + and not bool(_copy_verified_owned_file( + source.path_join(filename), + destination.path_join(filename), + ).get("ok", false)) + ): + access.list_dir_end() + return false + filename = access.get_next() + access.list_dir_end() + return true + + static func _copy_bytes(source: String, destination: String) -> bool: return _write_bytes(destination, PortableFileGuard.read_bytes(source)) diff --git a/network/saved_server_store.gd b/network/saved_server_store.gd index de48c2c..4e00259 100644 --- a/network/saved_server_store.gd +++ b/network/saved_server_store.gd @@ -22,6 +22,12 @@ var _data_root: PlayerDataRoot func configure_storage(path: String, data_root: PlayerDataRoot) -> void: _store_path = path _data_root = data_root + _saved_entries.clear() + _recent_entries.clear() + _loaded = false + _recovery_warning = "" + _write_blocked = false + _expected_hash = "" func _temp_path() -> String: diff --git a/network/server_trust_store.gd b/network/server_trust_store.gd index fda774b..1d4dd29 100644 --- a/network/server_trust_store.gd +++ b/network/server_trust_store.gd @@ -19,6 +19,10 @@ var _data_root: PlayerDataRoot func configure_storage(path: String, data_root: PlayerDataRoot) -> void: _store_path = path _data_root = data_root + _records.clear() + _loaded = false + _write_blocked = false + _expected_hash = "" func verify(endpoint: ConnectionEndpoint, fingerprint: String) -> Verification: diff --git a/player/animalese_voice_profiles.gd b/player/animalese_voice_profiles.gd index 2ea6cab..ded0898 100644 --- a/player/animalese_voice_profiles.gd +++ b/player/animalese_voice_profiles.gd @@ -2,9 +2,27 @@ class_name AnimaleseVoiceProfiles extends RefCounted const DEFAULT_ID: String = "natural" +const DEFAULT_SAMPLE_SET_ID: String = "kat" const DEFAULT_SPEED_ID: String = "normal" const DEFAULT_CALL_ID: String = "meow" const CALL_AUDIO_DIRECTORY: String = "res://sound/dialogue/calls" +const SAMPLE_SET_OPTIONS: Array[Dictionary] = [ + { + "id": "kat", + "label": "kat", + "directory": "res://sound/dialogue/animalese/alphanumeric", + }, + { + "id": "robot", + "label": "robot", + "directory": "res://sound/dialogue/animalese/robot", + }, + { + "id": "kim", + "label": "kim", + "directory": "res://sound/dialogue/animalese/kim", + }, +] const OPTIONS: Array[Dictionary] = [ {"id": "tiny", "label": "tiny", "pitch": 1.24}, {"id": "bright", "label": "bright", "pitch": 1.10}, @@ -12,6 +30,31 @@ const OPTIONS: Array[Dictionary] = [ {"id": "mellow", "label": "mellow", "pitch": 0.89}, {"id": "deep", "label": "deep", "pitch": 0.77}, ] + + +static func is_valid_sample_set(sample_set_id: String) -> bool: + for option: Dictionary in SAMPLE_SET_OPTIONS: + if str(option.get("id", "")) == sample_set_id: + return true + return false + + +static func sanitized_sample_set_id(sample_set_id: String) -> String: + return ( + sample_set_id + if is_valid_sample_set(sample_set_id) + else DEFAULT_SAMPLE_SET_ID + ) + + +static func sample_directory_for(sample_set_id: String) -> String: + var resolved_id := sanitized_sample_set_id(sample_set_id) + for option: Dictionary in SAMPLE_SET_OPTIONS: + if str(option.get("id", "")) == resolved_id: + return str(option.get("directory", "")) + return "" + + const SPEED_OPTIONS: Array[Dictionary] = [ {"id": "slow", "label": "slow", "characters_per_second": 20.0}, {"id": "relaxed", "label": "relaxed", "characters_per_second": 24.0}, diff --git a/player/fishing_rod_attachment.tscn b/player/fishing_rod_attachment.tscn index f284825..d803e28 100644 --- a/player/fishing_rod_attachment.tscn +++ b/player/fishing_rod_attachment.tscn @@ -1,4 +1,6 @@ -[gd_scene load_steps=3 format=3] +[gd_scene load_steps=4 format=3] + +[ext_resource type="Script" path="res://player/tool_socket_attachment.gd" id="1_socket"] [sub_resource type="CylinderMesh" id="FishingRodMesh"] top_radius = 0.025 @@ -11,6 +13,8 @@ roughness = 0.8 [node name="FishingRodAttachment" type="BoneAttachment3D"] bone_name = "rod_socket" +script = ExtResource("1_socket") +aligned_mount_path = NodePath("FishingRod") [node name="FishingRod" type="Node3D" parent="."] diff --git a/player/net_attachment.gd b/player/net_attachment.gd new file mode 100644 index 0000000..3c7843a --- /dev/null +++ b/player/net_attachment.gd @@ -0,0 +1,88 @@ +extends "res://player/tool_socket_attachment.gd" + +const TextureSamplingPolicyScript := preload( + "res://main/texture_sampling_policy.gd" +) +const SPRING_ROOT_BONE: StringName = &"net_mid" +const SPRING_END_BONE: StringName = &"net_tip" +const IMPACT_BONE: StringName = &"net_rim" + +@export_range(0.0, 10.0, 0.05) var spring_stiffness: float = 1.8 +@export_range(0.0, 1.0, 0.01) var spring_drag: float = 0.68 +@export_range(0.0, 10.0, 0.05) var spring_gravity: float = 0.3 +@export_range(0.01, 0.5, 0.01) var spring_end_length: float = 0.1 + +@onready var _catching_net: Node3D = %CatchingNet +@onready var _net_model: Node3D = %NetModel + +var _spring: SpringBoneSimulator3D +var _spring_was_visible: bool = false +var _net_skeleton: Skeleton3D + + +func _ready() -> void: + super._ready() + TextureSamplingPolicyScript.enforce_subtree(_net_model) + _configure_spring() + _sync_spring_activity() + + +func _process(_delta: float) -> void: + _sync_spring_activity() + + +func _configure_spring() -> void: + _net_skeleton = _net_model.find_child( + "Skeleton3D", true, false + ) as Skeleton3D + if _net_skeleton == null: + push_error("Imported net model is missing its Skeleton3D.") + return + if _net_skeleton.find_bone(SPRING_ROOT_BONE) < 0: + push_error("Imported net model is missing bone %s." % SPRING_ROOT_BONE) + return + if _net_skeleton.find_bone(SPRING_END_BONE) < 0: + push_error("Imported net model is missing bone %s." % SPRING_END_BONE) + return + if _net_skeleton.find_bone(IMPACT_BONE) < 0: + push_error("Imported net model is missing bone %s." % IMPACT_BONE) + return + + _spring = SpringBoneSimulator3D.new() + _spring.name = "NetSpring" + _spring.set_setting_count(1) + _spring.set_root_bone_name(0, SPRING_ROOT_BONE) + _spring.set_end_bone_name(0, SPRING_END_BONE) + _spring.set_extend_end_bone(0, true) + _spring.set_end_bone_direction( + 0, SkeletonModifier3D.BONE_DIRECTION_FROM_PARENT + ) + _spring.set_end_bone_length(0, spring_end_length) + _spring.set_stiffness(0, spring_stiffness) + _spring.set_drag(0, spring_drag) + _spring.set_gravity(0, spring_gravity) + _spring.set_gravity_direction(0, Vector3.DOWN) + _net_skeleton.add_child(_spring) + + +func get_impact_world_position() -> Vector3: + if _net_skeleton == null: + return _catching_net.global_position + var impact_bone_index := _net_skeleton.find_bone(IMPACT_BONE) + if impact_bone_index < 0: + return _catching_net.global_position + return _net_skeleton.global_transform * ( + _net_skeleton.get_bone_global_pose(impact_bone_index).origin + ) + + +func _sync_spring_activity() -> void: + if _spring == null: + return + var is_visible := _catching_net.is_visible_in_tree() + if is_visible and not _spring_was_visible: + _spring.active = true + _spring.reset() + elif not is_visible: + _spring.active = false + _spring_was_visible = is_visible diff --git a/player/net_attachment.gd.uid b/player/net_attachment.gd.uid new file mode 100644 index 0000000..9bf2fd6 --- /dev/null +++ b/player/net_attachment.gd.uid @@ -0,0 +1 @@ +uid://cw5vc02hoelgm diff --git a/player/net_attachment.tscn b/player/net_attachment.tscn index 7c16fca..da49a88 100644 --- a/player/net_attachment.tscn +++ b/player/net_attachment.tscn @@ -1,55 +1,20 @@ -[gd_scene load_steps=7 format=3] +[gd_scene load_steps=3 format=3] -[sub_resource type="StandardMaterial3D" id="HandleMaterial"] -albedo_color = Color(0.25, 0.13, 0.055, 1) -roughness = 0.9 - -[sub_resource type="CylinderMesh" id="HandleMesh"] -material = SubResource("HandleMaterial") -top_radius = 0.025 -bottom_radius = 0.035 -height = 1.25 - -[sub_resource type="StandardMaterial3D" id="HoopMaterial"] -albedo_color = Color(0.34, 0.39, 0.4, 1) -metallic = 0.25 -roughness = 0.65 - -[sub_resource type="TorusMesh" id="HoopMesh"] -material = SubResource("HoopMaterial") -inner_radius = 0.24 -outer_radius = 0.29 -rings = 12 -ring_segments = 18 - -[sub_resource type="StandardMaterial3D" id="NetMaterial"] -transparency = 1 -albedo_color = Color(0.65, 0.78, 0.75, 0.42) -shading_mode = 0 -cull_mode = 2 - -[sub_resource type="CylinderMesh" id="NetMesh"] -material = SubResource("NetMaterial") -top_radius = 0.24 -bottom_radius = 0.08 -height = 0.34 -radial_segments = 12 -rings = 1 +[ext_resource type="Script" path="res://player/net_attachment.gd" id="1_script"] +[ext_resource type="PackedScene" path="res://art/exported/items/equipment/net.glb" id="2_model"] [node name="NetAttachment" type="BoneAttachment3D"] bone_name = "rod_socket" +script = ExtResource("1_script") +aligned_mount_path = NodePath("CatchingNet") -[node name="CatchingNet" type="Node3D" parent="."] +[node name="CatchingNet" type="Node3D" parent="." unique_id=947004727] +unique_name_in_owner = true visible = false -[node name="Handle" type="MeshInstance3D" parent="CatchingNet"] -position = Vector3(0, 0.55, 0) -mesh = SubResource("HandleMesh") +[node name="ModelMount" type="Node3D" parent="CatchingNet"] +position = Vector3(-0.000217, -0.098636, -0.020218) +rotation = Vector3(0, 3.1415927, 0) -[node name="Hoop" type="MeshInstance3D" parent="CatchingNet"] -position = Vector3(0, 1.17, 0) -mesh = SubResource("HoopMesh") - -[node name="Bag" type="MeshInstance3D" parent="CatchingNet"] -position = Vector3(0, 1.0, 0) -mesh = SubResource("NetMesh") +[node name="NetModel" parent="CatchingNet/ModelMount" unique_id=1627767240 instance=ExtResource("2_model")] +unique_name_in_owner = true diff --git a/player/player.gd b/player/player.gd index da23e45..e36f92b 100644 --- a/player/player.gd +++ b/player/player.gd @@ -19,6 +19,9 @@ const PlayerItemEffectsType = preload( const PlayerCoolerCapacityType = preload( "res://progression/player_cooler_capacity.gd" ) +const PlayerInventoryLayoutType = preload( + "res://inventory/player_inventory_layout.gd" +) const PlayerArtUnlocksType = preload( "res://progression/player_art_unlocks.gd" ) @@ -32,11 +35,16 @@ const FishingRodAttachmentScene = preload( "res://player/fishing_rod_attachment.tscn" ) const NetAttachmentScene = preload("res://player/net_attachment.tscn") +const NetAttachmentType = preload("res://player/net_attachment.gd") +const ShovelAttachmentScene = preload("res://player/shovel_attachment.tscn") const FishingRodDataType = preload("res://items/fishing_rod_data.gd") const HeldItemAttachmentScene = preload( "res://player/held_item_attachment.tscn" ) const SprintDustTrailType = preload("res://player/sprint_dust_trail.gd") +const VoiceProfilesType = preload( + "res://player/animalese_voice_profiles.gd" +) signal retract_visual_finished @@ -48,6 +56,8 @@ const CHARACTER_WALKING_ANIMATION: StringName = &"walking" const CHARACTER_WALKING_SHOW_ANIMATION: StringName = &"walking_show" const CHARACTER_RUNNING_ANIMATION: StringName = &"running" const CHARACTER_RUNNING_SHOW_ANIMATION: StringName = &"running_show" +const CHARACTER_IDLE_SNEAK_ANIMATION: StringName = &"idle_sneak" +const CHARACTER_SNEAKING_ANIMATION: StringName = &"sneaking" const CHARACTER_CASTING_ANIMATION: StringName = &"casting" const CHARACTER_CASTING_SIT_ANIMATION: StringName = &"casting_sit" const CHARACTER_RELEASE_ANIMATION: StringName = &"release" @@ -70,10 +80,20 @@ const CHARACTER_FISHING_ANIMATION: StringName = &"fishing" const CHARACTER_FISHING_SIT_ANIMATION: StringName = &"fishing_sit" const CHARACTER_FIGHTING_ANIMATION: StringName = &"fighting" const CHARACTER_FIGHTING_SIT_ANIMATION: StringName = &"fighting_sit" +const CHARACTER_NET_DRAW_ANIMATION: StringName = &"draw" +const CHARACTER_NET_STRIKE_ANIMATION: StringName = &"strike" +const CATCH_PRESENTATION_REFERENCE_LONG_SIDE_PX: float = 1280.0 +const CATCH_PRESENTATION_MIN_TEXTURE_SCALE: float = 0.1 +const CATCH_PRESENTATION_MAX_TEXTURE_SCALE: float = 20.0 +const CATCH_SHOWCASE_INPUT_OWNER: StringName = &"catch_showcase" # Add future networked emote animation IDs here. The protocol accepts unknown # safe IDs so newer clients can extend it, but Player only presents actions # explicitly approved by this catalog. -const NETWORK_ANIMATION_ACTION_IDS: Array[StringName] = [] +const NETWORK_ANIMATION_ACTION_IDS: Array[StringName] = [ + CHARACTER_CASTING_ANIMATION, + CHARACTER_NET_DRAW_ANIMATION, + CHARACTER_NET_STRIKE_ANIMATION, +] enum FishingVisualPhase { NONE, @@ -95,6 +115,7 @@ enum LocomotionState { IDLE, WALKING, RUNNING, + SNEAKING, } const FIGHTING_EYES_ID: String = "alligator_eyes" const BLINK_EYES_ID: String = "closed" @@ -102,6 +123,13 @@ const BLINK_INTERVAL_SECONDS := Vector2(2.8, 7.5) const BLINK_DURATION_SECONDS: float = 0.11 const CHARACTER_CALL_MOUTH_ID: String = "open_ah" const CHARACTER_CALL_MOUTH_DURATION_SECONDS: float = 0.16 +const SPEECH_MOUTH_IDS: Array[String] = [ + "open_ah", + "open_oh", + "open_small", + "open_smile", +] +const SPEECH_MOUTH_FRAME_SECONDS: float = 0.09 const BASE_REEL_SPEED: float = 0.16 const LANDING_DUST_MIN_FALL_SPEED: float = 2.5 const NETWORK_EXTRAPOLATION_LIMIT_SECONDS: float = 0.25 @@ -111,11 +139,20 @@ const NETWORK_SNAPSHOT_JITTER_WEIGHT: float = 0.15 const NETWORK_REMOTE_SMOOTHING_RATE: float = 12.0 const NETWORK_REMOTE_JITTER_SMOOTHING_RATE: float = 6.0 const NETWORK_INPUT_STALE_TIMEOUT_SECONDS: float = 0.25 +const NETWORK_INPUT_STALE_TIMEOUT_MAX_SECONDS: float = 1.25 +const NETWORK_INPUT_STALE_RTT_MULTIPLIER: float = 1.5 +const NETWORK_MOVEMENT_HISTORY_SECONDS: float = 1.25 +const NETWORK_MAX_LAG_COMPENSATION_SECONDS: float = 0.75 const LOCAL_PREDICTION_EXTRAPOLATION_LIMIT_SECONDS: float = 0.25 const LOCAL_PREDICTION_FALLBACK_TRANSIT_RATIO: float = 0.5 -const LOCAL_PREDICTION_CORRECTION_THRESHOLD: float = 0.12 -const LOCAL_PREDICTION_SNAP_DISTANCE: float = 2.0 -const LOCAL_PREDICTION_CORRECTION_WEIGHT: float = 0.18 +const LOCAL_PREDICTION_CORRECTION_THRESHOLD: float = 1.5 +const LOCAL_PREDICTION_SNAP_DISTANCE: float = 6.0 +const LOCAL_PREDICTION_CORRECTION_DELAY_SECONDS: float = 0.35 +const LOCAL_PREDICTION_MIN_CORRECTION_AUDITS: int = 3 +const LOCAL_PREDICTION_SOFT_CORRECTION_RATE: float = 2.5 +const LOCAL_PREDICTION_MAX_SOFT_CORRECTION_STEP: float = 0.15 +const LOCAL_PREDICTION_MAX_AUDIT_DELTA_SECONDS: float = 0.15 +const LOCAL_RECONCILIATION_PRESENTATION_RECENTER_RATE: float = 5.0 # The target Android handheld exposes its physical right trigger through # Godot's left-trigger axis. Keep the role named here so the platform mapping # remains isolated from camera behavior. @@ -124,7 +161,8 @@ const CONTROLLER_ZOOM_TRIGGER_AXIS: JoyAxis = JOY_AXIS_TRIGGER_LEFT var appearance_snapshot: Dictionary = ( CharacterCustomizationCatalog.default_snapshot() ) -var animalese_voice_id: String = "natural" +var animalese_voice_id: String = VoiceProfilesType.DEFAULT_ID +var animalese_sample_set_id: String = VoiceProfilesType.DEFAULT_SAMPLE_SET_ID var active_bait_id: StringName = StringName() var active_lure_id: StringName = StringName() signal active_bait_changed(item_id: StringName) @@ -206,6 +244,42 @@ func play_character_call_visual() -> void: _apply_presented_appearance() +func play_speech_visual(duration_seconds: float) -> void: + stop_speech_visual() + if duration_seconds <= 0.0 or SPEECH_MOUTH_IDS.is_empty(): + return + var generation: int = _speech_visual_generation + var elapsed: float = 0.0 + var frame_index: int = 0 + _speech_mouth_active = true + while elapsed < duration_seconds: + _speech_mouth_id = SPEECH_MOUTH_IDS[ + frame_index % SPEECH_MOUTH_IDS.size() + ] + _apply_presented_appearance() + var frame_duration := minf( + SPEECH_MOUTH_FRAME_SECONDS, + duration_seconds - elapsed, + ) + await get_tree().create_timer(frame_duration).timeout + if generation != _speech_visual_generation: + return + elapsed += frame_duration + frame_index += 1 + _speech_mouth_active = false + _speech_mouth_id = "" + _apply_presented_appearance() + + +func stop_speech_visual() -> void: + _speech_visual_generation += 1 + if not _speech_mouth_active and _speech_mouth_id.is_empty(): + return + _speech_mouth_active = false + _speech_mouth_id = "" + _apply_presented_appearance() + + func set_fishing_visual(active: bool) -> void: if ( active @@ -274,6 +348,10 @@ func _apply_presented_appearance() -> void: if _fighting_visual_active: presented_appearance = appearance_snapshot.duplicate(true) presented_appearance["eyes"] = FIGHTING_EYES_ID + if _speech_mouth_active and not _speech_mouth_id.is_empty(): + if presented_appearance == appearance_snapshot: + presented_appearance = appearance_snapshot.duplicate(true) + presented_appearance["mouth"] = _speech_mouth_id if _character_call_mouth_active: if presented_appearance == appearance_snapshot: presented_appearance = appearance_snapshot.duplicate(true) @@ -282,12 +360,22 @@ func _apply_presented_appearance() -> void: func apply_animalese_voice_id(voice_id: String) -> void: - animalese_voice_id = voice_id + animalese_voice_id = VoiceProfilesType.sanitized_id(voice_id) func get_animalese_voice_id() -> String: return animalese_voice_id + +func apply_animalese_sample_set_id(sample_set_id: String) -> void: + animalese_sample_set_id = VoiceProfilesType.sanitized_sample_set_id( + sample_set_id + ) + + +func get_animalese_sample_set_id() -> String: + return animalese_sample_set_id + class ShowcaseCameraSnapshot: extends RefCounted @@ -296,7 +384,6 @@ class ShowcaseCameraSnapshot: var pitch_rotation: Vector3 var spring_length: float var target_zoom: float - var camera_input_enabled: bool var camera_dragging: bool @@ -323,16 +410,26 @@ class ShowcaseCameraSnapshot: @export_range(0.05, 1.0, 0.01) var showcase_restore_duration: float = 0.24 @export_range(0.05, 1.5, 0.01) var showcase_camera_transition_duration: float = 0.42 @export_range(-180.0, 180.0, 1.0) var showcase_camera_yaw_offset: float = 180.0 +@export_range(-180.0, 180.0, 1.0) var net_showcase_camera_yaw_offset: float = 0.0 @export_range(-80.0, 80.0, 1.0) var showcase_camera_pitch: float = -8.0 @export_range(1.0, 10.0, 0.1) var showcase_camera_zoom_distance: float = 3.6 @export_range(0.5, 3.0, 0.05) var showcase_camera_target_height: float = 1.45 @export_range(0.01, 1.0, 0.01) var catch_presentation_base_scale: float = 0.10 +@export_category("Gathering") +@export_flags_3d_physics var net_impact_collision_mask: int = 1 +@export_range(0.02, 0.5, 0.01) var net_impact_radius: float = 0.16 +@export_range(0.0, 1.0, 0.01) var net_success_contact_pause_duration: float = 0.45 + @export_category("Camera") @export var mouse_sensitivity: float = 0.005 @export var controller_camera_speed: float = 2.5 @export_range(0.0, 1.0, 0.01) var controller_camera_deadzone: float = 0.2 @export var invert_camera_y: bool = false +var _swap_hotbar_camera_scroll: bool = false +var _rv_interior_camera_mode: bool = false +var _rv_interior_environment: Environment +var _rv_previous_camera_environment: Environment @export_range(-89.0, 0.0, 0.5) var minimum_pitch_degrees: float = -65.0 @export_range(0.0, 89.0, 0.5) var maximum_pitch_degrees: float = 45.0 @export var minimum_zoom: float = 2.0 @@ -365,6 +462,7 @@ class ShowcaseCameraSnapshot: @onready var fishing_upgrades: PlayerFishingUpgradesType = %FishingUpgrades @onready var item_effects: PlayerItemEffectsType = %ItemEffects @onready var cooler_capacity: PlayerCoolerCapacityType = %CoolerCapacity +@onready var inventory_layout: PlayerInventoryLayoutType = %InventoryLayout @onready var art_unlocks: PlayerArtUnlocksType = %ArtUnlocks @onready var experience: PlayerExperienceType = %Experience @onready var _cast_origin: Marker3D = %CastOrigin @@ -376,12 +474,16 @@ var _held_fish_attachment_offset: Vector3 = Vector3(0.0, 0.08, 0.04) var _held_fish_sprite: Sprite3D var _held_art_kit_display: Node3D var _held_art_kit_sprite: Sprite3D +var _held_decor_package_display: Node3D +var _held_decor_package_visible: bool = false var _catch_attachment_offset: Vector3 = Vector3(0.0, 0.08, 0.04) var _gravity: float = float(ProjectSettings.get_setting("physics/3d/default_gravity")) var _camera_dragging: bool = false var _camera_input_enabled: bool = true var _camera_drag_prior_mouse_mode: Input.MouseMode = Input.MOUSE_MODE_VISIBLE +var _camera_drag_pointer_origin: Vector2 = Vector2.ZERO +var _camera_drag_restore_pointer: bool = false var _free_camera_active: bool = false var _free_camera_body: CharacterBody3D var _free_camera: Camera3D @@ -389,6 +491,7 @@ var _free_camera_yaw: float = 0.0 var _free_camera_pitch: float = 0.0 var _movement_enabled: bool = true var _local_input_suppressors: Dictionary[StringName, bool] = {} +var _camera_input_suppressors: Dictionary[StringName, bool] = {} var _water_recovery_active: bool = false var _remote_recovery_presentation_active: bool = false var _remote_recovery_visual_origin: Vector3 @@ -396,6 +499,7 @@ var _remote_recovery_elapsed: float = 0.0 var _target_zoom: float = 5.0 var _showcase_rod_visibility: bool = true var _showcase_net_visibility: bool = false +var _showcase_shovel_visibility: bool = false var _remote_presentation_visible := true var _showcase_rod_state_stored: bool = false var _showcase_visual_rotation: Vector3 @@ -417,6 +521,9 @@ var _network_slow_walk: bool = false var _last_network_input_sequence: int = 0 var _network_input_age: float = 0.0 var _network_input_stale: bool = false +var _network_input_stale_timeout_seconds: float = ( + NETWORK_INPUT_STALE_TIMEOUT_SECONDS +) var _network_jump_intent_active: bool = false var _network_target_position: Vector3 var _network_target_velocity: Vector3 @@ -426,16 +533,29 @@ var _network_target_locomotion_state: LocomotionState = LocomotionState.IDLE var _network_target_animation_action_id: StringName = &"" var _network_target_animation_action_sequence: int = 0 var _network_target_animation_action_elapsed: float = 0.0 +var _network_target_animation_action_paused: bool = false var _network_snapshot_ready: bool = false var _network_snapshot_age: float = 0.0 var _network_snapshot_jitter: float = 0.0 +var _network_simulation_only: bool = false +var _local_reconciliation_visual_offset: Vector3 = Vector3.ZERO +var _local_reconciliation_camera_offset: Vector3 = Vector3.ZERO +var _local_prediction_error_seconds: float = 0.0 +var _local_prediction_error_audits: int = 0 +var _local_prediction_error_direction: Vector3 = Vector3.ZERO +var _local_prediction_soft_corrections: int = 0 +var _local_prediction_hard_corrections: int = 0 +var _local_prediction_largest_error: float = 0.0 +var _authoritative_movement_history: Array[Dictionary] = [] var _local_network_jump_intent_pending: bool = false var _local_network_jump_intent_sequence: int = -1 var _animation_action_id: StringName = &"" var _animation_action_sequence: int = 0 var _animation_action_elapsed: float = 0.0 +var _animation_action_paused: bool = false var _presented_animation_action_id: StringName = &"" var _presented_animation_action_sequence: int = -1 +var _presented_animation_action_paused: bool = false var _character_animation_name: StringName = &"" var _sitting: bool = false var _sit_after_landing: bool = false @@ -460,12 +580,28 @@ var _blink_seconds_remaining: float = 0.0 var _blink_rng := RandomNumberGenerator.new() var _character_call_mouth_active: bool = false var _character_call_visual_generation: int = 0 +var _speech_mouth_active: bool = false +var _speech_mouth_id: String = "" +var _speech_visual_generation: int = 0 var _fishing_visual_active: bool = false var _fishing_visual_phase: FishingVisualPhase = FishingVisualPhase.NONE var _fishing_after_release_pending: bool = false var _retract_animation_completed: bool = true var _fishing_rod: Node3D var _catching_net: Node3D +var _catching_net_attachment: NetAttachmentType +var _shovel: Node3D +var _net_strike_collision_armed: bool = false +var _net_strike_has_previous_sample: bool = false +var _net_strike_previous_position: Vector3 +var _net_strike_previous_animation_position: float = 0.0 +var _net_strike_contact_held: bool = false +var _net_strike_result_known: bool = false +var _net_strike_successful: bool = false +var _net_strike_showcase_pause_tween: Tween +var _net_impact_shape := SphereShape3D.new() +var _pending_net_showcase_catch: FishCatchType +var _pending_net_showcase_remote: bool = false var _fishing_rod_tip: Marker3D var _fishing_rod_model_mount: Node3D var _fishing_rod_fallback_visual: GeometryInstance3D @@ -473,6 +609,7 @@ var _custom_fishing_rod_visual: Node3D var _active_fishing_rod_id: StringName var _active_item_is_rod: bool = false var _active_item_is_net: bool = false +var _active_item_is_shovel: bool = false var _controller_mapping_manager: ControllerMappingManagerType var _sprint_dust_landing_ready: bool = false var _sprint_dust_airborne: bool = false @@ -498,6 +635,7 @@ func _ready() -> void: _apply_presented_appearance() _initialize_fishing_rod() _initialize_catching_net() + _initialize_shovel() _target_zoom = clampf(_spring_arm.spring_length, minimum_zoom, maximum_zoom) _spring_arm.spring_length = _target_zoom _camera.current = local_control_enabled @@ -567,6 +705,192 @@ func end_animation_action() -> void: ) +func begin_net_draw_visual() -> bool: + return begin_animation_action( + CHARACTER_NET_DRAW_ANIMATION + if is_sneaking() + else CHARACTER_CASTING_ANIMATION + ) + + +func play_net_strike_visual() -> bool: + if begin_animation_action(CHARACTER_NET_STRIKE_ANIMATION): + _net_strike_collision_armed = local_control_enabled + _net_strike_has_previous_sample = false + _net_strike_contact_held = false + _net_strike_result_known = false + _net_strike_successful = false + return true + cancel_net_action_visual() + return false + + +func resolve_net_strike_visual(successful: bool) -> void: + if _animation_action_id != CHARACTER_NET_STRIKE_ANIMATION: + return + _net_strike_result_known = true + _net_strike_successful = successful + if successful: + _net_strike_collision_armed = false + if successful and _animation_action_paused: + _net_strike_contact_held = false + _set_animation_action_paused(false) + + +func is_net_strike_held() -> bool: + return ( + _animation_action_id == CHARACTER_NET_STRIKE_ANIMATION + and _net_strike_contact_held + ) + + +func release_net_strike_hold() -> bool: + if not is_net_strike_held(): + return false + cancel_net_action_visual() + return true + + +func cancel_net_action_visual() -> void: + _clear_net_strike_state() + if _animation_action_id in [ + CHARACTER_CASTING_ANIMATION, + CHARACTER_NET_DRAW_ANIMATION, + CHARACTER_NET_STRIKE_ANIMATION, + ]: + end_animation_action() + + +func _clear_net_strike_state() -> void: + _kill_net_strike_showcase_pause() + _net_strike_collision_armed = false + _net_strike_has_previous_sample = false + _net_strike_contact_held = false + _net_strike_result_known = false + _net_strike_successful = false + if _animation_action_paused: + _set_animation_action_paused(false) + + +func _kill_net_strike_showcase_pause() -> void: + if ( + _net_strike_showcase_pause_tween != null + and _net_strike_showcase_pause_tween.is_valid() + ): + _net_strike_showcase_pause_tween.kill() + _net_strike_showcase_pause_tween = null + + +func _hold_successful_net_strike_before_showcase() -> void: + _kill_net_strike_showcase_pause() + var strike_animation := _character_animation_player.get_animation( + CHARACTER_NET_STRIKE_ANIMATION + ) + if strike_animation != null: + _animation_action_elapsed = maxf( + strike_animation.length - 0.001, + 0.0, + ) + _net_strike_collision_armed = false + _net_strike_contact_held = false + _set_animation_action_paused(true) + if net_success_contact_pause_duration <= 0.0: + _finish_successful_net_strike_pause() + return + _net_strike_showcase_pause_tween = create_tween() + _net_strike_showcase_pause_tween.tween_interval( + net_success_contact_pause_duration + ) + _net_strike_showcase_pause_tween.finished.connect( + _finish_successful_net_strike_pause + ) + + +func _finish_successful_net_strike_pause() -> void: + _net_strike_showcase_pause_tween = null + if local_control_enabled: + if not _net_strike_result_known or not _net_strike_successful: + return + _clear_net_strike_state() + end_animation_action() + _begin_pending_net_showcase() + + +func _set_animation_action_paused(paused: bool) -> void: + if _animation_action_id.is_empty() or _animation_action_paused == paused: + return + var next_sequence: int = ( + 1 + if _animation_action_sequence + >= NetworkPlayerAnimationProtocol.MAX_ACTION_SEQUENCE + else _animation_action_sequence + 1 + ) + _apply_animation_action_state( + NetworkPlayerAnimationProtocol.make_action_state( + _animation_action_id, + next_sequence, + _animation_action_elapsed, + paused, + ) + ) + + +func _update_net_strike_contact() -> void: + if ( + not local_control_enabled + or not _net_strike_collision_armed + or _animation_action_paused + or _animation_action_id != CHARACTER_NET_STRIKE_ANIMATION + or _catching_net_attachment == null + or _character_animation_player == null + or get_world_3d() == null + ): + return + var current_position: Vector3 = ( + _catching_net_attachment.get_impact_world_position() + ) + var current_animation_position: float = ( + _character_animation_player.current_animation_position + ) + if not _net_strike_has_previous_sample: + _net_strike_previous_position = current_position + _net_strike_previous_animation_position = current_animation_position + _net_strike_has_previous_sample = true + return + var motion := current_position - _net_strike_previous_position + if motion.length_squared() <= 0.000001: + _net_strike_previous_animation_position = current_animation_position + return + _net_impact_shape.radius = net_impact_radius + var query := PhysicsShapeQueryParameters3D.new() + query.shape = _net_impact_shape + query.transform = Transform3D( + Basis.IDENTITY, + _net_strike_previous_position, + ) + query.motion = motion + query.collision_mask = net_impact_collision_mask + query.collide_with_areas = false + query.collide_with_bodies = true + query.exclude = [get_rid()] + var fractions: PackedFloat32Array = ( + get_world_3d().direct_space_state.cast_motion(query) + ) + if fractions.size() >= 2 and float(fractions[1]) < 1.0: + var impact_fraction := clampf(float(fractions[0]), 0.0, 1.0) + _animation_action_elapsed = lerpf( + _net_strike_previous_animation_position, + current_animation_position, + impact_fraction, + ) + _net_strike_collision_armed = false + _net_strike_contact_held = true + _set_animation_action_paused(true) + return + _net_strike_previous_position = current_position + _net_strike_previous_animation_position = current_animation_position + + func _apply_animation_action_state(action_state: Dictionary) -> void: if not NetworkPlayerAnimationProtocol.validate_action_state(action_state): return @@ -580,10 +904,13 @@ func _apply_animation_action_state(action_state: Dictionary) -> void: var action_changed: bool = ( action_id != _animation_action_id or action_sequence != _animation_action_sequence + or bool(action_state.get("paused", false)) + != _animation_action_paused ) _animation_action_id = action_id _animation_action_sequence = action_sequence _animation_action_elapsed = float(action_state["elapsed"]) + _animation_action_paused = bool(action_state.get("paused", false)) if action_changed: _character_animation_name = &"" _update_character_animation() @@ -620,16 +947,34 @@ func _initialize_catching_net() -> void: if skeleton == null: push_error("Player character skeleton is unavailable for the net.") return - var attachment := NetAttachmentScene.instantiate() as BoneAttachment3D + var attachment := NetAttachmentScene.instantiate() as NetAttachmentType if attachment == null: push_error("Catching net attachment could not be instantiated.") return skeleton.add_child(attachment) + _catching_net_attachment = attachment _catching_net = attachment.get_node("CatchingNet") as Node3D if _catching_net != null: _catching_net.visible = false +func _initialize_shovel() -> void: + var skeleton := get_node_or_null( + "Visuals/CharacterRig/CharacterRig/Skeleton3D" + ) as Skeleton3D + if skeleton == null: + push_error("Player character skeleton is unavailable for the shovel.") + return + var attachment := ShovelAttachmentScene.instantiate() as BoneAttachment3D + if attachment == null: + push_error("Shovel attachment could not be instantiated.") + return + skeleton.add_child(attachment) + _shovel = attachment.get_node("Shovel") as Node3D + if _shovel != null: + _shovel.visible = false + + func _initialize_held_item_attachment() -> void: var skeleton := get_node_or_null( "Visuals/CharacterRig/CharacterRig/Skeleton3D" @@ -652,6 +997,7 @@ func _initialize_held_item_attachment() -> void: _held_art_kit_sprite = attachment.get_node( "HeldArtKitDisplay/HeldArtKitSprite" ) as Sprite3D + _held_decor_package_display = _build_decor_package_display(attachment) _catch_display = attachment.get_node("CatchDisplay") as Node3D _catch_attachment_offset = _catch_display.position _catch_sprite = attachment.get_node("CatchDisplay/CatchSprite") as Sprite3D @@ -661,6 +1007,12 @@ func _physics_process(delta: float) -> void: if _network_interpolation_enabled: _update_network_interpolation(delta) return + _simulate_movement_physics(delta) + if _network_authoritative_simulation: + _record_authoritative_movement_state() + + +func _simulate_movement_physics(delta: float) -> void: if _network_authoritative_simulation: _update_network_input_freshness(delta) if local_control_enabled and _free_camera_active: @@ -690,7 +1042,15 @@ func _physics_process(delta: float) -> void: or (_network_authoritative_simulation and _network_jump_pending) ) ) - if _sit_after_landing and is_on_floor(): + if jump_requested: + _cancel_sitting_for_jump() + # Sitting deliberately stops movement processing, so never allow a stale + # grounded flag or a reconciled network state to leave an airborne avatar in + # that early-return path. Preserve the intent and sit once landing is real. + if _sitting and not _can_begin_sitting(): + _sit_after_landing = true + _set_sitting(false) + if _sit_after_landing and not jump_requested and _can_begin_sitting(): _sit_after_landing = false _set_sitting(true, local_control_enabled) if _sitting: @@ -743,6 +1103,8 @@ func _physics_process(delta: float) -> void: move_direction.y = 0.0 var input_strength: float = minf(input_vector.length(), 1.0) move_direction = move_direction.normalized() + if input_strength > 0.05: + release_net_strike_hold() var speed: float = _get_network_aware_speed() if item_effects != null: @@ -762,13 +1124,17 @@ func _physics_process(delta: float) -> void: func _process(delta: float) -> void: - if not _animation_action_id.is_empty(): + if _network_simulation_only: + return + _update_local_reconciliation_visuals(delta) + if not _animation_action_id.is_empty() and not _animation_action_paused: _animation_action_elapsed = minf( _animation_action_elapsed + delta, NetworkPlayerAnimationProtocol.MAX_ACTION_ELAPSED_SECONDS, ) _update_blink(delta) _update_character_animation() + _update_net_strike_contact() _update_sprint_dust(delta) # The hand bone supplies the attachment position, but its animated wrist # rotation should not turn the flat fish/catch artwork edge-on. Keep each @@ -806,9 +1172,6 @@ func _process(delta: float) -> void: ) return - if _camera_dragging and not Input.is_action_pressed("camera_drag"): - _set_camera_dragging(false) - if _is_camera_input_enabled(): var stick: Vector2 = _get_controller_camera_stick() if stick.length() > controller_camera_deadzone: @@ -949,16 +1312,23 @@ func _update_character_animation() -> void: ) var is_walking: bool = locomotion_state != LocomotionState.IDLE var is_running: bool = locomotion_state == LocomotionState.RUNNING + var is_sneaking_pose: bool = ( + locomotion_state == LocomotionState.SNEAKING + ) + var is_moving_horizontally: bool = ( + _is_presented_moving_horizontally() + ) var animation_action: Dictionary = _get_presented_animation_action() var animation_action_id := StringName(str(animation_action.get("id", ""))) + var animation_action_paused: bool = bool( + animation_action.get("paused", false) + ) var animation_action_available: bool = ( not animation_action_id.is_empty() and supports_network_animation_action(animation_action_id) and _character_animation_player.has_animation(animation_action_id) ) - var held_show_item_visible: bool = ( - _held_fish_visible or _held_art_kit_visible - ) + var held_show_item_visible: bool = _has_held_show_item() var requested_animation: Array[StringName] = [] if _pocket_visual_active: requested_animation = [_pocket_visual_animation] @@ -1061,6 +1431,19 @@ func _update_character_animation() -> void: &"sitting", &"idle_loop_sit", ] + elif is_sneaking_pose: + if is_moving_horizontally: + requested_animation = [ + CHARACTER_SNEAKING_ANIMATION, + CHARACTER_WALKING_ANIMATION, + &"walking_loop", + ] + else: + requested_animation = [ + CHARACTER_IDLE_SNEAK_ANIMATION, + CHARACTER_IDLE_ANIMATION, + &"idle_loop", + ] elif is_running and held_show_item_visible: requested_animation = [ CHARACTER_RUNNING_SHOW_ANIMATION, @@ -1110,34 +1493,103 @@ func _update_character_animation() -> void: and ( animation_action_id != _presented_animation_action_id or action_sequence != _presented_animation_action_sequence + or animation_action_paused + != _presented_animation_action_paused ) ) if not action_selected: _presented_animation_action_id = &"" _presented_animation_action_sequence = -1 - if _character_animation_name == next_animation and not action_changed: + _presented_animation_action_paused = false + if ( + _character_animation_playback_matches( + next_animation, + action_selected and animation_action_paused, + ) + and not action_changed + ): return + # The animation name is only a selection cache. A remote player's + # AnimationPlayer can occasionally stop or lose its assigned animation while + # its replicated locomotion state remains valid. Reassert the selected + # presentation here instead of waiting for another network state transition; + # movement simulation and replication remain untouched. + _character_animation_player.active = true _character_animation_player.play(next_animation) _character_animation_name = next_animation if action_selected: _presented_animation_action_id = animation_action_id _presented_animation_action_sequence = action_sequence + _presented_animation_action_paused = animation_action_paused var elapsed: float = float(animation_action.get("elapsed", 0.0)) var animation: Animation = _character_animation_player.get_animation( next_animation ) - if elapsed > 0.0 and animation != null and animation.length > 0.0: + if ( + (elapsed > 0.0 or animation_action_paused) + and animation != null + and animation.length > 0.0 + ): _character_animation_player.seek( fposmod(elapsed, animation.length), true ) + if animation_action_paused: + _character_animation_player.pause() + + +func _character_animation_playback_matches( + animation_name: StringName, + paused_action_selected: bool, +) -> bool: + if ( + _character_animation_name != animation_name + or _character_animation_player.assigned_animation != animation_name + or not _character_animation_player.active + ): + return false + if paused_action_selected: + return true + var animation := _character_animation_player.get_animation(animation_name) + if animation == null or animation.loop_mode == Animation.LOOP_NONE: + # Completed one-shot actions deliberately keep their final pose until the + # authoritative action state advances; they must not be restarted here. + return true + return _character_animation_player.is_playing() func _on_character_animation_finished(animation_name: StringName) -> void: + if animation_name == CHARACTER_NET_STRIKE_ANIMATION: + if local_control_enabled: + if _net_strike_result_known and _net_strike_successful: + _hold_successful_net_strike_before_showcase() + else: + var strike_animation := ( + _character_animation_player.get_animation( + CHARACTER_NET_STRIKE_ANIMATION + ) + ) + if strike_animation != null: + _animation_action_elapsed = maxf( + strike_animation.length - 0.001, + 0.0, + ) + _net_strike_collision_armed = false + _net_strike_contact_held = true + _set_animation_action_paused(true) + return + if _pending_net_showcase_remote: + _hold_successful_net_strike_before_showcase() + return if ( local_control_enabled and not _animation_action_id.is_empty() and animation_name == _animation_action_id ): + if animation_name in [ + CHARACTER_CASTING_ANIMATION, + CHARACTER_NET_DRAW_ANIMATION, + ]: + return end_animation_action() return if animation_name in [ @@ -1189,6 +1641,7 @@ func _complete_retract_animation() -> void: func toggle_sitting() -> void: if _sit_after_landing: _sit_after_landing = false + _set_sitting(false, local_control_enabled) return var should_sit: bool = not _sitting if should_sit: @@ -1202,7 +1655,7 @@ func toggle_sitting() -> void: ]) ): return - if not is_on_floor(): + if not _can_begin_sitting(): _sit_after_landing = true return _set_sitting(should_sit, local_control_enabled) @@ -1221,12 +1674,12 @@ func _set_sitting( should_sit: bool, is_local_intent: bool = false, ) -> void: - if _sitting == should_sit: - return - _sitting = should_sit if is_local_intent: _sitting_intent_pending = true _sitting_intent_sequence = -1 + if _sitting == should_sit: + return + _sitting = should_sit if _sitting: velocity = Vector3.ZERO _character_animation_name = &"" @@ -1237,6 +1690,73 @@ func is_sitting() -> bool: return _sitting +func _can_begin_sitting() -> bool: + return is_on_floor() and velocity.y <= 0.0 + + +func _cancel_sitting_for_jump() -> void: + if not _sitting and not _sit_after_landing: + return + _sit_after_landing = false + _set_sitting(false, local_control_enabled) + + +func get_network_sitting_state() -> bool: + return _sitting + + +func get_network_sitting_intent() -> bool: + # Jumping is an explicit cancellation of both a current sit and a deferred + # sit. Input capture can run before the matching physics frame, so suppress + # the stale seated bit as soon as the reliable jump intent is queued. + if _local_network_jump_intent_pending: + return false + return _sitting or _sit_after_landing + + +func apply_network_sitting_state(should_sit: bool) -> void: + _set_sitting(should_sit) + + +func apply_authoritative_network_sitting_state(should_sit: bool) -> void: + if should_sit and ( + not _can_begin_sitting() or _network_jump_pending + ): + _sit_after_landing = true + _set_sitting(false) + return + _sit_after_landing = false + _set_sitting(should_sit) + + +func _input(event: InputEvent) -> void: + # Camera dragging must observe the complete mouse gesture before GUI controls + # get a chance to consume one part of it. Do not claim the event here: the + # Art Kit still needs the same right-button state to suspend its pointer. + if not local_control_enabled or not _is_camera_input_enabled(): + return + var mouse_button := event as InputEventMouseButton + if mouse_button != null and event.is_action("camera_drag"): + _set_camera_dragging(mouse_button.pressed) + return + var mouse_motion := event as InputEventMouseMotion + if mouse_motion == null or not _camera_dragging: + return + if _free_camera_active: + _rotate_free_camera(mouse_motion.screen_relative * mouse_sensitivity) + else: + _rotate_camera(mouse_motion.screen_relative * mouse_sensitivity) + + +func _notification(what: int) -> void: + # A captured pointer can miss its release when the application loses focus. + # Normal camera drags are ended by the matching mouse-button event; polling + # InputMap here is intentionally avoided because changing mouse mode can + # transiently clear the action and release an otherwise active drag. + if what == NOTIFICATION_APPLICATION_FOCUS_OUT and _camera_dragging: + _set_camera_dragging(false) + + func _unhandled_input(event: InputEvent) -> void: if not local_control_enabled or not _is_camera_input_enabled(): return @@ -1245,24 +1765,16 @@ func _unhandled_input(event: InputEvent) -> void: get_viewport().set_input_as_handled() return - if event.is_action("camera_drag"): - _set_camera_dragging(event.is_pressed()) - get_viewport().set_input_as_handled() - return - - if event is InputEventMouseMotion and _camera_dragging: - if _free_camera_active: - _rotate_free_camera(event.relative * mouse_sensitivity) - else: - _rotate_camera(event.relative * mouse_sensitivity) - get_viewport().set_input_as_handled() - return if _free_camera_active: return var mouse_zoom_in: bool = ( event is InputEventMouseButton - and event.shift_pressed + and ( + (not event.shift_pressed) + if _rv_interior_camera_mode + else event.shift_pressed != _swap_hotbar_camera_scroll + ) and event.is_action_pressed("camera_zoom_in") ) var controller_zoom_in: bool = ( @@ -1271,7 +1783,11 @@ func _unhandled_input(event: InputEvent) -> void: ) var mouse_zoom_out: bool = ( event is InputEventMouseButton - and event.shift_pressed + and ( + (not event.shift_pressed) + if _rv_interior_camera_mode + else event.shift_pressed != _swap_hotbar_camera_scroll + ) and event.is_action_pressed("camera_zoom_out") ) var controller_zoom_out: bool = ( @@ -1302,9 +1818,22 @@ func _set_camera_dragging(active: bool) -> void: _camera_dragging = active if active: _camera_drag_prior_mouse_mode = Input.mouse_mode + _camera_drag_restore_pointer = _camera_drag_prior_mouse_mode in [ + Input.MOUSE_MODE_VISIBLE, + Input.MOUSE_MODE_CONFINED, + ] + if _camera_drag_restore_pointer: + _camera_drag_pointer_origin = get_viewport().get_mouse_position() + # Capture starts with the physical press, before any motion is applied. + # Switching modes after the first movement can synthesize a center warp + # in the middle of the drag and interrupt camera control. Input.mouse_mode = Input.MOUSE_MODE_CAPTURED - elif Input.mouse_mode == Input.MOUSE_MODE_CAPTURED: - Input.mouse_mode = _camera_drag_prior_mouse_mode + else: + if Input.mouse_mode == Input.MOUSE_MODE_CAPTURED: + Input.mouse_mode = _camera_drag_prior_mouse_mode + if _camera_drag_restore_pointer: + Input.warp_mouse(_camera_drag_pointer_origin) + _camera_drag_restore_pointer = false func _get_network_aware_speed() -> float: @@ -1390,6 +1919,13 @@ func _update_free_camera_physics() -> void: if _free_camera == null or _free_camera_body == null: _set_free_camera_active(false) return + # Freecam translation is camera input, not avatar movement. Fishing locks + # the avatar after a cast, but the detached camera must remain movable. + # Camera/menu input ownership still stops freecam while an overlay is active. + if not _is_camera_input_enabled(): + _free_camera_body.velocity = Vector3.ZERO + _free_camera_body.move_and_slide() + return var input_vector: Vector2 = Input.get_vector( "move_left", "move_right", @@ -1439,7 +1975,11 @@ func get_active_gameplay_camera() -> Camera3D: func _set_target_zoom(value: float) -> void: - _target_zoom = clampf(value, minimum_zoom, maximum_zoom) + _target_zoom = clampf( + value, + 1.25 if _rv_interior_camera_mode else minimum_zoom, + 16.0 if _rv_interior_camera_mode else maximum_zoom, + ) func _apply_axis_deadzone(value: float) -> float: @@ -1472,10 +2012,14 @@ func get_network_peer_id() -> int: return _network_peer_id -func configure_network_remote(authoritative_simulation: bool) -> void: +func configure_network_remote( + authoritative_simulation: bool, + simulation_only: bool = false, +) -> void: set_local_control(false) _network_authoritative_simulation = authoritative_simulation _network_interpolation_enabled = not authoritative_simulation + set_network_simulation_only(simulation_only) _network_axis = Vector2.ZERO _network_jump_pending = false _network_sprint = false @@ -1483,6 +2027,7 @@ func configure_network_remote(authoritative_simulation: bool) -> void: _network_slow_walk = false _network_input_age = 0.0 _network_input_stale = false + _network_input_stale_timeout_seconds = NETWORK_INPUT_STALE_TIMEOUT_SECONDS _network_jump_intent_active = false _network_snapshot_ready = false _network_snapshot_age = 0.0 @@ -1492,11 +2037,45 @@ func configure_network_remote(authoritative_simulation: bool) -> void: _network_target_animation_action_id = &"" _network_target_animation_action_sequence = 0 _network_target_animation_action_elapsed = 0.0 + _network_target_animation_action_paused = false _camera.current = false + _authoritative_movement_history.clear() + + +func set_network_simulation_only(enabled: bool) -> void: + _network_simulation_only = enabled + if not is_node_ready(): + return + set_process(not enabled) + for presentation_root: Node in [ + _visuals, + get_node_or_null("GroundShadow"), + get_node_or_null("SprintDust"), + _camera_yaw, + ]: + if presentation_root == null: + continue + presentation_root.process_mode = ( + Node.PROCESS_MODE_DISABLED + if enabled + else Node.PROCESS_MODE_INHERIT + ) + if presentation_root is Node3D: + (presentation_root as Node3D).visible = not enabled + + +func is_network_simulation_only() -> bool: + return _network_simulation_only func reset_network_movement_state() -> void: _clear_local_network_jump_intent() + if not _animation_action_id.is_empty(): + end_animation_action() + _sit_after_landing = false + _sitting_intent_pending = false + _sitting_intent_sequence = -1 + _set_sitting(false) _network_axis = Vector2.ZERO _network_jump_pending = false _network_sprint = false @@ -1504,8 +2083,45 @@ func reset_network_movement_state() -> void: _network_slow_walk = false _network_input_age = 0.0 _network_input_stale = false + _network_input_stale_timeout_seconds = NETWORK_INPUT_STALE_TIMEOUT_SECONDS _network_jump_intent_active = false _last_network_input_sequence = 0 + _reset_local_prediction_error() + _clear_local_reconciliation_offsets() + _local_prediction_soft_corrections = 0 + _local_prediction_hard_corrections = 0 + _local_prediction_largest_error = 0.0 + + +func apply_network_space_transition( + target_transform: Transform3D, + align_local_camera: bool, +) -> void: + if not target_transform.origin.is_finite(): + return + # A room transition is a discontinuity, not ordinary movement. Preserve the + # host's input acknowledgement while clearing every motion, animation, and + # reconciliation state that could pull the avatar toward the previous space. + var acknowledged_input: int = _last_network_input_sequence + reset_network_movement_state() + _last_network_input_sequence = acknowledged_input + _apply_network_casting(false) + velocity = Vector3.ZERO + global_transform = Transform3D(Basis.IDENTITY, target_transform.origin) + var target_yaw: float = target_transform.basis.get_euler().y + _visuals.rotation.y = target_yaw + _network_camera_yaw = target_yaw + _network_target_position = global_position + _network_target_velocity = Vector3.ZERO + _network_target_visual_yaw = target_yaw + _network_snapshot_age = 0.0 + _network_snapshot_ready = true + _authoritative_movement_history.clear() + if align_local_camera: + _set_camera_dragging(false) + if _free_camera_active: + _set_free_camera_active(false) + _camera_yaw.rotation.y = target_yaw func capture_network_input(sequence: int) -> Dictionary: @@ -1532,7 +2148,7 @@ func capture_network_input(sequence: int) -> Dictionary: "sprint": false, "sneak": false, "slow_walk": false, - "sitting": _sitting, + "sitting": get_network_sitting_intent(), "casting": ( _fishing_visual_phase == FishingVisualPhase.CASTING ), @@ -1557,13 +2173,66 @@ func capture_network_input(sequence: int) -> Dictionary: "sprint": Input.is_action_pressed("sprint"), "sneak": Input.is_action_pressed("sneak"), "slow_walk": Input.is_action_pressed("slow_walk"), - "sitting": _sitting, + "sitting": get_network_sitting_intent(), "casting": _fishing_visual_phase == FishingVisualPhase.CASTING, "animation_action": _make_animation_action_state(), } -func apply_authoritative_network_input(data: Dictionary) -> void: +func has_active_network_input() -> bool: + if not local_control_enabled: + return false + if _local_network_jump_intent_pending or _sitting_intent_pending: + return true + if not _is_movement_input_enabled() or _free_camera_active: + return false + return ( + not Input.get_vector( + "move_left", + "move_right", + "move_forward", + "move_backward", + ).is_zero_approx() + or Input.is_action_pressed("sprint") + or Input.is_action_pressed("sneak") + or Input.is_action_pressed("slow_walk") + or _fishing_visual_phase == FishingVisualPhase.CASTING + or not _animation_action_id.is_empty() + ) + + +func get_network_input_state_hash() -> int: + var axis: Vector2 = Vector2.ZERO + if ( + local_control_enabled + and _is_movement_input_enabled() + and not _free_camera_active + ): + axis = Input.get_vector( + "move_left", + "move_right", + "move_forward", + "move_backward", + ) + return hash([ + axis, + _camera_yaw.global_rotation.y, + _local_network_jump_intent_pending, + Input.is_action_pressed("sprint"), + Input.is_action_pressed("sneak"), + Input.is_action_pressed("slow_walk"), + get_network_sitting_intent(), + _fishing_visual_phase == FishingVisualPhase.CASTING, + _animation_action_id, + _animation_action_sequence, + _animation_action_paused, + ]) + + +func apply_authoritative_network_input( + data: Dictionary, + stale_timeout_seconds: float = NETWORK_INPUT_STALE_TIMEOUT_SECONDS, +) -> void: var sequence: int = int(data.get("sequence", 0)) if sequence <= _last_network_input_sequence: return @@ -1573,6 +2242,11 @@ func apply_authoritative_network_input(data: Dictionary) -> void: _last_network_input_sequence = sequence _network_input_age = 0.0 _network_input_stale = false + _network_input_stale_timeout_seconds = clampf( + stale_timeout_seconds, + NETWORK_INPUT_STALE_TIMEOUT_SECONDS, + NETWORK_INPUT_STALE_TIMEOUT_MAX_SECONDS, + ) _network_axis = Vector2(float(axis[0]), float(axis[1])).limit_length(1.0) _network_camera_yaw = float(data.get("camera_yaw", 0.0)) var jump_intent_active: bool = bool(data.get("jump", false)) @@ -1582,15 +2256,13 @@ func apply_authoritative_network_input(data: Dictionary) -> void: _network_sprint = bool(data.get("sprint", false)) _network_sneak = bool(data.get("sneak", false)) _network_slow_walk = bool(data.get("slow_walk", false)) - _apply_animation_action_state(data.get("animation_action", {})) + apply_authoritative_network_animation_action( + data.get("animation_action", {}) + ) _apply_network_casting(bool(data.get("casting", false))) - var sitting_requested: bool = bool(data.get("sitting", false)) - if sitting_requested and not is_on_floor(): - _sit_after_landing = true - _set_sitting(false) - else: - _sit_after_landing = false - _set_sitting(sitting_requested) + apply_authoritative_network_sitting_state( + bool(data.get("sitting", false)) + ) func make_network_snapshot(peer_id: int) -> Dictionary: @@ -1600,18 +2272,49 @@ func make_network_snapshot(peer_id: int) -> Dictionary: "position": [global_position.x, global_position.y, global_position.z], "velocity": [velocity.x, velocity.y, velocity.z], "visual_yaw": _visuals.rotation.y, - "animation_state": NetworkPlayerAnimationProtocol.make_state( - _get_authoritative_locomotion_id(), - is_on_floor(), - _animation_action_id, - _animation_action_sequence, - _animation_action_elapsed, - ), - "sitting": _sitting, + "animation_state": make_network_animation_state(), + "grounded": is_on_floor(), + "sitting": get_network_sitting_state(), "casting": _fishing_visual_phase == FishingVisualPhase.CASTING, } +func make_network_animation_state() -> Dictionary: + return NetworkPlayerAnimationProtocol.make_state( + _get_authoritative_locomotion_id(), + is_on_floor(), + _animation_action_id, + _animation_action_sequence, + _animation_action_elapsed, + _animation_action_paused, + ) + + +func apply_network_animation_state(state: Dictionary) -> void: + _apply_network_target_animation_state(state) + + +func apply_authoritative_network_animation_action( + action_state: Dictionary, +) -> void: + if not NetworkPlayerAnimationProtocol.validate_action_state(action_state): + return + var incoming_sequence: int = int(action_state["sequence"]) + var wrapped_sequence: bool = ( + _animation_action_sequence + == NetworkPlayerAnimationProtocol.MAX_ACTION_SEQUENCE + and incoming_sequence == 1 + ) + if incoming_sequence < _animation_action_sequence and not wrapped_sequence: + return + if ( + incoming_sequence == _animation_action_sequence + and StringName(str(action_state["id"])) != _animation_action_id + ): + return + _apply_animation_action_state(action_state) + + func push_network_snapshot( snapshot: Dictionary, estimated_transit_seconds: float = -1.0, @@ -1645,7 +2348,8 @@ func push_network_snapshot( ) _network_target_velocity = parsed["velocity"] _network_target_visual_yaw = parsed["visual_yaw"] - _apply_network_target_animation_state(parsed["animation_state"]) + if not Dictionary(parsed.get("animation_state", {})).is_empty(): + _apply_network_target_animation_state(parsed["animation_state"]) _network_snapshot_age = 0.0 _apply_network_casting(bool(parsed["casting"])) _set_sitting(bool(parsed["sitting"])) @@ -1661,6 +2365,7 @@ func apply_local_prediction_correction( latest_input_sequence: int = 0, input_interval_seconds: float = 0.0, estimated_transit_seconds: float = -1.0, + audit_delta_seconds: float = 0.0, ) -> void: var parsed: Dictionary = _parse_network_snapshot(snapshot) if parsed.is_empty(): @@ -1693,16 +2398,226 @@ func apply_local_prediction_correction( authoritative_position += ( (parsed["velocity"] as Vector3) * transit_seconds ) - var error_distance: float = global_position.distance_to( - authoritative_position + var error_offset: Vector3 = authoritative_position - global_position + var error_distance: float = error_offset.length() + _local_prediction_largest_error = maxf( + _local_prediction_largest_error, + error_distance, ) - if error_distance > LOCAL_PREDICTION_SNAP_DISTANCE: + if error_distance <= LOCAL_PREDICTION_CORRECTION_THRESHOLD: + _reset_local_prediction_error() + return + if error_distance >= LOCAL_PREDICTION_SNAP_DISTANCE: + _clear_local_reconciliation_offsets() global_position = authoritative_position - elif error_distance > LOCAL_PREDICTION_CORRECTION_THRESHOLD: - global_position = global_position.lerp( - authoritative_position, - LOCAL_PREDICTION_CORRECTION_WEIGHT, + velocity = parsed["velocity"] + _local_prediction_hard_corrections += 1 + _reset_local_prediction_error() + return + if _should_defer_local_prediction_correction(parsed): + # A host and its client do not reach the apex or landing on the same + # frame. Correcting that expected vertical disagreement while either + # side is airborne can pull the local body off narrow platforms. + _reset_local_prediction_error() + return + # Both simulations agree the player is standing. Let ordinary floor motion + # and gravity resolve the vertical component; a stale height sample must not + # press a locally controlled player down or turn a horizontal correction + # into an early floor collision. + error_offset.y = 0.0 + error_distance = error_offset.length() + if error_distance <= LOCAL_PREDICTION_CORRECTION_THRESHOLD: + _reset_local_prediction_error() + return + var error_direction: Vector3 = error_offset.normalized() + if ( + not _local_prediction_error_direction.is_zero_approx() + and _local_prediction_error_direction.dot(error_direction) < 0.5 + ): + _reset_local_prediction_error() + _local_prediction_error_direction = error_direction + _local_prediction_error_audits += 1 + _local_prediction_error_seconds += clampf( + audit_delta_seconds, + 0.0, + LOCAL_PREDICTION_MAX_AUDIT_DELTA_SECONDS, + ) + if ( + _local_prediction_error_audits + < LOCAL_PREDICTION_MIN_CORRECTION_AUDITS + or _local_prediction_error_seconds + < LOCAL_PREDICTION_CORRECTION_DELAY_SECONDS + ): + return + var correction_weight: float = 1.0 - exp( + -LOCAL_PREDICTION_SOFT_CORRECTION_RATE + * clampf( + audit_delta_seconds, + 0.0, + LOCAL_PREDICTION_MAX_AUDIT_DELTA_SECONDS, ) + ) + var correction: Vector3 = error_offset * correction_weight + if correction.length() > LOCAL_PREDICTION_MAX_SOFT_CORRECTION_STEP: + correction = ( + correction.normalized() + * LOCAL_PREDICTION_MAX_SOFT_CORRECTION_STEP + ) + if _apply_camera_safe_local_correction(correction): + _local_prediction_soft_corrections += 1 + + +func _should_defer_local_prediction_correction(parsed: Dictionary) -> bool: + if not bool(parsed.get("grounded", true)): + return true + return _local_network_jump_intent_pending or not is_on_floor() + + +func _apply_camera_safe_local_correction(correction: Vector3) -> bool: + if correction.is_zero_approx(): + return false + var previous_visual_position: Vector3 = _visuals.global_position + var previous_camera_position: Vector3 = _camera_yaw.global_position + var previous_body_position: Vector3 = global_position + var base_visual_local_position: Vector3 = ( + _visuals.position - _local_reconciliation_visual_offset + ) + var base_camera_local_position: Vector3 = ( + _camera_yaw.position - _local_reconciliation_camera_offset + ) + # Reconciliation is still physical movement. Going through the physics + # server prevents a delayed host audit from placing the capsule through a + # tree, cliff, or stepping stone on the way to the authoritative position. + move_and_collide(correction) + if global_position.is_equal_approx(previous_body_position): + return false + _visuals.global_position = previous_visual_position + _camera_yaw.global_position = previous_camera_position + _local_reconciliation_visual_offset = ( + _visuals.position - base_visual_local_position + ) + _local_reconciliation_camera_offset = ( + _camera_yaw.position - base_camera_local_position + ) + return true + + +func _reset_local_prediction_error() -> void: + _local_prediction_error_seconds = 0.0 + _local_prediction_error_audits = 0 + _local_prediction_error_direction = Vector3.ZERO + + +func _clear_local_reconciliation_offsets() -> void: + if not _local_reconciliation_visual_offset.is_zero_approx(): + _visuals.position -= _local_reconciliation_visual_offset + if not _local_reconciliation_camera_offset.is_zero_approx(): + _camera_yaw.position -= _local_reconciliation_camera_offset + _local_reconciliation_visual_offset = Vector3.ZERO + _local_reconciliation_camera_offset = Vector3.ZERO + + +func _update_local_reconciliation_visuals(delta: float) -> void: + if ( + _local_reconciliation_visual_offset.is_zero_approx() + and _local_reconciliation_camera_offset.is_zero_approx() + ): + _local_reconciliation_visual_offset = Vector3.ZERO + _local_reconciliation_camera_offset = Vector3.ZERO + return + var retained_ratio: float = exp( + -LOCAL_RECONCILIATION_PRESENTATION_RECENTER_RATE * delta + ) + var retained_visual_offset: Vector3 = ( + _local_reconciliation_visual_offset * retained_ratio + ) + var retained_camera_offset: Vector3 = ( + _local_reconciliation_camera_offset * retained_ratio + ) + _visuals.position += ( + retained_visual_offset - _local_reconciliation_visual_offset + ) + _camera_yaw.position += ( + retained_camera_offset - _local_reconciliation_camera_offset + ) + _local_reconciliation_visual_offset = retained_visual_offset + _local_reconciliation_camera_offset = retained_camera_offset + + +func get_local_prediction_metrics() -> Dictionary: + return { + "soft_corrections": _local_prediction_soft_corrections, + "hard_corrections": _local_prediction_hard_corrections, + "largest_error": _local_prediction_largest_error, + "out_of_bounds_audits": _local_prediction_error_audits, + "out_of_bounds_seconds": _local_prediction_error_seconds, + } + + +static func resolve_network_input_stale_timeout_seconds( + round_trip_msec: int, +) -> float: + if round_trip_msec < 0: + return NETWORK_INPUT_STALE_TIMEOUT_SECONDS + return clampf( + NETWORK_INPUT_STALE_TIMEOUT_SECONDS + + float(round_trip_msec) / 1000.0 + * NETWORK_INPUT_STALE_RTT_MULTIPLIER, + NETWORK_INPUT_STALE_TIMEOUT_SECONDS, + NETWORK_INPUT_STALE_TIMEOUT_MAX_SECONDS, + ) + + +func _record_authoritative_movement_state() -> void: + var now_seconds: float = Time.get_ticks_msec() / 1000.0 + _authoritative_movement_history.append({ + "sequence": _last_network_input_sequence, + "recorded_at": now_seconds, + "position": global_position, + "velocity": velocity, + "cast_origin": get_cast_origin_position(), + "facing": get_facing_direction(), + "sneaking": is_sneaking(), + }) + var oldest_allowed: float = now_seconds - NETWORK_MOVEMENT_HISTORY_SECONDS + while ( + not _authoritative_movement_history.is_empty() + and float( + _authoritative_movement_history[0].get("recorded_at", 0.0) + ) < oldest_allowed + ): + _authoritative_movement_history.pop_front() + + +func get_lag_compensated_movement_state( + input_sequence: int, + max_age_seconds: float = NETWORK_MAX_LAG_COMPENSATION_SECONDS, +) -> Dictionary: + var now_seconds: float = Time.get_ticks_msec() / 1000.0 + for index: int in range( + _authoritative_movement_history.size() - 1, + -1, + -1, + ): + var candidate: Dictionary = _authoritative_movement_history[index] + if now_seconds - float(candidate.get("recorded_at", 0.0)) > ( + max_age_seconds + ): + break + if ( + input_sequence <= 0 + or int(candidate.get("sequence", 0)) <= input_sequence + ): + return candidate.duplicate(true) + return { + "sequence": _last_network_input_sequence, + "recorded_at": now_seconds, + "position": global_position, + "velocity": velocity, + "cast_origin": get_cast_origin_position(), + "facing": get_facing_direction(), + "sneaking": is_sneaking(), + } static func resolve_local_prediction_transit_seconds( @@ -1746,7 +2661,8 @@ func apply_network_teleport(snapshot: Dictionary) -> void: _network_target_position = global_position _network_target_velocity = velocity _network_target_visual_yaw = _visuals.rotation.y - _apply_network_target_animation_state(parsed["animation_state"]) + if not Dictionary(parsed.get("animation_state", {})).is_empty(): + _apply_network_target_animation_state(parsed["animation_state"]) _network_snapshot_age = 0.0 _network_snapshot_ready = true @@ -1772,12 +2688,16 @@ func _parse_network_snapshot(snapshot: Dictionary) -> Dictionary: float(network_velocity[2]) ) var visual_yaw: float = float(snapshot.get("visual_yaw", 0.0)) - var animation_state_value: Variant = snapshot.get("animation_state") - if not NetworkPlayerAnimationProtocol.validate_state(animation_state_value): - return {} - var animation_state: Dictionary = ( - animation_state_value as Dictionary - ).duplicate(true) + var animation_state: Dictionary = {} + if snapshot.has("animation_state"): + var animation_state_value: Variant = snapshot.get("animation_state") + if not NetworkPlayerAnimationProtocol.validate_state( + animation_state_value + ): + return {} + animation_state = ( + animation_state_value as Dictionary + ).duplicate(true) if ( snapshot.has("acknowledged_input") and ( @@ -1795,6 +2715,9 @@ func _parse_network_snapshot(snapshot: Dictionary) -> Dictionary: if snapshot.has("casting") and typeof(snapshot.get("casting")) != TYPE_BOOL: return {} var casting: bool = bool(snapshot.get("casting", false)) + if snapshot.has("grounded") and typeof(snapshot.get("grounded")) != TYPE_BOOL: + return {} + var grounded: bool = bool(snapshot.get("grounded", true)) if ( not parsed_position.is_finite() or not parsed_velocity.is_finite() @@ -1806,6 +2729,7 @@ func _parse_network_snapshot(snapshot: Dictionary) -> Dictionary: "velocity": parsed_velocity, "visual_yaw": visual_yaw, "animation_state": animation_state, + "grounded": grounded, "acknowledged_input": acknowledged_input, "sitting": sitting, "casting": casting, @@ -1817,6 +2741,7 @@ func _make_animation_action_state() -> Dictionary: _animation_action_id, _animation_action_sequence, _animation_action_elapsed, + _animation_action_paused, ) @@ -1828,9 +2753,29 @@ func _apply_network_target_animation_state(state: Dictionary) -> void: StringName(str(state["locomotion_id"])) ) var action: Dictionary = state["action"] + var incoming_sequence: int = int(action["sequence"]) + var wrapped_sequence: bool = ( + _network_target_animation_action_sequence + == NetworkPlayerAnimationProtocol.MAX_ACTION_SEQUENCE + and incoming_sequence == 1 + ) + if ( + incoming_sequence < _network_target_animation_action_sequence + and not wrapped_sequence + ): + return + if ( + incoming_sequence == _network_target_animation_action_sequence + and StringName(str(action["id"])) + != _network_target_animation_action_id + ): + return _network_target_animation_action_id = StringName(str(action["id"])) _network_target_animation_action_sequence = int(action["sequence"]) _network_target_animation_action_elapsed = float(action["elapsed"]) + _network_target_animation_action_paused = bool( + action.get("paused", false) + ) func _get_authoritative_locomotion_state() -> LocomotionState: @@ -1839,14 +2784,17 @@ func _get_authoritative_locomotion_state() -> LocomotionState: and _is_movement_input_enabled() and not _water_recovery_active and not _sitting - and _network_axis.length_squared() > 0.0025 ): + if _network_sneak: + return LocomotionState.SNEAKING + if _network_axis.length_squared() <= 0.0025: + return LocomotionState.IDLE return ( LocomotionState.RUNNING if _network_sprint else LocomotionState.WALKING ) - return _locomotion_state_from_velocity() + return _locomotion_state_from_velocity(is_sneaking()) func _get_authoritative_locomotion_id() -> StringName: @@ -1856,7 +2804,19 @@ func _get_authoritative_locomotion_id() -> StringName: func _get_presented_locomotion_state() -> LocomotionState: if _network_interpolation_enabled and _network_snapshot_ready: return _network_target_locomotion_state - return _locomotion_state_from_velocity() + return _locomotion_state_from_velocity(is_sneaking()) + + +func _is_presented_moving_horizontally() -> bool: + var presented_velocity: Vector3 = ( + _network_target_velocity + if _network_interpolation_enabled and _network_snapshot_ready + else velocity + ) + return Vector2( + presented_velocity.x, + presented_velocity.z, + ).length_squared() > 0.0025 func _get_presented_animation_action() -> Dictionary: @@ -1865,15 +2825,23 @@ func _get_presented_animation_action() -> Dictionary: _network_target_animation_action_id, _network_target_animation_action_sequence, minf( - _network_target_animation_action_elapsed + _network_snapshot_age, + _network_target_animation_action_elapsed + + ( + 0.0 + if _network_target_animation_action_paused + else _network_snapshot_age + ), NetworkPlayerAnimationProtocol.MAX_ACTION_ELAPSED_SECONDS, ), + _network_target_animation_action_paused, ) return _make_animation_action_state() func _locomotion_id_from_state(state: LocomotionState) -> StringName: match state: + LocomotionState.SNEAKING: + return NetworkPlayerAnimationProtocol.LOCOMOTION_SNEAKING LocomotionState.WALKING: return NetworkPlayerAnimationProtocol.LOCOMOTION_WALKING LocomotionState.RUNNING: @@ -1884,6 +2852,8 @@ func _locomotion_id_from_state(state: LocomotionState) -> StringName: func _locomotion_state_from_id(state_id: StringName) -> LocomotionState: match state_id: + NetworkPlayerAnimationProtocol.LOCOMOTION_SNEAKING: + return LocomotionState.SNEAKING NetworkPlayerAnimationProtocol.LOCOMOTION_WALKING: return LocomotionState.WALKING NetworkPlayerAnimationProtocol.LOCOMOTION_RUNNING: @@ -1896,7 +2866,11 @@ static func supports_network_animation_action(action_id: StringName) -> bool: return action_id in NETWORK_ANIMATION_ACTION_IDS -func _locomotion_state_from_velocity() -> LocomotionState: +func _locomotion_state_from_velocity( + sneaking: bool = false, +) -> LocomotionState: + if sneaking: + return LocomotionState.SNEAKING var horizontal_speed_squared: float = ( velocity.x * velocity.x + velocity.z * velocity.z ) @@ -1973,11 +2947,11 @@ func _update_network_interpolation(delta: float) -> void: func _update_network_input_freshness(delta: float) -> void: _network_input_age = minf( _network_input_age + delta, - NETWORK_INPUT_STALE_TIMEOUT_SECONDS + 1.0, + _network_input_stale_timeout_seconds + 1.0, ) if ( _network_input_stale - or _network_input_age <= NETWORK_INPUT_STALE_TIMEOUT_SECONDS + or _network_input_age <= _network_input_stale_timeout_seconds ): return _network_input_stale = true @@ -2045,7 +3019,11 @@ func _is_movement_input_enabled() -> bool: func _is_camera_input_enabled() -> bool: - return _camera_input_enabled and _local_input_suppressors.is_empty() + return ( + _camera_input_enabled + and _local_input_suppressors.is_empty() + and _camera_input_suppressors.is_empty() + ) func set_camera_input_enabled(enabled: bool) -> void: @@ -2054,6 +3032,19 @@ func set_camera_input_enabled(enabled: bool) -> void: _set_camera_dragging(false) +func set_camera_input_suppressed( + owner: StringName, + suppressed: bool, +) -> void: + if owner.is_empty(): + return + if suppressed: + _camera_input_suppressors[owner] = true + _set_camera_dragging(false) + else: + _camera_input_suppressors.erase(owner) + + func set_camera_active(active: bool) -> void: if _free_camera_active and _free_camera != null: _free_camera.current = active @@ -2065,6 +3056,7 @@ func apply_camera_settings( new_mouse_sensitivity: float, new_controller_sensitivity: float, invert_vertical: bool, + swap_hotbar_camera_scroll: bool = false, ) -> void: mouse_sensitivity = clampf(new_mouse_sensitivity, 0.001, 0.012) controller_camera_speed = clampf( @@ -2073,6 +3065,50 @@ func apply_camera_settings( 5.0 ) invert_camera_y = invert_vertical + _swap_hotbar_camera_scroll = swap_hotbar_camera_scroll + + +func set_rv_interior_camera_mode( + enabled: bool, + excluded_wall_rids: Array[RID] = [], +) -> void: + if enabled != _rv_interior_camera_mode: + if enabled: + _rv_previous_camera_environment = _camera.environment + _camera.environment = _get_rv_interior_environment() + if _free_camera != null: + _free_camera.environment = _camera.environment + else: + _camera.environment = _rv_previous_camera_environment + if _free_camera != null: + _free_camera.environment = _camera.environment + _rv_previous_camera_environment = null + _rv_interior_camera_mode = enabled + if _spring_arm == null: + return + _spring_arm.clear_excluded_objects() + if enabled: + for collider_rid: RID in excluded_wall_rids: + if collider_rid.is_valid(): + _spring_arm.add_excluded_object(collider_rid) + _set_target_zoom(_target_zoom) + + +func _get_rv_interior_environment() -> Environment: + if _rv_interior_environment != null: + return _rv_interior_environment + _rv_interior_environment = Environment.new() + _rv_interior_environment.background_mode = Environment.BG_COLOR + _rv_interior_environment.background_color = Color("020506") + _rv_interior_environment.ambient_light_source = ( + Environment.AMBIENT_SOURCE_COLOR + ) + _rv_interior_environment.ambient_light_color = Color("d6caaa") + _rv_interior_environment.ambient_light_energy = 1.0 + _rv_interior_environment.reflected_light_source = ( + Environment.REFLECTION_SOURCE_DISABLED + ) + return _rv_interior_environment func is_camera_input_enabled() -> bool: @@ -2175,6 +3211,8 @@ func set_active_fishing_rod( func set_active_catching_net(should_show: bool) -> void: _active_item_is_net = should_show + if not should_show: + cancel_net_action_visual() if _catching_net == null: return if _showcase_rod_state_stored: @@ -2185,6 +3223,37 @@ func set_active_catching_net(should_show: bool) -> void: ) +func set_active_shovel(should_show: bool) -> void: + _active_item_is_shovel = should_show + if not should_show: + cancel_net_action_visual() + if _shovel == null: + return + if _showcase_rod_state_stored: + _showcase_shovel_visibility = should_show + return + _shovel.visible = ( + should_show and not _has_held_show_item() and not _showcase_animation_active + ) + + +func set_active_decor_package(should_show: bool) -> void: + var changed: bool = _held_decor_package_visible != should_show + _held_decor_package_visible = should_show + if _held_decor_package_display != null: + _held_decor_package_display.visible = should_show + if should_show: + _fishing_rod.visible = false + if _catching_net != null: + _catching_net.visible = false + if _shovel != null: + _shovel.visible = false + elif changed: + _apply_active_rod_visibility() + if changed: + _update_character_animation() + + func _apply_fishing_rod_model(rod: FishingRodDataType) -> void: var next_id: StringName = rod.item_id if rod != null else StringName() if next_id == _active_fishing_rod_id: @@ -2253,6 +3322,12 @@ func _apply_active_rod_visibility() -> void: and not _has_held_show_item() and not _showcase_animation_active ) + if _shovel != null: + _shovel.visible = ( + _active_item_is_shovel + and not _has_held_show_item() + and not _showcase_animation_active + ) func set_active_art_kit(icon: Texture2D, should_show: bool) -> void: @@ -2283,6 +3358,8 @@ func set_active_art_kit(icon: Texture2D, should_show: bool) -> void: _fishing_rod.visible = false if _catching_net != null: _catching_net.visible = false + if _shovel != null: + _shovel.visible = false if item_changed: _begin_pocket_visual( PocketVisualTarget.ART_KIT, @@ -2323,16 +3400,17 @@ func set_held_fish( ) _held_fish_visible = true _pending_held_fish_texture = fish.display_texture - _pending_held_fish_scale = ( - Vector3.ONE - * maxf(display_scale, 0.01) - * catch_presentation_base_scale + _pending_held_fish_scale = _get_catch_presentation_scale( + fish, + display_scale, ) if not previous_show_pose: _held_fish_display.visible = false _fishing_rod.visible = false if _catching_net != null: _catching_net.visible = false + if _shovel != null: + _shovel.visible = false if item_changed: _begin_pocket_visual( PocketVisualTarget.HELD_FISH, @@ -2348,7 +3426,52 @@ func set_held_fish( func _has_held_show_item() -> bool: - return _held_fish_visible or _held_art_kit_visible + return ( + _held_fish_visible + or _held_art_kit_visible + or _held_decor_package_visible + ) + + +func _build_decor_package_display(parent: Node3D) -> Node3D: + var display := Node3D.new() + display.name = "HeldDecorPackageDisplay" + display.position = Vector3(0.0, 0.1, 0.04) + display.rotation = Vector3(0.15, 0.0, -0.55) + display.visible = false + parent.add_child(display) + + var sack := MeshInstance3D.new() + sack.name = "Sack" + var sack_mesh := SphereMesh.new() + sack_mesh.radius = 0.22 + sack_mesh.height = 0.48 + sack_mesh.radial_segments = 8 + sack_mesh.rings = 4 + sack_mesh.material = _decor_package_material(Color("a87843")) + sack.mesh = sack_mesh + display.add_child(sack) + + var tie := MeshInstance3D.new() + tie.name = "Tie" + var tie_mesh := CylinderMesh.new() + tie_mesh.top_radius = 0.1 + tie_mesh.bottom_radius = 0.12 + tie_mesh.height = 0.08 + tie_mesh.radial_segments = 8 + tie_mesh.material = _decor_package_material(Color("513829")) + tie.mesh = tie_mesh + tie.position = Vector3(0.0, 0.22, 0.0) + display.add_child(tie) + return display + + +func _decor_package_material(color: Color) -> StandardMaterial3D: + var material := StandardMaterial3D.new() + material.albedo_color = color + material.roughness = 1.0 + material.shading_mode = BaseMaterial3D.SHADING_MODE_PER_VERTEX + return material func _clear_held_fish() -> void: @@ -2543,8 +3666,21 @@ func get_cast_origin_position() -> Vector3: func begin_catch_showcase(fish_catch: FishCatchType) -> void: if fish_catch == null or not fish_catch.is_valid(): return + if _is_net_strike_visual_active(): + _pending_net_showcase_catch = fish_catch + _pending_net_showcase_remote = false + return + _begin_catch_showcase_now(fish_catch, showcase_camera_yaw_offset) + + +func _begin_catch_showcase_now( + fish_catch: FishCatchType, + camera_yaw_offset_degrees: float, +) -> void: if _pocket_visual_target == PocketVisualTarget.CATCH_SHOWCASE: _cancel_pocket_visual() + if local_control_enabled: + set_local_input_suppressed(CATCH_SHOWCASE_INPUT_OWNER, true) _showcase_animation_active = true set_fishing_visual(false) _kill_showcase_camera_tween() @@ -2553,22 +3689,28 @@ func begin_catch_showcase(fish_catch: FishCatchType) -> void: if not _showcase_visual_rotation_stored: _showcase_visual_rotation = _visuals.rotation _showcase_visual_rotation_stored = true - var showcase_camera_position: Vector3 = _begin_showcase_camera_transition() + var showcase_camera_position: Vector3 = _begin_showcase_camera_transition( + camera_yaw_offset_degrees + ) _turn_showcase_toward_position(showcase_camera_position) if not _showcase_rod_state_stored: _showcase_rod_visibility = _fishing_rod.visible _showcase_net_visibility = ( _catching_net.visible if _catching_net != null else false ) + _showcase_shovel_visibility = ( + _shovel.visible if _shovel != null else false + ) _showcase_rod_state_stored = true _fishing_rod.visible = false if _catching_net != null: _catching_net.visible = false + if _shovel != null: + _shovel.visible = false _catch_sprite.texture = fish_catch.fish.display_texture - _catch_display.scale = ( - Vector3.ONE - * fish_catch.display_scale - * catch_presentation_base_scale + _catch_display.scale = _get_catch_presentation_scale( + fish_catch.fish, + fish_catch.display_scale, ) _catch_display.visible = _catch_sprite.texture != null _update_character_animation() @@ -2577,6 +3719,14 @@ func begin_catch_showcase(fish_catch: FishCatchType) -> void: func begin_remote_catch_showcase(fish_catch: FishCatchType) -> void: if local_control_enabled or fish_catch == null or not fish_catch.is_valid(): return + if _is_net_strike_visual_active(): + _pending_net_showcase_catch = fish_catch + _pending_net_showcase_remote = true + return + _begin_remote_catch_showcase_now(fish_catch) + + +func _begin_remote_catch_showcase_now(fish_catch: FishCatchType) -> void: end_catch_showcase(Callable(), true) _showcase_animation_active = true set_fishing_visual(false) @@ -2584,20 +3734,80 @@ func begin_remote_catch_showcase(fish_catch: FishCatchType) -> void: _showcase_net_visibility = ( _catching_net.visible if _catching_net != null else false ) + _showcase_shovel_visibility = ( + _shovel.visible if _shovel != null else false + ) _showcase_rod_state_stored = true _fishing_rod.visible = false if _catching_net != null: _catching_net.visible = false + if _shovel != null: + _shovel.visible = false _catch_sprite.texture = fish_catch.fish.display_texture - _catch_display.scale = ( - Vector3.ONE - * fish_catch.display_scale - * catch_presentation_base_scale + _catch_display.scale = _get_catch_presentation_scale( + fish_catch.fish, + fish_catch.display_scale, ) _catch_display.visible = _catch_sprite.texture != null _update_character_animation() +func _get_catch_presentation_scale( + fish: FishDataType, + display_scale: float, +) -> Vector3: + var texture: Texture2D = fish.display_texture if fish != null else null + return ( + Vector3.ONE + * maxf(display_scale, 0.01) + * catch_presentation_base_scale + * get_catch_texture_resolution_scale(texture) + ) + + +static func get_catch_texture_resolution_scale(texture: Texture2D) -> float: + if texture == null: + return 1.0 + var texture_size: Vector2 = texture.get_size() + var longest_side: float = maxf(texture_size.x, texture_size.y) + if not is_finite(longest_side) or longest_side <= 0.0: + return 1.0 + return clampf( + CATCH_PRESENTATION_REFERENCE_LONG_SIDE_PX / longest_side, + CATCH_PRESENTATION_MIN_TEXTURE_SCALE, + CATCH_PRESENTATION_MAX_TEXTURE_SCALE, + ) + + +func _is_net_strike_visual_active() -> bool: + return ( + _animation_action_id == CHARACTER_NET_STRIKE_ANIMATION + or _network_target_animation_action_id + == CHARACTER_NET_STRIKE_ANIMATION + or ( + _character_animation_player != null + and _character_animation_player.current_animation + == CHARACTER_NET_STRIKE_ANIMATION + ) + ) + + +func _begin_pending_net_showcase() -> void: + var fish_catch := _pending_net_showcase_catch + var remote: bool = _pending_net_showcase_remote + _pending_net_showcase_catch = null + _pending_net_showcase_remote = false + if fish_catch == null or not fish_catch.is_valid(): + return + if remote: + _begin_remote_catch_showcase_now(fish_catch) + else: + _begin_catch_showcase_now( + fish_catch, + net_showcase_camera_yaw_offset, + ) + + func end_catch_showcase( restored_callback: Callable = Callable(), immediate: bool = false, @@ -2629,13 +3839,18 @@ func end_catch_showcase( _fishing_rod.visible = _showcase_rod_visibility if _catching_net != null: _catching_net.visible = _showcase_net_visibility + if _shovel != null: + _shovel.visible = _showcase_shovel_visibility _showcase_rod_visibility = true _showcase_net_visibility = false + _showcase_shovel_visibility = false _showcase_rod_state_stored = false if ( not _showcase_visual_rotation_stored and _showcase_camera_snapshot == null ): + if local_control_enabled: + set_local_input_suppressed(CATCH_SHOWCASE_INPUT_OWNER, false) if restored_callback.is_valid(): restored_callback.call() return @@ -2789,14 +4004,13 @@ func _complete_showcase_restore( _camera_pitch.rotation = _showcase_camera_snapshot.pitch_rotation _spring_arm.spring_length = _showcase_camera_snapshot.spring_length _target_zoom = _showcase_camera_snapshot.target_zoom - _camera_input_enabled = ( - _showcase_camera_snapshot.camera_input_enabled - ) _set_camera_dragging( _showcase_camera_snapshot.camera_dragging and Input.is_action_pressed("camera_drag") ) _showcase_camera_snapshot = null + if local_control_enabled: + set_local_input_suppressed(CATCH_SHOWCASE_INPUT_OWNER, false) if restored_callback.is_valid(): restored_callback.call() @@ -2810,16 +4024,16 @@ func _capture_showcase_camera_snapshot() -> void: _showcase_camera_snapshot.pitch_rotation = _camera_pitch.rotation _showcase_camera_snapshot.spring_length = _spring_arm.spring_length _showcase_camera_snapshot.target_zoom = _target_zoom - _showcase_camera_snapshot.camera_input_enabled = _camera_input_enabled _showcase_camera_snapshot.camera_dragging = _camera_dragging - _camera_input_enabled = false _set_camera_dragging(false) -func _begin_showcase_camera_transition() -> Vector3: +func _begin_showcase_camera_transition( + camera_yaw_offset_degrees: float, +) -> Vector3: var target_world_yaw: float = ( _visuals.global_rotation.y - + deg_to_rad(showcase_camera_yaw_offset) + + deg_to_rad(camera_yaw_offset_degrees) ) var target_local_yaw: float = target_world_yaw - global_rotation.y var shortest_target_yaw: float = ( diff --git a/player/player.tscn b/player/player.tscn index 43ab900..3288d2d 100644 --- a/player/player.tscn +++ b/player/player.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=22 format=3] +[gd_scene load_steps=23 format=3] [ext_resource type="Script" path="res://player/player.gd" id="1_script"] [ext_resource type="Script" path="res://inventory/fish_inventory.gd" id="2_inventory"] @@ -12,10 +12,11 @@ [ext_resource type="Script" path="res://progression/player_cooler_capacity.gd" id="10_capacity"] [ext_resource type="Script" path="res://player/player_ground_shadow.gd" id="11_ground_shadow"] [ext_resource type="Material" path="res://player/materials/player_blob_shadow.tres" id="12_blob_shadow"] -[ext_resource type="PackedScene" path="res://art/exported/characters/base/netfishing_base_character.glb" id="13_character"] +[ext_resource type="PackedScene" path="res://art/exported/characters/base/straywild_base_character.glb" id="13_character"] [ext_resource type="Script" path="res://progression/player_art_unlocks.gd" id="14_art_unlocks"] [ext_resource type="Script" path="res://progression/player_experience.gd" id="15_experience"] [ext_resource type="Script" path="res://player/sprint_dust_trail.gd" id="16_sprint_dust"] +[ext_resource type="Script" path="res://inventory/player_inventory_layout.gd" id="17_inventory_layout"] [sub_resource type="CapsuleShape3D" id="PlayerShape"] radius = 0.45 @@ -119,6 +120,10 @@ script = ExtResource("9_effects") unique_name_in_owner = true script = ExtResource("10_capacity") +[node name="InventoryLayout" type="Node" parent="."] +unique_name_in_owner = true +script = ExtResource("17_inventory_layout") + [node name="ArtUnlocks" type="Node" parent="."] unique_name_in_owner = true script = ExtResource("14_art_unlocks") diff --git a/player/player_visual_presenter.gd b/player/player_visual_presenter.gd index 745fc3c..b071b2c 100644 --- a/player/player_visual_presenter.gd +++ b/player/player_visual_presenter.gd @@ -3,9 +3,9 @@ extends RefCounted const PlayerScene: PackedScene = preload("res://player/player.tscn") const FurPatternShader: Shader = preload("res://player/fur_pattern.gdshader") -const RUNTIME_MATERIAL_META: StringName = &"netfishing_runtime_material" +const RUNTIME_MATERIAL_META: StringName = &"straywild_runtime_material" const RUNTIME_FUR_PATTERN_MATERIAL_META: StringName = ( - &"netfishing_runtime_fur_pattern_material" + &"straywild_runtime_fur_pattern_material" ) const EAR_MESH_NAMES: Array[String] = [ "ears_antlers_round", diff --git a/player/shovel_attachment.tscn b/player/shovel_attachment.tscn new file mode 100644 index 0000000..a57dfe5 --- /dev/null +++ b/player/shovel_attachment.tscn @@ -0,0 +1,68 @@ +[gd_scene load_steps=8 format=3] + +[ext_resource type="Script" path="res://player/tool_socket_attachment.gd" id="1_socket"] + +[sub_resource type="StandardMaterial3D" id="HandleMaterial"] +shading_mode = 0 +albedo_color = Color(0.36, 0.2, 0.1, 1) +metallic = 0.0 +roughness = 1.0 + +[sub_resource type="StandardMaterial3D" id="BladeMaterial"] +shading_mode = 0 +albedo_color = Color(0.34, 0.57, 0.58, 1) +metallic = 0.0 +roughness = 1.0 + +[sub_resource type="CylinderMesh" id="ShaftMesh"] +top_radius = 0.018 +bottom_radius = 0.018 +height = 0.7 +radial_segments = 8 +rings = 1 +material = SubResource("HandleMaterial") + +[sub_resource type="BoxMesh" id="BladeMesh"] +size = Vector3(0.19, 0.25, 0.025) +material = SubResource("BladeMaterial") + +[sub_resource type="BoxMesh" id="GripCrossMesh"] +size = Vector3(0.18, 0.035, 0.035) +material = SubResource("HandleMaterial") + +[sub_resource type="BoxMesh" id="GripSideMesh"] +size = Vector3(0.035, 0.13, 0.035) +material = SubResource("HandleMaterial") + +[node name="ShovelAttachment" type="BoneAttachment3D"] +bone_name = "rod_socket" +script = ExtResource("1_socket") +aligned_mount_path = NodePath("Shovel") + +[node name="Shovel" type="Node3D" parent="."] +visible = false + +[node name="Shaft" type="MeshInstance3D" parent="Shovel"] +position = Vector3(0, 0.35, 0) +cast_shadow = 0 +mesh = SubResource("ShaftMesh") + +[node name="Blade" type="MeshInstance3D" parent="Shovel"] +position = Vector3(0, 0.78, 0) +cast_shadow = 0 +mesh = SubResource("BladeMesh") + +[node name="GripCross" type="MeshInstance3D" parent="Shovel"] +position = Vector3(0, -0.09, 0) +cast_shadow = 0 +mesh = SubResource("GripCrossMesh") + +[node name="GripLeft" type="MeshInstance3D" parent="Shovel"] +position = Vector3(-0.0725, -0.035, 0) +cast_shadow = 0 +mesh = SubResource("GripSideMesh") + +[node name="GripRight" type="MeshInstance3D" parent="Shovel"] +position = Vector3(0.0725, -0.035, 0) +cast_shadow = 0 +mesh = SubResource("GripSideMesh") diff --git a/player/tool_socket_attachment.gd b/player/tool_socket_attachment.gd new file mode 100644 index 0000000..4bbd1af --- /dev/null +++ b/player/tool_socket_attachment.gd @@ -0,0 +1,57 @@ +class_name ToolSocketAttachment +extends BoneAttachment3D + +@export var direction_guide_bone: StringName = &"rod_socket.001" +@export_node_path("Node3D") var aligned_mount_path: NodePath + + +func _ready() -> void: + _align_mount_to_direction_guide() + + +func _align_mount_to_direction_guide() -> void: + var skeleton := get_parent() as Skeleton3D + var mount := get_node_or_null(aligned_mount_path) as Node3D + if skeleton == null or mount == null: + push_error("Tool socket alignment requires a Skeleton3D parent and mount.") + return + var socket_index := skeleton.find_bone(bone_name) + var guide_index := skeleton.find_bone(direction_guide_bone) + if socket_index < 0 or guide_index < 0: + push_error( + "Tool socket alignment is missing %s or %s." + % [bone_name, direction_guide_bone] + ) + return + if skeleton.get_bone_parent(guide_index) != socket_index: + push_error( + "Tool direction guide %s must be a child of %s." + % [direction_guide_bone, bone_name] + ) + return + var socket_rest := skeleton.get_bone_global_rest(socket_index) + var guide_rest := skeleton.get_bone_global_rest(guide_index) + var guide_in_socket := socket_rest.affine_inverse() * guide_rest + var rear_direction := guide_in_socket.basis.y.normalized() + # rod_socket already aims local +Y from the hand toward the working end. + # Its child guide is perpendicular to that axis and identifies which face + # of the held tool points rearward. Projecting it onto the roll plane keeps + # imperfect authored guides from changing the tool's lengthwise direction. + rear_direction -= Vector3.UP * rear_direction.dot(Vector3.UP) + if rear_direction.is_zero_approx(): + push_error("Tool direction guide has no usable direction.") + return + rear_direction = rear_direction.normalized() + var rear_roll := Vector3.BACK.signed_angle_to( + rear_direction, + Vector3.UP, + ) + var mount_transform := mount.transform + mount_transform.basis = ( + Basis(Vector3.UP, rear_roll).orthonormalized() + * mount_transform.basis + ) + # The guide starts at the socket tip, but the held tool must remain anchored + # at the socket origin in the hand. Only its authored direction is applied. + mount_transform.origin = mount.transform.origin + mount.transform = mount_transform diff --git a/player/tool_socket_attachment.gd.uid b/player/tool_socket_attachment.gd.uid new file mode 100644 index 0000000..7ddb71c --- /dev/null +++ b/player/tool_socket_attachment.gd.uid @@ -0,0 +1 @@ +uid://toolsocketalignment01 diff --git a/progression/player_appearance_store.gd b/progression/player_appearance_store.gd index 7ac8767..febe43d 100644 --- a/progression/player_appearance_store.gd +++ b/progression/player_appearance_store.gd @@ -13,6 +13,10 @@ var _data_root: PlayerDataRoot func configure_storage(path: String, data_root: PlayerDataRoot) -> void: _profile_path = path _data_root = data_root + _snapshot = CharacterCustomizationCatalog.default_snapshot() + _loaded = false + _future_version = false + _expected_hash = "" func _temp_path() -> String: diff --git a/progression/player_art_unlocks.gd b/progression/player_art_unlocks.gd index c6a6e57..0bc7acc 100644 --- a/progression/player_art_unlocks.gd +++ b/progression/player_art_unlocks.gd @@ -7,6 +7,7 @@ signal unlocks_changed(unlock_mask: int) const BASE_BRUSH_SIZE: int = 1 const BASE_GRID_SIZE: int = 16 +const STAMP_PRODUCT_ID: StringName = &"stamp_tool" const BRUSH_SIZES: Array[int] = [1, 2, 3, 4] const GRID_SIZES: Array[int] = [16, 32, 64, 128] @@ -25,6 +26,7 @@ const PRODUCT_BITS: Dictionary[StringName, int] = { &"grid_32x": 10, &"grid_64x": 11, &"grid_128x": 12, + STAMP_PRODUCT_ID: 13, } const COLOR_PRODUCTS: Dictionary[StringName, StringName] = { &"marker_ocean_teal": &"ocean_teal", @@ -45,7 +47,7 @@ const GRID_PRODUCTS: Dictionary[StringName, int] = { &"grid_64x": 64, &"grid_128x": 128, } -const ALL_UNLOCK_MASK: int = (1 << 13) - 1 +const ALL_UNLOCK_MASK: int = (1 << 14) - 1 var _unlock_mask: int = 0 @@ -146,6 +148,10 @@ func is_grid_size_unlocked(grid_size: int) -> bool: return grid_size in get_unlocked_grid_sizes() +func is_stamp_unlocked() -> bool: + return owns_product(STAMP_PRODUCT_ID) + + static func get_product_bit(product_id: StringName) -> int: return int(PRODUCT_BITS.get(product_id, -1)) diff --git a/progression/player_cooler_capacity.gd b/progression/player_cooler_capacity.gd index 1e77784..b8c62be 100644 --- a/progression/player_cooler_capacity.gd +++ b/progression/player_cooler_capacity.gd @@ -5,9 +5,13 @@ const PlayerWalletType = preload("res://economy/player_wallet.gd") signal capacity_changed(level: int, capacity: int) -const CAPACITIES: Array[int] = [12, 18, 24, 32, 40] -const EXPANSION_COSTS: Array[int] = [75, 175, 400, 850] -const MAX_LEVEL: int = 4 +## Kept under the historical class name so existing saves and network product +## identifiers migrate without losing their purchased level. This progression +## now controls the player's private storage box rather than carried catches. +const CAPACITIES: Array[int] = [9, 18, 27, 36, 45, 54, 63, 72] +const EXPANSION_COSTS: Array[int] = [75, 175, 400, 850, 1500, 2500, 4000] +const MAX_LEVEL: int = 7 +const MAX_CAPACITY: int = 72 var _capacity_level: int = 0 diff --git a/progression/player_fishing_upgrades.gd b/progression/player_fishing_upgrades.gd index 7bc6abd..e21a31e 100644 --- a/progression/player_fishing_upgrades.gd +++ b/progression/player_fishing_upgrades.gd @@ -6,9 +6,17 @@ const PlayerWalletType = preload("res://economy/player_wallet.gd") signal upgrades_changed(reel_speed_level: int, barrier_power_level: int) const MAX_REEL_SPEED_LEVEL: int = 5 -const MAX_BARRIER_POWER_LEVEL: int = 3 +const MAX_BARRIER_POWER_LEVEL: int = 7 const REEL_SPEED_COSTS: Array[int] = [50, 125, 300, 650, 1250] -const BARRIER_POWER_COSTS: Array[int] = [100, 275, 700] +const BARRIER_POWER_COSTS: Array[int] = [ + 100, + 275, + 700, + 1500, + 3000, + 6000, + 12000, +] var _reel_speed_level: int = 0 var _barrier_power_level: int = 0 @@ -27,7 +35,11 @@ func get_reel_speed_multiplier() -> float: func get_barrier_damage() -> int: - return _barrier_power_level + 1 + return get_barrier_damage_for_level(_barrier_power_level) + + +static func get_barrier_damage_for_level(level: int) -> int: + return 1 << clampi(level, 0, MAX_BARRIER_POWER_LEVEL) func get_next_reel_speed_cost() -> int: diff --git a/project.godot b/project.godot index a8a58c9..5bcbb4d 100644 --- a/project.godot +++ b/project.godot @@ -10,11 +10,11 @@ config_version=5 [application] -config/name="NETFISHING" -config/version="0.10.0-alpha" +config/name="straywild" +config/version="0.20.2-alpha" run/main_scene="res://main/main.tscn" config/features=PackedStringArray("4.7", "GL Compatibility") -config/icon="res://art/exported/system_icons/netfishing_256.png" +config/icon="res://art/exported/system_icons/straywild_256.png" [autoload] @@ -26,10 +26,11 @@ window/stretch/aspect="expand" [editor_plugins] -enabled=PackedStringArray("res://addons/netfishing_shoreline_baker/plugin.cfg") +enabled=PackedStringArray("res://addons/straywild_shoreline_baker/plugin.cfg") [gui] +timers/tooltip_delay_sec=0.0 theme/custom="res://ui/game_theme.tres" [input] @@ -107,6 +108,11 @@ fish_primary={ , Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":0,"button_index":10,"pressure":0.0,"pressed":false,"script":null) ] } +reel_alternate={ +"deadzone": 0.2, +"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":16,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":96,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null) +] +} camera_drag={ "deadzone": 0.2, "events": [Object(InputEventMouseButton,"resource_local_to_scene":false,"resource_name":"","device":32,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"button_mask":0,"position":Vector2(0, 0),"global_position":Vector2(0, 0),"factor":1.0,"button_index":2,"canceled":false,"pressed":false,"double_click":false,"script":null) @@ -197,6 +203,7 @@ open_emotes={ character_call={ "deadzone": 0.2, "events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":16,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":71,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null) +, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":0,"button_index":3,"pressure":0.0,"pressed":false,"script":null) ] } open_quick_actions={ @@ -253,7 +260,7 @@ alternate_fishing={ [network] -discovery/base_url="https://discovery.netfishing.org" +discovery/base_url="https://discovery.straywild.io/patron-test" [physics] diff --git a/save/player_save_inspection.gd b/save/player_save_inspection.gd index be5fd24..ff14de6 100644 --- a/save/player_save_inspection.gd +++ b/save/player_save_inspection.gd @@ -14,6 +14,10 @@ var detected_version: int = -1 var catch_count: int = 0 var wallet_balance: int = 0 var discovered_species_count: int = 0 +var total_experience: int = 0 +var player_level: int = 1 +var world_layout: StringName = &"generated_world" +var world_seed: int = 0 var has_primary_file: bool = false var message: String = "" diff --git a/save/player_save_manager.gd b/save/player_save_manager.gd index 57e355d..56fd49c 100644 --- a/save/player_save_manager.gd +++ b/save/player_save_manager.gd @@ -12,6 +12,9 @@ const ItemCatalogType = preload("res://items/item_catalog.gd") const OwnedItemType = preload("res://items/owned_item.gd") const PlayerBagType = preload("res://inventory/player_bag.gd") const PlayerHotbarType = preload("res://inventory/player_hotbar.gd") +const PlayerInventoryLayoutType = preload( + "res://inventory/player_inventory_layout.gd" +) const PlayerFishingUpgradesType = preload( "res://progression/player_fishing_upgrades.gd" ) @@ -28,11 +31,18 @@ const WorldTimeServiceType = preload("res://world/world_time_service.gd") const WorldWeatherServiceType = preload( "res://world/world_weather_service.gd" ) +const WorldLayoutType = preload("res://world/world_layout.gd") const PlayerJobServiceType = preload("res://jobs/player_job_service.gd") +const PlayerType = preload("res://player/player.gd") +const PlayerHomeStateType = preload("res://homes/player_home_state.gd") -const SAVE_VERSION: int = 7 +const SAVE_VERSION: int = 11 +const LEGACY_SAVE_FILENAME := "player_save.json" +const ARCHIVE_EXTENSION := ".nfsave" const BASIC_ROD_ID: StringName = &"basic_fishing_rod" const MAX_SAFE_BALANCE: int = 1000000000000 +const DEFAULT_WORLD_SEED: int = 13001 +const MAX_WORLD_SEED: int = 2147483646 class LoadSnapshot: extends RefCounted @@ -40,18 +50,24 @@ class LoadSnapshot: var catches: Array[FishCatchType] = [] var discovered_ids: Array[StringName] = [] var discovered_quality_masks: Dictionary[StringName, int] = {} + var catch_counts: Dictionary[StringName, int] = {} var wallet_balance: int = 0 var next_catch_sequence: int = 1 var bag_items: Array[OwnedItemType] = [] var unlocked_bait_ids: Array[StringName] = [] + var active_bait_id: StringName + var active_lure_id: StringName var hotbar_slots: Array[StringName] = [] var fish_hotbar_slots: Array[StringName] = [] var selected_hotbar_slot: int = 0 + var inventory_layout_data: Dictionary = {} var reel_speed_level: int = 0 var barrier_power_level: int = 0 var cooler_capacity_level: int = 0 var art_unlock_mask: int = 0 var total_experience: int = 0 + var world_layout: StringName = WorldLayoutType.GENERATED + var world_seed: int = DEFAULT_WORLD_SEED var world_time_hours: float = WorldTimeServiceType.DEFAULT_START_HOUR var has_world_weather_state: bool = false var world_weather: WorldWeatherServiceType.Weather = ( @@ -61,6 +77,7 @@ class LoadSnapshot: WorldWeatherServiceType.SUNNY_DURATION_RANGE.x ) var jobs_data: Dictionary = PlayerJobServiceType.default_save_data() + var home_data: Dictionary = PlayerHomeStateType.default_save_data() @export_range(0.05, 5.0, 0.05) var autosave_delay: float = 0.5 @@ -71,6 +88,7 @@ var _wallet: PlayerWalletType var _catalog: FishPoolType var _bag: PlayerBagType var _hotbar: PlayerHotbarType +var _inventory_layout: PlayerInventoryLayoutType var _item_catalog: ItemCatalogType var _fishing_upgrades: PlayerFishingUpgradesType var _cooler_capacity: PlayerCoolerCapacityType @@ -79,6 +97,8 @@ var _experience: PlayerExperienceType var _world_time: WorldTimeServiceType var _world_weather: WorldWeatherServiceType var _jobs: PlayerJobServiceType +var _player: PlayerType +var _home_state: PlayerHomeStateType var _autosave_timer: Timer var _is_configured: bool = false var _is_restoring: bool = false @@ -88,11 +108,27 @@ var _autosave_enabled: bool = false var _save_path := "" var _expected_hash := "" var _data_root: PlayerDataRoot +var _world_layout: StringName = WorldLayoutType.GENERATED +var _world_seed: int = DEFAULT_WORLD_SEED func configure_storage(path: String, data_root: PlayerDataRoot) -> void: + if not select_storage(path, data_root): + push_error("PlayerSaveManager could not configure progression storage.") + + +func select_storage(path: String, data_root: PlayerDataRoot) -> bool: + if path.is_empty() or data_root == null: + return false + if _autosave_enabled or _is_dirty: + return false + if _autosave_timer != null: + _autosave_timer.stop() _save_path = path _data_root = data_root + _expected_hash = "" + _automatic_saving_blocked = false + return true func _temp_path() -> String: @@ -103,6 +139,21 @@ func _backup_path() -> String: return _save_path + ".backup" +func _codec_scratch_path() -> String: + return _save_path + ".codec.tmp" + + +func _legacy_save_path() -> String: + return _save_path.get_base_dir().path_join(LEGACY_SAVE_FILENAME) + + +func _read_path() -> String: + if FileAccess.file_exists(_save_path): + return _save_path + var legacy: String = _legacy_save_path() + return legacy if FileAccess.file_exists(legacy) else "" + + func _ready() -> void: _autosave_timer = Timer.new() _autosave_timer.one_shot = true @@ -117,6 +168,7 @@ func setup( catalog: FishPoolType, bag: PlayerBagType, hotbar: PlayerHotbarType, + inventory_layout: PlayerInventoryLayoutType, item_catalog: ItemCatalogType, fishing_upgrades: PlayerFishingUpgradesType, cooler_capacity: PlayerCoolerCapacityType, @@ -125,6 +177,8 @@ func setup( world_time: WorldTimeServiceType, world_weather: WorldWeatherServiceType, jobs: PlayerJobServiceType, + player: PlayerType, + home_state: PlayerHomeStateType, ) -> void: _inventory = inventory _collection_log = collection_log @@ -132,6 +186,7 @@ func setup( _catalog = catalog _bag = bag _hotbar = hotbar + _inventory_layout = inventory_layout _item_catalog = item_catalog _fishing_upgrades = fishing_upgrades _cooler_capacity = cooler_capacity @@ -140,6 +195,8 @@ func setup( _world_time = world_time _world_weather = world_weather _jobs = jobs + _player = player + _home_state = home_state _is_configured = ( _inventory != null and _collection_log != null @@ -147,6 +204,7 @@ func setup( and _catalog != null and _bag != null and _hotbar != null + and _inventory_layout != null and _item_catalog != null and _fishing_upgrades != null and _cooler_capacity != null @@ -155,6 +213,8 @@ func setup( and _world_time != null and _world_weather != null and _jobs != null + and _player != null + and _home_state != null ) if not _is_configured: push_error("PlayerSaveManager setup is missing required references.") @@ -171,6 +231,8 @@ func setup( _bag.contents_changed.connect(_mark_dirty) if not _hotbar.slots_changed.is_connected(_mark_dirty): _hotbar.slots_changed.connect(_mark_dirty) + if not _inventory_layout.layout_changed.is_connected(_mark_dirty): + _inventory_layout.layout_changed.connect(_mark_dirty) if not _hotbar.selected_slot_changed.is_connected( _on_selected_hotbar_slot_changed ): @@ -195,6 +257,12 @@ func setup( _experience.experience_changed.connect(_on_experience_changed) if not _jobs.changed.is_connected(_mark_dirty): _jobs.changed.connect(_mark_dirty) + if not _player.active_bait_changed.is_connected(_on_active_tackle_changed): + _player.active_bait_changed.connect(_on_active_tackle_changed) + if not _player.active_lure_changed.is_connected(_on_active_tackle_changed): + _player.active_lure_changed.connect(_on_active_tackle_changed) + if not _home_state.changed.is_connected(_mark_dirty): + _home_state.changed.connect(_mark_dirty) func load_player_data() -> bool: @@ -202,24 +270,22 @@ func load_player_data() -> bool: return false _automatic_saving_blocked = false _recover_interrupted_write() - if _save_path.is_empty() or not FileAccess.file_exists(_save_path): + var read_path: String = _read_path() + if _save_path.is_empty() or read_path.is_empty(): _is_dirty = false return true - - var save_file := FileAccess.open(_save_path, FileAccess.READ) - if save_file == null: - _handle_corrupt_save("Unable to open player save.") + var decoded: Dictionary = ProgressionSaveCodec.read_local_save( + read_path, + read_path == _legacy_save_path(), + ) + if not bool(decoded.get("ok", false)): + _handle_corrupt_save("Player save could not be decoded.", read_path) return false - var json_text: String = save_file.get_as_text() - save_file.close() - _expected_hash = PortableFileGuard.hash_file(_save_path) - - var json := JSON.new() - var parse_error: Error = json.parse(json_text) - if parse_error != OK or typeof(json.data) != TYPE_DICTIONARY: - _handle_corrupt_save("Player save contains malformed JSON.") - return false - var save_data: Dictionary = json.data + _expected_hash = ( + PortableFileGuard.hash_file(_save_path) + if read_path == _save_path else "" + ) + var save_data: Dictionary = decoded["data"] var version: int = _read_integer(save_data.get("save_version"), -1) if version > SAVE_VERSION: _automatic_saving_blocked = true @@ -236,13 +302,16 @@ func load_player_data() -> bool: save_data = _migrate_save(save_data, version) if save_data.is_empty(): _handle_corrupt_save( - "Player save version %d is unsupported." % version + "Player save version %d is unsupported." % version, + read_path, ) return false var snapshot: LoadSnapshot = _build_load_snapshot(save_data) if snapshot == null: - _handle_corrupt_save("Player save failed structural validation.") + _handle_corrupt_save( + "Player save failed structural validation.", read_path + ) return false _is_restoring = true @@ -251,9 +320,10 @@ func load_player_data() -> bool: snapshot.next_catch_sequence ) var collection_restored: bool = ( - _collection_log.replace_discovery_state( + _collection_log.replace_collection_state( snapshot.discovered_ids, snapshot.discovered_quality_masks, + snapshot.catch_counts, ) ) var wallet_restored: bool = _wallet.restore_balance( @@ -263,11 +333,7 @@ func load_player_data() -> bool: _bag.replace_all_items(snapshot.bag_items) and _bag.replace_unlocked_bait_ids(snapshot.unlocked_bait_ids) ) - var hotbar_restored: bool = _hotbar.replace_state( - snapshot.hotbar_slots, - snapshot.selected_hotbar_slot, - snapshot.fish_hotbar_slots, - ) + var tackle_restored: bool = _restore_tackle_selection(snapshot) var upgrades_restored: bool = _fishing_upgrades.restore_levels( snapshot.reel_speed_level, snapshot.barrier_power_level @@ -275,6 +341,15 @@ func load_player_data() -> bool: var cooler_restored: bool = _cooler_capacity.restore_level( snapshot.cooler_capacity_level ) + var layout_restored: bool = _inventory_layout.restore_from_save_data( + snapshot.inventory_layout_data + ) + var hotbar_restored: bool = _hotbar.replace_state( + snapshot.hotbar_slots, + snapshot.selected_hotbar_slot, + snapshot.fish_hotbar_slots, + false, + ) var art_restored: bool = _art_unlocks.restore_mask( snapshot.art_unlock_mask ) @@ -284,6 +359,8 @@ func load_player_data() -> bool: var world_time_restored: bool = ( _world_time.restore_persistent_time_hours(snapshot.world_time_hours) ) + _world_layout = snapshot.world_layout + _world_seed = snapshot.world_seed var world_weather_restored: bool = true if snapshot.has_world_weather_state: world_weather_restored = _world_weather.restore_persistent_state( @@ -291,25 +368,57 @@ func load_player_data() -> bool: snapshot.world_weather_seconds_remaining, ) var jobs_restored: bool = _jobs.restore_from_save_data(snapshot.jobs_data) + var home_restored: bool = _home_state.restore_from_save_data( + snapshot.home_data + ) _is_restoring = false if ( not inventory_restored or not collection_restored or not wallet_restored or not bag_restored + or not tackle_restored or not hotbar_restored or not upgrades_restored or not cooler_restored + or not layout_restored or not art_restored or not experience_restored or not world_time_restored or not world_weather_restored or not jobs_restored + or not home_restored ): - push_error("Validated player save could not be restored.") + push_error( + ( + "Validated player save could not be restored: " + + "inventory=%s collection=%s wallet=%s bag=%s tackle=%s hotbar=%s " + + "upgrades=%s cooler=%s layout=%s art=%s experience=%s " + + "time=%s weather=%s jobs=%s home=%s" + ) + % [ + inventory_restored, + collection_restored, + wallet_restored, + bag_restored, + tackle_restored, + hotbar_restored, + upgrades_restored, + cooler_restored, + layout_restored, + art_restored, + experience_restored, + world_time_restored, + world_weather_restored, + jobs_restored, + home_restored, + ] + ) return false _is_dirty = false + if read_path == _legacy_save_path(): + _migrate_legacy_plaintext_save(save_data, read_path) print( "Loaded player save version %d with %d catches." % [SAVE_VERSION, snapshot.catches.size()] @@ -318,26 +427,36 @@ func load_player_data() -> bool: func inspect_save() -> SaveInspectionType: - var result := SaveInspectionType.new() _recover_interrupted_write() - result.has_primary_file = FileAccess.file_exists(_save_path) + var read_path: String = _read_path() + return inspect_progression_at_path( + read_path, + read_path == _legacy_save_path(), + ) + + +func inspect_progression_at_path( + path: String, + allow_legacy_plaintext: bool = false, +) -> SaveInspectionType: + var result := SaveInspectionType.new() + if not path.is_empty(): + _remove_if_present(path + ".codec.tmp") + _recover_path_write(path) + result.has_primary_file = not path.is_empty() and FileAccess.file_exists(path) if not result.has_primary_file: result.status = SaveInspectionType.Status.MISSING result.message = "no save found." return result - var save_file := FileAccess.open(_save_path, FileAccess.READ) - if save_file == null: + var decoded: Dictionary = ProgressionSaveCodec.read_local_save( + path, + allow_legacy_plaintext, + ) + if not bool(decoded.get("ok", false)): result.status = SaveInspectionType.Status.IO_ERROR result.message = "the save could not be read." return result - var json := JSON.new() - var parse_error: Error = json.parse(save_file.get_as_text()) - save_file.close() - if parse_error != OK or typeof(json.data) != TYPE_DICTIONARY: - result.status = SaveInspectionType.Status.MALFORMED - result.message = "the save is corrupt and was preserved." - return result - var save_data: Dictionary = json.data + var save_data: Dictionary = decoded["data"] result.detected_version = _read_integer(save_data.get("save_version"), -1) if result.detected_version > SAVE_VERSION: result.status = SaveInspectionType.Status.UNSUPPORTED_VERSION @@ -362,22 +481,237 @@ func inspect_save() -> SaveInspectionType: result.catch_count = snapshot.catches.size() result.wallet_balance = snapshot.wallet_balance result.discovered_species_count = snapshot.discovered_ids.size() + result.total_experience = snapshot.total_experience + result.player_level = PlayerExperienceType.level_for_total_experience( + snapshot.total_experience + ) + result.world_layout = snapshot.world_layout + result.world_seed = snapshot.world_seed result.message = "save ready." return result -func initialize_new_game() -> bool: +func export_progression_archive(path: String) -> Dictionary: + if not _is_configured or path.is_empty(): + return {"ok": false, "message": "progression export is unavailable."} + if _is_dirty and not save_if_dirty(): + return {"ok": false, "message": "progression could not be saved first."} + var source_path: String = _read_path() + if source_path.is_empty(): + return {"ok": false, "message": "there is no progression to export."} + return export_progression_archive_from_path( + source_path, + path, + source_path == _legacy_save_path(), + ) + + +func export_progression_archive_from_path( + source_path: String, + destination_path: String, + allow_legacy_plaintext: bool = false, +) -> Dictionary: + if source_path.is_empty() or destination_path.is_empty(): + return {"ok": false, "message": "progression export is unavailable."} + var decoded: Dictionary = ProgressionSaveCodec.read_local_save( + source_path, + allow_legacy_plaintext, + ) + if not bool(decoded.get("ok", false)): + return {"ok": false, "message": "the selected progression could not be read."} + var prepared: Dictionary = _prepare_external_save_data(decoded["data"]) + if not bool(prepared.get("ok", false)): + return prepared + var bytes: PackedByteArray = ProgressionSaveCodec.encode_archive( + prepared["data"], + destination_path + ".codec.tmp", + ) + if bytes.is_empty(): + return {"ok": false, "message": "the progression archive could not be encoded."} + var result: Dictionary = PortableFileGuard.write_guarded( + destination_path, + bytes, + PortableFileGuard.hash_file(destination_path), + _data_root.conflict_directory(), + _data_root.device_id, + ) + if not bool(result.get("ok", false)): + return {"ok": false, "message": "the progression archive could not be written."} + var verified: Dictionary = inspect_progression_archive(destination_path) + if not bool(verified.get("ok", false)): + return {"ok": false, "message": "the progression archive could not be verified."} + verified["message"] = "progression archive created." + return verified + + +func inspect_progression_archive(path: String) -> Dictionary: + var decoded: Dictionary = ProgressionSaveCodec.read_archive(path) + if not bool(decoded.get("ok", false)): + return { + "ok": false, + "message": str(decoded.get("message", "could not open progression archive.")), + } + var prepared: Dictionary = _prepare_external_save_data(decoded["data"]) + if not bool(prepared.get("ok", false)): + return prepared + prepared["game_version"] = str(decoded.get("game_version", "")) + prepared["created_at_unix"] = int(decoded.get("created_at_unix", 0)) + return prepared + + +func import_progression_archive(path: String) -> Dictionary: if not _is_configured: + return {"ok": false, "message": "progression import is unavailable."} + var inspected: Dictionary = inspect_progression_archive(path) + if not bool(inspected.get("ok", false)): + return inspected + var current_path: String = _read_path() + if not current_path.is_empty() and not _archive_replaced_save(current_path): + return {"ok": false, "message": "the current progression could not be backed up."} + var expected_hash: String = PortableFileGuard.hash_file(_save_path) + var result: Dictionary = _write_current_save_data( + inspected["data"], expected_hash + ) + if not bool(result.get("ok", false)): + return {"ok": false, "message": "the imported progression could not be installed."} + _expected_hash = str(result.get("hash", "")) + _remove_legacy_save_files() + _is_dirty = false + _automatic_saving_blocked = false + return { + "ok": true, + "message": "progression imported.", + "catch_count": inspected["catch_count"], + "wallet_balance": inspected["wallet_balance"], + "discovered_species_count": inspected["discovered_species_count"], + } + + +func install_progression_archive_at_path( + archive_path: String, + destination_path: String, +) -> Dictionary: + if not _is_configured or destination_path.is_empty(): + return {"ok": false, "message": "progression import is unavailable."} + var inspected: Dictionary = inspect_progression_archive(archive_path) + if not bool(inspected.get("ok", false)): + return inspected + var result: Dictionary = _write_save_data_at_path( + inspected["data"], + destination_path, + PortableFileGuard.hash_file(destination_path), + ) + if not bool(result.get("ok", false)): + return {"ok": false, "message": "the imported progression could not be installed."} + return { + "ok": true, + "message": "progression imported as a new save slot.", + "catch_count": inspected["catch_count"], + "wallet_balance": inspected["wallet_balance"], + "discovered_species_count": inspected["discovered_species_count"], + "world_layout": inspected["world_layout"], + "world_seed": inspected["world_seed"], + } + + +func copy_progression_to_path( + source_path: String, + destination_path: String, + allow_legacy_plaintext: bool, + world_layout: StringName, + world_seed: int, +) -> Dictionary: + if ( + not _is_configured + or source_path.is_empty() + or destination_path.is_empty() + or not WorldLayoutType.is_valid(world_layout) + or world_seed <= 0 + or world_seed > MAX_WORLD_SEED + ): + return {"ok": false, "message": "progression duplication is unavailable."} + var decoded: Dictionary = ProgressionSaveCodec.read_local_save( + source_path, + allow_legacy_plaintext, + ) + if not bool(decoded.get("ok", false)): + return {"ok": false, "message": "the selected progression could not be read."} + var prepared: Dictionary = _prepare_external_save_data(decoded["data"]) + if not bool(prepared.get("ok", false)): + return prepared + var save_data: Dictionary = (prepared["data"] as Dictionary).duplicate(true) + var world_data: Dictionary = {} + if typeof(save_data.get("world")) == TYPE_DICTIONARY: + world_data = (save_data["world"] as Dictionary).duplicate(true) + world_data["layout"] = String(world_layout) + world_data["seed"] = world_seed + save_data["world"] = world_data + prepared = _prepare_external_save_data(save_data) + if not bool(prepared.get("ok", false)): + return prepared + var result: Dictionary = _write_save_data_at_path( + prepared["data"], + destination_path, + PortableFileGuard.hash_file(destination_path), + ) + if not bool(result.get("ok", false)): + return {"ok": false, "message": "the duplicated progression could not be written."} + return { + "ok": true, + "message": "save slot duplicated.", + "world_layout": String(world_layout), + "world_seed": world_seed, + } + + +func initialize_new_game( + world_seed: int = DEFAULT_WORLD_SEED, + world_layout: StringName = WorldLayoutType.GENERATED, +) -> bool: + if not _is_configured: + return false + if ( + world_seed <= 0 + or world_seed > MAX_WORLD_SEED + or not WorldLayoutType.is_valid(world_layout) + ): return false _automatic_saving_blocked = false _restore_defaults() + _world_layout = world_layout + _world_seed = world_seed + _is_dirty = true return true +func get_world_layout() -> StringName: + return _world_layout + + +func get_world_seed() -> int: + return _world_seed + + +static func roll_world_seed() -> int: + var random := RandomNumberGenerator.new() + random.randomize() + return random.randi_range(1, MAX_WORLD_SEED) + + func delete_progression_save() -> bool: - if FileAccess.file_exists(_save_path) and not _remove_if_present(_save_path): - return false - for path: String in [_temp_path(), _backup_path()]: + for primary_path: String in [_save_path, _legacy_save_path()]: + if ( + FileAccess.file_exists(primary_path) + and not _remove_if_present(primary_path) + ): + return false + for path: String in [ + _temp_path(), + _backup_path(), + _codec_scratch_path(), + _legacy_save_path() + ".tmp", + _legacy_save_path() + ".backup", + ]: if FileAccess.file_exists(path) and not _remove_if_present(path): push_warning("Unable to remove stale player-save auxiliary file.") if _autosave_timer != null: @@ -429,16 +763,8 @@ func save_now() -> bool: var save_data: Dictionary = _build_save_dictionary() if save_data.is_empty(): return false - var json_text: String = JSON.stringify(save_data, "\t") - if json_text.is_empty(): - return false - - var result := PortableFileGuard.write_guarded( - _save_path, - json_text.to_utf8_buffer(), - _expected_hash, - _data_root.conflict_directory(), - _data_root.device_id, + var result: Dictionary = _write_current_save_data( + save_data, _expected_hash ) if bool(result.get("conflict", false)): _data_root.report_conflict( @@ -491,6 +817,20 @@ func _build_save_dictionary() -> Dictionary: ): return {} serialized_quality_masks[String(fish_id)] = quality_mask + var serialized_catch_counts: Dictionary = {} + var catch_counts: Dictionary[StringName, int] = ( + _collection_log.get_catch_counts() + ) + for fish_id: StringName in catch_counts: + var catch_count: int = catch_counts[fish_id] + if ( + fish_id.is_empty() + or catch_count <= 0 + or catch_count > CollectionLogType.MAX_CATCH_COUNT + or not _collection_log.has_discovered(fish_id) + ): + return {} + serialized_catch_counts[String(fish_id)] = catch_count var serialized_items: Array[Dictionary] = [] for owned: OwnedItemType in _bag.get_all_items(): if owned == null or not owned.is_valid(): @@ -518,6 +858,17 @@ func _build_save_dictionary() -> Dictionary: ) ): return {} + var active_bait_id: StringName = _player.active_bait_id + var active_lure_id: StringName = _player.active_lure_id + if ( + (not active_bait_id.is_empty() and not _valid_active_tackle( + active_bait_id, true + )) + or (not active_lure_id.is_empty() and not _valid_active_tackle( + active_lure_id, false + )) + ): + return {} return { "save_version": SAVE_VERSION, @@ -527,6 +878,7 @@ func _build_save_dictionary() -> Dictionary: "collection": { "discovered_fish_ids": discovered_strings, "discovered_quality_masks": serialized_quality_masks, + "catch_counts": serialized_catch_counts, }, "inventory": { "next_catch_sequence": _inventory.get_next_catch_sequence(), @@ -536,16 +888,23 @@ func _build_save_dictionary() -> Dictionary: "items": serialized_items, "unlocked_bait_ids": serialized_unlocked_baits, }, + "tackle": { + "active_bait_id": String(active_bait_id), + "active_lure_id": String(active_lure_id), + }, "hotbar": { "selected_slot": _hotbar.get_selected_slot(), "slots": serialized_slots, "fish_slots": serialized_fish_slots, }, + "inventory_layout": _inventory_layout.to_save_data(), "upgrades": _fishing_upgrades.to_save_data(), "cooler": _cooler_capacity.to_save_data(), "art": _art_unlocks.to_save_data(), "experience": _experience.to_save_data(), "world": { + "layout": String(_world_layout), + "seed": _world_seed, "time_hours": _world_time.get_persistent_time_hours(), "weather": int(_world_weather.get_persistent_weather()), "weather_seconds_remaining": ( @@ -553,6 +912,7 @@ func _build_save_dictionary() -> Dictionary: ), }, "jobs": _jobs.to_save_data(), + "home": _home_state.to_save_data(), } @@ -562,18 +922,24 @@ func _build_load_snapshot(save_data: Dictionary) -> LoadSnapshot: or typeof(save_data.get("collection")) != TYPE_DICTIONARY or typeof(save_data.get("inventory")) != TYPE_DICTIONARY or typeof(save_data.get("bag")) != TYPE_DICTIONARY + or typeof(save_data.get("tackle")) != TYPE_DICTIONARY or typeof(save_data.get("hotbar")) != TYPE_DICTIONARY + or typeof(save_data.get("inventory_layout")) != TYPE_DICTIONARY or typeof(save_data.get("experience")) != TYPE_DICTIONARY or typeof(save_data.get("jobs")) != TYPE_DICTIONARY + or typeof(save_data.get("home")) != TYPE_DICTIONARY ): return null var wallet_data: Dictionary = save_data["wallet"] var collection_data: Dictionary = save_data["collection"] var inventory_data: Dictionary = save_data["inventory"] var bag_data: Dictionary = save_data["bag"] + var tackle_data: Dictionary = save_data["tackle"] var hotbar_data: Dictionary = save_data["hotbar"] + var inventory_layout_data: Dictionary = save_data["inventory_layout"] var experience_data: Dictionary = save_data["experience"] var jobs_data: Dictionary = save_data["jobs"] + var home_data: Dictionary = save_data["home"] var world_data: Dictionary = {} if typeof(save_data.get("world")) == TYPE_DICTIONARY: world_data = save_data["world"] @@ -605,6 +971,12 @@ func _build_load_snapshot(save_data: Dictionary) -> LoadSnapshot: and typeof(bag_data.get("unlocked_bait_ids")) != TYPE_ARRAY ) or typeof(hotbar_data.get("slots")) != TYPE_ARRAY + or typeof(tackle_data.get("active_bait_id")) not in [ + TYPE_STRING, TYPE_STRING_NAME, + ] + or typeof(tackle_data.get("active_lure_id")) not in [ + TYPE_STRING, TYPE_STRING_NAME, + ] or not hotbar_data.has("selected_slot") or not experience_data.has("total_experience") ): @@ -624,6 +996,21 @@ func _build_load_snapshot(save_data: Dictionary) -> LoadSnapshot: return null var snapshot := LoadSnapshot.new() + if world_data.has("layout"): + if not WorldLayoutType.is_valid(world_data["layout"]): + return null + snapshot.world_layout = WorldLayoutType.normalized( + world_data["layout"] + ) + if world_data.has("seed"): + snapshot.world_seed = _read_integer( + world_data["seed"], + -1, + MAX_WORLD_SEED, + ) + if snapshot.world_seed <= 0: + return null + snapshot.inventory_layout_data = inventory_layout_data.duplicate(true) snapshot.wallet_balance = balance snapshot.total_experience = _read_integer( experience_data["total_experience"], @@ -635,6 +1022,12 @@ func _build_load_snapshot(save_data: Dictionary) -> LoadSnapshot: if not PlayerJobServiceType.validate_save_data(jobs_data): return null snapshot.jobs_data = jobs_data.duplicate(true) + var sanitized_home: Dictionary = PlayerHomeStateType.sanitize_save_data( + home_data + ) + if sanitized_home.is_empty(): + return null + snapshot.home_data = sanitized_home if world_data.has("time_hours"): snapshot.world_time_hours = _read_world_time_hours( world_data["time_hours"] @@ -696,6 +1089,30 @@ func _build_load_snapshot(save_data: Dictionary) -> LoadSnapshot: ): return null snapshot.discovered_quality_masks[fish_id] = mask + var has_saved_catch_counts: bool = collection_data.has("catch_counts") + if ( + has_saved_catch_counts + and typeof(collection_data.get("catch_counts")) != TYPE_DICTIONARY + ): + return null + if has_saved_catch_counts: + var saved_catch_counts: Dictionary = collection_data["catch_counts"] + for key: Variant in saved_catch_counts: + if typeof(key) not in [TYPE_STRING, TYPE_STRING_NAME]: + return null + var fish_id := StringName(str(key)) + var catch_count: int = _read_integer( + saved_catch_counts[key], + -1, + CollectionLogType.MAX_CATCH_COUNT, + ) + if ( + fish_id.is_empty() + or not seen_discoveries.has(fish_id) + or catch_count <= 0 + ): + return null + snapshot.catch_counts[fish_id] = catch_count var seen_ids: Dictionary[StringName, bool] = {} var seen_sequences: Dictionary[int, bool] = {} @@ -746,6 +1163,13 @@ func _build_load_snapshot(save_data: Dictionary) -> LoadSnapshot: fish_catch.catch_sequence ) snapshot.catches.append(fish_catch) + if ( + not has_saved_catch_counts + and seen_discoveries.has(fish_catch.fish_id) + ): + snapshot.catch_counts[fish_catch.fish_id] = ( + int(snapshot.catch_counts.get(fish_catch.fish_id, 0)) + 1 + ) snapshot.next_catch_sequence = maxi( requested_next_sequence, @@ -793,6 +1217,11 @@ func _build_load_snapshot(save_data: Dictionary) -> LoadSnapshot: var owned := OwnedItemType.new() owned.item_id = item_id owned.quantity = quantity + owned.storage_slot = _read_integer( + item_record.get("storage_slot", -1), + -1, + PlayerBagType.MAX_STORAGE_SLOT_INDEX, + ) seen_items[item_id] = true snapshot.bag_items.append(owned) @@ -823,6 +1252,16 @@ func _build_load_snapshot(save_data: Dictionary) -> LoadSnapshot: ): seen_unlocked_baits[owned.item_id] = true snapshot.unlocked_bait_ids.append(owned.item_id) + snapshot.active_bait_id = _validated_tackle_id( + StringName(str(tackle_data.get("active_bait_id", ""))), + true, + seen_items, + ) + snapshot.active_lure_id = _validated_tackle_id( + StringName(str(tackle_data.get("active_lure_id", ""))), + false, + seen_items, + ) var slot_values: Array = hotbar_data["slots"] snapshot.hotbar_slots.resize(PlayerHotbarType.SLOT_COUNT) @@ -917,6 +1356,14 @@ func _migrate_save( migrated = _migrate_version_5_to_6(migrated) 6: migrated = _migrate_version_6_to_7(migrated) + 7: + migrated = _migrate_version_7_to_8(migrated) + 8: + migrated = _migrate_version_8_to_9(migrated) + 9: + migrated = _migrate_version_9_to_10(migrated) + 10: + migrated = _migrate_version_10_to_11(migrated) _: return {} if migrated.is_empty(): @@ -1035,6 +1482,152 @@ func _migrate_version_6_to_7(data: Dictionary) -> Dictionary: return migrated +func _migrate_version_7_to_8(data: Dictionary) -> Dictionary: + var migrated: Dictionary = data.duplicate(true) + if ( + typeof(migrated.get("bag")) != TYPE_DICTIONARY + or typeof(migrated.get("inventory")) != TYPE_DICTIONARY + or typeof(migrated.get("hotbar")) != TYPE_DICTIONARY + ): + return {} + var bag_data: Dictionary = migrated["bag"] + var inventory_data: Dictionary = migrated["inventory"] + var hotbar_data: Dictionary = migrated["hotbar"] + if ( + typeof(bag_data.get("items")) != TYPE_ARRAY + or typeof(inventory_data.get("catches")) != TYPE_ARRAY + or typeof(hotbar_data.get("slots")) != TYPE_ARRAY + ): + return {} + + var placements: Array[Dictionary] = [] + var assigned: Dictionary[String, bool] = {} + var item_slots: Array = hotbar_data["slots"] + var fish_slots: Array = [] + if typeof(hotbar_data.get("fish_slots")) == TYPE_ARRAY: + fish_slots = hotbar_data["fish_slots"] + for slot: int in PlayerHotbarType.SLOT_COUNT: + var item_id := StringName( + str(item_slots[slot]) if slot < item_slots.size() else "" + ) + if not item_id.is_empty(): + var item = _item_catalog.get_item_by_id(item_id) + if item != null and not item.is_bait() and not item.is_lure(): + var key := PlayerInventoryLayoutType.item_key(item_id) + if not assigned.has(key): + placements.append({ + "kind": PlayerInventoryLayoutType.EntryKind.ITEM, + "identity": String(item_id), + "container": PlayerInventoryLayoutType.InventoryContainer.HOTBAR, + "slot": slot, + }) + assigned[key] = true + continue + var catch_id := StringName( + str(fish_slots[slot]) if slot < fish_slots.size() else "" + ) + if catch_id.is_empty(): + continue + var catch_key := PlayerInventoryLayoutType.catch_key(catch_id) + if assigned.has(catch_key): + continue + placements.append({ + "kind": PlayerInventoryLayoutType.EntryKind.CATCH, + "identity": String(catch_id), + "container": PlayerInventoryLayoutType.InventoryContainer.HOTBAR, + "slot": slot, + }) + assigned[catch_key] = true + + var next_inventory_slot: int = 0 + var next_storage_slot: int = 0 + for value: Variant in bag_data["items"] as Array: + if typeof(value) != TYPE_DICTIONARY: + continue + var item_id := StringName(str((value as Dictionary).get("item_id", ""))) + var item = _item_catalog.get_item_by_id(item_id) + if item == null or item.is_bait() or item.is_lure(): + continue + var key := PlayerInventoryLayoutType.item_key(item_id) + if assigned.has(key): + continue + var target := PlayerInventoryLayoutType.InventoryContainer.INVENTORY + var target_slot := next_inventory_slot + if next_inventory_slot < PlayerInventoryLayoutType.INVENTORY_CAPACITIES[0]: + next_inventory_slot += 1 + else: + target = PlayerInventoryLayoutType.InventoryContainer.STORAGE + target_slot = next_storage_slot + next_storage_slot += 1 + placements.append({ + "kind": PlayerInventoryLayoutType.EntryKind.ITEM, + "identity": String(item_id), + "container": target, + "slot": target_slot, + }) + assigned[key] = true + for value: Variant in inventory_data["catches"] as Array: + if typeof(value) != TYPE_DICTIONARY: + continue + var catch_id := StringName( + str((value as Dictionary).get("catch_id", "")) + ) + if catch_id.is_empty(): + continue + var key := PlayerInventoryLayoutType.catch_key(catch_id) + if assigned.has(key): + continue + var target := PlayerInventoryLayoutType.InventoryContainer.INVENTORY + var target_slot := next_inventory_slot + if next_inventory_slot < PlayerInventoryLayoutType.INVENTORY_CAPACITIES[0]: + next_inventory_slot += 1 + else: + target = PlayerInventoryLayoutType.InventoryContainer.STORAGE + target_slot = next_storage_slot + next_storage_slot += 1 + placements.append({ + "kind": PlayerInventoryLayoutType.EntryKind.CATCH, + "identity": String(catch_id), + "container": target, + "slot": target_slot, + }) + assigned[key] = true + migrated["inventory_layout"] = { + "backpack_level": 0, + "placements": placements, + } + migrated["save_version"] = 8 + return migrated + + +func _migrate_version_8_to_9(data: Dictionary) -> Dictionary: + var migrated: Dictionary = data.duplicate(true) + var world_data: Dictionary = {} + if typeof(migrated.get("world")) == TYPE_DICTIONARY: + world_data = (migrated["world"] as Dictionary).duplicate(true) + world_data["seed"] = DEFAULT_WORLD_SEED + migrated["world"] = world_data + migrated["save_version"] = 9 + return migrated + + +func _migrate_version_9_to_10(data: Dictionary) -> Dictionary: + var migrated: Dictionary = data.duplicate(true) + migrated["tackle"] = { + "active_bait_id": "", + "active_lure_id": "", + } + migrated["save_version"] = 10 + return migrated + + +func _migrate_version_10_to_11(data: Dictionary) -> Dictionary: + var migrated: Dictionary = data.duplicate(true) + migrated["home"] = PlayerHomeStateType.default_save_data() + migrated["save_version"] = 11 + return migrated + + func _mark_dirty() -> void: if ( _is_restoring @@ -1084,33 +1677,177 @@ func _on_experience_changed(_total_experience: int, _level: int) -> void: _mark_dirty() +func _on_active_tackle_changed(_item_id: StringName) -> void: + _mark_dirty() + + func _on_autosave_timeout() -> void: if _is_dirty: save_now() func _recover_interrupted_write() -> void: - if FileAccess.file_exists(_save_path): - _remove_if_present(_temp_path()) - _remove_if_present(_backup_path()) + _remove_if_present(_codec_scratch_path()) + _recover_path_write(_save_path) + _recover_path_write(_legacy_save_path()) + + +func _recover_path_write(path: String) -> void: + var temporary: String = path + ".tmp" + var backup: String = path + ".backup" + if FileAccess.file_exists(path): + _remove_if_present(temporary) + _remove_if_present(backup) return - if FileAccess.file_exists(_backup_path()): - _rename_file(_backup_path(), _save_path) - _remove_if_present(_temp_path()) + if FileAccess.file_exists(backup): + _rename_file(backup, path) + _remove_if_present(temporary) -func _handle_corrupt_save(message: String) -> void: +func _write_current_save_data( + save_data: Dictionary, + expected_hash: String, +) -> Dictionary: + return _write_save_data_at_path(save_data, _save_path, expected_hash) + + +func _write_save_data_at_path( + save_data: Dictionary, + destination_path: String, + expected_hash: String, +) -> Dictionary: + var bytes: PackedByteArray = ProgressionSaveCodec.encode_local_save( + save_data, + destination_path + ".codec.tmp", + ) + if bytes.is_empty(): + return {"ok": false} + return PortableFileGuard.write_guarded( + destination_path, + bytes, + expected_hash, + _data_root.conflict_directory(), + _data_root.device_id, + ) + + +func _prepare_external_save_data(value: Variant) -> Dictionary: + if typeof(value) != TYPE_DICTIONARY: + return {"ok": false, "message": "progression data is malformed."} + var save_data: Dictionary = (value as Dictionary).duplicate(true) + var version: int = _read_integer(save_data.get("save_version"), -1) + if version > SAVE_VERSION: + return { + "ok": false, + "message": "this progression belongs to a newer game version.", + } + if version < 1: + return {"ok": false, "message": "the progression version is unsupported."} + if version != SAVE_VERSION: + save_data = _migrate_save(save_data, version) + if save_data.is_empty(): + return { + "ok": false, + "message": "the progression version is unsupported.", + } + var snapshot: LoadSnapshot = _build_load_snapshot(save_data) + if snapshot == null: + return {"ok": false, "message": "the progression is structurally invalid."} + return { + "ok": true, + "data": save_data, + "catch_count": snapshot.catches.size(), + "wallet_balance": snapshot.wallet_balance, + "discovered_species_count": snapshot.discovered_ids.size(), + "world_layout": String(snapshot.world_layout), + "world_seed": snapshot.world_seed, + } + + +func _migrate_legacy_plaintext_save( + save_data: Dictionary, + legacy_path: String, +) -> void: + var result: Dictionary = _write_current_save_data(save_data, "") + if not bool(result.get("ok", false)): + push_warning("Legacy progression loaded but could not be encrypted yet.") + return + _expected_hash = str(result.get("hash", "")) + if not _archive_replaced_save(legacy_path, "plaintext-migration"): + push_warning( + "Legacy progression was encrypted, but its migration backup failed." + ) + return + _remove_legacy_save_files() + print("Upgraded legacy plaintext progression to the opaque save format.") + + +func _archive_replaced_save( + source_path: String, + reason: String = "before-import", +) -> bool: + if source_path.is_empty() or not FileAccess.file_exists(source_path): + return true + var timestamp: String = Time.get_datetime_string_from_system().replace( + ":", "-" + ) + var destination: String = _data_root.root_path.path_join( + "backups/saves/player-save-%s-%s%s" + % [reason, timestamp, ARCHIVE_EXTENSION] + ) + if FileAccess.file_exists(destination): + destination = destination.trim_suffix(ARCHIVE_EXTENSION) + ( + "-%s%s" % [Time.get_ticks_usec(), ARCHIVE_EXTENSION] + ) + var decoded: Dictionary = ProgressionSaveCodec.read_local_save( + source_path, + source_path == _legacy_save_path(), + ) + var bytes: PackedByteArray + if bool(decoded.get("ok", false)): + var prepared: Dictionary = _prepare_external_save_data(decoded["data"]) + if bool(prepared.get("ok", false)): + bytes = ProgressionSaveCodec.encode_archive( + prepared["data"], destination + ".codec.tmp" + ) + if bytes.is_empty(): + bytes = PortableFileGuard.read_bytes(source_path) + destination = ( + destination.trim_suffix(ARCHIVE_EXTENSION) + ".preserved" + ) + if bytes.is_empty(): + return false + var result: Dictionary = PortableFileGuard.write_guarded( + destination, + bytes, + "", + _data_root.conflict_directory(), + _data_root.device_id, + ) + return bool(result.get("ok", false)) + + +func _remove_legacy_save_files() -> void: + for path: String in [ + _legacy_save_path(), + _legacy_save_path() + ".tmp", + _legacy_save_path() + ".backup", + ]: + _remove_if_present(path) + + +func _handle_corrupt_save(message: String, source_path: String) -> void: push_warning(message) _restore_defaults() - if not FileAccess.file_exists(_save_path): + if not FileAccess.file_exists(source_path): return var timestamp: int = int(Time.get_unix_time_from_system()) var corrupt_path: String = ( - "%s.corrupt-%d" % [_save_path, timestamp] + "%s.corrupt-%d" % [source_path, timestamp] ) if FileAccess.file_exists(corrupt_path): corrupt_path += "-%d" % Time.get_ticks_usec() - if not _rename_file(_save_path, corrupt_path): + if not _rename_file(source_path, corrupt_path): _automatic_saving_blocked = true push_warning( "Corrupt player save was left in place; automatic saving is " @@ -1125,6 +1862,7 @@ func _restore_defaults() -> void: var empty_catches: Array[FishCatchType] = [] var empty_discoveries: Array[StringName] = [] var empty_quality_masks: Dictionary[StringName, int] = {} + var empty_catch_counts: Dictionary[StringName, int] = {} var default_items: Array[OwnedItemType] = [] var basic_rod := OwnedItemType.new() basic_rod.item_id = BASIC_ROD_ID @@ -1135,28 +1873,82 @@ func _restore_defaults() -> void: default_slots.fill(StringName()) default_slots[0] = BASIC_ROD_ID _inventory.replace_all_catches(empty_catches, 1) - _collection_log.replace_discovery_state( + _collection_log.replace_collection_state( empty_discoveries, empty_quality_masks, + empty_catch_counts, ) _wallet.restore_balance(0) _bag.replace_all_items(default_items) var default_unlocked_baits: Array[StringName] = [] _bag.replace_unlocked_bait_ids(default_unlocked_baits) - _hotbar.replace_state(default_slots, 0) + _player.unequip_bait() + _player.unequip_lure() _fishing_upgrades.reset_to_defaults() _cooler_capacity.reset_to_defaults() + _inventory_layout.reset_to_defaults() + _hotbar.replace_state(default_slots, 0) _art_unlocks.reset_to_defaults() _experience.reset_to_defaults() _world_time.restore_persistent_time_hours( WorldTimeServiceType.DEFAULT_START_HOUR ) _world_weather.reset_persistent_state() + _world_layout = WorldLayoutType.GENERATED + _world_seed = DEFAULT_WORLD_SEED _jobs.reset_to_defaults() + _home_state.reset_to_defaults() _is_restoring = false _is_dirty = false +func _valid_active_tackle(item_id: StringName, bait: bool) -> bool: + var item = _item_catalog.get_item_by_id(item_id) + return ( + item != null + and item.is_available() + and (item.is_bait() if bait else item.is_lure()) + and _bag.owns_item(item_id) + ) + + +func _validated_tackle_id( + item_id: StringName, + bait: bool, + seen_items: Dictionary[StringName, bool], +) -> StringName: + if item_id.is_empty(): + return StringName() + var item = _item_catalog.get_item_by_id(item_id) + if ( + item == null + or not item.is_available() + or not seen_items.has(item_id) + or not (item.is_bait() if bait else item.is_lure()) + ): + push_warning("Skipped invalid saved active tackle '%s'." % String(item_id)) + return StringName() + return item_id + + +func _restore_tackle_selection(snapshot: LoadSnapshot) -> bool: + _player.unequip_bait() + _player.unequip_lure() + var bait_restored: bool = ( + snapshot.active_bait_id.is_empty() + or _player.equip_bait( + _item_catalog.get_item_by_id(snapshot.active_bait_id) + ) + ) + var lure_restored: bool = ( + snapshot.active_lure_id.is_empty() + or _player.equip_lure( + _item_catalog.get_item_by_id(snapshot.active_lure_id) + ) + ) + return bait_restored and lure_restored + + func _read_integer( value: Variant, invalid_value: int, diff --git a/save/player_save_slot_catalog.gd b/save/player_save_slot_catalog.gd new file mode 100644 index 0000000..d3b9d23 --- /dev/null +++ b/save/player_save_slot_catalog.gd @@ -0,0 +1,591 @@ +class_name PlayerSaveSlotCatalog +extends RefCounted + +const FORMAT_VERSION: int = 1 +const MAX_SLOTS: int = 32 +const MAX_NAME_LENGTH: int = 32 +const LEGACY_SAVE_ID: StringName = &"player_save" + +signal slots_changed + +var _data_root: PlayerDataRoot +var _save_manager: PlayerSaveManager +var _manifest_path := "" +var _slots_directory := "" +var _slots: Array[Dictionary] = [] +var _active_slot_id := "" +var _expected_hash := "" +var _error_message := "" + + +func configure( + data_root: PlayerDataRoot, + save_manager: PlayerSaveManager, +) -> bool: + if data_root == null or save_manager == null or data_root.root_path.is_empty(): + return false + _data_root = data_root + _save_manager = save_manager + _manifest_path = data_root.path_for(&"save_slots") + _slots_directory = data_root.root_path.path_join("player/saves") + _slots.clear() + _active_slot_id = "" + _expected_hash = "" + _error_message = "" + if DirAccess.make_dir_recursive_absolute(_slots_directory) != OK: + _error_message = "the save-slot directory could not be created." + return false + _recover_interrupted_manifest_write() + var loaded: bool = _load_manifest() + if not loaded and FileAccess.file_exists(_manifest_path): + if not _preserve_invalid_manifest(): + _error_message = "the invalid save-slot catalog could not be preserved." + return false + var slot_count_before_discovery: int = _slots.size() + var active_before_discovery: String = _active_slot_id + _discover_untracked_saves() + if _active_slot_id.is_empty() and not _slots.is_empty(): + _active_slot_id = str(_slots.front().get("slot_id", "")) + if ( + not loaded + or _slots.size() != slot_count_before_discovery + or _active_slot_id != active_before_discovery + ): + if not _save_manifest(): + return false + return _select_configured_storage() + + +func get_error_message() -> String: + return _error_message + + +func list_slots() -> Array[Dictionary]: + var result: Array[Dictionary] = [] + for entry: Dictionary in _slots: + result.append(_build_slot_summary(entry)) + result.sort_custom( + func(a: Dictionary, b: Dictionary) -> bool: + var a_played: int = int(a.get("last_played_at_unix", 0)) + var b_played: int = int(b.get("last_played_at_unix", 0)) + if a_played == b_played: + return int(a.get("created_at_unix", 0)) > int( + b.get("created_at_unix", 0) + ) + return a_played > b_played + ) + return result + + +func get_slot(slot_id: String) -> Dictionary: + var entry: Dictionary = _find_slot(slot_id) + return _build_slot_summary(entry) if not entry.is_empty() else {} + + +func get_active_slot_id() -> String: + return _active_slot_id + + +func has_slots() -> bool: + return not _slots.is_empty() + + +func ensure_active_slot() -> Dictionary: + if not _active_slot_id.is_empty() and not _find_slot(_active_slot_id).is_empty(): + return {"ok": true, "slot_id": _active_slot_id} + var created: Dictionary = create_empty_slot(_next_default_name()) + if not bool(created.get("ok", false)): + return created + var slot_id: String = str(created.get("slot_id", "")) + if not activate_slot(slot_id): + return {"ok": false, "message": "the new save slot could not be selected."} + return {"ok": true, "slot_id": slot_id} + + +func create_empty_slot(display_name: String) -> Dictionary: + if _slots.size() >= MAX_SLOTS: + return {"ok": false, "message": "the maximum number of save slots has been reached."} + var clean_name: String = normalized_name(display_name) + if clean_name.is_empty(): + return {"ok": false, "message": "enter a name for this save slot."} + var slot_id: String = _generate_slot_id() + var now: int = int(Time.get_unix_time_from_system()) + _slots.append({ + "slot_id": slot_id, + "display_name": clean_name, + "created_at_unix": now, + "last_played_at_unix": 0, + "legacy": false, + }) + if not _save_manifest(): + _slots.pop_back() + return {"ok": false, "message": "the save-slot catalog could not be updated."} + slots_changed.emit() + return {"ok": true, "slot_id": slot_id} + + +func duplicate_slot( + source_slot_id: String, + display_name: String, + world_layout: StringName, + world_seed: int, +) -> Dictionary: + if _slots.size() >= MAX_SLOTS: + return {"ok": false, "message": "the maximum number of save slots has been reached."} + var source: Dictionary = _find_slot(source_slot_id) + var clean_name: String = normalized_name(display_name) + if source.is_empty() or clean_name.is_empty(): + return {"ok": false, "message": "the selected save slot cannot be duplicated."} + var source_path: String = _existing_slot_path(source) + if source_path.is_empty(): + return {"ok": false, "message": "the selected save slot has no progression to duplicate."} + var slot_id: String = _generate_slot_id() + var destination: String = _slots_directory.path_join(slot_id + ".nfsave") + var copied: Dictionary = _save_manager.copy_progression_to_path( + source_path, + destination, + source_path.ends_with(".json"), + world_layout, + world_seed, + ) + if not bool(copied.get("ok", false)): + return copied + var now: int = int(Time.get_unix_time_from_system()) + _slots.append({ + "slot_id": slot_id, + "display_name": clean_name, + "created_at_unix": now, + "last_played_at_unix": 0, + "legacy": false, + }) + if not _save_manifest(): + _slots.pop_back() + _remove_if_present(destination) + return {"ok": false, "message": "the duplicated slot could not be recorded."} + slots_changed.emit() + return {"ok": true, "slot_id": slot_id} + + +func import_slot(archive_path: String, display_name: String) -> Dictionary: + if _slots.size() >= MAX_SLOTS: + return {"ok": false, "message": "the maximum number of save slots has been reached."} + var clean_name: String = normalized_name(display_name) + if clean_name.is_empty(): + return {"ok": false, "message": "the imported save needs a slot name."} + var slot_id: String = _generate_slot_id() + var destination: String = _slots_directory.path_join(slot_id + ".nfsave") + var installed: Dictionary = _save_manager.install_progression_archive_at_path( + archive_path, + destination, + ) + if not bool(installed.get("ok", false)): + return installed + var now: int = int(Time.get_unix_time_from_system()) + _slots.append({ + "slot_id": slot_id, + "display_name": clean_name, + "created_at_unix": now, + "last_played_at_unix": 0, + "legacy": false, + }) + if not _save_manifest(): + _slots.pop_back() + _remove_if_present(destination) + return {"ok": false, "message": "the imported slot could not be recorded."} + slots_changed.emit() + installed["slot_id"] = slot_id + return installed + + +func export_slot(slot_id: String, destination_path: String) -> Dictionary: + var entry: Dictionary = _find_slot(slot_id) + var source_path: String = _existing_slot_path(entry) + if entry.is_empty() or source_path.is_empty(): + return {"ok": false, "message": "the selected save slot cannot be exported."} + return _save_manager.export_progression_archive_from_path( + source_path, + destination_path, + source_path.ends_with(".json"), + ) + + +func activate_slot(slot_id: String) -> bool: + var entry: Dictionary = _find_slot(slot_id) + if entry.is_empty(): + return false + var previous_id: String = _active_slot_id + var previous_path: String = _configured_storage_path(previous_id) + var next_path: String = _slot_primary_path(entry) + if not _save_manager.select_storage(next_path, _data_root): + return false + _active_slot_id = slot_id + if _save_manifest(): + slots_changed.emit() + return true + _active_slot_id = previous_id + _save_manager.select_storage(previous_path, _data_root) + return false + + +func mark_played(slot_id: String) -> bool: + var index: int = _find_slot_index(slot_id) + if index < 0: + return false + var previous_played_at: int = int( + _slots[index].get("last_played_at_unix", 0) + ) + var previous_active: String = _active_slot_id + _slots[index]["last_played_at_unix"] = int(Time.get_unix_time_from_system()) + _active_slot_id = slot_id + if not _save_manifest(): + _slots[index]["last_played_at_unix"] = previous_played_at + _active_slot_id = previous_active + return false + slots_changed.emit() + return true + + +func rename_slot(slot_id: String, display_name: String) -> bool: + var index: int = _find_slot_index(slot_id) + var clean_name: String = normalized_name(display_name) + if index < 0 or clean_name.is_empty(): + return false + var previous: String = str(_slots[index].get("display_name", "")) + _slots[index]["display_name"] = clean_name + if not _save_manifest(): + _slots[index]["display_name"] = previous + return false + slots_changed.emit() + return true + + +func delete_slot(slot_id: String) -> bool: + var index: int = _find_slot_index(slot_id) + if index < 0: + return false + var previous_slots: Array[Dictionary] = [] + for previous_entry: Dictionary in _slots: + previous_slots.append(previous_entry.duplicate(true)) + var previous_active: String = _active_slot_id + var entry: Dictionary = _slots[index] + var source_path: String = _existing_slot_path(entry) + var preserved_path := "" + if not source_path.is_empty(): + preserved_path = _deleted_backup_path(entry, source_path) + if not _rename_file(source_path, preserved_path): + return false + _slots.remove_at(index) + if _active_slot_id == slot_id: + _active_slot_id = ( + str(_slots.front().get("slot_id", "")) + if not _slots.is_empty() + else "" + ) + if not _select_configured_storage() or not _save_manifest(): + _slots = previous_slots + _active_slot_id = previous_active + _select_configured_storage() + if not preserved_path.is_empty(): + _rename_file(preserved_path, source_path) + return false + for auxiliary: String in _slot_auxiliary_paths(entry): + _remove_if_present(auxiliary) + slots_changed.emit() + return true + + +static func normalized_name(value: String) -> String: + var clean_name: String = value.strip_edges().left(MAX_NAME_LENGTH) + if clean_name.is_empty(): + return "" + for index: int in clean_name.length(): + var codepoint: int = clean_name.unicode_at(index) + if codepoint < 32 or codepoint == 127: + return "" + return clean_name + + +func _build_slot_summary(entry: Dictionary) -> Dictionary: + if entry.is_empty(): + return {} + var summary: Dictionary = entry.duplicate(true) + var path: String = _existing_slot_path(entry) + var inspection: PlayerSaveInspection = _save_manager.inspect_progression_at_path( + path, + path.ends_with(".json"), + ) + summary["active"] = str(entry.get("slot_id", "")) == _active_slot_id + summary["has_save"] = inspection.can_continue() + summary["save_status"] = inspection.status + summary["status_message"] = inspection.message + summary["catch_count"] = inspection.catch_count + summary["wallet_balance"] = inspection.wallet_balance + summary["discovered_species_count"] = inspection.discovered_species_count + summary["player_level"] = inspection.player_level + summary["world_layout"] = String(inspection.world_layout) + summary["world_seed"] = inspection.world_seed + return summary + + +func _load_manifest() -> bool: + if not FileAccess.file_exists(_manifest_path): + return false + var file := FileAccess.open(_manifest_path, FileAccess.READ) + if file == null: + return false + var parser := JSON.new() + var error: Error = parser.parse(file.get_as_text()) + file.close() + if error != OK or typeof(parser.data) != TYPE_DICTIONARY: + return false + var data: Dictionary = parser.data + if int(data.get("format_version", -1)) != FORMAT_VERSION: + return false + if typeof(data.get("slots")) != TYPE_ARRAY: + return false + var loaded_slots: Array[Dictionary] = [] + var seen_ids: Dictionary[String, bool] = {} + for value: Variant in data["slots"]: + if typeof(value) != TYPE_DICTIONARY: + return false + var entry: Dictionary = (value as Dictionary).duplicate(true) + if not _valid_slot_entry(entry): + return false + var slot_id: String = str(entry["slot_id"]) + if seen_ids.has(slot_id): + return false + seen_ids[slot_id] = true + loaded_slots.append(entry) + _slots = loaded_slots + _active_slot_id = str(data.get("active_slot_id", "")) + if not _active_slot_id.is_empty() and not seen_ids.has(_active_slot_id): + _active_slot_id = "" + _expected_hash = PortableFileGuard.hash_file(_manifest_path) + return true + + +func _save_manifest() -> bool: + var data: Dictionary = { + "format_version": FORMAT_VERSION, + "active_slot_id": _active_slot_id, + "slots": _slots, + } + var result: Dictionary = PortableFileGuard.write_guarded( + _manifest_path, + JSON.stringify(data, "\t").to_utf8_buffer(), + _expected_hash, + _data_root.conflict_directory(), + _data_root.device_id, + ) + if bool(result.get("conflict", false)): + _data_root.report_conflict( + str(result.get("message", "")), + str(result.get("conflict_path", "")), + ) + if bool(result.get("ok", false)): + _expected_hash = str(result.get("hash", "")) + return true + _error_message = "the save-slot catalog could not be written safely." + return false + + +func _discover_untracked_saves() -> void: + var known_ids: Dictionary[String, bool] = {} + var has_legacy: bool = false + for entry: Dictionary in _slots: + known_ids[str(entry.get("slot_id", ""))] = true + has_legacy = has_legacy or bool(entry.get("legacy", false)) + var legacy_primary: String = _data_root.path_for(LEGACY_SAVE_ID) + var legacy_plaintext: String = legacy_primary.get_base_dir().path_join( + PlayerSaveManager.LEGACY_SAVE_FILENAME + ) + if ( + not has_legacy + and ( + FileAccess.file_exists(legacy_primary) + or FileAccess.file_exists(legacy_plaintext) + ) + ): + var legacy_id: String = _generate_slot_id() + _slots.append({ + "slot_id": legacy_id, + "display_name": _next_default_name(), + "created_at_unix": int(Time.get_unix_time_from_system()), + "last_played_at_unix": 0, + "legacy": true, + }) + known_ids[legacy_id] = true + var directory := DirAccess.open(_slots_directory) + if directory == null: + return + directory.list_dir_begin() + var filename: String = directory.get_next() + while not filename.is_empty(): + if not directory.current_is_dir() and filename.ends_with(".nfsave"): + var slot_id: String = filename.trim_suffix(".nfsave") + if _valid_slot_id(slot_id) and not known_ids.has(slot_id): + _slots.append({ + "slot_id": slot_id, + "display_name": _next_default_name(), + "created_at_unix": int(Time.get_unix_time_from_system()), + "last_played_at_unix": 0, + "legacy": false, + }) + known_ids[slot_id] = true + filename = directory.get_next() + directory.list_dir_end() + + +func _select_configured_storage() -> bool: + return _save_manager.select_storage( + _configured_storage_path(_active_slot_id), + _data_root, + ) + + +func _configured_storage_path(slot_id: String) -> String: + var entry: Dictionary = _find_slot(slot_id) + if not entry.is_empty(): + return _slot_primary_path(entry) + return _data_root.path_for(LEGACY_SAVE_ID) + + +func _slot_primary_path(entry: Dictionary) -> String: + if bool(entry.get("legacy", false)): + return _data_root.path_for(LEGACY_SAVE_ID) + return _slots_directory.path_join(str(entry.get("slot_id", "")) + ".nfsave") + + +func _existing_slot_path(entry: Dictionary) -> String: + if entry.is_empty(): + return "" + var primary: String = _slot_primary_path(entry) + if FileAccess.file_exists(primary): + return primary + if bool(entry.get("legacy", false)): + var plaintext: String = primary.get_base_dir().path_join( + PlayerSaveManager.LEGACY_SAVE_FILENAME + ) + if FileAccess.file_exists(plaintext): + return plaintext + return "" + + +func _slot_auxiliary_paths(entry: Dictionary) -> Array[String]: + var primary: String = _slot_primary_path(entry) + var paths: Array[String] = [ + primary + ".tmp", + primary + ".backup", + primary + ".codec.tmp", + ] + if bool(entry.get("legacy", false)): + var plaintext: String = primary.get_base_dir().path_join( + PlayerSaveManager.LEGACY_SAVE_FILENAME + ) + paths.append_array([ + plaintext + ".tmp", + plaintext + ".backup", + ]) + return paths + + +func _deleted_backup_path(entry: Dictionary, source_path: String) -> String: + var timestamp: String = Time.get_datetime_string_from_system().replace(":", "-") + var extension: String = ".json" if source_path.ends_with(".json") else ".nfsave" + var destination: String = _data_root.root_path.path_join( + "backups/saves/deleted-slot-%s-%s%s" + % [str(entry.get("slot_id", "")).left(8), timestamp, extension] + ) + if FileAccess.file_exists(destination): + destination = destination.trim_suffix(extension) + ( + "-%d%s" % [Time.get_ticks_usec(), extension] + ) + return destination + + +func _find_slot(slot_id: String) -> Dictionary: + var index: int = _find_slot_index(slot_id) + return _slots[index] if index >= 0 else {} + + +func _find_slot_index(slot_id: String) -> int: + for index: int in _slots.size(): + if str(_slots[index].get("slot_id", "")) == slot_id: + return index + return -1 + + +func _next_default_name() -> String: + var used: Dictionary[String, bool] = {} + for entry: Dictionary in _slots: + used[str(entry.get("display_name", "")).to_lower()] = true + var number: int = 1 + while used.has("save %d" % number): + number += 1 + return "save %d" % number + + +func _generate_slot_id() -> String: + var slot_id: String = Crypto.new().generate_random_bytes(16).hex_encode() + while _find_slot_index(slot_id) >= 0: + slot_id = Crypto.new().generate_random_bytes(16).hex_encode() + return slot_id + + +func _valid_slot_entry(entry: Dictionary) -> bool: + var display_name: String = str(entry.get("display_name", "")) + return ( + _valid_slot_id(str(entry.get("slot_id", ""))) + and display_name.length() <= MAX_NAME_LENGTH + and not normalized_name(display_name).is_empty() + and typeof(entry.get("created_at_unix")) in [TYPE_INT, TYPE_FLOAT] + and typeof(entry.get("last_played_at_unix")) in [TYPE_INT, TYPE_FLOAT] + and typeof(entry.get("legacy")) == TYPE_BOOL + ) + + +func _valid_slot_id(slot_id: String) -> bool: + if slot_id.length() != 32: + return false + for index: int in slot_id.length(): + var character: String = slot_id.substr(index, 1).to_lower() + if character not in "0123456789abcdef": + return false + return true + + +func _recover_interrupted_manifest_write() -> void: + var temporary: String = _manifest_path + ".tmp" + var backup: String = _manifest_path + ".backup" + if FileAccess.file_exists(_manifest_path): + _remove_if_present(temporary) + _remove_if_present(backup) + return + if FileAccess.file_exists(backup): + _rename_file(backup, _manifest_path) + _remove_if_present(temporary) + + +func _preserve_invalid_manifest() -> bool: + var destination: String = _data_root.migration_backup_directory().path_join( + "invalid-save-slots-%s.json" + % Time.get_datetime_string_from_system().replace(":", "-") + ) + if not _rename_file(_manifest_path, destination): + return false + _expected_hash = "" + _slots.clear() + _active_slot_id = "" + return true + + +func _rename_file(source: String, destination: String) -> bool: + if source.is_empty() or destination.is_empty(): + return false + if DirAccess.make_dir_recursive_absolute(destination.get_base_dir()) != OK: + return false + return DirAccess.rename_absolute(source, destination) == OK + + +func _remove_if_present(path: String) -> bool: + return not FileAccess.file_exists(path) or DirAccess.remove_absolute(path) == OK diff --git a/save/player_save_slot_catalog.gd.uid b/save/player_save_slot_catalog.gd.uid new file mode 100644 index 0000000..8906f5a --- /dev/null +++ b/save/player_save_slot_catalog.gd.uid @@ -0,0 +1 @@ +uid://djfeifv7xrqdt diff --git a/save/progression_save_codec.gd b/save/progression_save_codec.gd new file mode 100644 index 0000000..4d0ba33 --- /dev/null +++ b/save/progression_save_codec.gd @@ -0,0 +1,191 @@ +class_name ProgressionSaveCodec +extends RefCounted + +const MAGIC := "straywild_PROGRESSION_CONTAINER" +const LEGACY_MAGIC := "NETFISHING_PROGRESSION_CONTAINER" +const FORMAT_VERSION := 1 +const LOCAL_KIND := "local_save" +const ARCHIVE_KIND := "portable_archive" +const MAX_CONTAINER_BYTES := 16 * 1024 * 1024 + +# This key keeps routine progression files opaque to casual editing. Since the +# client is open source, it is intentionally not treated as a security secret. +# Its original value is a stable file-format detail so released saves remain +# readable after the Straywild rebrand. +const CONTAINER_PASSPHRASE := ( + "NETfishing progression container v1 / not an identity credential" +) + + +static func encode_local_save( + save_data: Dictionary, + scratch_path: String, +) -> PackedByteArray: + return _encode_container(LOCAL_KIND, save_data, scratch_path) + + +static func encode_archive( + save_data: Dictionary, + scratch_path: String, +) -> PackedByteArray: + return _encode_container(ARCHIVE_KIND, save_data, scratch_path) + + +static func read_local_save( + path: String, + allow_legacy_plaintext: bool = false, +) -> Dictionary: + if allow_legacy_plaintext and not _looks_encrypted(path): + var legacy: Dictionary = _read_plaintext_dictionary(path) + if bool(legacy.get("ok", false)): + legacy["legacy_plaintext"] = true + return legacy + return _read_container(path, LOCAL_KIND) + + +static func read_archive(path: String) -> Dictionary: + if not _looks_encrypted(path): + return {"ok": false, "message": "progression archive is not recognized."} + return _read_container(path, ARCHIVE_KIND) + + +static func _encode_container( + kind: String, + save_data: Dictionary, + scratch_path: String, +) -> PackedByteArray: + if save_data.is_empty() or scratch_path.is_empty(): + return PackedByteArray() + var payload_json: String = JSON.stringify(save_data) + if payload_json.is_empty(): + return PackedByteArray() + var payload_bytes: PackedByteArray = payload_json.to_utf8_buffer() + var envelope: Dictionary = { + "magic": MAGIC, + "format_version": FORMAT_VERSION, + "kind": kind, + "game_version": str( + ProjectSettings.get_setting("application/config/version", "") + ), + "created_at_unix": int(Time.get_unix_time_from_system()), + "payload_sha256": PortableFileGuard.hash_bytes(payload_bytes), + "payload_json": payload_json, + } + if DirAccess.make_dir_recursive_absolute( + scratch_path.get_base_dir() + ) != OK: + return PackedByteArray() + _remove_if_present(scratch_path) + var file: FileAccess = FileAccess.open_encrypted_with_pass( + scratch_path, + FileAccess.WRITE, + CONTAINER_PASSPHRASE, + ) + if file == null: + return PackedByteArray() + file.store_string(JSON.stringify(envelope)) + file.flush() + var write_ok: bool = file.get_error() == OK + file.close() + if not write_ok: + _remove_if_present(scratch_path) + return PackedByteArray() + var encoded: PackedByteArray = PortableFileGuard.read_bytes( + scratch_path, + MAX_CONTAINER_BYTES, + ) + _remove_if_present(scratch_path) + return encoded + + +static func _read_container(path: String, expected_kind: String) -> Dictionary: + if ( + path.is_empty() + or not FileAccess.file_exists(path) + or FileAccess.get_size(path) > MAX_CONTAINER_BYTES + ): + return {"ok": false, "message": "progression file is unavailable."} + var envelope_text: String = _read_encrypted_text(path) + if envelope_text.is_empty(): + return {"ok": false, "message": "progression file could not be opened."} + var envelope_json := JSON.new() + if ( + envelope_json.parse(envelope_text) != OK + or typeof(envelope_json.data) != TYPE_DICTIONARY + ): + return {"ok": false, "message": "progression container is malformed."} + var envelope: Dictionary = envelope_json.data + var legacy_container: bool = envelope.get("magic") == LEGACY_MAGIC + if ( + envelope.get("magic") not in [MAGIC, LEGACY_MAGIC] + or int(envelope.get("format_version", -1)) != FORMAT_VERSION + or str(envelope.get("kind", "")) != expected_kind + ): + return {"ok": false, "message": "progression container is unsupported."} + var payload_json: String = str(envelope.get("payload_json", "")) + var payload_bytes: PackedByteArray = payload_json.to_utf8_buffer() + if ( + payload_json.is_empty() + or str(envelope.get("payload_sha256", "")) + != PortableFileGuard.hash_bytes(payload_bytes) + ): + return {"ok": false, "message": "progression container failed validation."} + var payload_parser := JSON.new() + if ( + payload_parser.parse(payload_json) != OK + or typeof(payload_parser.data) != TYPE_DICTIONARY + ): + return {"ok": false, "message": "progression payload is malformed."} + return { + "ok": true, + "data": payload_parser.data, + "game_version": str(envelope.get("game_version", "")), + "created_at_unix": int(envelope.get("created_at_unix", 0)), + "legacy_plaintext": false, + "legacy_container": legacy_container, + } + + +static func _read_encrypted_text(path: String) -> String: + var file: FileAccess = FileAccess.open_encrypted_with_pass( + path, + FileAccess.READ, + CONTAINER_PASSPHRASE, + ) + if file == null: + return "" + var text: String = file.get_as_text() + file.close() + return text + + +static func _read_plaintext_dictionary(path: String) -> Dictionary: + var bytes: PackedByteArray = PortableFileGuard.read_bytes( + path, + MAX_CONTAINER_BYTES, + ) + if bytes.is_empty(): + return {"ok": false} + var text: String = bytes.get_string_from_utf8() + if not text.strip_edges().begins_with("{"): + return {"ok": false} + var parser := JSON.new() + if parser.parse(text) != OK or typeof(parser.data) != TYPE_DICTIONARY: + return {"ok": false} + return {"ok": true, "data": parser.data} + + +static func _looks_encrypted(path: String) -> bool: + if not FileAccess.file_exists(path) or FileAccess.get_size(path) < 4: + return false + var file := FileAccess.open(path, FileAccess.READ) + if file == null: + return false + var header: PackedByteArray = file.get_buffer(4) + file.close() + return header == PackedByteArray([0x47, 0x44, 0x45, 0x43]) + + +static func _remove_if_present(path: String) -> void: + if FileAccess.file_exists(path): + DirAccess.remove_absolute(path) diff --git a/save/progression_save_codec.gd.uid b/save/progression_save_codec.gd.uid new file mode 100644 index 0000000..6db5823 --- /dev/null +++ b/save/progression_save_codec.gd.uid @@ -0,0 +1 @@ +uid://lad8mvedktww diff --git a/scripts/build_android_debug.sh b/scripts/build_android_debug.sh index 8f856f8..f68eb32 100755 --- a/scripts/build_android_debug.sh +++ b/scripts/build_android_debug.sh @@ -4,7 +4,7 @@ set -euo pipefail readonly SCRIPT_DIR="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd)" readonly PROJECT_ROOT="$(cd -- "${SCRIPT_DIR}/.." && pwd)" -readonly OUTPUT_PATH="${PROJECT_ROOT}/builds/android/NETfishing-debug.apk" +readonly OUTPUT_PATH="${PROJECT_ROOT}/builds/android/straywild-debug.apk" readonly GODOT_BIN="${GODOT_BIN:-godot}" mkdir -p -- "$(dirname -- "${OUTPUT_PATH}")" diff --git a/scripts/build_playtest.sh b/scripts/build_playtest.sh index fe588aa..d54ba70 100755 --- a/scripts/build_playtest.sh +++ b/scripts/build_playtest.sh @@ -4,14 +4,14 @@ set -euo pipefail readonly SCRIPT_DIR="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd)" readonly PROJECT_ROOT="$(cd -- "${SCRIPT_DIR}/.." && pwd)" -readonly BUILD_ROOT="${PROJECT_ROOT}/builds/v0.10.0-alpha" +readonly BUILD_ROOT="${PROJECT_ROOT}/builds/v0.20.2-alpha" readonly WINDOWS_DIR="${BUILD_ROOT}/windows-x86_64" readonly LINUX_DIR="${BUILD_ROOT}/linux-x86_64" readonly README_SOURCE="${PROJECT_ROOT}/docs/README-PLAYTEST.txt" readonly SOURCE_COMMIT="$(git -C "${PROJECT_ROOT}" rev-parse HEAD)" -readonly SOURCE_URL="https://forge.makearmy.io/woofmeow/netfishing" -readonly WINDOWS_ZIP="${BUILD_ROOT}/NETfishing-v0.10.0-alpha-windows-x86_64.zip" -readonly LINUX_ZIP="${BUILD_ROOT}/NETfishing-v0.10.0-alpha-linux-x86_64.zip" +readonly SOURCE_URL="https://forge.makearmy.io/woofmeow/straywild" +readonly WINDOWS_ZIP="${BUILD_ROOT}/straywild-v0.20.2-alpha-windows-x86_64.zip" +readonly LINUX_ZIP="${BUILD_ROOT}/straywild-v0.20.2-alpha-linux-x86_64.zip" readonly GODOT_BIN="${GODOT_BIN:-godot}" if [[ ! -f "${PROJECT_ROOT}/project.godot" ]]; then @@ -31,26 +31,26 @@ mkdir -p -- "${WINDOWS_DIR}" "${LINUX_DIR}" --headless \ --path "${PROJECT_ROOT}" \ --export-release "Windows Desktop" \ - "${WINDOWS_DIR}/NETfishing.exe" + "${WINDOWS_DIR}/straywild.exe" "${GODOT_BIN}" \ --headless \ --path "${PROJECT_ROOT}" \ --export-release "Linux Desktop" \ - "${LINUX_DIR}/NETfishing.x86_64" + "${LINUX_DIR}/straywild.x86_64" for required_file in \ - "${WINDOWS_DIR}/NETfishing.exe" \ - "${WINDOWS_DIR}/NETfishing.pck" \ - "${LINUX_DIR}/NETfishing.x86_64" \ - "${LINUX_DIR}/NETfishing.pck"; do + "${WINDOWS_DIR}/straywild.exe" \ + "${WINDOWS_DIR}/straywild.pck" \ + "${LINUX_DIR}/straywild.x86_64" \ + "${LINUX_DIR}/straywild.pck"; do if [[ ! -s "${required_file}" ]]; then echo "error: expected export output is missing: ${required_file}" >&2 exit 1 fi done -chmod +x -- "${LINUX_DIR}/NETfishing.x86_64" +chmod +x -- "${LINUX_DIR}/straywild.x86_64" cp -- "${README_SOURCE}" "${WINDOWS_DIR}/README-PLAYTEST.txt" cp -- "${README_SOURCE}" "${LINUX_DIR}/README-PLAYTEST.txt" @@ -60,7 +60,7 @@ stage_licenses() { install -m 0644 "${PROJECT_ROOT}/LICENSE" \ "${destination}/GPL-3.0-or-later.txt" install -m 0644 "${PROJECT_ROOT}/ASSET-LICENSE.md" \ - "${destination}/NETFISHING-ASSET-LICENSE.md" + "${destination}/straywild-ASSET-LICENSE.md" install -m 0644 "${PROJECT_ROOT}/docs/ATTRIBUTION.md" \ "${destination}/ATTRIBUTION.md" install -m 0644 "${PROJECT_ROOT}/TRADEMARKS.md" \ @@ -72,11 +72,14 @@ stage_licenses() { cat >"${destination}/SOURCE-CODE.md" <&2 + exit 2 + ;; + esac shift -fi -if [[ $# -ne 0 ]]; then - echo "Usage: $0 [--package-only]" >&2 +done +if [[ ${HOTFIX} -eq 1 && ${PACKAGE_ONLY} -ne 1 ]]; then + echo "PortMaster hotfixes must use an existing pinned ARM64 export." >&2 + echo "Run this script with both --package-only and --hotfix." >&2 exit 2 fi @@ -28,20 +42,39 @@ fi readonly RELEASE_TAG="v${PROJECT_VERSION}" readonly RELEASE_ROOT="${PROJECT_ROOT}/builds/${RELEASE_TAG}" readonly ARM64_ROOT="${RELEASE_ROOT}/linux-arm64" -readonly ARM64_EXECUTABLE="${ARM64_ROOT}/NETfishing.arm64" -readonly ARM64_PCK="${ARM64_ROOT}/NETfishing.pck" +readonly ARM64_EXECUTABLE="${ARM64_ROOT}/straywild.arm64" +readonly ARM64_PCK="${ARM64_ROOT}/straywild.pck" readonly STAGE_ROOT="${RELEASE_ROOT}/portmaster-stage" -readonly GAME_ROOT="${STAGE_ROOT}/netfishing" -readonly ARCHIVE="${RELEASE_ROOT}/netfishing.zip" -readonly LEGACY_ARCHIVE="${RELEASE_ROOT}/netfishing-${RELEASE_TAG}-portmaster-arm64.zip" +readonly GAME_ROOT="${STAGE_ROOT}/straywild" +readonly ARCHIVE="${RELEASE_ROOT}/straywild.zip" +readonly OBSOLETE_VERSIONED_ARCHIVE="${RELEASE_ROOT}/straywild-${RELEASE_TAG}-portmaster-arm64.zip" +readonly OBSOLETE_LOWERCASE_ARCHIVE="${RELEASE_ROOT}/straywild-${RELEASE_TAG}-portmaster-arm64.zip" readonly HEAD_COMMIT="$(git -C "${PROJECT_ROOT}" rev-parse HEAD)" readonly TAG_COMMIT="$(git -C "${PROJECT_ROOT}" rev-parse "${RELEASE_TAG}^{commit}")" -if [[ "${HEAD_COMMIT}" != "${TAG_COMMIT}" ]]; then +if [[ ${HOTFIX} -eq 1 ]]; then + if ! git -C "${PROJECT_ROOT}" merge-base --is-ancestor \ + "${TAG_COMMIT}" "${HEAD_COMMIT}"; then + echo "${RELEASE_TAG} is not an ancestor of HEAD. Refusing hotfix package." >&2 + exit 1 + fi + + while IFS= read -r changed_path; do + case "${changed_path}" in + docs/PORTMASTER.md|scripts/build_portmaster.sh|scripts/portmaster/*) + ;; + *) + echo "Hotfix contains a non-PortMaster change: ${changed_path}" >&2 + exit 1 + ;; + esac + done < <(git -C "${PROJECT_ROOT}" diff --name-only \ + "${TAG_COMMIT}..${HEAD_COMMIT}") +elif [[ "${HEAD_COMMIT}" != "${TAG_COMMIT}" ]]; then echo "HEAD does not match ${RELEASE_TAG}. Refusing to package mutable source." >&2 exit 1 fi -if [[ "${NETFISHING_ALLOW_DIRTY_RELEASE:-0}" != "1" ]]; then +if [[ "${straywild_ALLOW_DIRTY_RELEASE:-0}" != "1" ]]; then dirty_tree=0 git -C "${PROJECT_ROOT}" diff --quiet || dirty_tree=1 git -C "${PROJECT_ROOT}" diff --cached --quiet || dirty_tree=1 @@ -54,7 +87,7 @@ if [[ "${NETFISHING_ALLOW_DIRTY_RELEASE:-0}" != "1" ]]; then fi fi -for command_name in git file zip unzip sha256sum; do +for command_name in git file zip unzip sha256sum rsync; do command -v "${command_name}" >/dev/null 2>&1 || { echo "Required command not found: ${command_name}" >&2 exit 1 @@ -63,11 +96,38 @@ done mkdir -p -- "${ARM64_ROOT}" "${RELEASE_ROOT}" if [[ ${PACKAGE_ONLY} -eq 0 ]]; then + readonly EXPORT_PROJECT_ROOT="$( + mktemp -d -t straywild-portmaster-export.XXXXXX + )" + cleanup_export_project() { + rm -rf -- "${EXPORT_PROJECT_ROOT}" + } + trap cleanup_export_project EXIT INT TERM rm -f -- "${ARM64_EXECUTABLE}" "${ARM64_PCK}" + rsync -a \ + --exclude '/.git/' \ + --exclude '/.godot/' \ + --exclude '/art/source/' \ + --exclude '/art/exported/system_icons/straywild.ico' \ + --exclude '/art/exported/system_icons/straywild_1024.png' \ + --exclude '/art/exported/system_icons/straywild_1024.png.import' \ + --exclude '/audio/ambience/' \ + --exclude '/builds/' \ + --exclude '/docs/design/' \ + --exclude '/tests/' \ + "${PROJECT_ROOT}/" "${EXPORT_PROJECT_ROOT}/" + "${ASSET_PROFILE_SCRIPT}" "${EXPORT_PROJECT_ROOT}" "${GODOT_BIN}" \ --headless \ - --path "${PROJECT_ROOT}" \ - --export-release "Linux ARM64" + --path "${EXPORT_PROJECT_ROOT}" \ + --import + "${GODOT_BIN}" \ + --headless \ + --path "${EXPORT_PROJECT_ROOT}" \ + --export-release "Linux ARM64" \ + "${ARM64_EXECUTABLE}" + cleanup_export_project + trap - EXIT INT TERM fi test -s "${ARM64_EXECUTABLE}" @@ -75,13 +135,20 @@ test -s "${ARM64_PCK}" file "${ARM64_EXECUTABLE}" | grep -q "ARM aarch64" rm -rf -- "${STAGE_ROOT}" -rm -f -- "${ARCHIVE}" "${LEGACY_ARCHIVE}" +rm -f -- \ + "${ARCHIVE}" \ + "${OBSOLETE_VERSIONED_ARCHIVE}" \ + "${OBSOLETE_LOWERCASE_ARCHIVE}" mkdir -p -- "${GAME_ROOT}/licenses" -install -m 0755 "${TEMPLATE_ROOT}/NETfishing.sh" "${STAGE_ROOT}/NETfishing.sh" -install -m 0644 "${TEMPLATE_ROOT}/port.json" "${STAGE_ROOT}/port.json" -install -m 0755 "${ARM64_EXECUTABLE}" "${GAME_ROOT}/NETfishing.aarch64" -install -m 0644 "${ARM64_PCK}" "${GAME_ROOT}/NETfishing.pck" +install -m 0755 "${TEMPLATE_ROOT}/straywild.sh" "${STAGE_ROOT}/straywild.sh" +install -m 0644 "${TEMPLATE_ROOT}/port.json" "${GAME_ROOT}/port.json" +install -m 0644 "${TEMPLATE_ROOT}/straywild.gptk" \ + "${GAME_ROOT}/straywild.gptk" +install -m 0755 "${TEMPLATE_ROOT}/launch-straywild.sh" \ + "${GAME_ROOT}/launch-straywild.sh" +install -m 0755 "${ARM64_EXECUTABLE}" "${GAME_ROOT}/straywild.aarch64" +install -m 0644 "${ARM64_PCK}" "${GAME_ROOT}/straywild.pck" install -m 0644 "${TEMPLATE_ROOT}/gameinfo.xml" "${GAME_ROOT}/gameinfo.xml" install -m 0644 "${TEMPLATE_ROOT}/screenshot.png" "${GAME_ROOT}/screenshot.png" install -m 0644 \ @@ -92,7 +159,7 @@ install -m 0644 \ "${GAME_ROOT}/licenses/GPL-3.0-or-later.txt" install -m 0644 \ "${PROJECT_ROOT}/ASSET-LICENSE.md" \ - "${GAME_ROOT}/licenses/NETFISHING-ASSET-LICENSE.md" + "${GAME_ROOT}/licenses/straywild-ASSET-LICENSE.md" install -m 0644 \ "${PROJECT_ROOT}/TRADEMARKS.md" \ "${GAME_ROOT}/licenses/TRADEMARKS.md" @@ -104,14 +171,18 @@ install -m 0644 \ "${GAME_ROOT}/licenses/Seattle-Avenue-LICENSE.txt" cat >"${GAME_ROOT}/BUILD-INFO.txt" <"${GAME_ROOT}/licenses/SOURCE-CODE.md" <"${GAME_ROOT}/README.md" </dev/null readonly TOP_LEVELS="$( unzip -Z1 "${ARCHIVE}" | cut -d/ -f1 | sort -u )" -readonly EXPECTED_TOP_LEVELS="$(printf '%s\n' NETfishing.sh netfishing port.json)" +readonly EXPECTED_TOP_LEVELS="$(printf '%s\n' straywild straywild.sh)" if [[ "${TOP_LEVELS}" != "${EXPECTED_TOP_LEVELS}" ]]; then echo "Unexpected PortMaster archive roots:" >&2 printf '%s\n' "${TOP_LEVELS}" >&2 exit 1 fi -grep -q '"version": 4' "${STAGE_ROOT}/port.json" -grep -q '"name": "netfishing.zip"' "${STAGE_ROOT}/port.json" -grep -q '"rtr": true' "${STAGE_ROOT}/port.json" -grep -q '^# PORTMASTER: netfishing.zip, NETfishing.sh$' \ - "${STAGE_ROOT}/NETfishing.sh" -grep -Fq 'PROFILE_PATH="$CONFDIR/performance_profile"' \ - "${STAGE_ROOT}/NETfishing.sh" -grep -Fq 'NETFISHING_PERFORMANCE_PROFILE=light' \ - "${STAGE_ROOT}/NETfishing.sh" -grep -Fq '$GPTOKEYB "NETfishing.aarch64" &' \ - "${STAGE_ROOT}/NETfishing.sh" -grep -Fq 'pm_platform_helper "$GAME_EXECUTABLE"' \ - "${STAGE_ROOT}/NETfishing.sh" -grep -Fq 'pm_finish' "${STAGE_ROOT}/NETfishing.sh" -if [[ "$(grep -Ec '^[[:space:]]*\$GPTOKEYB[[:space:]]' \ - "${STAGE_ROOT}/NETfishing.sh")" -ne 1 ]]; then - echo "NETfishing must start exactly one GPTOKEYB exit handler." >&2 +grep -q '"version": 4' "${GAME_ROOT}/port.json" +grep -q '"name": "straywild.zip"' "${GAME_ROOT}/port.json" +grep -q '"rtr": true' "${GAME_ROOT}/port.json" +if unzip -Z1 "${ARCHIVE}" | grep -qx 'port.json'; then + echo "port.json must be inside straywild/, not at the archive root." >&2 exit 1 fi -if grep -Eq '\$GPTOKEYB.*[[:space:]]-c([[:space:]]|$)' \ - "${STAGE_ROOT}/NETfishing.sh"; then - echo "GPTOKEYB controller mappings must not be enabled for NETfishing." >&2 +if grep -Eq '^[[:space:]]*#[[:space:]]*PORTMASTER:' \ + "${STAGE_ROOT}/straywild.sh"; then + echo "The distributable launcher contains an installed PortMaster signature." >&2 + exit 1 +fi +grep -Fq 'PROFILE_PATH="$CONFDIR/performance_profile"' \ + "${STAGE_ROOT}/straywild.sh" +grep -Fq 'straywild_PERFORMANCE_PROFILE=light' \ + "${STAGE_ROOT}/straywild.sh" +grep -Fq 'CONTROLLER_MAPPING_FILE="$CONFDIR/cache/controller_mapping.txt"' \ + "${STAGE_ROOT}/straywild.sh" +grep -Fq 'SAVEDIR="$PORTS_ROOT/saves/straywild"' \ + "${STAGE_ROOT}/straywild.sh" +grep -Fq 'LEGACY_SAVEDIR="$PORTS_ROOT/saves/netfishing"' \ + "${STAGE_ROOT}/straywild.sh" +grep -Fq 'cp -a "$LEGACY_CONFDIR/." "$CONFDIR/"' \ + "${STAGE_ROOT}/straywild.sh" +grep -Fq '"straywild_DATA_DIR=$SAVEDIR"' \ + "${STAGE_ROOT}/straywild.sh" +grep -Fq '"straywild_CREATE_DATA_DIR=1"' \ + "${STAGE_ROOT}/straywild.sh" +grep -Fq 'printf '\''%s\n'\'' "$straywild_controllerconfig" > "$CONTROLLER_MAPPING_FILE"' \ + "${STAGE_ROOT}/straywild.sh" +grep -Fq '"$GAME_LAUNCHER"' "${STAGE_ROOT}/straywild.sh" +grep -Fq '"$CONTROLLER_MAPPING_FILE"' "${STAGE_ROOT}/straywild.sh" +if grep -Fq 'SDL_GAMECONTROLLERCONFIG="$straywild_controllerconfig"' \ + "${STAGE_ROOT}/straywild.sh"; then + echo "Raw controller mappings must not be passed through westonwrap.sh." >&2 + exit 1 +fi +grep -Fq 'SDL_GAMECONTROLLERCONFIG="$(<"$CONTROLLER_MAPPING_FILE")"' \ + "${GAME_ROOT}/launch-straywild.sh" +grep -Fq 'export SDL_GAMECONTROLLERCONFIG' \ + "${GAME_ROOT}/launch-straywild.sh" +grep -Fq 'exec "$@"' "${GAME_ROOT}/launch-straywild.sh" +grep -Fq 'GPTOKEYB_CONFIG="$GAMEDIR/straywild.gptk"' \ + "${STAGE_ROOT}/straywild.sh" +grep -Fq '$GPTOKEYB "straywild.aarch64" -c "$GPTOKEYB_CONFIG" &' \ + "${STAGE_ROOT}/straywild.sh" +grep -Fq 'pm_platform_helper "$GAME_EXECUTABLE"' \ + "${STAGE_ROOT}/straywild.sh" +grep -Fq 'pm_finish' "${STAGE_ROOT}/straywild.sh" +if [[ "$(grep -Ec '^[[:space:]]*\$GPTOKEYB[[:space:]]' \ + "${STAGE_ROOT}/straywild.sh")" -ne 1 ]]; then + echo "straywild must start exactly one GPTOKEYB exit handler." >&2 + exit 1 +fi +readonly GPTOKEYB_NOOP_KEYS=( + back guide start + a a_hk b b_hk x x_hk y y_hk + l1 l1_hk l2 l2_hk l3 r1 r1_hk r2 r2_hk r3 + up down left right + left_analog_up left_analog_down left_analog_left left_analog_right + right_analog_up right_analog_down right_analog_left right_analog_right +) +for noop_key in "${GPTOKEYB_NOOP_KEYS[@]}"; do + if ! grep -Eq \ + "^[[:space:]]*${noop_key}[[:space:]]*=[[:space:]]*\\\\\"[[:space:]]*$" \ + "${GAME_ROOT}/straywild.gptk"; then + echo "GPTOKEYB no-op mapping is missing: ${noop_key}" >&2 + exit 1 + fi +done +if [[ "$(grep -Ec '^[[:space:]]*[a-z0-9_]+[[:space:]]*=' \ + "${GAME_ROOT}/straywild.gptk")" -ne "${#GPTOKEYB_NOOP_KEYS[@]}" ]]; then + echo "GPTOKEYB no-op mapping contains an unexpected assignment." >&2 exit 1 fi if unzip -Z1 "${ARCHIVE}" | grep -E \ diff --git a/scripts/generate_placeholder_animalese.gd b/scripts/generate_placeholder_animalese.gd deleted file mode 100644 index 8119fd3..0000000 --- a/scripts/generate_placeholder_animalese.gd +++ /dev/null @@ -1,71 +0,0 @@ -extends SceneTree - -const OUTPUT_DIRECTORY := "res://sound/dialogue/animalese/placeholder" -const SAMPLE_RATE: int = 22050 -const SAMPLE_SECONDS: float = 0.055 -const CHARACTERS := "abcdefghijklmnopqrstuvwxyz" -const VOWELS := "aeiou" - - -func _initialize() -> void: - var absolute_directory := ProjectSettings.globalize_path(OUTPUT_DIRECTORY) - var directory_error: Error = DirAccess.make_dir_recursive_absolute( - absolute_directory - ) - if directory_error != OK: - push_error("Could not create animalese sample directory.") - quit(1) - return - for character_index: int in range(CHARACTERS.length()): - var character := CHARACTERS.substr(character_index, 1) - _save_sample(character, character_index) - _save_sample("fallback", CHARACTERS.length()) - quit() - - -func _save_sample(sample_name: String, sample_index: int) -> void: - var stream := _build_sample(sample_name, sample_index) - var output_path := "%s/%s" % [OUTPUT_DIRECTORY, sample_name] - var save_error: Error = stream.save_to_wav(output_path) - if save_error != OK: - push_error("Could not save animalese sample: %s" % sample_name) - - -func _build_sample(sample_name: String, sample_index: int) -> AudioStreamWAV: - var frame_count := roundi(SAMPLE_RATE * SAMPLE_SECONDS) - var pcm := PackedByteArray() - pcm.resize(frame_count * 2) - var base_frequency := 245.0 + float(sample_index % 7) * 18.0 - var formant_one := 620.0 + float(sample_index % 5) * 85.0 - var formant_two := 1320.0 + float(sample_index % 6) * 115.0 - var is_vowel := VOWELS.contains(sample_name) - var noise_seed := sample_index * 7919 + 104729 - for frame_index: int in range(frame_count): - var time := float(frame_index) / SAMPLE_RATE - var attack := minf(time / 0.004, 1.0) - var release := minf((SAMPLE_SECONDS - time) / 0.014, 1.0) - var envelope := maxf(minf(attack, release), 0.0) - noise_seed = int( - (noise_seed * 1103515245 + 12345) & 0x7fffffff - ) - var noise := float(noise_seed % 65536) / 32767.5 - 1.0 - var voiced := ( - sin(TAU * base_frequency * time) * 0.42 - + sin(TAU * base_frequency * 2.0 * time) * 0.16 - ) - var formants := ( - sin(TAU * formant_one * time) * 0.18 - + sin(TAU * formant_two * time) * 0.10 - ) - var consonant_noise := noise * (0.08 if is_vowel else 0.24) - var value := envelope * (voiced + formants + consonant_noise) * 0.72 - var signed_sample := clampi(roundi(value * 32767.0), -32768, 32767) - var encoded_sample := signed_sample if signed_sample >= 0 else signed_sample + 65536 - pcm[frame_index * 2] = encoded_sample & 0xff - pcm[frame_index * 2 + 1] = (encoded_sample >> 8) & 0xff - var stream := AudioStreamWAV.new() - stream.set("format", AudioStreamWAV.FORMAT_16_BITS) - stream.mix_rate = SAMPLE_RATE - stream.stereo = false - stream.data = pcm - return stream diff --git a/scripts/import_animalese_voice.sh b/scripts/import_animalese_voice.sh new file mode 100755 index 0000000..b9076ca --- /dev/null +++ b/scripts/import_animalese_voice.sh @@ -0,0 +1,112 @@ +#!/usr/bin/env bash +set -euo pipefail + +readonly TARGET_RMS_DBFS="-18.0" +readonly PEAK_CEILING_DBFS="-3.0" +readonly OUTPUT_SAMPLE_RATE="48000" + +usage() { + printf 'usage: %s SOURCE_DIRECTORY SAMPLE_SET_DIRECTORY\n' "$0" >&2 + printf 'example: %s /path/to/voice_kim kim\n' "$0" >&2 +} + +if (( $# != 2 )); then + usage + exit 2 +fi + +if ! command -v sox >/dev/null 2>&1; then + printf 'error: sox is required to import animalese samples\n' >&2 + exit 1 +fi + +readonly SCRIPT_DIRECTORY="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd)" +readonly PROJECT_ROOT="$(cd -- "$SCRIPT_DIRECTORY/.." && pwd)" +readonly SOURCE_DIRECTORY="$(realpath -e -- "$1")" +readonly SAMPLE_SET_DIRECTORY="$2" + +if [[ ! -d "$SOURCE_DIRECTORY" ]]; then + printf 'error: source is not a directory: %s\n' "$SOURCE_DIRECTORY" >&2 + exit 1 +fi +if [[ ! "$SAMPLE_SET_DIRECTORY" =~ ^[a-z0-9_-]+$ ]]; then + printf 'error: sample-set directory must use lowercase letters, numbers, underscores, or hyphens\n' >&2 + exit 1 +fi + +readonly DESTINATION_DIRECTORY="$PROJECT_ROOT/sound/dialogue/animalese/$SAMPLE_SET_DIRECTORY" +readonly WORK_DIRECTORY="$(mktemp -d -t straywild-animalese-import.XXXXXX)" + +cleanup() { + if [[ "$WORK_DIRECTORY" == /tmp/straywild-animalese-import.* ]]; then + find "$WORK_DIRECTORY" -depth -delete + fi +} +trap cleanup EXIT + +mkdir -p -- "$WORK_DIRECTORY/converted" "$WORK_DIRECTORY/normalized" +mapfile -d '' SOURCE_FILES < <( + find "$SOURCE_DIRECTORY" -maxdepth 1 -type f -name '*.wav' -print0 \ + | sort -z +) +if (( ${#SOURCE_FILES[@]} == 0 )); then + printf 'error: no .wav samples found in %s\n' "$SOURCE_DIRECTORY" >&2 + exit 1 +fi + +for source_file in "${SOURCE_FILES[@]}"; do + filename="$(basename -- "$source_file")" + if [[ ! "$filename" =~ ^[a-z0-9_]+\.wav$ ]]; then + printf 'error: unsupported sample filename: %s\n' "$filename" >&2 + exit 1 + fi + converted_file="$WORK_DIRECTORY/converted/$filename" + normalized_file="$WORK_DIRECTORY/normalized/$filename" + + # Measure the exact channel/rate conversion that will be shipped, then use + # the smaller of the RMS correction and peak-safe gain. Very short voice + # clips are not reliable inputs for program-loudness algorithms such as + # EBU R128, so this deterministic RMS/peak policy is intentional. + # Reserve headroom before high-quality resampling. Several supplied 8-bit + # clips sit near full scale and their interpolated waveform can otherwise + # clip before the normalization gain is calculated. + sox -D "$source_file" \ + -r "$OUTPUT_SAMPLE_RATE" -c 1 -b 32 -e floating-point \ + "$converted_file" gain -6 rate -v "$OUTPUT_SAMPLE_RATE" + statistics="$(sox "$converted_file" -n stat 2>&1)" + peak_amplitude="$(awk '/Maximum amplitude/ {print $3}' <<< "$statistics")" + rms_amplitude="$(awk '/RMS.*amplitude/ {print $3; exit}' <<< "$statistics")" + if ! awk -v peak="$peak_amplitude" -v rms="$rms_amplitude" \ + 'BEGIN {exit !(peak > 0.0 && rms > 0.0)}'; then + printf 'error: sample is silent or unreadable: %s\n' "$source_file" >&2 + exit 1 + fi + + gain_db="$( + awk \ + -v peak="$peak_amplitude" \ + -v rms="$rms_amplitude" \ + -v target_rms="$TARGET_RMS_DBFS" \ + -v peak_ceiling="$PEAK_CEILING_DBFS" \ + 'BEGIN { + peak_db = 20.0 * log(peak) / log(10.0) + rms_db = 20.0 * log(rms) / log(10.0) + rms_gain = target_rms - rms_db + peak_gain = peak_ceiling - peak_db + gain = rms_gain < peak_gain ? rms_gain : peak_gain + printf "%.6f", gain + }' + )" + sox -D "$converted_file" \ + -r "$OUTPUT_SAMPLE_RATE" -c 1 -b 16 -e signed-integer \ + "$normalized_file" gain "$gain_db" + printf '%-16s %8s dB\n' "$filename" "$gain_db" +done + +mkdir -p -- "$DESTINATION_DIRECTORY" +for normalized_file in "$WORK_DIRECTORY"/normalized/*.wav; do + cp -- "$normalized_file" "$DESTINATION_DIRECTORY/$(basename -- "$normalized_file")" +done + +printf 'imported %d normalized samples to %s\n' \ + "${#SOURCE_FILES[@]}" "$DESTINATION_DIRECTORY" diff --git a/scripts/normalize_texture_imports.gd b/scripts/normalize_texture_imports.gd index 5b78ec1..e7b2406 100644 --- a/scripts/normalize_texture_imports.gd +++ b/scripts/normalize_texture_imports.gd @@ -31,6 +31,11 @@ const FACIAL_FEATURE_IMPORT_PATH: String = ( "art/exported/characters/faces/" ) const FACIAL_FEATURE_SIZE_LIMIT: int = 512 +const PROJECTED_TERRAIN_TEXTURE_IMPORTS: Array[String] = [ + "res://world/generation/chunks/assets/chunk_0000_grass_lite.png.import", + "res://world/generation/chunks/assets/chunk_0001_sand.png.import", + "res://world/generation/chunks/assets/chunk_0031_dirt.png.import", +] var apply_changes: bool = false var verbose: bool = false @@ -153,6 +158,8 @@ func _handle_import_file(import_path: String) -> void: var desired: Variant = section_data[section_key] if section_key == "process/size_limit": desired = _size_limit_for(import_path) + elif section_key == "mipmaps/generate": + desired = _generates_mipmaps(import_path) var existing: Variant = null if cfg.has_section(section_name) and cfg.has_section_key(section_name, section_key): existing = cfg.get_value(section_name, section_key) @@ -187,6 +194,11 @@ func _size_limit_for(import_path: String) -> int: return int(DEFAULT_PROFILE["params"]["process/size_limit"]) +func _generates_mipmaps(import_path: String) -> bool: + var normalized_path := import_path.replace("\\", "/") + return normalized_path in PROJECTED_TERRAIN_TEXTURE_IMPORTS + + func print_summary() -> void: if apply_changes: _print( diff --git a/scripts/normalize_texture_profiles.sh b/scripts/normalize_texture_profiles.sh index 1483a61..0551efd 100755 --- a/scripts/normalize_texture_profiles.sh +++ b/scripts/normalize_texture_profiles.sh @@ -13,7 +13,7 @@ fi readonly ROOT_PATH="$1" -readonly WORK_ROOT="$(mktemp -d -t netfishing-godot-data.XXXXXX)" +readonly WORK_ROOT="$(mktemp -d -t straywild-godot-data.XXXXXX)" trap 'rm -rf -- "${WORK_ROOT}"' EXIT cd "${PROJECT_ROOT}" diff --git a/scripts/portmaster/gameinfo.xml b/scripts/portmaster/gameinfo.xml index ef608bd..1b0a1c7 100755 --- a/scripts/portmaster/gameinfo.xml +++ b/scripts/portmaster/gameinfo.xml @@ -1,13 +1,13 @@ - ./NETfishing.sh - NETfishing + ./straywild.sh + straywild A relaxed multiplayer fishing game about exploring a small island, catching and collecting fish, customizing your character, and spending time by the water. 20260804T000000 - NETfishing project + straywild project Independent adventure, simulation - ./netfishing/screenshot.png + ./straywild/screenshot.png diff --git a/scripts/portmaster/launch-straywild.sh b/scripts/portmaster/launch-straywild.sh new file mode 100755 index 0000000..50f2ec9 --- /dev/null +++ b/scripts/portmaster/launch-straywild.sh @@ -0,0 +1,23 @@ +#!/bin/bash + +if [[ $# -lt 2 ]]; then + echo "Usage: $0 [arguments...]" >&2 + exit 2 +fi + +CONTROLLER_MAPPING_FILE="$1" +shift + +if [[ ! -r "$CONTROLLER_MAPPING_FILE" ]]; then + echo "Controller mapping file is not readable: $CONTROLLER_MAPPING_FILE" >&2 + exit 1 +fi + +SDL_GAMECONTROLLERCONFIG="$(<"$CONTROLLER_MAPPING_FILE")" +if [[ "$SDL_GAMECONTROLLERCONFIG" != *,*,* ]]; then + echo "Controller mapping file is malformed: $CONTROLLER_MAPPING_FILE" >&2 + exit 1 +fi + +export SDL_GAMECONTROLLERCONFIG +exec "$@" diff --git a/scripts/portmaster/port.json b/scripts/portmaster/port.json index affc601..4c36648 100644 --- a/scripts/portmaster/port.json +++ b/scripts/portmaster/port.json @@ -1,13 +1,13 @@ { "version": 4, - "name": "netfishing.zip", + "name": "straywild.zip", "items": [ - "NETfishing.sh", - "netfishing/" + "straywild.sh", + "straywild/" ], "items_opt": null, "attr": { - "title": "NETfishing", + "title": "straywild", "porter": [ "Voyager" ], diff --git a/scripts/portmaster/straywild.gptk b/scripts/portmaster/straywild.gptk new file mode 100644 index 0000000..2e8602e --- /dev/null +++ b/scripts/portmaster/straywild.gptk @@ -0,0 +1,41 @@ +# straywild reads the controller directly. GPTOKEYB is retained only for its +# device-specific force-quit chord, so every keyboard and mouse binding is +# disabled to prevent duplicate input. + +back = \" +guide = \" +start = \" + +a = \" +a_hk = \" +b = \" +b_hk = \" +x = \" +x_hk = \" +y = \" +y_hk = \" + +l1 = \" +l1_hk = \" +l2 = \" +l2_hk = \" +l3 = \" +r1 = \" +r1_hk = \" +r2 = \" +r2_hk = \" +r3 = \" + +up = \" +down = \" +left = \" +right = \" + +left_analog_up = \" +left_analog_down = \" +left_analog_left = \" +left_analog_right = \" +right_analog_up = \" +right_analog_down = \" +right_analog_left = \" +right_analog_right = \" diff --git a/scripts/portmaster/NETfishing.sh b/scripts/portmaster/straywild.sh similarity index 51% rename from scripts/portmaster/NETfishing.sh rename to scripts/portmaster/straywild.sh index 527f15f..d4e56a7 100755 --- a/scripts/portmaster/NETfishing.sh +++ b/scripts/portmaster/straywild.sh @@ -1,5 +1,4 @@ #!/bin/bash -# PORTMASTER: netfishing.zip, NETfishing.sh XDG_DATA_HOME=${XDG_DATA_HOME:-$HOME/.local/share} @@ -13,37 +12,68 @@ else controlfolder="/roms/ports/PortMaster" fi -if [ ! -f "$controlfolder/control.txt" ]; then - echo "PortMaster control.txt was not found at $controlfolder" >&2 - exit 1 -fi - source "$controlfolder/control.txt" [ -f "${controlfolder}/mod_${CFW_NAME}.txt" ] && source "${controlfolder}/mod_${CFW_NAME}.txt" get_controls -GAMEDIR="/${directory}/ports/netfishing" -if [ ! -d "$GAMEDIR" ] && [ -d "/mnt/mmc/ports/netfishing" ]; then - GAMEDIR="/mnt/mmc/ports/netfishing" -fi +GAMEDIR="/${directory}/ports/straywild" CONFDIR="$GAMEDIR/conf" -GAME_EXECUTABLE="$GAMEDIR/NETfishing.aarch64" -WESTON_DIR="/tmp/netfishing-weston" +PORTS_ROOT="${GAMEDIR%/straywild}" +SAVEDIR="$PORTS_ROOT/saves/straywild" +LEGACY_GAMEDIR="$PORTS_ROOT/netfishing" +LEGACY_CONFDIR="$LEGACY_GAMEDIR/conf" +LEGACY_SAVEDIR="$PORTS_ROOT/saves/netfishing" +DATA_BOOTSTRAP_DIR="$CONFDIR/data/godot/app_userdata/straywild" +LEGACY_DATA_BOOTSTRAP_DIR="$CONFDIR/data/godot/app_userdata/NETFISHING" +GAME_EXECUTABLE="$GAMEDIR/straywild.aarch64" +GAME_LAUNCHER="$GAMEDIR/launch-straywild.sh" +GPTOKEYB_CONFIG="$GAMEDIR/straywild.gptk" +CONTROLLER_MAPPING_FILE="$CONFDIR/cache/controller_mapping.txt" +WESTON_DIR="/tmp/straywild-weston" WESTON_RUNTIME="weston_pkg_0.2" HARBOURMASTER="$controlfolder/harbourmaster" -if [ ! -x "$HARBOURMASTER" ] && [ -x "/mnt/mmc/MUOS/PortMaster/harbourmaster" ]; then - HARBOURMASTER="/mnt/mmc/MUOS/PortMaster/harbourmaster" -fi mkdir -p "$CONFDIR/data" "$CONFDIR/config" "$CONFDIR/cache" "$WESTON_DIR" chmod +x "$GAME_EXECUTABLE" +# A renamed PortMaster entry installs beside the former NETfishing port. Copy +# its device-local configuration once and continue using its established save +# root when present. New installations use straywild paths exclusively. +if [ -d "$LEGACY_CONFDIR" ] && [ ! -f "$CONFDIR/.netfishing-imported" ]; then + cp -a "$LEGACY_CONFDIR/." "$CONFDIR/" + touch "$CONFDIR/.netfishing-imported" +fi +if [ ! -f "$SAVEDIR/straywild_data.json" ] \ + && [ ! -f "$SAVEDIR/netfishing_data.json" ] \ + && { [ -f "$LEGACY_SAVEDIR/straywild_data.json" ] \ + || [ -f "$LEGACY_SAVEDIR/netfishing_data.json" ]; }; then + SAVEDIR="$LEGACY_SAVEDIR" +fi + +# straywild uses a predictable save directory beside the port instead of +# presenting a folder picker on a small screen. Preserve an established +# data-root choice when upgrading an existing installation. +straywild_DATA_ENVIRONMENT=() +if [ -f "$SAVEDIR/straywild_data.json" ] \ + || [ -f "$SAVEDIR/netfishing_data.json" ] || { + [ ! -f "$DATA_BOOTSTRAP_DIR/data_root_bootstrap.json" ] && + [ ! -f "$DATA_BOOTSTRAP_DIR/data_root_bootstrap.json.backup" ] && + [ ! -f "$LEGACY_DATA_BOOTSTRAP_DIR/data_root_bootstrap.json" ] && + [ ! -f "$LEGACY_DATA_BOOTSTRAP_DIR/data_root_bootstrap.json.backup" ] +}; then + mkdir -p "$SAVEDIR" + straywild_DATA_ENVIRONMENT+=( + "straywild_DATA_DIR=$SAVEDIR" + "straywild_CREATE_DATA_DIR=1" + ) +fi + > "$GAMEDIR/log.txt" && exec > >(tee "$GAMEDIR/log.txt") 2>&1 if [ ! -f "$controlfolder/libs/${WESTON_RUNTIME}.squashfs" ]; then if [ ! -x "$HARBOURMASTER" ]; then - pm_message "NETfishing requires the latest PortMaster and WestonPack runtime." + pm_message "straywild requires the latest PortMaster and WestonPack runtime." sleep 5 exit 1 fi @@ -69,16 +99,17 @@ cd "$GAMEDIR" || exit 1 GODOT_MUOS_MAPPING="19004ca6010000000100000000010000,muOS-Keys,a:b0,b:b1,x:b3,y:b2,leftshoulder:b4,rightshoulder:b5,lefttrigger:b10,righttrigger:b11,guide:b8,start:b7,back:b6,dpup:h0.1,dpleft:h0.8,dpright:h0.2,dpdown:h0.4,leftx:a0,lefty:a1,leftstick:b9,rightx:a2,righty:a3,rightstick:b12,platform:Linux," MUOS_SDL2_GUID="19000000010000000100000000010000" if [[ "$sdl_controllerconfig" == "${MUOS_SDL2_GUID},"* ]]; then - netfishing_controllerconfig="$GODOT_MUOS_MAPPING" + straywild_controllerconfig="$GODOT_MUOS_MAPPING" elif [ -n "$sdl_controllerconfig" ]; then - netfishing_controllerconfig="$sdl_controllerconfig" + straywild_controllerconfig="$sdl_controllerconfig" else - netfishing_controllerconfig="$GODOT_MUOS_MAPPING" + straywild_controllerconfig="$GODOT_MUOS_MAPPING" fi +printf '%s\n' "$straywild_controllerconfig" > "$CONTROLLER_MAPPING_FILE" -NETFISHING_GODOT_OPTIONS=() -NETFISHING_GAME_ENVIRONMENT=() -PERFORMANCE_PROFILE="${NETFISHING_PERFORMANCE_PROFILE:-}" +straywild_GODOT_OPTIONS=() +straywild_GAME_ENVIRONMENT=() +PERFORMANCE_PROFILE="${straywild_PERFORMANCE_PROFILE:-}" PROFILE_PATH="$CONFDIR/performance_profile" if [[ -z "$PERFORMANCE_PROFILE" && -r "$PROFILE_PATH" ]]; then IFS= read -r PERFORMANCE_PROFILE < "$PROFILE_PATH" || true @@ -86,16 +117,16 @@ if [[ -z "$PERFORMANCE_PROFILE" && -r "$PROFILE_PATH" ]]; then fi case "$PERFORMANCE_PROFILE" in normal) - NETFISHING_GAME_ENVIRONMENT+=( - "NETFISHING_PERFORMANCE_PROFILE=normal" + straywild_GAME_ENVIRONMENT+=( + "straywild_PERFORMANCE_PROFILE=normal" ) ;; light|"") - NETFISHING_GAME_ENVIRONMENT+=( - "NETFISHING_PERFORMANCE_PROFILE=light" - "NETFISHING_LOW_END=1" + straywild_GAME_ENVIRONMENT+=( + "straywild_PERFORMANCE_PROFILE=light" + "straywild_LOW_END=1" ) - NETFISHING_GODOT_OPTIONS+=( + straywild_GODOT_OPTIONS+=( --single-window --disable-vsync --max-fps 30 @@ -104,11 +135,11 @@ case "$PERFORMANCE_PROFILE" in ;; *) echo "Unknown performance profile '$PERFORMANCE_PROFILE'; using light." >&2 - NETFISHING_GAME_ENVIRONMENT+=( - "NETFISHING_PERFORMANCE_PROFILE=light" - "NETFISHING_LOW_END=1" + straywild_GAME_ENVIRONMENT+=( + "straywild_PERFORMANCE_PROFILE=light" + "straywild_LOW_END=1" ) - NETFISHING_GODOT_OPTIONS+=( + straywild_GODOT_OPTIONS+=( --single-window --disable-vsync --max-fps 30 @@ -117,10 +148,10 @@ case "$PERFORMANCE_PROFILE" in ;; esac -# Keep NETfishing's native controller input separate from PortMaster's exit -# handling. Without a -c mapping file, GPTOKEYB only watches for the -# device-specific force-quit chord and does not inject gameplay inputs. -$GPTOKEYB "NETfishing.aarch64" & +# straywild reads gameplay input natively. The explicit no-op map prevents +# GPTOKEYB from injecting duplicate keyboard or mouse input while retaining +# its device-specific force-quit chord, including on ROCKNIX. +$GPTOKEYB "straywild.aarch64" -c "$GPTOKEYB_CONFIG" & pm_platform_helper "$GAME_EXECUTABLE" $ESUDO env CRUSTY_RESOLUTION="${DISPLAY_WIDTH}x${DISPLAY_HEIGHT}" \ @@ -128,11 +159,13 @@ $ESUDO env CRUSTY_RESOLUTION="${DISPLAY_WIDTH}x${DISPLAY_HEIGHT}" \ XDG_DATA_HOME="$CONFDIR/data" \ XDG_CONFIG_HOME="$CONFDIR/config" \ XDG_CACHE_HOME="$CONFDIR/cache" \ - SDL_GAMECONTROLLERCONFIG="$netfishing_controllerconfig" \ GODOT_SILENCE_ROOT_WARNING=1 \ - "${NETFISHING_GAME_ENVIRONMENT[@]}" \ + "${straywild_DATA_ENVIRONMENT[@]}" \ + "${straywild_GAME_ENVIRONMENT[@]}" \ + "$GAME_LAUNCHER" \ + "$CONTROLLER_MAPPING_FILE" \ "$GAME_EXECUTABLE" \ - "${NETFISHING_GODOT_OPTIONS[@]}" \ + "${straywild_GODOT_OPTIONS[@]}" \ --resolution "${DISPLAY_WIDTH}x${DISPLAY_HEIGHT}" \ --fullscreen \ --rendering-driver opengl3_es \ diff --git a/scripts/prepare_portmaster_assets.sh b/scripts/prepare_portmaster_assets.sh new file mode 100755 index 0000000..0429f69 --- /dev/null +++ b/scripts/prepare_portmaster_assets.sh @@ -0,0 +1,96 @@ +#!/usr/bin/env bash + +set -euo pipefail + +if [[ $# -ne 1 ]]; then + echo "usage: scripts/prepare_portmaster_assets.sh " >&2 + exit 2 +fi + +readonly PROJECT_ROOT="$1" +readonly GENERAL_TEXTURE_LIMIT=128 +readonly GAMEPLAY_TEXTURE_LIMIT=64 +readonly AUDIO_SAMPLE_RATE=22050 + +if [[ ! -f "${PROJECT_ROOT}/project.godot" ]]; then + echo "PortMaster asset project is missing project.godot: ${PROJECT_ROOT}" >&2 + exit 1 +fi + +limit_texture_imports() { + local asset_root="$1" + local size_limit="$2" + local import_file + local updated=0 + + if [[ ! -d "${asset_root}" ]]; then + return + fi + while IFS= read -r -d '' import_file; do + if ! grep -q '^importer="texture"$' "${import_file}"; then + continue + fi + if ! grep -q '^process/size_limit=' "${import_file}"; then + continue + fi + sed -i \ + -e 's|^compress/mode=.*$|compress/mode=2|' \ + -e "s|^process/size_limit=.*$|process/size_limit=${size_limit}|" \ + "${import_file}" + updated=$((updated + 1)) + done < <(find "${asset_root}" -type f -name '*.import' -print0) + printf 'PortMaster texture limit %d px: %d imports under %s\n' \ + "${size_limit}" "${updated}" "${asset_root#${PROJECT_ROOT}/}" +} + + +configure_audio_imports() { + local asset_root="$1" + local import_file + local updated=0 + + if [[ ! -d "${asset_root}" ]]; then + return + fi + while IFS= read -r -d '' import_file; do + if ! grep -q '^importer="wav"$' "${import_file}"; then + continue + fi + sed -i \ + -e 's|^force/mono=.*$|force/mono=true|' \ + -e 's|^force/max_rate=.*$|force/max_rate=true|' \ + -e "s|^force/max_rate_hz=.*$|force/max_rate_hz=${AUDIO_SAMPLE_RATE}|" \ + -e 's|^compress/mode=.*$|compress/mode=2|' \ + "${import_file}" + updated=$((updated + 1)) + done < <(find "${asset_root}" -type f -name '*.wav.import' -print0) + printf 'PortMaster audio profile %d Hz mono: %d imports under %s\n' \ + "${AUDIO_SAMPLE_RATE}" "${updated}" \ + "${asset_root#${PROJECT_ROOT}/}" +} + +# The entire PortMaster project uses a deliberately small, VRAM-compressed +# texture ceiling. Fonts are unaffected, preserving readable interface text +# while raster artwork is reduced for one-gigabyte shared-memory devices. +limit_texture_imports "${PROJECT_ROOT}" "${GENERAL_TEXTURE_LIMIT}" + +# These catalogs contain most of the authored high-resolution textures and +# account for the largest runtime residency. At a 640x480 output, 64 pixels +# remains sufficient for the deliberately low-fidelity light profile. +for gameplay_root in \ + "art/exported/characters" \ + "art/exported/environment" \ + "art/exported/items" \ + "fish/species" \ + "gathering" \ + "items/icons" \ + "world"; do + limit_texture_imports \ + "${PROJECT_ROOT}/${gameplay_root}" \ + "${GAMEPLAY_TEXTURE_LIMIT}" +done + +# Short speech, call, and gameplay effects remain available, but use a small +# mono QOA representation to reduce both package and resident sample memory. +configure_audio_imports "${PROJECT_ROOT}/audio/sfx" +configure_audio_imports "${PROJECT_ROOT}/sound/dialogue" diff --git a/scripts/run_validations.sh b/scripts/run_validations.sh index 722c97b..ff108a8 100755 --- a/scripts/run_validations.sh +++ b/scripts/run_validations.sh @@ -6,33 +6,55 @@ readonly SCRIPT_DIR="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd)" readonly PROJECT_ROOT="$(cd -- "${SCRIPT_DIR}/.." && pwd)" readonly GODOT_BIN="${GODOT_BIN:-godot}" readonly TEST_TIMEOUT_SECONDS="${TEST_TIMEOUT_SECONDS:-120}" -readonly RUN_ROOT="$(mktemp -d -t netfishing-validations.XXXXXX)" +readonly RUN_ROOT="$(mktemp -d -t straywild-validations.XXXXXX)" + +export straywild_ISOLATED_VALIDATION_STORAGE=1 readonly -a QUICK_TESTS=( + "scripts/validate_animalese_samples.gd" "tests/android_readiness_validation.gd" + "tests/camera_drag_validation.gd" + "tests/character_rig_validation.gd" + "tests/network_chat_protocol_validation.gd" "tests/controller_focus_presentation_validation.gd" - "tests/controller_focus_recovery_validation.gd" "tests/controller_menu_accessibility_validation.gd" "tests/controller_mapping_validation.gd" + "tests/controller_world_interaction_validation.gd" "tests/controller_ui_navigation_validation.gd" "tests/dedicated_server_config_validation.gd" + "tests/digging_prototype_validation.gd" + "tests/equipment_catalog_validation.gd" "tests/exported_decal_hotfix_validation.gd" "tests/file_dialog_controller_navigation_validation.gd" "tests/fish_catalog_content_validation.gd" "tests/fish_quality_validation.gd" + "tests/fishing_shop_controller_validation.gd" "tests/fishing_audio_validation.gd" "tests/fishing_surface_validation.gd" + "tests/friend_relationship_validation.gd" "tests/fur_pattern_validation.gd" + "tests/generated_world_runtime_validation.gd" + "tests/gathering_marker_surface_validation.gd" + "tests/inventory_storage_validation.gd" "tests/keyboard_mouse_mapping_validation.gd" "tests/logbook_validation.gd" "tests/network_player_animation_protocol_validation.gd" + "tests/net_attachment_validation.gd" "tests/on_screen_keyboard_validation.gd" + "tests/player_gathering_animation_validation.gd" "tests/player_experience_validation.gd" "tests/shoreline_ambience_validation.gd" "tests/surface_drawing_validation.gd" + "tests/surface_drawing_texture_renderer_validation.gd" + "tests/tackle_order_validation.gd" + "tests/terrain_biome_validation.gd" "tests/terrain_blender_material_validation.gd" + "tests/terrain_chunk_generator_validation.gd" "tests/texture_sampling_validation.gd" + "tests/tree_gathering_prototype_validation.gd" + "tests/unified_inventory_validation.gd" "tests/world_time_validation.gd" + "tests/world_layout_validation.gd" "tests/world_spawn_protocol_validation.gd" "tests/world_weather_validation.gd" ) @@ -53,24 +75,31 @@ readonly -a HOST_TESTS=( "tests/fish_hotbar_showcase_validation.gd" "tests/fishing_authority_validation.gd" "tests/gathering_showcase_validation.gd" + "tests/inventory_storage_persistence_validation.gd" "tests/job_system_validation.gd" + "tests/progression_archive_validation.gd" "tests/surface_drawing_runtime_validation.gd" ) readonly -a NETWORK_TESTS=( + "tests/chat_privacy_multiplayer_validation.gd" "tests/economy_regression_validation.gd" "tests/fish_showcase_multiplayer_validation.gd" + "tests/friend_multiplayer_validation.gd" "tests/fishing_multiplayer_validation.gd" + "tests/home_spawn_multiplayer_validation.gd" "tests/job_multiplayer_validation.gd" "tests/movement_multiplayer_validation.gd" "tests/operator_multiplayer_validation.gd" "tests/profile_multiplayer_validation.gd" "tests/surface_drawing_multiplayer_validation.gd" "tests/world_time_multiplayer_validation.gd" + "tests/world_layout_multiplayer_validation.gd" "tests/world_spawn_multiplayer_validation.gd" ) readonly SESSION_SWITCH_NETWORK_TEST="tests/session_switch_multiplayer_validation.gd" +readonly LATE_JOIN_NETWORK_TEST="tests/late_join_multiplayer_validation.gd" cleanup() { rm -rf -- "${RUN_ROOT}" @@ -79,7 +108,7 @@ trap cleanup EXIT INT TERM usage() { printf \ - 'Usage: %s {quick|full|host|network|session-switch|all|--list}\n' \ + 'Usage: %s {quick|full|host|network|session-switch|late-join|all|--list}\n' \ "$0" } @@ -122,7 +151,10 @@ wait_for_network_host() { sleep 2 return 0 fi - for _attempt in {1..100}; do + # A cold generated-world startup can take longer than ten seconds before + # NetworkSession is ready to bind. Keep the client launch tied to the actual + # listener instead of treating that normal startup work as a host failure. + for _attempt in {1..600}; do if ! kill -0 "${host_pid}" 2>/dev/null; then return 1 fi @@ -208,7 +240,7 @@ run_session_switch_network_test() { --headless --path "${PROJECT_ROOT}" --script "${script}" -- second_host \ >"${second_root}/output.log" 2>&1 & second_pid=$! - for _attempt in {1..100}; do + for _attempt in {1..600}; do if ! kill -0 "${first_pid}" 2>/dev/null \ || ! kill -0 "${second_pid}" 2>/dev/null; then break @@ -262,6 +294,71 @@ run_session_switch_network_test() { fi } + +run_late_join_network_test() { + local script="${LATE_JOIN_NETWORK_TEST}" + local name="${script#tests/}" + name="${name%.gd}" + local host_root first_root late_root + local host_pid first_pid late_pid host_status first_status late_status + host_root="$(prepare_root "${name}-host")" + first_root="$(prepare_root "${name}-first")" + late_root="$(prepare_root "${name}-late")" + printf '\n==> %s (host + first client + late client)\n' "${script}" + XDG_DATA_HOME="${host_root}/data" \ + XDG_CONFIG_HOME="${host_root}/config" \ + XDG_CACHE_HOME="${host_root}/cache" \ + timeout "${TEST_TIMEOUT_SECONDS}s" "${GODOT_BIN}" \ + --headless --path "${PROJECT_ROOT}" --script "${script}" -- host \ + >"${host_root}/output.log" 2>&1 & + host_pid=$! + if ! wait_for_network_host "${script}" "${host_pid}"; then + set +e + wait "${host_pid}" + host_status=$? + set -e + printf '%s\n' '-- host output --' + sed -n '1,240p' "${host_root}/output.log" + printf 'error: host did not become ready (exit %d)\n' \ + "${host_status}" >&2 + return 1 + fi + XDG_DATA_HOME="${first_root}/data" \ + XDG_CONFIG_HOME="${first_root}/config" \ + XDG_CACHE_HOME="${first_root}/cache" \ + timeout "${TEST_TIMEOUT_SECONDS}s" "${GODOT_BIN}" \ + --headless --path "${PROJECT_ROOT}" --script "${script}" -- first \ + >"${first_root}/output.log" 2>&1 & + first_pid=$! + sleep 4 + XDG_DATA_HOME="${late_root}/data" \ + XDG_CONFIG_HOME="${late_root}/config" \ + XDG_CACHE_HOME="${late_root}/cache" \ + timeout "${TEST_TIMEOUT_SECONDS}s" "${GODOT_BIN}" \ + --headless --path "${PROJECT_ROOT}" --script "${script}" -- late \ + >"${late_root}/output.log" 2>&1 & + late_pid=$! + set +e + wait "${late_pid}" + late_status=$? + wait "${first_pid}" + first_status=$? + wait "${host_pid}" + host_status=$? + set -e + printf '%s\n' '-- host output --' + sed -n '1,240p' "${host_root}/output.log" + printf '%s\n' '-- first client output --' + sed -n '1,240p' "${first_root}/output.log" + printf '%s\n' '-- late client output --' + sed -n '1,240p' "${late_root}/output.log" + if ((host_status != 0 || first_status != 0 || late_status != 0)); then + printf 'error: host exited %d; clients exited %d/%d\n' \ + "${host_status}" "${first_status}" "${late_status}" >&2 + return 1 + fi +} + run_quick() { local test_script for test_script in "${QUICK_TESTS[@]}"; do @@ -289,6 +386,7 @@ run_network() { for test_script in "${NETWORK_TESTS[@]}"; do run_network_test "${test_script}" done + run_late_join_network_test run_session_switch_network_test } @@ -303,6 +401,8 @@ list_tests() { printf ' %s\n' "${NETWORK_TESTS[@]}" printf '%s\n' 'Two-host session-switch network test:' printf ' %s\n' "${SESSION_SWITCH_NETWORK_TEST}" + printf '%s\n' 'Three-peer late-join network test:' + printf ' %s\n' "${LATE_JOIN_NETWORK_TEST}" } case "${1:-}" in @@ -321,6 +421,9 @@ case "${1:-}" in session-switch) run_session_switch_network_test ;; + late-join) + run_late_join_network_test + ;; all) run_full run_host diff --git a/scripts/setup_android_build.sh b/scripts/setup_android_build.sh index c1cebdc..bc96083 100755 --- a/scripts/setup_android_build.sh +++ b/scripts/setup_android_build.sh @@ -336,8 +336,8 @@ check_editor_settings() { run_export_hint() { echo echo "Example export commands:" - echo " ${GODOT} --headless --path \"$PROJECT_ROOT\" --export-release \"Android\" builds/${PROJECT_VERSION}/android/NETfishing.apk" - echo " ${GODOT} --headless --path \"$PROJECT_ROOT\" --export-debug \"Android\" builds/android/NETfishing-debug.apk" + echo " ${GODOT} --headless --path \"$PROJECT_ROOT\" --export-release \"Android\" builds/${PROJECT_VERSION}/android/straywild.apk" + echo " ${GODOT} --headless --path \"$PROJECT_ROOT\" --export-debug \"Android\" builds/android/straywild-debug.apk" } print_status INFO "Starting Android dependency preflight..." diff --git a/scripts/test_player_data_root_paths.gd b/scripts/test_player_data_root_paths.gd index 69a2485..f357b9a 100644 --- a/scripts/test_player_data_root_paths.gd +++ b/scripts/test_player_data_root_paths.gd @@ -1,36 +1,36 @@ extends SceneTree -const PROJECT_PATH := "/tmp/netfishing" -const INSTALL_PATH := "/opt/NETfishing" +const PROJECT_PATH := "/tmp/straywild" +const INSTALL_PATH := "/opt/straywild" func _initialize() -> void: - var root_to_create: String = OS.get_environment("NETFISHING_TEST_CREATE_ROOT") + var root_to_create: String = OS.get_environment("straywild_TEST_CREATE_ROOT") if not root_to_create.is_empty(): _create_validation_root(root_to_create) return var failures: PackedStringArray = [] _expect( "external temporary directory", - "/tmp/NETfishing-test-data", + "/tmp/straywild-test-data", PlayerDataRoot.PATH_ALLOWED, failures, ) _expect( "external trailing slash", - "/tmp/NETfishing-test-data/", + "/tmp/straywild-test-data/", PlayerDataRoot.PATH_ALLOWED, failures, ) _expect( "similar project-name sibling", - "/tmp/netfishing-data", + "/tmp/straywild-data", PlayerDataRoot.PATH_ALLOWED, failures, ) _expect( "documents directory", - "/home/player/Documents/NETfishing", + "/home/player/Documents/straywild", PlayerDataRoot.PATH_ALLOWED, failures, ) @@ -55,7 +55,7 @@ func _initialize() -> void: ) _expect_with_references( "empty project reference", - "/tmp/NETfishing-test-data", + "/tmp/straywild-test-data", "", INSTALL_PATH, PlayerDataRoot.PATH_ALLOWED, @@ -63,7 +63,7 @@ func _initialize() -> void: ) _expect_with_references( "root project reference", - "/tmp/NETfishing-test-data", + "/tmp/straywild-test-data", "/", INSTALL_PATH, PlayerDataRoot.PATH_ALLOWED, @@ -71,9 +71,9 @@ func _initialize() -> void: ) _expect_with_references( "Windows component and case normalization", - "C:\\Games\\NETfishing Data", - "C:\\Games\\NETfishing", - "C:\\Program Files\\NETfishing", + "C:\\Games\\straywild Data", + "C:\\Games\\straywild", + "C:\\Program Files\\straywild", PlayerDataRoot.PATH_ALLOWED, failures, true, diff --git a/scripts/validate_animalese_samples.gd b/scripts/validate_animalese_samples.gd new file mode 100644 index 0000000..a4e7502 --- /dev/null +++ b/scripts/validate_animalese_samples.gd @@ -0,0 +1,73 @@ +extends SceneTree + +const AnimaleseVoiceType = preload("res://ui/animalese_voice.gd") +const VoiceProfilesType = preload( + "res://player/animalese_voice_profiles.gd" +) +const EXPECTED_CHARACTERS := "abcdefghijklmnopqrstuvwxyz0123456789" +const ROBOT_CHARACTERS := "abcdefghijklmnopqrstuvwxyz" + +var _failures: Array[String] = [] + + +func _initialize() -> void: + _expect( + AnimaleseVoiceType.SUPPORTED_CHARACTERS == EXPECTED_CHARACTERS, + "animalese supports every letter and digit", + ) + _expect( + VoiceProfilesType.DEFAULT_SAMPLE_SET_ID == "kat", + "kat is the default animalese voice set", + ) + _expect( + VoiceProfilesType.is_valid_sample_set("robot"), + "the original tones remain available as robot", + ) + _expect( + VoiceProfilesType.is_valid_sample_set("kim"), + "kim is available as an animalese voice set", + ) + _validate_set("kat", EXPECTED_CHARACTERS, false) + _validate_set("robot", ROBOT_CHARACTERS, true) + _validate_set("kim", EXPECTED_CHARACTERS, false) + if _failures.is_empty(): + print("Animalese sample validation: PASS") + quit(0) + return + for failure: String in _failures: + push_error(failure) + quit(1) + + +func _validate_set( + sample_set_id: String, + characters: String, + expects_fallback: bool, +) -> void: + var sample_directory := VoiceProfilesType.sample_directory_for( + sample_set_id + ) + _expect( + not sample_directory.is_empty(), + "%s has a sample directory" % sample_set_id, + ) + for character_index: int in range(characters.length()): + var character := characters.substr(character_index, 1) + var sample_path := "%s/%s.wav" % [sample_directory, character] + _expect( + ResourceLoader.exists(sample_path, "AudioStreamWAV"), + "%s sample loads for %s" % [sample_set_id, character], + ) + if expects_fallback: + _expect( + ResourceLoader.exists( + "%s/fallback.wav" % sample_directory, + "AudioStreamWAV", + ), + "%s supplies a fallback for digits and symbols" % sample_set_id, + ) + + +func _expect(condition: bool, message: String) -> void: + if not condition: + _failures.append(message) diff --git a/scripts/generate_placeholder_animalese.gd.uid b/scripts/validate_animalese_samples.gd.uid similarity index 100% rename from scripts/generate_placeholder_animalese.gd.uid rename to scripts/validate_animalese_samples.gd.uid diff --git a/server/dedicated_server_config.gd b/server/dedicated_server_config.gd index 0618466..3370457 100644 --- a/server/dedicated_server_config.gd +++ b/server/dedicated_server_config.gd @@ -1,19 +1,24 @@ class_name DedicatedServerConfig extends RefCounted -const DEFAULT_NAME: String = "NETfishing Dedicated Server" +const DEFAULT_NAME: String = "straywild Dedicated Server" const DEFAULT_BIND_ADDRESS: String = "*" const DEFAULT_PORT: int = 7777 const DEFAULT_MAX_PLAYERS: int = 8 +const DEFAULT_WORLD_SEED: int = 13001 +const MAX_WORLD_SEED: int = 2147483646 const MAX_OPERATORS: int = 64 var server_name: String = DEFAULT_NAME var bind_address: String = DEFAULT_BIND_ADDRESS var port: int = DEFAULT_PORT var max_players: int = DEFAULT_MAX_PLAYERS +var world_seed: int = DEFAULT_WORLD_SEED var public_listing: bool = false var discovery_url: String = "" var data_directory: String = "" +var chat_logging: bool = false +var chat_log_path: String = "" var operator_fingerprints: PackedStringArray = PackedStringArray() var error_message: String = "" @@ -26,8 +31,10 @@ static func from_runtime() -> DedicatedServerConfig: result.discovery_url = str(ProjectSettings.get_setting( "network/discovery/base_url", "" )).strip_edges() - var config_path: String = OS.get_environment( - "NETFISHING_SERVER_CONFIG" + var config_path: String = _environment_string( + "straywild_SERVER_CONFIG", + "NETFISHING_SERVER_CONFIG", + "", ).strip_edges() for argument: String in OS.get_cmdline_user_args(): if argument.begins_with("--config="): @@ -58,6 +65,7 @@ func _load_file(path: String) -> bool: max_players = int(file.get_value( "server", "max_players", max_players )) + world_seed = int(file.get_value("world", "seed", world_seed)) public_listing = bool(file.get_value( "server", "public", public_listing )) @@ -67,6 +75,12 @@ func _load_file(path: String) -> bool: discovery_url = str(file.get_value( "discovery", "url", discovery_url )) + chat_logging = bool(file.get_value( + "privacy", "chat_logging", chat_logging + )) + chat_log_path = str(file.get_value( + "privacy", "chat_log_path", chat_log_path + )) operator_fingerprints = _parse_fingerprint_list(file.get_value( "moderation", "operators", operator_fingerprints )) @@ -75,27 +89,44 @@ func _load_file(path: String) -> bool: func _apply_environment() -> void: server_name = _environment_string( - "NETFISHING_SERVER_NAME", server_name + "straywild_SERVER_NAME", "NETFISHING_SERVER_NAME", server_name ) bind_address = _environment_string( - "NETFISHING_SERVER_BIND", bind_address + "straywild_SERVER_BIND", "NETFISHING_SERVER_BIND", bind_address + ) + port = _environment_int( + "straywild_SERVER_PORT", "NETFISHING_SERVER_PORT", port ) - port = _environment_int("NETFISHING_SERVER_PORT", port) max_players = _environment_int( - "NETFISHING_SERVER_MAX_PLAYERS", max_players + "straywild_SERVER_MAX_PLAYERS", + "NETFISHING_SERVER_MAX_PLAYERS", + max_players, + ) + world_seed = _environment_int( + "straywild_WORLD_SEED", "NETFISHING_WORLD_SEED", world_seed ) public_listing = _environment_bool( - "NETFISHING_SERVER_PUBLIC", public_listing + "straywild_SERVER_PUBLIC", "NETFISHING_SERVER_PUBLIC", public_listing ) discovery_url = _environment_string( - "NETFISHING_DISCOVERY_URL", discovery_url + "straywild_DISCOVERY_URL", "NETFISHING_DISCOVERY_URL", discovery_url ) data_directory = _environment_string( - "NETFISHING_DATA_DIR", data_directory + "straywild_DATA_DIR", "NETFISHING_DATA_DIR", data_directory ) - if OS.has_environment("NETFISHING_SERVER_OPERATORS"): + chat_logging = _environment_bool( + "straywild_CHAT_LOGGING", "NETFISHING_CHAT_LOGGING", chat_logging + ) + chat_log_path = _environment_string( + "straywild_CHAT_LOG_PATH", "NETFISHING_CHAT_LOG_PATH", chat_log_path + ) + var operators_variable: String = _available_environment_variable( + "straywild_SERVER_OPERATORS", + "NETFISHING_SERVER_OPERATORS", + ) + if not operators_variable.is_empty(): operator_fingerprints = _parse_fingerprint_list( - OS.get_environment("NETFISHING_SERVER_OPERATORS") + OS.get_environment(operators_variable) ) @@ -111,6 +142,10 @@ func _apply_arguments(arguments: PackedStringArray) -> void: max_players = _parse_int( argument.trim_prefix("--max-players="), max_players ) + elif argument.begins_with("--world-seed="): + world_seed = _parse_int( + argument.trim_prefix("--world-seed="), world_seed + ) elif argument.begins_with("--data-dir="): data_directory = argument.trim_prefix("--data-dir=") elif argument.begins_with("--discovery-url="): @@ -119,10 +154,16 @@ func _apply_arguments(arguments: PackedStringArray) -> void: operator_fingerprints = _parse_fingerprint_list( argument.trim_prefix("--operators=") ) + elif argument.begins_with("--chat-log-path="): + chat_log_path = argument.trim_prefix("--chat-log-path=") elif argument == "--public": public_listing = true elif argument == "--private": public_listing = false + elif argument == "--chat-logging": + chat_logging = true + elif argument == "--no-chat-logging": + chat_logging = false func _validate() -> void: @@ -130,6 +171,9 @@ func _validate() -> void: bind_address = bind_address.strip_edges() discovery_url = discovery_url.strip_edges().trim_suffix("/") data_directory = data_directory.strip_edges() + chat_log_path = chat_log_path.strip_edges() + if chat_logging and chat_log_path.is_empty() and not data_directory.is_empty(): + chat_log_path = data_directory.path_join("logs/chat.jsonl") operator_fingerprints = _normalized_fingerprints(operator_fingerprints) if server_name.is_empty(): error_message = "Server name cannot be empty." @@ -141,8 +185,16 @@ func _validate() -> void: error_message = "Server port must be between 1 and 65535." elif max_players < 1 or max_players > 128: error_message = "Maximum players must be between 1 and 128." + elif world_seed <= 0 or world_seed > MAX_WORLD_SEED: + error_message = "World seed must be between 1 and %d." % MAX_WORLD_SEED elif not data_directory.is_empty() and not data_directory.is_absolute_path(): error_message = "Server data directory must be an absolute path." + elif chat_logging and ( + chat_log_path.is_empty() or not chat_log_path.is_absolute_path() + ): + error_message = ( + "Chat logging requires an absolute chat log path." + ) elif public_listing and not ( discovery_url.begins_with("https://") or discovery_url.begins_with("http://") @@ -169,21 +221,45 @@ static func _safe_text(value: String) -> bool: return true -static func _environment_string(name: String, fallback: String) -> String: - return OS.get_environment(name) if OS.has_environment(name) else fallback +static func _available_environment_variable( + name: String, + legacy_name: String, +) -> String: + if OS.has_environment(name): + return name + return legacy_name if OS.has_environment(legacy_name) else "" -static func _environment_int(name: String, fallback: int) -> int: +static func _environment_string( + name: String, + legacy_name: String, + fallback: String, +) -> String: + var variable: String = _available_environment_variable(name, legacy_name) + return OS.get_environment(variable) if not variable.is_empty() else fallback + + +static func _environment_int( + name: String, + legacy_name: String, + fallback: int, +) -> int: + var variable: String = _available_environment_variable(name, legacy_name) return ( - _parse_int(OS.get_environment(name), fallback) - if OS.has_environment(name) else fallback + _parse_int(OS.get_environment(variable), fallback) + if not variable.is_empty() else fallback ) -static func _environment_bool(name: String, fallback: bool) -> bool: - if not OS.has_environment(name): +static func _environment_bool( + name: String, + legacy_name: String, + fallback: bool, +) -> bool: + var variable: String = _available_environment_variable(name, legacy_name) + if variable.is_empty(): return fallback - var value: String = OS.get_environment(name).strip_edges().to_lower() + var value: String = OS.get_environment(variable).strip_edges().to_lower() return value in ["1", "true", "yes", "on"] diff --git a/settings/controller_mapping_manager.gd b/settings/controller_mapping_manager.gd index 7c54777..278022e 100644 --- a/settings/controller_mapping_manager.gd +++ b/settings/controller_mapping_manager.gd @@ -80,11 +80,11 @@ const ROLE_LABELS: Dictionary = { ROLE_A: "jump / menu accept", ROLE_B: "menu back", ROLE_X: "player menu", - ROLE_Y: "interact", + ROLE_Y: "interact / character call", ROLE_LB: "focus chat or world", ROLE_RB: "primary action", ROLE_POINTER_MODIFIER: "virtual mouse modifier", - ROLE_CAMERA_ZOOM: "camera zoom", + ROLE_CAMERA_ZOOM: "zoom modifier (+RT)", ROLE_SELECT: "chat", ROLE_START: "pause", ROLE_LEFT_STICK_CLICK: "sprint", @@ -96,7 +96,7 @@ const ROLE_LABELS: Dictionary = { ROLE_LEFT_STICK_X: "move left / right", ROLE_LEFT_STICK_Y: "move up / down", ROLE_RIGHT_STICK_X: "camera left / right", - ROLE_RIGHT_STICK_Y: "camera up / down", + ROLE_RIGHT_STICK_Y: "camera up / down (+RT to zoom)", } const ROLE_PROMPTS: Dictionary = { @@ -139,6 +139,7 @@ const BUTTON_ACTION_ROLES: Dictionary = { &"ui_cancel": ROLE_B, &"open_backpack": ROLE_X, &"interact": ROLE_Y, + &"character_call": ROLE_Y, &"focus_gameplay": ROLE_LB, &"fish_primary": ROLE_RB, &"open_chat": ROLE_SELECT, @@ -281,7 +282,7 @@ func _validated_profiles(raw_profiles: Dictionary) -> Dictionary: ): complete = false break - if not complete: + if not complete or bindings_have_conflicts(bindings): continue validated[str(key_value)] = { "controller_name": str( @@ -401,6 +402,8 @@ func replace_active_bindings(bindings: Dictionary) -> bool: return false if not validate_binding(role, binding as Dictionary): return false + if bindings_have_conflicts(bindings): + return false var previous: Dictionary = _profiles.duplicate(true) _profiles[_active_profile_key] = { "controller_name": _active_controller_name, @@ -483,6 +486,53 @@ func validate_binding(role: StringName, binding: Dictionary) -> bool: ) +static func bindings_have_conflicts(bindings: Dictionary) -> bool: + for role_index: int in ROLE_ORDER.size(): + var first_role: StringName = ROLE_ORDER[role_index] + var first_value: Variant = bindings.get(str(first_role), {}) + if typeof(first_value) != TYPE_DICTIONARY: + continue + for other_index: int in range(role_index + 1, ROLE_ORDER.size()): + var second_role: StringName = ROLE_ORDER[other_index] + var second_value: Variant = bindings.get(str(second_role), {}) + if typeof(second_value) != TYPE_DICTIONARY: + continue + if bindings_conflict( + first_role, + first_value as Dictionary, + second_role, + second_value as Dictionary, + ): + return true + return false + + +static func bindings_conflict( + first_role: StringName, + first: Dictionary, + second_role: StringName, + second: Dictionary, +) -> bool: + var binding_kind: String = str(first.get("kind", "")) + if binding_kind != str(second.get("kind", "")): + return false + if binding_kind == "button": + return int(first.get("button", -1)) == int( + second.get("button", -1) + ) + if binding_kind != "axis": + return false + if int(first.get("axis", -1)) != int(second.get("axis", -1)): + return false + var opposite_trigger_halves: bool = ( + first_role in TRIGGER_ROLES + and second_role in TRIGGER_ROLES + and signf(float(first.get("direction", 0.0))) + != signf(float(second.get("direction", 0.0))) + ) + return not opposite_trigger_halves + + func binding_label(binding: Dictionary) -> String: if str(binding.get("kind", "")) == "button": return _button_label(int(binding.get("button", -1))) diff --git a/settings/keyboard_mouse_mapping_manager.gd b/settings/keyboard_mouse_mapping_manager.gd index a8d4f09..54dacc8 100644 --- a/settings/keyboard_mouse_mapping_manager.gd +++ b/settings/keyboard_mouse_mapping_manager.gd @@ -3,7 +3,8 @@ extends Node signal mapping_changed -const FORMAT_VERSION: int = 1 +const FORMAT_VERSION: int = 2 +const LEGACY_FORMAT_VERSION: int = 1 const MAPPING_PATH: String = "user://keyboard_mouse_bindings.json" const MAPPING_TEMP_PATH: String = "user://keyboard_mouse_bindings.json.tmp" const MAPPING_BACKUP_PATH: String = ( @@ -21,6 +22,7 @@ const ROLE_SNEAK: StringName = &"sneak" const ROLE_SLOW_WALK: StringName = &"slow_walk" const ROLE_INTERACT: StringName = &"interact" const ROLE_PRIMARY_ACTION: StringName = &"fish_primary" +const ROLE_ALTERNATE_REEL: StringName = &"reel_alternate" const ROLE_CAMERA_DRAG: StringName = &"camera_drag" const ROLE_CAMERA_ZOOM_IN: StringName = &"camera_zoom_in" const ROLE_CAMERA_ZOOM_OUT: StringName = &"camera_zoom_out" @@ -46,6 +48,7 @@ const ROLE_ORDER: Array[StringName] = [ ROLE_SLOW_WALK, ROLE_INTERACT, ROLE_PRIMARY_ACTION, + ROLE_ALTERNATE_REEL, ROLE_CAMERA_DRAG, ROLE_CAMERA_ZOOM_IN, ROLE_CAMERA_ZOOM_OUT, @@ -81,9 +84,10 @@ const ROLE_LABELS: Dictionary = { ROLE_SLOW_WALK: "slow walk", ROLE_INTERACT: "interact", ROLE_PRIMARY_ACTION: "primary action", + ROLE_ALTERNATE_REEL: "alternate reel", ROLE_CAMERA_DRAG: "rotate camera", - ROLE_CAMERA_ZOOM_IN: "camera zoom in", - ROLE_CAMERA_ZOOM_OUT: "camera zoom out", + ROLE_CAMERA_ZOOM_IN: "hotbar select (+SHIFT to zoom)", + ROLE_CAMERA_ZOOM_OUT: "hotbar select (+SHIFT to zoom)", ROLE_PLAYER_MENU: "player menu", ROLE_TACKLE_BOX: "tackle box", ROLE_PROP_BOOK: "prop book", @@ -138,19 +142,28 @@ func load_mapping() -> bool: _bindings = {} return false var data := json.data as Dictionary - if int(data.get("format_version", -1)) != FORMAT_VERSION: + var format_version: int = int(data.get("format_version", -1)) + if format_version not in [LEGACY_FORMAT_VERSION, FORMAT_VERSION]: push_warning("Keyboard binding version is unsupported; using defaults.") _bindings = {} return false var raw_bindings: Variant = data.get("bindings", {}) if ( typeof(raw_bindings) != TYPE_DICTIONARY - or not _validate_complete_bindings(raw_bindings as Dictionary) ): push_warning("Keyboard bindings are incomplete; using defaults.") _bindings = {} return false - _bindings = (raw_bindings as Dictionary).duplicate(true) + var loaded_bindings := (raw_bindings as Dictionary).duplicate(true) + if format_version == LEGACY_FORMAT_VERSION: + loaded_bindings[str(ROLE_ALTERNATE_REEL)] = ( + _default_bindings[str(ROLE_ALTERNATE_REEL)].duplicate(true) + ) + if not _validate_complete_bindings(loaded_bindings): + push_warning("Keyboard bindings are incomplete; using defaults.") + _bindings = {} + return false + _bindings = loaded_bindings return true @@ -164,6 +177,17 @@ func get_active_bindings() -> Dictionary: return _default_bindings.duplicate(true) +func get_binding(role: StringName) -> Dictionary: + var binding: Variant = get_active_bindings().get(str(role), {}) + if typeof(binding) != TYPE_DICTIONARY: + return {} + return (binding as Dictionary).duplicate(true) + + +func get_binding_label(role: StringName) -> String: + return binding_label(get_binding(role)) + + func get_role_label(role: StringName) -> String: return str(ROLE_LABELS.get(role, str(role).replace("_", " "))) diff --git a/settings/player_settings.gd b/settings/player_settings.gd index a20a3e1..59099fc 100644 --- a/settings/player_settings.gd +++ b/settings/player_settings.gd @@ -15,6 +15,9 @@ const DEFAULT_WORLD_PIXEL_SIZE: int = 3 const MIN_UI_PIXEL_SIZE: int = 1 const MAX_UI_PIXEL_SIZE: int = 5 const DEFAULT_UI_PIXEL_SIZE: int = 3 +const DEFAULT_CHAT_DOCK_RIGHT: bool = false +const DEFAULT_CHAT_MOBILE_MODE: bool = false +const DEFAULT_PAINT_DOCK_RIGHT: bool = true const MAX_CHAT_DRAFT_CHARACTERS: int = 256 const COMPACT_DISPLAY_HEIGHT: int = 560 const WORLD_DESKTOP_GRID_HEIGHTS: Array[int] = [0, 540, 360, 216, 96] @@ -29,12 +32,14 @@ const UI_COMPACT_RENDER_HEIGHTS: Array[int] = [0, 408, 336, 264, 192] @export_range(0.001, 0.012, 0.0005) var mouse_camera_sensitivity: float = 0.005 @export_range(0.5, 5.0, 0.1) var controller_camera_sensitivity: float = 2.5 @export var invert_camera_y: bool = false +@export var swap_hotbar_camera_scroll: bool = false @export var on_screen_keyboard_enabled: bool = false @export var chat_draft: String = "" @export var chat_collapsed: bool = false -@export var chat_dock_right: bool = false -@export var chat_mobile_mode: bool = false -@export var paint_dock_right: bool = true +@export var chat_dock_right: bool = DEFAULT_CHAT_DOCK_RIGHT +@export var chat_mobile_mode: bool = DEFAULT_CHAT_MOBILE_MODE +@export var paint_dock_right: bool = DEFAULT_PAINT_DOCK_RIGHT +@export var presentation_layout_customized: bool = false @export var fullscreen_enabled: bool = false @export_range(0.0, 1.0, 0.01) var master_volume: float = 1.0 @export_range(0.0, 1.0, 0.01) var music_volume: float = 1.0 @@ -75,12 +80,14 @@ func copy() -> PlayerSettings: result.mouse_camera_sensitivity = mouse_camera_sensitivity result.controller_camera_sensitivity = controller_camera_sensitivity result.invert_camera_y = invert_camera_y + result.swap_hotbar_camera_scroll = swap_hotbar_camera_scroll result.on_screen_keyboard_enabled = on_screen_keyboard_enabled result.chat_draft = chat_draft result.chat_collapsed = chat_collapsed result.chat_dock_right = chat_dock_right result.chat_mobile_mode = chat_mobile_mode result.paint_dock_right = paint_dock_right + result.presentation_layout_customized = presentation_layout_customized result.fullscreen_enabled = fullscreen_enabled result.master_volume = master_volume result.music_volume = music_volume @@ -91,6 +98,20 @@ func copy() -> PlayerSettings: return result +func normalize_implicit_presentation_layout() -> bool: + if presentation_layout_customized: + return false + var changed: bool = ( + chat_dock_right != DEFAULT_CHAT_DOCK_RIGHT + or chat_mobile_mode != DEFAULT_CHAT_MOBILE_MODE + or paint_dock_right != DEFAULT_PAINT_DOCK_RIGHT + ) + chat_dock_right = DEFAULT_CHAT_DOCK_RIGHT + chat_mobile_mode = DEFAULT_CHAT_MOBILE_MODE + paint_dock_right = DEFAULT_PAINT_DOCK_RIGHT + return changed + + static func _is_valid_audio_volume(value: float) -> bool: return ( is_finite(value) diff --git a/settings/player_settings_manager.gd b/settings/player_settings_manager.gd index 84b3f44..362abc9 100644 --- a/settings/player_settings_manager.gd +++ b/settings/player_settings_manager.gd @@ -6,6 +6,9 @@ const SETTINGS_PATH: String = "user://player_settings.json" const TEMP_PATH: String = "user://player_settings.json.tmp" const BACKUP_PATH: String = "user://player_settings.json.backup" const SILENT_VOLUME_DB: float = -80.0 +const HEADLESS_WRITE_ENVIRONMENT: String = ( + "straywild_ISOLATED_VALIDATION_STORAGE" +) signal settings_changed(settings: PlayerSettings) @@ -51,6 +54,10 @@ func load_settings() -> bool: if ( typeof(accessibility.get("auto_click_enabled")) != TYPE_BOOL or typeof(camera.get("invert_vertical")) != TYPE_BOOL + or ( + camera.has("swap_hotbar_camera_scroll") + and typeof(camera["swap_hotbar_camera_scroll"]) != TYPE_BOOL + ) or ( accessibility.has("on_screen_keyboard_enabled") and typeof(accessibility["on_screen_keyboard_enabled"]) != TYPE_BOOL @@ -79,6 +86,10 @@ func load_settings() -> bool: presentation.has("paint_dock_right") and typeof(presentation["paint_dock_right"]) != TYPE_BOOL ) + or ( + presentation.has("layout_customized") + and typeof(presentation["layout_customized"]) != TYPE_BOOL + ) or ( presentation.has("fullscreen_enabled") and typeof(presentation["fullscreen_enabled"]) != TYPE_BOOL @@ -102,6 +113,9 @@ func load_settings() -> bool: -1.0 ) loaded.invert_camera_y = camera["invert_vertical"] + loaded.swap_hotbar_camera_scroll = bool( + camera.get("swap_hotbar_camera_scroll", false) + ) loaded.on_screen_keyboard_enabled = bool( accessibility.get("on_screen_keyboard_enabled", false) ) @@ -132,6 +146,12 @@ func load_settings() -> bool: presentation.get("chat_mobile_mode", false) ) loaded.paint_dock_right = bool(presentation.get("paint_dock_right", true)) + loaded.presentation_layout_customized = bool( + presentation.get("layout_customized", false) + ) + var normalized_implicit_layout: bool = ( + loaded.normalize_implicit_presentation_layout() + ) loaded.fullscreen_enabled = bool( presentation.get("fullscreen_enabled", false) ) @@ -144,7 +164,7 @@ func load_settings() -> bool: if not loaded.is_valid(): return _use_defaults_after_corruption("Player settings values are invalid.") current_settings = loaded - _is_dirty = false + _is_dirty = normalized_implicit_layout _apply_audio_settings(current_settings) emit_signal("settings_changed", current_settings) return true @@ -154,7 +174,9 @@ func apply_settings(settings: PlayerSettings) -> bool: if settings == null or not settings.is_valid(): return false var previous: PlayerSettings = current_settings - current_settings = settings.copy() + var normalized_settings := settings.copy() + normalized_settings.normalize_implicit_presentation_layout() + current_settings = normalized_settings _is_dirty = true if not save_now(): current_settings = previous @@ -197,6 +219,15 @@ func save_chat_preferences() -> bool: func save_now() -> bool: + if ( + OS.has_feature("editor") + and DisplayServer.get_name() == "headless" + and not OS.has_environment(HEADLESS_WRITE_ENVIRONMENT) + ): + push_error( + "Refusing to write player settings from an unisolated headless editor run." + ) + return false if current_settings == null or not current_settings.is_valid(): return false var data: Dictionary = { @@ -213,6 +244,9 @@ func save_now() -> bool: "mouse_sensitivity": current_settings.mouse_camera_sensitivity, "controller_sensitivity": current_settings.controller_camera_sensitivity, "invert_vertical": current_settings.invert_camera_y, + "swap_hotbar_camera_scroll": ( + current_settings.swap_hotbar_camera_scroll + ), }, "audio": { "master": current_settings.master_volume, @@ -228,6 +262,9 @@ func save_now() -> bool: "chat_dock_right": current_settings.chat_dock_right, "chat_mobile_mode": current_settings.chat_mobile_mode, "paint_dock_right": current_settings.paint_dock_right, + "layout_customized": ( + current_settings.presentation_layout_customized + ), "fullscreen_enabled": current_settings.fullscreen_enabled, }, } diff --git a/sound/dialogue/animalese/alphanumeric/0.wav b/sound/dialogue/animalese/alphanumeric/0.wav new file mode 100644 index 0000000..779e725 Binary files /dev/null and b/sound/dialogue/animalese/alphanumeric/0.wav differ diff --git a/sound/dialogue/animalese/placeholder/a.wav.import b/sound/dialogue/animalese/alphanumeric/0.wav.import similarity index 50% rename from sound/dialogue/animalese/placeholder/a.wav.import rename to sound/dialogue/animalese/alphanumeric/0.wav.import index 86de7ca..19ac04b 100644 --- a/sound/dialogue/animalese/placeholder/a.wav.import +++ b/sound/dialogue/animalese/alphanumeric/0.wav.import @@ -2,13 +2,13 @@ importer="wav" type="AudioStreamWAV" -uid="uid://dvajjy4bwadio" -path="res://.godot/imported/a.wav-9ab4b1a9a555e6fcf07951f399769b30.sample" +uid="uid://cbn5ed728rsm" +path="res://.godot/imported/0.wav-9378d7763e1ef87ae982ab57f6e81f2d.sample" [deps] -source_file="res://sound/dialogue/animalese/placeholder/a.wav" -dest_files=["res://.godot/imported/a.wav-9ab4b1a9a555e6fcf07951f399769b30.sample"] +source_file="res://sound/dialogue/animalese/alphanumeric/0.wav" +dest_files=["res://.godot/imported/0.wav-9378d7763e1ef87ae982ab57f6e81f2d.sample"] [params] diff --git a/sound/dialogue/animalese/alphanumeric/1.wav b/sound/dialogue/animalese/alphanumeric/1.wav new file mode 100644 index 0000000..db7dd62 Binary files /dev/null and b/sound/dialogue/animalese/alphanumeric/1.wav differ diff --git a/sound/dialogue/animalese/alphanumeric/1.wav.import b/sound/dialogue/animalese/alphanumeric/1.wav.import new file mode 100644 index 0000000..fa2905a --- /dev/null +++ b/sound/dialogue/animalese/alphanumeric/1.wav.import @@ -0,0 +1,24 @@ +[remap] + +importer="wav" +type="AudioStreamWAV" +uid="uid://8ofrxxya8xo8" +path="res://.godot/imported/1.wav-759e5f8cac5cef5d0e23605844f5032c.sample" + +[deps] + +source_file="res://sound/dialogue/animalese/alphanumeric/1.wav" +dest_files=["res://.godot/imported/1.wav-759e5f8cac5cef5d0e23605844f5032c.sample"] + +[params] + +force/8_bit=false +force/mono=false +force/max_rate=false +force/max_rate_hz=44100 +edit/trim=false +edit/normalize=false +edit/loop_mode=0 +edit/loop_begin=0 +edit/loop_end=-1 +compress/mode=2 diff --git a/sound/dialogue/animalese/alphanumeric/2.wav b/sound/dialogue/animalese/alphanumeric/2.wav new file mode 100644 index 0000000..74dd315 Binary files /dev/null and b/sound/dialogue/animalese/alphanumeric/2.wav differ diff --git a/sound/dialogue/animalese/alphanumeric/2.wav.import b/sound/dialogue/animalese/alphanumeric/2.wav.import new file mode 100644 index 0000000..800b899 --- /dev/null +++ b/sound/dialogue/animalese/alphanumeric/2.wav.import @@ -0,0 +1,24 @@ +[remap] + +importer="wav" +type="AudioStreamWAV" +uid="uid://cmxvxip3pwuun" +path="res://.godot/imported/2.wav-4b3515a4b79f8ae9ffc829c8a5e3c285.sample" + +[deps] + +source_file="res://sound/dialogue/animalese/alphanumeric/2.wav" +dest_files=["res://.godot/imported/2.wav-4b3515a4b79f8ae9ffc829c8a5e3c285.sample"] + +[params] + +force/8_bit=false +force/mono=false +force/max_rate=false +force/max_rate_hz=44100 +edit/trim=false +edit/normalize=false +edit/loop_mode=0 +edit/loop_begin=0 +edit/loop_end=-1 +compress/mode=2 diff --git a/sound/dialogue/animalese/alphanumeric/3.wav b/sound/dialogue/animalese/alphanumeric/3.wav new file mode 100644 index 0000000..6f90835 Binary files /dev/null and b/sound/dialogue/animalese/alphanumeric/3.wav differ diff --git a/sound/dialogue/animalese/alphanumeric/3.wav.import b/sound/dialogue/animalese/alphanumeric/3.wav.import new file mode 100644 index 0000000..5430aea --- /dev/null +++ b/sound/dialogue/animalese/alphanumeric/3.wav.import @@ -0,0 +1,24 @@ +[remap] + +importer="wav" +type="AudioStreamWAV" +uid="uid://c8017waek7ew8" +path="res://.godot/imported/3.wav-ffb8f531dceaa153b492b74c4bbf7c7c.sample" + +[deps] + +source_file="res://sound/dialogue/animalese/alphanumeric/3.wav" +dest_files=["res://.godot/imported/3.wav-ffb8f531dceaa153b492b74c4bbf7c7c.sample"] + +[params] + +force/8_bit=false +force/mono=false +force/max_rate=false +force/max_rate_hz=44100 +edit/trim=false +edit/normalize=false +edit/loop_mode=0 +edit/loop_begin=0 +edit/loop_end=-1 +compress/mode=2 diff --git a/sound/dialogue/animalese/alphanumeric/4.wav b/sound/dialogue/animalese/alphanumeric/4.wav new file mode 100644 index 0000000..061b5da Binary files /dev/null and b/sound/dialogue/animalese/alphanumeric/4.wav differ diff --git a/sound/dialogue/animalese/alphanumeric/4.wav.import b/sound/dialogue/animalese/alphanumeric/4.wav.import new file mode 100644 index 0000000..65e2fa4 --- /dev/null +++ b/sound/dialogue/animalese/alphanumeric/4.wav.import @@ -0,0 +1,24 @@ +[remap] + +importer="wav" +type="AudioStreamWAV" +uid="uid://bbtypop1cmrw1" +path="res://.godot/imported/4.wav-effad197373ffb9b48afe78e0fe6c95a.sample" + +[deps] + +source_file="res://sound/dialogue/animalese/alphanumeric/4.wav" +dest_files=["res://.godot/imported/4.wav-effad197373ffb9b48afe78e0fe6c95a.sample"] + +[params] + +force/8_bit=false +force/mono=false +force/max_rate=false +force/max_rate_hz=44100 +edit/trim=false +edit/normalize=false +edit/loop_mode=0 +edit/loop_begin=0 +edit/loop_end=-1 +compress/mode=2 diff --git a/sound/dialogue/animalese/alphanumeric/5.wav b/sound/dialogue/animalese/alphanumeric/5.wav new file mode 100644 index 0000000..a6c5000 Binary files /dev/null and b/sound/dialogue/animalese/alphanumeric/5.wav differ diff --git a/sound/dialogue/animalese/alphanumeric/5.wav.import b/sound/dialogue/animalese/alphanumeric/5.wav.import new file mode 100644 index 0000000..cddbc1f --- /dev/null +++ b/sound/dialogue/animalese/alphanumeric/5.wav.import @@ -0,0 +1,24 @@ +[remap] + +importer="wav" +type="AudioStreamWAV" +uid="uid://ddwhh6igah1ok" +path="res://.godot/imported/5.wav-2cd0baa0afa291660575e1fc431a6b91.sample" + +[deps] + +source_file="res://sound/dialogue/animalese/alphanumeric/5.wav" +dest_files=["res://.godot/imported/5.wav-2cd0baa0afa291660575e1fc431a6b91.sample"] + +[params] + +force/8_bit=false +force/mono=false +force/max_rate=false +force/max_rate_hz=44100 +edit/trim=false +edit/normalize=false +edit/loop_mode=0 +edit/loop_begin=0 +edit/loop_end=-1 +compress/mode=2 diff --git a/sound/dialogue/animalese/alphanumeric/6.wav b/sound/dialogue/animalese/alphanumeric/6.wav new file mode 100644 index 0000000..41154f8 Binary files /dev/null and b/sound/dialogue/animalese/alphanumeric/6.wav differ diff --git a/sound/dialogue/animalese/alphanumeric/6.wav.import b/sound/dialogue/animalese/alphanumeric/6.wav.import new file mode 100644 index 0000000..4cb51b2 --- /dev/null +++ b/sound/dialogue/animalese/alphanumeric/6.wav.import @@ -0,0 +1,24 @@ +[remap] + +importer="wav" +type="AudioStreamWAV" +uid="uid://cqsddej565w48" +path="res://.godot/imported/6.wav-8c88e3785af1748d3cc8334b825655e1.sample" + +[deps] + +source_file="res://sound/dialogue/animalese/alphanumeric/6.wav" +dest_files=["res://.godot/imported/6.wav-8c88e3785af1748d3cc8334b825655e1.sample"] + +[params] + +force/8_bit=false +force/mono=false +force/max_rate=false +force/max_rate_hz=44100 +edit/trim=false +edit/normalize=false +edit/loop_mode=0 +edit/loop_begin=0 +edit/loop_end=-1 +compress/mode=2 diff --git a/sound/dialogue/animalese/alphanumeric/7.wav b/sound/dialogue/animalese/alphanumeric/7.wav new file mode 100644 index 0000000..e732f42 Binary files /dev/null and b/sound/dialogue/animalese/alphanumeric/7.wav differ diff --git a/sound/dialogue/animalese/alphanumeric/7.wav.import b/sound/dialogue/animalese/alphanumeric/7.wav.import new file mode 100644 index 0000000..7ed72ee --- /dev/null +++ b/sound/dialogue/animalese/alphanumeric/7.wav.import @@ -0,0 +1,24 @@ +[remap] + +importer="wav" +type="AudioStreamWAV" +uid="uid://de5lwv3vtq4jo" +path="res://.godot/imported/7.wav-aa6620dad62f7a8fa68ac3dfe0e8bce0.sample" + +[deps] + +source_file="res://sound/dialogue/animalese/alphanumeric/7.wav" +dest_files=["res://.godot/imported/7.wav-aa6620dad62f7a8fa68ac3dfe0e8bce0.sample"] + +[params] + +force/8_bit=false +force/mono=false +force/max_rate=false +force/max_rate_hz=44100 +edit/trim=false +edit/normalize=false +edit/loop_mode=0 +edit/loop_begin=0 +edit/loop_end=-1 +compress/mode=2 diff --git a/sound/dialogue/animalese/alphanumeric/8.wav b/sound/dialogue/animalese/alphanumeric/8.wav new file mode 100644 index 0000000..2779375 Binary files /dev/null and b/sound/dialogue/animalese/alphanumeric/8.wav differ diff --git a/sound/dialogue/animalese/alphanumeric/8.wav.import b/sound/dialogue/animalese/alphanumeric/8.wav.import new file mode 100644 index 0000000..4733d6c --- /dev/null +++ b/sound/dialogue/animalese/alphanumeric/8.wav.import @@ -0,0 +1,24 @@ +[remap] + +importer="wav" +type="AudioStreamWAV" +uid="uid://lsklvocqcohu" +path="res://.godot/imported/8.wav-ee305634b68bbc3c852777570ad90d81.sample" + +[deps] + +source_file="res://sound/dialogue/animalese/alphanumeric/8.wav" +dest_files=["res://.godot/imported/8.wav-ee305634b68bbc3c852777570ad90d81.sample"] + +[params] + +force/8_bit=false +force/mono=false +force/max_rate=false +force/max_rate_hz=44100 +edit/trim=false +edit/normalize=false +edit/loop_mode=0 +edit/loop_begin=0 +edit/loop_end=-1 +compress/mode=2 diff --git a/sound/dialogue/animalese/alphanumeric/9.wav b/sound/dialogue/animalese/alphanumeric/9.wav new file mode 100644 index 0000000..644d326 Binary files /dev/null and b/sound/dialogue/animalese/alphanumeric/9.wav differ diff --git a/sound/dialogue/animalese/alphanumeric/9.wav.import b/sound/dialogue/animalese/alphanumeric/9.wav.import new file mode 100644 index 0000000..06be5cb --- /dev/null +++ b/sound/dialogue/animalese/alphanumeric/9.wav.import @@ -0,0 +1,24 @@ +[remap] + +importer="wav" +type="AudioStreamWAV" +uid="uid://cuwg5n2w8trdf" +path="res://.godot/imported/9.wav-2dbc1a5726fda3c5d3e5b8a5c940e14e.sample" + +[deps] + +source_file="res://sound/dialogue/animalese/alphanumeric/9.wav" +dest_files=["res://.godot/imported/9.wav-2dbc1a5726fda3c5d3e5b8a5c940e14e.sample"] + +[params] + +force/8_bit=false +force/mono=false +force/max_rate=false +force/max_rate_hz=44100 +edit/trim=false +edit/normalize=false +edit/loop_mode=0 +edit/loop_begin=0 +edit/loop_end=-1 +compress/mode=2 diff --git a/sound/dialogue/animalese/alphanumeric/a.wav b/sound/dialogue/animalese/alphanumeric/a.wav new file mode 100644 index 0000000..cd50a8b Binary files /dev/null and b/sound/dialogue/animalese/alphanumeric/a.wav differ diff --git a/sound/dialogue/animalese/placeholder/x.wav.import b/sound/dialogue/animalese/alphanumeric/a.wav.import similarity index 52% rename from sound/dialogue/animalese/placeholder/x.wav.import rename to sound/dialogue/animalese/alphanumeric/a.wav.import index c91ffb4..f058d25 100644 --- a/sound/dialogue/animalese/placeholder/x.wav.import +++ b/sound/dialogue/animalese/alphanumeric/a.wav.import @@ -2,13 +2,13 @@ importer="wav" type="AudioStreamWAV" -uid="uid://b5al0m4de1m5x" -path="res://.godot/imported/x.wav-b1beaddcc7d6663882ddd8b86e65db56.sample" +uid="uid://dnnf2sfntra41" +path="res://.godot/imported/a.wav-07b66f5c4c337a0412ac22c096725756.sample" [deps] -source_file="res://sound/dialogue/animalese/placeholder/x.wav" -dest_files=["res://.godot/imported/x.wav-b1beaddcc7d6663882ddd8b86e65db56.sample"] +source_file="res://sound/dialogue/animalese/alphanumeric/a.wav" +dest_files=["res://.godot/imported/a.wav-07b66f5c4c337a0412ac22c096725756.sample"] [params] diff --git a/sound/dialogue/animalese/alphanumeric/b.wav b/sound/dialogue/animalese/alphanumeric/b.wav new file mode 100644 index 0000000..56c49e2 Binary files /dev/null and b/sound/dialogue/animalese/alphanumeric/b.wav differ diff --git a/sound/dialogue/animalese/alphanumeric/b.wav.import b/sound/dialogue/animalese/alphanumeric/b.wav.import new file mode 100644 index 0000000..82c50e4 --- /dev/null +++ b/sound/dialogue/animalese/alphanumeric/b.wav.import @@ -0,0 +1,24 @@ +[remap] + +importer="wav" +type="AudioStreamWAV" +uid="uid://cxueylrkf0358" +path="res://.godot/imported/b.wav-4eb4b2c71e0d5f50efbe3fc8793801e4.sample" + +[deps] + +source_file="res://sound/dialogue/animalese/alphanumeric/b.wav" +dest_files=["res://.godot/imported/b.wav-4eb4b2c71e0d5f50efbe3fc8793801e4.sample"] + +[params] + +force/8_bit=false +force/mono=false +force/max_rate=false +force/max_rate_hz=44100 +edit/trim=false +edit/normalize=false +edit/loop_mode=0 +edit/loop_begin=0 +edit/loop_end=-1 +compress/mode=2 diff --git a/sound/dialogue/animalese/alphanumeric/c.wav b/sound/dialogue/animalese/alphanumeric/c.wav new file mode 100644 index 0000000..6531a4a Binary files /dev/null and b/sound/dialogue/animalese/alphanumeric/c.wav differ diff --git a/sound/dialogue/animalese/alphanumeric/c.wav.import b/sound/dialogue/animalese/alphanumeric/c.wav.import new file mode 100644 index 0000000..5fc9844 --- /dev/null +++ b/sound/dialogue/animalese/alphanumeric/c.wav.import @@ -0,0 +1,24 @@ +[remap] + +importer="wav" +type="AudioStreamWAV" +uid="uid://cbwe5uie8fa6k" +path="res://.godot/imported/c.wav-86a3dcc44eaabde775a8efc14c630f27.sample" + +[deps] + +source_file="res://sound/dialogue/animalese/alphanumeric/c.wav" +dest_files=["res://.godot/imported/c.wav-86a3dcc44eaabde775a8efc14c630f27.sample"] + +[params] + +force/8_bit=false +force/mono=false +force/max_rate=false +force/max_rate_hz=44100 +edit/trim=false +edit/normalize=false +edit/loop_mode=0 +edit/loop_begin=0 +edit/loop_end=-1 +compress/mode=2 diff --git a/sound/dialogue/animalese/alphanumeric/d.wav b/sound/dialogue/animalese/alphanumeric/d.wav new file mode 100644 index 0000000..3838dd7 Binary files /dev/null and b/sound/dialogue/animalese/alphanumeric/d.wav differ diff --git a/sound/dialogue/animalese/alphanumeric/d.wav.import b/sound/dialogue/animalese/alphanumeric/d.wav.import new file mode 100644 index 0000000..c58cbf9 --- /dev/null +++ b/sound/dialogue/animalese/alphanumeric/d.wav.import @@ -0,0 +1,24 @@ +[remap] + +importer="wav" +type="AudioStreamWAV" +uid="uid://yyr410g00p5p" +path="res://.godot/imported/d.wav-5577435bb675e68970dd9de887fff671.sample" + +[deps] + +source_file="res://sound/dialogue/animalese/alphanumeric/d.wav" +dest_files=["res://.godot/imported/d.wav-5577435bb675e68970dd9de887fff671.sample"] + +[params] + +force/8_bit=false +force/mono=false +force/max_rate=false +force/max_rate_hz=44100 +edit/trim=false +edit/normalize=false +edit/loop_mode=0 +edit/loop_begin=0 +edit/loop_end=-1 +compress/mode=2 diff --git a/sound/dialogue/animalese/alphanumeric/e.wav b/sound/dialogue/animalese/alphanumeric/e.wav new file mode 100644 index 0000000..8ba7d24 Binary files /dev/null and b/sound/dialogue/animalese/alphanumeric/e.wav differ diff --git a/sound/dialogue/animalese/alphanumeric/e.wav.import b/sound/dialogue/animalese/alphanumeric/e.wav.import new file mode 100644 index 0000000..8d384a2 --- /dev/null +++ b/sound/dialogue/animalese/alphanumeric/e.wav.import @@ -0,0 +1,24 @@ +[remap] + +importer="wav" +type="AudioStreamWAV" +uid="uid://cp6stdrpayltv" +path="res://.godot/imported/e.wav-6373ce27ee05eb89c9d510ca465a24d1.sample" + +[deps] + +source_file="res://sound/dialogue/animalese/alphanumeric/e.wav" +dest_files=["res://.godot/imported/e.wav-6373ce27ee05eb89c9d510ca465a24d1.sample"] + +[params] + +force/8_bit=false +force/mono=false +force/max_rate=false +force/max_rate_hz=44100 +edit/trim=false +edit/normalize=false +edit/loop_mode=0 +edit/loop_begin=0 +edit/loop_end=-1 +compress/mode=2 diff --git a/sound/dialogue/animalese/alphanumeric/f.wav b/sound/dialogue/animalese/alphanumeric/f.wav new file mode 100644 index 0000000..0ec0644 Binary files /dev/null and b/sound/dialogue/animalese/alphanumeric/f.wav differ diff --git a/sound/dialogue/animalese/placeholder/f.wav.import b/sound/dialogue/animalese/alphanumeric/f.wav.import similarity index 50% rename from sound/dialogue/animalese/placeholder/f.wav.import rename to sound/dialogue/animalese/alphanumeric/f.wav.import index dc85ee3..fdc83d0 100644 --- a/sound/dialogue/animalese/placeholder/f.wav.import +++ b/sound/dialogue/animalese/alphanumeric/f.wav.import @@ -2,13 +2,13 @@ importer="wav" type="AudioStreamWAV" -uid="uid://c0gv4cphnfcxf" -path="res://.godot/imported/f.wav-8eb31f2de6240647a0d6d2520aadcd6a.sample" +uid="uid://bc1lj4kba0fr1" +path="res://.godot/imported/f.wav-637c7bb130969a55972a1c232962cb40.sample" [deps] -source_file="res://sound/dialogue/animalese/placeholder/f.wav" -dest_files=["res://.godot/imported/f.wav-8eb31f2de6240647a0d6d2520aadcd6a.sample"] +source_file="res://sound/dialogue/animalese/alphanumeric/f.wav" +dest_files=["res://.godot/imported/f.wav-637c7bb130969a55972a1c232962cb40.sample"] [params] diff --git a/sound/dialogue/animalese/alphanumeric/g.wav b/sound/dialogue/animalese/alphanumeric/g.wav new file mode 100644 index 0000000..c942d53 Binary files /dev/null and b/sound/dialogue/animalese/alphanumeric/g.wav differ diff --git a/sound/dialogue/animalese/placeholder/g.wav.import b/sound/dialogue/animalese/alphanumeric/g.wav.import similarity index 50% rename from sound/dialogue/animalese/placeholder/g.wav.import rename to sound/dialogue/animalese/alphanumeric/g.wav.import index 1709852..f643d8d 100644 --- a/sound/dialogue/animalese/placeholder/g.wav.import +++ b/sound/dialogue/animalese/alphanumeric/g.wav.import @@ -2,13 +2,13 @@ importer="wav" type="AudioStreamWAV" -uid="uid://c7706p0fc8y7c" -path="res://.godot/imported/g.wav-45b2cbd9653a31477e3f00c9432d560c.sample" +uid="uid://6k1d81vrewm7" +path="res://.godot/imported/g.wav-73da4ecac29d03a5e0c1bb2463bcb6cb.sample" [deps] -source_file="res://sound/dialogue/animalese/placeholder/g.wav" -dest_files=["res://.godot/imported/g.wav-45b2cbd9653a31477e3f00c9432d560c.sample"] +source_file="res://sound/dialogue/animalese/alphanumeric/g.wav" +dest_files=["res://.godot/imported/g.wav-73da4ecac29d03a5e0c1bb2463bcb6cb.sample"] [params] diff --git a/sound/dialogue/animalese/alphanumeric/h.wav b/sound/dialogue/animalese/alphanumeric/h.wav new file mode 100644 index 0000000..545915f Binary files /dev/null and b/sound/dialogue/animalese/alphanumeric/h.wav differ diff --git a/sound/dialogue/animalese/placeholder/h.wav.import b/sound/dialogue/animalese/alphanumeric/h.wav.import similarity index 50% rename from sound/dialogue/animalese/placeholder/h.wav.import rename to sound/dialogue/animalese/alphanumeric/h.wav.import index 96b2359..c33b3bf 100644 --- a/sound/dialogue/animalese/placeholder/h.wav.import +++ b/sound/dialogue/animalese/alphanumeric/h.wav.import @@ -2,13 +2,13 @@ importer="wav" type="AudioStreamWAV" -uid="uid://cl66wka105xmo" -path="res://.godot/imported/h.wav-2da53a6638eebb75f0867eaf75dc24ba.sample" +uid="uid://boatg77atys5a" +path="res://.godot/imported/h.wav-44456bd4f004ee75088b13cb2069e3fb.sample" [deps] -source_file="res://sound/dialogue/animalese/placeholder/h.wav" -dest_files=["res://.godot/imported/h.wav-2da53a6638eebb75f0867eaf75dc24ba.sample"] +source_file="res://sound/dialogue/animalese/alphanumeric/h.wav" +dest_files=["res://.godot/imported/h.wav-44456bd4f004ee75088b13cb2069e3fb.sample"] [params] diff --git a/sound/dialogue/animalese/alphanumeric/i.wav b/sound/dialogue/animalese/alphanumeric/i.wav new file mode 100644 index 0000000..f464cbc Binary files /dev/null and b/sound/dialogue/animalese/alphanumeric/i.wav differ diff --git a/sound/dialogue/animalese/alphanumeric/i.wav.import b/sound/dialogue/animalese/alphanumeric/i.wav.import new file mode 100644 index 0000000..51b5c36 --- /dev/null +++ b/sound/dialogue/animalese/alphanumeric/i.wav.import @@ -0,0 +1,24 @@ +[remap] + +importer="wav" +type="AudioStreamWAV" +uid="uid://cvru47ct1d7mj" +path="res://.godot/imported/i.wav-8ce67b78d17a9ac111433177c3ed850b.sample" + +[deps] + +source_file="res://sound/dialogue/animalese/alphanumeric/i.wav" +dest_files=["res://.godot/imported/i.wav-8ce67b78d17a9ac111433177c3ed850b.sample"] + +[params] + +force/8_bit=false +force/mono=false +force/max_rate=false +force/max_rate_hz=44100 +edit/trim=false +edit/normalize=false +edit/loop_mode=0 +edit/loop_begin=0 +edit/loop_end=-1 +compress/mode=2 diff --git a/sound/dialogue/animalese/alphanumeric/j.wav b/sound/dialogue/animalese/alphanumeric/j.wav new file mode 100644 index 0000000..1381026 Binary files /dev/null and b/sound/dialogue/animalese/alphanumeric/j.wav differ diff --git a/sound/dialogue/animalese/placeholder/i.wav.import b/sound/dialogue/animalese/alphanumeric/j.wav.import similarity index 52% rename from sound/dialogue/animalese/placeholder/i.wav.import rename to sound/dialogue/animalese/alphanumeric/j.wav.import index 0c11fd6..83202fe 100644 --- a/sound/dialogue/animalese/placeholder/i.wav.import +++ b/sound/dialogue/animalese/alphanumeric/j.wav.import @@ -2,13 +2,13 @@ importer="wav" type="AudioStreamWAV" -uid="uid://jicgdbnyt6bm" -path="res://.godot/imported/i.wav-1e8d7f13980a6f2f61d73f65a2efc91c.sample" +uid="uid://dwi1wq2dyli5y" +path="res://.godot/imported/j.wav-c07aa6b0f20fa8fcc89a706a3391c11c.sample" [deps] -source_file="res://sound/dialogue/animalese/placeholder/i.wav" -dest_files=["res://.godot/imported/i.wav-1e8d7f13980a6f2f61d73f65a2efc91c.sample"] +source_file="res://sound/dialogue/animalese/alphanumeric/j.wav" +dest_files=["res://.godot/imported/j.wav-c07aa6b0f20fa8fcc89a706a3391c11c.sample"] [params] diff --git a/sound/dialogue/animalese/alphanumeric/k.wav b/sound/dialogue/animalese/alphanumeric/k.wav new file mode 100644 index 0000000..3995b27 Binary files /dev/null and b/sound/dialogue/animalese/alphanumeric/k.wav differ diff --git a/sound/dialogue/animalese/alphanumeric/k.wav.import b/sound/dialogue/animalese/alphanumeric/k.wav.import new file mode 100644 index 0000000..8cbff42 --- /dev/null +++ b/sound/dialogue/animalese/alphanumeric/k.wav.import @@ -0,0 +1,24 @@ +[remap] + +importer="wav" +type="AudioStreamWAV" +uid="uid://6dkc31pv1ey1" +path="res://.godot/imported/k.wav-c6fde0aff33080ec99703bdd4fa87e80.sample" + +[deps] + +source_file="res://sound/dialogue/animalese/alphanumeric/k.wav" +dest_files=["res://.godot/imported/k.wav-c6fde0aff33080ec99703bdd4fa87e80.sample"] + +[params] + +force/8_bit=false +force/mono=false +force/max_rate=false +force/max_rate_hz=44100 +edit/trim=false +edit/normalize=false +edit/loop_mode=0 +edit/loop_begin=0 +edit/loop_end=-1 +compress/mode=2 diff --git a/sound/dialogue/animalese/alphanumeric/l.wav b/sound/dialogue/animalese/alphanumeric/l.wav new file mode 100644 index 0000000..e0f7ae7 Binary files /dev/null and b/sound/dialogue/animalese/alphanumeric/l.wav differ diff --git a/sound/dialogue/animalese/alphanumeric/l.wav.import b/sound/dialogue/animalese/alphanumeric/l.wav.import new file mode 100644 index 0000000..8c05113 --- /dev/null +++ b/sound/dialogue/animalese/alphanumeric/l.wav.import @@ -0,0 +1,24 @@ +[remap] + +importer="wav" +type="AudioStreamWAV" +uid="uid://d2o1hk6e4bbss" +path="res://.godot/imported/l.wav-722141f795e13543172ffd960308b24c.sample" + +[deps] + +source_file="res://sound/dialogue/animalese/alphanumeric/l.wav" +dest_files=["res://.godot/imported/l.wav-722141f795e13543172ffd960308b24c.sample"] + +[params] + +force/8_bit=false +force/mono=false +force/max_rate=false +force/max_rate_hz=44100 +edit/trim=false +edit/normalize=false +edit/loop_mode=0 +edit/loop_begin=0 +edit/loop_end=-1 +compress/mode=2 diff --git a/sound/dialogue/animalese/alphanumeric/m.wav b/sound/dialogue/animalese/alphanumeric/m.wav new file mode 100644 index 0000000..6ea69d4 Binary files /dev/null and b/sound/dialogue/animalese/alphanumeric/m.wav differ diff --git a/sound/dialogue/animalese/placeholder/m.wav.import b/sound/dialogue/animalese/alphanumeric/m.wav.import similarity index 50% rename from sound/dialogue/animalese/placeholder/m.wav.import rename to sound/dialogue/animalese/alphanumeric/m.wav.import index 2a2439b..c5f005b 100644 --- a/sound/dialogue/animalese/placeholder/m.wav.import +++ b/sound/dialogue/animalese/alphanumeric/m.wav.import @@ -2,13 +2,13 @@ importer="wav" type="AudioStreamWAV" -uid="uid://dan4o17oreugv" -path="res://.godot/imported/m.wav-aa394c4b1d5309d859ce73a368754264.sample" +uid="uid://c588ew7t8dwse" +path="res://.godot/imported/m.wav-2ad62bfb1ad90a0667f708c5154de5dc.sample" [deps] -source_file="res://sound/dialogue/animalese/placeholder/m.wav" -dest_files=["res://.godot/imported/m.wav-aa394c4b1d5309d859ce73a368754264.sample"] +source_file="res://sound/dialogue/animalese/alphanumeric/m.wav" +dest_files=["res://.godot/imported/m.wav-2ad62bfb1ad90a0667f708c5154de5dc.sample"] [params] diff --git a/sound/dialogue/animalese/alphanumeric/n.wav b/sound/dialogue/animalese/alphanumeric/n.wav new file mode 100644 index 0000000..636914e Binary files /dev/null and b/sound/dialogue/animalese/alphanumeric/n.wav differ diff --git a/sound/dialogue/animalese/placeholder/n.wav.import b/sound/dialogue/animalese/alphanumeric/n.wav.import similarity index 50% rename from sound/dialogue/animalese/placeholder/n.wav.import rename to sound/dialogue/animalese/alphanumeric/n.wav.import index f5e432c..455c90b 100644 --- a/sound/dialogue/animalese/placeholder/n.wav.import +++ b/sound/dialogue/animalese/alphanumeric/n.wav.import @@ -2,13 +2,13 @@ importer="wav" type="AudioStreamWAV" -uid="uid://dxup6pw80km61" -path="res://.godot/imported/n.wav-84e9a6fa6664222868d647187a09f374.sample" +uid="uid://mc1vnfuhpuwr" +path="res://.godot/imported/n.wav-b995292a9ce9755047a5a6a6166a4a4c.sample" [deps] -source_file="res://sound/dialogue/animalese/placeholder/n.wav" -dest_files=["res://.godot/imported/n.wav-84e9a6fa6664222868d647187a09f374.sample"] +source_file="res://sound/dialogue/animalese/alphanumeric/n.wav" +dest_files=["res://.godot/imported/n.wav-b995292a9ce9755047a5a6a6166a4a4c.sample"] [params] diff --git a/sound/dialogue/animalese/alphanumeric/o.wav b/sound/dialogue/animalese/alphanumeric/o.wav new file mode 100644 index 0000000..0161399 Binary files /dev/null and b/sound/dialogue/animalese/alphanumeric/o.wav differ diff --git a/sound/dialogue/animalese/alphanumeric/o.wav.import b/sound/dialogue/animalese/alphanumeric/o.wav.import new file mode 100644 index 0000000..655e8fe --- /dev/null +++ b/sound/dialogue/animalese/alphanumeric/o.wav.import @@ -0,0 +1,24 @@ +[remap] + +importer="wav" +type="AudioStreamWAV" +uid="uid://rkmixmwg8vgp" +path="res://.godot/imported/o.wav-696f77252311afda46e416ece590eb55.sample" + +[deps] + +source_file="res://sound/dialogue/animalese/alphanumeric/o.wav" +dest_files=["res://.godot/imported/o.wav-696f77252311afda46e416ece590eb55.sample"] + +[params] + +force/8_bit=false +force/mono=false +force/max_rate=false +force/max_rate_hz=44100 +edit/trim=false +edit/normalize=false +edit/loop_mode=0 +edit/loop_begin=0 +edit/loop_end=-1 +compress/mode=2 diff --git a/sound/dialogue/animalese/alphanumeric/p.wav b/sound/dialogue/animalese/alphanumeric/p.wav new file mode 100644 index 0000000..99bf4fd Binary files /dev/null and b/sound/dialogue/animalese/alphanumeric/p.wav differ diff --git a/sound/dialogue/animalese/placeholder/p.wav.import b/sound/dialogue/animalese/alphanumeric/p.wav.import similarity index 50% rename from sound/dialogue/animalese/placeholder/p.wav.import rename to sound/dialogue/animalese/alphanumeric/p.wav.import index a431c1f..96ae91b 100644 --- a/sound/dialogue/animalese/placeholder/p.wav.import +++ b/sound/dialogue/animalese/alphanumeric/p.wav.import @@ -2,13 +2,13 @@ importer="wav" type="AudioStreamWAV" -uid="uid://crubsdrd220eh" -path="res://.godot/imported/p.wav-c32b759c822f258d8d947827adf8127a.sample" +uid="uid://blbcb70gci0q2" +path="res://.godot/imported/p.wav-bc58581e4a5d8761e1c8b91f069f951d.sample" [deps] -source_file="res://sound/dialogue/animalese/placeholder/p.wav" -dest_files=["res://.godot/imported/p.wav-c32b759c822f258d8d947827adf8127a.sample"] +source_file="res://sound/dialogue/animalese/alphanumeric/p.wav" +dest_files=["res://.godot/imported/p.wav-bc58581e4a5d8761e1c8b91f069f951d.sample"] [params] diff --git a/sound/dialogue/animalese/alphanumeric/q.wav b/sound/dialogue/animalese/alphanumeric/q.wav new file mode 100644 index 0000000..80562cc Binary files /dev/null and b/sound/dialogue/animalese/alphanumeric/q.wav differ diff --git a/sound/dialogue/animalese/placeholder/q.wav.import b/sound/dialogue/animalese/alphanumeric/q.wav.import similarity index 50% rename from sound/dialogue/animalese/placeholder/q.wav.import rename to sound/dialogue/animalese/alphanumeric/q.wav.import index 574c906..896c936 100644 --- a/sound/dialogue/animalese/placeholder/q.wav.import +++ b/sound/dialogue/animalese/alphanumeric/q.wav.import @@ -2,13 +2,13 @@ importer="wav" type="AudioStreamWAV" -uid="uid://ct0decr76agoq" -path="res://.godot/imported/q.wav-d494b927c6f2b8bfbaa44d1f81887731.sample" +uid="uid://bmu30s0vscbvg" +path="res://.godot/imported/q.wav-b9d907f73d4a59dd6641ffe35c36aaac.sample" [deps] -source_file="res://sound/dialogue/animalese/placeholder/q.wav" -dest_files=["res://.godot/imported/q.wav-d494b927c6f2b8bfbaa44d1f81887731.sample"] +source_file="res://sound/dialogue/animalese/alphanumeric/q.wav" +dest_files=["res://.godot/imported/q.wav-b9d907f73d4a59dd6641ffe35c36aaac.sample"] [params] diff --git a/sound/dialogue/animalese/alphanumeric/r.wav b/sound/dialogue/animalese/alphanumeric/r.wav new file mode 100644 index 0000000..b38b3a8 Binary files /dev/null and b/sound/dialogue/animalese/alphanumeric/r.wav differ diff --git a/sound/dialogue/animalese/placeholder/r.wav.import b/sound/dialogue/animalese/alphanumeric/r.wav.import similarity index 50% rename from sound/dialogue/animalese/placeholder/r.wav.import rename to sound/dialogue/animalese/alphanumeric/r.wav.import index 1f196b1..3007c69 100644 --- a/sound/dialogue/animalese/placeholder/r.wav.import +++ b/sound/dialogue/animalese/alphanumeric/r.wav.import @@ -2,13 +2,13 @@ importer="wav" type="AudioStreamWAV" -uid="uid://dpq7rin4pr1n3" -path="res://.godot/imported/r.wav-d1d419e3246c0e918ff51a9dd662a742.sample" +uid="uid://bgdec44ic6msd" +path="res://.godot/imported/r.wav-d5ea52bfff9160d4d25d74dd94072208.sample" [deps] -source_file="res://sound/dialogue/animalese/placeholder/r.wav" -dest_files=["res://.godot/imported/r.wav-d1d419e3246c0e918ff51a9dd662a742.sample"] +source_file="res://sound/dialogue/animalese/alphanumeric/r.wav" +dest_files=["res://.godot/imported/r.wav-d5ea52bfff9160d4d25d74dd94072208.sample"] [params] diff --git a/sound/dialogue/animalese/alphanumeric/s.wav b/sound/dialogue/animalese/alphanumeric/s.wav new file mode 100644 index 0000000..8ba7d24 Binary files /dev/null and b/sound/dialogue/animalese/alphanumeric/s.wav differ diff --git a/sound/dialogue/animalese/alphanumeric/s.wav.import b/sound/dialogue/animalese/alphanumeric/s.wav.import new file mode 100644 index 0000000..c48dad9 --- /dev/null +++ b/sound/dialogue/animalese/alphanumeric/s.wav.import @@ -0,0 +1,24 @@ +[remap] + +importer="wav" +type="AudioStreamWAV" +uid="uid://draie1dh0muw" +path="res://.godot/imported/s.wav-0dfb29a8b9a3bf4890d24e227cd0d0c4.sample" + +[deps] + +source_file="res://sound/dialogue/animalese/alphanumeric/s.wav" +dest_files=["res://.godot/imported/s.wav-0dfb29a8b9a3bf4890d24e227cd0d0c4.sample"] + +[params] + +force/8_bit=false +force/mono=false +force/max_rate=false +force/max_rate_hz=44100 +edit/trim=false +edit/normalize=false +edit/loop_mode=0 +edit/loop_begin=0 +edit/loop_end=-1 +compress/mode=2 diff --git a/sound/dialogue/animalese/alphanumeric/t.wav b/sound/dialogue/animalese/alphanumeric/t.wav new file mode 100644 index 0000000..f34aa5d Binary files /dev/null and b/sound/dialogue/animalese/alphanumeric/t.wav differ diff --git a/sound/dialogue/animalese/alphanumeric/t.wav.import b/sound/dialogue/animalese/alphanumeric/t.wav.import new file mode 100644 index 0000000..cd55195 --- /dev/null +++ b/sound/dialogue/animalese/alphanumeric/t.wav.import @@ -0,0 +1,24 @@ +[remap] + +importer="wav" +type="AudioStreamWAV" +uid="uid://ybmvcpv7prx" +path="res://.godot/imported/t.wav-d4e7e7dbe4c04e54e9c7edb0d85af81a.sample" + +[deps] + +source_file="res://sound/dialogue/animalese/alphanumeric/t.wav" +dest_files=["res://.godot/imported/t.wav-d4e7e7dbe4c04e54e9c7edb0d85af81a.sample"] + +[params] + +force/8_bit=false +force/mono=false +force/max_rate=false +force/max_rate_hz=44100 +edit/trim=false +edit/normalize=false +edit/loop_mode=0 +edit/loop_begin=0 +edit/loop_end=-1 +compress/mode=2 diff --git a/sound/dialogue/animalese/alphanumeric/u.wav b/sound/dialogue/animalese/alphanumeric/u.wav new file mode 100644 index 0000000..c41b3fc Binary files /dev/null and b/sound/dialogue/animalese/alphanumeric/u.wav differ diff --git a/sound/dialogue/animalese/placeholder/t.wav.import b/sound/dialogue/animalese/alphanumeric/u.wav.import similarity index 52% rename from sound/dialogue/animalese/placeholder/t.wav.import rename to sound/dialogue/animalese/alphanumeric/u.wav.import index ce35ba2..27b2e8b 100644 --- a/sound/dialogue/animalese/placeholder/t.wav.import +++ b/sound/dialogue/animalese/alphanumeric/u.wav.import @@ -2,13 +2,13 @@ importer="wav" type="AudioStreamWAV" -uid="uid://dr0dp5v8fdb8r" -path="res://.godot/imported/t.wav-3a26c5be0f8e3007adf1daa05a6a1ea2.sample" +uid="uid://dn0hxgm1ueiv7" +path="res://.godot/imported/u.wav-b8a534783b71ec701bb0925308d513a2.sample" [deps] -source_file="res://sound/dialogue/animalese/placeholder/t.wav" -dest_files=["res://.godot/imported/t.wav-3a26c5be0f8e3007adf1daa05a6a1ea2.sample"] +source_file="res://sound/dialogue/animalese/alphanumeric/u.wav" +dest_files=["res://.godot/imported/u.wav-b8a534783b71ec701bb0925308d513a2.sample"] [params] diff --git a/sound/dialogue/animalese/alphanumeric/v.wav b/sound/dialogue/animalese/alphanumeric/v.wav new file mode 100644 index 0000000..78b81f9 Binary files /dev/null and b/sound/dialogue/animalese/alphanumeric/v.wav differ diff --git a/sound/dialogue/animalese/alphanumeric/v.wav.import b/sound/dialogue/animalese/alphanumeric/v.wav.import new file mode 100644 index 0000000..294b852 --- /dev/null +++ b/sound/dialogue/animalese/alphanumeric/v.wav.import @@ -0,0 +1,24 @@ +[remap] + +importer="wav" +type="AudioStreamWAV" +uid="uid://c5p70bkanhlua" +path="res://.godot/imported/v.wav-0dc1396f424599662d6812e2e59a3b71.sample" + +[deps] + +source_file="res://sound/dialogue/animalese/alphanumeric/v.wav" +dest_files=["res://.godot/imported/v.wav-0dc1396f424599662d6812e2e59a3b71.sample"] + +[params] + +force/8_bit=false +force/mono=false +force/max_rate=false +force/max_rate_hz=44100 +edit/trim=false +edit/normalize=false +edit/loop_mode=0 +edit/loop_begin=0 +edit/loop_end=-1 +compress/mode=2 diff --git a/sound/dialogue/animalese/alphanumeric/w.wav b/sound/dialogue/animalese/alphanumeric/w.wav new file mode 100644 index 0000000..26cbdc9 Binary files /dev/null and b/sound/dialogue/animalese/alphanumeric/w.wav differ diff --git a/sound/dialogue/animalese/alphanumeric/w.wav.import b/sound/dialogue/animalese/alphanumeric/w.wav.import new file mode 100644 index 0000000..5c13da4 --- /dev/null +++ b/sound/dialogue/animalese/alphanumeric/w.wav.import @@ -0,0 +1,24 @@ +[remap] + +importer="wav" +type="AudioStreamWAV" +uid="uid://dr2025tcuq5lq" +path="res://.godot/imported/w.wav-caf9c9b3fa280c326a6be0c426672562.sample" + +[deps] + +source_file="res://sound/dialogue/animalese/alphanumeric/w.wav" +dest_files=["res://.godot/imported/w.wav-caf9c9b3fa280c326a6be0c426672562.sample"] + +[params] + +force/8_bit=false +force/mono=false +force/max_rate=false +force/max_rate_hz=44100 +edit/trim=false +edit/normalize=false +edit/loop_mode=0 +edit/loop_begin=0 +edit/loop_end=-1 +compress/mode=2 diff --git a/sound/dialogue/animalese/alphanumeric/x.wav b/sound/dialogue/animalese/alphanumeric/x.wav new file mode 100644 index 0000000..fa020f7 Binary files /dev/null and b/sound/dialogue/animalese/alphanumeric/x.wav differ diff --git a/sound/dialogue/animalese/alphanumeric/x.wav.import b/sound/dialogue/animalese/alphanumeric/x.wav.import new file mode 100644 index 0000000..95a6a8e --- /dev/null +++ b/sound/dialogue/animalese/alphanumeric/x.wav.import @@ -0,0 +1,24 @@ +[remap] + +importer="wav" +type="AudioStreamWAV" +uid="uid://c2c6lwmfogv1o" +path="res://.godot/imported/x.wav-6dec8d5d6aa916173970737d9db8f509.sample" + +[deps] + +source_file="res://sound/dialogue/animalese/alphanumeric/x.wav" +dest_files=["res://.godot/imported/x.wav-6dec8d5d6aa916173970737d9db8f509.sample"] + +[params] + +force/8_bit=false +force/mono=false +force/max_rate=false +force/max_rate_hz=44100 +edit/trim=false +edit/normalize=false +edit/loop_mode=0 +edit/loop_begin=0 +edit/loop_end=-1 +compress/mode=2 diff --git a/sound/dialogue/animalese/alphanumeric/y.wav b/sound/dialogue/animalese/alphanumeric/y.wav new file mode 100644 index 0000000..3acdc45 Binary files /dev/null and b/sound/dialogue/animalese/alphanumeric/y.wav differ diff --git a/sound/dialogue/animalese/placeholder/y.wav.import b/sound/dialogue/animalese/alphanumeric/y.wav.import similarity index 50% rename from sound/dialogue/animalese/placeholder/y.wav.import rename to sound/dialogue/animalese/alphanumeric/y.wav.import index 2c7d8d3..72ebe0c 100644 --- a/sound/dialogue/animalese/placeholder/y.wav.import +++ b/sound/dialogue/animalese/alphanumeric/y.wav.import @@ -2,13 +2,13 @@ importer="wav" type="AudioStreamWAV" -uid="uid://c6hust77yamoe" -path="res://.godot/imported/y.wav-5ef178912b2921bb7c790b12e2e82337.sample" +uid="uid://csjurthefub6u" +path="res://.godot/imported/y.wav-82e4c89a86bc31782eaca5f5ee737bb1.sample" [deps] -source_file="res://sound/dialogue/animalese/placeholder/y.wav" -dest_files=["res://.godot/imported/y.wav-5ef178912b2921bb7c790b12e2e82337.sample"] +source_file="res://sound/dialogue/animalese/alphanumeric/y.wav" +dest_files=["res://.godot/imported/y.wav-82e4c89a86bc31782eaca5f5ee737bb1.sample"] [params] diff --git a/sound/dialogue/animalese/alphanumeric/z.wav b/sound/dialogue/animalese/alphanumeric/z.wav new file mode 100644 index 0000000..779e725 Binary files /dev/null and b/sound/dialogue/animalese/alphanumeric/z.wav differ diff --git a/sound/dialogue/animalese/alphanumeric/z.wav.import b/sound/dialogue/animalese/alphanumeric/z.wav.import new file mode 100644 index 0000000..b089115 --- /dev/null +++ b/sound/dialogue/animalese/alphanumeric/z.wav.import @@ -0,0 +1,24 @@ +[remap] + +importer="wav" +type="AudioStreamWAV" +uid="uid://bujyv5lsxarhr" +path="res://.godot/imported/z.wav-38cc5c83dca1b80b731d307651219c08.sample" + +[deps] + +source_file="res://sound/dialogue/animalese/alphanumeric/z.wav" +dest_files=["res://.godot/imported/z.wav-38cc5c83dca1b80b731d307651219c08.sample"] + +[params] + +force/8_bit=false +force/mono=false +force/max_rate=false +force/max_rate_hz=44100 +edit/trim=false +edit/normalize=false +edit/loop_mode=0 +edit/loop_begin=0 +edit/loop_end=-1 +compress/mode=2 diff --git a/sound/dialogue/animalese/kim/0.wav b/sound/dialogue/animalese/kim/0.wav new file mode 100644 index 0000000..ed9af43 Binary files /dev/null and b/sound/dialogue/animalese/kim/0.wav differ diff --git a/sound/dialogue/animalese/kim/0.wav.import b/sound/dialogue/animalese/kim/0.wav.import new file mode 100644 index 0000000..cc27672 --- /dev/null +++ b/sound/dialogue/animalese/kim/0.wav.import @@ -0,0 +1,24 @@ +[remap] + +importer="wav" +type="AudioStreamWAV" +uid="uid://w8wvtbsovk1y" +path="res://.godot/imported/0.wav-bbd392e8755139dca852d942c97afaa6.sample" + +[deps] + +source_file="res://sound/dialogue/animalese/kim/0.wav" +dest_files=["res://.godot/imported/0.wav-bbd392e8755139dca852d942c97afaa6.sample"] + +[params] + +force/8_bit=false +force/mono=false +force/max_rate=false +force/max_rate_hz=44100 +edit/trim=false +edit/normalize=false +edit/loop_mode=0 +edit/loop_begin=0 +edit/loop_end=-1 +compress/mode=2 diff --git a/sound/dialogue/animalese/kim/1.wav b/sound/dialogue/animalese/kim/1.wav new file mode 100644 index 0000000..102b4f8 Binary files /dev/null and b/sound/dialogue/animalese/kim/1.wav differ diff --git a/sound/dialogue/animalese/placeholder/s.wav.import b/sound/dialogue/animalese/kim/1.wav.import similarity index 52% rename from sound/dialogue/animalese/placeholder/s.wav.import rename to sound/dialogue/animalese/kim/1.wav.import index a794fdf..0169929 100644 --- a/sound/dialogue/animalese/placeholder/s.wav.import +++ b/sound/dialogue/animalese/kim/1.wav.import @@ -2,13 +2,13 @@ importer="wav" type="AudioStreamWAV" -uid="uid://c00meumj2blfa" -path="res://.godot/imported/s.wav-15abb20075aacc8d5fe95cd206ae25ce.sample" +uid="uid://cnny27n4wbk6s" +path="res://.godot/imported/1.wav-5303efd25be6d603f73c2c2d77759fce.sample" [deps] -source_file="res://sound/dialogue/animalese/placeholder/s.wav" -dest_files=["res://.godot/imported/s.wav-15abb20075aacc8d5fe95cd206ae25ce.sample"] +source_file="res://sound/dialogue/animalese/kim/1.wav" +dest_files=["res://.godot/imported/1.wav-5303efd25be6d603f73c2c2d77759fce.sample"] [params] diff --git a/sound/dialogue/animalese/kim/2.wav b/sound/dialogue/animalese/kim/2.wav new file mode 100644 index 0000000..5559b55 Binary files /dev/null and b/sound/dialogue/animalese/kim/2.wav differ diff --git a/sound/dialogue/animalese/kim/2.wav.import b/sound/dialogue/animalese/kim/2.wav.import new file mode 100644 index 0000000..26bb35a --- /dev/null +++ b/sound/dialogue/animalese/kim/2.wav.import @@ -0,0 +1,24 @@ +[remap] + +importer="wav" +type="AudioStreamWAV" +uid="uid://daw5c2h7p5yu6" +path="res://.godot/imported/2.wav-a384b25ebb56567742354475fa551c97.sample" + +[deps] + +source_file="res://sound/dialogue/animalese/kim/2.wav" +dest_files=["res://.godot/imported/2.wav-a384b25ebb56567742354475fa551c97.sample"] + +[params] + +force/8_bit=false +force/mono=false +force/max_rate=false +force/max_rate_hz=44100 +edit/trim=false +edit/normalize=false +edit/loop_mode=0 +edit/loop_begin=0 +edit/loop_end=-1 +compress/mode=2 diff --git a/sound/dialogue/animalese/kim/3.wav b/sound/dialogue/animalese/kim/3.wav new file mode 100644 index 0000000..158485a Binary files /dev/null and b/sound/dialogue/animalese/kim/3.wav differ diff --git a/sound/dialogue/animalese/kim/3.wav.import b/sound/dialogue/animalese/kim/3.wav.import new file mode 100644 index 0000000..c4f479d --- /dev/null +++ b/sound/dialogue/animalese/kim/3.wav.import @@ -0,0 +1,24 @@ +[remap] + +importer="wav" +type="AudioStreamWAV" +uid="uid://dn24y7on5811q" +path="res://.godot/imported/3.wav-da7f408c6ee782136a7225f6a5b4c2da.sample" + +[deps] + +source_file="res://sound/dialogue/animalese/kim/3.wav" +dest_files=["res://.godot/imported/3.wav-da7f408c6ee782136a7225f6a5b4c2da.sample"] + +[params] + +force/8_bit=false +force/mono=false +force/max_rate=false +force/max_rate_hz=44100 +edit/trim=false +edit/normalize=false +edit/loop_mode=0 +edit/loop_begin=0 +edit/loop_end=-1 +compress/mode=2 diff --git a/sound/dialogue/animalese/kim/4.wav b/sound/dialogue/animalese/kim/4.wav new file mode 100644 index 0000000..6d05ec7 Binary files /dev/null and b/sound/dialogue/animalese/kim/4.wav differ diff --git a/sound/dialogue/animalese/kim/4.wav.import b/sound/dialogue/animalese/kim/4.wav.import new file mode 100644 index 0000000..c6a70b3 --- /dev/null +++ b/sound/dialogue/animalese/kim/4.wav.import @@ -0,0 +1,24 @@ +[remap] + +importer="wav" +type="AudioStreamWAV" +uid="uid://cpbt1fduqk2bc" +path="res://.godot/imported/4.wav-710dd9e6b25e0147dec2f21cfae1a894.sample" + +[deps] + +source_file="res://sound/dialogue/animalese/kim/4.wav" +dest_files=["res://.godot/imported/4.wav-710dd9e6b25e0147dec2f21cfae1a894.sample"] + +[params] + +force/8_bit=false +force/mono=false +force/max_rate=false +force/max_rate_hz=44100 +edit/trim=false +edit/normalize=false +edit/loop_mode=0 +edit/loop_begin=0 +edit/loop_end=-1 +compress/mode=2 diff --git a/sound/dialogue/animalese/kim/5.wav b/sound/dialogue/animalese/kim/5.wav new file mode 100644 index 0000000..5671a38 Binary files /dev/null and b/sound/dialogue/animalese/kim/5.wav differ diff --git a/sound/dialogue/animalese/kim/5.wav.import b/sound/dialogue/animalese/kim/5.wav.import new file mode 100644 index 0000000..bc739df --- /dev/null +++ b/sound/dialogue/animalese/kim/5.wav.import @@ -0,0 +1,24 @@ +[remap] + +importer="wav" +type="AudioStreamWAV" +uid="uid://chf4scjvimr1o" +path="res://.godot/imported/5.wav-7adb723973f3005425a71be181ad28e9.sample" + +[deps] + +source_file="res://sound/dialogue/animalese/kim/5.wav" +dest_files=["res://.godot/imported/5.wav-7adb723973f3005425a71be181ad28e9.sample"] + +[params] + +force/8_bit=false +force/mono=false +force/max_rate=false +force/max_rate_hz=44100 +edit/trim=false +edit/normalize=false +edit/loop_mode=0 +edit/loop_begin=0 +edit/loop_end=-1 +compress/mode=2 diff --git a/sound/dialogue/animalese/kim/6.wav b/sound/dialogue/animalese/kim/6.wav new file mode 100644 index 0000000..379199e Binary files /dev/null and b/sound/dialogue/animalese/kim/6.wav differ diff --git a/sound/dialogue/animalese/kim/6.wav.import b/sound/dialogue/animalese/kim/6.wav.import new file mode 100644 index 0000000..3674eb9 --- /dev/null +++ b/sound/dialogue/animalese/kim/6.wav.import @@ -0,0 +1,24 @@ +[remap] + +importer="wav" +type="AudioStreamWAV" +uid="uid://phxil12i1qmt" +path="res://.godot/imported/6.wav-1303e051aae59fdf169def7624379571.sample" + +[deps] + +source_file="res://sound/dialogue/animalese/kim/6.wav" +dest_files=["res://.godot/imported/6.wav-1303e051aae59fdf169def7624379571.sample"] + +[params] + +force/8_bit=false +force/mono=false +force/max_rate=false +force/max_rate_hz=44100 +edit/trim=false +edit/normalize=false +edit/loop_mode=0 +edit/loop_begin=0 +edit/loop_end=-1 +compress/mode=2 diff --git a/sound/dialogue/animalese/kim/7.wav b/sound/dialogue/animalese/kim/7.wav new file mode 100644 index 0000000..ccfdd5f Binary files /dev/null and b/sound/dialogue/animalese/kim/7.wav differ diff --git a/sound/dialogue/animalese/kim/7.wav.import b/sound/dialogue/animalese/kim/7.wav.import new file mode 100644 index 0000000..a6cee56 --- /dev/null +++ b/sound/dialogue/animalese/kim/7.wav.import @@ -0,0 +1,24 @@ +[remap] + +importer="wav" +type="AudioStreamWAV" +uid="uid://dn1pxla32ab23" +path="res://.godot/imported/7.wav-cb4bd630248ebe745a1646dc7060d526.sample" + +[deps] + +source_file="res://sound/dialogue/animalese/kim/7.wav" +dest_files=["res://.godot/imported/7.wav-cb4bd630248ebe745a1646dc7060d526.sample"] + +[params] + +force/8_bit=false +force/mono=false +force/max_rate=false +force/max_rate_hz=44100 +edit/trim=false +edit/normalize=false +edit/loop_mode=0 +edit/loop_begin=0 +edit/loop_end=-1 +compress/mode=2 diff --git a/sound/dialogue/animalese/kim/8.wav b/sound/dialogue/animalese/kim/8.wav new file mode 100644 index 0000000..d21e79c Binary files /dev/null and b/sound/dialogue/animalese/kim/8.wav differ diff --git a/sound/dialogue/animalese/kim/8.wav.import b/sound/dialogue/animalese/kim/8.wav.import new file mode 100644 index 0000000..36a3e42 --- /dev/null +++ b/sound/dialogue/animalese/kim/8.wav.import @@ -0,0 +1,24 @@ +[remap] + +importer="wav" +type="AudioStreamWAV" +uid="uid://dw3bqqcoeoelf" +path="res://.godot/imported/8.wav-5f912e71babee0f928483bcc9e2fa9f3.sample" + +[deps] + +source_file="res://sound/dialogue/animalese/kim/8.wav" +dest_files=["res://.godot/imported/8.wav-5f912e71babee0f928483bcc9e2fa9f3.sample"] + +[params] + +force/8_bit=false +force/mono=false +force/max_rate=false +force/max_rate_hz=44100 +edit/trim=false +edit/normalize=false +edit/loop_mode=0 +edit/loop_begin=0 +edit/loop_end=-1 +compress/mode=2 diff --git a/sound/dialogue/animalese/kim/9.wav b/sound/dialogue/animalese/kim/9.wav new file mode 100644 index 0000000..70d4515 Binary files /dev/null and b/sound/dialogue/animalese/kim/9.wav differ diff --git a/sound/dialogue/animalese/kim/9.wav.import b/sound/dialogue/animalese/kim/9.wav.import new file mode 100644 index 0000000..8739b30 --- /dev/null +++ b/sound/dialogue/animalese/kim/9.wav.import @@ -0,0 +1,24 @@ +[remap] + +importer="wav" +type="AudioStreamWAV" +uid="uid://b3xwpno2ky226" +path="res://.godot/imported/9.wav-92fe849d00f43baa22f6338601438d71.sample" + +[deps] + +source_file="res://sound/dialogue/animalese/kim/9.wav" +dest_files=["res://.godot/imported/9.wav-92fe849d00f43baa22f6338601438d71.sample"] + +[params] + +force/8_bit=false +force/mono=false +force/max_rate=false +force/max_rate_hz=44100 +edit/trim=false +edit/normalize=false +edit/loop_mode=0 +edit/loop_begin=0 +edit/loop_end=-1 +compress/mode=2 diff --git a/sound/dialogue/animalese/kim/a.wav b/sound/dialogue/animalese/kim/a.wav new file mode 100644 index 0000000..78d2ae6 Binary files /dev/null and b/sound/dialogue/animalese/kim/a.wav differ diff --git a/sound/dialogue/animalese/kim/a.wav.import b/sound/dialogue/animalese/kim/a.wav.import new file mode 100644 index 0000000..c0c8c4b --- /dev/null +++ b/sound/dialogue/animalese/kim/a.wav.import @@ -0,0 +1,24 @@ +[remap] + +importer="wav" +type="AudioStreamWAV" +uid="uid://c72cosdd78vhw" +path="res://.godot/imported/a.wav-19230b3cafcf4c28b5dd1f5c6133e5a5.sample" + +[deps] + +source_file="res://sound/dialogue/animalese/kim/a.wav" +dest_files=["res://.godot/imported/a.wav-19230b3cafcf4c28b5dd1f5c6133e5a5.sample"] + +[params] + +force/8_bit=false +force/mono=false +force/max_rate=false +force/max_rate_hz=44100 +edit/trim=false +edit/normalize=false +edit/loop_mode=0 +edit/loop_begin=0 +edit/loop_end=-1 +compress/mode=2 diff --git a/sound/dialogue/animalese/kim/b.wav b/sound/dialogue/animalese/kim/b.wav new file mode 100644 index 0000000..440592d Binary files /dev/null and b/sound/dialogue/animalese/kim/b.wav differ diff --git a/sound/dialogue/animalese/kim/b.wav.import b/sound/dialogue/animalese/kim/b.wav.import new file mode 100644 index 0000000..495146b --- /dev/null +++ b/sound/dialogue/animalese/kim/b.wav.import @@ -0,0 +1,24 @@ +[remap] + +importer="wav" +type="AudioStreamWAV" +uid="uid://caejv7ic8kc83" +path="res://.godot/imported/b.wav-185deb7af67f5a2c71a0fcd8ad5c9ee8.sample" + +[deps] + +source_file="res://sound/dialogue/animalese/kim/b.wav" +dest_files=["res://.godot/imported/b.wav-185deb7af67f5a2c71a0fcd8ad5c9ee8.sample"] + +[params] + +force/8_bit=false +force/mono=false +force/max_rate=false +force/max_rate_hz=44100 +edit/trim=false +edit/normalize=false +edit/loop_mode=0 +edit/loop_begin=0 +edit/loop_end=-1 +compress/mode=2 diff --git a/sound/dialogue/animalese/kim/c.wav b/sound/dialogue/animalese/kim/c.wav new file mode 100644 index 0000000..d7f2b03 Binary files /dev/null and b/sound/dialogue/animalese/kim/c.wav differ diff --git a/sound/dialogue/animalese/kim/c.wav.import b/sound/dialogue/animalese/kim/c.wav.import new file mode 100644 index 0000000..10afb6b --- /dev/null +++ b/sound/dialogue/animalese/kim/c.wav.import @@ -0,0 +1,24 @@ +[remap] + +importer="wav" +type="AudioStreamWAV" +uid="uid://cpshexs36p2g0" +path="res://.godot/imported/c.wav-bd1cbbf5862edfbaca6f9f8b0bb2990b.sample" + +[deps] + +source_file="res://sound/dialogue/animalese/kim/c.wav" +dest_files=["res://.godot/imported/c.wav-bd1cbbf5862edfbaca6f9f8b0bb2990b.sample"] + +[params] + +force/8_bit=false +force/mono=false +force/max_rate=false +force/max_rate_hz=44100 +edit/trim=false +edit/normalize=false +edit/loop_mode=0 +edit/loop_begin=0 +edit/loop_end=-1 +compress/mode=2 diff --git a/sound/dialogue/animalese/kim/d.wav b/sound/dialogue/animalese/kim/d.wav new file mode 100644 index 0000000..51b694b Binary files /dev/null and b/sound/dialogue/animalese/kim/d.wav differ diff --git a/sound/dialogue/animalese/placeholder/d.wav.import b/sound/dialogue/animalese/kim/d.wav.import similarity index 50% rename from sound/dialogue/animalese/placeholder/d.wav.import rename to sound/dialogue/animalese/kim/d.wav.import index ffc5bb9..6654420 100644 --- a/sound/dialogue/animalese/placeholder/d.wav.import +++ b/sound/dialogue/animalese/kim/d.wav.import @@ -2,13 +2,13 @@ importer="wav" type="AudioStreamWAV" -uid="uid://yvha8eukw6l7" -path="res://.godot/imported/d.wav-910bc02bc42bdb1b37561959a317c28a.sample" +uid="uid://bqhge2ptlm71d" +path="res://.godot/imported/d.wav-dd6ab85372a6bd92c069003d8685a7bf.sample" [deps] -source_file="res://sound/dialogue/animalese/placeholder/d.wav" -dest_files=["res://.godot/imported/d.wav-910bc02bc42bdb1b37561959a317c28a.sample"] +source_file="res://sound/dialogue/animalese/kim/d.wav" +dest_files=["res://.godot/imported/d.wav-dd6ab85372a6bd92c069003d8685a7bf.sample"] [params] diff --git a/sound/dialogue/animalese/kim/e.wav b/sound/dialogue/animalese/kim/e.wav new file mode 100644 index 0000000..cb2c1c8 Binary files /dev/null and b/sound/dialogue/animalese/kim/e.wav differ diff --git a/sound/dialogue/animalese/placeholder/e.wav.import b/sound/dialogue/animalese/kim/e.wav.import similarity index 50% rename from sound/dialogue/animalese/placeholder/e.wav.import rename to sound/dialogue/animalese/kim/e.wav.import index 49de309..8a998e2 100644 --- a/sound/dialogue/animalese/placeholder/e.wav.import +++ b/sound/dialogue/animalese/kim/e.wav.import @@ -2,13 +2,13 @@ importer="wav" type="AudioStreamWAV" -uid="uid://8ujopf8aqs83" -path="res://.godot/imported/e.wav-7da5f8fcd017bf931de2bd49dc00f652.sample" +uid="uid://crfyuh2rii14l" +path="res://.godot/imported/e.wav-08036c9672bbd5dd6268ec8812ae775f.sample" [deps] -source_file="res://sound/dialogue/animalese/placeholder/e.wav" -dest_files=["res://.godot/imported/e.wav-7da5f8fcd017bf931de2bd49dc00f652.sample"] +source_file="res://sound/dialogue/animalese/kim/e.wav" +dest_files=["res://.godot/imported/e.wav-08036c9672bbd5dd6268ec8812ae775f.sample"] [params] diff --git a/sound/dialogue/animalese/kim/f.wav b/sound/dialogue/animalese/kim/f.wav new file mode 100644 index 0000000..b1545ff Binary files /dev/null and b/sound/dialogue/animalese/kim/f.wav differ diff --git a/sound/dialogue/animalese/placeholder/b.wav.import b/sound/dialogue/animalese/kim/f.wav.import similarity index 52% rename from sound/dialogue/animalese/placeholder/b.wav.import rename to sound/dialogue/animalese/kim/f.wav.import index 4aea49c..03c1a4d 100644 --- a/sound/dialogue/animalese/placeholder/b.wav.import +++ b/sound/dialogue/animalese/kim/f.wav.import @@ -2,13 +2,13 @@ importer="wav" type="AudioStreamWAV" -uid="uid://cs30tdyuo6wtc" -path="res://.godot/imported/b.wav-eed860af2033bda258bd172899061b45.sample" +uid="uid://uk0jqhph802c" +path="res://.godot/imported/f.wav-82aa6f7c781c80928450893a029aac45.sample" [deps] -source_file="res://sound/dialogue/animalese/placeholder/b.wav" -dest_files=["res://.godot/imported/b.wav-eed860af2033bda258bd172899061b45.sample"] +source_file="res://sound/dialogue/animalese/kim/f.wav" +dest_files=["res://.godot/imported/f.wav-82aa6f7c781c80928450893a029aac45.sample"] [params] diff --git a/sound/dialogue/animalese/kim/g.wav b/sound/dialogue/animalese/kim/g.wav new file mode 100644 index 0000000..a37ac01 Binary files /dev/null and b/sound/dialogue/animalese/kim/g.wav differ diff --git a/sound/dialogue/animalese/kim/g.wav.import b/sound/dialogue/animalese/kim/g.wav.import new file mode 100644 index 0000000..a9b73ba --- /dev/null +++ b/sound/dialogue/animalese/kim/g.wav.import @@ -0,0 +1,24 @@ +[remap] + +importer="wav" +type="AudioStreamWAV" +uid="uid://1008bpcdr223" +path="res://.godot/imported/g.wav-372aa2fc0531a484e3322ee3d3b48085.sample" + +[deps] + +source_file="res://sound/dialogue/animalese/kim/g.wav" +dest_files=["res://.godot/imported/g.wav-372aa2fc0531a484e3322ee3d3b48085.sample"] + +[params] + +force/8_bit=false +force/mono=false +force/max_rate=false +force/max_rate_hz=44100 +edit/trim=false +edit/normalize=false +edit/loop_mode=0 +edit/loop_begin=0 +edit/loop_end=-1 +compress/mode=2 diff --git a/sound/dialogue/animalese/kim/h.wav b/sound/dialogue/animalese/kim/h.wav new file mode 100644 index 0000000..0c19076 Binary files /dev/null and b/sound/dialogue/animalese/kim/h.wav differ diff --git a/sound/dialogue/animalese/kim/h.wav.import b/sound/dialogue/animalese/kim/h.wav.import new file mode 100644 index 0000000..fb6ec91 --- /dev/null +++ b/sound/dialogue/animalese/kim/h.wav.import @@ -0,0 +1,24 @@ +[remap] + +importer="wav" +type="AudioStreamWAV" +uid="uid://bw0ua5pignh1m" +path="res://.godot/imported/h.wav-f16878738745ac8ee0150078290ea7c5.sample" + +[deps] + +source_file="res://sound/dialogue/animalese/kim/h.wav" +dest_files=["res://.godot/imported/h.wav-f16878738745ac8ee0150078290ea7c5.sample"] + +[params] + +force/8_bit=false +force/mono=false +force/max_rate=false +force/max_rate_hz=44100 +edit/trim=false +edit/normalize=false +edit/loop_mode=0 +edit/loop_begin=0 +edit/loop_end=-1 +compress/mode=2 diff --git a/sound/dialogue/animalese/kim/i.wav b/sound/dialogue/animalese/kim/i.wav new file mode 100644 index 0000000..cd097c2 Binary files /dev/null and b/sound/dialogue/animalese/kim/i.wav differ diff --git a/sound/dialogue/animalese/kim/i.wav.import b/sound/dialogue/animalese/kim/i.wav.import new file mode 100644 index 0000000..724e4f5 --- /dev/null +++ b/sound/dialogue/animalese/kim/i.wav.import @@ -0,0 +1,24 @@ +[remap] + +importer="wav" +type="AudioStreamWAV" +uid="uid://cyv3yum38oqdm" +path="res://.godot/imported/i.wav-c720580ef88ff0c17cc9e0a9daec4ec2.sample" + +[deps] + +source_file="res://sound/dialogue/animalese/kim/i.wav" +dest_files=["res://.godot/imported/i.wav-c720580ef88ff0c17cc9e0a9daec4ec2.sample"] + +[params] + +force/8_bit=false +force/mono=false +force/max_rate=false +force/max_rate_hz=44100 +edit/trim=false +edit/normalize=false +edit/loop_mode=0 +edit/loop_begin=0 +edit/loop_end=-1 +compress/mode=2 diff --git a/sound/dialogue/animalese/kim/j.wav b/sound/dialogue/animalese/kim/j.wav new file mode 100644 index 0000000..718d67e Binary files /dev/null and b/sound/dialogue/animalese/kim/j.wav differ diff --git a/sound/dialogue/animalese/kim/j.wav.import b/sound/dialogue/animalese/kim/j.wav.import new file mode 100644 index 0000000..4cc5f64 --- /dev/null +++ b/sound/dialogue/animalese/kim/j.wav.import @@ -0,0 +1,24 @@ +[remap] + +importer="wav" +type="AudioStreamWAV" +uid="uid://b7hjrilpfkuxx" +path="res://.godot/imported/j.wav-e5a60e91add3cfd5587ee2205e401fef.sample" + +[deps] + +source_file="res://sound/dialogue/animalese/kim/j.wav" +dest_files=["res://.godot/imported/j.wav-e5a60e91add3cfd5587ee2205e401fef.sample"] + +[params] + +force/8_bit=false +force/mono=false +force/max_rate=false +force/max_rate_hz=44100 +edit/trim=false +edit/normalize=false +edit/loop_mode=0 +edit/loop_begin=0 +edit/loop_end=-1 +compress/mode=2 diff --git a/sound/dialogue/animalese/kim/k.wav b/sound/dialogue/animalese/kim/k.wav new file mode 100644 index 0000000..fa1748d Binary files /dev/null and b/sound/dialogue/animalese/kim/k.wav differ diff --git a/sound/dialogue/animalese/placeholder/z.wav.import b/sound/dialogue/animalese/kim/k.wav.import similarity index 54% rename from sound/dialogue/animalese/placeholder/z.wav.import rename to sound/dialogue/animalese/kim/k.wav.import index 12b1b54..171b8a0 100644 --- a/sound/dialogue/animalese/placeholder/z.wav.import +++ b/sound/dialogue/animalese/kim/k.wav.import @@ -2,13 +2,13 @@ importer="wav" type="AudioStreamWAV" -uid="uid://djvv63b0jlll" -path="res://.godot/imported/z.wav-3e6ff24f53b1014b381cc80ee9fb1a84.sample" +uid="uid://n4n7gg0bqbbm" +path="res://.godot/imported/k.wav-82cc304c4627c5fcf78403e0d82b4066.sample" [deps] -source_file="res://sound/dialogue/animalese/placeholder/z.wav" -dest_files=["res://.godot/imported/z.wav-3e6ff24f53b1014b381cc80ee9fb1a84.sample"] +source_file="res://sound/dialogue/animalese/kim/k.wav" +dest_files=["res://.godot/imported/k.wav-82cc304c4627c5fcf78403e0d82b4066.sample"] [params] diff --git a/sound/dialogue/animalese/kim/l.wav b/sound/dialogue/animalese/kim/l.wav new file mode 100644 index 0000000..aea20f2 Binary files /dev/null and b/sound/dialogue/animalese/kim/l.wav differ diff --git a/sound/dialogue/animalese/kim/l.wav.import b/sound/dialogue/animalese/kim/l.wav.import new file mode 100644 index 0000000..1845e6d --- /dev/null +++ b/sound/dialogue/animalese/kim/l.wav.import @@ -0,0 +1,24 @@ +[remap] + +importer="wav" +type="AudioStreamWAV" +uid="uid://nle3bfrffs5t" +path="res://.godot/imported/l.wav-4b9d875920578dd42b0265fdc42a4c0d.sample" + +[deps] + +source_file="res://sound/dialogue/animalese/kim/l.wav" +dest_files=["res://.godot/imported/l.wav-4b9d875920578dd42b0265fdc42a4c0d.sample"] + +[params] + +force/8_bit=false +force/mono=false +force/max_rate=false +force/max_rate_hz=44100 +edit/trim=false +edit/normalize=false +edit/loop_mode=0 +edit/loop_begin=0 +edit/loop_end=-1 +compress/mode=2 diff --git a/sound/dialogue/animalese/kim/m.wav b/sound/dialogue/animalese/kim/m.wav new file mode 100644 index 0000000..68a5ace Binary files /dev/null and b/sound/dialogue/animalese/kim/m.wav differ diff --git a/sound/dialogue/animalese/kim/m.wav.import b/sound/dialogue/animalese/kim/m.wav.import new file mode 100644 index 0000000..5a81393 --- /dev/null +++ b/sound/dialogue/animalese/kim/m.wav.import @@ -0,0 +1,24 @@ +[remap] + +importer="wav" +type="AudioStreamWAV" +uid="uid://wia38ojr60e6" +path="res://.godot/imported/m.wav-f7d07c9e641beaa268666b6d6b350fb0.sample" + +[deps] + +source_file="res://sound/dialogue/animalese/kim/m.wav" +dest_files=["res://.godot/imported/m.wav-f7d07c9e641beaa268666b6d6b350fb0.sample"] + +[params] + +force/8_bit=false +force/mono=false +force/max_rate=false +force/max_rate_hz=44100 +edit/trim=false +edit/normalize=false +edit/loop_mode=0 +edit/loop_begin=0 +edit/loop_end=-1 +compress/mode=2 diff --git a/sound/dialogue/animalese/kim/n.wav b/sound/dialogue/animalese/kim/n.wav new file mode 100644 index 0000000..b3996d0 Binary files /dev/null and b/sound/dialogue/animalese/kim/n.wav differ diff --git a/sound/dialogue/animalese/kim/n.wav.import b/sound/dialogue/animalese/kim/n.wav.import new file mode 100644 index 0000000..63058b2 --- /dev/null +++ b/sound/dialogue/animalese/kim/n.wav.import @@ -0,0 +1,24 @@ +[remap] + +importer="wav" +type="AudioStreamWAV" +uid="uid://ci70fsfe28t2" +path="res://.godot/imported/n.wav-19567bad745c477e3e8f72b9737adf99.sample" + +[deps] + +source_file="res://sound/dialogue/animalese/kim/n.wav" +dest_files=["res://.godot/imported/n.wav-19567bad745c477e3e8f72b9737adf99.sample"] + +[params] + +force/8_bit=false +force/mono=false +force/max_rate=false +force/max_rate_hz=44100 +edit/trim=false +edit/normalize=false +edit/loop_mode=0 +edit/loop_begin=0 +edit/loop_end=-1 +compress/mode=2 diff --git a/sound/dialogue/animalese/kim/o.wav b/sound/dialogue/animalese/kim/o.wav new file mode 100644 index 0000000..66dd126 Binary files /dev/null and b/sound/dialogue/animalese/kim/o.wav differ diff --git a/sound/dialogue/animalese/kim/o.wav.import b/sound/dialogue/animalese/kim/o.wav.import new file mode 100644 index 0000000..4ba4147 --- /dev/null +++ b/sound/dialogue/animalese/kim/o.wav.import @@ -0,0 +1,24 @@ +[remap] + +importer="wav" +type="AudioStreamWAV" +uid="uid://droru2bo6m2ih" +path="res://.godot/imported/o.wav-d2b3f3d92542aa1643abd9b106b457de.sample" + +[deps] + +source_file="res://sound/dialogue/animalese/kim/o.wav" +dest_files=["res://.godot/imported/o.wav-d2b3f3d92542aa1643abd9b106b457de.sample"] + +[params] + +force/8_bit=false +force/mono=false +force/max_rate=false +force/max_rate_hz=44100 +edit/trim=false +edit/normalize=false +edit/loop_mode=0 +edit/loop_begin=0 +edit/loop_end=-1 +compress/mode=2 diff --git a/sound/dialogue/animalese/kim/p.wav b/sound/dialogue/animalese/kim/p.wav new file mode 100644 index 0000000..25cbb55 Binary files /dev/null and b/sound/dialogue/animalese/kim/p.wav differ diff --git a/sound/dialogue/animalese/kim/p.wav.import b/sound/dialogue/animalese/kim/p.wav.import new file mode 100644 index 0000000..ec826e3 --- /dev/null +++ b/sound/dialogue/animalese/kim/p.wav.import @@ -0,0 +1,24 @@ +[remap] + +importer="wav" +type="AudioStreamWAV" +uid="uid://d2gyv7ugi1yam" +path="res://.godot/imported/p.wav-f16816387176c36971c1a3eb52f1742e.sample" + +[deps] + +source_file="res://sound/dialogue/animalese/kim/p.wav" +dest_files=["res://.godot/imported/p.wav-f16816387176c36971c1a3eb52f1742e.sample"] + +[params] + +force/8_bit=false +force/mono=false +force/max_rate=false +force/max_rate_hz=44100 +edit/trim=false +edit/normalize=false +edit/loop_mode=0 +edit/loop_begin=0 +edit/loop_end=-1 +compress/mode=2 diff --git a/sound/dialogue/animalese/kim/q.wav b/sound/dialogue/animalese/kim/q.wav new file mode 100644 index 0000000..887f7d6 Binary files /dev/null and b/sound/dialogue/animalese/kim/q.wav differ diff --git a/sound/dialogue/animalese/kim/q.wav.import b/sound/dialogue/animalese/kim/q.wav.import new file mode 100644 index 0000000..0e794ee --- /dev/null +++ b/sound/dialogue/animalese/kim/q.wav.import @@ -0,0 +1,24 @@ +[remap] + +importer="wav" +type="AudioStreamWAV" +uid="uid://ci6h5d2oag4an" +path="res://.godot/imported/q.wav-729a36d49b5b3bd23f1badb802667428.sample" + +[deps] + +source_file="res://sound/dialogue/animalese/kim/q.wav" +dest_files=["res://.godot/imported/q.wav-729a36d49b5b3bd23f1badb802667428.sample"] + +[params] + +force/8_bit=false +force/mono=false +force/max_rate=false +force/max_rate_hz=44100 +edit/trim=false +edit/normalize=false +edit/loop_mode=0 +edit/loop_begin=0 +edit/loop_end=-1 +compress/mode=2 diff --git a/sound/dialogue/animalese/kim/r.wav b/sound/dialogue/animalese/kim/r.wav new file mode 100644 index 0000000..1fa9937 Binary files /dev/null and b/sound/dialogue/animalese/kim/r.wav differ diff --git a/sound/dialogue/animalese/kim/r.wav.import b/sound/dialogue/animalese/kim/r.wav.import new file mode 100644 index 0000000..84c2887 --- /dev/null +++ b/sound/dialogue/animalese/kim/r.wav.import @@ -0,0 +1,24 @@ +[remap] + +importer="wav" +type="AudioStreamWAV" +uid="uid://c03fj374ceaqc" +path="res://.godot/imported/r.wav-74003e87654a77c6a0afc0d80fca9cf3.sample" + +[deps] + +source_file="res://sound/dialogue/animalese/kim/r.wav" +dest_files=["res://.godot/imported/r.wav-74003e87654a77c6a0afc0d80fca9cf3.sample"] + +[params] + +force/8_bit=false +force/mono=false +force/max_rate=false +force/max_rate_hz=44100 +edit/trim=false +edit/normalize=false +edit/loop_mode=0 +edit/loop_begin=0 +edit/loop_end=-1 +compress/mode=2 diff --git a/sound/dialogue/animalese/kim/s.wav b/sound/dialogue/animalese/kim/s.wav new file mode 100644 index 0000000..962fd46 Binary files /dev/null and b/sound/dialogue/animalese/kim/s.wav differ diff --git a/sound/dialogue/animalese/kim/s.wav.import b/sound/dialogue/animalese/kim/s.wav.import new file mode 100644 index 0000000..c39714d --- /dev/null +++ b/sound/dialogue/animalese/kim/s.wav.import @@ -0,0 +1,24 @@ +[remap] + +importer="wav" +type="AudioStreamWAV" +uid="uid://d0yb6lesxgm8j" +path="res://.godot/imported/s.wav-627d8bd9f4cee8c43ac9237705df784f.sample" + +[deps] + +source_file="res://sound/dialogue/animalese/kim/s.wav" +dest_files=["res://.godot/imported/s.wav-627d8bd9f4cee8c43ac9237705df784f.sample"] + +[params] + +force/8_bit=false +force/mono=false +force/max_rate=false +force/max_rate_hz=44100 +edit/trim=false +edit/normalize=false +edit/loop_mode=0 +edit/loop_begin=0 +edit/loop_end=-1 +compress/mode=2 diff --git a/sound/dialogue/animalese/kim/t.wav b/sound/dialogue/animalese/kim/t.wav new file mode 100644 index 0000000..c5fcc51 Binary files /dev/null and b/sound/dialogue/animalese/kim/t.wav differ diff --git a/sound/dialogue/animalese/kim/t.wav.import b/sound/dialogue/animalese/kim/t.wav.import new file mode 100644 index 0000000..b6d0ae9 --- /dev/null +++ b/sound/dialogue/animalese/kim/t.wav.import @@ -0,0 +1,24 @@ +[remap] + +importer="wav" +type="AudioStreamWAV" +uid="uid://bcvrvl4mli82i" +path="res://.godot/imported/t.wav-aec336b52646bd870831f9effe598c92.sample" + +[deps] + +source_file="res://sound/dialogue/animalese/kim/t.wav" +dest_files=["res://.godot/imported/t.wav-aec336b52646bd870831f9effe598c92.sample"] + +[params] + +force/8_bit=false +force/mono=false +force/max_rate=false +force/max_rate_hz=44100 +edit/trim=false +edit/normalize=false +edit/loop_mode=0 +edit/loop_begin=0 +edit/loop_end=-1 +compress/mode=2 diff --git a/sound/dialogue/animalese/kim/u.wav b/sound/dialogue/animalese/kim/u.wav new file mode 100644 index 0000000..56caa56 Binary files /dev/null and b/sound/dialogue/animalese/kim/u.wav differ diff --git a/sound/dialogue/animalese/kim/u.wav.import b/sound/dialogue/animalese/kim/u.wav.import new file mode 100644 index 0000000..7724a93 --- /dev/null +++ b/sound/dialogue/animalese/kim/u.wav.import @@ -0,0 +1,24 @@ +[remap] + +importer="wav" +type="AudioStreamWAV" +uid="uid://mpw8xt0uxm5d" +path="res://.godot/imported/u.wav-02b540f73efcb10ad4943d4f37bdf90b.sample" + +[deps] + +source_file="res://sound/dialogue/animalese/kim/u.wav" +dest_files=["res://.godot/imported/u.wav-02b540f73efcb10ad4943d4f37bdf90b.sample"] + +[params] + +force/8_bit=false +force/mono=false +force/max_rate=false +force/max_rate_hz=44100 +edit/trim=false +edit/normalize=false +edit/loop_mode=0 +edit/loop_begin=0 +edit/loop_end=-1 +compress/mode=2 diff --git a/sound/dialogue/animalese/kim/v.wav b/sound/dialogue/animalese/kim/v.wav new file mode 100644 index 0000000..4add64f Binary files /dev/null and b/sound/dialogue/animalese/kim/v.wav differ diff --git a/sound/dialogue/animalese/placeholder/v.wav.import b/sound/dialogue/animalese/kim/v.wav.import similarity index 50% rename from sound/dialogue/animalese/placeholder/v.wav.import rename to sound/dialogue/animalese/kim/v.wav.import index ff876a8..fb772de 100644 --- a/sound/dialogue/animalese/placeholder/v.wav.import +++ b/sound/dialogue/animalese/kim/v.wav.import @@ -2,13 +2,13 @@ importer="wav" type="AudioStreamWAV" -uid="uid://y3g1s3pw3bn0" -path="res://.godot/imported/v.wav-5a9986e91dbdd0da4f0583b35a986b1c.sample" +uid="uid://n0r81bxuadfo" +path="res://.godot/imported/v.wav-d66f5caffb359fad446ec9ddbacdf071.sample" [deps] -source_file="res://sound/dialogue/animalese/placeholder/v.wav" -dest_files=["res://.godot/imported/v.wav-5a9986e91dbdd0da4f0583b35a986b1c.sample"] +source_file="res://sound/dialogue/animalese/kim/v.wav" +dest_files=["res://.godot/imported/v.wav-d66f5caffb359fad446ec9ddbacdf071.sample"] [params] diff --git a/sound/dialogue/animalese/kim/w.wav b/sound/dialogue/animalese/kim/w.wav new file mode 100644 index 0000000..9020a84 Binary files /dev/null and b/sound/dialogue/animalese/kim/w.wav differ diff --git a/sound/dialogue/animalese/placeholder/w.wav.import b/sound/dialogue/animalese/kim/w.wav.import similarity index 50% rename from sound/dialogue/animalese/placeholder/w.wav.import rename to sound/dialogue/animalese/kim/w.wav.import index 36f4e0f..b6f0a30 100644 --- a/sound/dialogue/animalese/placeholder/w.wav.import +++ b/sound/dialogue/animalese/kim/w.wav.import @@ -2,13 +2,13 @@ importer="wav" type="AudioStreamWAV" -uid="uid://5ml2iuf8cpgt" -path="res://.godot/imported/w.wav-d3e9035a1fc5e7946be782a0d4f95e64.sample" +uid="uid://dm742m0d4b8o7" +path="res://.godot/imported/w.wav-46b37c23c004fe793f00e82c587efbcf.sample" [deps] -source_file="res://sound/dialogue/animalese/placeholder/w.wav" -dest_files=["res://.godot/imported/w.wav-d3e9035a1fc5e7946be782a0d4f95e64.sample"] +source_file="res://sound/dialogue/animalese/kim/w.wav" +dest_files=["res://.godot/imported/w.wav-46b37c23c004fe793f00e82c587efbcf.sample"] [params] diff --git a/sound/dialogue/animalese/kim/x.wav b/sound/dialogue/animalese/kim/x.wav new file mode 100644 index 0000000..f147ef3 Binary files /dev/null and b/sound/dialogue/animalese/kim/x.wav differ diff --git a/sound/dialogue/animalese/kim/x.wav.import b/sound/dialogue/animalese/kim/x.wav.import new file mode 100644 index 0000000..4fcd581 --- /dev/null +++ b/sound/dialogue/animalese/kim/x.wav.import @@ -0,0 +1,24 @@ +[remap] + +importer="wav" +type="AudioStreamWAV" +uid="uid://cn2my2uukyd8u" +path="res://.godot/imported/x.wav-90efe4fb55c5c2061c2e9dbc89bfb532.sample" + +[deps] + +source_file="res://sound/dialogue/animalese/kim/x.wav" +dest_files=["res://.godot/imported/x.wav-90efe4fb55c5c2061c2e9dbc89bfb532.sample"] + +[params] + +force/8_bit=false +force/mono=false +force/max_rate=false +force/max_rate_hz=44100 +edit/trim=false +edit/normalize=false +edit/loop_mode=0 +edit/loop_begin=0 +edit/loop_end=-1 +compress/mode=2 diff --git a/sound/dialogue/animalese/kim/y.wav b/sound/dialogue/animalese/kim/y.wav new file mode 100644 index 0000000..7f818c8 Binary files /dev/null and b/sound/dialogue/animalese/kim/y.wav differ diff --git a/sound/dialogue/animalese/kim/y.wav.import b/sound/dialogue/animalese/kim/y.wav.import new file mode 100644 index 0000000..0cfb028 --- /dev/null +++ b/sound/dialogue/animalese/kim/y.wav.import @@ -0,0 +1,24 @@ +[remap] + +importer="wav" +type="AudioStreamWAV" +uid="uid://djhq5e17gcqv1" +path="res://.godot/imported/y.wav-0170ee159f2f8405596f47206d01cf8f.sample" + +[deps] + +source_file="res://sound/dialogue/animalese/kim/y.wav" +dest_files=["res://.godot/imported/y.wav-0170ee159f2f8405596f47206d01cf8f.sample"] + +[params] + +force/8_bit=false +force/mono=false +force/max_rate=false +force/max_rate_hz=44100 +edit/trim=false +edit/normalize=false +edit/loop_mode=0 +edit/loop_begin=0 +edit/loop_end=-1 +compress/mode=2 diff --git a/sound/dialogue/animalese/kim/z.wav b/sound/dialogue/animalese/kim/z.wav new file mode 100644 index 0000000..ed9af43 Binary files /dev/null and b/sound/dialogue/animalese/kim/z.wav differ diff --git a/sound/dialogue/animalese/kim/z.wav.import b/sound/dialogue/animalese/kim/z.wav.import new file mode 100644 index 0000000..4a3b319 --- /dev/null +++ b/sound/dialogue/animalese/kim/z.wav.import @@ -0,0 +1,24 @@ +[remap] + +importer="wav" +type="AudioStreamWAV" +uid="uid://bhhaol0imq60f" +path="res://.godot/imported/z.wav-6daaf8e93675aba3840dbf16e9c93ebf.sample" + +[deps] + +source_file="res://sound/dialogue/animalese/kim/z.wav" +dest_files=["res://.godot/imported/z.wav-6daaf8e93675aba3840dbf16e9c93ebf.sample"] + +[params] + +force/8_bit=false +force/mono=false +force/max_rate=false +force/max_rate_hz=44100 +edit/trim=false +edit/normalize=false +edit/loop_mode=0 +edit/loop_begin=0 +edit/loop_end=-1 +compress/mode=2 diff --git a/sound/dialogue/animalese/placeholder/a.wav b/sound/dialogue/animalese/placeholder/a.wav deleted file mode 100644 index ca652d4..0000000 Binary files a/sound/dialogue/animalese/placeholder/a.wav and /dev/null differ diff --git a/sound/dialogue/animalese/placeholder/b.wav b/sound/dialogue/animalese/placeholder/b.wav deleted file mode 100644 index 71ceb88..0000000 Binary files a/sound/dialogue/animalese/placeholder/b.wav and /dev/null differ diff --git a/sound/dialogue/animalese/placeholder/c.wav b/sound/dialogue/animalese/placeholder/c.wav deleted file mode 100644 index 8b5eb64..0000000 Binary files a/sound/dialogue/animalese/placeholder/c.wav and /dev/null differ diff --git a/sound/dialogue/animalese/placeholder/d.wav b/sound/dialogue/animalese/placeholder/d.wav deleted file mode 100644 index 978009a..0000000 Binary files a/sound/dialogue/animalese/placeholder/d.wav and /dev/null differ diff --git a/sound/dialogue/animalese/placeholder/e.wav b/sound/dialogue/animalese/placeholder/e.wav deleted file mode 100644 index 76f7b8c..0000000 Binary files a/sound/dialogue/animalese/placeholder/e.wav and /dev/null differ diff --git a/sound/dialogue/animalese/placeholder/f.wav b/sound/dialogue/animalese/placeholder/f.wav deleted file mode 100644 index bec92c1..0000000 Binary files a/sound/dialogue/animalese/placeholder/f.wav and /dev/null differ diff --git a/sound/dialogue/animalese/placeholder/fallback.wav b/sound/dialogue/animalese/placeholder/fallback.wav deleted file mode 100644 index 63a759e..0000000 Binary files a/sound/dialogue/animalese/placeholder/fallback.wav and /dev/null differ diff --git a/sound/dialogue/animalese/placeholder/fallback.wav.import b/sound/dialogue/animalese/placeholder/fallback.wav.import deleted file mode 100644 index e116a3c..0000000 --- a/sound/dialogue/animalese/placeholder/fallback.wav.import +++ /dev/null @@ -1,24 +0,0 @@ -[remap] - -importer="wav" -type="AudioStreamWAV" -uid="uid://bw0pod4tmexm0" -path="res://.godot/imported/fallback.wav-7a40516b188f10028ac39bdc24fb52e5.sample" - -[deps] - -source_file="res://sound/dialogue/animalese/placeholder/fallback.wav" -dest_files=["res://.godot/imported/fallback.wav-7a40516b188f10028ac39bdc24fb52e5.sample"] - -[params] - -force/8_bit=false -force/mono=false -force/max_rate=false -force/max_rate_hz=44100 -edit/trim=false -edit/normalize=false -edit/loop_mode=0 -edit/loop_begin=0 -edit/loop_end=-1 -compress/mode=2 diff --git a/sound/dialogue/animalese/placeholder/g.wav b/sound/dialogue/animalese/placeholder/g.wav deleted file mode 100644 index 39dccf1..0000000 Binary files a/sound/dialogue/animalese/placeholder/g.wav and /dev/null differ diff --git a/sound/dialogue/animalese/placeholder/h.wav b/sound/dialogue/animalese/placeholder/h.wav deleted file mode 100644 index acebfed..0000000 Binary files a/sound/dialogue/animalese/placeholder/h.wav and /dev/null differ diff --git a/sound/dialogue/animalese/placeholder/i.wav b/sound/dialogue/animalese/placeholder/i.wav deleted file mode 100644 index fbd10e1..0000000 Binary files a/sound/dialogue/animalese/placeholder/i.wav and /dev/null differ diff --git a/sound/dialogue/animalese/placeholder/j.wav b/sound/dialogue/animalese/placeholder/j.wav deleted file mode 100644 index 0087db5..0000000 Binary files a/sound/dialogue/animalese/placeholder/j.wav and /dev/null differ diff --git a/sound/dialogue/animalese/placeholder/j.wav.import b/sound/dialogue/animalese/placeholder/j.wav.import deleted file mode 100644 index 46a0baf..0000000 --- a/sound/dialogue/animalese/placeholder/j.wav.import +++ /dev/null @@ -1,24 +0,0 @@ -[remap] - -importer="wav" -type="AudioStreamWAV" -uid="uid://cji2evr0u3m6c" -path="res://.godot/imported/j.wav-2f355374ffcea77f8dc630ee45879444.sample" - -[deps] - -source_file="res://sound/dialogue/animalese/placeholder/j.wav" -dest_files=["res://.godot/imported/j.wav-2f355374ffcea77f8dc630ee45879444.sample"] - -[params] - -force/8_bit=false -force/mono=false -force/max_rate=false -force/max_rate_hz=44100 -edit/trim=false -edit/normalize=false -edit/loop_mode=0 -edit/loop_begin=0 -edit/loop_end=-1 -compress/mode=2 diff --git a/sound/dialogue/animalese/placeholder/k.wav b/sound/dialogue/animalese/placeholder/k.wav deleted file mode 100644 index c1b5e69..0000000 Binary files a/sound/dialogue/animalese/placeholder/k.wav and /dev/null differ diff --git a/sound/dialogue/animalese/placeholder/l.wav b/sound/dialogue/animalese/placeholder/l.wav deleted file mode 100644 index fe2624b..0000000 Binary files a/sound/dialogue/animalese/placeholder/l.wav and /dev/null differ diff --git a/sound/dialogue/animalese/placeholder/m.wav b/sound/dialogue/animalese/placeholder/m.wav deleted file mode 100644 index 4660d96..0000000 Binary files a/sound/dialogue/animalese/placeholder/m.wav and /dev/null differ diff --git a/sound/dialogue/animalese/placeholder/n.wav b/sound/dialogue/animalese/placeholder/n.wav deleted file mode 100644 index 97e5457..0000000 Binary files a/sound/dialogue/animalese/placeholder/n.wav and /dev/null differ diff --git a/sound/dialogue/animalese/placeholder/o.wav b/sound/dialogue/animalese/placeholder/o.wav deleted file mode 100644 index bee6bc1..0000000 Binary files a/sound/dialogue/animalese/placeholder/o.wav and /dev/null differ diff --git a/sound/dialogue/animalese/placeholder/p.wav b/sound/dialogue/animalese/placeholder/p.wav deleted file mode 100644 index 29fdd60..0000000 Binary files a/sound/dialogue/animalese/placeholder/p.wav and /dev/null differ diff --git a/sound/dialogue/animalese/placeholder/q.wav b/sound/dialogue/animalese/placeholder/q.wav deleted file mode 100644 index df184ca..0000000 Binary files a/sound/dialogue/animalese/placeholder/q.wav and /dev/null differ diff --git a/sound/dialogue/animalese/placeholder/r.wav b/sound/dialogue/animalese/placeholder/r.wav deleted file mode 100644 index 41fda60..0000000 Binary files a/sound/dialogue/animalese/placeholder/r.wav and /dev/null differ diff --git a/sound/dialogue/animalese/placeholder/s.wav b/sound/dialogue/animalese/placeholder/s.wav deleted file mode 100644 index f9c542a..0000000 Binary files a/sound/dialogue/animalese/placeholder/s.wav and /dev/null differ diff --git a/sound/dialogue/animalese/placeholder/t.wav b/sound/dialogue/animalese/placeholder/t.wav deleted file mode 100644 index 76e0948..0000000 Binary files a/sound/dialogue/animalese/placeholder/t.wav and /dev/null differ diff --git a/sound/dialogue/animalese/placeholder/u.wav b/sound/dialogue/animalese/placeholder/u.wav deleted file mode 100644 index 81ebbe5..0000000 Binary files a/sound/dialogue/animalese/placeholder/u.wav and /dev/null differ diff --git a/sound/dialogue/animalese/placeholder/u.wav.import b/sound/dialogue/animalese/placeholder/u.wav.import deleted file mode 100644 index 8ccd096..0000000 --- a/sound/dialogue/animalese/placeholder/u.wav.import +++ /dev/null @@ -1,24 +0,0 @@ -[remap] - -importer="wav" -type="AudioStreamWAV" -uid="uid://bln1bkdu20muo" -path="res://.godot/imported/u.wav-06e44c423f3d1cd6cdd34b54270211bb.sample" - -[deps] - -source_file="res://sound/dialogue/animalese/placeholder/u.wav" -dest_files=["res://.godot/imported/u.wav-06e44c423f3d1cd6cdd34b54270211bb.sample"] - -[params] - -force/8_bit=false -force/mono=false -force/max_rate=false -force/max_rate_hz=44100 -edit/trim=false -edit/normalize=false -edit/loop_mode=0 -edit/loop_begin=0 -edit/loop_end=-1 -compress/mode=2 diff --git a/sound/dialogue/animalese/placeholder/v.wav b/sound/dialogue/animalese/placeholder/v.wav deleted file mode 100644 index d5c0d12..0000000 Binary files a/sound/dialogue/animalese/placeholder/v.wav and /dev/null differ diff --git a/sound/dialogue/animalese/placeholder/w.wav b/sound/dialogue/animalese/placeholder/w.wav deleted file mode 100644 index 5122f9c..0000000 Binary files a/sound/dialogue/animalese/placeholder/w.wav and /dev/null differ diff --git a/sound/dialogue/animalese/placeholder/x.wav b/sound/dialogue/animalese/placeholder/x.wav deleted file mode 100644 index e00f085..0000000 Binary files a/sound/dialogue/animalese/placeholder/x.wav and /dev/null differ diff --git a/sound/dialogue/animalese/placeholder/y.wav b/sound/dialogue/animalese/placeholder/y.wav deleted file mode 100644 index 07b45ef..0000000 Binary files a/sound/dialogue/animalese/placeholder/y.wav and /dev/null differ diff --git a/sound/dialogue/animalese/placeholder/z.wav b/sound/dialogue/animalese/placeholder/z.wav deleted file mode 100644 index 8f94654..0000000 Binary files a/sound/dialogue/animalese/placeholder/z.wav and /dev/null differ diff --git a/sound/dialogue/animalese/robot/a.wav b/sound/dialogue/animalese/robot/a.wav new file mode 100644 index 0000000..0e434f7 Binary files /dev/null and b/sound/dialogue/animalese/robot/a.wav differ diff --git a/sound/dialogue/animalese/robot/a.wav.import b/sound/dialogue/animalese/robot/a.wav.import new file mode 100644 index 0000000..6d33ed2 --- /dev/null +++ b/sound/dialogue/animalese/robot/a.wav.import @@ -0,0 +1,24 @@ +[remap] + +importer="wav" +type="AudioStreamWAV" +uid="uid://cg8vgijwjen1h" +path="res://.godot/imported/a.wav-912469cf287b9f82df9e0084967c3138.sample" + +[deps] + +source_file="res://sound/dialogue/animalese/robot/a.wav" +dest_files=["res://.godot/imported/a.wav-912469cf287b9f82df9e0084967c3138.sample"] + +[params] + +force/8_bit=false +force/mono=false +force/max_rate=false +force/max_rate_hz=44100 +edit/trim=false +edit/normalize=false +edit/loop_mode=0 +edit/loop_begin=0 +edit/loop_end=-1 +compress/mode=2 diff --git a/sound/dialogue/animalese/robot/b.wav b/sound/dialogue/animalese/robot/b.wav new file mode 100644 index 0000000..8e24102 Binary files /dev/null and b/sound/dialogue/animalese/robot/b.wav differ diff --git a/sound/dialogue/animalese/robot/b.wav.import b/sound/dialogue/animalese/robot/b.wav.import new file mode 100644 index 0000000..d858d56 --- /dev/null +++ b/sound/dialogue/animalese/robot/b.wav.import @@ -0,0 +1,24 @@ +[remap] + +importer="wav" +type="AudioStreamWAV" +uid="uid://dbn3ilqo34j1l" +path="res://.godot/imported/b.wav-482bec9aa59b1274ddc061acf0928cc3.sample" + +[deps] + +source_file="res://sound/dialogue/animalese/robot/b.wav" +dest_files=["res://.godot/imported/b.wav-482bec9aa59b1274ddc061acf0928cc3.sample"] + +[params] + +force/8_bit=false +force/mono=false +force/max_rate=false +force/max_rate_hz=44100 +edit/trim=false +edit/normalize=false +edit/loop_mode=0 +edit/loop_begin=0 +edit/loop_end=-1 +compress/mode=2 diff --git a/sound/dialogue/animalese/robot/c.wav b/sound/dialogue/animalese/robot/c.wav new file mode 100644 index 0000000..4eb4028 Binary files /dev/null and b/sound/dialogue/animalese/robot/c.wav differ diff --git a/sound/dialogue/animalese/robot/c.wav.import b/sound/dialogue/animalese/robot/c.wav.import new file mode 100644 index 0000000..a32613d --- /dev/null +++ b/sound/dialogue/animalese/robot/c.wav.import @@ -0,0 +1,24 @@ +[remap] + +importer="wav" +type="AudioStreamWAV" +uid="uid://6tmnptljtqms" +path="res://.godot/imported/c.wav-88fe8cecfa21a5d5cf845d6b8679d13c.sample" + +[deps] + +source_file="res://sound/dialogue/animalese/robot/c.wav" +dest_files=["res://.godot/imported/c.wav-88fe8cecfa21a5d5cf845d6b8679d13c.sample"] + +[params] + +force/8_bit=false +force/mono=false +force/max_rate=false +force/max_rate_hz=44100 +edit/trim=false +edit/normalize=false +edit/loop_mode=0 +edit/loop_begin=0 +edit/loop_end=-1 +compress/mode=2 diff --git a/sound/dialogue/animalese/robot/d.wav b/sound/dialogue/animalese/robot/d.wav new file mode 100644 index 0000000..eba38a4 Binary files /dev/null and b/sound/dialogue/animalese/robot/d.wav differ diff --git a/sound/dialogue/animalese/robot/d.wav.import b/sound/dialogue/animalese/robot/d.wav.import new file mode 100644 index 0000000..3732bc7 --- /dev/null +++ b/sound/dialogue/animalese/robot/d.wav.import @@ -0,0 +1,24 @@ +[remap] + +importer="wav" +type="AudioStreamWAV" +uid="uid://btrj6qtm84855" +path="res://.godot/imported/d.wav-ef76f071f3356e954019c5494b963533.sample" + +[deps] + +source_file="res://sound/dialogue/animalese/robot/d.wav" +dest_files=["res://.godot/imported/d.wav-ef76f071f3356e954019c5494b963533.sample"] + +[params] + +force/8_bit=false +force/mono=false +force/max_rate=false +force/max_rate_hz=44100 +edit/trim=false +edit/normalize=false +edit/loop_mode=0 +edit/loop_begin=0 +edit/loop_end=-1 +compress/mode=2 diff --git a/sound/dialogue/animalese/robot/e.wav b/sound/dialogue/animalese/robot/e.wav new file mode 100644 index 0000000..4b54f04 Binary files /dev/null and b/sound/dialogue/animalese/robot/e.wav differ diff --git a/sound/dialogue/animalese/robot/e.wav.import b/sound/dialogue/animalese/robot/e.wav.import new file mode 100644 index 0000000..ce7a9c8 --- /dev/null +++ b/sound/dialogue/animalese/robot/e.wav.import @@ -0,0 +1,24 @@ +[remap] + +importer="wav" +type="AudioStreamWAV" +uid="uid://esdsylelog50" +path="res://.godot/imported/e.wav-e44b4d22c43894915ef0134813dd6ec8.sample" + +[deps] + +source_file="res://sound/dialogue/animalese/robot/e.wav" +dest_files=["res://.godot/imported/e.wav-e44b4d22c43894915ef0134813dd6ec8.sample"] + +[params] + +force/8_bit=false +force/mono=false +force/max_rate=false +force/max_rate_hz=44100 +edit/trim=false +edit/normalize=false +edit/loop_mode=0 +edit/loop_begin=0 +edit/loop_end=-1 +compress/mode=2 diff --git a/sound/dialogue/animalese/robot/f.wav b/sound/dialogue/animalese/robot/f.wav new file mode 100644 index 0000000..e30b889 Binary files /dev/null and b/sound/dialogue/animalese/robot/f.wav differ diff --git a/sound/dialogue/animalese/robot/f.wav.import b/sound/dialogue/animalese/robot/f.wav.import new file mode 100644 index 0000000..c9a3d2f --- /dev/null +++ b/sound/dialogue/animalese/robot/f.wav.import @@ -0,0 +1,24 @@ +[remap] + +importer="wav" +type="AudioStreamWAV" +uid="uid://xb01jed4d7xl" +path="res://.godot/imported/f.wav-06750a71b9dfd09a72792c85901ef2e0.sample" + +[deps] + +source_file="res://sound/dialogue/animalese/robot/f.wav" +dest_files=["res://.godot/imported/f.wav-06750a71b9dfd09a72792c85901ef2e0.sample"] + +[params] + +force/8_bit=false +force/mono=false +force/max_rate=false +force/max_rate_hz=44100 +edit/trim=false +edit/normalize=false +edit/loop_mode=0 +edit/loop_begin=0 +edit/loop_end=-1 +compress/mode=2 diff --git a/sound/dialogue/animalese/robot/fallback.wav b/sound/dialogue/animalese/robot/fallback.wav new file mode 100644 index 0000000..54ca7ca Binary files /dev/null and b/sound/dialogue/animalese/robot/fallback.wav differ diff --git a/sound/dialogue/animalese/robot/fallback.wav.import b/sound/dialogue/animalese/robot/fallback.wav.import new file mode 100644 index 0000000..a62bdeb --- /dev/null +++ b/sound/dialogue/animalese/robot/fallback.wav.import @@ -0,0 +1,24 @@ +[remap] + +importer="wav" +type="AudioStreamWAV" +uid="uid://cebc27kmdv7bt" +path="res://.godot/imported/fallback.wav-70adb8cf4fa8834ef769dc92854a5f89.sample" + +[deps] + +source_file="res://sound/dialogue/animalese/robot/fallback.wav" +dest_files=["res://.godot/imported/fallback.wav-70adb8cf4fa8834ef769dc92854a5f89.sample"] + +[params] + +force/8_bit=false +force/mono=false +force/max_rate=false +force/max_rate_hz=44100 +edit/trim=false +edit/normalize=false +edit/loop_mode=0 +edit/loop_begin=0 +edit/loop_end=-1 +compress/mode=2 diff --git a/sound/dialogue/animalese/robot/g.wav b/sound/dialogue/animalese/robot/g.wav new file mode 100644 index 0000000..d659358 Binary files /dev/null and b/sound/dialogue/animalese/robot/g.wav differ diff --git a/sound/dialogue/animalese/robot/g.wav.import b/sound/dialogue/animalese/robot/g.wav.import new file mode 100644 index 0000000..1c619ad --- /dev/null +++ b/sound/dialogue/animalese/robot/g.wav.import @@ -0,0 +1,24 @@ +[remap] + +importer="wav" +type="AudioStreamWAV" +uid="uid://cxnixxqcol7cf" +path="res://.godot/imported/g.wav-bab051202eead7ae86eb50d16fe7ae4d.sample" + +[deps] + +source_file="res://sound/dialogue/animalese/robot/g.wav" +dest_files=["res://.godot/imported/g.wav-bab051202eead7ae86eb50d16fe7ae4d.sample"] + +[params] + +force/8_bit=false +force/mono=false +force/max_rate=false +force/max_rate_hz=44100 +edit/trim=false +edit/normalize=false +edit/loop_mode=0 +edit/loop_begin=0 +edit/loop_end=-1 +compress/mode=2 diff --git a/sound/dialogue/animalese/robot/h.wav b/sound/dialogue/animalese/robot/h.wav new file mode 100644 index 0000000..3363245 Binary files /dev/null and b/sound/dialogue/animalese/robot/h.wav differ diff --git a/sound/dialogue/animalese/robot/h.wav.import b/sound/dialogue/animalese/robot/h.wav.import new file mode 100644 index 0000000..c7a868b --- /dev/null +++ b/sound/dialogue/animalese/robot/h.wav.import @@ -0,0 +1,24 @@ +[remap] + +importer="wav" +type="AudioStreamWAV" +uid="uid://cyssmnjalcjh1" +path="res://.godot/imported/h.wav-82eb606f12a9a3898f9adc04f47242bc.sample" + +[deps] + +source_file="res://sound/dialogue/animalese/robot/h.wav" +dest_files=["res://.godot/imported/h.wav-82eb606f12a9a3898f9adc04f47242bc.sample"] + +[params] + +force/8_bit=false +force/mono=false +force/max_rate=false +force/max_rate_hz=44100 +edit/trim=false +edit/normalize=false +edit/loop_mode=0 +edit/loop_begin=0 +edit/loop_end=-1 +compress/mode=2 diff --git a/sound/dialogue/animalese/robot/i.wav b/sound/dialogue/animalese/robot/i.wav new file mode 100644 index 0000000..c0b5ce8 Binary files /dev/null and b/sound/dialogue/animalese/robot/i.wav differ diff --git a/sound/dialogue/animalese/robot/i.wav.import b/sound/dialogue/animalese/robot/i.wav.import new file mode 100644 index 0000000..94f36d8 --- /dev/null +++ b/sound/dialogue/animalese/robot/i.wav.import @@ -0,0 +1,24 @@ +[remap] + +importer="wav" +type="AudioStreamWAV" +uid="uid://cvng0omshxqb1" +path="res://.godot/imported/i.wav-efaf75378a992fa714224dedfe31ed34.sample" + +[deps] + +source_file="res://sound/dialogue/animalese/robot/i.wav" +dest_files=["res://.godot/imported/i.wav-efaf75378a992fa714224dedfe31ed34.sample"] + +[params] + +force/8_bit=false +force/mono=false +force/max_rate=false +force/max_rate_hz=44100 +edit/trim=false +edit/normalize=false +edit/loop_mode=0 +edit/loop_begin=0 +edit/loop_end=-1 +compress/mode=2 diff --git a/sound/dialogue/animalese/robot/j.wav b/sound/dialogue/animalese/robot/j.wav new file mode 100644 index 0000000..f5f2e24 Binary files /dev/null and b/sound/dialogue/animalese/robot/j.wav differ diff --git a/sound/dialogue/animalese/robot/j.wav.import b/sound/dialogue/animalese/robot/j.wav.import new file mode 100644 index 0000000..b9a9adf --- /dev/null +++ b/sound/dialogue/animalese/robot/j.wav.import @@ -0,0 +1,24 @@ +[remap] + +importer="wav" +type="AudioStreamWAV" +uid="uid://b8roqgoeyo3l8" +path="res://.godot/imported/j.wav-822afb34d9e86d0e6fb2f2e871c11a99.sample" + +[deps] + +source_file="res://sound/dialogue/animalese/robot/j.wav" +dest_files=["res://.godot/imported/j.wav-822afb34d9e86d0e6fb2f2e871c11a99.sample"] + +[params] + +force/8_bit=false +force/mono=false +force/max_rate=false +force/max_rate_hz=44100 +edit/trim=false +edit/normalize=false +edit/loop_mode=0 +edit/loop_begin=0 +edit/loop_end=-1 +compress/mode=2 diff --git a/sound/dialogue/animalese/robot/k.wav b/sound/dialogue/animalese/robot/k.wav new file mode 100644 index 0000000..f9c6b5c Binary files /dev/null and b/sound/dialogue/animalese/robot/k.wav differ diff --git a/sound/dialogue/animalese/placeholder/l.wav.import b/sound/dialogue/animalese/robot/k.wav.import similarity index 52% rename from sound/dialogue/animalese/placeholder/l.wav.import rename to sound/dialogue/animalese/robot/k.wav.import index 8193ecf..ca3086f 100644 --- a/sound/dialogue/animalese/placeholder/l.wav.import +++ b/sound/dialogue/animalese/robot/k.wav.import @@ -2,13 +2,13 @@ importer="wav" type="AudioStreamWAV" -uid="uid://bixgnaq4idkhj" -path="res://.godot/imported/l.wav-b21006c3b048e0c797d6baf19ab0f663.sample" +uid="uid://b2x5ijnb38tnv" +path="res://.godot/imported/k.wav-253c9eda1dc82ce4e496727f8805ed63.sample" [deps] -source_file="res://sound/dialogue/animalese/placeholder/l.wav" -dest_files=["res://.godot/imported/l.wav-b21006c3b048e0c797d6baf19ab0f663.sample"] +source_file="res://sound/dialogue/animalese/robot/k.wav" +dest_files=["res://.godot/imported/k.wav-253c9eda1dc82ce4e496727f8805ed63.sample"] [params] diff --git a/sound/dialogue/animalese/robot/l.wav b/sound/dialogue/animalese/robot/l.wav new file mode 100644 index 0000000..cc1d512 Binary files /dev/null and b/sound/dialogue/animalese/robot/l.wav differ diff --git a/sound/dialogue/animalese/robot/l.wav.import b/sound/dialogue/animalese/robot/l.wav.import new file mode 100644 index 0000000..7f77dac --- /dev/null +++ b/sound/dialogue/animalese/robot/l.wav.import @@ -0,0 +1,24 @@ +[remap] + +importer="wav" +type="AudioStreamWAV" +uid="uid://dtobkfled545r" +path="res://.godot/imported/l.wav-74470cbddad2ea89893332702c74ae8d.sample" + +[deps] + +source_file="res://sound/dialogue/animalese/robot/l.wav" +dest_files=["res://.godot/imported/l.wav-74470cbddad2ea89893332702c74ae8d.sample"] + +[params] + +force/8_bit=false +force/mono=false +force/max_rate=false +force/max_rate_hz=44100 +edit/trim=false +edit/normalize=false +edit/loop_mode=0 +edit/loop_begin=0 +edit/loop_end=-1 +compress/mode=2 diff --git a/sound/dialogue/animalese/robot/m.wav b/sound/dialogue/animalese/robot/m.wav new file mode 100644 index 0000000..7359a06 Binary files /dev/null and b/sound/dialogue/animalese/robot/m.wav differ diff --git a/sound/dialogue/animalese/robot/m.wav.import b/sound/dialogue/animalese/robot/m.wav.import new file mode 100644 index 0000000..cc0ebdf --- /dev/null +++ b/sound/dialogue/animalese/robot/m.wav.import @@ -0,0 +1,24 @@ +[remap] + +importer="wav" +type="AudioStreamWAV" +uid="uid://x53vy8vfb0v7" +path="res://.godot/imported/m.wav-3282c0735e81b1924994c0f641854897.sample" + +[deps] + +source_file="res://sound/dialogue/animalese/robot/m.wav" +dest_files=["res://.godot/imported/m.wav-3282c0735e81b1924994c0f641854897.sample"] + +[params] + +force/8_bit=false +force/mono=false +force/max_rate=false +force/max_rate_hz=44100 +edit/trim=false +edit/normalize=false +edit/loop_mode=0 +edit/loop_begin=0 +edit/loop_end=-1 +compress/mode=2 diff --git a/sound/dialogue/animalese/robot/n.wav b/sound/dialogue/animalese/robot/n.wav new file mode 100644 index 0000000..a505906 Binary files /dev/null and b/sound/dialogue/animalese/robot/n.wav differ diff --git a/sound/dialogue/animalese/robot/n.wav.import b/sound/dialogue/animalese/robot/n.wav.import new file mode 100644 index 0000000..3122cfb --- /dev/null +++ b/sound/dialogue/animalese/robot/n.wav.import @@ -0,0 +1,24 @@ +[remap] + +importer="wav" +type="AudioStreamWAV" +uid="uid://cktk3r2ociatv" +path="res://.godot/imported/n.wav-38bfd5021f583b1a472e0c265ddc01e0.sample" + +[deps] + +source_file="res://sound/dialogue/animalese/robot/n.wav" +dest_files=["res://.godot/imported/n.wav-38bfd5021f583b1a472e0c265ddc01e0.sample"] + +[params] + +force/8_bit=false +force/mono=false +force/max_rate=false +force/max_rate_hz=44100 +edit/trim=false +edit/normalize=false +edit/loop_mode=0 +edit/loop_begin=0 +edit/loop_end=-1 +compress/mode=2 diff --git a/sound/dialogue/animalese/robot/o.wav b/sound/dialogue/animalese/robot/o.wav new file mode 100644 index 0000000..7e8cb61 Binary files /dev/null and b/sound/dialogue/animalese/robot/o.wav differ diff --git a/sound/dialogue/animalese/robot/o.wav.import b/sound/dialogue/animalese/robot/o.wav.import new file mode 100644 index 0000000..58596f6 --- /dev/null +++ b/sound/dialogue/animalese/robot/o.wav.import @@ -0,0 +1,24 @@ +[remap] + +importer="wav" +type="AudioStreamWAV" +uid="uid://exnucx2mi3nk" +path="res://.godot/imported/o.wav-c2146198bb8a83542393735ccb97a983.sample" + +[deps] + +source_file="res://sound/dialogue/animalese/robot/o.wav" +dest_files=["res://.godot/imported/o.wav-c2146198bb8a83542393735ccb97a983.sample"] + +[params] + +force/8_bit=false +force/mono=false +force/max_rate=false +force/max_rate_hz=44100 +edit/trim=false +edit/normalize=false +edit/loop_mode=0 +edit/loop_begin=0 +edit/loop_end=-1 +compress/mode=2 diff --git a/sound/dialogue/animalese/robot/p.wav b/sound/dialogue/animalese/robot/p.wav new file mode 100644 index 0000000..770c2ea Binary files /dev/null and b/sound/dialogue/animalese/robot/p.wav differ diff --git a/sound/dialogue/animalese/placeholder/c.wav.import b/sound/dialogue/animalese/robot/p.wav.import similarity index 52% rename from sound/dialogue/animalese/placeholder/c.wav.import rename to sound/dialogue/animalese/robot/p.wav.import index bbd8074..5b0c010 100644 --- a/sound/dialogue/animalese/placeholder/c.wav.import +++ b/sound/dialogue/animalese/robot/p.wav.import @@ -2,13 +2,13 @@ importer="wav" type="AudioStreamWAV" -uid="uid://2inox7x31xam" -path="res://.godot/imported/c.wav-61dc49533634805d70c71d509b63e37b.sample" +uid="uid://jgnbqcbt0t64" +path="res://.godot/imported/p.wav-b5d1c85200b8e57e540534fa6782857b.sample" [deps] -source_file="res://sound/dialogue/animalese/placeholder/c.wav" -dest_files=["res://.godot/imported/c.wav-61dc49533634805d70c71d509b63e37b.sample"] +source_file="res://sound/dialogue/animalese/robot/p.wav" +dest_files=["res://.godot/imported/p.wav-b5d1c85200b8e57e540534fa6782857b.sample"] [params] diff --git a/sound/dialogue/animalese/robot/q.wav b/sound/dialogue/animalese/robot/q.wav new file mode 100644 index 0000000..f7ec879 Binary files /dev/null and b/sound/dialogue/animalese/robot/q.wav differ diff --git a/sound/dialogue/animalese/robot/q.wav.import b/sound/dialogue/animalese/robot/q.wav.import new file mode 100644 index 0000000..a624666 --- /dev/null +++ b/sound/dialogue/animalese/robot/q.wav.import @@ -0,0 +1,24 @@ +[remap] + +importer="wav" +type="AudioStreamWAV" +uid="uid://ycgqs14iexxe" +path="res://.godot/imported/q.wav-27ccb3c315837cff45c092f2c543d9c3.sample" + +[deps] + +source_file="res://sound/dialogue/animalese/robot/q.wav" +dest_files=["res://.godot/imported/q.wav-27ccb3c315837cff45c092f2c543d9c3.sample"] + +[params] + +force/8_bit=false +force/mono=false +force/max_rate=false +force/max_rate_hz=44100 +edit/trim=false +edit/normalize=false +edit/loop_mode=0 +edit/loop_begin=0 +edit/loop_end=-1 +compress/mode=2 diff --git a/sound/dialogue/animalese/robot/r.wav b/sound/dialogue/animalese/robot/r.wav new file mode 100644 index 0000000..9a3b293 Binary files /dev/null and b/sound/dialogue/animalese/robot/r.wav differ diff --git a/sound/dialogue/animalese/robot/r.wav.import b/sound/dialogue/animalese/robot/r.wav.import new file mode 100644 index 0000000..a64a6b2 --- /dev/null +++ b/sound/dialogue/animalese/robot/r.wav.import @@ -0,0 +1,24 @@ +[remap] + +importer="wav" +type="AudioStreamWAV" +uid="uid://bun5h3babtwrw" +path="res://.godot/imported/r.wav-7370fd302d45d0a79de1eb3caf1fa0e2.sample" + +[deps] + +source_file="res://sound/dialogue/animalese/robot/r.wav" +dest_files=["res://.godot/imported/r.wav-7370fd302d45d0a79de1eb3caf1fa0e2.sample"] + +[params] + +force/8_bit=false +force/mono=false +force/max_rate=false +force/max_rate_hz=44100 +edit/trim=false +edit/normalize=false +edit/loop_mode=0 +edit/loop_begin=0 +edit/loop_end=-1 +compress/mode=2 diff --git a/sound/dialogue/animalese/robot/s.wav b/sound/dialogue/animalese/robot/s.wav new file mode 100644 index 0000000..0847120 Binary files /dev/null and b/sound/dialogue/animalese/robot/s.wav differ diff --git a/sound/dialogue/animalese/robot/s.wav.import b/sound/dialogue/animalese/robot/s.wav.import new file mode 100644 index 0000000..a65ebe9 --- /dev/null +++ b/sound/dialogue/animalese/robot/s.wav.import @@ -0,0 +1,24 @@ +[remap] + +importer="wav" +type="AudioStreamWAV" +uid="uid://ds02uafo1fulk" +path="res://.godot/imported/s.wav-d021f184e6f257c8c38e99166409779b.sample" + +[deps] + +source_file="res://sound/dialogue/animalese/robot/s.wav" +dest_files=["res://.godot/imported/s.wav-d021f184e6f257c8c38e99166409779b.sample"] + +[params] + +force/8_bit=false +force/mono=false +force/max_rate=false +force/max_rate_hz=44100 +edit/trim=false +edit/normalize=false +edit/loop_mode=0 +edit/loop_begin=0 +edit/loop_end=-1 +compress/mode=2 diff --git a/sound/dialogue/animalese/robot/t.wav b/sound/dialogue/animalese/robot/t.wav new file mode 100644 index 0000000..fef9bf0 Binary files /dev/null and b/sound/dialogue/animalese/robot/t.wav differ diff --git a/sound/dialogue/animalese/robot/t.wav.import b/sound/dialogue/animalese/robot/t.wav.import new file mode 100644 index 0000000..86242c0 --- /dev/null +++ b/sound/dialogue/animalese/robot/t.wav.import @@ -0,0 +1,24 @@ +[remap] + +importer="wav" +type="AudioStreamWAV" +uid="uid://ouvxq1dsnqsc" +path="res://.godot/imported/t.wav-12b718527178b570cfd5eedb8c04297e.sample" + +[deps] + +source_file="res://sound/dialogue/animalese/robot/t.wav" +dest_files=["res://.godot/imported/t.wav-12b718527178b570cfd5eedb8c04297e.sample"] + +[params] + +force/8_bit=false +force/mono=false +force/max_rate=false +force/max_rate_hz=44100 +edit/trim=false +edit/normalize=false +edit/loop_mode=0 +edit/loop_begin=0 +edit/loop_end=-1 +compress/mode=2 diff --git a/sound/dialogue/animalese/robot/u.wav b/sound/dialogue/animalese/robot/u.wav new file mode 100644 index 0000000..d2d148d Binary files /dev/null and b/sound/dialogue/animalese/robot/u.wav differ diff --git a/sound/dialogue/animalese/robot/u.wav.import b/sound/dialogue/animalese/robot/u.wav.import new file mode 100644 index 0000000..2703c24 --- /dev/null +++ b/sound/dialogue/animalese/robot/u.wav.import @@ -0,0 +1,24 @@ +[remap] + +importer="wav" +type="AudioStreamWAV" +uid="uid://dd3ece0ndg16y" +path="res://.godot/imported/u.wav-06fb03902c67d2949aa71cdb8e1f8bf0.sample" + +[deps] + +source_file="res://sound/dialogue/animalese/robot/u.wav" +dest_files=["res://.godot/imported/u.wav-06fb03902c67d2949aa71cdb8e1f8bf0.sample"] + +[params] + +force/8_bit=false +force/mono=false +force/max_rate=false +force/max_rate_hz=44100 +edit/trim=false +edit/normalize=false +edit/loop_mode=0 +edit/loop_begin=0 +edit/loop_end=-1 +compress/mode=2 diff --git a/sound/dialogue/animalese/robot/v.wav b/sound/dialogue/animalese/robot/v.wav new file mode 100644 index 0000000..32d8341 Binary files /dev/null and b/sound/dialogue/animalese/robot/v.wav differ diff --git a/sound/dialogue/animalese/robot/v.wav.import b/sound/dialogue/animalese/robot/v.wav.import new file mode 100644 index 0000000..a82ae8a --- /dev/null +++ b/sound/dialogue/animalese/robot/v.wav.import @@ -0,0 +1,24 @@ +[remap] + +importer="wav" +type="AudioStreamWAV" +uid="uid://cn1reodu8saiy" +path="res://.godot/imported/v.wav-d3ebbf2d472bce20fe0792395ed4d049.sample" + +[deps] + +source_file="res://sound/dialogue/animalese/robot/v.wav" +dest_files=["res://.godot/imported/v.wav-d3ebbf2d472bce20fe0792395ed4d049.sample"] + +[params] + +force/8_bit=false +force/mono=false +force/max_rate=false +force/max_rate_hz=44100 +edit/trim=false +edit/normalize=false +edit/loop_mode=0 +edit/loop_begin=0 +edit/loop_end=-1 +compress/mode=2 diff --git a/sound/dialogue/animalese/robot/w.wav b/sound/dialogue/animalese/robot/w.wav new file mode 100644 index 0000000..68d06c2 Binary files /dev/null and b/sound/dialogue/animalese/robot/w.wav differ diff --git a/sound/dialogue/animalese/placeholder/o.wav.import b/sound/dialogue/animalese/robot/w.wav.import similarity index 52% rename from sound/dialogue/animalese/placeholder/o.wav.import rename to sound/dialogue/animalese/robot/w.wav.import index b094a9f..76cbec4 100644 --- a/sound/dialogue/animalese/placeholder/o.wav.import +++ b/sound/dialogue/animalese/robot/w.wav.import @@ -2,13 +2,13 @@ importer="wav" type="AudioStreamWAV" -uid="uid://lntkug4avr2k" -path="res://.godot/imported/o.wav-6c18faa9701875d7753d91afcd1b09e6.sample" +uid="uid://bfbipoalvo37y" +path="res://.godot/imported/w.wav-fa8b04d920c43f155d3f4a909a2ee5e6.sample" [deps] -source_file="res://sound/dialogue/animalese/placeholder/o.wav" -dest_files=["res://.godot/imported/o.wav-6c18faa9701875d7753d91afcd1b09e6.sample"] +source_file="res://sound/dialogue/animalese/robot/w.wav" +dest_files=["res://.godot/imported/w.wav-fa8b04d920c43f155d3f4a909a2ee5e6.sample"] [params] diff --git a/sound/dialogue/animalese/robot/x.wav b/sound/dialogue/animalese/robot/x.wav new file mode 100644 index 0000000..24e8604 Binary files /dev/null and b/sound/dialogue/animalese/robot/x.wav differ diff --git a/sound/dialogue/animalese/robot/x.wav.import b/sound/dialogue/animalese/robot/x.wav.import new file mode 100644 index 0000000..d54fe68 --- /dev/null +++ b/sound/dialogue/animalese/robot/x.wav.import @@ -0,0 +1,24 @@ +[remap] + +importer="wav" +type="AudioStreamWAV" +uid="uid://e4bx33654fbn" +path="res://.godot/imported/x.wav-ce5e1553c073860351f5d4de3da6af28.sample" + +[deps] + +source_file="res://sound/dialogue/animalese/robot/x.wav" +dest_files=["res://.godot/imported/x.wav-ce5e1553c073860351f5d4de3da6af28.sample"] + +[params] + +force/8_bit=false +force/mono=false +force/max_rate=false +force/max_rate_hz=44100 +edit/trim=false +edit/normalize=false +edit/loop_mode=0 +edit/loop_begin=0 +edit/loop_end=-1 +compress/mode=2 diff --git a/sound/dialogue/animalese/robot/y.wav b/sound/dialogue/animalese/robot/y.wav new file mode 100644 index 0000000..414a176 Binary files /dev/null and b/sound/dialogue/animalese/robot/y.wav differ diff --git a/sound/dialogue/animalese/robot/y.wav.import b/sound/dialogue/animalese/robot/y.wav.import new file mode 100644 index 0000000..023e8ae --- /dev/null +++ b/sound/dialogue/animalese/robot/y.wav.import @@ -0,0 +1,24 @@ +[remap] + +importer="wav" +type="AudioStreamWAV" +uid="uid://b3ns0qyyvxqgt" +path="res://.godot/imported/y.wav-f5e15ad92e6316d22a5263c8296dff17.sample" + +[deps] + +source_file="res://sound/dialogue/animalese/robot/y.wav" +dest_files=["res://.godot/imported/y.wav-f5e15ad92e6316d22a5263c8296dff17.sample"] + +[params] + +force/8_bit=false +force/mono=false +force/max_rate=false +force/max_rate_hz=44100 +edit/trim=false +edit/normalize=false +edit/loop_mode=0 +edit/loop_begin=0 +edit/loop_end=-1 +compress/mode=2 diff --git a/sound/dialogue/animalese/robot/z.wav b/sound/dialogue/animalese/robot/z.wav new file mode 100644 index 0000000..243bab2 Binary files /dev/null and b/sound/dialogue/animalese/robot/z.wav differ diff --git a/sound/dialogue/animalese/robot/z.wav.import b/sound/dialogue/animalese/robot/z.wav.import new file mode 100644 index 0000000..1ee68f8 --- /dev/null +++ b/sound/dialogue/animalese/robot/z.wav.import @@ -0,0 +1,24 @@ +[remap] + +importer="wav" +type="AudioStreamWAV" +uid="uid://cu8vaak45mcna" +path="res://.godot/imported/z.wav-bde1bea473ae6ddcfb32432d5206e265.sample" + +[deps] + +source_file="res://sound/dialogue/animalese/robot/z.wav" +dest_files=["res://.godot/imported/z.wav-bde1bea473ae6ddcfb32432d5206e265.sample"] + +[params] + +force/8_bit=false +force/mono=false +force/max_rate=false +force/max_rate_hz=44100 +edit/trim=false +edit/normalize=false +edit/loop_mode=0 +edit/loop_begin=0 +edit/loop_end=-1 +compress/mode=2 diff --git a/tests/android_readiness_validation.gd b/tests/android_readiness_validation.gd index b383202..7472063 100644 --- a/tests/android_readiness_validation.gd +++ b/tests/android_readiness_validation.gd @@ -21,6 +21,7 @@ func _init() -> void: assert(_has_joypad_button(&"ui_accept", JOY_BUTTON_A)) assert(_has_joypad_button(&"ui_cancel", JOY_BUTTON_B)) assert(_has_joypad_button(&"interact", JOY_BUTTON_Y)) + assert(_has_joypad_button(&"character_call", JOY_BUTTON_Y)) assert(_has_joypad_button(&"fish_primary", JOY_BUTTON_RIGHT_SHOULDER)) assert(not _has_joypad_motion( &"fish_primary", JOY_AXIS_TRIGGER_LEFT, 1.0 diff --git a/tests/art_tools_validation.gd b/tests/art_tools_validation.gd index 6384d19..146fb4e 100644 --- a/tests/art_tools_validation.gd +++ b/tests/art_tools_validation.gd @@ -19,14 +19,21 @@ func _run() -> void: for _frame: int in 8: await process_frame assert(bool(main.get("_application_initialized"))) + assert(bool(main.call( + "_apply_world", WorldLayout.STARTER_ISLAND, 1, true + ))) + assert(bool(main.call( + "_prepare_host_world", WorldLayout.STARTER_ISLAND, 1 + ))) assert(bool(main.call("_prepare_private_host"))) var save_manager := main.get("_save_manager") as PlayerSaveManager - assert(save_manager.initialize_new_game()) + assert(save_manager.initialize_new_game(1, WorldLayout.STARTER_ISLAND)) main.call("_enter_gameplay") await physics_frame await physics_frame var player := main.get("_player") as Player + var session := main.get_node("%NetworkSession") as NetworkSession var sprint_dust := player.get_node("%SprintDust") as SprintDustTrail assert(sprint_dust != null) assert(sprint_dust.get_active_puff_count() == 0) @@ -80,42 +87,79 @@ func _run() -> void: "%NetworkSurfaceDrawingService" ) as NetworkSurfaceDrawingService var game_ui := main.get_node("%GameUI") as GameUI + var keyboard_mapping := main.get_node( + "%KeyboardMouseMappingManager" + ) as KeyboardMouseMappingManager var toolbar := game_ui.get_node( "%SurfaceDrawingToolbar" ) as SurfaceDrawingToolbar var chat_ui := game_ui.get_node("%ChatUI") as ChatUI assert(player != null and service != null and toolbar != null) assert(chat_ui != null) + assert(keyboard_mapping != null) + assert(keyboard_mapping.reset_mapping()) + await process_frame + var shop_prompt_key := game_ui.get_node("%ShopPromptKey") as Label + assert(shop_prompt_key.text == "E") + var remapped_interact := InputEventKey.new() + remapped_interact.physical_keycode = KEY_F + remapped_interact.pressed = true + assert(keyboard_mapping.set_binding( + KeyboardMouseMappingManager.ROLE_INTERACT, + keyboard_mapping.binding_from_event(remapped_interact), + )) + await process_frame + assert(shop_prompt_key.text == "F") + assert(keyboard_mapping.reset_mapping()) + await process_frame + assert(toolbar.get_parent() == chat_ui.get_parent()) + assert( + toolbar.get_index() > chat_ui.get_index(), + "The art-kit toolbar must receive overlapping pointer input before Chat.", + ) assert(bool(game_ui.call("_can_start_virtual_mouse"))) + var virtual_pointer_states: Array[bool] = [] + game_ui.virtual_pointer_mode_changed.connect( + func(active: bool) -> void: virtual_pointer_states.append(active) + ) game_ui.call("_begin_virtual_mouse", 0) var virtual_cursor := game_ui.get_node( "%ControllerVirtualCursor" ) as ControllerVirtualCursor assert(virtual_cursor.visible) + assert(virtual_pointer_states == [true]) + # PopupMenu subwindows can consume the physical shoulder release. The + # polled primary-button state must still release the synthetic mouse click. + game_ui.set("_virtual_mouse_button_mask", MOUSE_BUTTON_MASK_LEFT) + game_ui.call("_sync_virtual_mouse_primary_button", false) + assert(int(game_ui.get("_virtual_mouse_button_mask")) == 0) assert(not player.is_camera_input_enabled()) game_ui.call("_end_virtual_mouse") assert(not virtual_cursor.visible) + assert(virtual_pointer_states == [true, false]) assert(player.is_camera_input_enabled()) var settings_panel := game_ui.get( "_pause_settings_panel" ) as SettingsPanel - var chat_dock_button := settings_panel.get_node("%ChatDock") as BubbleButton - var chat_mode_button := settings_panel.get_node("%ChatMode") as BubbleButton - var paint_dock_button := settings_panel.get_node("%PaintDock") as BubbleButton - assert(chat_dock_button.neutral_size.x == chat_dock_button.neutral_size.y) - assert(chat_mode_button.neutral_size.x == chat_mode_button.neutral_size.y) - assert(paint_dock_button.neutral_size.x == paint_dock_button.neutral_size.y) + var chat_dock_selector := settings_panel.get_node( + "%ChatDockSelector" + ) as OptionButton + var chat_mode_selector := settings_panel.get_node( + "%ChatModeSelector" + ) as OptionButton + var paint_dock_selector := settings_panel.get_node( + "%PaintDockSelector" + ) as OptionButton + assert(chat_dock_selector != null) + assert(chat_mode_selector != null) + assert(paint_dock_selector != null) + assert(chat_dock_selector.custom_minimum_size.x == 300.0) + assert(chat_mode_selector.custom_minimum_size.x == 300.0) + assert(paint_dock_selector.custom_minimum_size.x == 300.0) assert( - chat_dock_button.compact_minimum_size.x - == chat_dock_button.compact_minimum_size.y - ) - assert( - chat_mode_button.compact_minimum_size.x - == chat_mode_button.compact_minimum_size.y - ) - assert( - paint_dock_button.compact_minimum_size.x - == paint_dock_button.compact_minimum_size.y + settings_panel.find_children( + "*", "BubbleButton", true, false + ).is_empty() ) assert(not chat_ui.is_docked_right()) assert(toolbar.is_docked_right()) @@ -129,6 +173,12 @@ func _run() -> void: changed_docks.paint_dock_right = false assert(settings_manager.apply_settings(changed_docks)) await process_frame + assert(not chat_ui.is_docked_right()) + assert(not chat_ui.is_mobile_mode()) + assert(toolbar.is_docked_right()) + changed_docks.presentation_layout_customized = true + assert(settings_manager.apply_settings(changed_docks)) + await process_frame assert(chat_ui.is_docked_right()) assert(chat_ui.is_mobile_mode()) assert(not toolbar.is_docked_right()) @@ -151,7 +201,31 @@ func _run() -> void: assert(reloaded_settings.current_settings.chat_dock_right) assert(reloaded_settings.current_settings.chat_mobile_mode) assert(not reloaded_settings.current_settings.paint_dock_right) + assert(reloaded_settings.current_settings.presentation_layout_customized) reloaded_settings.queue_free() + var legacy_data: Dictionary = JSON.parse_string( + FileAccess.get_file_as_string(PlayerSettingsManager.SETTINGS_PATH) + ) as Dictionary + var legacy_presentation := legacy_data.get("presentation", {}) as Dictionary + legacy_presentation.erase("layout_customized") + legacy_data["presentation"] = legacy_presentation + var legacy_file := FileAccess.open( + PlayerSettingsManager.SETTINGS_PATH, + FileAccess.WRITE, + ) + assert(legacy_file != null) + legacy_file.store_string(JSON.stringify(legacy_data, "\t")) + legacy_file.close() + var migrated_legacy_settings := PlayerSettingsManager.new() + root.add_child(migrated_legacy_settings) + assert(migrated_legacy_settings.load_settings()) + assert(not migrated_legacy_settings.current_settings.chat_dock_right) + assert(not migrated_legacy_settings.current_settings.chat_mobile_mode) + assert(migrated_legacy_settings.current_settings.paint_dock_right) + assert( + not migrated_legacy_settings.current_settings.presentation_layout_customized + ) + migrated_legacy_settings.queue_free() var default_docks: PlayerSettings = settings_manager.current_settings.copy() default_docks.chat_dock_right = false default_docks.chat_mobile_mode = false @@ -203,8 +277,46 @@ func _run() -> void: else: assert(not typed_chat_entry.virtual_keyboard_enabled) assert(on_screen_keyboard.is_open()) + + # A bite temporarily owns gameplay input without discarding an in-progress + # message. The draft and insertion point return only after fishing releases + # that ownership, and any controller keyboard follows the restored field. + var chat_fishing_spot := main.get_node("%FishingSpot") as FishingSpot + assert(chat_fishing_spot != null) + var interrupted_draft := "finish this message after fishing" + var interrupted_caret: int = 12 + typed_chat_entry.text = interrupted_draft + typed_chat_entry.caret_column = interrupted_caret + chat_fishing_spot.call("_set_fishing_input_priority", true) + await process_frame + assert(not chat_ui.is_open()) + assert(not bool(chat_ui.get("_input_lock_applied"))) + assert(chat_ui.has_fishing_resume_pending()) + assert(not on_screen_keyboard.is_open()) + chat_ui.open_chat() + assert(not chat_ui.is_open()) + chat_fishing_spot.call("_set_fishing_input_priority", false) + for _frame: int in 4: + await process_frame + assert(chat_ui.is_open()) + assert(typed_chat_entry.text == interrupted_draft) + assert(typed_chat_entry.caret_column == interrupted_caret) + assert(bool(chat_ui.get("_input_lock_applied"))) + if not DisplayServer.has_feature(DisplayServer.FEATURE_VIRTUAL_KEYBOARD): + assert(on_screen_keyboard.is_open()) on_screen_keyboard.call("_close_keyboard", true) assert(typed_chat_entry.has_focus()) + + # A deferred Standby bite has not started the fishing minigame yet. It must + # release fishing's input ownership so chat remains available until the + # player confirms the bite. + chat_fishing_spot.call("_set_fishing_input_priority", true) + chat_fishing_spot.call("_set_bite_confirmation_pending", true) + for _frame: int in 4: + await process_frame + assert(not chat_fishing_spot.is_fishing_input_priority_active()) + assert(chat_ui.is_open()) + chat_fishing_spot.call("_set_bite_confirmation_pending", false) var left_bumper := InputEventJoypadButton.new() left_bumper.button_index = JOY_BUTTON_LEFT_SHOULDER left_bumper.pressed = true @@ -221,6 +333,15 @@ func _run() -> void: assert(bool(game_ui.call("_handle_controller_chat_controls", select_button))) assert(chat_ui.is_open()) chat_ui.refocus_gameplay() + chat_ui.open_chat() + assert(chat_ui.is_open()) + typed_chat_entry.text = "validation message" + chat_ui.call("_send") + assert(not chat_ui.is_open()) + assert(not typed_chat_entry.has_focus()) + assert(not bool(chat_ui.get("_input_lock_applied"))) + assert(not chat_status.visible) + assert(chat_status.text.is_empty()) var quick_menu := game_ui.get_node( "%QuickRadialMenu" ) as QuickRadialMenu @@ -253,6 +374,74 @@ func _run() -> void: right_stick_motion.axis_value = 0.0 Input.parse_input_event(right_stick_motion) await process_frame + + var free_camera_body := player.get("_free_camera_body") as CharacterBody3D + assert(free_camera_body != null) + # A released fishing cast locks only the avatar. The detached camera must + # continue to accept translation while that movement lock is active. + player.set_movement_enabled(false) + var cast_locked_camera_position: Vector3 = free_camera_body.global_position + Input.action_press("move_forward") + for _frame: int in 3: + await physics_frame + Input.action_release("move_forward") + assert(not free_camera_body.global_position.is_equal_approx( + cast_locked_camera_position + )) + player.set_movement_enabled(true) + + # Chat owns all movement while text entry is active, including developer + # freecam movement which reads the same WASD actions as the player. + chat_ui.open_chat() + assert(chat_ui.is_open()) + var free_camera_position_before: Vector3 = free_camera_body.global_position + Input.action_press("move_forward") + for _frame: int in 3: + await physics_frame + Input.action_release("move_forward") + assert(free_camera_body.global_position.is_equal_approx( + free_camera_position_before + )) + chat_ui.refocus_gameplay() + + # Typewriter speech cycles the shared open-mouth faceplates, then restores + # the player's authored mouth. World speech also follows the active freecam, + # not the inactive normal gameplay camera. + var normal_camera := player.get_gameplay_camera() + var normal_camera_transform: Transform3D = normal_camera.global_transform + var chat_anchor: Vector3 = player.get_chat_anchor_position() + normal_camera.look_at( + normal_camera.global_position + - (chat_anchor - normal_camera.global_position), + Vector3.UP, + ) + assert(normal_camera.is_position_behind(chat_anchor)) + assert(not free_camera.is_position_behind(chat_anchor)) + var shop_prompt := game_ui.get_node("%ShopPrompt") as Control + var storage_prompt := game_ui.get_node("%StoragePrompt") as Control + game_ui.set_shop_prompt_visible(true, chat_anchor) + game_ui.set_storage_prompt_visible(true, chat_anchor) + assert(shop_prompt.visible) + assert(storage_prompt.visible) + chat_ui.show_local_speech("hello there friend") + await process_frame + assert(bool(player.get("_speech_mouth_active"))) + var first_speech_mouth: String = str(player.get("_speech_mouth_id")) + await create_timer(0.12).timeout + var second_speech_mouth: String = str(player.get("_speech_mouth_id")) + assert(not first_speech_mouth.is_empty()) + assert(not second_speech_mouth.is_empty()) + assert(first_speech_mouth != second_speech_mouth) + chat_ui.call("_update_speech") + var speech: Dictionary = chat_ui.get("_speech") + var local_speech: Dictionary = speech.get(session.get_local_peer_id(), {}) + var speech_bubble := local_speech.get("bubble") as PanelContainer + assert(speech_bubble != null and speech_bubble.visible) + normal_camera.global_transform = normal_camera_transform + await create_timer(0.6).timeout + assert(not bool(player.get("_speech_mouth_active"))) + chat_ui.call("_on_peer_removed", session.get_local_peer_id()) + game_ui.call("_on_quick_action_selected", &"freecam") assert(not player.is_free_camera_active()) game_ui.call("_on_quick_action_selected", &"hud") @@ -265,6 +454,22 @@ func _run() -> void: assert(not ( game_ui.get_node("%ExperiencePresentation") as Control ).visible) + var hud_fishing_spot := main.get_node("%FishingSpot") as FishingSpot + assert(hud_fishing_spot != null) + hud_fishing_spot.state = FishingSpot.FishingState.SHOWING_CATCH + game_ui.call("_refresh_gameplay_hud_visibility") + assert(( + game_ui.get_node("%GameplayTransientHUD") as Control + ).visible) + assert(not ( + game_ui.get_node("%ExperiencePresentation") as Control + ).visible) + assert(chat_ui.is_hud_hidden()) + hud_fishing_spot.state = FishingSpot.FishingState.READY + game_ui.call("_refresh_gameplay_hud_visibility") + assert(not ( + game_ui.get_node("%GameplayTransientHUD") as Control + ).visible) quick_menu.open_menu(true) assert(quick_menu.visible and quick_menu.is_open()) quick_menu.close_menu() @@ -313,6 +518,12 @@ func _run() -> void: await process_frame assert(service.is_active() and not service.is_placement_mode()) assert(toolbar.visible) + chat_ui.open_chat() + assert(chat_ui.is_open()) + assert(not service.is_active() and not toolbar.visible) + chat_ui.close_chat() + assert(not chat_ui.is_open()) + assert(service.is_active() and toolbar.visible) var ui_root := game_ui.get_node("%UIRoot") as Control assert(toolbar.get_parent() == ui_root) assert(is_zero_approx(toolbar.position.y)) @@ -352,6 +563,8 @@ func _run() -> void: var hide_button := toolbar.get_node("%HideGuideButton") as Button var restore_button := toolbar.get_node("%RestoreGuideButton") as Button var finalize_button := toolbar.get_node("%FinalizeGuideButton") as Button + var export_button := toolbar.get_node("%ExportButton") as Button + var stamp_button := toolbar.get_node("%StampButton") as Button assert( mode_button != null and eraser_button != null @@ -359,7 +572,13 @@ func _run() -> void: and hide_button != null and restore_button != null and finalize_button != null + and export_button != null + and stamp_button != null ) + assert(export_button.text == "png") + assert(export_button.tooltip_text == "aim at artwork, then click to export PNG") + assert(stamp_button.text == "stamp") + assert(stamp_button.disabled) assert(toolbar.get_node_or_null("%CloseButton") == null) var expected_toolbar_icons: Dictionary[Button, String] = { mode_button: "/art/art_kit_marker.png", @@ -382,6 +601,8 @@ func _run() -> void: hide_button, restore_button, finalize_button, + export_button, + stamp_button, ]: assert(icon_button.custom_minimum_size == Vector2(48, 44)) assert(icon_button.get_theme_constant("icon_max_width") == 40) @@ -392,7 +613,9 @@ func _run() -> void: assert(is_equal_approx(icon_style.content_margin_top, 2.0)) assert(mode_button.custom_minimum_size == Vector2(48, 48)) assert(mode_button.get_theme_constant("icon_max_width") == 40) - assert(mode_button.get_index() > finalize_button.get_index()) + assert(export_button.get_index() > finalize_button.get_index()) + assert(stamp_button.get_index() > export_button.get_index()) + assert(mode_button.get_index() > stamp_button.get_index()) assert(hide_button.button_group != null) assert(hide_button.button_group == restore_button.button_group) assert(hide_button.button_group == finalize_button.button_group) @@ -408,6 +631,8 @@ func _run() -> void: hide_button, restore_button, finalize_button, + export_button, + stamp_button, ]: assert(pointer_only_control.focus_mode == Control.FOCUS_NONE) assert(brush_option.get_popup().unfocusable) @@ -445,18 +670,39 @@ func _run() -> void: assert(grid_option.get_item_text(index).is_empty()) assert(brush_option.get_item_icon(index) != null) assert(grid_option.get_item_icon(index) != null) - assert( - str(brush_option.get_item_icon(index).get_meta( - &"channel_mask_source", "" - )).ends_with( - expected_brush_icons[index] + var brush_unlocked: bool = index == 0 + var grid_unlocked: bool = index == 0 + if brush_unlocked: + assert( + str(brush_option.get_item_icon(index).get_meta( + &"channel_mask_source", "" + )).ends_with( + expected_brush_icons[index] + ) ) - ) - assert( - grid_option.get_item_icon(index).resource_path.ends_with( - expected_grid_icons[index] + else: + assert(bool(brush_option.get_item_icon(index).get_meta( + &"locked_content_icon", false + ))) + if grid_unlocked: + assert( + grid_option.get_item_icon(index).resource_path.ends_with( + expected_grid_icons[index] + ) ) - ) + else: + assert(bool(grid_option.get_item_icon(index).get_meta( + &"locked_content_icon", false + ))) + var expected_lock_alpha: float = 1.0 if index == 0 else 0.72 + assert(is_equal_approx( + brush_option.get_popup().get_item_icon_modulate(index).a, + expected_lock_alpha, + )) + assert(is_equal_approx( + grid_option.get_popup().get_item_icon_modulate(index).a, + expected_lock_alpha, + )) assert(not brush_option.get_popup().is_item_disabled(0)) assert(brush_option.get_popup().is_item_disabled(1)) assert(not grid_option.get_popup().is_item_disabled(0)) @@ -467,15 +713,66 @@ func _run() -> void: assert(color_button.focus_mode == Control.FOCUS_NONE) assert(not (color_buttons[&"chalk_white"] as Button).disabled) assert((color_buttons[&"ocean_teal"] as Button).disabled) + var base_color_lock := ( + (color_buttons[&"chalk_white"] as Button).get_node( + "UnlockStateIcon" + ) as TextureRect + ) + var locked_color_lock := ( + (color_buttons[&"ocean_teal"] as Button).get_node( + "UnlockStateIcon" + ) as TextureRect + ) + assert(not base_color_lock.visible) + assert(locked_color_lock.visible) + assert(locked_color_lock.size == Vector2(18.0, 18.0)) + assert(is_equal_approx(locked_color_lock.modulate.a, 0.34)) + var popup_lock_icon := toolbar.get("_popup_lock_icon") as Texture2D + assert(popup_lock_icon.get_width() == 40) + assert(popup_lock_icon.get_height() == 40) + assert(int(popup_lock_icon.get_meta( + &"locked_content_icon_size", 0 + )) == 24) for product_id: StringName in [ - &"marker_ocean_teal", &"brush_4x", &"grid_128x", + &"marker_ocean_teal", + &"brush_4x", + &"grid_128x", + PlayerArtUnlocks.STAMP_PRODUCT_ID, ]: assert(player.art_unlocks.unlock_product(product_id)) await process_frame assert(not (color_buttons[&"ocean_teal"] as Button).disabled) assert(not brush_option.get_popup().is_item_disabled(3)) assert(not grid_option.get_popup().is_item_disabled(3)) + assert(not stamp_button.disabled) + var stamp_library_panel := toolbar.get_node( + "%StampLibraryPanel" + ) as PanelContainer + var stamp_library_close := toolbar.get_node( + "%StampLibraryClose" + ) as Button + assert(stamp_library_panel != null and not stamp_library_panel.visible) + stamp_button.pressed.emit() + assert(stamp_library_panel.visible) + var library_pointer := InputEventMouseMotion.new() + library_pointer.position = stamp_library_panel.get_global_rect().get_center() + assert(toolbar.owns_pointer_event(library_pointer)) + stamp_library_close.pressed.emit() + assert(not stamp_library_panel.visible) + assert(not locked_color_lock.visible) + assert(str(brush_option.get_item_icon(3).get_meta( + &"channel_mask_source", "" + )).ends_with(expected_brush_icons[3])) + assert(grid_option.get_item_icon(3).resource_path.ends_with( + expected_grid_icons[3] + )) + assert(is_equal_approx( + brush_option.get_popup().get_item_icon_modulate(3).a, 1.0 + )) + assert(is_equal_approx( + grid_option.get_popup().get_item_icon_modulate(3).a, 1.0 + )) assert(service.set_color_id(&"ocean_teal")) assert(service.set_brush_size(4)) assert(service.set_grid_size(128)) @@ -602,6 +899,18 @@ func _run() -> void: await process_frame assert(player.hotbar.get_selected_slot() == 1) assert(not service.is_active() and not toolbar.visible) + hotbar_ui.set_swap_hotbar_camera_scroll(true) + hotbar_ui._unhandled_input(wheel_down) + await process_frame + assert(player.hotbar.get_selected_slot() == 1) + var shifted_wheel_down := InputEventMouseButton.new() + shifted_wheel_down.button_index = MOUSE_BUTTON_WHEEL_DOWN + shifted_wheel_down.pressed = true + shifted_wheel_down.shift_pressed = true + hotbar_ui._unhandled_input(shifted_wheel_down) + await process_frame + assert(player.hotbar.get_selected_slot() == 2) + hotbar_ui.set_swap_hotbar_camera_scroll(false) var number_one := InputEventKey.new() number_one.physical_keycode = KEY_1 @@ -621,7 +930,6 @@ func _run() -> void: assert(not service.is_active() and not toolbar.visible) print("Art tools validation: PASS") - var session := main.get_node("%NetworkSession") as NetworkSession session.disconnect_session("") main.queue_free() for _frame: int in 4: @@ -684,7 +992,31 @@ func _validate_pause_browser_transition( ) == Input.MOUSE_MODE_VISIBLE ) Input.mouse_mode = Input.MOUSE_MODE_VISIBLE - player.call("_set_camera_dragging", true) + var drag_press := InputEventMouseButton.new() + drag_press.button_index = MOUSE_BUTTON_RIGHT + drag_press.button_mask = MOUSE_BUTTON_MASK_RIGHT + drag_press.pressed = true + player.call("_input", drag_press) + assert(bool(player.get("_camera_dragging"))) + var camera_yaw := player.get_node("%CameraYaw") as Node3D + var yaw_before_drag: float = camera_yaw.rotation.y + var drag_motion := InputEventMouseMotion.new() + drag_motion.button_mask = MOUSE_BUTTON_MASK_RIGHT + drag_motion.relative = Vector2(24.0, -8.0) + drag_motion.screen_relative = drag_motion.relative + player.call("_input", drag_motion) + assert(not is_equal_approx(camera_yaw.rotation.y, yaw_before_drag)) + await process_frame + assert(bool(player.get("_camera_dragging"))) + if DisplayServer.get_name() != "headless": + assert(Input.mouse_mode == Input.MOUSE_MODE_CAPTURED) + var drag_release := InputEventMouseButton.new() + drag_release.button_index = MOUSE_BUTTON_RIGHT + drag_release.button_mask = 0 + drag_release.pressed = false + player.call("_input", drag_release) + assert(not bool(player.get("_camera_dragging"))) + player.call("_input", drag_press) assert(bool(player.get("_camera_dragging"))) pause_menu.open_menu() while bool(pause_menu.get("_root_transition_active")): diff --git a/tests/camera_drag_validation.gd b/tests/camera_drag_validation.gd new file mode 100644 index 0000000..a2dd410 --- /dev/null +++ b/tests/camera_drag_validation.gd @@ -0,0 +1,80 @@ +extends SceneTree + +const PlayerScene: PackedScene = preload("res://player/player.tscn") + + +func _initialize() -> void: + call_deferred("_run") + + +func _run() -> void: + root.size = Vector2i(1280, 720) + var player := PlayerScene.instantiate() as Player + root.add_child(player) + await process_frame + player.local_control_enabled = true + player.set_camera_input_enabled(true) + Input.mouse_mode = Input.MOUSE_MODE_VISIBLE + + var press := InputEventMouseButton.new() + press.button_index = MOUSE_BUTTON_RIGHT + press.button_mask = MOUSE_BUTTON_MASK_RIGHT + press.pressed = true + Input.parse_input_event(press) + await process_frame + assert(bool(player.get("_camera_dragging"))) + if DisplayServer.get_name() != "headless": + assert(Input.mouse_mode == Input.MOUSE_MODE_CAPTURED) + + var yaw := player.get_node("%CameraYaw") as Node3D + var previous_yaw: float = yaw.rotation.y + var motion := InputEventMouseMotion.new() + motion.button_mask = MOUSE_BUTTON_MASK_RIGHT + motion.relative = Vector2(18.0, -4.0) + motion.screen_relative = motion.relative + Input.parse_input_event(motion) + await process_frame + assert(not is_equal_approx(yaw.rotation.y, previous_yaw)) + assert(bool(player.get("_camera_dragging"))) + if DisplayServer.get_name() != "headless": + assert(Input.mouse_mode == Input.MOUSE_MODE_CAPTURED) + + var release := InputEventMouseButton.new() + release.button_index = MOUSE_BUTTON_RIGHT + release.pressed = false + Input.parse_input_event(release) + await process_frame + assert(not bool(player.get("_camera_dragging"))) + if DisplayServer.get_name() != "headless": + assert(Input.mouse_mode == Input.MOUSE_MODE_VISIBLE) + + Input.parse_input_event(press) + await process_frame + assert(bool(player.get("_camera_dragging"))) + player.notification(NOTIFICATION_APPLICATION_FOCUS_OUT) + assert(not bool(player.get("_camera_dragging"))) + + var plain_wheel_down := InputEventMouseButton.new() + plain_wheel_down.button_index = MOUSE_BUTTON_WHEEL_DOWN + plain_wheel_down.pressed = true + var shifted_wheel_down := InputEventMouseButton.new() + shifted_wheel_down.button_index = MOUSE_BUTTON_WHEEL_DOWN + shifted_wheel_down.pressed = true + shifted_wheel_down.shift_pressed = true + player.apply_camera_settings(0.005, 2.5, false, false) + var default_zoom: float = float(player.get("_target_zoom")) + player._unhandled_input(plain_wheel_down) + assert(is_equal_approx(float(player.get("_target_zoom")), default_zoom)) + player._unhandled_input(shifted_wheel_down) + assert(float(player.get("_target_zoom")) > default_zoom) + player.apply_camera_settings(0.005, 2.5, false, true) + var swapped_zoom: float = float(player.get("_target_zoom")) + player._unhandled_input(shifted_wheel_down) + assert(is_equal_approx(float(player.get("_target_zoom")), swapped_zoom)) + player._unhandled_input(plain_wheel_down) + assert(float(player.get("_target_zoom")) > swapped_zoom) + + player.queue_free() + await process_frame + print("Camera drag validation: PASS") + quit() diff --git a/tests/camera_drag_validation.gd.uid b/tests/camera_drag_validation.gd.uid new file mode 100644 index 0000000..a37fad9 --- /dev/null +++ b/tests/camera_drag_validation.gd.uid @@ -0,0 +1 @@ +uid://dku3kyarg3fxu diff --git a/tests/character_rig_validation.gd b/tests/character_rig_validation.gd new file mode 100644 index 0000000..2aece2b --- /dev/null +++ b/tests/character_rig_validation.gd @@ -0,0 +1,139 @@ +extends SceneTree + + +const CHARACTER_SCENE: PackedScene = preload( + "res://art/exported/characters/base/straywild_base_character.glb" +) + +const EXPECTED_ANIMATIONS: Array[StringName] = [ + &"casting", + &"casting_sit", + &"draw", + &"fighting", + &"fighting_sit", + &"fishing", + &"fishing_sit", + &"idle", + &"idle_show", + &"idle_sit", + &"idle_sit_show", + &"idle_sneak", + &"pocket_idle_idle", + &"pocket_idle_show", + &"pocket_show_idle", + &"pocket_show_show", + &"pocket_sit_idle_idle", + &"pocket_sit_idle_show", + &"pocket_sit_show_idle", + &"pocket_sit_show_show", + &"pocket_walking_idle_idle", + &"pocket_walking_idle_show", + &"pocket_walking_show_idle", + &"pocket_walking_show_show", + &"release", + &"release_sit", + &"retract", + &"retract_sit", + &"running", + &"running_show", + &"sneaking", + &"strike", + &"walking", + &"walking_show", +] + + +func _initialize() -> void: + call_deferred("_run") + + +func _run() -> void: + var character := CHARACTER_SCENE.instantiate() + root.add_child(character) + var skeleton := _find_first(character, "Skeleton3D") as Skeleton3D + var animation_player := _find_first( + character, + "AnimationPlayer", + ) as AnimationPlayer + assert(skeleton != null) + assert(animation_player != null) + + var socket_index := skeleton.find_bone("rod_socket") + assert(socket_index >= 0) + var socket_direction_index := skeleton.find_bone("rod_socket.001") + assert(socket_direction_index >= 0) + assert(skeleton.get_bone_parent(socket_direction_index) == socket_index) + var animation_names := animation_player.get_animation_list() + assert(animation_names.size() == EXPECTED_ANIMATIONS.size()) + for expected in EXPECTED_ANIMATIONS: + assert(expected in animation_names, "Missing animation: %s" % expected) + var animation := animation_player.get_animation(expected) + if expected in [&"casting", &"draw", &"idle_sneak", &"sneaking", &"strike"]: + var has_socket_track: bool = false + for track_index in animation.get_track_count(): + has_socket_track = has_socket_track or String( + animation.track_get_path(track_index) + ).contains("rod_socket") + assert( + has_socket_track, + "Animation %s lost its authored rod socket pose." % expected, + ) + + var arms := character.find_child( + "body_arms", + true, + false, + ) as MeshInstance3D + assert(arms != null) + var blended_arm_vertices := _validate_mesh_weights(arms) + assert(blended_arm_vertices > 0, "body_arms has no blended joint weights.") + var body := character.find_child( + "body_main", + true, + false, + ) as MeshInstance3D + assert(body != null) + _validate_mesh_weights(body) + + print( + "Character rig validation: PASS " + + "(animations=%d, blended arm vertices=%d)" + % [EXPECTED_ANIMATIONS.size(), blended_arm_vertices] + ) + character.queue_free() + quit() + + +func _validate_mesh_weights(mesh_instance: MeshInstance3D) -> int: + var blended_vertices := 0 + for surface_index in mesh_instance.mesh.get_surface_count(): + var arrays := mesh_instance.mesh.surface_get_arrays(surface_index) + var weights: PackedFloat32Array = arrays[Mesh.ARRAY_WEIGHTS] + var vertices: PackedVector3Array = arrays[Mesh.ARRAY_VERTEX] + assert(not weights.is_empty()) + assert(not vertices.is_empty()) + var components_per_vertex := weights.size() / vertices.size() + assert(components_per_vertex == 4 or components_per_vertex == 8) + for offset in range(0, weights.size(), components_per_vertex): + var total := 0.0 + var influence_count := 0 + for component in range(components_per_vertex): + var weight := weights[offset + component] + total += weight + if weight > 0.000001: + influence_count += 1 + assert(absf(total - 1.0) <= 0.0001) + assert(influence_count <= 2) + if influence_count == 2: + blended_vertices += 1 + return blended_vertices + + +func _find_first(parent: Node, class_name_to_find: String) -> Node: + if parent.is_class(class_name_to_find): + return parent + for child in parent.get_children(): + var found := _find_first(child, class_name_to_find) + if found != null: + return found + return null diff --git a/tests/character_rig_validation.gd.uid b/tests/character_rig_validation.gd.uid new file mode 100644 index 0000000..f7bda09 --- /dev/null +++ b/tests/character_rig_validation.gd.uid @@ -0,0 +1 @@ +uid://di6r1gphajq8u diff --git a/tests/chat_privacy_multiplayer_validation.gd b/tests/chat_privacy_multiplayer_validation.gd new file mode 100644 index 0000000..e1d6f87 --- /dev/null +++ b/tests/chat_privacy_multiplayer_validation.gd @@ -0,0 +1,124 @@ +extends SceneTree + +const MainScene: PackedScene = preload("res://main/main.tscn") +const TEST_PORT: int = 18152 +const PREJOIN_MESSAGE: String = "private prejoin message" +const LIVE_MESSAGE: String = "live message after join" + + +func _initialize() -> void: + call_deferred("_run") + + +func _run() -> void: + var arguments: PackedStringArray = OS.get_cmdline_user_args() + if arguments.has("host"): + await _run_host() + return + if arguments.has("client"): + await _run_client() + return + push_error("Chat privacy validation needs host or client mode.") + quit(1) + + +func _run_host() -> void: + var main: Node = await _create_initialized_main() + var session := main.get_node("%NetworkSession") as NetworkSession + var save_manager := main.get("_save_manager") as PlayerSaveManager + assert(bool(main.call( + "_apply_world", WorldLayout.STARTER_ISLAND, 1, true + ))) + assert(session.set_host_world(WorldLayout.STARTER_ISLAND, 1)) + assert(session.start_private_host(TEST_PORT)) + assert(save_manager.initialize_new_game()) + main.call("_enter_gameplay") + for _frame: int in 4: + await physics_frame + assert(session.set_host_open(true)) + var chat_service := main.get_node( + "%NetworkChatService" + ) as NetworkChatService + assert(chat_service.send_local_message(PREJOIN_MESSAGE)) + var remote_peer_id: int = await _wait_for_remote_peer(session) + assert(remote_peer_id > 1) + await create_timer(1.0).timeout + assert(chat_service.send_local_message(LIVE_MESSAGE)) + var disconnect_deadline: int = Time.get_ticks_msec() + 8000 + while ( + Time.get_ticks_msec() < disconnect_deadline + and session.is_authenticated_peer(remote_peer_id) + ): + await process_frame + assert(not session.is_authenticated_peer(remote_peer_id)) + print("Chat privacy multiplayer host validation: PASS") + await _session_cleanup(main, session) + + +func _run_client() -> void: + var main: Node = await _create_initialized_main() + main.call("_on_title_join_game_requested", "127.0.0.1:%d" % TEST_PORT) + var session := main.get_node("%NetworkSession") as NetworkSession + var join_deadline: int = Time.get_ticks_msec() + 20000 + while Time.get_ticks_msec() < join_deadline: + await process_frame + if session.state == NetworkSession.State.VERIFYING_SERVER_IDENTITY: + main.call("_confirm_server_trust") + if session.is_joined_client() and bool(main.get("_gameplay_started")): + break + assert(session.is_joined_client()) + var chat_service := main.get_node( + "%NetworkChatService" + ) as NetworkChatService + await create_timer(0.5).timeout + assert(not _history_contains(chat_service, PREJOIN_MESSAGE)) + var live_deadline: int = Time.get_ticks_msec() + 8000 + while ( + Time.get_ticks_msec() < live_deadline + and not _history_contains(chat_service, LIVE_MESSAGE) + ): + await process_frame + assert(_history_contains(chat_service, LIVE_MESSAGE)) + assert(not _history_contains(chat_service, PREJOIN_MESSAGE)) + print("Chat privacy multiplayer client validation: PASS") + await _session_cleanup(main, session) + + +func _history_contains(service: NetworkChatService, body: String) -> bool: + return service.get_history().any( + func(message: Dictionary) -> bool: + return str(message.get("body", "")) == body + ) + + +func _create_initialized_main() -> Node: + root.size = Vector2i(1280, 720) + var main: Node = MainScene.instantiate() + root.add_child(main) + for _frame: int in 4: + await process_frame + if not bool(main.get("_application_initialized")): + main.call("_activate_selected_data_path", "", true) + for _frame: int in 8: + await process_frame + assert(bool(main.get("_application_initialized"))) + return main + + +func _wait_for_remote_peer(session: NetworkSession) -> int: + var deadline: int = Time.get_ticks_msec() + 20000 + while Time.get_ticks_msec() < deadline: + await process_frame + for peer_id: int in session.get_authenticated_peer_ids(): + if peer_id != session.get_local_peer_id(): + return peer_id + return 0 + + +func _session_cleanup(main: Node, session: NetworkSession) -> void: + session.disconnect_session("") + main.queue_free() + for _frame: int in 4: + await process_frame + await create_timer(0.1).timeout + quit() diff --git a/tests/chat_privacy_multiplayer_validation.gd.uid b/tests/chat_privacy_multiplayer_validation.gd.uid new file mode 100644 index 0000000..33b210d --- /dev/null +++ b/tests/chat_privacy_multiplayer_validation.gd.uid @@ -0,0 +1 @@ +uid://ivtqrnppnmli diff --git a/tests/controller_focus_presentation_validation.gd b/tests/controller_focus_presentation_validation.gd index e349a1e..7f59f70 100644 --- a/tests/controller_focus_presentation_validation.gd +++ b/tests/controller_focus_presentation_validation.gd @@ -3,6 +3,9 @@ extends SceneTree const FocusPresentationType = preload( "res://ui/controller_focus_presentation.gd" ) +const FishBatchSelectionType = preload( + "res://ui/fish_batch_selection.gd" +) var _failures: Array[String] = [] @@ -12,6 +15,8 @@ func _initialize() -> void: func _run() -> void: + _validate_controller_cooler_focus() + root.size = Vector2i(1280, 720) var stage := Control.new() stage.set_anchors_and_offsets_preset(Control.PRESET_FULL_RECT) root.add_child(stage) @@ -19,58 +24,309 @@ func _run() -> void: stage.add_child(presentation) var standard_button := Button.new() standard_button.text = "standard" + standard_button.position = Vector2(80.0, 60.0) standard_button.custom_minimum_size = Vector2(120.0, 60.0) + var normal_style := _button_style(Color("123f4e")) + var old_hover_style := _button_style(Color("58c6d4")) + var old_focus_style := _button_style(Color("238697")) + standard_button.add_theme_stylebox_override("normal", normal_style) + standard_button.add_theme_stylebox_override("hover", old_hover_style) + standard_button.add_theme_stylebox_override("focus", old_focus_style) stage.add_child(standard_button) - var authored_selector := Button.new() - authored_selector.text = "authored selector" - authored_selector.position = Vector2(140.0, 0.0) - authored_selector.custom_minimum_size = Vector2(160.0, 60.0) - authored_selector.set_meta(&"controller_focus_inversion_disabled", true) - stage.add_child(authored_selector) + var second_button := Button.new() + second_button.text = "second" + second_button.position = Vector2(260.0, 60.0) + second_button.custom_minimum_size = Vector2(120.0, 60.0) + # Legacy opt-outs must not prevent the new universal cursor from appearing. + second_button.set_meta(&"controller_focus_inversion_disabled", true) + stage.add_child(second_button) await process_frame + standard_button.grab_focus() + await process_frame + _expect( + root.gui_get_focus_owner() == null, + "a menu's programmatic first focus is visible before navigation input", + ) + _expect( + presentation.get("_neutral_focus_seed") == standard_button, + "the neutral menu focus seed did not remember the first action", + ) + var player_menu_tab := InputEventKey.new() + player_menu_tab.physical_keycode = KEY_TAB + player_menu_tab.pressed = true + presentation._input(player_menu_tab) + await process_frame + _expect( + root.gui_get_focus_owner() == null, + "the default player-menu Tab was consumed as focus navigation", + ) + _expect( + presentation.get("_neutral_focus_seed") == standard_button, + "the default player-menu Tab discarded the neutral focus seed", + ) + var first_navigation := InputEventJoypadButton.new() + first_navigation.button_index = JOY_BUTTON_DPAD_DOWN + first_navigation.pressed = true + presentation._input(first_navigation) + await process_frame + _expect( + root.gui_get_focus_owner() == standard_button, + "the first directional input did not activate the neutral focus seed", + ) + var controller_event := InputEventJoypadButton.new() controller_event.button_index = JOY_BUTTON_A controller_event.pressed = true presentation._input(controller_event) - standard_button.grab_focus() + await process_frame + var focus_arrow := presentation.get("_focus_arrow") as TextureRect + var focus_shadow := presentation.get("_focus_arrow_shadow") as TextureRect + _expect(focus_arrow != null, "controller focus arrow was not created") + _expect(focus_shadow != null, "controller focus shadow was not created") + _expect(focus_arrow.visible, "controller focus arrow is not visible") + _expect(focus_shadow.visible, "controller focus shadow is not visible") + _expect( + focus_arrow.texture == FocusPresentationType.FOCUS_ARROW_TEXTURE, + "controller focus arrow uses the wrong artwork", + ) + _expect( + focus_shadow.texture == focus_arrow.texture, + "controller focus shadow does not follow the cursor silhouette", + ) + _expect( + focus_shadow.position.is_equal_approx( + focus_arrow.position + + FocusPresentationType.FOCUS_ARROW_SHADOW_OFFSET + ), + "controller focus shadow uses the wrong offset", + ) + _expect( + is_equal_approx( + focus_arrow.rotation_degrees, + FocusPresentationType.FOCUS_ARROW_ROTATION_DEGREES, + ), + "controller focus arrow does not point toward five o'clock", + ) + _expect( + standard_button.material == null, + "controller focus still applies material inversion", + ) + _expect( + standard_button.get_theme_stylebox("focus") == normal_style, + "native focus highlighting was not neutralized", + ) + _expect( + _arrow_marks_top_left(focus_arrow, standard_button.get_global_rect()), + "controller focus arrow is not in the control's top-left corner", + ) + stage.scale = Vector2.ONE * 0.5 await process_frame _expect( - standard_button.material != null, - "ordinary controller focus receives inversion", + focus_arrow.size.is_equal_approx( + FocusPresentationType.FOCUS_ARROW_SIZE * 0.5 + ), + "controller focus arrow does not follow canonical UI stage scale", ) + _expect( + _arrow_marks_top_left(focus_arrow, standard_button.get_global_rect()), + "scaled controller focus arrow left its control's top-left corner", + ) + stage.scale = Vector2.ONE + await process_frame + var hover_motion := InputEventMouseMotion.new() + hover_motion.position = standard_button.get_global_rect().get_center() + hover_motion.global_position = hover_motion.position + root.push_input(hover_motion, true) + await process_frame + _expect( + root.gui_get_hovered_control() == standard_button, + "the pointer did not reach the hover-suppression test button", + ) + presentation._input(first_navigation) + presentation._input(controller_event) + await process_frame + _expect( + standard_button.get_theme_stylebox("hover") == normal_style, + "controller use leaves a stale mouse-hover highlight visible", + ) + + second_button.grab_focus() + await process_frame + _expect( + focus_arrow.visible, + "legacy inversion metadata incorrectly hides the focus arrow", + ) + _expect( + _arrow_marks_top_left(focus_arrow, second_button.get_global_rect()), + "controller focus arrow did not follow the focused control", + ) + var bubble_button := BubbleButton.new() + bubble_button.text = "bubble" + bubble_button.position = Vector2(440.0, 60.0) + bubble_button.size = Vector2(120.0, 120.0) + stage.add_child(bubble_button) + await process_frame + bubble_button.grab_focus() + await process_frame + _expect( + _arrow_overlaps_bubble_edge(focus_arrow, bubble_button), + "controller focus arrow does not meet the visible bubble edge", + ) + var pointer_motion := InputEventMouseMotion.new() pointer_motion.position = Vector2(4.0, 4.0) presentation._input(pointer_motion) await process_frame _expect( - standard_button.material == null, - "mouse motion clears controller focus presentation", + not focus_arrow.visible, + "mouse motion does not clear controller focus presentation", ) + _expect( + not focus_shadow.visible, + "mouse motion leaves the controller focus shadow visible", + ) + _expect( + root.gui_get_focus_owner() == null, + "mouse motion leaves a stale menu action focused", + ) + _expect( + standard_button.get_theme_stylebox("focus") == old_focus_style, + "native theme overrides were not restored after controller use", + ) + _expect( + standard_button.get_theme_stylebox("hover") == old_hover_style, + "mouse hover styling was not restored after controller use", + ) + var item_list := ItemList.new() + item_list.position = Vector2(80.0, 160.0) + item_list.size = Vector2(240.0, 150.0) + item_list.max_columns = 1 + for index: int in 4: + item_list.add_item("list item %d" % index) + stage.add_child(item_list) + await process_frame + item_list.select(0) + item_list.grab_focus() + await process_frame + presentation._input(first_navigation) presentation._input(controller_event) - - authored_selector.grab_focus() + await process_frame + var first_item_arrow_y: float = focus_arrow.position.y + item_list.select(2) await process_frame _expect( - standard_button.material == null, - "inversion clears when focus moves", + focus_arrow.position.y > first_item_arrow_y, + "focus arrow does not follow the selected ItemList row", ) _expect( - authored_selector.material == null, - "authored selector backgrounds opt out of inversion", + item_list.get_theme_stylebox("selected") is StyleBoxEmpty, + "ItemList still draws a selected-row cursor highlight", + ) + _expect( + item_list.get_theme_color("font_selected_color") + == item_list.get_theme_color("font_color"), + "ItemList still recolors the selected-row cursor text", ) - standard_button.grab_focus() + var tree := Tree.new() + tree.position = Vector2(700.0, 160.0) + tree.size = Vector2(240.0, 150.0) + tree.hide_root = true + var tree_root: TreeItem = tree.create_item() + var first_tree_item: TreeItem = tree.create_item(tree_root) + first_tree_item.set_text(0, "first folder") + var second_tree_item: TreeItem = tree.create_item(tree_root) + second_tree_item.set_text(0, "second folder") + stage.add_child(tree) await process_frame - standard_button.focus_mode = Control.FOCUS_NONE + first_tree_item.select(0) + tree.grab_focus() + await process_frame + var first_tree_arrow_y: float = focus_arrow.position.y + second_tree_item.select(0) await process_frame _expect( - standard_button.material == null, - "inversion clears when a focused control is defocused", + focus_arrow.position.y > first_tree_arrow_y, + "focus arrow does not follow the selected Tree row", ) + var popup := PopupMenu.new() + for index: int in 5: + popup.add_item("popup item %d" % index) + root.add_child(popup) + popup.popup(Rect2i(500, 300, 0, 0)) + popup.set_focused_item(0) + for _frame: int in 2: + await process_frame + _expect( + presentation.get("_focused_popup") == popup, + "focus arrow did not enter an open PopupMenu", + ) + _expect( + presentation.get("_focus_layer").custom_viewport == popup, + "focus arrow is not rendered inside the PopupMenu viewport", + ) + _expect( + popup.get_theme_stylebox("hover") is StyleBoxEmpty, + "PopupMenu still draws its native focus highlight", + ) + _expect( + _arrow_marks_top_left( + focus_arrow, + presentation.call("_popup_focus_target_rect", popup) as Rect2, + ), + "focus arrow does not mark the focused PopupMenu item", + ) + var first_popup_arrow_y: float = focus_arrow.position.y + popup.set_focused_item(2) + await process_frame + _expect( + focus_arrow.position.y > first_popup_arrow_y, + "focus arrow does not follow PopupMenu item navigation", + ) + popup.hide() + popup.queue_free() + await process_frame + item_list.grab_focus() + await process_frame + + var dialog := FileDialog.new() + dialog.file_mode = FileDialog.FILE_MODE_OPEN_DIR + dialog.access = FileDialog.ACCESS_FILESYSTEM + dialog.size = Vector2i(720, 480) + root.add_child(dialog) + dialog.popup_centered() + for _frame: int in 2: + await process_frame + var dialog_cancel := dialog.get_cancel_button() + dialog_cancel.grab_focus() + for _frame: int in 2: + await process_frame + _expect( + focus_arrow.visible, + "focus arrow is hidden for an embedded dialog control", + ) + _expect( + presentation.get("_focus_layer").custom_viewport + == dialog_cancel.get_viewport(), + "focus arrow is not rendered inside the dialog viewport", + ) + _expect( + _arrow_marks_top_left( + focus_arrow, + presentation.call("_focus_target_rect", dialog_cancel) as Rect2, + ), + "focus arrow does not follow an embedded dialog control", + ) + dialog.hide() + dialog.queue_free() + await process_frame + item_list.grab_focus() + await process_frame + var scroll := ScrollContainer.new() - scroll.position = Vector2(0.0, 80.0) + scroll.position = Vector2(420.0, 160.0) scroll.size = Vector2(180.0, 90.0) scroll.horizontal_scroll_mode = ScrollContainer.SCROLL_MODE_DISABLED stage.add_child(scroll) @@ -86,15 +342,65 @@ func _run() -> void: last_scroll_button = scroll_button await process_frame last_scroll_button.grab_focus() - await process_frame - await process_frame + for _frame: int in 2: + await process_frame _expect( scroll.scroll_vertical > 0, - "controller focus scrolls an off-screen selection into view", + "controller focus does not reveal an off-screen selection", ) _expect( root.gui_get_focus_owner() == last_scroll_button, - "scroll following preserves the selected controller control", + "scroll following does not preserve the focused control", + ) + _expect( + _arrow_marks_top_left( + focus_arrow, + last_scroll_button.get_global_rect(), + ), + "focus arrow does not follow a scrolled control", + ) + + last_scroll_button.focus_mode = Control.FOCUS_NONE + await process_frame + _expect( + not focus_arrow.visible, + "focus arrow remains after its control becomes unfocusable", + ) + var event_focused_button := Button.new() + event_focused_button.text = "event focused" + event_focused_button.position = Vector2(700.0, 360.0) + event_focused_button.custom_minimum_size = Vector2(160.0, 50.0) + stage.add_child(event_focused_button) + await process_frame + presentation._input(first_navigation) + event_focused_button.grab_focus() + await process_frame + _expect( + root.gui_get_focus_owner() == event_focused_button, + ( + "a menu focus established by the current directional event was " + + "mistaken for an automatic default" + ), + ) + + presentation.set_virtual_pointer_active(true) + await process_frame + _expect( + not focus_arrow.visible, + "focus arrow competes with active virtual-pointer presentation", + ) + presentation._input(controller_event) + await process_frame + _expect( + not focus_arrow.visible, + "controller input stole presentation from the held virtual pointer", + ) + presentation.set_virtual_pointer_active(false) + presentation._input(controller_event) + await process_frame + _expect( + focus_arrow.visible, + "controller focus presentation did not resume after virtual-pointer use", ) stage.queue_free() @@ -107,6 +413,66 @@ func _run() -> void: quit(1) +func _validate_controller_cooler_focus() -> void: + var selection := FishBatchSelectionType.new() + selection.set_visible_order([&"first", &"second"]) + selection.select_only(&"first") + selection.focus_only(&"second") + _expect( + selection.get_focused_id() == &"second", + "cooler focus does not follow controller navigation", + ) + _expect( + selection.get_selected_ids() == [&"first"], + "moving cooler focus unexpectedly changes the selected catch set", + ) + + +func _button_style(color: Color) -> StyleBoxFlat: + var style := StyleBoxFlat.new() + style.bg_color = color + style.set_corner_radius_all(8) + return style + + +func _arrow_marks_top_left(arrow: Control, target: Rect2) -> bool: + var arrow_pivot: Vector2 = arrow.position + arrow.size * 0.5 + var arrow_scale: Vector2 = arrow.size / FocusPresentationType.FOCUS_ARROW_SIZE + var tip_from_pivot: Vector2 = ( + (FocusPresentationType.FOCUS_ARROW_TIP_UV - Vector2.ONE * 0.5) + * arrow.size + ).rotated(deg_to_rad( + FocusPresentationType.FOCUS_ARROW_ROTATION_DEGREES + )) + var actual_tip: Vector2 = arrow_pivot + tip_from_pivot + var expected_tip: Vector2 = ( + target.position + + FocusPresentationType.FOCUS_ARROW_TARGET_OVERLAP * arrow_scale + ) + return actual_tip.distance_to(expected_tip) <= 0.5 + + +func _arrow_overlaps_bubble_edge( + arrow: Control, + bubble: BubbleButton, +) -> bool: + var arrow_pivot: Vector2 = arrow.position + arrow.size * 0.5 + var tip_from_pivot: Vector2 = ( + (FocusPresentationType.FOCUS_ARROW_TIP_UV - Vector2.ONE * 0.5) + * arrow.size + ).rotated(deg_to_rad( + FocusPresentationType.FOCUS_ARROW_ROTATION_DEGREES + )) + var actual_tip: Vector2 = arrow_pivot + tip_from_pivot + var local_tip: Vector2 = ( + bubble.get_global_transform_with_canvas().affine_inverse() + * actual_tip + ) + var radius: Vector2 = bubble.size * 0.5 + var normalized: Vector2 = (local_tip - radius) / radius + return normalized.length() >= 0.75 and normalized.length() <= 1.0 + + func _expect(condition: bool, message: String) -> void: if not condition: _failures.append(message) diff --git a/tests/controller_focus_recovery_validation.gd b/tests/controller_focus_recovery_validation.gd deleted file mode 100644 index f598511..0000000 --- a/tests/controller_focus_recovery_validation.gd +++ /dev/null @@ -1,184 +0,0 @@ -extends SceneTree - -const ControllerFocusRecoveryType = preload( - "res://ui/controller_focus_recovery.gd" -) - -var _failures: Array[String] = [] - - -func _initialize() -> void: - _run.call_deferred() - - -func _run() -> void: - var stage := Control.new() - stage.set_anchors_and_offsets_preset(Control.PRESET_FULL_RECT) - root.add_child(stage) - var recovery := ControllerFocusRecoveryType.new() - stage.add_child(recovery) - var option_list := VBoxContainer.new() - option_list.position = Vector2(100.0, 100.0) - stage.add_child(option_list) - var original := _make_button("cute", "cute (show variants)") - option_list.add_child(original) - await process_frame - original.grab_focus() - await process_frame - await process_frame - _expect( - root.gui_get_focus_owner() == null, - "programmatic focus stays pending outside navigation mode", - ) - var keyboard_navigation := InputEventKey.new() - keyboard_navigation.keycode = KEY_DOWN - keyboard_navigation.pressed = true - recovery._input(keyboard_navigation) - await process_frame - await process_frame - _expect( - root.gui_get_focus_owner() == original, - "keyboard navigation restores pending initial focus", - ) - var menu_shortcut := InputEventKey.new() - menu_shortcut.physical_keycode = KEY_TAB - menu_shortcut.pressed = true - recovery._input(menu_shortcut) - await process_frame - await process_frame - _expect( - root.gui_get_focus_owner() == null, - "the menu shortcut does not leave a pseudo-focused option", - ) - - var controller_event := InputEventJoypadButton.new() - controller_event.button_index = JOY_BUTTON_A - controller_event.pressed = true - recovery._input(controller_event) - await process_frame - await process_frame - await process_frame - _expect( - root.gui_get_focus_owner() == original, - "controller navigation restores pending initial focus", - ) - - option_list.remove_child(original) - original.queue_free() - var replacement := _make_button("cute", "cute (hide variants)") - option_list.add_child(replacement) - await process_frame - await process_frame - _expect( - root.gui_get_focus_owner() == replacement, - "focus follows a rebuilt semantic option", - ) - - var explicit_target := _make_button("explicit", "explicit") - option_list.add_child(explicit_target) - option_list.remove_child(replacement) - replacement.queue_free() - explicit_target.grab_focus() - await process_frame - _expect( - root.gui_get_focus_owner() == explicit_target, - "explicit focus changes take precedence over recovery", - ) - var pointer_motion := InputEventMouseMotion.new() - pointer_motion.position = Vector2(4.0, 4.0) - recovery._input(pointer_motion) - await process_frame - await process_frame - _expect( - root.gui_get_focus_owner() == null, - "mouse motion releases controller focus", - ) - await process_frame - _expect( - root.gui_get_focus_owner() == null, - "mouse motion prevents automatic focus recovery", - ) - recovery._input(controller_event) - await process_frame - await process_frame - _expect( - root.gui_get_focus_owner() == explicit_target, - "controller navigation can resume from pointer mode", - ) - var pointer_press := InputEventMouseButton.new() - pointer_press.button_index = MOUSE_BUTTON_LEFT - pointer_press.pressed = true - recovery._input(pointer_press) - await process_frame - _expect( - root.gui_get_focus_owner() == explicit_target, - "mouse-down preserves focus through button activation", - ) - var pointer_release := InputEventMouseButton.new() - pointer_release.button_index = MOUSE_BUTTON_LEFT - pointer_release.pressed = false - recovery._input(pointer_release) - await process_frame - await process_frame - _expect( - root.gui_get_focus_owner() == null, - "mouse-up clears the completed button focus", - ) - recovery._input(controller_event) - await process_frame - await process_frame - - var outside_button := _make_button("outside", "outside") - stage.add_child(outside_button) - option_list.hide() - root.gui_release_focus() - await process_frame - await process_frame - _expect( - root.gui_get_focus_owner() == null, - "focus recovery never escapes a hidden menu scope", - ) - option_list.show() - explicit_target.grab_focus() - await process_frame - var leave_world_ui_event := InputEventJoypadButton.new() - leave_world_ui_event.button_index = JOY_BUTTON_LEFT_SHOULDER - leave_world_ui_event.pressed = true - recovery._input(leave_world_ui_event) - root.gui_release_focus() - await process_frame - await process_frame - _expect( - root.gui_get_focus_owner() == null, - "LB intentionally leaving world UI is never recovered", - ) - var accessibility_only := Control.new() - accessibility_only.focus_mode = Control.FOCUS_ACCESSIBILITY - stage.add_child(accessibility_only) - await process_frame - _expect( - not bool(recovery.call("_is_focusable", accessibility_only)), - "accessibility-only controls are not recovery targets", - ) - - stage.queue_free() - if _failures.is_empty(): - print("Controller focus recovery validation: PASS") - quit(0) - return - for failure: String in _failures: - push_error(failure) - quit(1) - - -func _make_button(text: String, tooltip: String) -> Button: - var button := Button.new() - button.text = text - button.tooltip_text = tooltip - button.custom_minimum_size = Vector2(120.0, 48.0) - return button - - -func _expect(condition: bool, message: String) -> void: - if not condition: - _failures.append(message) diff --git a/tests/controller_mapping_validation.gd b/tests/controller_mapping_validation.gd index 78e0ee8..a5938d6 100644 --- a/tests/controller_mapping_validation.gd +++ b/tests/controller_mapping_validation.gd @@ -14,6 +14,22 @@ func _init() -> void: func _run() -> void: + if ( + ControllerMappingManagerType.ROLE_LABELS[ + ControllerMappingManagerType.ROLE_CAMERA_ZOOM + ] != "zoom modifier (+RT)" + ): + push_error("controller zoom modifier label is misleading") + quit(1) + return + if ( + ControllerMappingManagerType.ROLE_LABELS[ + ControllerMappingManagerType.ROLE_RIGHT_STICK_Y + ] != "camera up / down (+RT to zoom)" + ): + push_error("controller vertical camera label omits the RT zoom chord") + quit(1) + return var manager := ControllerMappingManagerType.new() root.add_child(manager) await process_frame @@ -102,6 +118,22 @@ func _validate_manager(manager: ControllerMappingManagerType) -> String: &"sneak", &"" ) != ControllerMappingManagerType.ROLE_RIGHT_STICK_CLICK: return "right-stick click is not assigned to the sneak action" + if ControllerMappingManagerType.ROLE_LABELS.get( + ControllerMappingManagerType.ROLE_Y, "" + ) != "interact / character call": + return "Y does not present its contextual gameplay actions" + if ControllerMappingManagerType.BUTTON_ACTION_ROLES.get( + &"interact", &"" + ) != ControllerMappingManagerType.ROLE_Y: + return "Y is not assigned to the interact action" + if ControllerMappingManagerType.BUTTON_ACTION_ROLES.get( + &"character_call", &"" + ) != ControllerMappingManagerType.ROLE_Y: + return "Y is not assigned to the character-call action" + if not _has_joy_button(&"character_call", JOY_BUTTON_Y): + return "character call does not default to Y" + if not _has_joy_button(&"interact", JOY_BUTTON_Y): + return "interact does not default to Y" if not _has_joy_button(&"sneak", JOY_BUTTON_RIGHT_STICK): return "sneak does not default to right-stick click" var trigger_button := InputEventJoypadButton.new() @@ -136,6 +168,10 @@ func _validate_manager(manager: ControllerMappingManagerType) -> String: "kind": "button", "button": int(JOY_BUTTON_X), } + custom[str(ControllerMappingManagerType.ROLE_X)] = { + "kind": "button", + "button": int(JOY_BUTTON_A), + } custom[str(ControllerMappingManagerType.ROLE_POINTER_MODIFIER)] = ( trigger_binding ) @@ -143,6 +179,41 @@ func _validate_manager(manager: ControllerMappingManagerType) -> String: return "valid custom mapping could not be saved" if not manager.has_custom_mapping(): return "saved custom mapping did not become active" + var duplicate: Dictionary = custom.duplicate(true) + duplicate[str(ControllerMappingManagerType.ROLE_X)] = ( + duplicate[str(ControllerMappingManagerType.ROLE_A)] as Dictionary + ).duplicate(true) + if manager.replace_active_bindings(duplicate): + return "duplicate controller buttons were accepted" + var shared_trigger_axis: Dictionary = custom.duplicate(true) + shared_trigger_axis[ + str(ControllerMappingManagerType.ROLE_POINTER_MODIFIER) + ] = { + "kind": "axis", + "axis": int(JOY_AXIS_TRIGGER_LEFT), + "direction": 1.0, + "rest": 0.0, + } + shared_trigger_axis[ + str(ControllerMappingManagerType.ROLE_CAMERA_ZOOM) + ] = { + "kind": "axis", + "axis": int(JOY_AXIS_TRIGGER_LEFT), + "direction": -1.0, + "rest": 0.0, + } + if ControllerMappingManagerType.bindings_have_conflicts( + shared_trigger_axis + ): + return "opposite halves of a shared trigger axis conflict" + var malformed_profiles: Dictionary = manager._validated_profiles({ + "name:controller": { + "controller_name": "controller", + "bindings": duplicate, + }, + }) + if not malformed_profiles.is_empty(): + return "a stored controller profile with duplicate buttons was accepted" if _keyboard_event_count(&"jump") != keyboard_events_before: return "controller remapping changed keyboard bindings" var active_button := InputEventJoypadButton.new() @@ -207,7 +278,7 @@ func _validate_manager(manager: ControllerMappingManagerType) -> String: func _validate_portmaster_launcher() -> String: - const launcher_path: String = "res://scripts/portmaster/NETfishing.sh" + const launcher_path: String = "res://scripts/portmaster/straywild.sh" if not FileAccess.file_exists(launcher_path): return "PortMaster launcher template is missing" var launcher: String = FileAccess.get_file_as_string(launcher_path) @@ -220,18 +291,33 @@ func _validate_portmaster_launcher() -> String: "guide:b8,start:b7,back:b6", "leftstick:b9", "rightstick:b12", - "netfishing_controllerconfig=\"$GODOT_MUOS_MAPPING\"", - "$GPTOKEYB \"NETfishing.aarch64\" &", + "straywild_controllerconfig=\"$GODOT_MUOS_MAPPING\"", + "GPTOKEYB_CONFIG=\"$GAMEDIR/straywild.gptk\"", + "$GPTOKEYB \"straywild.aarch64\" -c \"$GPTOKEYB_CONFIG\" &", "pm_platform_helper \"$GAME_EXECUTABLE\"", - "SDL_GAMECONTROLLERCONFIG=\"$netfishing_controllerconfig\" \\", + "\"$GAME_LAUNCHER\"", + "\"$CONTROLLER_MAPPING_FILE\"", "pm_finish", ]: if expected_fragment not in launcher: return "PortMaster launcher omitted " + expected_fragment if "$'\\n'" in launcher: return "PortMaster launcher appends mappings across a Weston-unsafe newline" - if "$GPTOKEYB \"NETfishing.aarch64\" -c" in launcher: - return "PortMaster launcher injects duplicate GPTOKEYB gameplay mappings" + const game_launcher_path: String = ( + "res://scripts/portmaster/launch-straywild.sh" + ) + if not FileAccess.file_exists(game_launcher_path): + return "PortMaster game launcher wrapper is missing" + var game_launcher: String = FileAccess.get_file_as_string( + game_launcher_path + ) + for expected_fragment: String in [ + "SDL_GAMECONTROLLERCONFIG=\"$(<\"$CONTROLLER_MAPPING_FILE\")\"", + "export SDL_GAMECONTROLLERCONFIG", + "exec \"$@\"", + ]: + if expected_fragment not in game_launcher: + return "PortMaster game launcher omitted " + expected_fragment return "" @@ -278,12 +364,6 @@ func _validate_auto_map(manager: ControllerMappingManagerType) -> String: ControllerMappingManagerType.default_bindings()[str(role)] as Dictionary ) - if role == ControllerMappingManagerType.ROLE_B: - binding = ( - ControllerMappingManagerType.default_bindings()[ - str(ControllerMappingManagerType.ROLE_A) - ] as Dictionary - ) if str(binding.get("kind", "")) == "button": var button := InputEventJoypadButton.new() button.device = manager.get_active_device_id() @@ -304,24 +384,12 @@ func _validate_auto_map(manager: ControllerMappingManagerType) -> String: ControllerMappingManagerType.ROLE_ORDER.size() ): return "manual override list does not expose every mapped role" - var conflict_button := panel._binding_buttons.get( - ControllerMappingManagerType.ROLE_A - ) as Button - var conflict_style := conflict_button.get_theme_stylebox( - &"normal" - ) as StyleBoxFlat - if ( - conflict_style == null - or conflict_style.bg_color - != UtilityPageStyle.OCEAN_DANGER - ): - return "duplicate controller bindings were not marked in red" - manager.set_binding( + var duplicate_saved: bool = manager.set_binding( ControllerMappingManagerType.ROLE_B, - ControllerMappingManagerType.default_bindings()[ - str(ControllerMappingManagerType.ROLE_B) - ] as Dictionary, + manager.get_binding(ControllerMappingManagerType.ROLE_A), ) + if duplicate_saved: + return "manual mapping accepted a controller button already in use" panel._begin_manual_capture( ControllerMappingManagerType.ROLE_POINTER_MODIFIER ) diff --git a/tests/controller_menu_accessibility_validation.gd b/tests/controller_menu_accessibility_validation.gd index fca6c46..37e43d5 100644 --- a/tests/controller_menu_accessibility_validation.gd +++ b/tests/controller_menu_accessibility_validation.gd @@ -3,7 +3,10 @@ extends SceneTree const JoinGamePageScene = preload( "res://ui/network/join_game_page.tscn" ) +const TitleScreenScene = preload("res://ui/title_screen.tscn") +const PauseMenuScene = preload("res://ui/pause_menu.tscn") const SettingsPanelScene = preload("res://ui/settings_panel.tscn") +const SaveSlotsPageScene = preload("res://ui/save_slots_page.tscn") const BubbleConfirmationScene = preload( "res://ui/components/bubble_menu/bubble_confirmation_page.tscn" ) @@ -11,7 +14,22 @@ const TitleConfirmationScene = preload( "res://ui/title_confirmation_bubble_page.tscn" ) const MailPageType = preload("res://ui/mail_page.gd") +const LogbookPageType = preload("res://ui/logbook_page.gd") const ProfilePageType = preload("res://ui/profile_page.gd") +const VoiceProfilesType = preload( + "res://player/animalese_voice_profiles.gd" +) +const PlayerMenuScene = preload("res://ui/player_menu.tscn") +const PlayerMenuType = preload("res://ui/player_menu.gd") +const PlayerHotbarType = preload("res://inventory/player_hotbar.gd") +const ItemCatalogResource: ItemCatalog = preload( + "res://items/catalog/item_catalog.tres" +) +const PlayersPageType = preload("res://ui/players_page.gd") +const TheNetPageType = preload("res://ui/the_net_page.gd") +const ControllerMappingManagerType = preload( + "res://settings/controller_mapping_manager.gd" +) const DialogControllerNavigationType = preload( "res://ui/file_dialog_controller_navigation.gd" ) @@ -25,10 +43,18 @@ func _initialize() -> void: func _run() -> void: root.size = Vector2i(1280, 720) + await _validate_primary_menu_navigation() + await _validate_save_slots_navigation() await _validate_join_game_navigation() await _validate_data_settings_navigation() + await _validate_settings_adjustment_navigation() + await _validate_settings_presentation_requires_apply() await _validate_mail_navigation() await _validate_profile_confirmation_focus() + await _validate_profile_voice_navigation() + await _validate_player_menu_toggle_queue() + await _validate_inventory_tab_zone_transitions() + await _validate_player_menu_nested_controller_back() await _validate_confirmation_dialog_navigation() await _validate_bubble_confirmation_navigation() _validate_mapping_capture_contract() @@ -41,18 +67,250 @@ func _run() -> void: quit(1) +func _validate_player_menu_toggle_queue() -> void: + var menu := PlayerMenuScene.instantiate() as Control + root.add_child(menu) + await process_frame + menu.visible = true + menu.set("_transitioning", true) + var toggle := InputEventAction.new() + toggle.action = &"open_backpack" + toggle.pressed = true + menu.call("_input", toggle) + _expect( + bool(menu.get("_backpack_toggle_queued")), + "Player menu discarded TAB during its entry transition.", + ) + menu.call("_input", toggle) + _expect( + not bool(menu.get("_backpack_toggle_queued")), + "Repeated TAB presses did not preserve toggle parity.", + ) + menu.call("_input", toggle) + menu.call( + "_finish_menu_entry", + int(menu.get("_transition_generation")), + ) + await create_timer(0.5).timeout + _expect( + not menu.visible, + "A queued TAB press did not close the menu after entry.", + ) + menu.queue_free() + await process_frame + + +func _validate_primary_menu_navigation() -> void: + var title := TitleScreenScene.instantiate() as Control + root.add_child(title) + await process_frame + (title.get_node("%ButtonCenter") as Control).show() + (title.get_node("%BubbleField") as Control).show() + title.call("_update_title_layout") + title.call("_set_title_bubbles_interactive", true) + var title_controls: Array[Control] = [] + for candidate: Variant in title.call("_get_title_buttons"): + var control := candidate as Control + if control is BaseButton: + (control as BaseButton).disabled = false + title_controls.append(control) + _expect( + title_controls.size() == 5, + "Title menu does not expose its five primary actions.", + ) + var play_button := title.get_node("%PlayButton") as Button + _expect( + play_button.icon != null + and play_button.icon.resource_path + == "res://ui/icons/new_menu/play.png" + and play_button.text.is_empty(), + "The Play action is not presented as the large square icon button.", + ) + _expect( + is_equal_approx(play_button.size.x, play_button.size.y), + "The Play action is not square.", + ) + var online_button := title.get_node("%JoinGameButton") as Button + var settings_button := title.get_node("%SettingsButton") as Button + var credits_button := title.get_node("%CreditsButton") as Button + var close_button := title.get_node("%QuitButton") as Button + for secondary_button: Button in [ + online_button, + settings_button, + credits_button, + close_button, + ]: + _expect( + is_equal_approx( + secondary_button.size.x, + secondary_button.size.y, + ), + "A secondary title action is not square.", + ) + _expect( + is_equal_approx( + close_button.position.y + close_button.size.y + - online_button.position.y, + play_button.size.y, + ), + "The secondary title-action stack does not match Play's height.", + ) + _expect( + not (title.get_node("%NewGameButton") as Control).visible + and not (title.get_node("%DeleteSaveButton") as Control).visible, + "Legacy New/Delete title bubbles are still visible.", + ) + _assert_neighbor( + play_button, + &"focus_neighbor_right", + title.get_node("%JoinGameButton") as Control, + ) + _assert_neighbor( + title.get_node("%JoinGameButton") as Control, + &"focus_neighbor_left", + play_button, + ) + _assert_neighbor( + title.get_node("%JoinGameButton") as Control, + &"focus_neighbor_bottom", + title.get_node("%SettingsButton") as Control, + ) + _assert_neighbor( + title.get_node("%SettingsButton") as Control, + &"focus_neighbor_bottom", + title.get_node("%CreditsButton") as Control, + ) + _assert_neighbor( + title.get_node("%CreditsButton") as Control, + &"focus_neighbor_bottom", + title.get_node("%QuitButton") as Control, + ) + for title_control: Control in title_controls: + _assert_directionally_reachable(title_control, title_controls) + title.queue_free() + await process_frame + + var pause := PauseMenuScene.instantiate() as Control + root.add_child(pause) + pause.show() + var root_page := pause.get_node("%RootPage") as Control + root_page.call("show_page", false) + for _frame: int in 2: + await process_frame + var pause_controls: Array[Control] = [ + pause.get_node("%ResumeButton") as Control, + pause.get_node("%SaveButton") as Control, + pause.get_node("%JoinGameButton") as Control, + pause.get_node("%SettingsButton") as Control, + pause.get_node("%ReturnToTitleButton") as Control, + pause.get_node("%ResetProgressButton") as Control, + pause.get_node("%QuitButton") as Control, + ] + _assert_directionally_reachable(pause_controls.front(), pause_controls) + pause.queue_free() + await process_frame + + +func _validate_save_slots_navigation() -> void: + var page := SaveSlotsPageScene.instantiate() as SaveSlotsPage + root.add_child(page) + await process_frame + page.open_page() + for _frame: int in 2: + await process_frame + await create_timer(0.25).timeout + var saves_tab := page.get_node("%SavesTab") as Button + var new_tab := page.get_node("%NewSlotTab") as Button + var content_panel := page.get_node("%ContentPanel") as PanelContainer + var tab_overlap: float = ( + saves_tab.get_global_rect().end.y + - content_panel.get_global_rect().position.y + ) + _expect( + is_equal_approx(tab_overlap, saves_tab.size.y * 0.5), + "Save-slot content does not cover the lower half of its organizer tabs.", + ) + _expect( + page.get_active_page_id() == &"new", + "An empty save catalog does not open directly to New Slot.", + ) + _assert_neighbor(saves_tab, &"focus_neighbor_right", new_tab) + _assert_neighbor(new_tab, &"focus_neighbor_left", saves_tab) + var new_controls: Array[Control] = [ + saves_tab, + new_tab, + page.get_node("%NewSlotName") as Control, + page.get_node("%GeneratedButton") as Control, + page.get_node("%StarterButton") as Control, + page.get_node("%RandomSeedButton") as Control, + page.get_node("%CustomSeedButton") as Control, + page.get_node("%CreateSlotButton") as Control, + page.get_node("%BackButton") as Control, + ] + _assert_directionally_reachable(new_tab, new_controls) + page.call("_select_page", &"saves", false) + await process_frame + var import_button := page.get_node("%ImportSlotButton") as Button + var actions := page.get_node("%Actions") as VBoxContainer + var secondary_actions := page.get_node("%SecondaryActions") as GridContainer + var play_slot := page.get_node("%PlaySlotButton") as Button + var rename_slot := page.get_node("%RenameSlotButton") as Button + var duplicate_slot := page.get_node("%DuplicateSlotButton") as Button + var export_slot := page.get_node("%ExportSlotButton") as Button + var delete_slot := page.get_node("%DeleteSlotButton") as Button + _expect( + saves_tab.find_valid_focus_neighbor(SIDE_BOTTOM) == import_button, + "An empty Save Slots page does not lead from its tab to Import Save.", + ) + _expect( + import_button.find_valid_focus_neighbor(SIDE_BOTTOM) + == page.get_node("%BackButton"), + "An empty Save Slots page does not lead from Import Save to Back.", + ) + _expect( + is_equal_approx(play_slot.size.x, actions.size.x), + "Save-slot Play does not span the full action width.", + ) + _expect( + secondary_actions.columns == 2 + and is_equal_approx(rename_slot.size.x, duplicate_slot.size.x) + and is_equal_approx(export_slot.size.x, delete_slot.size.x) + and is_equal_approx(rename_slot.position.y, duplicate_slot.position.y) + and is_equal_approx(export_slot.position.y, delete_slot.position.y) + and export_slot.position.y > rename_slot.position.y, + "Save-slot secondary actions are not arranged as a 2 by 2 grid.", + ) + var play_style := play_slot.get_theme_stylebox("normal") as StyleBoxFlat + _expect( + play_style != null and play_style.bg_color == UtilityPageStyle.GREEN, + "Save-slot Play does not use the green primary-action style.", + ) + _assert_neighbor(play_slot, &"focus_neighbor_bottom", rename_slot) + _assert_neighbor(rename_slot, &"focus_neighbor_right", duplicate_slot) + _assert_neighbor(rename_slot, &"focus_neighbor_bottom", export_slot) + _assert_neighbor(duplicate_slot, &"focus_neighbor_bottom", delete_slot) + _assert_neighbor(export_slot, &"focus_neighbor_right", delete_slot) + page.queue_free() + await process_frame + + func _validate_join_game_navigation() -> void: var page := JoinGamePageScene.instantiate() as Control root.add_child(page) await process_frame page.show() + await process_frame var discover := page.get_node("%DiscoverButton") as Button + var friends := page.get_node("%FriendsButton") as Button var direct := page.get_node("%DirectButton") as Button var saved := page.get_node("%SavedButton") as Button var recent := page.get_node("%RecentButton") as Button var address := page.get_node("%Address") as LineEdit var name_edit := page.get_node("%NameEdit") as LineEdit var server_list := page.get_node("%ServerList") as ItemList + var presence := page.get_node("%PresenceButton") as Button + var room_open := page.get_node("%RoomOpenButton") as Button + var room_listing := page.get_node("%RoomListingButton") as Button var refresh := page.get_node("%RefreshButton") as Button var join := page.get_node("%JoinButton") as Button var save := page.get_node("%SaveButton") as Button @@ -61,8 +319,22 @@ func _validate_join_game_navigation() -> void: var delete := page.get_node("%DeleteButton") as Button var cancel := page.get_node("%CancelButton") as Button var back := page.get_node("%BackButton") as Button - var modes: Array[Control] = [discover, direct, saved, recent] + var direct_content := page.get_node("%DirectContent") as Control + var list_content := page.get_node("%ListContent") as Control + var content_panel := page.get_node("%ContentPanel") as PanelContainer + var actions := page.get_node("%Actions") as HBoxContainer + var modes: Array[Control] = [discover, friends, direct, saved, recent] + var tab_overlap: float = ( + discover.get_global_rect().end.y + - content_panel.get_global_rect().position.y + ) + _expect( + is_equal_approx(tab_overlap, discover.size.y * 0.5), + "Join-game content does not cover the lower half of its organizer tabs.", + ) + direct_content.hide() + list_content.show() address.hide() name_edit.hide() server_list.show() @@ -74,30 +346,114 @@ func _validate_join_game_navigation() -> void: _set_button_state(delete, false) _set_button_state(cancel, false) _set_button_state(back, true) - page.set("_mode", 0) + page.set("_mode", JoinGamePage.Mode.DISCOVER) page.call("_configure_controller_navigation") await process_frame _assert_neighbor(discover, &"focus_neighbor_bottom", server_list) _assert_neighbor(server_list, &"focus_neighbor_top", discover) _assert_neighbor(server_list, &"focus_neighbor_bottom", refresh) _assert_neighbor(refresh, &"focus_neighbor_right", join) - _assert_neighbor(back, &"focus_neighbor_left", join) + _assert_neighbor(join, &"focus_neighbor_bottom", back) + _assert_neighbor(back, &"focus_neighbor_top", join) + _expect( + is_equal_approx( + join.get_global_rect().end.x, + actions.get_global_rect().end.x, + ), + "Discover Refresh and Join are not right-justified.", + ) var discover_controls: Array[Control] = modes.duplicate() discover_controls.append_array([server_list, refresh, join, back]) _assert_directionally_reachable(discover, discover_controls) + room_open.show() + room_listing.show() + _set_button_state(room_open, true) + _set_button_state(room_listing, true) + page.call("_configure_controller_navigation") + await process_frame + _assert_neighbor(room_open, &"focus_neighbor_right", room_listing) + _assert_neighbor(room_open, &"focus_neighbor_left", room_open) + _assert_neighbor(room_listing, &"focus_neighbor_left", room_open) + _assert_neighbor(room_listing, &"focus_neighbor_bottom", server_list) + var hosted_discover_controls: Array[Control] = modes.duplicate() + hosted_discover_controls.append_array([ + room_open, + room_listing, + server_list, + refresh, + join, + back, + ]) + _assert_directionally_reachable(discover, hosted_discover_controls) + var rooms: Array[Dictionary] = [ + { + "room_id": "controller-default-room", + "room_name": "Controller default room", + "current_players": 1, + "max_players": 8, + }, + { + "room_id": "controller-second-room", + "room_name": "Controller second room", + "current_players": 2, + "max_players": 8, + }, + ] + page.call("_on_discovery_rooms_updated", rooms) + _expect( + int(page.get("_selected_discovery_index")) == 0, + "Discovery should select its first room as soon as results arrive.", + ) + _expect( + server_list.is_selected(0), + "Discovery's visible cursor and selected room should agree immediately.", + ) + page.set("_mode", JoinGamePage.Mode.FRIENDS) + (page.get_node("%OnlineControls") as Control).hide() + presence.show() + page.call("_configure_controller_navigation") + await process_frame + _assert_neighbor(friends, &"focus_neighbor_bottom", server_list) + _assert_neighbor(server_list, &"focus_neighbor_top", friends) + _assert_neighbor(server_list, &"focus_neighbor_bottom", presence) + _assert_neighbor(presence, &"focus_neighbor_right", refresh) + _assert_neighbor(refresh, &"focus_neighbor_right", join) + _expect( + is_equal_approx( + presence.get_global_rect().position.x, + actions.get_global_rect().position.x, + ), + "Friend presence is not left-justified in the action row.", + ) + _expect( + is_equal_approx( + join.get_global_rect().end.x, + actions.get_global_rect().end.x, + ), + "Friends Refresh and Join are not right-justified.", + ) + var friend_controls: Array[Control] = modes.duplicate() + friend_controls.append_array([server_list, presence, refresh, join, back]) + _assert_directionally_reachable(friends, friend_controls) + + list_content.hide() + direct_content.show() + presence.hide() address.show() address.editable = true server_list.hide() _set_button_state(refresh, false) _set_button_state(join, true) _set_button_state(save, true) - page.set("_mode", 1) + page.set("_mode", JoinGamePage.Mode.DIRECT) page.call("_configure_controller_navigation") await process_frame _assert_neighbor(direct, &"focus_neighbor_bottom", address) _assert_neighbor(address, &"focus_neighbor_top", direct) _assert_neighbor(address, &"focus_neighbor_bottom", join) + _assert_neighbor(save, &"focus_neighbor_bottom", back) + _assert_neighbor(back, &"focus_neighbor_top", save) var direct_controls: Array[Control] = modes.duplicate() direct_controls.append_array([address, join, save, back]) _assert_directionally_reachable(direct, direct_controls) @@ -120,28 +476,168 @@ func _validate_join_game_navigation() -> void: ) await process_frame + var saved_entries: Array[SavedServerEntry] = [] + server_list.clear() + for index: int in 3: + var entry := SavedServerEntry.new() + entry.entry_id = "controller-saved-%d" % index + entry.display_name = "Saved server %d" % index + saved_entries.append(entry) + server_list.add_item(entry.display_name) + page.set("_mode", JoinGamePage.Mode.SAVED) + page.set("_visible_entries", saved_entries) + direct_content.hide() + list_content.show() + server_list.show() + page.call("_configure_controller_navigation") + page.call("_restore_entry_selection_and_focus", 1) + await process_frame + _expect( + server_list.is_selected(1) + and root.gui_get_focus_owner() == server_list, + "Saved-server refresh did not restore the same list position.", + ) + saved_entries.remove_at(1) + server_list.remove_item(1) + page.set("_visible_entries", saved_entries) + page.call("_restore_entry_selection_and_focus", 1) + await process_frame + _expect( + server_list.is_selected(1) + and ( + page.get("_selected_entry") as SavedServerEntry + ).entry_id == "controller-saved-2", + "Deleting a saved server did not select the row that replaced it.", + ) + saved_entries.clear() + server_list.clear() + page.set("_visible_entries", saved_entries) + page.call("_restore_entry_selection_and_focus", 0) + await process_frame + _expect( + root.gui_get_focus_owner() == saved, + "An empty saved-server list did not return focus to its mode tab.", + ) + page.queue_free() await process_frame func _validate_data_settings_navigation() -> void: - var panel := SettingsPanelScene.instantiate() as Control + var main_source: String = FileAccess.get_file_as_string("res://main/main.gd") + var data_root_source: String = FileAccess.get_file_as_string( + "res://network/player_data_root.gd" + ) + var settings_source: String = FileAccess.get_file_as_string( + "res://ui/settings_panel.gd" + ) + _expect( + not main_source.contains("OS.shell_open") + and not main_source.contains( + "status_changed.connect(_on_data_root_status)" + ) + and not data_root_source.contains("OS.shell_open") + and settings_source.count("OS.shell_open") == 1, + ( + "Opening the data folder is not owned exclusively by the Settings " + + "Data action." + ), + ) + var panel := SettingsPanelScene.instantiate() as SettingsPanel root.add_child(panel) await process_frame panel.show() - var data_page := panel.get_node("%DataPage") as SettingsBubblePage - data_page.show_page(false) for _frame: int in 2: await process_frame + var data_tab := panel.get_node("%DataTab") as Button + var open_data_folder := panel.get_node("%OpenDataFolder") as Button + var content_panel := panel.get_node("%ContentPanel") as PanelContainer + var tab_overlap: float = ( + data_tab.get_global_rect().end.y + - content_panel.get_global_rect().position.y + ) + _expect( + is_equal_approx(tab_overlap, data_tab.size.y * 0.5), + "Settings content does not cover the lower half of its organizer tabs.", + ) + var open_activation := {"count": 0} + open_data_folder.pressed.connect(func() -> void: + open_activation["count"] = int(open_activation["count"]) + 1 + ) + data_tab.grab_focus() + var accept_press := InputEventJoypadButton.new() + accept_press.button_index = JOY_BUTTON_A + accept_press.pressed = true + Input.parse_input_event(accept_press) + await process_frame + var accept_release := InputEventJoypadButton.new() + accept_release.button_index = JOY_BUTTON_A + accept_release.pressed = false + Input.parse_input_event(accept_release) + for _frame: int in 2: + await process_frame + _expect( + panel.get_active_page_id() == &"data", + "Selecting the Data tab did not open the Data page.", + ) + _expect( + int(open_activation["count"]) == 0, + "Selecting the Data tab also activated Open Data Folder.", + ) + _expect( + root.gui_get_focus_owner() == data_tab, + "Selecting the Data tab transferred focus into its actions.", + ) + open_data_folder.grab_focus() + _expect( + root.gui_get_focus_owner() == open_data_folder, + "Open Data Folder did not accept controller focus.", + ) + _expect( + not open_data_folder.disabled, + "Open Data Folder is unexpectedly disabled.", + ) + var action_press := InputEventJoypadButton.new() + action_press.button_index = JOY_BUTTON_A + action_press.pressed = true + Input.parse_input_event(action_press) + await process_frame + var action_release := InputEventJoypadButton.new() + action_release.button_index = JOY_BUTTON_A + action_release.pressed = false + Input.parse_input_event(action_release) + for _frame: int in 2: + await process_frame + _expect( + int(open_activation["count"]) == 1, + ( + "Explicitly accepting Open Data Folder pressed it %d times." + % int(open_activation["count"]) + ), + ) + _expect( + panel.find_children( + "*", "ConfirmationDialog", true, false + ).is_empty(), + "Open Data Folder left a controller-activatable dialog behind.", + ) + var change_data_folder := panel.get_node("%ChangeDataFolder") as Button + var copy_fingerprint := panel.get_node("%CopyPlayerFingerprint") as Button + var export_player := panel.get_node("%ExportPlayerIdentity") as Button + var import_player := panel.get_node("%ImportPlayerIdentity") as Button + var export_host := panel.get_node("%ExportHostIdentity") as Button + var import_host := panel.get_node("%ImportHostIdentity") as Button var controls: Array[Control] = [ - panel.get_node("%OpenDataFolder") as Control, - panel.get_node("%ChangeDataFolder") as Control, - panel.get_node("%CopyPlayerFingerprint") as Control, - panel.get_node("%ExportPlayerIdentity") as Control, - panel.get_node("%ImportPlayerIdentity") as Control, - panel.get_node("%ExportHostIdentity") as Control, - panel.get_node("%ImportHostIdentity") as Control, - panel.get_node("%DataBackButton") as Control, + data_tab, + open_data_folder, + change_data_folder, + copy_fingerprint, + export_player, + import_player, + export_host, + import_host, + panel.get_node("%ApplySettingsButton") as Control, + panel.get_node("%SettingsBackButton") as Control, ] for control: Control in controls: _expect( @@ -149,11 +645,261 @@ func _validate_data_settings_navigation() -> void: "Data & Identity control %s is not controller-focusable." % control.name, ) + _assert_neighbor(data_tab, &"focus_neighbor_bottom", open_data_folder) + _assert_neighbor( + open_data_folder, + &"focus_neighbor_right", + change_data_folder, + ) + _assert_neighbor( + open_data_folder, + &"focus_neighbor_bottom", + copy_fingerprint, + ) + _assert_neighbor( + change_data_folder, + &"focus_neighbor_left", + open_data_folder, + ) + _assert_neighbor( + change_data_folder, + &"focus_neighbor_bottom", + copy_fingerprint, + ) + _assert_neighbor( + copy_fingerprint, + &"focus_neighbor_top", + open_data_folder, + ) + _assert_neighbor( + copy_fingerprint, + &"focus_neighbor_bottom", + export_player, + ) + _assert_neighbor(export_player, &"focus_neighbor_right", import_player) + _assert_neighbor(export_player, &"focus_neighbor_bottom", export_host) + _assert_neighbor(import_player, &"focus_neighbor_left", export_player) + _assert_neighbor(import_player, &"focus_neighbor_bottom", import_host) + _assert_neighbor(export_host, &"focus_neighbor_top", export_player) + _assert_neighbor(export_host, &"focus_neighbor_right", import_host) + _assert_neighbor(import_host, &"focus_neighbor_top", import_player) + _assert_neighbor(import_host, &"focus_neighbor_left", export_host) _assert_directionally_reachable(controls.front(), controls) + await process_frame + open_data_folder.grab_focus() + panel.call("_select_page", &"sound", true) + _expect( + panel.get_active_page_id() == &"sound", + "Settings did not leave the Data page.", + ) + _expect( + root.gui_get_focus_owner() == panel.get_node("%SoundTab"), + "Leaving Data retained focus on a hidden Data action.", + ) + var sound_down: Control = ( + (panel.get_node("%SoundTab") as Control).find_valid_focus_neighbor( + SIDE_BOTTOM + ) + ) + _expect( + sound_down != null and not panel.get_node("%DataPage").is_ancestor_of( + sound_down + ), + "Sound navigation still pointed into the hidden Data page.", + ) + var hidden_data_activation_count: int = int(open_activation["count"]) + Input.parse_input_event(action_press) + await process_frame + Input.parse_input_event(action_release) + for _frame: int in 2: + await process_frame + _expect( + int(open_activation["count"]) == hidden_data_activation_count, + "Controller A activated Open Data Folder from another settings page.", + ) + open_data_folder.pressed.emit() + await process_frame + _expect( + panel.find_children( + "*", "ConfirmationDialog", true, false + ).is_empty(), + "A hidden Data action created a folder dialog.", + ) + panel.call("_select_page", &"data", true) + await process_frame + copy_fingerprint.grab_focus() + var feedback := panel.get_node("%SettingsFeedback") as Label + feedback.text = "activation boundary intact" + open_data_folder.pressed.emit() + await process_frame + _expect( + feedback.text == "activation boundary intact", + ( + "Open Data Folder crossed its activation boundary without owning " + + "controller focus." + ), + ) + panel.hide() + await process_frame + var hidden_focus_owner: Control = root.gui_get_focus_owner() + _expect( + hidden_focus_owner == null + or not panel.is_ancestor_of(hidden_focus_owner), + "Hiding Settings retained focus on one of its controls.", + ) + _expect( + panel.find_children("*", "BubbleButton", true, false).is_empty(), + "Settings children still contain bubble controls.", + ) panel.queue_free() await process_frame +func _validate_settings_adjustment_navigation() -> void: + var panel := SettingsPanelScene.instantiate() as SettingsPanel + root.add_child(panel) + await process_frame + panel.show() + panel.call("_select_page", &"sound", false) + for _frame: int in 2: + await process_frame + var sound_controls: Array[Control] = [ + panel.get_node("%SoundTab") as Control, + panel.get_node("%MasterVolumeSlider") as Control, + panel.get_node("%MusicVolumeSlider") as Control, + panel.get_node("%EffectsVolumeSlider") as Control, + panel.get_node("%EnvironmentVolumeSlider") as Control, + panel.get_node("%ApplySettingsButton") as Control, + panel.get_node("%SettingsBackButton") as Control, + ] + _assert_directionally_reachable(sound_controls.front(), sound_controls) + panel.call("_select_page", &"controls", false) + for _frame: int in 2: + await process_frame + var mouse_slider := panel.get_node("%MouseSensitivitySlider") as HSlider + var controller_slider := panel.get_node( + "%ControllerSensitivitySlider" + ) as HSlider + var on_screen_keyboard := panel.get_node( + "%OnScreenKeyboardToggle" + ) as Button + var swap_scroll := panel.get_node("%SwapScrollToggle") as Button + var invert_y := panel.get_node("%InvertYToggle") as Button + var controller_binds := panel.get_node("%ControllerMapping") as Button + var keyboard_binds := panel.get_node("%KeyboardMapping") as Button + _expect( + mouse_slider.focus_mode == Control.FOCUS_ALL + and controller_slider.focus_mode == Control.FOCUS_ALL, + "Standard sensitivity sliders are not controller-focusable.", + ) + _expect( + is_equal_approx(mouse_slider.step, 0.0005) + and is_equal_approx(controller_slider.step, 0.1), + "Sensitivity sliders do not retain their authored increments.", + ) + _assert_neighbor( + invert_y, + &"focus_neighbor_bottom", + swap_scroll, + ) + _assert_neighbor( + swap_scroll, + &"focus_neighbor_top", + invert_y, + ) + _assert_neighbor( + swap_scroll, + &"focus_neighbor_bottom", + on_screen_keyboard, + ) + _assert_neighbor( + on_screen_keyboard, + &"focus_neighbor_top", + swap_scroll, + ) + _assert_neighbor( + on_screen_keyboard, + &"focus_neighbor_bottom", + controller_binds, + ) + _assert_neighbor( + controller_binds, + &"focus_neighbor_top", + on_screen_keyboard, + ) + _assert_neighbor( + controller_binds, + &"focus_neighbor_right", + keyboard_binds, + ) + _assert_neighbor( + keyboard_binds, + &"focus_neighbor_top", + on_screen_keyboard, + ) + _assert_neighbor( + keyboard_binds, + &"focus_neighbor_left", + controller_binds, + ) + var control_inputs: Array[Control] = [ + panel.get_node("%ControlsTab") as Control, + mouse_slider, + controller_slider, + invert_y, + swap_scroll, + on_screen_keyboard, + controller_binds, + keyboard_binds, + panel.get_node("%ApplySettingsButton") as Control, + panel.get_node("%SettingsBackButton") as Control, + ] + _assert_directionally_reachable(control_inputs.front(), control_inputs) + panel.queue_free() + await process_frame + + +func _validate_settings_presentation_requires_apply() -> void: + var panel := SettingsPanelScene.instantiate() as SettingsPanel + var settings_manager := PlayerSettingsManager.new() + root.add_child(settings_manager) + root.add_child(panel) + await process_frame + panel.open_panel(settings_manager) + await process_frame + var chat_dock := panel.get_node("%ChatDockSelector") as OptionButton + var chat_mode := panel.get_node("%ChatModeSelector") as OptionButton + var paint_dock := panel.get_node("%PaintDockSelector") as OptionButton + chat_dock.select(1) + chat_dock.item_selected.emit(1) + chat_mode.select(1) + chat_mode.item_selected.emit(1) + paint_dock.select(0) + paint_dock.item_selected.emit(0) + _expect( + not settings_manager.current_settings.chat_dock_right + and not settings_manager.current_settings.chat_mobile_mode + and settings_manager.current_settings.paint_dock_right + and not settings_manager.current_settings.presentation_layout_customized, + ( + "Navigating presentation choices changed saved docking settings " + + "before Apply." + ), + ) + panel.call("_apply_settings") + _expect( + settings_manager.current_settings.chat_dock_right + and settings_manager.current_settings.chat_mobile_mode + and not settings_manager.current_settings.paint_dock_right + and settings_manager.current_settings.presentation_layout_customized, + "Applying deliberate presentation choices did not retain them.", + ) + panel.close_panel(true) + panel.queue_free() + settings_manager.queue_free() + await process_frame + + func _validate_mail_navigation() -> void: var page := MailPageType.new() as Control root.add_child(page) @@ -213,6 +959,13 @@ func _validate_profile_confirmation_focus() -> void: page.call("activate") page.call("set_interactive", true) page.call("reset_controller_zone") + var name_edit := page.get("_name_edit") as LineEdit + name_edit.grab_focus() + page.call("_on_name_changed", "V") + _expect( + root.gui_get_focus_owner() == name_edit, + "Typing a profile name released the active name field.", + ) var suggestions := page.get("_suggestions") as HBoxContainer var suggestion := Button.new() suggestion.text = "alternate name" @@ -223,6 +976,7 @@ func _validate_profile_confirmation_focus() -> void: account_controls.append(item as Control) var preview := page.get("_preview") as Control var reset_view := page.get("_reset_view_button") as Button + var reset_view_hint := page.get("_reset_view_controller_hint") as Label _expect( suggestion in account_controls, "Profile name-conflict choices are outside the account zone.", @@ -239,6 +993,34 @@ func _validate_profile_confirmation_focus() -> void: reset_view.focus_mode == Control.FOCUS_NONE, "The profile reset-view button must not take controller focus.", ) + _expect( + reset_view_hint != null + and reset_view_hint.text == "Reset View: RS" + and reset_view_hint.focus_mode == Control.FOCUS_NONE, + "The profile preview does not present its right-stick reset hint.", + ) + preview.set("_camera_yaw", 1.0) + preview.set("_camera_pitch", 0.4) + preview.set("_camera_distance", 2.5) + var reset_view_event := InputEventJoypadButton.new() + reset_view_event.button_index = JOY_BUTTON_RIGHT_STICK + reset_view_event.pressed = true + _expect( + bool(page.call("handle_controller_input", reset_view_event)), + "Profile customization did not consume right-stick reset.", + ) + _expect( + is_equal_approx(float(preview.get("_camera_yaw")), 0.0) + and is_equal_approx( + float(preview.get("_camera_pitch")), + ProfilePreview.DEFAULT_CAMERA_PITCH, + ) + and is_equal_approx( + float(preview.get("_camera_distance")), + ProfilePreview.DEFAULT_CAMERA_DISTANCE, + ), + "Right-stick click did not restore the default profile preview view.", + ) page.call("_show_confirmation", "defaults") var confirmation := page.get("_discard_confirmation") as Control var confirm := page.get("_confirmation_confirm") as Button @@ -273,10 +1055,830 @@ func _validate_profile_confirmation_focus() -> void: control.focus_mode == Control.FOCUS_ALL, "Profile account focus was not restored after confirmation.", ) + page.call("_enter_controller_customization") + for _frame: int in 2: + await process_frame + var categories: Array[Control] = [] + var category_list := page.get("_category_list") as VBoxContainer + for item: Variant in page.call("_controls_under", category_list): + categories.append(item as Control) + var initial_category_focus := root.gui_get_focus_owner() as Control + _expect( + initial_category_focus in categories, + "Customize did not focus the appearance feature list.", + ) + var down := InputEventAction.new() + down.action = &"ui_down" + down.pressed = true + Input.parse_input_event(down) + for _frame: int in 2: + await process_frame + var next_category_focus := root.gui_get_focus_owner() as Control + _expect( + next_category_focus in categories, + "Moving down dropped focus from the appearance feature list.", + ) + _expect( + next_category_focus != initial_category_focus, + "Moving down did not advance through appearance features.", + ) + down.pressed = false + Input.parse_input_event(down) + var accept_event := InputEventAction.new() + accept_event.action = &"ui_accept" + accept_event.pressed = true + _expect( + bool(page.call("handle_controller_input", accept_event)), + "Appearance feature selection did not consume controller Accept.", + ) + for _frame: int in 3: + await process_frame + var option_groups: Array = page.call("_controller_option_groups") + var option_controls: Array[Control] = [] + if not option_groups.is_empty(): + for item: Variant in option_groups.front(): + var option_control := item as Control + if option_control != null: + option_controls.append(option_control) + _expect( + root.gui_get_focus_owner() in option_controls, + "Selecting an appearance feature did not focus its options.", + ) + var rebuilt_option := root.gui_get_focus_owner() as BaseButton + if rebuilt_option != null: + rebuilt_option.pressed.emit() + for _frame: int in 3: + await process_frame + option_groups = page.call("_controller_option_groups") + option_controls.clear() + if not option_groups.is_empty(): + for item: Variant in option_groups.front(): + var option_control := item as Control + if option_control != null: + option_controls.append(option_control) + _expect( + root.gui_get_focus_owner() in option_controls, + "Rebuilding appearance options dropped controller focus.", + ) + root.gui_release_focus() + var controller_down := InputEventJoypadButton.new() + controller_down.button_index = JOY_BUTTON_DPAD_DOWN + controller_down.pressed = true + page.call("handle_controller_input", controller_down) + _expect( + root.gui_get_focus_owner() in option_controls, + "Appearance options did not recover a lost controller focus owner.", + ) + var cancel_options := InputEventAction.new() + cancel_options.action = &"ui_cancel" + cancel_options.pressed = true + _expect( + bool(page.call("handle_controller_input", cancel_options)), + "Appearance options did not consume controller Back.", + ) + for _frame: int in 2: + await process_frame + _expect( + root.gui_get_focus_owner() in categories, + "Controller Back did not return to the appearance feature list.", + ) page.queue_free() await process_frame +func _validate_profile_voice_navigation() -> void: + var page := ProfilePageType.new() as Control + page.set_anchors_and_offsets_preset(Control.PRESET_FULL_RECT) + root.add_child(page) + await process_frame + page.call("activate") + page.call("set_interactive", true) + page.call("_select_category", "voice") + await process_frame + page.set( + "_controller_zone", + ProfilePageType.ControllerZone.OPTIONS, + ) + page.set("_controller_option_depth", 0) + page.call("_apply_controller_zone_focus") + page.call("_focus_controller_zone") + await process_frame + var sample_grid := page.find_child( + "VoiceSampleSetGrid", true, false + ) as GridContainer + var pitch_grid := page.find_child( + "VoicePitchGrid", true, false + ) as GridContainer + var speed_grid := page.find_child( + "VoiceSpeedGrid", true, false + ) as GridContainer + var call_grid := page.find_child( + "VoiceCallGrid", true, false + ) as GridContainer + _expect( + is_instance_valid(sample_grid) + and is_instance_valid(pitch_grid) + and is_instance_valid(speed_grid) + and is_instance_valid(call_grid), + "The voice page is missing a settings section.", + ) + if ( + not is_instance_valid(sample_grid) + or not is_instance_valid(pitch_grid) + or not is_instance_valid(speed_grid) + or not is_instance_valid(call_grid) + ): + page.queue_free() + await process_frame + return + var sample_buttons: Array[Control] = [] + for item: Variant in page.call("_controls_under", sample_grid): + sample_buttons.append(item as Control) + _expect( + sample_buttons.size() == 3, + "The voice-set row must expose kat, robot, and kim.", + ) + if sample_buttons.size() != 3: + page.queue_free() + await process_frame + return + var kat_button := sample_grid.get_node("VoiceSet_kat") as Button + var robot_button := sample_grid.get_node("VoiceSet_robot") as Button + var kim_button := sample_grid.get_node("VoiceSet_kim") as Button + _expect(kat_button.text == "kat", "The default voice set is not labeled kat.") + _expect(robot_button.text == "robot", "The tone voice set is not labeled robot.") + _expect(kim_button.text == "kim", "The kim voice set is not labeled kim.") + _expect(kat_button.button_pressed, "The kat voice set is not selected by default.") + var option_controls: Array[Control] = [] + var option_groups: Array = page.call("_controller_option_groups") + for item: Variant in option_groups[0]: + option_controls.append(item as Control) + _expect( + option_controls.size() + == ( + VoiceProfilesType.SAMPLE_SET_OPTIONS.size() + + VoiceProfilesType.OPTIONS.size() + + VoiceProfilesType.SPEED_OPTIONS.size() + + VoiceProfilesType.CALL_OPTIONS.size() + ), + "The controller voice zone does not contain every voice setting.", + ) + _assert_directionally_reachable(kat_button, option_controls) + var kat_down := kat_button.get_node_or_null( + kat_button.focus_neighbor_bottom + ) as Control + _expect( + kat_down != null and pitch_grid.is_ancestor_of(kat_down), + "Down from the voice-set row does not enter the pitch row.", + ) + if OS.has_environment("straywild_PROFILE_VOICE_CAPTURE"): + await RenderingServer.frame_post_draw + var capture := root.get_viewport().get_texture().get_image() + _expect( + capture.save_png(OS.get_environment( + "straywild_PROFILE_VOICE_CAPTURE" + )) == OK, + "The profile voice-page capture could not be saved.", + ) + robot_button.grab_focus() + robot_button.button_pressed = true + robot_button.pressed.emit() + await process_frame + _expect( + root.gui_get_focus_owner() == robot_button, + "Selecting robot moved controller focus out of the voice-set row.", + ) + _expect( + str(page.get("_draft_sample_set_id")) == "robot", + "Selecting robot did not update the profile draft.", + ) + kim_button.grab_focus() + kim_button.button_pressed = true + kim_button.pressed.emit() + await process_frame + _expect( + root.gui_get_focus_owner() == kim_button, + "Selecting kim moved controller focus out of the voice-set row.", + ) + _expect( + str(page.get("_draft_sample_set_id")) == "kim", + "Selecting kim did not update the profile draft.", + ) + var category_controls: Array[Control] = [] + for item: Variant in page.call( + "_controls_under", page.get("_category_list") + ): + category_controls.append(item as Control) + for category_control: Control in category_controls: + _expect( + category_control.focus_mode == Control.FOCUS_NONE, + "The voice options zone leaked focus into profile categories.", + ) + page.queue_free() + await process_frame + + +func _validate_player_menu_nested_controller_back() -> void: + var menu := PlayerMenuScene.instantiate() as Control + root.add_child(menu) + await process_frame + menu.visible = true + menu.set("_current_section", PlayerMenuType.Section.PROFILE) + var profile_page := menu.get("_profile_page") as Control + profile_page.call("activate") + profile_page.call("set_interactive", true) + profile_page.call("_enter_controller_customization") + for _frame: int in 2: + await process_frame + var categories: Array[Control] = [] + var category_list := profile_page.get( + "_category_list" + ) as VBoxContainer + for item: Variant in profile_page.call( + "_controls_under", category_list + ): + categories.append(item as Control) + var initial_focus := root.gui_get_focus_owner() as Control + menu.call("_reserve_visible_secondary_navigation") + await process_frame + _expect( + root.gui_get_focus_owner() in categories, + "Player-menu focus reservation disabled appearance features.", + ) + var down := InputEventAction.new() + down.action = &"ui_down" + down.pressed = true + Input.parse_input_event(down) + for _frame: int in 2: + await process_frame + _expect( + root.gui_get_focus_owner() in categories, + "Player-menu Down dropped appearance feature focus.", + ) + _expect( + root.gui_get_focus_owner() != initial_focus, + "Player-menu Down did not advance appearance feature focus.", + ) + down.pressed = false + Input.parse_input_event(down) + _expect( + bool(menu.call("consume_escape")), + "Global player-menu Back did not consume the Profile category zone.", + ) + _expect( + menu.visible, + "Global player-menu Back closed Profile from a nested zone.", + ) + _expect( + int(profile_page.get("_controller_zone")) + == ProfilePageType.ControllerZone.ACCOUNT, + "Global player-menu Back did not return Profile to its account zone.", + ) + + var logbook_page := menu.get("_catalog_logbook") as Control + logbook_page.set("_active", true) + logbook_page.set("_interactive", true) + logbook_page.set( + "_controller_zone", + LogbookPageType.ControllerZone.DETAILS, + ) + menu.set("_current_section", PlayerMenuType.Section.LOGBOOK) + _expect( + bool(menu.call("consume_escape")), + "Global player-menu Back did not consume the Logbook detail zone.", + ) + _expect( + menu.visible, + "Global player-menu Back closed Logbook from a nested zone.", + ) + _expect( + int(logbook_page.get("_controller_zone")) + == LogbookPageType.ControllerZone.ENTRIES, + "Global player-menu Back did not return Logbook to creature selection.", + ) + logbook_page.call("_set_index_open", true, false) + logbook_page.set( + "_controller_zone", + LogbookPageType.ControllerZone.INDEX, + ) + _expect( + bool(menu.call("consume_escape")), + "Global player-menu Back did not consume the Logbook index zone.", + ) + _expect( + menu.visible and not bool(logbook_page.get("_index_open")), + "Global player-menu Back did not return from the Logbook index page.", + ) + _expect( + int(logbook_page.get("_controller_zone")) + == LogbookPageType.ControllerZone.TABS, + "Global player-menu Back did not return Logbook index focus to tabs.", + ) + + var net_page := menu.get("_the_net_page") as Control + net_page.set("_active", true) + net_page.set("_interactive", true) + net_page.set( + "_controller_zone", + TheNetPageType.ControllerZone.CLAIMS, + ) + menu.set("_current_section", PlayerMenuType.Section.NET) + _expect( + bool(menu.call("consume_escape")), + "Global player-menu Back did not consume the Fishnet claims zone.", + ) + _expect( + menu.visible, + "Global player-menu Back closed Fishnet from a nested zone.", + ) + _expect( + int(net_page.get("_controller_zone")) + == TheNetPageType.ControllerZone.TABS, + "Global player-menu Back did not return Fishnet to its tabs.", + ) + + var mail_page := menu.get("_mail_page") as Control + mail_page.set("_active", true) + mail_page.set("_interactive", true) + (mail_page.get("_inbox") as Control).hide() + (mail_page.get("_compose") as Control).show() + (mail_page.get("_letter") as Control).hide() + menu.set("_current_section", PlayerMenuType.Section.MAIL) + _expect( + bool(menu.call("consume_escape")), + "Global player-menu Back did not consume the Mail compose zone.", + ) + _expect( + menu.visible, + "Global player-menu Back closed Mail while composing.", + ) + _expect( + (mail_page.get("_inbox") as Control).visible, + "Global player-menu Back did not return Mail to the inbox.", + ) + + var mapping_manager := ControllerMappingManagerType.new() + var bindings: Dictionary = ControllerMappingManagerType.default_bindings() + bindings[str(ControllerMappingManagerType.ROLE_B)] = { + "kind": "button", + "button": int(JOY_BUTTON_Y), + } + mapping_manager.set("_profiles", { + "default": { + "controller_name": "controller", + "bindings": bindings, + }, + }) + menu.call("setup_controller_mapping", mapping_manager) + var players_page := menu.get("_players_page") as Control + players_page.set("_active", true) + players_page.set("_interactive", true) + players_page.set( + "_controller_zone", PlayersPageType.ControllerZone.BODY + ) + menu.set("_current_section", PlayerMenuType.Section.PLAYERS) + _expect( + bool(menu.call("consume_escape")), + "Global player-menu Back did not consume the Online body zone.", + ) + _expect( + menu.visible, + "Global player-menu Back closed Online from its body zone.", + ) + _expect( + int(players_page.get("_controller_zone")) + == PlayersPageType.ControllerZone.TABS, + "Global player-menu Back did not return Online to its tabs.", + ) + players_page.set( + "_controller_zone", PlayersPageType.ControllerZone.BODY + ) + var mapped_back := InputEventJoypadButton.new() + mapped_back.device = 0 + mapped_back.button_index = JOY_BUTTON_Y + mapped_back.pressed = true + _expect( + bool(menu.call( + "_handle_controller_ownership_input", mapped_back + )), + "Player menu did not consume a mapped controller Back press.", + ) + _expect( + int(players_page.get("_controller_zone")) + == PlayersPageType.ControllerZone.TABS, + "Mapped controller Back skipped the previous player-page zone.", + ) + menu.queue_free() + await process_frame + mapping_manager.free() + + +func _validate_inventory_tab_zone_transitions() -> void: + var menu := PlayerMenuScene.instantiate() as Control + root.add_child(menu) + await process_frame + var inventory_state := Node.new() + root.add_child(inventory_state) + var bag := PlayerBag.new() + var catches := FishInventory.new() + var storage_capacity := PlayerCoolerCapacity.new() + var layout := PlayerInventoryLayout.new() + var hotbar := PlayerHotbarType.new() + for node: Node in [bag, catches, storage_capacity, layout, hotbar]: + inventory_state.add_child(node) + bag.setup(ItemCatalogResource) + layout.setup(bag, catches, ItemCatalogResource, storage_capacity) + assert(layout.restore_backpack_level(1)) + bag.set_inventory_layout(layout) + catches.set_inventory_layout(layout) + hotbar.setup(bag, ItemCatalogResource, catches, layout) + assert(bag.add_item(&"basic_fishing_rod", 1)) + assert(bag.add_item(&"coffee", 1)) + assert(bag.add_item(&"worms", 1)) + assert(layout.move_entry( + PlayerInventoryLayout.EntryKind.ITEM, + &"basic_fishing_rod", + PlayerInventoryLayout.InventoryContainer.INVENTORY, + 9, + )) + assert(hotbar.assign_item(0, &"coffee")) + menu.set("_bag", bag) + menu.set("_inventory", catches) + menu.set("_hotbar", hotbar) + menu.set("_inventory_layout", layout) + menu.set("_item_catalog", ItemCatalogResource) + var inventory_grid := menu.get("_general_inventory_grid") as GeneralInventoryGrid + inventory_grid.setup( + layout, + bag, + catches, + hotbar, + ItemCatalogResource, + PlayerInventoryLayout.InventoryContainer.INVENTORY, + ) + menu.visible = true + menu.call( + "_show_section_immediate", + PlayerMenuType.Section.BAG, + ) + menu.call("_set_content_interactive", true) + menu.call("_enter_inventory_tabs_zone") + for _frame: int in 2: + await process_frame + var inventory_tab := menu.get_node("%BagSubTab") as Button + var tackle_tab := menu.get_node("%TackleSubTab") as Button + _expect( + root.gui_get_focus_owner() == inventory_tab, + "Inventory tab zone did not begin on the unified Inventory tab.", + ) + _expect(inventory_tab.text == "Inventory", "Unified tab is not labelled Inventory.") + _expect( + not (menu.get_node("%CoolerSubTab") as Button).visible + and not (menu.get_node("%ItemsSubTab") as Button).visible, + "Legacy Cooler or Items tabs remain visible.", + ) + + var right := InputEventAction.new() + right.action = &"ui_right" + right.pressed = true + _expect( + bool(menu.call("_handle_controller_ownership_input", right)), + "Inventory tab zone did not consume controller Right.", + ) + await _wait_for_player_menu_page_transition(menu) + _expect( + menu.get("_current_section") == PlayerMenuType.Section.TACKLE_BOX, + "Controller Right did not switch from Inventory to Tackle.", + ) + _expect( + menu.get("_controller_ownership") + == PlayerMenuType.ControllerOwnership.INVENTORY_TABS, + "Changing Inventory tabs entered the item-content zone without A.", + ) + _expect( + root.gui_get_focus_owner() == tackle_tab, + "Changing Inventory tabs did not keep focus on the selected tab.", + ) + var down := InputEventAction.new() + down.action = &"ui_down" + down.pressed = true + _expect( + bool(menu.call("_handle_controller_ownership_input", down)), + "Inventory tab zone did not consume controller Down.", + ) + await process_frame + _expect( + root.gui_get_focus_owner() == tackle_tab, + "Controller Down escaped the Inventory tab zone before A.", + ) + var left := InputEventAction.new() + left.action = &"ui_left" + left.pressed = true + _expect( + bool(menu.call("_handle_controller_ownership_input", left)), + "Tackle-to-Inventory navigation did not consume controller Left.", + ) + _expect( + menu.get("_current_section") == PlayerMenuType.Section.BAG + or bool(menu.get("_page_transitioning")), + "Tackle-to-Inventory input did not start the Inventory transition.", + ) + await _wait_for_player_menu_page_transition(menu) + _expect( + root.gui_get_focus_owner() == inventory_tab, + "Returning to Inventory did not retain tab focus before A.", + ) + menu.call("_set_content_interactive", true) + menu.call("_configure_bag_item_focus") + var active_slots := inventory_grid.get_slots() + for slot: GeneralInventorySlot in active_slots: + _expect( + slot.focus_mode == Control.FOCUS_NONE, + "Inventory slots remained focusable while tabs owned the controller.", + ) + + var accept := InputEventJoypadButton.new() + accept.button_index = JOY_BUTTON_A + accept.pressed = true + _expect( + bool(menu.call("_handle_controller_ownership_input", accept)), + "Inventory tab zone did not consume controller A.", + ) + _expect( + menu.get("_controller_ownership") + == PlayerMenuType.ControllerOwnership.ITEM_LIST, + "Controller A did not explicitly enter Inventory contents.", + ) + for _frame: int in 2: + await process_frame + _expect( + menu.get("_current_section") == PlayerMenuType.Section.BAG, + "Entering Inventory contents changed section to %s." + % menu.get("_current_section"), + ) + var first_item := active_slots[0] as Control + var second_item := active_slots[1] as Control + for slot: GeneralInventorySlot in active_slots: + _expect( + slot.focus_mode == Control.FOCUS_ALL, + "Accepting Inventory did not enable its content focus zone.", + ) + _expect( + root.gui_get_focus_owner() == first_item, + "Entering Inventory did not focus its first slot.", + ) + _expect( + first_item.focus_neighbor_right == first_item.get_path_to(second_item), + "Inventory slots do not provide horizontal controller navigation.", + ) + Input.parse_input_event(right) + for _frame: int in 2: + await process_frame + _expect( + menu.get("_current_section") == PlayerMenuType.Section.BAG, + "Inventory slot navigation changed section to %s." + % menu.get("_current_section"), + ) + _expect( + root.gui_get_focus_owner() == second_item, + "Controller Right did not move between Inventory slots.", + ) + var right_release := InputEventAction.new() + right_release.action = &"ui_right" + right_release.pressed = false + Input.parse_input_event(right_release) + _expect( + bool(menu.call("consume_escape")), + "Global player-menu Back did not consume Inventory contents.", + ) + _expect( + menu.visible, + "Global player-menu Back closed Inventory from its content zone.", + ) + _expect( + menu.get("_controller_ownership") + == PlayerMenuType.ControllerOwnership.INVENTORY_TABS, + "Global player-menu Back did not return Inventory contents to tabs.", + ) + for _frame: int in 2: + await process_frame + _expect( + menu.get("_current_section") == PlayerMenuType.Section.BAG, + "Returning from Inventory contents changed section to %s." + % menu.get("_current_section"), + ) + _expect( + bool(menu.call("_handle_controller_ownership_input", accept)), + "Inventory tab zone did not re-enter Inventory contents.", + ) + for _frame: int in 2: + await process_frame + var notepad_source := active_slots[9] + notepad_source.grab_focus() + var context_press := InputEventJoypadButton.new() + context_press.button_index = JOY_BUTTON_Y + context_press.pressed = true + _expect( + bool(menu.call( + "_handle_controller_ownership_input", context_press + )), + "Controller Y did not open the selected Inventory notepad.", + ) + _expect( + menu.get("_controller_ownership") + == PlayerMenuType.ControllerOwnership.NOTEPAD_ACTIONS, + "Inventory notepad did not become the active controller zone.", + ) + _expect( + (menu.get_node("%BagDetailConstellation") as Control).visible, + "Inventory notepad remained hidden after controller Y.", + ) + _expect( + bool(menu.call("consume_escape")), + "Controller B did not close the Inventory notepad.", + ) + _expect( + not (menu.get_node("%BagDetailConstellation") as Control).visible + and menu.get("_controller_ownership") + == PlayerMenuType.ControllerOwnership.ITEM_LIST, + "Closing the Inventory notepad did not restore the item zone.", + ) + for _frame: int in 2: + await process_frame + var accept_release := InputEventJoypadButton.new() + accept_release.button_index = JOY_BUTTON_A + accept_release.pressed = false + notepad_source.grab_focus() + menu.call("_handle_controller_ownership_input", accept) + menu.call("_handle_controller_ownership_input", accept_release) + _expect( + str(menu.get("_inventory_move_identity")) == "basic_fishing_rod", + "Controller A did not pick up the focused Inventory item.", + ) + var move_target := active_slots[10] + move_target.grab_focus() + menu.call("_handle_controller_ownership_input", accept) + menu.call("_handle_controller_ownership_input", accept_release) + _expect( + layout.get_key_at( + PlayerInventoryLayout.InventoryContainer.INVENTORY, 10 + ) == PlayerInventoryLayout.item_key(&"basic_fishing_rod"), + "Controller A did not place the picked-up item in its target slot.", + ) + var management_requests: Array[int] = [0] + menu.controller_hotbar_management_requested.connect( + func(_initial_slot: int) -> void: + management_requests[0] += 1 + ) + menu.set( + "_controller_ownership", + PlayerMenuType.ControllerOwnership.ITEM_LIST, + ) + menu.call("_apply_inventory_controller_zone_focus_modes") + menu.call("_configure_bag_item_focus") + var hotbar_source := active_slots[10] + _expect( + menu.get("_current_section") == PlayerMenuType.Section.BAG, + "Hotbar navigation test left the unified Inventory section (%s)." + % menu.get("_current_section"), + ) + _expect( + hotbar_source.focus_mode == Control.FOCUS_ALL, + "Final active Inventory row was not controller-focusable.", + ) + hotbar_source.grab_focus() + _expect( + root.gui_get_focus_owner() == hotbar_source, + "Final Inventory row did not accept controller focus before Hotbar entry.", + ) + _expect( + bool(menu.call("_controller_focus_is_on_last_inventory_row")), + "Focused Inventory slot was not recognized as part of the final row.", + ) + _expect( + bool(menu.call("_handle_controller_ownership_input", down)), + "Down from the final Inventory row did not enter the hotbar zone.", + ) + _expect( + menu.get("_controller_ownership") + == PlayerMenuType.ControllerOwnership.HOTBAR_MANAGEMENT, + "Equipment-to-hotbar navigation did not transfer controller ownership.", + ) + _expect( + management_requests[0] == 1, + "Equipment-to-hotbar navigation did not open hotbar management.", + ) + var up := InputEventAction.new() + up.action = &"ui_up" + up.pressed = true + _expect( + bool(menu.call("_handle_controller_ownership_input", up)), + "Up from hotbar management was not consumed.", + ) + _expect( + menu.get("_controller_ownership") + == PlayerMenuType.ControllerOwnership.ITEM_LIST, + "Up from hotbar management did not return to Inventory contents.", + ) + for _frame: int in 2: + await process_frame + _expect( + root.gui_get_focus_owner() == hotbar_source, + "Up from hotbar management did not restore the source item focus.", + ) + _expect( + bool(menu.call("_handle_controller_ownership_input", down)), + "Inventory contents could not re-enter hotbar management.", + ) + _expect( + management_requests[0] == 2, + "Re-entering the hotbar did not reopen hotbar management.", + ) + _expect( + bool(menu.call("_handle_controller_ownership_input", accept)), + "Hotbar management did not consume controller A.", + ) + _expect( + hotbar.get_item_id(0).is_empty(), + "Controller A did not return the selected hotbar item to Inventory.", + ) + _expect(layout.is_item_in_inventory(&"coffee"), "Cleared hotbar item was lost.") + _expect( + bool(menu.call("consume_escape")), + "Global player-menu Back did not consume hotbar management.", + ) + _expect( + menu.visible, + "Global player-menu Back closed Inventory from hotbar management.", + ) + _expect( + menu.get("_controller_ownership") + == PlayerMenuType.ControllerOwnership.ITEM_LIST, + "Global player-menu Back did not return the hotbar to Inventory contents.", + ) + for _frame: int in 2: + await process_frame + + menu.call("_show_section_immediate", PlayerMenuType.Section.TACKLE_BOX) + menu.call("_set_content_interactive", true) + menu.set( + "_controller_ownership", + PlayerMenuType.ControllerOwnership.ITEM_LIST, + ) + menu.call("_apply_inventory_controller_zone_focus_modes") + menu.call("_configure_tackle_item_focus") + for _frame: int in 2: + await process_frame + var tackle_buttons: Dictionary = menu.get("_tackle_item_buttons") + var worms_button := tackle_buttons.get(&"worms") as Button + _expect(worms_button != null, "Tackle test could not find unlocked worms.") + if worms_button != null: + worms_button.grab_focus() + menu.call("_handle_controller_ownership_input", accept) + menu.call("_handle_controller_ownership_input", accept_release) + _expect( + StringName(menu.get("_selected_tackle_item_id")).is_empty(), + "Controller A still activates a bait or lure inventory action.", + ) + _expect( + not (menu.get_node("%TackleDetailPanel") as Control).visible, + "Controller A opened the tackle notepad reserved for Y.", + ) + _expect( + bool(menu.call( + "_handle_controller_ownership_input", context_press + )), + "Controller Y did not open the bait/lure equip notepad.", + ) + _expect( + menu.get("_controller_ownership") + == PlayerMenuType.ControllerOwnership.NOTEPAD_ACTIONS, + "Tackle notepad did not take controller ownership after Y.", + ) + _expect( + (menu.get_node("%TackleDetailPanel") as Control).visible, + "Controller Y left the bait/lure equip notepad hidden.", + ) + menu.queue_free() + inventory_state.queue_free() + await process_frame + + +func _wait_for_player_menu_page_transition(menu: Control) -> void: + var frames_waited: int = 0 + while bool(menu.get("_page_transitioning")) and frames_waited < 120: + await process_frame + frames_waited += 1 + # Same-section Equipment/Items changes do not tween, but they restore the + # active tab focus with a deferred call just like completed page changes. + for _frame: int in 2: + await process_frame + _expect( + not bool(menu.get("_page_transitioning")), + "Inventory page transition did not finish within 120 frames.", + ) + + func _validate_mapping_capture_contract() -> void: var title_source: String = FileAccess.get_file_as_string( "res://ui/title_screen.gd" @@ -430,13 +2032,8 @@ func _assert_directionally_reachable( var pending: Array[Control] = [start] while not pending.is_empty(): var current: Control = pending.pop_front() - for path: NodePath in [ - current.focus_neighbor_left, - current.focus_neighbor_right, - current.focus_neighbor_top, - current.focus_neighbor_bottom, - ]: - var neighbor := current.get_node_or_null(path) as Control + for side: Side in [SIDE_LEFT, SIDE_RIGHT, SIDE_TOP, SIDE_BOTTOM]: + var neighbor: Control = current.find_valid_focus_neighbor(side) if ( neighbor == null or not expected.has(neighbor.get_instance_id()) diff --git a/tests/controller_ui_navigation_validation.gd b/tests/controller_ui_navigation_validation.gd index 30871eb..24f39f9 100644 --- a/tests/controller_ui_navigation_validation.gd +++ b/tests/controller_ui_navigation_validation.gd @@ -6,6 +6,9 @@ const ControllerFocusNavigationType = preload( const UIReferencePresentationType = preload( "res://ui/ui_reference_presentation.gd" ) +const FullscreenMenuPresentationType = preload( + "res://ui/fullscreen_menu_presentation.gd" +) func _initialize() -> void: @@ -20,6 +23,7 @@ func _run() -> void: _validate_controller_hierarchy_contract() _validate_player_page_zone_contracts() _validate_shop_navigation_contract() + _validate_settings_navigation_contract() _validate_four_by_three_centering() _validate_low_end_profile_contract() print("Controller UI navigation validation: PASS") @@ -104,6 +108,12 @@ func _validate_controller_hierarchy_contract() -> void: assert(source.contains("active_tab.call_deferred(\"grab_focus\")")) assert(source.contains("CONTROLLER_PICKUP_HOLD_SECONDS")) assert(source.contains("_reserve_main_navigation_for_page_switching")) + assert(source.contains( + "if not _is_inventory_section(_current_section):\n\t\treturn" + )) + assert(source.contains( + "_dispatch_active_page_controller_input(cancel_event)" + )) assert(source.contains("configure_spatial_neighbors(candidates)")) @@ -145,7 +155,11 @@ func _validate_player_page_zone_contracts() -> void: var net_source: String = FileAccess.get_file_as_string( "res://ui/the_net_page.gd" ) - assert(net_source.contains("ROLE_RIGHT_STICK_Y")) + var game_ui_source: String = FileAccess.get_file_as_string( + "res://ui/game_ui.gd" + ) + assert(not net_source.contains("ROLE_RIGHT_STICK_Y")) + assert(game_ui_source.contains("_update_controller_menu_scroll")) func _validate_shop_navigation_contract() -> void: @@ -157,26 +171,128 @@ func _validate_shop_navigation_contract() -> void: assert(source.contains("_configure_controller_focus")) +func _validate_settings_navigation_contract() -> void: + var settings_scene := load("res://ui/settings_panel.tscn") as PackedScene + var settings := settings_scene.instantiate() as SettingsPanel + root.add_child(settings) + var accessibility_tab := settings.get_node( + "%AccessibilityTab" + ) as Button + var auto_click_toggle := settings.get_node("%AutoClickToggle") as Button + var interval_slider := settings.get_node( + "%AutoClickIntervalSlider" + ) as HSlider + var apply_button := settings.get_node("%ApplySettingsButton") as Button + var back_button := settings.get_node("%SettingsBackButton") as Button + assert( + accessibility_tab.get_node(accessibility_tab.focus_neighbor_bottom) + == auto_click_toggle + ) + assert( + auto_click_toggle.get_node(auto_click_toggle.focus_neighbor_bottom) + == interval_slider + ) + assert( + interval_slider.get_node(interval_slider.focus_neighbor_top) + == auto_click_toggle + ) + assert( + interval_slider.get_node(interval_slider.focus_neighbor_bottom) + == apply_button + ) + assert(apply_button.get_node(apply_button.focus_neighbor_right) == back_button) + var reset_scene := load( + "res://ui/pixelation_reset_overlay.tscn" + ) as PackedScene + var reset_overlay := reset_scene.instantiate() as PixelationResetOverlay + root.add_child(reset_overlay) + settings.show() + reset_overlay.set_settings_open(true) + var reset_focus_requested: Array[bool] = [false] + settings.crisp_reset_focus_requested.connect(func() -> void: + reset_focus_requested[0] = true + ) + settings.crisp_reset_focus_requested.connect( + reset_overlay.focus_reset_button + ) + var reset_cursor_presentation := reset_overlay.get_node( + "ControllerFocusPresentation" + ) as ControllerFocusPresentation + var controller_right := InputEventJoypadButton.new() + controller_right.button_index = JOY_BUTTON_DPAD_RIGHT + controller_right.pressed = true + reset_cursor_presentation._input(controller_right) + var focus_reset_event := InputEventAction.new() + focus_reset_event.action = &"ui_right" + focus_reset_event.pressed = true + settings.call("_on_back_button_gui_input", focus_reset_event) + assert(reset_focus_requested[0]) + assert( + root.gui_get_focus_owner() + == reset_overlay.get_node("%ResetPixelationButton") + ) + assert( + (reset_cursor_presentation.get("_focus_arrow") as TextureRect).visible + ) + reset_overlay.return_to_settings_requested.connect( + settings.focus_back_button + ) + var return_event := InputEventAction.new() + return_event.action = &"ui_left" + return_event.pressed = true + reset_overlay.call("_on_reset_button_gui_input", return_event) + assert(root.gui_get_focus_owner() == back_button) + reset_overlay.queue_free() + settings.queue_free() + + func _validate_four_by_three_centering() -> void: - var stage_position: Vector2 = ( - UIReferencePresentationType.get_stage_position(Vector2(640.0, 480.0)) + var display_size := Vector2(640.0, 480.0) + var stage_position: Vector2 = UIReferencePresentationType.get_stage_position( + display_size ) assert(stage_position.is_equal_approx(Vector2(0.0, 120.0))) + assert(FullscreenMenuPresentationType.uses_compact_profile(display_size)) + assert(is_equal_approx( + FullscreenMenuPresentationType.get_profile_scale(display_size), + 4.0 / 3.0, + )) + assert(FullscreenMenuPresentationType.get_profile_position( + display_size + ).is_equal_approx(Vector2(-640.0 / 3.0, -120.0))) + assert(FullscreenMenuPresentationType.get_source_rect(display_size) + == Rect2(160.0, 0.0, 960.0, 720.0)) func _validate_low_end_profile_contract() -> void: var launcher: String = FileAccess.get_file_as_string( - "res://scripts/portmaster/NETfishing.sh" + "res://scripts/portmaster/straywild.sh" ) - assert(launcher.contains("NETFISHING_PERFORMANCE_PROFILE:-")) + assert(launcher.contains("straywild_PERFORMANCE_PROFILE:-")) assert(launcher.contains("$CONFDIR/performance_profile")) assert(launcher.contains("normal)")) assert(launcher.contains("light|\"\")")) - assert(launcher.contains("NETFISHING_PERFORMANCE_PROFILE=normal")) - assert(launcher.contains("NETFISHING_PERFORMANCE_PROFILE=light")) - assert(launcher.contains("NETFISHING_LOW_END=1")) + assert(launcher.contains("straywild_PERFORMANCE_PROFILE=normal")) + assert(launcher.contains("straywild_PERFORMANCE_PROFILE=light")) + assert(launcher.contains("straywild_LOW_END=1")) assert(launcher.contains("--max-fps 30")) assert(launcher.contains("--audio-output-latency 40")) + var builder: String = FileAccess.get_file_as_string( + "res://scripts/build_portmaster.sh" + ) + assert(builder.contains("prepare_portmaster_assets.sh")) + assert(builder.contains("straywild-portmaster-export")) + var asset_profile: String = FileAccess.get_file_as_string( + "res://scripts/prepare_portmaster_assets.sh" + ) + assert(asset_profile.contains("GENERAL_TEXTURE_LIMIT=128")) + assert(asset_profile.contains("GAMEPLAY_TEXTURE_LIMIT=64")) + assert(asset_profile.contains("AUDIO_SAMPLE_RATE=22050")) + assert(asset_profile.contains("compress/mode=2")) + assert(asset_profile.contains("fish/species")) + assert(asset_profile.contains("art/exported/characters")) + assert(builder.contains("--exclude '/audio/ambience/'")) + assert(not builder.contains("--exclude '/audio/music/'")) func _make_button( diff --git a/tests/controller_world_interaction_validation.gd b/tests/controller_world_interaction_validation.gd new file mode 100644 index 0000000..3d684cb --- /dev/null +++ b/tests/controller_world_interaction_validation.gd @@ -0,0 +1,145 @@ +extends SceneTree + +const MainScene = preload("res://main/main.tscn") + +var _failures: Array[String] = [] + + +func _initialize() -> void: + _run.call_deferred() + + +func _run() -> void: + root.size = Vector2i(1280, 720) + var main := MainScene.instantiate() + root.add_child(main) + for _frame: int in 4: + await process_frame + if not bool(main.get("_application_initialized")): + main.call("_activate_selected_data_path", "", true) + for _frame: int in 8: + await process_frame + _expect( + bool(main.get("_application_initialized")), + "application initialization failed", + ) + var save_manager := main.get("_save_manager") as PlayerSaveManager + var world_layout: StringName = WorldLayout.GENERATED + var world_seed: int = PlayerSaveManager.DEFAULT_WORLD_SEED + _expect( + bool(main.call("_apply_world", world_layout, world_seed, true)), + "generated-world preparation failed", + ) + _expect( + bool(main.call("_prepare_host_world", world_layout, world_seed)), + "host-world preparation failed", + ) + _expect( + bool(main.call("_prepare_private_host")), + "private host preparation failed", + ) + _expect( + save_manager != null + and save_manager.initialize_new_game(world_seed, world_layout), + "new-game initialization failed", + ) + main.call("_enter_gameplay") + for _frame: int in 8: + await process_frame + + var player := main.get("_player") as Player + var interaction := main.get("_shop_interaction") as FishingShopInteraction + var game_ui := main.get("_game_ui") as GameUI + var chat_service := main.get_node( + "%NetworkChatService" + ) as NetworkChatService + _expect(player != null, "local player is unavailable") + _expect(interaction != null, "shop interaction is unavailable") + _expect(game_ui != null, "game UI is unavailable") + _expect(chat_service != null, "network chat service is unavailable") + if ( + player != null + and interaction != null + and game_ui != null + and chat_service != null + ): + player.global_position = interaction.global_position + for _frame: int in 6: + await physics_frame + _expect( + interaction.is_local_player_in_range(), + "local player did not enter the shop interaction range", + ) + var character_calls: Array[String] = [] + var capture_call := func( + _peer_id: int, + call_id: String, + _pitch_scale: float, + ) -> void: + character_calls.append(call_id) + chat_service.character_call_received.connect(capture_call) + var press := InputEventJoypadButton.new() + press.device = 0 + press.button_index = JOY_BUTTON_Y + press.pressed = true + _expect( + press.is_action_pressed("interact"), + "Y does not resolve to interact", + ) + _expect( + press.is_action_pressed("character_call"), + "Y does not resolve to character call", + ) + game_ui.call("_input", press) + main.call("_unhandled_input", press) + await process_frame + _expect( + game_ui.get_fishing_shop().visible, + "Y did not open the shop while the player was in range", + ) + _expect( + character_calls.is_empty(), + "Y played a character call instead of opening the shop", + ) + player.global_position = interaction.global_position + Vector3(20.0, 0.0, 0.0) + for _frame: int in 6: + await physics_frame + for _frame: int in 60: + if not game_ui.get_fishing_shop().visible: + break + await process_frame + _expect( + not interaction.is_local_player_in_range(), + "local player did not leave the shop interaction range", + ) + _expect( + not game_ui.get_fishing_shop().visible, + "shop did not close after leaving its interaction range", + ) + game_ui.call("_input", press) + await process_frame + _expect( + character_calls.size() == 1, + "Y did not play a character call away from an interaction", + ) + chat_service.character_call_received.disconnect(capture_call) + + var session := main.get_node("%NetworkSession") as NetworkSession + if session != null: + session.disconnect_session("Controller interaction validation complete.") + main.queue_free() + for _frame: int in 4: + await process_frame + await create_timer(0.1).timeout + if _failures.is_empty(): + print("Controller world interaction validation: PASS") + quit(0) + return + for failure: String in _failures: + push_error(failure) + quit(1) + + +func _expect(condition: bool, message: String) -> void: + if not condition: + _failures.append(message) diff --git a/tests/controller_world_interaction_validation.gd.uid b/tests/controller_world_interaction_validation.gd.uid new file mode 100644 index 0000000..8315ee5 --- /dev/null +++ b/tests/controller_world_interaction_validation.gd.uid @@ -0,0 +1 @@ +uid://b6fg46sad1ma6 diff --git a/tests/dedicated_server_config_validation.gd b/tests/dedicated_server_config_validation.gd index 6fef7c6..2125220 100644 --- a/tests/dedicated_server_config_validation.gd +++ b/tests/dedicated_server_config_validation.gd @@ -15,10 +15,16 @@ func _initialize() -> void: func _run() -> void: var defaults := ConfigType.new() - defaults.set("data_directory", "/tmp/netfishing-server") + defaults.set("data_directory", "/tmp/straywild-server") defaults.call("_validate") assert(defaults.is_valid()) assert(not bool(defaults.get("public_listing"))) + assert(not bool(defaults.get("chat_logging"))) + assert(str(defaults.get("chat_log_path")).is_empty()) + assert(NetworkChatService.BURST_COUNT == 3) + assert(NetworkChatService.WINDOW_COUNT == 5) + assert(is_equal_approx(NetworkChatService.WINDOW_SECONDS, 10.0)) + assert(NetworkChatService.CALL_COOLDOWN_MILLISECONDS == 90) var path: String = ProjectSettings.globalize_path( "user://dedicated-server-validation.cfg" @@ -28,9 +34,16 @@ func _run() -> void: file.set_value("server", "bind_address", "127.0.0.1") file.set_value("server", "port", 17777) file.set_value("server", "max_players", 12) + file.set_value("world", "seed", 928374) file.set_value("server", "public", true) file.set_value("server", "data_directory", "/tmp/configured-server") - file.set_value("discovery", "url", "https://discovery.netfishing.org/") + file.set_value("discovery", "url", "https://discovery.straywild.io/") + file.set_value("privacy", "chat_logging", true) + file.set_value( + "privacy", + "chat_log_path", + "/tmp/configured-server/logs/chat.jsonl", + ) file.set_value( "moderation", "operators", PackedStringArray([OPERATOR_B, OPERATOR_A]) ) @@ -44,8 +57,14 @@ func _run() -> void: assert(str(configured.get("bind_address")) == "127.0.0.1") assert(int(configured.get("port")) == 17777) assert(int(configured.get("max_players")) == 12) + assert(int(configured.get("world_seed")) == 928374) assert(bool(configured.get("public_listing"))) - assert(str(configured.get("discovery_url")) == "https://discovery.netfishing.org") + assert(str(configured.get("discovery_url")) == "https://discovery.straywild.io") + assert(bool(configured.get("chat_logging"))) + assert( + str(configured.get("chat_log_path")) + == "/tmp/configured-server/logs/chat.jsonl" + ) assert( configured.get("operator_fingerprints") == PackedStringArray([OPERATOR_A, OPERATOR_B]) @@ -81,6 +100,57 @@ func _run() -> void: invalid.call("_validate") assert(not invalid.is_valid()) + var invalid_seed := ConfigType.new() + invalid_seed.set("world_seed", 0) + invalid_seed.set("data_directory", "/tmp/invalid-seed-server") + invalid_seed.call("_validate") + assert(not invalid_seed.is_valid()) + + var default_chat_path := ConfigType.new() + default_chat_path.set("data_directory", "/tmp/default-chat-path-server") + default_chat_path.set("chat_logging", true) + default_chat_path.call("_validate") + assert(default_chat_path.is_valid()) + assert( + str(default_chat_path.get("chat_log_path")) + == "/tmp/default-chat-path-server/logs/chat.jsonl" + ) + + var invalid_chat_path := ConfigType.new() + invalid_chat_path.set("data_directory", "/tmp/invalid-chat-path-server") + invalid_chat_path.set("chat_logging", true) + invalid_chat_path.set("chat_log_path", "relative/chat.jsonl") + invalid_chat_path.call("_validate") + assert(not invalid_chat_path.is_valid()) + + var chat_log_validation_path: String = ProjectSettings.globalize_path( + "user://dedicated-chat-log-validation.jsonl" + ) + var chat_service := NetworkChatService.new() + assert(not chat_service.configure_dedicated_history( + true, + "relative/chat.jsonl", + )) + assert(chat_service.configure_dedicated_history( + true, + chat_log_validation_path, + )) + assert(FileAccess.file_exists(chat_log_validation_path)) + chat_service.call("_append_chat_log", { + "sender_display_name": "Privacy Tester", + "body": "explicitly retained message", + }) + var logged_message: Variant = JSON.parse_string( + FileAccess.get_file_as_string(chat_log_validation_path).strip_edges() + ) + assert(typeof(logged_message) == TYPE_DICTIONARY) + assert(str(logged_message.get("recorded_at_utc", "")).ends_with("Z")) + assert(logged_message.get("sender_display_name") == "Privacy Tester") + assert(logged_message.get("body") == "explicitly retained message") + assert(chat_service.configure_dedicated_history(false, "")) + assert(DirAccess.remove_absolute(chat_log_validation_path) == OK) + chat_service.free() + var discovery := DiscoveryClient.new() assert( str(discovery.call("_default_room_name", "River")) diff --git a/tests/digging_prototype_validation.gd b/tests/digging_prototype_validation.gd new file mode 100644 index 0000000..95917a0 --- /dev/null +++ b/tests/digging_prototype_validation.gd @@ -0,0 +1,161 @@ +extends SceneTree + +const StarterIslandScene = preload( + "res://world/regions/starter_island_region.tscn" +) +const ShovelAttachmentScene = preload("res://player/shovel_attachment.tscn") +const ItemCatalogResource: ItemCatalog = preload( + "res://items/catalog/item_catalog.tres" +) +const Gatherables: GatherableCatalog = preload( + "res://gathering/catalog/gatherable_catalog.tres" +) + +class PrimaryTerrainProvider: + extends Node3D + + var primary_meshes: Array[MeshInstance3D] = [] + + + func get_primary_terrain_meshes() -> Array[MeshInstance3D]: + return primary_meshes + + +func _initialize() -> void: + call_deferred("_run") + + +func _run() -> void: + _validate_catalog_content() + _validate_flat_shovel() + await _validate_beach_authoring() + _validate_primary_terrain_provider() + print("Digging prototype validation: PASS") + quit() + + +func _validate_catalog_content() -> void: + var shovel: ItemData = ItemCatalogResource.get_available_item_by_id( + &"standard_shovel" + ) + assert(shovel != null) + assert(shovel.category == ItemData.Category.TOOL) + assert(shovel.equippable and shovel.hotbar_allowed) + var clam: GatherableData = Gatherables.get_entry(&"clam_manila") + assert(clam != null and clam.is_available()) + assert(clam.required_tool_id == shovel.item_id) + assert(clam.diggable_area_id == &"starter_beach") + assert(clam.presentation_mode == GatherableData.PresentationMode.WATER_SPURT) + assert(not clam.requires_sneaking) + assert(is_equal_approx(clam.active_lifetime_seconds, 10.0)) + + +func _validate_flat_shovel() -> void: + var attachment := ShovelAttachmentScene.instantiate() as BoneAttachment3D + assert(attachment != null) + var shovel := attachment.get_node("Shovel") as Node3D + assert(shovel != null) + var meshes: Array[MeshInstance3D] = [] + _collect_meshes(shovel, meshes) + assert(meshes.size() == 5) + for mesh_instance: MeshInstance3D in meshes: + assert( + mesh_instance.cast_shadow + == GeometryInstance3D.SHADOW_CASTING_SETTING_OFF + ) + var material := mesh_instance.mesh.surface_get_material(0) as StandardMaterial3D + assert(material != null) + assert(material.shading_mode == BaseMaterial3D.SHADING_MODE_UNSHADED) + assert(material.transparency == BaseMaterial3D.TRANSPARENCY_DISABLED) + assert(material.albedo_texture == null) + assert(is_equal_approx(material.albedo_color.a, 1.0)) + attachment.free() + + +func _validate_beach_authoring() -> void: + var region := StarterIslandScene.instantiate() as WorldRegion + root.add_child(region) + await process_frame + var area: DiggableArea3D = region.get_diggable_area(&"starter_beach") + assert(area != null) + assert(area.terrain_source == NodePath("../../Terrain/Visual")) + assert(area.surface_materials.size() == 1) + assert(area.surface_materials[0] == &"sand") + var triangles: Array[PackedVector3Array] = area.get_surface_triangles() + assert(not triangles.is_empty()) + for triangle: PackedVector3Array in triangles: + assert(triangle.size() == 3) + var center := (triangle[0] + triangle[1] + triangle[2]) / 3.0 + assert(area.generation_bounds.has_point(Vector2(center.x, center.z))) + assert(center.y <= area.maximum_global_y + 0.001) + region.queue_free() + + +func _validate_primary_terrain_provider() -> void: + var fixture := Node3D.new() + fixture.name = "PrimaryTerrainFixture" + root.add_child(fixture) + var provider := PrimaryTerrainProvider.new() + provider.name = "Provider" + fixture.add_child(provider) + var clear_sand := _flat_surface_triangle(0.0, 0.0, &"sand") + var covered_sand := _flat_surface_triangle(10.0, 0.0, &"sand") + var covering_grass := _flat_surface_triangle(10.0, 0.01, &"grass_lite") + for mesh_instance: MeshInstance3D in [ + clear_sand, + covered_sand, + covering_grass, + ]: + provider.add_child(mesh_instance) + provider.primary_meshes.append(mesh_instance) + var buried_base := _flat_surface_triangle(20.0, 0.0, &"sand") + buried_base.name = "BuriedSandBase" + provider.add_child(buried_base) + var area := DiggableArea3D.new() + area.name = "DiggableArea" + area.area_id = &"provider_test" + area.terrain_source = NodePath("../Provider") + area.surface_materials = [&"sand"] + area.generation_bounds = Rect2(-20.0, -20.0, 40.0, 40.0) + fixture.add_child(area) + var triangles := area.get_surface_triangles() + assert(triangles.size() == 2) + var clear_center := Vector3(1.0 / 3.0, 0.0, 1.0 / 3.0) + var covered_center := Vector3(10.0 + 1.0 / 3.0, 0.0, 1.0 / 3.0) + assert(area.is_surface_point_valid(clear_center)) + assert(not area.is_surface_point_valid(covered_center)) + fixture.free() + + +func _flat_surface_triangle( + x_offset: float, + height: float, + material_name: StringName, +) -> MeshInstance3D: + var arrays: Array = [] + arrays.resize(Mesh.ARRAY_MAX) + arrays[Mesh.ARRAY_VERTEX] = PackedVector3Array([ + Vector3(x_offset, height, 0.0), + Vector3(x_offset, height, 1.0), + Vector3(x_offset + 1.0, height, 0.0), + ]) + arrays[Mesh.ARRAY_INDEX] = PackedInt32Array([0, 1, 2]) + var mesh := ArrayMesh.new() + mesh.add_surface_from_arrays(Mesh.PRIMITIVE_TRIANGLES, arrays) + var material := StandardMaterial3D.new() + material.resource_name = str(material_name) + mesh.surface_set_material(0, material) + var mesh_instance := MeshInstance3D.new() + mesh_instance.name = "Primary%s" % str(material_name).capitalize() + mesh_instance.mesh = mesh + return mesh_instance + + +func _collect_meshes( + root_node: Node, + result: Array[MeshInstance3D], +) -> void: + for child: Node in root_node.get_children(): + if child is MeshInstance3D: + result.append(child as MeshInstance3D) + _collect_meshes(child, result) diff --git a/tests/digging_prototype_validation.gd.uid b/tests/digging_prototype_validation.gd.uid new file mode 100644 index 0000000..182ab02 --- /dev/null +++ b/tests/digging_prototype_validation.gd.uid @@ -0,0 +1 @@ +uid://c1dt44ieacnvb diff --git a/tests/economy_regression_validation.gd b/tests/economy_regression_validation.gd index debe48c..ff82495 100644 --- a/tests/economy_regression_validation.gd +++ b/tests/economy_regression_validation.gd @@ -31,9 +31,14 @@ func _run() -> void: for _frame: int in 8: await process_frame assert(bool(main.get("_application_initialized"))) + var session := main.get_node("%NetworkSession") as NetworkSession + assert(bool(main.call( + "_apply_world", WorldLayout.STARTER_ISLAND, 1, true + ))) + assert(session.set_host_world(WorldLayout.STARTER_ISLAND, 1)) assert(bool(main.call("_prepare_private_host"))) var save_manager := main.get("_save_manager") as PlayerSaveManager - assert(save_manager.initialize_new_game()) + assert(save_manager.initialize_new_game(1, WorldLayout.STARTER_ISLAND)) main.call("_enter_gameplay") for _frame: int in 8: await process_frame @@ -42,14 +47,13 @@ func _run() -> void: var catalog := main.get("fish_catalog") as FishPool var sale_service := main.get_node("%NetworkSaleService") as NetworkSaleService var shop_service := main.get_node("%NetworkShopService") as NetworkShopService - var session := main.get_node("%NetworkSession") as NetworkSession var reservations := ( main.get_node("%PlayerAssetReservationService") as PlayerAssetReservationService ) assert(player != null) - assert(catalog != null and catalog.candidates.size() == 314) - assert(LogbookCatalog.ordered_species(catalog.candidates).size() == 54) + assert(catalog != null and catalog.candidates.size() == 316) + assert(LogbookCatalog.ordered_species(catalog.candidates).size() == 313) assert(sale_service != null) assert(shop_service != null) assert(session != null and session.is_host()) @@ -62,7 +66,6 @@ func _run() -> void: _test_multi_sale(player, catalog, sale_service) _test_reservations(player, catalog, sale_service, reservations) _test_anywhere_sale(player, catalog, sale_service) - await _test_player_menu_sale(main, player, catalog, sale_service) await _test_host_shop_sale(main, player, catalog, sale_service) assert(session.set_host_open(true)) @@ -78,6 +81,8 @@ func _run() -> void: await _test_fishing_shop_sale_ui( main, player, catalog, sale_service, reservations ) + _test_host_backpack_purchase(player, shop_service) + _test_host_storage_purchase(player, shop_service) assert(not sale_service.is_local_sale_pending()) assert(not shop_service.is_local_purchase_pending()) @@ -93,11 +98,15 @@ func _run() -> void: func _run_multiplayer_host() -> void: root.size = Vector2i(1280, 720) var main: Node = await _create_initialized_main() + var session := main.get_node("%NetworkSession") as NetworkSession + assert(bool(main.call( + "_apply_world", WorldLayout.STARTER_ISLAND, 1, true + ))) + assert(session.set_host_world(WorldLayout.STARTER_ISLAND, 1)) assert(bool(main.call("_prepare_private_host"))) var save_manager := main.get("_save_manager") as PlayerSaveManager assert(save_manager.initialize_new_game()) main.call("_enter_gameplay") - var session := main.get_node("%NetworkSession") as NetworkSession assert(session.set_host_open(true)) var client_connected := false # Loading the full client world can take longer on a cold import. Keep the @@ -125,7 +134,10 @@ func _run_multiplayer_host() -> void: var interaction := main.get("_shop_interaction") as FishingShopInteraction assert(interaction != null) remote_avatar.global_position = interaction.global_position - var completion_deadline: int = Time.get_ticks_msec() + 30000 + # The client can finish loading its local presentation well after the host + # has authenticated it, especially during a cold import. Keep the authority + # alive until the client completes the transaction sequence or disconnects. + var completion_deadline: int = Time.get_ticks_msec() + 90000 while Time.get_ticks_msec() < completion_deadline: await process_frame if session.get_authenticated_peer_ids().size() < 2: @@ -160,13 +172,22 @@ func _run_multiplayer_client() -> void: var shop_service := main.get_node("%NetworkShopService") as NetworkShopService sale_service.local_sale_finished.connect(_on_sale_finished) shop_service.local_purchase_finished.connect(_on_shop_finished) + assert(player.inventory_layout.restore_backpack_level( + PlayerInventoryLayout.MAX_BACKPACK_LEVEL + )) + assert(player.cooler_capacity.restore_level(PlayerCoolerCapacity.MAX_LEVEL)) + player.inventory.set_inventory_layout(null) var catch_ids: Array[StringName] = [] for fish: FishData in catalog.candidates: if not fish.active: continue var fish_catch := _make_catch(fish) - player.inventory.add_catch(fish_catch) + assert(player.inventory.add_catch(fish_catch)) catch_ids.append(fish_catch.catch_id) + if catch_ids.size() == NetworkSaleProtocol.MAX_CATCHES_PER_REQUEST: + break + assert(catch_ids.size() == NetworkSaleProtocol.MAX_CATCHES_PER_REQUEST) + player.inventory.set_inventory_layout(player.inventory_layout) await create_timer(1.0).timeout _sale_result.clear() assert(not sale_service.request_local_sale(catch_ids).is_empty()) @@ -180,6 +201,8 @@ func _run_multiplayer_client() -> void: for catch_id: StringName in catch_ids: assert(not player.inventory.contains_catch_id(catch_id)) assert(not sale_service.is_local_sale_pending()) + assert(player.inventory_layout.restore_backpack_level(0)) + assert(player.cooler_capacity.restore_level(0)) var interaction := main.get("_shop_interaction") as FishingShopInteraction player.global_position = interaction.global_position @@ -217,6 +240,17 @@ func _run_multiplayer_client() -> void: print("Client shop result: ", _shop_result) assert(not _shop_result.is_empty() and bool(_shop_result[1])) assert(not shop_service.is_local_purchase_pending()) + var backpack_cost := player.inventory_layout.get_next_backpack_cost() + if player.wallet.get_balance() < backpack_cost: + assert(player.wallet.credit( + backpack_cost - player.wallet.get_balance() + )) + _shop_result.clear() + assert(not shop_service.request_backpack_capacity_upgrade().is_empty()) + while _shop_result.is_empty(): + await process_frame + assert(bool(_shop_result[1])) + assert(player.inventory_layout.get_inventory_capacity() == 18) var required_art_balance: int = ( ArtShopStock.ART_KIT_PRICE + ArtShopStock.UPGRADE_PRICE ) @@ -377,81 +411,39 @@ func _test_host_shop_sale( ) var species_ids: Array[StringName] = [] var expected_payout: int = 0 + var species_balance_before: int = player.wallet.get_balance() for fish: FishData in catalog.candidates: if not fish.active: continue var fish_catch := _make_catch(fish) - player.inventory.add_catch(fish_catch) + assert(player.inventory.add_catch(fish_catch)) species_ids.append(fish_catch.catch_id) expected_payout += fish_catch.sale_value - var species_balance_before: int = player.wallet.get_balance() - _assert_sale( - player, - sale_service, - species_ids, - true, - true, - NetworkSaleService.MAIN_SHOP_BUYER_ID, - ) + if species_ids.size() >= 5: + _assert_sale( + player, + sale_service, + species_ids, + true, + true, + NetworkSaleService.MAIN_SHOP_BUYER_ID, + ) + species_ids.clear() + if not species_ids.is_empty(): + _assert_sale( + player, + sale_service, + species_ids, + true, + true, + NetworkSaleService.MAIN_SHOP_BUYER_ID, + ) assert( player.wallet.get_balance() == species_balance_before + expected_payout ) -func _test_player_menu_sale( - main: Node, - player: Player, - catalog: FishPool, - sale_service: NetworkSaleService, -) -> void: - var game_ui := main.get_node("%GameUI") as GameUI - var player_menu := game_ui.get_node("%PlayerMenu") as PlayerMenu - var fish_catch := _make_catch(catalog.candidates[6]) - player.inventory.add_catch(fish_catch) - player.global_position = Vector3(0.0, 3.95, 13.0) - player_menu.open_menu() - await create_timer(2.2).timeout - player_menu.call("_on_catch_card_pressed", fish_catch.catch_id) - await process_frame - var sell_action := player_menu.get_node("%SellBubble") as Button - var confirmation := player_menu.get_node("%SaleConfirmation") as Control - var confirm_button := player_menu.get_node("%ConfirmSaleButton") as Button - var ui_viewport := main.get_node( - "UIPresentation/UIViewport" - ) as SubViewport - assert(sell_action.visible and not sell_action.disabled) - assert(sell_action.mouse_filter == Control.MOUSE_FILTER_STOP) - assert(sell_action.focus_mode == Control.FOCUS_ALL) - assert(ui_viewport != null) - await _activate_pointer_control(sell_action, ui_viewport) - await process_frame - assert(confirmation.visible) - assert(confirm_button.visible and not confirm_button.disabled) - assert( - confirmation.z_index - > (player_menu.get_node("%CoolerOuterWall") as Control).z_index - ) - _sale_result.clear() - await _activate_pointer_control(confirm_button, ui_viewport) - await process_frame - assert(not _sale_result.is_empty() and bool(_sale_result[1])) - assert(not player.inventory.contains_catch_id(fish_catch.catch_id)) - assert(not sale_service.is_local_sale_pending()) - player_menu.close_menu() - await create_timer(2.2).timeout - assert(not player_menu.visible) - player_menu.open_menu() - await create_timer(2.2).timeout - assert(player_menu.visible) - assert( - not sell_action.disabled - or player.inventory.get_all_catches().is_empty() - ) - player_menu.close_menu() - await create_timer(2.2).timeout - - func _activate_pointer_control( control: Control, ui_viewport: SubViewport, @@ -509,7 +501,7 @@ func _test_host_art_shop_purchase( for _frame: int in 4: await physics_frame var required_balance: int = ( - ArtShopStock.ART_KIT_PRICE + ArtShopStock.UPGRADE_PRICE * 3 + ArtShopStock.ART_KIT_PRICE + ArtShopStock.UPGRADE_PRICE * 4 ) if player.wallet.get_balance() < required_balance: assert(player.wallet.credit(required_balance - player.wallet.get_balance())) @@ -527,7 +519,10 @@ func _test_host_art_shop_purchase( assert(art_item.icon.resource_path.ends_with("/art/art_kit.png")) assert(player.hotbar.assign_item(0, ArtShopStock.ART_KIT_ITEM_ID)) for product_id: StringName in [ - &"marker_ocean_teal", &"brush_2x", &"grid_32x", + &"marker_ocean_teal", + &"brush_2x", + &"grid_32x", + PlayerArtUnlocks.STAMP_PRODUCT_ID, ]: _shop_result.clear() assert(not shop_service.request_art_upgrade(product_id).is_empty()) @@ -548,6 +543,54 @@ func _test_host_rod_purchase( assert(not shop_service.is_local_purchase_pending()) +func _test_host_backpack_purchase( + player: Player, + shop_service: NetworkShopService, +) -> void: + var layout := player.inventory_layout + assert(layout.get_inventory_capacity() == 9) + var total_cost: int = 0 + for cost: int in PlayerInventoryLayout.BACKPACK_EXPANSION_COSTS: + total_cost += cost + if player.wallet.get_balance() < total_cost: + assert(player.wallet.credit(total_cost - player.wallet.get_balance())) + var balance_before := player.wallet.get_balance() + for expected_capacity: int in [18, 27, 36]: + _shop_result.clear() + assert(not shop_service.request_backpack_capacity_upgrade().is_empty()) + assert( + not _shop_result.is_empty() and bool(_shop_result[1]), + "Backpack purchase failed: %s" % [_shop_result], + ) + assert(layout.get_inventory_capacity() == expected_capacity) + assert(player.wallet.get_balance() == balance_before - total_cost) + assert(layout.get_next_backpack_cost() == -1) + + +func _test_host_storage_purchase( + player: Player, + shop_service: NetworkShopService, +) -> void: + var capacity := player.cooler_capacity + assert(capacity.get_capacity() == 9) + var total_cost: int = 0 + for cost: int in PlayerCoolerCapacity.EXPANSION_COSTS: + total_cost += cost + if player.wallet.get_balance() < total_cost: + assert(player.wallet.credit(total_cost - player.wallet.get_balance())) + var balance_before := player.wallet.get_balance() + for expected_capacity: int in [18, 27, 36, 45, 54, 63, 72]: + _shop_result.clear() + assert(not shop_service.request_cooler_capacity_upgrade().is_empty()) + assert( + not _shop_result.is_empty() and bool(_shop_result[1]), + "Cooler purchase failed: %s" % [_shop_result], + ) + assert(capacity.get_capacity() == expected_capacity) + assert(player.wallet.get_balance() == balance_before - total_cost) + assert(capacity.get_next_cost() == -1) + + func _test_fishing_shop_sale_ui( main: Node, player: Player, @@ -609,7 +652,11 @@ func _test_fishing_shop_sale_ui( "QuantityBadge/Quantity" ) as Label assert(tackle_quantity.text == expected_bait_supply) - assert(tackle_bait_button.tooltip_text.contains(expected_bait_supply)) + assert( + str(tackle_bait_button.get_meta( + &"inventory_context_text", "" + )).contains(expected_bait_supply) + ) var tackle_badge := tackle_quantity.get_parent() as Panel assert( is_equal_approx( @@ -632,7 +679,8 @@ func _test_fishing_shop_sale_ui( })) var balance_before: int = player.wallet.get_balance() assert(shop.open_shop()) - await process_frame + for _frame: int in 2: + await process_frame assert(shop_backdrop.visible) assert(shop_backdrop.material is ShaderMaterial) assert(shop.has_node("InputBlocker") and not shop.has_node("Dimmer")) @@ -654,7 +702,10 @@ func _test_fishing_shop_sale_ui( assert((shop.get_node("%Upgrades") as Control).visible) assert(not (shop.get_node("%Supplies") as Control).visible) for upgrade_name: String in [ - "ReelPurchase", "BarrierPurchase", "CoolerPurchase" + "ReelPurchase", + "BarrierPurchase", + "CoolerPurchase", + "BackpackPurchase", ]: var upgrade_button := shop.get_node("%%%s" % upgrade_name) as Button assert(upgrade_button != null) @@ -662,6 +713,15 @@ func _test_fishing_shop_sale_ui( assert(upgrade_button.text.is_empty()) assert(upgrade_button.icon != null) assert(upgrade_button.tooltip_text.contains("level")) + for placeholder_name: String in ["CoolerPurchase", "BackpackPurchase"]: + var placeholder_button := shop.get_node( + "%%%s" % placeholder_name + ) as Button + assert( + placeholder_button.icon.resource_path.ends_with( + "/pictograms/x_light.png" + ) + ) assert(not shop.has_node("%ReelLevel")) assert(not shop.has_node("%BarrierEffect")) assert(not shop.has_node("%CoolerLevel")) @@ -674,7 +734,9 @@ func _test_fishing_shop_sale_ui( "/shop/32_currency.png" ) ) - for cost_name: String in ["ReelCost", "BarrierCost", "CoolerCost"]: + for cost_name: String in [ + "ReelCost", "BarrierCost", "CoolerCost", "BackpackCost" + ]: var cost_display := shop.get_node("%%%s" % cost_name) as CurrencyAmount assert(cost_display != null) var cost_icon := cost_display.get_node("Icon") as TextureRect @@ -690,7 +752,7 @@ func _test_fishing_shop_sale_ui( var art_supplies_tab := shop_tabs[4] as Button assert(art_supplies_tab != null and art_supplies_tab.text == "Art Supplies") var sell_mode := shop_tabs[5] as Button - assert(sell_mode != null and sell_mode.text == "Sell Fish") + assert(sell_mode != null and sell_mode.text == "Sell") var equipment_tab := shop_tabs[3] as Button assert(equipment_tab != null and equipment_tab.text == "Equipment") var supplies_list := shop.get_node("%SuppliesList") as VBoxContainer @@ -767,15 +829,15 @@ func _test_fishing_shop_sale_ui( assert(bait_receipt.contains(" spent on ")) assert(bait_receipt.ends_with(" worms")) assert(snails_button.get_node_or_null("SupplyQuantityBadge") == null) - assert(worms_button.get_node_or_null("UnlockStateIcon") == null) + assert(worms_button.get_node_or_null("UnlockStateBadge") == null) var snails_lock_icon := snails_button.get_node( - "UnlockStateIcon" + "UnlockStateBadge/UnlockStateIcon" ) as TextureRect assert(not bool(snails_lock_icon.get_meta(&"unlocked"))) assert(snails_lock_icon.texture.resource_path.ends_with( "/lock_light.png" )) - assert(is_equal_approx(snails_lock_icon.modulate.a, 0.75)) + assert(is_equal_approx(snails_lock_icon.modulate.a, 0.88)) await _activate_pointer_control(equipment_tab, ui_viewport) await process_frame var equipment_sections: Array[String] = [] @@ -797,7 +859,7 @@ func _test_fishing_shop_sale_ui( assert(basic_rod_button != null) assert(basic_rod_button.custom_minimum_size == Vector2(144.0, 144.0)) assert(basic_rod_button.icon != null and basic_rod_button.disabled) - assert(basic_rod_button.get_node_or_null("UnlockStateIcon") == null) + assert(basic_rod_button.get_node_or_null("UnlockStateBadge") == null) assert(rod_cards.find_child("Rod_aurora_rod", true, false) == null) await _activate_pointer_control(art_supplies_tab, ui_viewport) await process_frame @@ -805,7 +867,9 @@ func _test_fishing_shop_sale_ui( for child: Node in shop.get_node("%SuppliesList").get_children(): if child is Label: stock_sections.append((child as Label).text) - assert(stock_sections == ["art kit", "markers", "brushes", "grids"]) + assert(stock_sections == [ + "art kit", "markers", "brushes", "grids", "stamps", + ]) var marker_icons := shop.find_children( "MarkerIcon", "TextureRect", true, false ) @@ -847,8 +911,13 @@ func _test_fishing_shop_sale_ui( var product_unlocked: bool = ( player.art_unlocks.owns_product(product_id) ) - var state_icon := upgrade_button.get_node_or_null( - "UnlockStateIcon" + var state_badge := upgrade_button.get_node_or_null( + "UnlockStateBadge" + ) as Panel + var state_icon := ( + state_badge.get_node("UnlockStateIcon") as TextureRect + if state_badge != null + else null ) as TextureRect assert((state_icon == null) == product_unlocked) if state_icon != null: @@ -859,6 +928,17 @@ func _test_fishing_shop_sale_ui( ) ) assert(found_art_upgrade_icons == expected_art_upgrade_icons.size()) + var stamp_button: Button + for upgrade_node: Node in shop.find_children("*", "Button", true, false): + var upgrade_button := upgrade_node as Button + if StringName(str(upgrade_button.get_meta(&"art_product_id", ""))) == ( + PlayerArtUnlocks.STAMP_PRODUCT_ID + ): + stamp_button = upgrade_button + break + assert(stamp_button != null) + assert(stamp_button.text == "stamp") + assert(stamp_button.icon == null) var price_bubbles := shop.find_children( "PriceBubble", "PanelContainer", true, false ) @@ -881,55 +961,69 @@ func _test_fishing_shop_sale_ui( assert((shop.get_node("%ShopPanel") as Control).visible) assert(not (shop.get_node("ShopPanel/Margin/Layout/Body") as Control).visible) assert(not (shop.get_node("%Feedback") as Control).visible) - var mounted_cooler := player_menu.get("_cooler_page") as Control - assert(mounted_cooler != null and mounted_cooler.visible) + var sell_inventory := shop.get("_sell_inventory") as ShopSellInventory + assert(sell_inventory != null and sell_inventory.visible) + var sell_tray_grid := sell_inventory.get("_tray_grid") as GridContainer assert( - mounted_cooler.get_parent() == shop.get_node("%ShopCoolerMount") + sell_tray_grid.columns == PlayerInventoryLayout.INVENTORY_COLUMNS ) - var cooler_outer_wall := player_menu.get("_cooler_outer_wall") as Control - var water_surface := player_menu.get("_cooler_water_surface") as ColorRect - assert(cooler_outer_wall != null and cooler_outer_wall.visible) - assert(water_surface.visible and water_surface.material is ShaderMaterial) - var cooler_sort_option := player_menu.get("_cooler_sort_option") as Control - await _activate_pointer_control(cooler_sort_option, ui_viewport) - var cooler_choice_panel := cooler_sort_option.get("_choice_panel") as Control - assert(cooler_choice_panel.visible) - cooler_sort_option.call("close_choices") assert( - StringName( - (player_menu.get("_sale_buyer_override") as FishBuyerProfile).id - ) == NetworkSaleService.MAIN_SHOP_BUYER_ID + sell_tray_grid.get_theme_constant("h_separation") + == GeneralInventoryGrid.DEFAULT_SLOT_SEPARATION ) - var fish_nodes: Dictionary = player_menu.get("_fish_nodes") - var fish_button := fish_nodes.get(fish_catch.catch_id) as Button - var reserved_button := fish_nodes.get(reserved_catch.catch_id) as Button - assert(fish_button != null and fish_button.visible) - assert(reserved_button != null and reserved_button.visible) - await _activate_pointer_control(fish_button, ui_viewport) - var sell_button := player_menu.get("_sell_bubble") as Button - assert(sell_button.visible and not sell_button.disabled) - await _activate_pointer_control(sell_button, ui_viewport) - await process_frame - var confirmation := player_menu.get("_sale_confirmation") as Control - var confirm_button := player_menu.get("_confirm_sale_button") as Button - assert(confirmation.visible) assert( - confirmation.z_index - > cooler_outer_wall.z_index + sell_inventory.get_parent() == shop.get_node("%ShopCoolerMount") ) + var staged: Dictionary = sell_inventory.get("_staged") + sell_inventory.call( + "_stage", + PlayerInventoryLayout.EntryKind.CATCH, + reserved_catch.catch_id, + ) + assert(staged.is_empty()) + var sell_button := sell_inventory.get("_sell_button") as Button + var all_button := sell_inventory.get("_all_button") as Button + assert(sell_button != null and sell_button.text == "sell") + assert(all_button != null and all_button.text == "all") + assert(sell_button.get_parent() == all_button.get_parent()) + assert( + sell_button.size_flags_horizontal == Control.SIZE_EXPAND_FILL + and all_button.size_flags_horizontal == Control.SIZE_EXPAND_FILL + ) + sell_inventory.call("_stage_all_eligible") + assert(staged.has(PlayerInventoryLayout.catch_key(fish_catch.catch_id))) + assert(not staged.has( + PlayerInventoryLayout.catch_key(reserved_catch.catch_id) + )) + assert(all_button.disabled) + assert((sell_inventory.get("_feedback") as Label).text.is_empty()) + var source_grid := sell_inventory.get("_inventory_grid") as GeneralInventoryGrid + var staged_source_found := false + for source_slot: GeneralInventorySlot in source_grid.get_slots(): + if source_slot.entry_identity == fish_catch.catch_id: + staged_source_found = bool(source_slot.get("_staged")) + break + assert(staged_source_found) + var expected_all_payout := int(sell_inventory.call("_calculate_total")) + assert(expected_all_payout >= fish_catch.sale_value) + var feedback := sell_inventory.get("_feedback") as Label + var total_label := sell_inventory.get("_total_label") as Label + var sale_buttons := sell_button.get_parent() as HBoxContainer + assert(feedback.get_index() < total_label.get_parent().get_index()) + assert(total_label.get_parent().get_index() < sale_buttons.get_index()) _sale_result.clear() - await _activate_pointer_control(confirm_button, ui_viewport) + sell_inventory.call("_submit_sale") await process_frame assert(not _sale_result.is_empty() and bool(_sale_result[1])) assert(not player.inventory.contains_catch_id(fish_catch.catch_id)) - assert(player.wallet.get_balance() == balance_before + fish_catch.sale_value) + assert(player.wallet.get_balance() == balance_before + expected_all_payout) assert(not sale_service.is_local_sale_pending()) assert(reservations.release(reservation_id)) await _activate_pointer_control(shop_tabs[0] as Button, ui_viewport) await process_frame assert(shop.visible and (shop.get_node("%ShopPanel") as Control).visible) assert(not (shop.get_node("%ShopCoolerPage") as Control).visible) - assert(not player_menu.is_shop_cooler_mounted()) + assert(not sell_inventory.is_visible_in_tree()) shop.close_shop() await shop.menu_visibility_changed assert(not shop.visible) diff --git a/tests/equipment_catalog_validation.gd b/tests/equipment_catalog_validation.gd index 498c2ba..bc549aa 100644 --- a/tests/equipment_catalog_validation.gd +++ b/tests/equipment_catalog_validation.gd @@ -20,20 +20,25 @@ func _initialize() -> void: shop.call( "_add_unlock_state_icon", locked_button, false, Vector2(72.0, 72.0) ) - var locked_icon := locked_button.get_node( + var locked_badge := locked_button.get_node( + "UnlockStateBadge" + ) as Panel + var locked_icon := locked_badge.get_node( "UnlockStateIcon" ) as TextureRect + assert(locked_badge.position == Vector2(4.0, 4.0)) + assert(locked_badge.size == Vector2(30.0, 30.0)) assert(locked_icon.texture.resource_path.ends_with("/lock_light.png")) - assert(locked_icon.size == Vector2(48.0, 48.0)) - assert(locked_icon.position == Vector2(12.0, 6.0)) - assert(is_equal_approx(locked_icon.modulate.a, 0.75)) + assert(locked_icon.size == Vector2(18.0, 18.0)) + assert(locked_icon.position == Vector2(6.0, 6.0)) + assert(is_equal_approx(locked_icon.modulate.a, 0.88)) assert(not bool(locked_icon.get_meta(&"unlocked"))) locked_button.free() var unlocked_button := Button.new() shop.call( "_add_unlock_state_icon", unlocked_button, true, Vector2(72.0, 72.0) ) - assert(unlocked_button.get_node_or_null("UnlockStateIcon") == null) + assert(unlocked_button.get_node_or_null("UnlockStateBadge") == null) unlocked_button.free() shop.free() @@ -49,12 +54,42 @@ func _initialize() -> void: assert(FishingShopStockType.get_price(&"magnet") == 250) assert(FishingShopStockType.get_stock_item_ids().has(&"magnet")) assert(FishingShopStockType.is_permanent_unlock(&"magnet", magnet)) + var fishing_net: ItemDataType = ( + ItemCatalogResource.get_available_item_by_id(&"fishing_net") + ) + assert(fishing_net != null) + assert(fishing_net.category == ItemDataType.Category.TOOL) + assert(fishing_net.icon == null) + assert(not fishing_net.usable) + assert(not fishing_net.equippable) + assert(not fishing_net.hotbar_allowed) + assert(FishingShopStockType.get_price(&"fishing_net") == 250) + assert(FishingShopStockType.get_stock_item_ids().has(&"fishing_net")) + assert(FishingShopStockType.is_permanent_unlock( + &"fishing_net", fishing_net + )) + assert(not FishingShopStockType.is_gathering_tool(&"fishing_net")) var crab_net: ItemDataType = ItemCatalogResource.get_available_item_by_id( &"crab_net" ) assert(crab_net != null) assert(crab_net.icon != null) - assert(crab_net.icon.resource_path.ends_with("/equipment/temp_net.png")) + assert(crab_net.icon.resource_path.ends_with("/equipment/net.png")) + var shovel: ItemDataType = ItemCatalogResource.get_available_item_by_id( + &"standard_shovel" + ) + assert(shovel != null) + assert(shovel.category == ItemDataType.Category.TOOL) + assert(shovel.icon != null) + assert(shovel.icon.resource_path.ends_with("/equipment/shovel.png")) + assert(shovel.equippable) + assert(shovel.hotbar_allowed) + assert(FishingShopStockType.get_price(&"standard_shovel") == 75) + assert(FishingShopStockType.get_stock_item_ids().has(&"standard_shovel")) + assert(FishingShopStockType.is_permanent_unlock(&"standard_shovel", shovel)) + assert(FishingShopStockType.is_gathering_tool(&"crab_net")) + assert(FishingShopStockType.is_gathering_tool(&"standard_shovel")) + assert(not FishingShopStockType.is_gathering_tool(&"basic_fishing_rod")) var wallet := PlayerWalletType.new() wallet.current_balance = 250 diff --git a/tests/file_dialog_controller_navigation_validation.gd b/tests/file_dialog_controller_navigation_validation.gd index a31e56e..7ac8df9 100644 --- a/tests/file_dialog_controller_navigation_validation.gd +++ b/tests/file_dialog_controller_navigation_validation.gd @@ -35,11 +35,19 @@ func _run() -> void: FileDialogControllerNavigationType.interactive_controls(root_scope) ) var directory_list: ItemList + var parent_button: Button var create_folder_button: Button var path_edit: LineEdit - var has_menu_button: bool = false - var has_cancel: bool = false - var has_select: bool = false + var drive_button: MenuButton + var refresh_button: Button + var favorite_button: Button + var hidden_button: Button + var grid_button: Button + var list_button: Button + var filter_button: Button + var sort_button: MenuButton + var cancel_button: Button + var select_button: Button for control: Control in root_controls: if ( control is ItemList @@ -50,22 +58,133 @@ func _run() -> void: path_edit = control as LineEdit var button := control as Button if button != null: + parent_button = ( + button + if button.tooltip_text == "Go to parent folder." + else parent_button + ) create_folder_button = ( button if button.tooltip_text == "Create a new folder." else create_folder_button ) - has_cancel = has_cancel or button.text == "Cancel" - has_select = has_select or button.text == "Select Current Folder" - has_menu_button = has_menu_button or control is MenuButton + refresh_button = ( + button + if button.tooltip_text == "Refresh files." + else refresh_button + ) + favorite_button = ( + button + if button.tooltip_text == "(Un)favorite current folder." + else favorite_button + ) + hidden_button = ( + button + if button.tooltip_text == ( + "Toggle the visibility of hidden files." + ) + else hidden_button + ) + grid_button = ( + button + if button.tooltip_text == ( + "View items as a grid of thumbnails." + ) + else grid_button + ) + list_button = ( + button + if button.tooltip_text == "View items as a list." + else list_button + ) + filter_button = ( + button + if button.tooltip_text == ( + "Toggle the visibility of the filter for file names." + ) + else filter_button + ) + cancel_button = button if button.text == "Cancel" else cancel_button + select_button = ( + button + if button.text == "Select Current Folder" + else select_button + ) + var menu := control as MenuButton + if menu != null: + drive_button = menu if menu.accessibility_name == "Drive" else drive_button + sort_button = ( + menu if menu.tooltip_text == "Sort files" else sort_button + ) assert(directory_list != null) + assert(parent_button != null) assert(path_edit != null) assert(create_folder_button != null) - assert(has_menu_button) - assert(has_cancel) - assert(has_select) + assert(drive_button != null) + assert(refresh_button != null) + assert(favorite_button != null) + assert(hidden_button != null) + assert(grid_button != null) + assert(list_button != null) + assert(filter_button != null) + assert(sort_button != null) + assert(cancel_button != null) + assert(select_button != null) assert(dialog.gui_get_focus_owner() == directory_list) + _assert_neighbor(path_edit, &"focus_neighbor_left", parent_button) + _assert_neighbor(path_edit, &"focus_neighbor_right", drive_button) + _assert_neighbor(drive_button, &"focus_neighbor_left", path_edit) + _assert_neighbor(refresh_button, &"focus_neighbor_left", drive_button) + _assert_neighbor(favorite_button, &"focus_neighbor_left", refresh_button) + _assert_neighbor( + create_folder_button, &"focus_neighbor_left", favorite_button + ) + _assert_neighbor(hidden_button, &"focus_neighbor_right", grid_button) + _assert_neighbor(grid_button, &"focus_neighbor_right", list_button) + _assert_neighbor(list_button, &"focus_neighbor_right", filter_button) + _assert_neighbor(filter_button, &"focus_neighbor_right", sort_button) + _assert_neighbor(sort_button, &"focus_neighbor_top", create_folder_button) + _assert_neighbor( + create_folder_button, &"focus_neighbor_bottom", sort_button + ) + _assert_neighbor(directory_list, &"focus_neighbor_top", hidden_button) + _assert_neighbor(directory_list, &"focus_neighbor_bottom", select_button) + _assert_neighbor(cancel_button, &"focus_neighbor_right", select_button) + _assert_neighbor(select_button, &"focus_neighbor_left", cancel_button) + assert(favorite_button.accessibility_name == "favorite current folder") + assert(create_folder_button.accessibility_name == "new folder") + assert(filter_button.accessibility_name == "filter file names") _assert_directionally_reachable(directory_list, root_controls) + directory_list.clear() + directory_list.add_item("test folder") + directory_list.select(0) + directory_list.grab_focus() + assert( + FileDialogControllerNavigationType.move_from_item_list( + directory_list, Vector2.UP + ) + ) + assert(dialog.gui_get_focus_owner() == hidden_button) + directory_list.grab_focus() + assert( + FileDialogControllerNavigationType.move_from_item_list( + directory_list, Vector2.DOWN + ) + ) + assert(dialog.gui_get_focus_owner() == select_button) + sort_button.grab_focus() + var accept_press := InputEventAction.new() + accept_press.action = &"ui_accept" + accept_press.pressed = true + Input.parse_input_event(accept_press) + var accept_release := InputEventAction.new() + accept_release.action = &"ui_accept" + accept_release.pressed = false + Input.parse_input_event(accept_release) + await process_frame + assert(sort_button.get_popup().visible) + sort_button.get_popup().hide() + await process_frame create_folder_button.pressed.emit() for _frame: int in 3: @@ -124,7 +243,14 @@ func _validate_compact_dialog() -> void: root.size = Vector2i(640, 480) var font_controller := InterfaceFontControllerType.new() root.add_child(font_controller) + var keyboard := OnScreenKeyboardType.new() + root.add_child(keyboard) await process_frame + keyboard.set_enabled(false) + font_controller.set_controller_text_entry_request( + Callable(keyboard, "request_for_control"), + Callable(keyboard, "is_open"), + ) var dialog := FileDialog.new() dialog.file_mode = FileDialog.FILE_MODE_OPEN_DIR dialog.access = FileDialog.ACCESS_FILESYSTEM @@ -140,17 +266,46 @@ func _validate_compact_dialog() -> void: FileDialogControllerNavigationType.interactive_controls(scope) ) var directory_list: ItemList + var path_edit: LineEdit + var select_button: Button for control: Control in controls: if ( control is ItemList and control.accessibility_name == "Directories & Files:" ): directory_list = control as ItemList - break + if control is LineEdit and control.accessibility_name == "Path:": + path_edit = control as LineEdit + if control is Button and (control as Button).text == ( + "Select Current Folder" + ): + select_button = control as Button assert(directory_list != null) + assert(path_edit != null) + assert(select_button != null) _assert_directionally_reachable(directory_list, controls) + directory_list.clear() + directory_list.add_item("test folder") + directory_list.select(0) + directory_list.grab_focus() + var down_event := InputEventJoypadButton.new() + down_event.button_index = JOY_BUTTON_DPAD_DOWN + down_event.pressed = true + var dialog_controller := font_controller.get( + "_file_dialog_controller" + ) as FileDialogController + dialog_controller.call("_input", down_event) + assert(scope.gui_get_focus_owner() == select_button) + path_edit.grab_focus() + var accept_event := InputEventJoypadButton.new() + accept_event.button_index = JOY_BUTTON_A + accept_event.pressed = true + dialog_controller.call("_input", accept_event) + assert(keyboard.is_open()) + keyboard.call("_close_keyboard", true) dialog.queue_free() font_controller.queue_free() + keyboard.queue_free() await process_frame @@ -181,3 +336,13 @@ func _assert_directionally_reachable( visited[neighbor.get_instance_id()] = true pending.append(neighbor) assert(visited.size() == expected.size()) + + +func _assert_neighbor( + origin: Control, + property_name: StringName, + expected: Control, +) -> void: + var neighbor_path: NodePath = origin.get(property_name) + var neighbor := origin.get_node_or_null(neighbor_path) as Control + assert(neighbor == expected) diff --git a/tests/fish_catalog_content_validation.gd b/tests/fish_catalog_content_validation.gd index a2855e5..3b31005 100644 --- a/tests/fish_catalog_content_validation.gd +++ b/tests/fish_catalog_content_validation.gd @@ -15,6 +15,7 @@ const NetworkFishingServiceType = preload( "res://network/network_fishing_service.gd" ) const FishingSpotType = preload("res://fishing/fishing_spot.gd") +const CalendarSeasonType = preload("res://world/calendar_season.gd") const Catalog: FishPoolType = preload("res://fish/pools/fish_catalog.tres") const PondPool: FishPoolType = preload( @@ -23,10 +24,61 @@ const PondPool: FishPoolType = preload( const OceanPool: FishPoolType = preload( "res://fish/pools/starter_ocean_pool.tres" ) +const GeneratedPondPool: FishPoolType = preload( + "res://fish/pools/generated_pond_pool.tres" +) +const GeneratedLakePool: FishPoolType = preload( + "res://fish/pools/generated_lake_pool.tres" +) +const GeneratedRiverPool: FishPoolType = preload( + "res://fish/pools/generated_river_pool.tres" +) const PelicanBuyer = preload("res://economy/buyers/pelicans.tres") const StarterRegionScene = preload( "res://world/regions/starter_island_region.tscn" ) +const SharedFishPlaceholder: Texture2D = preload( + "res://art/exported/creatures/fish_placeholder.png" +) +const FINAL_CREATURE_TEXTURE_PATHS: Dictionary[StringName, String] = { + &"bowfin": "res://art/exported/creatures/101.png", + &"sturgeon_lake": "res://art/exported/creatures/102.png", + &"gar_longnose": "res://art/exported/creatures/103.png", + &"paddlefish": "res://art/exported/creatures/104.png", + &"sturgeon_shovelnose": "res://art/exported/creatures/105.png", + &"gar_spotted": "res://art/exported/creatures/106.png", + &"lungfish_west_african": "res://art/exported/creatures/107.png", + &"mudskipper_atlantic": "res://art/exported/creatures/201.png", + &"flounder_winter": "res://art/exported/creatures/403.png", + &"mackerel_atlantic": "res://art/exported/creatures/701.png", + &"mackerel_chub": "res://art/exported/creatures/704.png", + &"sand_lance_american": "res://art/exported/creatures/801.png", + &"menhaden_atlantic": "res://art/exported/creatures/802.png", + &"anchovy_european": "res://art/exported/creatures/805.png", + &"sardine_european": "res://art/exported/creatures/806.png", + &"anchovy_northern": "res://art/exported/creatures/808.png", + &"crab_brown": "res://art/exported/creatures/3906.png", + &"salmon_atlantic": "res://art/exported/creatures/4401.png", + &"mahi_mahi": "res://art/exported/creatures/4701.png", + &"clownfish_ocellaris": "res://art/exported/creatures/5702.png", + &"chromis_blue_green": "res://art/exported/creatures/5901.png", + &"hogfish": "res://art/exported/creatures/6103.png", + &"mullet_striped": "res://art/exported/creatures/6804.png", + &"sheepshead": "res://art/exported/creatures/6905.png", + &"milkfish": "res://art/exported/creatures/7101.png", + &"ladyfish": "res://art/exported/creatures/7403.png", + &"tilapia_nile": "res://art/exported/creatures/7506.png", + &"betta_siamese": "res://art/exported/creatures/7508.png", +} + +const ACTIVE_CATALOG_COUNT: int = 313 +const INACTIVE_CATALOG_COUNT: int = 3 +const FISHING_SPECIES_COUNT: int = 310 +const GENERATED_POND_COUNT: int = 33 +const GENERATED_LAKE_COUNT: int = 20 +const GENERATED_RIVER_COUNT: int = 53 +const STARTER_POND_COUNT: int = 106 +const OCEAN_COUNT: int = 204 const ORIGINAL_IDS: Array[StringName] = [ &"bluegill", &"bass", &"carp", &"sunfish", @@ -69,15 +121,16 @@ const NEW_FRESH_WATER_IDS: Array[StringName] = [ &"chub_european", &"chub_flame", &"chub_lake", &"goldfish", &"goldfish_bubbleeye", &"sauger", &"saugeye", &"trout_cutthroat", &"trout_golden", &"trout_rainbow", &"trout_steelhead", &"walleye", + &"bowfin", &"sturgeon_lake", &"gar_longnose", &"paddlefish", + &"sturgeon_shovelnose", &"gar_spotted", &"lungfish_west_african", ] - - func _initialize() -> void: call_deferred("_run") func _run() -> void: _validate_catalog_and_pools() + _validate_generated_habitat_pools() _validate_weight_based_display_scale() _validate_starter_water_bodies() _validate_authoritative_water_filter() @@ -86,6 +139,42 @@ func _run() -> void: quit() +func _validate_generated_habitat_pools() -> void: + var expected_counts: Dictionary = { + GeneratedPondPool: GENERATED_POND_COUNT, + GeneratedLakePool: GENERATED_LAKE_COUNT, + GeneratedRiverPool: GENERATED_RIVER_COUNT, + } + var freshwater_ids: Dictionary[StringName, bool] = {} + for pool: FishPoolType in expected_counts: + assert(pool.candidates.size() == int(expected_counts[pool])) + for fish: FishDataType in pool.candidates: + assert(fish != null and fish.is_fishable()) + assert(not freshwater_ids.has(fish.id)) + freshwater_ids[fish.id] = true + assert(fish.is_allowed_in_water(WaterType.Type.FRESH_WATER)) + assert(freshwater_ids.size() == STARTER_POND_COUNT) + assert(PondPool.candidates.size() == STARTER_POND_COUNT) + for fish: FishDataType in PondPool.candidates: + assert(freshwater_ids.has(fish.id)) + assert(OceanPool.candidates.size() == OCEAN_COUNT) + var ocean_ids: Dictionary[StringName, bool] = {} + for fish: FishDataType in OceanPool.candidates: + assert(fish != null and fish.is_fishable()) + assert(not ocean_ids.has(fish.id)) + ocean_ids[fish.id] = true + assert(fish.is_allowed_in_water(WaterType.Type.SALT_WATER)) + for fish: FishDataType in Catalog.candidates: + if not fish.is_fishable(): + continue + assert(freshwater_ids.has(fish.id) != ocean_ids.has(fish.id)) + assert(freshwater_ids.size() + ocean_ids.size() == FISHING_SPECIES_COUNT) + assert(GeneratedPondPool.get_fish_by_id(&"gar_longnose") == null) + assert(GeneratedRiverPool.get_fish_by_id(&"gar_longnose") != null) + assert(GeneratedRiverPool.get_fish_by_id(&"goby_round") == null) + assert(GeneratedLakePool.get_fish_by_id(&"goby_round") != null) + + func _validate_weight_based_display_scale() -> void: var previous_scale: float = 0.0 for fish: FishDataType in Catalog.candidates: @@ -93,7 +182,7 @@ func _validate_weight_based_display_scale() -> void: continue assert(fish.is_selectable()) assert(fish.weight_min_lb > 0.0) - assert(fish.weight_max_lb <= 1000.0) + assert(fish.weight_max_lb <= 500000.0) var minimum_scale: float = fish.get_display_scale_for_weight( fish.weight_min_lb ) @@ -121,11 +210,14 @@ func _validate_weight_based_display_scale() -> void: func _validate_catalog_and_pools() -> void: - assert(Catalog.candidates.size() == 314) - assert(PondPool.candidates.size() == 19) - assert(OceanPool.candidates.size() == 34) + assert(Catalog.candidates.size() == 316) + assert(PondPool.candidates.size() == STARTER_POND_COUNT) + assert(OceanPool.candidates.size() == OCEAN_COUNT) var active_count: int = 0 var inactive_count: int = 0 + var fishing_count: int = 0 + var final_art_count: int = 0 + var placeholder_fishing_count: int = 0 var catalog_numbers: Dictionary[int, bool] = {} for fish: FishDataType in Catalog.candidates: assert(fish != null and not fish.id.is_empty()) @@ -134,6 +226,8 @@ func _validate_catalog_and_pools() -> void: assert(not catalog_numbers.has(fish.catalog_number)) catalog_numbers[fish.catalog_number] = true assert(not fish.logbook_fact.strip_edges().is_empty()) + assert(CalendarSeasonType.is_valid_mask(fish.available_seasons)) + assert(not fish.get_season_text().is_empty()) if fish.active: active_count += 1 assert(fish.is_selectable()) @@ -142,14 +236,67 @@ func _validate_catalog_and_pools() -> void: inactive_count += 1 assert(not fish.is_selectable()) assert(fish.display_texture == null) - assert(active_count == 54) - assert(inactive_count == 260) - var inactive_fish: FishDataType = Catalog.get_fish_by_id(&"bowfin") + if FINAL_CREATURE_TEXTURE_PATHS.has(fish.id): + var expected_texture: Texture2D = load( + FINAL_CREATURE_TEXTURE_PATHS[fish.id] + ) as Texture2D + assert(expected_texture != null) + assert(fish.display_texture == expected_texture) + final_art_count += 1 + if fish.collection_method == FishDataType.CollectionMethod.FISHING: + fishing_count += 1 + assert(fish.active) + if not FINAL_CREATURE_TEXTURE_PATHS.has(fish.id): + assert(fish.display_texture == SharedFishPlaceholder) + placeholder_fishing_count += 1 + assert(active_count == ACTIVE_CATALOG_COUNT) + assert(inactive_count == INACTIVE_CATALOG_COUNT) + assert(fishing_count == FISHING_SPECIES_COUNT) + assert(final_art_count == FINAL_CREATURE_TEXTURE_PATHS.size()) + assert(placeholder_fishing_count == 283) + var chum: FishDataType = Catalog.get_fish_by_id(&"salmon_chum") + assert(chum != null) + assert(chum.get_season_text() == "fall") + assert( + chum.is_available_in_season(CalendarSeasonType.Season.FALL) + ) + assert( + not chum.is_available_in_season(CalendarSeasonType.Season.SUMMER) + ) + var chum_pool := FishPoolType.new() + chum_pool.candidates = [chum] + var seasonal_collection := CollectionLogType.new() + var seasonal_selector := FishSelectorType.new() + seasonal_selector.use_deterministic_test_seed = true + var summer_context := FishingContextType.new() + summer_context.water_type = WaterType.Type.SALT_WATER + summer_context.season = CalendarSeasonType.Season.SUMMER + seasonal_selector.begin_roll() + assert( + seasonal_selector.select_fish( + chum_pool, + summer_context, + seasonal_collection, + ) == null + ) + var fall_context := FishingContextType.new() + fall_context.water_type = WaterType.Type.SALT_WATER + fall_context.season = CalendarSeasonType.Season.FALL + seasonal_selector.begin_roll() + assert( + seasonal_selector.select_fish( + chum_pool, + fall_context, + seasonal_collection, + ) == chum + ) + seasonal_collection.free() + var inactive_fish: FishDataType = Catalog.get_fish_by_id(&"crab_blue") assert(inactive_fish != null and not inactive_fish.active) var inactive_pool := FishPoolType.new() inactive_pool.candidates = [inactive_fish] var inactive_context := FishingContextType.new() - inactive_context.water_type = WaterType.Type.FRESH_WATER + inactive_context.water_type = WaterType.Type.SALT_WATER var inactive_collection := CollectionLogType.new() var inactive_selector := FishSelectorType.new() inactive_selector.use_deterministic_test_seed = true @@ -193,7 +340,12 @@ func _validate_catalog_and_pools() -> void: assert(fish.is_selectable()) assert(PondPool.get_fish_by_id(fish_id) == fish) assert(OceanPool.get_fish_by_id(fish_id) == null) - assert(fish.availability.allowed_location_tags == [&"starter_pond"]) + var expected_tags: Array[StringName] = [] + if fish_id in [&"catfish_channel", &"catfish_white"]: + expected_tags.assign([&"starter_pond", &"pond"]) + else: + expected_tags.append(&"river") + assert(fish.availability.allowed_location_tags == expected_tags) assert( LogbookCatalog.category_for(fish) == LogbookCatalog.Category.FRESH_WATER @@ -264,17 +416,25 @@ func _validate_catalog_and_pools() -> void: var pond_context := FishingContextType.new() pond_context.location_tags = [&"starter_pond"] pond_context.water_type = WaterType.Type.FRESH_WATER - var night_pond_context := FishingContextType.new() - night_pond_context.location_tags = [&"starter_pond"] - night_pond_context.water_type = WaterType.Type.FRESH_WATER - night_pond_context.is_night = true var ocean_context := FishingContextType.new() ocean_context.location_tags = [&"coast", &"ocean"] ocean_context.water_type = WaterType.Type.SALT_WATER for fish_id: StringName in CATFISH_IDS: var fish: FishDataType = Catalog.get_fish_by_id(fish_id) - assert(not fish.availability.is_available(pond_context)) - assert(fish.availability.is_available(night_pond_context)) + var day_habitat_context := FishingContextType.new() + if fish_id in [&"catfish_channel", &"catfish_white"]: + day_habitat_context.location_tags.append(&"pond") + else: + day_habitat_context.location_tags.append(&"river") + day_habitat_context.water_type = WaterType.Type.FRESH_WATER + var night_habitat_context := FishingContextType.new() + night_habitat_context.location_tags = ( + day_habitat_context.location_tags.duplicate() + ) + night_habitat_context.water_type = WaterType.Type.FRESH_WATER + night_habitat_context.is_night = true + assert(not fish.availability.is_available(day_habitat_context)) + assert(fish.availability.is_available(night_habitat_context)) assert(not fish.availability.is_available(ocean_context)) var single_species_pool := FishPoolType.new() single_species_pool.candidates = [fish] @@ -284,7 +444,7 @@ func _validate_catalog_and_pools() -> void: selector.begin_roll() assert( selector.select_fish( - single_species_pool, night_pond_context, collection + single_species_pool, night_habitat_context, collection ) == fish ) collection.free() @@ -322,11 +482,15 @@ func _validate_authoritative_water_filter() -> void: ocean_region.location_tags = [&"coast", &"ocean"] var stale_salt_pool_region := FishableWaterRegion.new() stale_salt_pool_region.water_type = WaterType.Type.FRESH_WATER - stale_salt_pool_region.fish_pool = OceanPool + var salt_only_pool := FishPoolType.new() + salt_only_pool.candidates = [Catalog.get_fish_by_id(&"bass")] + stale_salt_pool_region.fish_pool = salt_only_pool stale_salt_pool_region.location_tags = [&"starter_pond"] var stale_fresh_pool_region := FishableWaterRegion.new() stale_fresh_pool_region.water_type = WaterType.Type.SALT_WATER - stale_fresh_pool_region.fish_pool = PondPool + var fresh_only_pool := FishPoolType.new() + fresh_only_pool.candidates = [Catalog.get_fish_by_id(&"bluegill")] + stale_fresh_pool_region.fish_pool = fresh_only_pool stale_fresh_pool_region.location_tags = [&"coast", &"ocean"] var evidence := {"discovered_fish_ids": []} assert( @@ -455,6 +619,7 @@ func _validate_catches_and_authoritative_sale() -> void: 1, "catalog_sale_%d" % catch_sequence, [loaded.to_network_dict()], + [], PelicanBuyer, ) assert(bool(sale_result.get("accepted", false))) diff --git a/tests/fish_hotbar_showcase_validation.gd b/tests/fish_hotbar_showcase_validation.gd index 945155d..af3644b 100644 --- a/tests/fish_hotbar_showcase_validation.gd +++ b/tests/fish_hotbar_showcase_validation.gd @@ -56,7 +56,7 @@ func _run() -> void: ) fish_catch.ensure_identity() player.inventory.add_catch(fish_catch) - player.collection_log.mark_quality_discovered( + player.collection_log.record_catch( fish_catch.fish_id, fish_catch.quality, ) @@ -89,36 +89,39 @@ func _run() -> void: assert(not service.is_local_showcase_visible()) await _wait_for_held_fish_visibility(player, false) var saved_weather: WorldWeatherService.Weather = ( - world_weather.get_weather() + world_weather.get_persistent_weather() ) - var saved_weather_seconds: float = world_weather.get_seconds_remaining() - var saved_time_hours: float = world_time.get_time_hours() + var saved_weather_seconds: float = ( + world_weather.get_persistent_seconds_remaining() + ) + var saved_time_hours: float = world_time.get_persistent_time_hours() assert(save_manager.save_now()) var save_path: String = str(save_manager.get("_save_path")) - var save_file := FileAccess.open(save_path, FileAccess.READ) - assert(save_file != null) - var parsed: Variant = JSON.parse_string(save_file.get_as_text()) - save_file.close() - assert(typeof(parsed) == TYPE_DICTIONARY) - var hotbar_data: Dictionary = (parsed as Dictionary)["hotbar"] + var decoded: Dictionary = ProgressionSaveCodec.read_local_save(save_path) + assert(bool(decoded.get("ok", false))) + var parsed: Dictionary = decoded["data"] + var hotbar_data: Dictionary = parsed["hotbar"] assert(typeof(hotbar_data.get("fish_slots")) == TYPE_ARRAY) assert(str((hotbar_data["fish_slots"] as Array)[1]) == fish_catch.catch_id) - assert(int((parsed as Dictionary)["save_version"]) == 7) + assert(int(parsed["save_version"]) == 11) + assert(not PlayerHomeState.sanitize_save_data( + parsed.get("home", {}) + ).is_empty()) assert( - int((parsed as Dictionary)["experience"]["total_experience"]) + int(parsed["experience"]["total_experience"]) == 125 ) assert(absf( - float((parsed as Dictionary)["world"]["time_hours"]) - saved_time_hours + float(parsed["world"]["time_hours"]) - saved_time_hours ) < 0.01) assert( - int((parsed as Dictionary)["world"]["weather"]) + int(parsed["world"]["weather"]) == int(saved_weather) ) assert(absf( float( - (parsed as Dictionary)["world"][ + parsed["world"][ "weather_seconds_remaining" ] ) - saved_weather_seconds @@ -132,6 +135,19 @@ func _run() -> void: int(saved_masks[String(fish.id)]) == FishQuality.bit_for(FishQuality.Tier.EXCEPTIONAL) ) + var saved_catch_counts: Dictionary = ( + (parsed as Dictionary)["collection"]["catch_counts"] + ) + assert(int(saved_catch_counts[String(fish.id)]) == 1) + var legacy_without_counts: Dictionary = parsed.duplicate(true) + (legacy_without_counts["collection"] as Dictionary).erase("catch_counts") + var legacy_snapshot: RefCounted = save_manager.call( + "_build_load_snapshot", + legacy_without_counts, + ) + assert(legacy_snapshot != null) + var recovered_counts: Dictionary = legacy_snapshot.get("catch_counts") + assert(int(recovered_counts.get(fish.id, 0)) == 1) assert(player.hotbar.clear_slot(1)) assert(player.experience.restore_total_experience(0)) @@ -143,10 +159,12 @@ func _run() -> void: ) assert(save_manager.load_player_data()) assert(player.experience.get_total_experience() == 125) - assert(absf(world_time.get_time_hours() - saved_time_hours) < 0.01) - assert(world_weather.get_weather() == saved_weather) + # Loading a save must not replace the active RTC-authoritative clock. + assert(absf(world_time.get_time_hours() - 8.0) < 0.01) + assert(world_weather.get_persistent_weather() == saved_weather) assert(absf( - world_weather.get_seconds_remaining() - saved_weather_seconds + world_weather.get_persistent_seconds_remaining() + - saved_weather_seconds ) < 2.0) assert(player.experience.get_level() == 2) assert(player.hotbar.get_fish_catch_id(1) == fish_catch.catch_id) @@ -157,6 +175,7 @@ func _run() -> void: FishQuality.Tier.EXCEPTIONAL, ) ) + assert(player.collection_log.get_catch_count(fish.id) == 1) assert(service.is_local_showcase_visible()) await _wait_for_held_fish_visibility(player, true) assert(player.inventory.remove_catch_by_id(fish_catch.catch_id) != null) @@ -181,8 +200,8 @@ func _run() -> void: var invalid_state: Dictionary = valid_state.duplicate(true) invalid_state["display_scale"] = 1000.0 assert(not NetworkFishShowcaseProtocol.validate_state(invalid_state)) - assert(NetworkProtocol.PROTOCOL_VERSION == 6) - assert(NetworkProtocol.ENET_CHANNEL_COUNT == 10) + assert(NetworkProtocol.PROTOCOL_VERSION == 12) + assert(NetworkProtocol.ENET_CHANNEL_COUNT == 18) assert( NetworkProtocol.FISH_QUALITY_CAPABILITY == "fish_quality_v1" diff --git a/tests/fish_quality_validation.gd b/tests/fish_quality_validation.gd index 28224f4..99a2169 100644 --- a/tests/fish_quality_validation.gd +++ b/tests/fish_quality_validation.gd @@ -25,13 +25,60 @@ func _run() -> void: _validate_mail_round_trip() _validate_collection_mastery() _validate_version_four_migration() - assert(NetworkProtocol.PROTOCOL_VERSION == 6) - assert(NetworkProtocol.ENET_CHANNEL_COUNT == 10) + _validate_fishing_protocol_v2() + assert(NetworkProtocol.PROTOCOL_VERSION == 12) + assert(NetworkProtocol.ENET_CHANNEL_COUNT == 18) + assert(NetworkProtocol.MOVEMENT_ANIMATION_CHANNEL == 11) + assert( + NetworkProtocol.MOVEMENT_RECONCILIATION_CAPABILITY + == "movement_reconciliation_v2" + ) + assert( + NetworkProtocol.FISHING_REPLICATION_CAPABILITY + == "fishing_replication_v2" + ) assert(NetworkProtocol.FISH_QUALITY_CAPABILITY == "fish_quality_v1") print("Fish quality validation: PASS") quit() +func _validate_fishing_protocol_v2() -> void: + var request: Dictionary = { + "request_id": "cast-1", + "session_id": "session-1", + "origin": [0.0, 1.0, 0.0], + "target": [0.0, 0.0, -4.0], + "charge": 0.5, + "rod_id": "basic_fishing_rod", + "reel_speed": 0.2, + "barrier_damage": 1, + "bite_multiplier": 1.0, + "rarity_multipliers": [], + "discovered_fish_ids": [], + "capacity_available": true, + "movement_sequence": 17, + } + assert(NetworkFishingProtocol.validate_cast_request(request).is_empty()) + var missing_sequence: Dictionary = request.duplicate(true) + missing_sequence.erase("movement_sequence") + assert( + NetworkFishingProtocol.validate_cast_request(missing_sequence) + == "Malformed fishing request." + ) + var invalid_sequence: Dictionary = request.duplicate(true) + invalid_sequence["movement_sequence"] = -1 + assert( + NetworkFishingProtocol.validate_cast_request(invalid_sequence) + == "Fishing request values are outside allowed limits." + ) + assert(NetworkFishingProtocol.OBSERVER_SNAPSHOT_CHANNEL == 10) + assert(NetworkWorldSpawnProtocol.SNAPSHOT_CHANNEL == 15) + assert( + NetworkWorldSpawnProtocol.SNAPSHOT_CHANNEL + != NetworkFishingProtocol.SNAPSHOT_CHANNEL + ) + + func _validate_tiers_and_distribution() -> void: assert(FishQualityType.TIER_COUNT == 5) assert(FishQualityType.display_name(0) == "boring") @@ -173,23 +220,49 @@ func _validate_barrier_challenge_curve() -> void: FishQualityType.Tier.SHINY ).y var base_power_clicks: int = ceili(float(shiny_health) / 1.0) + var maximum_barrier_damage: int = ( + PlayerFishingUpgrades.get_barrier_damage_for_level( + PlayerFishingUpgrades.MAX_BARRIER_POWER_LEVEL + ) + ) var max_power_clicks: int = ceili( float(shiny_health) - / float(PlayerFishingUpgrades.MAX_BARRIER_POWER_LEVEL + 1) + / float(maximum_barrier_damage) ) assert(base_power_clicks == 400) - assert(max_power_clicks == 100) + assert(maximum_barrier_damage == 128) + assert( + NetworkFishingProtocol.MAX_BARRIER_DAMAGE + == maximum_barrier_damage + ) + assert(max_power_clicks == 4) assert(max_power_clicks < base_power_clicks) func _validate_fight_pacing_and_reel_upgrades() -> void: assert(is_equal_approx(CatchController.CHASE_SPEED, 0.07)) - assert(is_equal_approx(CatchController.CHASE_START_DELAY, 1.0)) + assert(is_equal_approx(CatchController.CHASE_START_DELAY, 1.5)) assert(is_equal_approx(CatchController.CHASE_START_OFFSET, 0.04)) assert(is_equal_approx(Player.BASE_REEL_SPEED, 0.16)) var upgrades := PlayerFishingUpgrades.new() assert(is_equal_approx(upgrades.get_reel_speed_multiplier(), 1.0)) + assert( + PlayerFishingUpgrades.BARRIER_POWER_COSTS.size() + == PlayerFishingUpgrades.MAX_BARRIER_POWER_LEVEL + ) + for barrier_level: int in range( + PlayerFishingUpgrades.MAX_BARRIER_POWER_LEVEL + 1 + ): + assert(upgrades.restore_levels(0, barrier_level)) + assert(upgrades.get_barrier_damage() == 1 << barrier_level) + if barrier_level < PlayerFishingUpgrades.MAX_BARRIER_POWER_LEVEL: + assert( + upgrades.get_next_barrier_power_cost() + == PlayerFishingUpgrades.BARRIER_POWER_COSTS[barrier_level] + ) + else: + assert(upgrades.get_next_barrier_power_cost() == -1) assert( upgrades.restore_levels( PlayerFishingUpgrades.MAX_REEL_SPEED_LEVEL, @@ -279,6 +352,7 @@ func _validate_catch_round_trip_and_sale() -> void: 1, "quality_sale", [network_data], + [], PelicanBuyer, ) assert(bool(accepted.get("accepted", false))) @@ -310,6 +384,7 @@ func _validate_catch_round_trip_and_sale() -> void: 1, "quality_sale_forged", [forged], + [], PelicanBuyer, ) assert(not bool(rejected.get("accepted", false))) @@ -373,6 +448,11 @@ func _validate_collection_mastery() -> void: collection.get_quality_mask(&"bluegill") == FishQualityType.ALL_TIERS_MASK ) + assert(collection.get_catch_count(&"bluegill") == 0) + collection.record_catch(&"bluegill", FishQualityType.Tier.BORING) + collection.record_catch(&"bluegill", FishQualityType.Tier.SHINY) + assert(collection.get_catch_count(&"bluegill") == 2) + assert(int(collection.get_catch_counts()[&"bluegill"]) == 2) collection.queue_free() @@ -405,7 +485,7 @@ func _validate_version_four_migration() -> void: version_four, 4, ) - assert(int(migrated.get("save_version", -1)) == 7) + assert(int(migrated.get("save_version", -1)) == 11) assert(int((migrated["experience"] as Dictionary)["total_experience"]) == 0) assert( is_equal_approx( @@ -413,6 +493,10 @@ func _validate_version_four_migration() -> void: 8.0, ) ) + assert( + int((migrated["world"] as Dictionary)["seed"]) + == PlayerSaveManager.DEFAULT_WORLD_SEED + ) var catches: Array = migrated["inventory"]["catches"] assert(int((catches[0] as Dictionary)["quality"]) == 0) var collection: Dictionary = migrated["collection"] @@ -425,4 +509,7 @@ func _validate_version_four_migration() -> void: assert( PlayerJobService.validate_save_data(migrated.get("jobs", {})) ) + assert(not PlayerHomeState.sanitize_save_data( + migrated.get("home", {}) + ).is_empty()) manager.queue_free() diff --git a/tests/fish_showcase_multiplayer_validation.gd b/tests/fish_showcase_multiplayer_validation.gd index 72f4a59..5161377 100644 --- a/tests/fish_showcase_multiplayer_validation.gd +++ b/tests/fish_showcase_multiplayer_validation.gd @@ -24,6 +24,10 @@ func _run() -> void: func _run_host() -> void: var main: Node = await _create_initialized_main() var session := main.get_node("%NetworkSession") as NetworkSession + assert(bool(main.call( + "_apply_world", WorldLayout.STARTER_ISLAND, 1, true + ))) + assert(session.set_host_world(WorldLayout.STARTER_ISLAND, 1)) assert(session.start_private_host(TEST_PORT)) var save_manager := main.get("_save_manager") as PlayerSaveManager assert(save_manager.initialize_new_game()) diff --git a/tests/fishing_authority_validation.gd b/tests/fishing_authority_validation.gd index c06ab36..b3c17dd 100644 --- a/tests/fishing_authority_validation.gd +++ b/tests/fishing_authority_validation.gd @@ -19,6 +19,12 @@ func _run() -> void: for _frame: int in 8: await process_frame assert(bool(main.get("_application_initialized"))) + assert(bool(main.call( + "_apply_world", + WorldLayout.GENERATED, + PlayerSaveManager.DEFAULT_WORLD_SEED, + true, + ))) assert(bool(main.call("_prepare_private_host"))) var save_manager := main.get("_save_manager") as PlayerSaveManager assert(save_manager.initialize_new_game()) @@ -35,23 +41,44 @@ func _run() -> void: var fishing_status := game_ui.get_node("%StatusLabel") as Label var fishing_panel := game_ui.get_node("%FishingPanel") as PanelContainer var player := main.get("_player") as Player + var item_catalog := main.get("item_catalog") as ItemCatalog assert(session.is_host()) assert(not session.is_open_host()) assert(service != null and fishing_spot != null and player != null) assert(player.hotbar.get_selected_item_id() == &"basic_fishing_rod") - var pond := main.get_node( - "TestWorld/Regions/StarterIslandRegion/WaterBodies/Pond" + var worms: ItemData = item_catalog.get_item_by_id(&"worms") + assert(worms != null) + if player.bag.get_quantity(&"worms") == 0: + assert(player.bag.add_item(&"worms", 2)) + assert(player.equip_bait(worms)) + var bait_quantity_before: int = player.bag.get_quantity(&"worms") + var fresh_root := main.get_node( + "TestWorld/Regions/GeneratedWorldRegion/WaterBodies/FreshWaterBodies" ) as Node3D + var pond: WaterBodyAuthoring + for child: Node in fresh_root.get_children(): + var candidate := child as WaterBodyAuthoring + if candidate != null and &"pond" in candidate.location_tags: + pond = candidate + break + assert(pond != null) var pond_region := pond.get_node("FishingRegion") as FishableWaterRegion - assert(pond != null and pond_region != null) + assert(pond_region != null) var pond_surface_y: float = pond_region.get_surface_height() - player.global_position = pond.global_position + Vector3(8.9, 1.44, 0.0) + player.global_position = pond.global_transform * Vector3( + pond.surface_size.x * 0.5 + 0.8, + 1.44, + 0.0, + ) + var pond_direction := pond.global_position - player.global_position + pond_direction.y = 0.0 + pond_direction = pond_direction.normalized() var visuals := player.get_node("Visuals") as Node3D - visuals.rotation.y = PI * 0.5 + visuals.global_rotation.y = atan2(-pond_direction.x, -pond_direction.z) for _frame: int in 4: await physics_frame - assert(player.get_facing_direction().dot(Vector3.LEFT) > 0.99) + assert(player.get_facing_direction().dot(pond_direction) > 0.99) fishing_spot.call("_begin_aiming", player) assert(fishing_spot.state == FishingSpotType.FishingState.AIMING_CAST) @@ -59,7 +86,9 @@ func _run() -> void: fishing_spot.set("_cast_charge", 0.32) fishing_spot.call("_update_cast_charge", 0.0) var aimed_target: Vector3 = fishing_spot.get("_cast_target") - assert(aimed_target.x < player.global_position.x - 0.85) + var aimed_direction := aimed_target - player.global_position + aimed_direction.y = 0.0 + assert(aimed_direction.normalized().dot(pond_direction) > 0.99) assert(is_equal_approx(aimed_target.y, pond_surface_y)) assert(fishing_spot.is_target_fishable(aimed_target)) fishing_spot.call("_confirm_cast") @@ -74,6 +103,7 @@ func _run() -> void: await process_frame assert(fishing_spot.state == FishingSpotType.FishingState.WAITING_FOR_BITE) assert(service.has_local_attempt()) + assert(player.bag.get_quantity(&"worms") == bait_quantity_before) assert(fishing_status.text.is_empty()) assert(not fishing_status.visible) assert(not fishing_panel.visible) @@ -108,6 +138,7 @@ func _run() -> void: assert(fishing_spot.state == FishingSpotType.FishingState.READY) assert(player.is_movement_enabled()) assert(not bobber.visible) + assert(player.bag.get_quantity(&"worms") == bait_quantity_before) # A private host rolls and retains the authoritative catch before the fight # so its quality selects the barrier band clients receive in snapshots. @@ -125,9 +156,18 @@ func _run() -> void: attempts = service.get("_attempts") attempt = attempts.get(session.get_local_peer_id()) assert(attempt != null) + assert(player.bag.get_quantity(&"worms") == bait_quantity_before) + var fishing_priority_transitions: Array[bool] = [] + fishing_spot.fishing_input_priority_changed.connect( + func(active: bool) -> void: + fishing_priority_transitions.append(active) + ) service.call("_start_bite", attempt) await process_frame assert(attempt.phase == NetworkFishingAttempt.Phase.FIGHTING) + assert(fishing_spot.is_fishing_input_priority_active()) + assert(fishing_priority_transitions == [true]) + assert(player.bag.get_quantity(&"worms") == bait_quantity_before - 1) var catalog: FishPool = main.get("fish_catalog") as FishPool assert(catalog != null) var fish: FishData = catalog.get_fish_by_id(attempt.fish_id) @@ -173,6 +213,7 @@ func _run() -> void: service.call("_on_attempt_escaped", session.get_local_peer_id()) await process_frame assert(not service.has_local_attempt()) + assert(fishing_spot.is_fishing_input_priority_active()) assert(fishing_status.text.is_empty()) assert(not fishing_status.visible) assert(not fishing_panel.visible) @@ -183,6 +224,8 @@ func _run() -> void: ): await process_frame assert(fishing_spot.state == FishingSpotType.FishingState.READY) + assert(not fishing_spot.is_fishing_input_priority_active()) + assert(fishing_priority_transitions == [true, false]) # Leaving a session during the cast presentation must release every local # action and equipment lock. This is the same cleanup path used by an @@ -202,6 +245,38 @@ func _run() -> void: assert(fishing_spot.can_change_hotbar_selection()) assert(fishing_spot.can_open_fishing_shop()) + # Escape can put the rod into RETURNING immediately before deep-water + # recovery begins. Recovery must finish that return before snapshotting its + # movement state, otherwise the respawn restores a permanent cast lock. + var water_recovery := main.get_node("%WaterRecovery") as WaterRecoveryController + assert(water_recovery != null) + var pause_menu: PauseMenu = game_ui.get_pause_menu() + pause_menu.open_menu() + assert(pause_menu.visible) + player.set_movement_enabled(false) + fishing_spot.set("_active_player", player) + fishing_spot.state = FishingSpotType.FishingState.RETURNING + water_recovery.call( + "_on_recovery_requested", + player, + player.global_position.y, + ) + assert(fishing_spot.state == FishingSpotType.FishingState.READY) + assert(bool(water_recovery.get("_prior_movement_enabled"))) + assert(bool(water_recovery.get("_prior_camera_input_enabled"))) + assert(not pause_menu.visible) + var test_world := main.get_node("TestWorld") as TestWorld + assert(test_world != null) + var recovery_entry := water_recovery.get("_entry_position") as Vector3 + var resolved_recovery := water_recovery.call( + "_resolve_recovery_position" + ) as Vector3 + assert(resolved_recovery.is_equal_approx( + test_world.get_water_recovery_position(recovery_entry) + )) + water_recovery.call("_finish_recovery") + assert(player.is_movement_enabled()) + print("Fishing authority validation: PASS") session.disconnect_session("") main.queue_free() diff --git a/tests/fishing_multiplayer_validation.gd b/tests/fishing_multiplayer_validation.gd index e19a92e..9d7ef7f 100644 --- a/tests/fishing_multiplayer_validation.gd +++ b/tests/fishing_multiplayer_validation.gd @@ -2,6 +2,7 @@ extends SceneTree const MainScene = preload("res://main/main.tscn") const FishingSpotType = preload("res://fishing/fishing_spot.gd") +const TEST_SEED: int = 864209 func _initialize() -> void: @@ -22,9 +23,23 @@ func _run() -> void: func _run_host() -> void: var main: Node = await _create_initialized_main() + assert(bool(main.call( + "_apply_world", + WorldLayout.STARTER_ISLAND, + TEST_SEED, + true, + ))) + assert(bool(main.call( + "_prepare_host_world", + WorldLayout.STARTER_ISLAND, + TEST_SEED, + ))) assert(bool(main.call("_prepare_private_host"))) var save_manager := main.get("_save_manager") as PlayerSaveManager - assert(save_manager.initialize_new_game()) + assert(save_manager.initialize_new_game( + TEST_SEED, + WorldLayout.STARTER_ISLAND, + )) main.call("_enter_gameplay") var session := main.get_node("%NetworkSession") as NetworkSession assert(session.set_host_open(true)) @@ -48,12 +63,38 @@ func _run_host() -> void: var spawn_service := main.get_node( "%PlayerSpawnService" ) as PlayerSpawnService + var network_home := main.get_node( + "%NetworkHomeService" + ) as NetworkHomeService + var home_world := main.get_node("%HomeWorldService") as HomeWorldService var remote_avatar: Player = spawn_service.get_avatar(remote_peer_id) assert(remote_avatar != null) assert(remote_avatar.bag.get_quantity(&"worms") == 0) - remote_avatar.global_position = Vector3(-0.5, 3.95, 2.1) - var remote_visuals := remote_avatar.get_node("Visuals") as Node3D - remote_visuals.rotation.y = PI * 0.5 + var remote_record := session.get_peer_record(remote_peer_id) + assert(remote_record != null) + assert(await _wait_for_home( + network_home, remote_record.identity_fingerprint + )) + var exterior_spawn: Transform3D = home_world.get_exterior_spawn_transform( + remote_record.identity_fingerprint + ) + var exterior_deadline: int = Time.get_ticks_msec() + 5000 + while ( + Time.get_ticks_msec() < exterior_deadline + and remote_avatar.global_position.distance_to(exterior_spawn.origin) > 0.25 + ): + await physics_frame + assert(remote_avatar.global_position.distance_to(exterior_spawn.origin) <= 0.25) + # Give the client enough local frames to observe the initial RV-door spawn + # before this test publishes its separate fishing-position teleport. + for _frame: int in 30: + await physics_frame + var cast_setup: Dictionary = await _find_clear_fishing_setup( + main, remote_avatar + ) + assert(not cast_setup.is_empty(), "no clear fishing setup was found") + var expected_position: Vector3 = cast_setup["position"] + var expected_direction: Vector3 = cast_setup["direction"] session.publish_authoritative_teleport(remote_peer_id) var aiming_deadline: int = Time.get_ticks_msec() + 15000 while ( @@ -67,7 +108,7 @@ func _run_host() -> void: == Player.FishingVisualPhase.CASTING ) var remote_position_error := ( - remote_avatar.global_position - Vector3(-0.5, 3.95, 2.1) + remote_avatar.global_position - expected_position ) remote_position_error.y = 0.0 assert( @@ -75,7 +116,7 @@ func _run_host() -> void: "remote casting position drifted: %s" % remote_avatar.global_position ) assert( - remote_avatar.get_facing_direction().dot(Vector3.LEFT) > 0.99, + remote_avatar.get_facing_direction().dot(expected_direction) > 0.99, "remote casting facing drifted: %s" % remote_avatar.get_facing_direction() ) @@ -181,6 +222,23 @@ func _run_client() -> void: joined = true break assert(joined) + var network_home := main.get_node( + "%NetworkHomeService" + ) as NetworkHomeService + var home_world := main.get_node("%HomeWorldService") as HomeWorldService + var local_fingerprint: String = session.get_local_identity_fingerprint() + assert(await _wait_for_home(network_home, local_fingerprint)) + var player := main.get("_player") as Player + var exterior_spawn: Transform3D = ( + home_world.get_exterior_spawn_transform(local_fingerprint) + ) + var home_spawn_deadline: int = Time.get_ticks_msec() + 5000 + while ( + Time.get_ticks_msec() < home_spawn_deadline + and player.global_position.distance_to(exterior_spawn.origin) > 0.25 + ): + await physics_frame + assert(player.global_position.distance_to(exterior_spawn.origin) <= 0.25) var service := main.get_node( "%NetworkFishingService" @@ -191,7 +249,6 @@ func _run_client() -> void: cast_rejections.append(message) ) var fishing_spot := main.get_node("%FishingSpot") as FishingSpotType - var player := main.get("_player") as Player var item_catalog := main.get("item_catalog") as ItemCatalog var worms: ItemData = item_catalog.get_item_by_id(&"worms") if player.bag.get_quantity(&"worms") == 0: @@ -202,29 +259,39 @@ func _run_client() -> void: "Visuals/CharacterRig/AnimationPlayer" ) as AnimationPlayer assert(character_animation_player.has_animation(&"retract_sit")) - var placement_deadline: int = Time.get_ticks_msec() + 5000 + # The host chooses and publishes a clear target after both RV manifests have + # settled. Waiting for that authoritative teleport also coordinates the + # animation-observation window between these two independent processes. + var placement_deadline: int = Time.get_ticks_msec() + 10000 while ( Time.get_ticks_msec() < placement_deadline - and player.global_position.distance_to(Vector3(-0.5, 3.95, 2.1)) - > 0.25 + and player.global_position.distance_to(exterior_spawn.origin) <= 1.0 ): await physics_frame - assert(player.global_position.distance_to(Vector3(-0.5, 3.95, 2.1)) <= 0.25) - assert(player.get_facing_direction().dot(Vector3.LEFT) > 0.99) + assert(player.global_position.distance_to(exterior_spawn.origin) > 1.0) + for _frame: int in 2: + await physics_frame + var expected_position: Vector3 = player.global_position + var expected_direction: Vector3 = player.get_facing_direction() player.set_casting_visual() assert( int(player.get("_fishing_visual_phase")) == Player.FishingVisualPhase.CASTING ) - for _frame: int in 30: + # Keep the transient pull-back pose visible long enough for the separate host + # process to observe it even when a cold validation run is CPU-bound. + for _frame: int in 120: await physics_frame player.set_fishing_visual(false) player.call("_set_sitting", true, true) assert(player.is_sitting()) for _frame: int in 15: await physics_frame + assert(fishing_spot.state == FishingSpotType.FishingState.READY) + assert(fishing_spot.get("_active_player") == null) fishing_spot.call("_begin_aiming", player) + assert(fishing_spot.state == FishingSpotType.FishingState.AIMING_CAST) assert(player.is_movement_enabled()) assert( int(player.get("_fishing_visual_phase")) @@ -233,6 +300,7 @@ func _run_client() -> void: var cast_charge: float = 0.0 var target: Vector3 = Vector3.ZERO var cast_origin: Vector3 = fishing_spot.get("_cast_origin_position") + var target_diagnostics: Array[String] = [] for charge_step: int in range(1, 21): var candidate_charge := float(charge_step) / 20.0 fishing_spot.set("_cast_charge", candidate_charge) @@ -241,14 +309,33 @@ func _run_client() -> void: var candidate_surface := fishing_spot.get( "_aim_surface_sample" ) as FishingSurfaceSample + target_diagnostics.append( + "charge=%.2f surface=%s path=%s target=%s" % [ + candidate_charge, + candidate_surface.is_fishable(), + fishing_spot.get("_cast_path_is_clear"), + candidate_target, + ] + ) if ( candidate_surface.is_fishable() - and fishing_spot.is_cast_path_clear(cast_origin, candidate_target) + and bool(fishing_spot.get("_cast_path_is_clear")) ): cast_charge = candidate_charge target = candidate_target break - assert(cast_charge > 0.0, "no clear fishable test target was found") + assert( + cast_charge > 0.0, + ( + "no clear fishable test target was found; position=%s facing=%s " + + "expected=%s diagnostics=%s" + ) % [ + player.global_position, + player.get_facing_direction(), + expected_direction, + target_diagnostics, + ], + ) var evidence: Dictionary = fishing_spot.call("_build_network_evidence") fishing_spot.set("state", FishingSpotType.FishingState.CASTING) player.set_movement_enabled(false) @@ -285,7 +372,9 @@ func _run_client() -> void: ] ) assert(service.has_local_attempt()) - assert(player.bag.get_quantity(&"worms") == worms_before_cast - 1) + # Bait remains available while the bobber is waiting. It is consumed only + # once the authoritative bite begins. + assert(player.bag.get_quantity(&"worms") == worms_before_cast) var fishing_deadline: int = Time.get_ticks_msec() + 5000 while ( Time.get_ticks_msec() < fishing_deadline @@ -369,3 +458,79 @@ func _create_initialized_main() -> Node: await process_frame assert(bool(main.get("_application_initialized"))) return main + + +func _wait_for_home( + network_home: NetworkHomeService, + fingerprint: String, +) -> bool: + var deadline: int = Time.get_ticks_msec() + 10000 + while Time.get_ticks_msec() < deadline: + await process_frame + var manifests: Dictionary = network_home.get( + "_manifests_by_fingerprint" + ) + if manifests.has(fingerprint): + return true + return false + + +func _find_clear_fishing_setup(main: Node, player: Player) -> Dictionary: + var world := main.get_node("TestWorld") as TestWorld + var fishing_spot := main.get_node("%FishingSpot") as FishingSpotType + var regions: Array[FishableWaterRegion] = world.get_fishable_water_regions() + for region: FishableWaterRegion in regions: + var body := region.get_parent() as WaterBodyAuthoring + if body == null or body.surface_size.x <= 0.0 or body.surface_size.y <= 0.0: + continue + var center: Vector3 = region.global_position + var half_size: Vector2 = body.surface_size * 0.5 + var candidate_offsets: Array[Vector3] = [ + Vector3(half_size.x + 0.8, 0.0, 0.0), + Vector3(-half_size.x - 0.8, 0.0, 0.0), + Vector3(0.0, 0.0, half_size.y + 0.8), + Vector3(0.0, 0.0, -half_size.y - 0.8), + ] + for offset: Vector3 in candidate_offsets: + var position := Vector3( + center.x + offset.x, + region.get_surface_height() + 1.44, + center.z + offset.z, + ) + var direction: Vector3 = center - position + direction.y = 0.0 + direction = direction.normalized() + player.global_position = position + var visuals := player.get_node("Visuals") as Node3D + visuals.global_rotation.y = atan2(-direction.x, -direction.z) + for _frame: int in 2: + await physics_frame + var cast_origin: Vector3 = player.get_cast_origin_position() + var launch_position: Vector3 = player.get_fishing_rod_tip().global_position + for charge_step: int in range(1, 21): + var cast_charge := float(charge_step) / 20.0 + var cast_distance := lerpf( + fishing_spot.minimum_cast_distance, + fishing_spot.maximum_cast_distance, + cast_charge, + ) + var query_position := cast_origin + direction * cast_distance + var sample: FishingSurfaceSample = ( + fishing_spot.resolve_fishing_surface( + query_position, cast_origin.y + ) + ) + var target: Vector3 = sample.get_bobber_position( + fishing_spot.solid_bobber_clearance + ) + if ( + sample.is_fishable() + and fishing_spot.is_cast_path_clear( + launch_position, target + ) + ): + return { + "position": player.global_position, + "direction": direction, + } + return {} diff --git a/tests/fishing_shop_controller_validation.gd b/tests/fishing_shop_controller_validation.gd new file mode 100644 index 0000000..488a01e --- /dev/null +++ b/tests/fishing_shop_controller_validation.gd @@ -0,0 +1,105 @@ +extends SceneTree + +const FishingShopScene: PackedScene = preload( + "res://ui/fishing_shop.tscn" +) + + +func _initialize() -> void: + call_deferred("_run") + + +func _run() -> void: + root.size = Vector2i(1280, 720) + var shop := FishingShopScene.instantiate() as FishingShop + root.add_child(shop) + shop.show() + await process_frame + + var tabs: Array = shop.get("_shop_tabs") as Array + assert(tabs.size() == FishingShop.ShopSection.size()) + var supplies_list := shop.get_node("%SuppliesList") as VBoxContainer + var dummy_stock := Button.new() + dummy_stock.name = "ControllerTestStock" + dummy_stock.text = "test stock" + supplies_list.add_child(dummy_stock) + var activations: Array[int] = [0] + dummy_stock.pressed.connect( + func() -> void: + activations[0] += 1 + ) + + var accept := InputEventJoypadButton.new() + accept.button_index = JOY_BUTTON_A + accept.pressed = true + var accept_release := InputEventJoypadButton.new() + accept_release.button_index = JOY_BUTTON_A + accept_release.pressed = false + var cancel := InputEventJoypadButton.new() + cancel.button_index = JOY_BUTTON_B + cancel.pressed = true + + for section_index: int in range(FishingShop.ShopSection.ART_SUPPLIES + 1): + shop.set("_shop_section", section_index) + shop.call("_select_shop_section", section_index, false) + shop.call("_enter_shop_tabs_zone") + for _frame: int in 2: + await process_frame + var tab := tabs[section_index] as Button + assert( + root.gui_get_focus_owner() == tab, + "section %d tab focus mismatch: focused=%s tab=%s visible=%s mode=%d" + % [ + section_index, + root.gui_get_focus_owner(), + tab, + tab.is_visible_in_tree(), + tab.focus_mode, + ], + ) + assert( + shop.get("_controller_zone") + == FishingShop.ControllerZone.TABS + ) + shop.call("_input", accept) + for _frame: int in 2: + await process_frame + assert(int(shop.get("_shop_section")) == section_index) + assert( + shop.get("_controller_zone") + == FishingShop.ControllerZone.CONTENT + ) + assert(not _array_contains_control( + tabs, + root.gui_get_focus_owner(), + )) + if section_index == FishingShop.ShopSection.BAIT: + assert(root.gui_get_focus_owner() == dummy_stock) + Input.parse_input_event(accept) + await process_frame + Input.parse_input_event(accept_release) + await process_frame + assert(activations[0] == 1) + shop.call("_input", cancel) + for _frame: int in 2: + await process_frame + assert(shop.visible) + assert( + shop.get("_controller_zone") + == FishingShop.ControllerZone.TABS + ) + assert(root.gui_get_focus_owner() == tab) + + shop.hide() + shop.queue_free() + await process_frame + print("Fishing shop controller validation: PASS") + quit() + + +func _array_contains_control(values: Array, target: Control) -> bool: + for value: Variant in values: + var control := value as Control + if control == target: + return true + return false diff --git a/tests/fishing_shop_controller_validation.gd.uid b/tests/fishing_shop_controller_validation.gd.uid new file mode 100644 index 0000000..228bf9b --- /dev/null +++ b/tests/fishing_shop_controller_validation.gd.uid @@ -0,0 +1 @@ +uid://duwikmb08papi diff --git a/tests/fishing_surface_validation.gd b/tests/fishing_surface_validation.gd index b3ca57c..8248c36 100644 --- a/tests/fishing_surface_validation.gd +++ b/tests/fishing_surface_validation.gd @@ -151,6 +151,12 @@ func _validate_portable_water_body() -> void: water_body.set("surface_size", Vector2(12.0, 8.0)) water_body.set("fishing_depth", 6.0) water_body.set("recovery_depth", 7.0) + water_body.set( + "recovery_entry_height_reference", + PlayerWaterTrigger.EntryHeightReference.PLAYER_ORIGIN, + ) + water_body.set("recovery_entry_depth_threshold", 0.1) + water_body.set("recovery_entry_confirmation_seconds", 0.2) water_body.set("fish_pool", PondPool) root.add_child(water_body) await process_frame @@ -169,8 +175,43 @@ func _validate_portable_water_body() -> void: assert(is_equal_approx(fishing_region.get_surface_height(), 7.0)) assert(is_equal_approx(fishing_shape_node.position.y, -3.0)) assert(fishing_shape.size.is_equal_approx(Vector3(12.0, 6.0, 8.0))) - var recovery_region := water_body.get_node("RecoveryRegion") as Area3D + var recovery_region := ( + water_body.get_node("RecoveryRegion") as PlayerWaterTrigger + ) assert(is_equal_approx(recovery_region.position.y, -3.5)) + assert( + recovery_region.entry_height_reference + == PlayerWaterTrigger.EntryHeightReference.PLAYER_ORIGIN + ) + assert(is_equal_approx(recovery_region.entry_depth_threshold, 0.1)) + assert(is_equal_approx(recovery_region.entry_confirmation_seconds, 0.2)) + + var recovery_player := PlayerScene.instantiate() as Player + assert(recovery_player != null) + root.add_child(recovery_player) + recovery_player.set_process(false) + recovery_player.set_physics_process(false) + var recovery_requests: Array[float] = [] + recovery_region.recovery_requested.connect( + func(_player: Player, requested_surface_height: float) -> void: + recovery_requests.append(requested_surface_height) + ) + recovery_region.call("_on_body_entered", recovery_player) + recovery_player.global_position.y = 6.8 + recovery_region.call("_physics_process", 0.1) + assert(recovery_requests.is_empty()) + # Breaking the submersion resets confirmation rather than carrying a stale + # partial fall into a later jump. + recovery_player.global_position.y = 7.0 + recovery_region.call("_physics_process", 0.1) + recovery_player.global_position.y = 6.8 + recovery_region.call("_physics_process", 0.11) + assert(recovery_requests.is_empty()) + recovery_region.call("_physics_process", 0.1) + assert(recovery_requests == [7.0]) + recovery_region.call("_on_body_exited", recovery_player) + recovery_player.queue_free() + await process_frame water_body.queue_free() await process_frame @@ -199,6 +240,59 @@ func _validate_portable_water_body() -> void: mesh_derived_body.queue_free() await process_frame + var polygon_body := WaterBodyScene.instantiate() as WaterBodyAuthoring + polygon_body.position = Vector3(30.0, 5.0, 20.0) + polygon_body.surface_polygon = PackedVector2Array([ + Vector2(-4.0, -4.0), + Vector2(4.0, -4.0), + Vector2(4.0, 4.0), + Vector2(0.0, 1.0), + Vector2(-4.0, 4.0), + ]) + polygon_body.visual_surface_enabled = false + polygon_body.fish_pool = PondPool + root.add_child(polygon_body) + await physics_frame + await physics_frame + + var polygon_fishing_region := polygon_body.get_node( + "FishingRegion" + ) as FishableWaterRegionType + var polygon_recovery_region := polygon_body.get_node( + "RecoveryRegion" + ) as Area3D + assert(polygon_fishing_region.get_child_count() == 3) + assert(polygon_recovery_region.get_child_count() == 3) + for child: Node in polygon_fishing_region.get_children(): + var polygon_shape_node := child as CollisionShape3D + assert(polygon_shape_node != null) + assert(polygon_shape_node.shape is ConvexPolygonShape3D) + + var polygon_resolver := FishingSurfaceResolverType.new() + var polygon_space_state := ( + polygon_body.get_world_3d().direct_space_state + ) + var polygon_inside: FishingSurfaceSampleType = ( + polygon_resolver.resolve_surface( + polygon_space_state, + Vector3(30.0, 0.0, 20.0), + 8.0, + ) + ) + assert(polygon_inside.is_fishable()) + assert(is_equal_approx(polygon_inside.position.y, 5.0)) + var polygon_notch: FishingSurfaceSampleType = ( + polygon_resolver.resolve_surface( + polygon_space_state, + Vector3(30.0, 0.0, 23.0), + 8.0, + ) + ) + assert(not polygon_notch.has_surface) + + polygon_body.queue_free() + await process_frame + func _validate_starter_region_surfaces() -> void: var region := StarterRegionScene.instantiate() as Node3D @@ -232,10 +326,13 @@ func _validate_starter_region_surfaces() -> void: assert(is_equal_approx(ocean.position.y, -0.45)) var ocean_visual := region.get_node( "WaterBodies/Ocean/VisualWater" - ) as MeshInstance3D + ) as WaterSurfaceMotion assert(ocean_visual != null) - assert(is_equal_approx(ocean_visual.global_position.y, ocean.position.y)) - assert(not ocean_visual.is_processing()) + assert(ocean_visual.is_processing()) + assert( + absf(ocean_visual.global_position.y - ocean.position.y) + <= ocean_visual.amplitude + 0.0001 + ) var ocean_shapes := region.get_node( "WaterBodies/Ocean/FishingRegions/OceanFishingRegion" ).get_children() @@ -422,7 +519,7 @@ func _validate_remote_presentation() -> void: await process_frame var origin: Vector3 = player.get_fishing_rod_tip().global_position var target: Vector3 = origin + Vector3(-4.0, -0.5, 0.0) - presentation.show_cast(origin, target) + presentation.show_cast(origin, target, "cast-attempt") var bobber := presentation.get("_bobber") as MeshInstance3D assert(bobber.visible) assert(presentation.get("_cast_tween") != null) @@ -432,6 +529,22 @@ func _validate_remote_presentation() -> void: await create_timer(0.2).timeout assert(not is_equal_approx(bobber.global_position.y, first_bob_y)) + # A client joining after the reliable cast event reconstructs the current + # remote fishing state from the observer summary instead of waiting for the + # next cast. This also covers a bite/fighting transition received by an + # already active observer. + presentation.cleanup() + presentation.synchronize_active("late-attempt", target, false) + assert(bobber.visible) + assert( + int(player.get("_fishing_visual_phase")) + == Player.FishingVisualPhase.FISHING + ) + presentation.synchronize_active("late-attempt", target, true) + assert(bool(player.get("_fighting_visual_active"))) + presentation.synchronize_active("late-attempt", target, false) + assert(not bool(player.get("_fighting_visual_active"))) + var fish_catch := FishCatchType.new() var fish: FishData = PondPool.candidates.front() fish_catch.fish = fish diff --git a/tests/friend_multiplayer_validation.gd b/tests/friend_multiplayer_validation.gd new file mode 100644 index 0000000..f8ef64d --- /dev/null +++ b/tests/friend_multiplayer_validation.gd @@ -0,0 +1,161 @@ +extends SceneTree + +const MainScene: PackedScene = preload("res://main/main.tscn") +const TEST_PORT: int = 18196 + + +func _initialize() -> void: + call_deferred("_run") + + +func _run() -> void: + var arguments := OS.get_cmdline_user_args() + if arguments.has("host"): + await _run_host() + return + if arguments.has("client"): + await _run_client() + return + push_error("Friend multiplayer validation needs host or client mode.") + quit(1) + + +func _run_host() -> void: + var main := await _create_initialized_main() + var session := main.get_node("%NetworkSession") as NetworkSession + var save_manager := main.get("_save_manager") as PlayerSaveManager + assert(bool(main.call( + "_apply_world", WorldLayout.STARTER_ISLAND, 1, true + ))) + assert(session.set_host_world(WorldLayout.STARTER_ISLAND, 1)) + assert(session.start_private_host(TEST_PORT)) + assert(save_manager.initialize_new_game()) + main.call("_enter_gameplay") + for _frame: int in 4: + await physics_frame + assert(session.set_host_open(true)) + + var remote_peer_id := await _wait_for_remote_peer(session) + assert(remote_peer_id > 1) + assert(session.peer_supports_capability( + remote_peer_id, NetworkProtocol.FRIENDS_CAPABILITY + )) + var remote_record := session.get_peer_record(remote_peer_id) + assert(remote_record != null) + var game_ui := main.get_node("%GameUI") as GameUI + var prompt_deadline := Time.get_ticks_msec() + 8000 + while ( + Time.get_ticks_msec() < prompt_deadline + and not game_ui.is_social_prompt_open() + ): + await process_frame + assert(game_ui.is_social_prompt_open()) + await create_timer(0.15).timeout + game_ui.call("_accept_social_prompt") + + var relationships := main.get_node( + "%PlayerRelationshipStore" + ) as PlayerRelationshipStore + var accepted_deadline := Time.get_ticks_msec() + 8000 + while ( + Time.get_ticks_msec() < accepted_deadline + and not relationships.is_friend(remote_record.identity_fingerprint) + ): + await process_frame + assert(relationships.is_friend(remote_record.identity_fingerprint)) + var friend := relationships.get_friend_record( + remote_record.identity_fingerprint + ) + assert(not str(friend.get("remote_presence_channel", "")).is_empty()) + assert(not str(friend.get("remote_invite_token", "")).is_empty()) + + var disconnect_deadline := Time.get_ticks_msec() + 8000 + while ( + Time.get_ticks_msec() < disconnect_deadline + and session.is_authenticated_peer(remote_peer_id) + ): + await process_frame + assert(not session.is_authenticated_peer(remote_peer_id)) + print("Friend multiplayer host validation: PASS") + await _cleanup(main, session) + + +func _run_client() -> void: + var main := await _create_initialized_main() + main.call( + "_on_title_join_game_requested", + "127.0.0.1:%d" % TEST_PORT, + ) + var session := main.get_node("%NetworkSession") as NetworkSession + var join_deadline := Time.get_ticks_msec() + 20000 + while Time.get_ticks_msec() < join_deadline: + await process_frame + if session.state == NetworkSession.State.VERIFYING_SERVER_IDENTITY: + main.call("_confirm_server_trust") + if session.is_joined_client() and bool(main.get("_gameplay_started")): + break + assert(session.is_joined_client()) + assert(session.supports_server_capability( + NetworkProtocol.FRIENDS_CAPABILITY + )) + var host_record := session.get_peer_record(1) + assert(host_record != null) + var service := main.get_node( + "%NetworkPlayerListService" + ) as NetworkPlayerListService + assert(service.send_friend_request( + 1, + host_record.identity_fingerprint, + host_record.display_name, + )) + + var relationships := main.get_node( + "%PlayerRelationshipStore" + ) as PlayerRelationshipStore + var accepted_deadline := Time.get_ticks_msec() + 8000 + while ( + Time.get_ticks_msec() < accepted_deadline + and not relationships.is_friend(host_record.identity_fingerprint) + ): + await process_frame + assert(relationships.is_friend(host_record.identity_fingerprint)) + var friend := relationships.get_friend_record( + host_record.identity_fingerprint + ) + assert(not str(friend.get("remote_presence_channel", "")).is_empty()) + assert(not str(friend.get("remote_invite_token", "")).is_empty()) + print("Friend multiplayer client validation: PASS") + await _cleanup(main, session) + + +func _create_initialized_main() -> Node: + root.size = Vector2i(1280, 720) + var main := MainScene.instantiate() + root.add_child(main) + for _frame: int in 4: + await process_frame + if not bool(main.get("_application_initialized")): + main.call("_activate_selected_data_path", "", true) + for _frame: int in 8: + await process_frame + assert(bool(main.get("_application_initialized"))) + return main + + +func _wait_for_remote_peer(session: NetworkSession) -> int: + var deadline := Time.get_ticks_msec() + 20000 + while Time.get_ticks_msec() < deadline: + await process_frame + for peer_id: int in session.get_authenticated_peer_ids(): + if peer_id != session.get_local_peer_id(): + return peer_id + return 0 + + +func _cleanup(main: Node, session: NetworkSession) -> void: + session.disconnect_session("") + main.queue_free() + for _frame: int in 4: + await process_frame + await create_timer(0.1).timeout + quit() diff --git a/tests/friend_multiplayer_validation.gd.uid b/tests/friend_multiplayer_validation.gd.uid new file mode 100644 index 0000000..d243a6b --- /dev/null +++ b/tests/friend_multiplayer_validation.gd.uid @@ -0,0 +1 @@ +uid://cxltqyom4yt3j diff --git a/tests/friend_relationship_validation.gd b/tests/friend_relationship_validation.gd new file mode 100644 index 0000000..ce6bd90 --- /dev/null +++ b/tests/friend_relationship_validation.gd @@ -0,0 +1,76 @@ +extends SceneTree + +const FRIEND_FINGERPRINT := ( + "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" +) + + +func _initialize() -> void: + call_deferred("_run") + + +func _run() -> void: + var data_root := PlayerDataRoot.new() + root.add_child(data_root) + var portable_path := ProjectSettings.globalize_path( + "user://friend-relationship-validation" + ) + var created := data_root.create_unbound_root(portable_path) + assert(bool(created.get("ok", false))) + assert(data_root.activate_process_root(portable_path)) + + var store := PlayerRelationshipStore.new() + root.add_child(store) + store.configure_storage( + data_root.path_for(&"player_relationships"), data_root + ) + var local_capabilities := store.create_friend_capabilities() + var remote_capabilities := store.create_friend_capabilities() + assert(not local_capabilities.is_empty()) + assert(not remote_capabilities.is_empty()) + assert(store.add_friend( + FRIEND_FINGERPRINT, + "Pond Friend", + local_capabilities, + { + "presence_channel": remote_capabilities["presence_channel"], + "invite_token": remote_capabilities["invite_token"], + }, + )) + assert(store.is_friend(FRIEND_FINGERPRINT)) + + var reloaded := PlayerRelationshipStore.new() + root.add_child(reloaded) + reloaded.configure_storage( + data_root.path_for(&"player_relationships"), data_root + ) + assert(reloaded.is_friend(FRIEND_FINGERPRINT)) + var friend := reloaded.get_friend_record(FRIEND_FINGERPRINT) + assert( + str(friend["remote_presence_channel"]) + == str(remote_capabilities["presence_channel"]) + ) + assert( + str(friend["remote_invite_token"]) + == str(remote_capabilities["invite_token"]) + ) + assert(reloaded.set_blocked(FRIEND_FINGERPRINT, "Pond Friend", true)) + assert(reloaded.is_blocked(FRIEND_FINGERPRINT)) + assert(reloaded.is_muted(FRIEND_FINGERPRINT)) + assert(not reloaded.is_friend(FRIEND_FINGERPRINT)) + assert(reloaded.set_blocked(FRIEND_FINGERPRINT, "Pond Friend", false)) + assert(not reloaded.is_blocked(FRIEND_FINGERPRINT)) + assert(not reloaded.is_muted(FRIEND_FINGERPRINT)) + assert(not reloaded.is_friend(FRIEND_FINGERPRINT)) + + var hello := NetworkProtocol.make_client_hello( + "profile", + "Pond Friend", + "nonce", + ) + assert( + NetworkProtocol.FRIENDS_CAPABILITY + in PackedStringArray(hello.get("capability_flags", [])) + ) + print("Friend relationship validation: PASS") + quit() diff --git a/tests/friend_relationship_validation.gd.uid b/tests/friend_relationship_validation.gd.uid new file mode 100644 index 0000000..aa2acaf --- /dev/null +++ b/tests/friend_relationship_validation.gd.uid @@ -0,0 +1 @@ +uid://d3v4e1xtu8ytq diff --git a/tests/fur_pattern_validation.gd b/tests/fur_pattern_validation.gd index 135c507..a795d53 100644 --- a/tests/fur_pattern_validation.gd +++ b/tests/fur_pattern_validation.gd @@ -287,10 +287,13 @@ func _validate_fur_color_ui(snapshot: Dictionary) -> void: ) as ColorPickerButton var picker_popup := picker.get_popup() var picker_control := picker.get_picker() - assert(color_panel != null and color_panel.size.x > 360.0) - assert(channel_grid != null and channel_grid.columns == 4) + var option_list := profile_page.get("_option_list") as Control + assert(color_panel != null and option_list != null) + assert(color_panel.size.x > 0.0) + assert(color_panel.size.x <= option_list.size.x + 0.5) + assert(channel_grid != null and channel_grid.columns == 2) assert(channel_grid.get_child_count() == 4) - assert(palette_grid != null and palette_grid.columns == 10) + assert(palette_grid != null and palette_grid.columns == 6) assert(palette_grid.get_child_count() == 30) for option_button: Button in palette_grid.get_children(): assert( @@ -384,6 +387,19 @@ func _validate_fur_color_ui(snapshot: Dictionary) -> void: "panel" ) as StyleBoxFlat assert(first_swatch_style.bg_color.is_equal_approx(live_custom_color)) + picker_popup.popup_centered() + for _frame: int in 2: + await process_frame + picker_popup.hide() + for _frame: int in 3: + await process_frame + assert(is_instance_valid(picker)) + assert(picker.is_inside_tree()) + assert( + profile_page.find_child( + "FurCustomColorPicker", true, false + ) == picker + ) profile_page.free() await process_frame diff --git a/tests/gathering_marker_surface_validation.gd b/tests/gathering_marker_surface_validation.gd new file mode 100644 index 0000000..72f15f0 --- /dev/null +++ b/tests/gathering_marker_surface_validation.gd @@ -0,0 +1,101 @@ +extends SceneTree + +const PlayerScene: PackedScene = preload("res://player/player.tscn") +const GatheringControllerType = preload( + "res://gathering/gathering_controller.gd" +) + + +func _initialize() -> void: + call_deferred("_run") + + +func _run() -> void: + var player := PlayerScene.instantiate() as Player + root.add_child(player) + player.set_process(false) + player.set_physics_process(false) + + var controller := GatheringControllerType.new() + root.add_child(controller) + controller.set("_player", player) + + var wall := _make_surface( + Vector3(2.0, 2.0, 0.1), + Vector3(0.0, 0.9, -1.1), + ) + root.add_child(wall) + await physics_frame + controller.call("_update_marker_target") + var marker := controller.get("_marker") as MeshInstance3D + assert(marker != null) + var disc := marker.mesh as CylinderMesh + assert(disc != null) + assert(is_equal_approx(disc.top_radius, controller.marker_radius)) + assert(is_equal_approx(disc.bottom_radius, controller.marker_radius)) + var invalid_material := controller.get( + "_marker_invalid_material" + ) as StandardMaterial3D + var valid_material := controller.get( + "_marker_valid_material" + ) as StandardMaterial3D + assert(invalid_material != null) + assert(valid_material != null) + assert(invalid_material.albedo_color == Color.WHITE) + assert(is_equal_approx(invalid_material.albedo_color.a, 1.0)) + assert(is_equal_approx(valid_material.albedo_color.a, 1.0)) + assert(invalid_material.no_depth_test) + assert(valid_material.no_depth_test) + assert( + invalid_material.shading_mode + == BaseMaterial3D.SHADING_MODE_UNSHADED + ) + assert( + valid_material.shading_mode + == BaseMaterial3D.SHADING_MODE_UNSHADED + ) + assert(bool(controller.get("_marker_has_surface"))) + assert(marker.global_basis.y.dot(Vector3.BACK) > 0.99) + + wall.queue_free() + await process_frame + var floor := _make_surface( + Vector3(10.0, 0.2, 10.0), + Vector3(0.0, -0.1, -1.7), + ) + root.add_child(floor) + await physics_frame + controller.call("_update_marker_target") + assert(bool(controller.get("_marker_has_surface"))) + assert(marker.global_basis.y.dot(Vector3.UP) > 0.99) + assert(is_equal_approx(absf(marker.global_basis.determinant()), 1.0)) + var horizontal_marker_offset := Vector2( + marker.global_position.x - player.global_position.x, + marker.global_position.z - player.global_position.z, + ).length() + assert( + is_equal_approx( + horizontal_marker_offset, + controller.marker_distance, + ) + ) + + floor.queue_free() + controller.queue_free() + player.queue_free() + await process_frame + print("Gathering marker surface validation: PASS") + quit() + + +func _make_surface(size: Vector3, position: Vector3) -> StaticBody3D: + var body := StaticBody3D.new() + body.position = position + body.collision_layer = 1 + body.collision_mask = 0 + var collision := CollisionShape3D.new() + var shape := BoxShape3D.new() + shape.size = size + collision.shape = shape + body.add_child(collision) + return body diff --git a/tests/gathering_marker_surface_validation.gd.uid b/tests/gathering_marker_surface_validation.gd.uid new file mode 100644 index 0000000..044defc --- /dev/null +++ b/tests/gathering_marker_surface_validation.gd.uid @@ -0,0 +1 @@ +uid://ddsf88kuxgsqp diff --git a/tests/gathering_showcase_validation.gd b/tests/gathering_showcase_validation.gd index 0138bad..51d6f38 100644 --- a/tests/gathering_showcase_validation.gd +++ b/tests/gathering_showcase_validation.gd @@ -21,17 +21,28 @@ func _run() -> void: assert(bool(main.get("_application_initialized"))) var session := main.get_node("%NetworkSession") as NetworkSession + assert(bool(main.call( + "_apply_world", WorldLayout.STARTER_ISLAND, 1, true + ))) + assert(session.set_host_world(WorldLayout.STARTER_ISLAND, 1)) assert(session.start_private_host(TEST_PORT)) var save_manager := main.get("_save_manager") as PlayerSaveManager - assert(save_manager.initialize_new_game()) + assert(save_manager.initialize_new_game(1, WorldLayout.STARTER_ISLAND)) main.call("_enter_gameplay") for _frame: int in 8: await process_frame var player := main.get("_player") as Player var fishing_spot := main.get_node("%FishingSpot") as FishingSpot + var game_ui := main.get_node("%GameUI") as GameUI var catalog := main.get("fish_catalog") as FishPool - assert(player != null and fishing_spot != null and catalog != null) + assert( + player != null + and fishing_spot != null + and game_ui != null + and catalog != null + ) + fishing_spot.minimum_showcase_duration = 1.0 assert(player.bag.add_item(&"crab_net")) assert(player.hotbar.assign_item(0, &"crab_net")) assert(player.hotbar.select_slot(0)) @@ -58,17 +69,41 @@ func _run() -> void: assert(fishing_spot.present_external_catch(crab_catch)) assert(fishing_spot.state == FishingSpot.FishingState.SHOWING_CATCH) assert(not player.is_movement_enabled()) + # Network attempt cleanup may restore the base movement flag before the + # presentation finishes. The showcase owns a separate local-input lock. + player.set_movement_enabled(true) + assert(not bool(player.call("_is_movement_input_enabled"))) + assert(not bool(player.call("_is_camera_input_enabled"))) Input.action_release("fish_primary") await process_frame - assert(bool(fishing_spot.get("_put_away_press_armed"))) + assert(not bool(fishing_spot.get("_put_away_press_armed"))) var pocket_event := InputEventAction.new() pocket_event.action = &"fish_primary" pocket_event.pressed = true Input.parse_input_event(pocket_event) await process_frame + assert(fishing_spot.get("_pending_catch") == crab_catch) + Input.action_release("fish_primary") + fishing_spot.set("_showcase_input_lock_remaining", 0.0) + await process_frame + assert(bool(fishing_spot.get("_put_away_press_armed"))) + Input.parse_input_event(pocket_event) + await process_frame assert(fishing_spot.get("_pending_catch") == null) + # A radial menu can open after the showcase panel disappears but before the + # pocket animation restores gameplay. Its camera lock must not overwrite the + # showcase's underlying camera state when the two finish in either order. + Input.action_press("open_emotes") + var emote_press := InputEventAction.new() + emote_press.action = &"open_emotes" + emote_press.pressed = true + game_ui.call("_input", emote_press) + var emote_menu := game_ui.get_node("%EmoteRadialMenu") as EmoteRadialMenu + assert(emote_menu.is_open()) + assert(not bool(player.call("_is_camera_input_enabled"))) + var pocket_deadline: int = Time.get_ticks_msec() + 6000 while ( Time.get_ticks_msec() < pocket_deadline @@ -77,6 +112,25 @@ func _run() -> void: await process_frame assert(fishing_spot.state == FishingSpot.FishingState.READY) assert(player.is_movement_enabled()) + assert(bool(player.call("_is_movement_input_enabled"))) + assert(not bool(player.call("_is_camera_input_enabled"))) + Input.action_release("open_emotes") + var emote_release := InputEventAction.new() + emote_release.action = &"open_emotes" + emote_release.pressed = false + game_ui.call("_input", emote_release) + assert(not emote_menu.is_open()) + assert(bool(player.call("_is_camera_input_enabled"))) + + # A focused chat field or popup can consume the wheel's release event. The + # polled action state must still close the radial and release its camera lock. + Input.action_press("open_emotes") + game_ui.call("_input", emote_press) + assert(emote_menu.is_open()) + Input.action_release("open_emotes") + await process_frame + assert(not emote_menu.is_open()) + assert(bool(player.call("_is_camera_input_enabled"))) assert(player.inventory.contains_catch_id(crab_catch.catch_id)) assert(bool(player.get("_active_item_is_net"))) print("Gathering showcase validation: PASS") diff --git a/tests/generated_world_runtime_validation.gd b/tests/generated_world_runtime_validation.gd new file mode 100644 index 0000000..6a3f6c8 --- /dev/null +++ b/tests/generated_world_runtime_validation.gd @@ -0,0 +1,1733 @@ +extends SceneTree + +const RegionScene: PackedScene = preload( + "res://world/generation/generated_world_region.tscn" +) +const GeneratedPondPool: FishPool = preload( + "res://fish/pools/generated_pond_pool.tres" +) +const GeneratedLakePool: FishPool = preload( + "res://fish/pools/generated_lake_pool.tres" +) +const GeneratedRiverPool: FishPool = preload( + "res://fish/pools/generated_river_pool.tres" +) +const PrecipitationOcclusionType = preload( + "res://world/environment/precipitation_occlusion.gd" +) +const FIRST_SEED := 13001 +const SECOND_SEED := 13002 +const RIVER_FALLBACK_SEED := 13012 +const EXPECTED_PROP_IDS: Array[StringName] = [ + &"prop_bridge", + &"prop_dock", + &"prop_log", + &"prop_log_post_1", + &"prop_log_post_2", + &"prop_mushroom", + &"prop_palm", + &"prop_pine", + &"prop_pine_large", + &"prop_timber_1", + &"prop_timber_2", + &"prop_tree_1", + &"prop_tree_2", + &"prop_tree_3", + &"prop_tree_large", +] +const EXPECTED_BIOME_IDS: Array[StringName] = [ + &"biome_plains", + &"biome_forest", + &"biome_pine_forest", + &"biome_coast", +] +const PROCEDURAL_PROP_IDS: Array[StringName] = [ + &"prop_log", + &"prop_mushroom", + &"prop_palm", + &"prop_pine", + &"prop_pine_large", + &"prop_tree_1", + &"prop_tree_2", + &"prop_tree_3", + &"prop_tree_large", +] + + +func _initialize() -> void: + call_deferred(&"_run") + + +func _run() -> void: + var region := RegionScene.instantiate() as GeneratedWorldRegion + assert(region != null) + var configured_generator := region.get_node( + "Terrain/TerrainChunkGenerator" + ) as TerrainChunkGenerator + assert(configured_generator != null) + configured_generator.elevated_cliff_third_level_chance = 1.0 + configured_generator.elevated_cliff_third_tier_base_chance = 0.0 + configured_generator.elevated_cliff_third_tier_stack_chance = 1.0 + configured_generator.elevated_cliff_double_third_tier_chance = 0.0 + root.add_child(region) + await process_frame + assert(region.generate_world(FIRST_SEED)) + await physics_frame + + var generator := region.get_node( + "Terrain/TerrainChunkGenerator" + ) as TerrainChunkGenerator + assert(generator != null) + assert(region.get_generation_seed() == FIRST_SEED) + _validate_generated_region(region, generator) + + var first_layout := generator.placement_keys() + var first_stacked_layout := generator.stacked_elevated_placement_keys() + var first_biomes := _biome_signature(region, generator) + var first_decorations := _decoration_signature(region) + assert(region.generate_world(FIRST_SEED)) + assert(generator.placement_keys() == first_layout) + assert(_biome_signature(region, generator) == first_biomes) + assert(_decoration_signature(region) == first_decorations) + generator._elevated_feature_center = Vector2i(-1, -1) + assert(generator.generate_from_placement_keys(first_layout)) + assert(generator.stacked_elevated_placement_keys() == first_stacked_layout) + + configured_generator.elevated_cliff_third_tier_base_chance = 1.0 + configured_generator.elevated_cliff_third_tier_stack_chance = 0.0 + assert(region.generate_world(SECOND_SEED)) + await process_frame + await physics_frame + await physics_frame + _validate_generated_region(region, generator) + assert(generator.placement_keys() != first_layout) + assert(_biome_signature(region, generator) != first_biomes) + var second_layout := generator.placement_keys() + + configured_generator.elevated_cliff_double_third_tier_chance = 1.0 + assert(region.generate_world(RIVER_FALLBACK_SEED)) + await process_frame + await physics_frame + await physics_frame + _validate_generated_region(region, generator) + assert(generator.placement_keys() != first_layout) + assert(generator.placement_keys() != second_layout) + assert(generator._river_feature_candidate_index >= 0) + + region.queue_free() + await process_frame + print("Generated world runtime validation: PASS") + quit() + + +func _validate_generated_region( + region: GeneratedWorldRegion, + generator: TerrainChunkGenerator, +) -> void: + var placements := generator.placement_keys() + var expected_chunk_count := generator.grid_size.x * generator.grid_size.y + var center := Vector2i( + generator.grid_size.x / 2, + generator.grid_size.y / 2, + ) + var center_index := center.y * generator.grid_size.x + center.x + assert(generator.grid_size == Vector2i(20, 20)) + assert(generator._lake_feature_footprint_size.x >= 7) + assert( + generator._lake_feature_footprint_size.x + == generator._lake_feature_footprint_size.y + ) + assert(maxi( + generator._river_feature_footprint_size.x, + generator._river_feature_footprint_size.y, + ) >= 4) + assert(mini( + generator._river_feature_footprint_size.x, + generator._river_feature_footprint_size.y, + ) >= 4) + assert(generator._river_feature_flow_direction in [ + Vector2i.RIGHT, + Vector2i.DOWN, + Vector2i.LEFT, + Vector2i.UP, + ]) + assert(generator._river_feature_outlet_direction in [ + Vector2i.RIGHT, + Vector2i.DOWN, + Vector2i.LEFT, + Vector2i.UP, + ]) + assert( + generator._river_feature_flow_direction.x + * generator._river_feature_outlet_direction.x + + generator._river_feature_flow_direction.y + * generator._river_feature_outlet_direction.y + == 0 + ) + assert(generator.elevated_cliff_coastal_feature_required) + assert(placements.size() == expected_chunk_count) + assert(placements[center_index].begins_with("chunk_spawn@")) + assert(_placement_count(placements, "chunk_spawn") == 1) + assert(_placement_count(placements, "chunk_0001") >= 1) + var stream_count := ( + _placement_count(placements, "chunk_0003") + + _placement_count(placements, "chunk_0016") + ) + assert(stream_count >= 1 and stream_count <= 3) + assert(_placement_count(placements, "chunk_0004") == 2) + var beach_count := _placement_count(placements, "chunk_0002") + var grass_coast_count := _placement_count(placements, "chunk_0005") + var grass_corner_count := _placement_count(placements, "chunk_0007") + var beach_corner_count := _placement_count(placements, "chunk_0008") + var has_secondary_elevation := ( + generator._secondary_elevated_feature_center.x >= 0 + ) + var has_third_tier_base := ( + _placement_count(placements, "chunk_0028") > 0 + ) + var coastline_edge_count := ( + 2 * (generator.grid_size.x - 2) + + 2 * (generator.grid_size.y - 2) + ) + assert( + beach_count + == coastline_edge_count - (4 if has_secondary_elevation else 0) - 2 + and grass_coast_count == 0 + ) + assert( + beach_corner_count == (3 if has_secondary_elevation else 4) + and grass_corner_count == 0 + ) + assert( + _placement_count(placements, "chunk_0009") + == ( + (1 if has_secondary_elevation else 0) + + (0 if has_third_tier_base else 9) + ) + ) + assert( + _placement_count(placements, "chunk_0010") + == ( + (1 if has_secondary_elevation else 0) + + (0 if has_third_tier_base else 4) + ) + ) + assert( + _placement_count(placements, "chunk_0011") + + _placement_count(placements, "chunk_0012") + == ( + (2 if has_secondary_elevation else 0) + + (0 if has_third_tier_base else 12) + ) + ) + assert( + _placement_count(placements, "chunk_0012") + == ( + (1 if has_secondary_elevation else 0) + + (0 if has_third_tier_base else 1) + ) + ) + assert( + _placement_count(placements, "chunk_0028") + == (9 if has_third_tier_base else 0) + ) + assert( + _placement_count(placements, "chunk_0027") + == (4 if has_third_tier_base else 0) + ) + assert( + _placement_count(placements, "chunk_0026") + == (10 if has_third_tier_base else 0) + ) + assert(_placement_count(placements, "chunk_0029") == 1) + assert(_placement_count(placements, "chunk_0030") == 1) + assert(_placement_count(placements, "chunk_0031") == 1) + assert(_placement_count(placements, "chunk_0032") == 1) + assert(_placement_count(placements, "chunk_0033") == 1) + assert(_placement_count(placements, "chunk_0034") == 1) + assert(_placement_count(placements, "chunk_0035") == 1) + assert(_placement_count(placements, "chunk_0036") == 1) + assert(_placement_count(placements, "chunk_0038") == 2) + assert( + _placement_count(placements, "chunk_0014") + == (2 if has_secondary_elevation else 0) + ) + assert( + _placement_count(placements, "chunk_0015") + == (1 if has_secondary_elevation else 0) + ) + assert(_placement_count(placements, "chunk_0018") == 0) + assert(_placement_count(placements, "chunk_0020") == 4) + assert(_placement_count(placements, "chunk_0022") == 4) + assert(_placement_count(placements, "chunk_0023") == 4) + var lake_edge_count := _placement_count(placements, "chunk_0017") + var lake_edge_variant_count := _placement_count(placements, "chunk_0037") + var lake_fill_count := _placement_count(placements, "chunk_0019") + var lake_narrow_count := _placement_count(placements, "chunk_0021") + var lake_size := generator._lake_feature_footprint_size.x + assert(lake_size in [7, 8]) + assert(lake_fill_count == (lake_size - 2) * (lake_size - 2)) + assert(lake_edge_count + lake_edge_variant_count == (lake_size - 6) * 4) + assert(lake_edge_count > 0) + assert(lake_edge_variant_count > 0) + assert(lake_narrow_count == 8) + assert(_placement_count(placements, "chunk_9999") == 0) + assert(_placement_count(placements, "chunk_9998") == 0) + assert( + _placement_count(placements, "chunk_9997") + == (1 if has_secondary_elevation else 0) + ) + assert( + _placement_count(placements, "chunk_9996") + == (1 if has_secondary_elevation else 0) + ) + assert(_placement_count(placements, "chunk_9995") == 0) + var river_coordinate_count := generator._river_feature_coordinates.size() + var river_edge_count := ( + _placement_count(placements, "chunk_0024") + + _placement_count(placements, "chunk_0025") + + _placement_count(placements, "chunk_0038") + ) + assert(river_coordinate_count >= 12) + assert(generator._river_feature_placements.size() == river_coordinate_count) + assert(river_edge_count == river_coordinate_count - 8) + var stone_bridge_specs: Array[Dictionary] = [] + for spec: Dictionary in generator._river_feature_placements: + if spec.get("id", &"") == &"chunk_0038": + stone_bridge_specs.append(spec) + assert(stone_bridge_specs.size() == 2) + var first_bridge_coordinate := stone_bridge_specs[0].get( + "coordinate", + Vector2i(-1, -1), + ) as Vector2i + var second_bridge_coordinate := stone_bridge_specs[1].get( + "coordinate", + Vector2i(-1, -1), + ) as Vector2i + var bridge_delta := second_bridge_coordinate - first_bridge_coordinate + assert(absi(bridge_delta.x) + absi(bridge_delta.y) == 1) + assert(posmod( + int(stone_bridge_specs[1].get("turns", -1)) + - int(stone_bridge_specs[0].get("turns", -1)), + 4, + ) == 2) + var river_source_coordinates := generator._river_source_coordinates( + generator._river_feature_origin, + generator._river_feature_footprint_size, + generator._river_feature_flow_direction, + ) + assert(river_source_coordinates.size() == 2) + for source_coordinate: Vector2i in river_source_coordinates: + var source_index := ( + source_coordinate.y * generator.grid_size.x + source_coordinate.x + ) + assert( + placements[source_index].begins_with("chunk_0029@") + or placements[source_index].begins_with("chunk_0030@") + ) + var source_offset := source_coordinate - generator._elevated_feature_center + assert( + maxi(absi(source_offset.x), absi(source_offset.y)) + == TerrainChunkGenerator.ELEVATED_FEATURE_RADIUS + ) + var outlet_coordinates: Array[Vector2i] = [] + for index: int in placements.size(): + if ( + placements[index].begins_with("chunk_0031@") + or placements[index].begins_with("chunk_0032@") + ): + var outlet_coordinate := Vector2i( + index % generator.grid_size.x, + index / generator.grid_size.x, + ) + outlet_coordinates.append(outlet_coordinate) + assert( + not generator._coordinate_is_inside_grid( + outlet_coordinate + + generator._river_feature_outlet_direction + ) + ) + assert(outlet_coordinates.size() == 2) + var outlet_delta := outlet_coordinates[1] - outlet_coordinates[0] + assert(absi(outlet_delta.x) + absi(outlet_delta.y) == 1) + for beach_coordinate: Vector2i in [ + outlet_coordinates[0] - outlet_delta, + outlet_coordinates[1] + outlet_delta, + ]: + assert(generator._coordinate_is_inside_grid(beach_coordinate)) + assert(generator._coordinate_is_on_boundary(beach_coordinate)) + var beach_index := ( + beach_coordinate.y * generator.grid_size.x + beach_coordinate.x + ) + assert(placements[beach_index].begins_with("chunk_0002@")) + for index: int in placements.size(): + var coordinate := Vector2i( + index % generator.grid_size.x, + index / generator.grid_size.x, + ) + if placements[index].begins_with("chunk_0001@"): + assert(generator._distance_from_map_boundary(coordinate) <= 1) + elif placements[index].begins_with("chunk_0013@"): + assert(generator._distance_from_map_boundary(coordinate) <= 2) + assert(_placement_count(placements, "chunk_0013") >= 1) + assert( + generator.get_generated_chunks_root().get_child_count() + == expected_chunk_count + ) + var generated_root := generator.get_generated_chunks_root() + var terrain_collision_batches := generated_root.find_children( + "TerrainCollisionBatch_*", + "StaticBody3D", + true, + false, + ) + assert(not terrain_collision_batches.is_empty()) + assert( + terrain_collision_batches.size() + <= ceili(float(generator.grid_size.x) / generator.collision_batch_size) + * ceili(float(generator.grid_size.y) / generator.collision_batch_size) + ) + assert( + generated_root.find_children( + "TerrainCollision", + "StaticBody3D", + true, + false, + ).is_empty() + ) + assert( + generator.get_primary_terrain_meshes().size() + == ( + expected_chunk_count + + generator.stacked_elevated_placement_keys().size() + ) + ) + _validate_elevated_cliff_feature(generator) + + var shop := region.get_node("Interactables/FishingShopWorld") as Node3D + var storage := region.get_node("Interactables/PlayerStorageBox") as Node3D + assert(shop != null and shop.has_node("Shopkeeper")) + assert(storage != null and storage.has_node("InteractionArea")) + var spawn_chunk_center := generator.chunk_position(center) + var shop_offset := shop.position - spawn_chunk_center + var storage_offset := storage.position - spawn_chunk_center + assert(absf(shop_offset.x) < 5.0 and absf(shop_offset.z) < 5.0) + assert(absf(storage_offset.x) < 5.0 and absf(storage_offset.z) < 5.0) + assert(region.get_fishing_shop() != null) + assert(region.get_player_storage() != null) + assert(region.get_player_spawn_transform().origin.y > 0.0) + _validate_prop_catalog(region) + _validate_biome_catalog(region, generator) + + var ocean := region.get_node("WaterBodies/OceanWater") as WaterBodyAuthoring + var fresh_root := region.get_node("WaterBodies/FreshWaterBodies") as Node3D + assert(ocean != null and fresh_root != null) + assert(ocean.water_type == WaterType.Type.SALT_WATER) + assert(is_equal_approx(ocean.position.y, GeneratedWorldRegion.WATER_HEIGHT)) + var ocean_recovery := ocean.get_node("RecoveryRegion") as PlayerWaterTrigger + assert( + ocean_recovery.entry_height_reference + == PlayerWaterTrigger.EntryHeightReference.BODY_CENTER + ) + assert(is_equal_approx(ocean_recovery.entry_depth_threshold, 0.35)) + var fresh_placement_count := 0 + var river_placement_count := 0 + var polygon_sizes_by_coordinate: Dictionary[Vector2i, int] = {} + for record: Dictionary in generator.placement_records(): + var tags: PackedStringArray = record.get("tags", PackedStringArray()) + if "coast" in tags: + _validate_ocean_facing_record(record, generator.grid_size) + if "fresh_water" in tags: + fresh_placement_count += 1 + if "river" in tags: + river_placement_count += 1 + assert(not "pond" in tags) + assert(not "lake" in tags) + var surface_polygon: PackedVector2Array = record.get( + "water_surface_polygon", + PackedVector2Array(), + ) + if surface_polygon.size() >= 3: + polygon_sizes_by_coordinate[ + record.get("coordinate", Vector2i.ZERO) + ] = surface_polygon.size() + _validate_complete_coastline(generator) + assert(fresh_root.get_child_count() == fresh_placement_count) + assert(river_placement_count == river_coordinate_count) + assert( + polygon_sizes_by_coordinate.size() + == 20 + river_placement_count + ) + var river_body_count := 0 + for child: Node in fresh_root.get_children(): + var fresh := child as WaterBodyAuthoring + assert(fresh != null) + assert(fresh.water_type == WaterType.Type.FRESH_WATER) + assert(is_equal_approx(fresh.position.y, GeneratedWorldRegion.WATER_HEIGHT)) + assert(fresh.visible) + assert(fresh.surface_size.x <= 10.0 and fresh.surface_size.y <= 10.0) + assert(not fresh.visual_surface_enabled) + assert(not (fresh.get_node("VisualWater") as MeshInstance3D).visible) + var generated_bed := fresh.get_node_or_null( + "GeneratedBed", + ) as MeshInstance3D + assert(generated_bed != null and generated_bed.mesh != null) + assert( + is_equal_approx( + generated_bed.global_position.y, + GeneratedWorldRegion.GENERATED_FRESH_WATER_BED_HEIGHT, + ) + ) + assert( + generated_bed.material_override != null + and generated_bed.material_override.resource_name == "dirt" + ) + var fresh_recovery := ( + fresh.get_node("RecoveryRegion") as PlayerWaterTrigger + ) + assert( + fresh_recovery.entry_height_reference + == PlayerWaterTrigger.EntryHeightReference.PLAYER_ORIGIN + ) + assert(is_equal_approx(fresh_recovery.entry_depth_threshold, 0.1)) + assert(is_equal_approx( + fresh_recovery.entry_confirmation_seconds, + 0.2, + )) + var coordinate_tokens := child.name.trim_prefix("FreshWater_").split("_") + assert(coordinate_tokens.size() == 2) + var coordinate := Vector2i( + int(coordinate_tokens[0]), + int(coordinate_tokens[1]), + ) + if polygon_sizes_by_coordinate.has(coordinate): + assert( + fresh.surface_polygon.size() + == polygon_sizes_by_coordinate[coordinate] + ) + assert( + fresh.get_node("FishingRegion").get_child_count() > 1 + ) + else: + assert(fresh.surface_polygon.is_empty()) + if &"river" in fresh.location_tags: + river_body_count += 1 + assert(fresh.fish_pool == GeneratedRiverPool) + elif &"lake" in fresh.location_tags: + assert(fresh.fish_pool == GeneratedLakePool) + else: + assert(&"pond" in fresh.location_tags) + assert(fresh.fish_pool == GeneratedPondPool) + assert(river_body_count == river_placement_count) + + _validate_authored_chunk_surfaces(region, generator) + _validate_projected_terrain_materials( + generator.get_generated_chunks_root() + ) + + var decorations := region.get_node("Decorations") as Node3D + var grass_prop_surface_triangles := region.get_spawn_surface_triangles( + [&"grass_lite"], + -INF, + 0.35, + ) + var sand_prop_surface_triangles := region.get_spawn_surface_triangles( + [&"sand"], + -INF, + 0.35, + ) + _validate_water_recovery_positions( + region, + grass_prop_surface_triangles, + sand_prop_surface_triangles, + ) + var anchors := region.get_node( + "GatherableAnchors/ReachableTreeTrunks" + ) as GatherableAnchorSet3D + assert(decorations != null and decorations.get_child_count() > 0) + assert(anchors != null) + assert(anchors.get_spawn_positions().size() > 0) + _validate_tree_gatherable_anchors(region, decorations, anchors) + var palm_clusters: Dictionary[int, Array] = {} + var tree_scales: Array[float] = [] + var tree_yaws: Dictionary[float, bool] = {} + var ocean_edges_by_coordinate: Dictionary[Vector2i, int] = {} + for record: Dictionary in generator.placement_records(): + var record_edges := int(record.get("ocean_facing_edges", 0)) + if record_edges != 0: + ocean_edges_by_coordinate[ + record.get("coordinate", Vector2i.ZERO) + ] = record_edges + for child: Node in decorations.get_children(): + var prop_id := StringName(child.get_meta(&"terrain_prop_id", &"")) + assert(PROCEDURAL_PROP_IDS.has(prop_id)) + var definition := region.get_prop_catalog().definition_for_id(prop_id) + assert(definition != null) + if definition.procedural_group in [&"grass_tree", &"sand_tree"]: + assert( + _has_precipitation_occlusion_layer(child), + "Precipitation occlusion layer missing from %s (%s)." + % [child.name, prop_id], + ) + var biome_id := StringName( + child.get_meta(&"terrain_biome_id", &"") + ) + var biome := region.get_biome_catalog().definition_for_id(biome_id) + assert(biome != null) + var biome_rule := biome.prop_rule_for_group( + definition.procedural_group + ) + assert(biome_rule != null and biome_rule.allows_prop(definition)) + var coordinate: Vector2i = child.get_meta( + &"terrain_chunk_coordinate", + Vector2i.ZERO, + ) + var spawn_coordinate := Vector2i( + generator.grid_size.x / 2, + generator.grid_size.y / 2, + ) + var spawn_distance := ( + absi(coordinate.x - spawn_coordinate.x) + + absi(coordinate.y - spawn_coordinate.y) + ) + assert(spawn_distance >= definition.minimum_spawn_chunk_distance) + _validate_decoration_transform( + region, + child as Node3D, + definition, + grass_prop_surface_triangles, + sand_prop_surface_triangles, + ) + if prop_id == &"prop_palm": + var cluster_id := int( + child.get_meta(&"terrain_prop_cluster_id", -1) + ) + var members: Array = palm_clusters.get(cluster_id, []) + members.append(child) + palm_clusters[cluster_id] = members + var ocean_direction := _ocean_direction( + ocean_edges_by_coordinate.get(coordinate, 0) + ) + if ocean_direction.is_zero_approx(): + ocean_direction = _nearest_ocean_direction( + region, + generator, + (child as Node3D).position, + ) + var local_overhang := Vector3( + definition.local_overhang_direction.x, + 0.0, + definition.local_overhang_direction.y, + ).normalized() + var actual_overhang := local_overhang.rotated( + Vector3.UP, + (child as Node3D).rotation.y, + ) + assert( + actual_overhang.dot(ocean_direction) + >= cos(deg_to_rad(definition.ocean_facing_spread_degrees)) + - 0.001 + ) + elif prop_id in [ + &"prop_tree_1", + &"prop_tree_2", + &"prop_tree_3", + &"prop_tree_large", + &"prop_pine", + &"prop_pine_large", + ]: + tree_scales.append( + float(child.get_meta(&"terrain_prop_visual_scale", 1.0)) + ) + tree_yaws[snappedf((child as Node3D).rotation.y, 0.01)] = true + if prop_id in [ + &"prop_tree_1", + &"prop_tree_2", + &"prop_tree_3", + &"prop_tree_large", + ]: + assert( + _has_material_variant_override( + child.get_node_or_null("Visual"), + definition.material_variants, + ) + ) + assert( + _has_material_variant_override( + child.get_node_or_null("Visual"), + definition.secondary_material_variants, + ) + ) + assert(not palm_clusters.is_empty()) + for members: Array in palm_clusters.values(): + assert(members.size() >= 1 and members.size() <= 3) + for first_index: int in members.size(): + for second_index: int in range(first_index + 1, members.size()): + var first := members[first_index] as Node3D + var second := members[second_index] as Node3D + var separation := Vector2( + first.position.x - second.position.x, + first.position.z - second.position.z, + ).length() + assert(separation > 0.5 and separation < 6.1) + assert(tree_scales.max() - tree_scales.min() > 0.25) + assert(tree_yaws.size() >= 8) + assert(_decoration_group_count(region, &"grass_tree") > 0) + assert(_decoration_group_count(region, &"sand_tree") > 0) + assert( + _decoration_biome_group_count( + region, + &"biome_forest", + &"grass_tree", + ) >= 4 + ) + assert( + _decoration_biome_group_count( + region, + &"biome_pine_forest", + &"grass_tree", + ) >= 4 + ) + + +func _validate_elevated_cliff_feature( + generator: TerrainChunkGenerator, +) -> void: + var elevated_coordinates: Dictionary[Vector2i, StringName] = {} + var top_coordinates: Array[Vector2i] = [] + var ramp_records: Array[Dictionary] = [] + var coastal_ids: Array[StringName] = [ + &"chunk_0014", + &"chunk_0015", + &"chunk_9999", + &"chunk_9998", + &"chunk_9997", + &"chunk_9996", + ] + var has_coastal_feature := false + for record: Dictionary in generator.placement_records(): + var stable_id: StringName = record.get("stable_id", &"") + if stable_id not in [ + &"chunk_0009", + &"chunk_0010", + &"chunk_0011", + &"chunk_0012", + &"chunk_0026", + &"chunk_0027", + &"chunk_0028", + &"chunk_0029", + &"chunk_0030", + &"chunk_0014", + &"chunk_0015", + &"chunk_9999", + &"chunk_9998", + &"chunk_9997", + &"chunk_9996", + ]: + continue + var coordinate: Vector2i = record.get("coordinate", Vector2i.ZERO) + if stable_id in coastal_ids: + has_coastal_feature = true + assert( + coordinate.x in [0, generator.grid_size.x - 1] + or coordinate.y in [0, generator.grid_size.y - 1] + ) + else: + assert(coordinate.x > 0 and coordinate.x < generator.grid_size.x - 1) + assert(coordinate.y > 0 and coordinate.y < generator.grid_size.y - 1) + elevated_coordinates[coordinate] = stable_id + if stable_id in [&"chunk_0009", &"chunk_0028"]: + top_coordinates.append(coordinate) + elif stable_id == &"chunk_0012": + ramp_records.append(record) + assert(elevated_coordinates.size() == (34 if has_coastal_feature else 25)) + var feature_center := generator._elevated_feature_center + assert(feature_center != Vector2i(-1, -1)) + var center_index := feature_center.y * generator.grid_size.x + feature_center.x + assert(center_index >= 0 and center_index < generator.placement_keys().size()) + var primary_top_id := StringName( + generator.placement_keys()[center_index].get_slice("@", 0) + ) + assert(primary_top_id in [&"chunk_0009", &"chunk_0028"]) + var primary_is_third_tier := primary_top_id == &"chunk_0028" + assert( + top_coordinates.size() + == (9 + (1 if has_coastal_feature else 0)) + ) + assert( + ramp_records.size() + == ( + (0 if primary_is_third_tier else 1) + + (1 if has_coastal_feature else 0) + ) + ) + var detected_feature_center := Vector2i(-1, -1) + for candidate: Vector2i in top_coordinates: + var neighboring_top_count := 0 + for row_offset: int in range(-1, 2): + for column_offset: int in range(-1, 2): + neighboring_top_count += int( + elevated_coordinates.get( + candidate + Vector2i(column_offset, row_offset), + &"", + ) == primary_top_id + ) + if neighboring_top_count == 9: + detected_feature_center = candidate + break + assert(detected_feature_center == feature_center) + for row_offset: int in range(-2, 3): + for column_offset: int in range(-2, 3): + assert( + elevated_coordinates.has( + feature_center + Vector2i(column_offset, row_offset) + ) + ) + if has_coastal_feature: + var secondary_top := generator._secondary_elevated_feature_center + assert(secondary_top != Vector2i(-1, -1)) + for row_offset: int in range(-1, 2): + for column_offset: int in range(-1, 2): + assert( + elevated_coordinates.has( + secondary_top + Vector2i(column_offset, row_offset) + ) + ) + var found_primary_ramp := false + for ramp_record: Dictionary in ramp_records: + var ramp_coordinate: Vector2i = ramp_record.get( + "coordinate", Vector2i(-1, -1) + ) + var ramp_turns := int(ramp_record.get("rotation_quarters", 0)) + var high_edge := TerrainChunkTopology.rotated_edge( + TerrainChunkTopology.Edge.WEST, + ramp_turns, + ) + var high_offset := TerrainChunkTopology.grid_offset(high_edge) + assert( + elevated_coordinates.get(ramp_coordinate + high_offset, &"") + == &"chunk_0009" + ) + found_primary_ramp = ( + found_primary_ramp + or elevated_coordinates.get( + ramp_coordinate + high_offset * 2, + &"", + ) == &"chunk_0009" + ) + var low_coordinate := ramp_coordinate - high_offset + var low_index := ( + low_coordinate.y * generator.grid_size.x + low_coordinate.x + ) + assert( + generator.placement_keys()[low_index].begins_with("chunk_0000@") + or generator.placement_keys()[low_index].begins_with("chunk_spawn@") + ) + assert(found_primary_ramp == not primary_is_third_tier) + + var generated := generator.get_generated_chunks_root() + assert(generated != null) + var layered_count := 0 + for chunk_root: Node in generated.get_children(): + var stable_id := StringName( + chunk_root.get_meta(&"terrain_chunk_id", &"") + ) + if stable_id not in [ + &"chunk_0009", + &"chunk_0010", + &"chunk_0011", + &"chunk_0012", + &"chunk_0026", + &"chunk_0027", + &"chunk_0028", + &"chunk_0029", + &"chunk_0030", + &"chunk_0014", + &"chunk_0015", + &"chunk_9999", + &"chunk_9998", + &"chunk_9997", + &"chunk_9996", + ]: + continue + if stable_id in [&"chunk_0014", &"chunk_0015"]: + assert(chunk_root.get_node_or_null("TerrainBaseLayer") == null) + continue + if stable_id in [&"chunk_0029", &"chunk_0030"]: + assert(chunk_root.get_node_or_null("TerrainBaseLayer") == null) + var source_mesh := TerrainChunkAnalyzer.find_primary_mesh( + chunk_root, + stable_id, + ) + assert(source_mesh != null and source_mesh.mesh != null) + continue + layered_count += 1 + var base_layer := chunk_root.get_node_or_null("TerrainBaseLayer") + var overlay := chunk_root.get_node_or_null("TerrainOverlay") + assert(base_layer != null and overlay != null) + var transition_base_mesh := &"chunk_0000" + if stable_id in [&"chunk_9999", &"chunk_9998"]: + transition_base_mesh = &"chunk_0007" + elif stable_id in [&"chunk_9997", &"chunk_9996"]: + transition_base_mesh = &"chunk_0008" + var base_mesh := TerrainChunkAnalyzer.find_primary_mesh( + base_layer, + transition_base_mesh, + ) + var overlay_mesh := TerrainChunkAnalyzer.find_primary_mesh( + overlay, + ( + &"chunk_0010" + if stable_id in [ + &"chunk_9999", + &"chunk_9998", + &"chunk_9997", + &"chunk_9996", + ] + else stable_id + ), + ) + assert(base_mesh != null and base_mesh.mesh != null) + assert(overlay_mesh != null and overlay_mesh.mesh != null) + assert(layered_count == (29 if has_coastal_feature else 23)) + var stacked_keys := generator.stacked_elevated_placement_keys() + assert(stacked_keys.size() in [0, 4]) + if stacked_keys.is_empty(): + return + for key: String in stacked_keys: + assert( + key.begins_with("chunk_0010@") + or key.begins_with("chunk_0027@") + ) + var stacked_count := 0 + for chunk_root: Node in generated.get_children(): + for child: Node in chunk_root.get_children(): + if not bool(child.get_meta(&"terrain_stacked_elevation", false)): + continue + stacked_count += 1 + var stacked_id := StringName( + child.get_meta(&"terrain_chunk_id", &"") + ) + assert(stacked_id in [&"chunk_0010", &"chunk_0027"]) + var expected_height := ( + generator.elevated_cliff_level_height * 2.0 + if primary_is_third_tier + else generator.elevated_cliff_level_height + ) + assert( + is_equal_approx( + (child as Node3D).position.y, + expected_height, + ) + ) + var stacked_mesh := TerrainChunkAnalyzer.find_primary_mesh( + child, + stacked_id, + ) + assert(stacked_mesh != null and stacked_mesh.mesh != null) + assert(stacked_count == 4) + + +func _validate_ocean_facing_record( + record: Dictionary, + grid_size: Vector2i, +) -> void: + var coordinate: Vector2i = record.get("coordinate", Vector2i.ZERO) + var ocean_edges := int(record.get("ocean_facing_edges", 0)) + assert(ocean_edges != 0) + for edge_value: int in TerrainChunkTopology.Edge.values(): + if (ocean_edges & (1 << edge_value)) == 0: + continue + var ocean_coordinate := ( + coordinate + + TerrainChunkTopology.grid_offset( + edge_value as TerrainChunkTopology.Edge + ) + ) + assert( + ocean_coordinate.x < 0 + or ocean_coordinate.y < 0 + or ocean_coordinate.x >= grid_size.x + or ocean_coordinate.y >= grid_size.y + ) + + +func _validate_complete_coastline(generator: TerrainChunkGenerator) -> void: + for record: Dictionary in generator.placement_records(): + var coordinate: Vector2i = record.get("coordinate", Vector2i.ZERO) + var ocean_edges := int(record.get("ocean_facing_edges", 0)) + for edge_value: int in TerrainChunkTopology.Edge.values(): + var neighbor := ( + coordinate + + TerrainChunkTopology.grid_offset( + edge_value as TerrainChunkTopology.Edge + ) + ) + var outside := ( + neighbor.x < 0 + or neighbor.y < 0 + or neighbor.x >= generator.grid_size.x + or neighbor.y >= generator.grid_size.y + ) + assert( + ((ocean_edges & (1 << edge_value)) != 0) == outside + ) + + +func _ocean_direction(ocean_edges: int) -> Vector3: + var result := Vector3.ZERO + for edge_value: int in TerrainChunkTopology.Edge.values(): + if (ocean_edges & (1 << edge_value)) != 0: + result += TerrainChunkTopology.edge_normal( + edge_value as TerrainChunkTopology.Edge + ) + return result.normalized() + + +func _nearest_ocean_direction( + region: GeneratedWorldRegion, + generator: TerrainChunkGenerator, + position: Vector3, +) -> Vector3: + var half_extents := region.get_playable_half_extents() + var distance_x := half_extents.x - absf(position.x) + var distance_z := half_extents.y - absf(position.z) + var direction_x := Vector3.RIGHT if position.x >= 0.0 else Vector3.LEFT + var direction_z := Vector3.BACK if position.z >= 0.0 else Vector3.FORWARD + if absf(distance_x - distance_z) <= generator.catalog.chunk_size * 0.35: + return (direction_x + direction_z).normalized() + return direction_x if distance_x < distance_z else direction_z + + +func _validate_prop_catalog(region: GeneratedWorldRegion) -> void: + var catalog := region.get_prop_catalog() + assert(catalog != null) + assert(catalog.validation_errors().is_empty()) + assert(catalog.definitions.size() == EXPECTED_PROP_IDS.size()) + for stable_id: StringName in EXPECTED_PROP_IDS: + var definition := catalog.definition_for_id(stable_id) + assert(definition != null and definition.packed_scene != null) + var instance := definition.packed_scene.instantiate() as Node3D + assert(instance != null) + assert(instance.position.is_zero_approx()) + assert(_find_mesh_instance(instance) != null) + instance.free() + if definition.has_gatherable_surface(): + assert( + definition.gatherable_surface_clearance >= 0.12 + ) + var mushroom := catalog.definition_for_id(&"prop_mushroom") + assert(mushroom != null and mushroom.has_collision()) + assert(mushroom.visual_offset.y < 0.0) + for tree_id: StringName in [ + &"prop_tree_1", + &"prop_tree_2", + &"prop_tree_3", + &"prop_tree_large", + ]: + var tree := catalog.definition_for_id(tree_id) + assert(tree != null) + assert(tree.minimum_visual_scale < tree.maximum_visual_scale) + assert(tree.material_variants.size() >= 3) + assert(not tree.variant_material_slot_names.is_empty()) + assert(tree.secondary_material_variants.size() >= 3) + assert(not tree.secondary_variant_material_slot_names.is_empty()) + var pine := catalog.definition_for_id(&"prop_pine") + assert(pine != null) + assert(pine.minimum_visual_scale < pine.maximum_visual_scale) + assert(pine.material_variants.is_empty()) + assert(not pine.has_gatherable_surface()) + var large_pine := catalog.definition_for_id(&"prop_pine_large") + assert(large_pine != null) + assert(large_pine.minimum_visual_scale < large_pine.maximum_visual_scale) + assert(large_pine.material_variants.is_empty()) + assert(not large_pine.has_gatherable_surface()) + var palm := catalog.definition_for_id(&"prop_palm") + assert(palm != null) + assert(is_equal_approx(palm.minimum_visual_scale, 0.5)) + assert(is_equal_approx(palm.maximum_visual_scale, 1.0)) + assert(palm.minimum_cluster_size == 2) + assert(palm.maximum_cluster_size == 3) + assert(palm.minimum_cluster_radius > palm.clearance_radius) + assert(palm.maximum_cluster_radius > palm.minimum_cluster_radius) + assert(palm.prefer_ocean_facing) + assert(not palm.local_overhang_direction.is_zero_approx()) + var aligned_tree_collisions: Dictionary[StringName, Vector2] = { + &"prop_tree_1": Vector2(0.08, 0.01), + &"prop_tree_2": Vector2(0.1, 0.075), + &"prop_tree_3": Vector2(-0.1, 0.18), + &"prop_tree_large": Vector2(0.084, 0.504), + &"prop_pine": Vector2(-0.044, 0.083), + &"prop_pine_large": Vector2(-0.04, 0.075), + &"prop_palm": Vector2(0.15, -0.1), + } + for tree_id: StringName in aligned_tree_collisions: + var aligned_tree := catalog.definition_for_id(tree_id) + assert(aligned_tree != null and aligned_tree.has_cylinder_collision()) + var collision_center := Vector2( + aligned_tree.collision_offset.x, + aligned_tree.collision_offset.z, + ) + assert(collision_center.is_equal_approx( + aligned_tree_collisions[tree_id] + )) + var forest := region.get_biome_catalog().definition_for_id(&"biome_forest") + var forest_rule := forest.prop_rule_for_group(&"grass_tree") + var large_tree := catalog.definition_for_id(&"prop_tree_large") + var small_tree_weight := ( + catalog.definition_for_id(&"prop_tree_1").selection_weight + + catalog.definition_for_id(&"prop_tree_2").selection_weight + + catalog.definition_for_id(&"prop_tree_3").selection_weight + ) + assert(forest_rule.allows_prop(large_tree)) + assert(large_tree.selection_weight <= small_tree_weight) + var pine_forest := region.get_biome_catalog().definition_for_id( + &"biome_pine_forest" + ) + var pine_rule := pine_forest.prop_rule_for_group(&"grass_tree") + assert(pine_rule.allows_prop(large_pine)) + assert( + is_equal_approx(large_pine.selection_weight, pine.selection_weight) + ) + assert(forest_rule.minimum_placements == 4) + assert(forest_rule.placement_attempts_per_chunk == 4) + assert(pine_rule.minimum_placements == 4) + assert(pine_rule.placement_attempts_per_chunk == 4) + + +func _validate_biome_catalog( + region: GeneratedWorldRegion, + generator: TerrainChunkGenerator, +) -> void: + var catalog := region.get_biome_catalog() + assert(catalog != null) + assert(catalog.validation_errors().is_empty()) + assert(catalog.definitions.size() == EXPECTED_BIOME_IDS.size()) + var counts: Dictionary[StringName, int] = {} + for record: Dictionary in generator.placement_records(): + var coordinate: Vector2i = record.get("coordinate", Vector2i.ZERO) + var biome_id := region.get_biome_at(coordinate) + var tags: PackedStringArray = record.get("tags", PackedStringArray()) + if "mixed_surface" in tags: + assert(biome_id == &"") + elif "grass" in tags or "sand" in tags: + assert(biome_id != &"") + var biome := catalog.definition_for_id(biome_id) + assert(biome != null and biome.supports_chunk_tags(tags)) + counts[biome_id] = counts.get(biome_id, 0) + 1 + else: + assert(biome_id == &"") + for biome_id: StringName in EXPECTED_BIOME_IDS: + assert(counts.get(biome_id, 0) > 0) + var center := Vector2i( + generator.grid_size.x / 2, + generator.grid_size.y / 2, + ) + assert(region.get_biome_at(center) == &"biome_plains") + for child: Node in generator.get_generated_chunks_root().get_children(): + var coordinate: Vector2i = child.get_meta( + &"terrain_chunk_coordinate", + Vector2i.ZERO, + ) + assert( + StringName(child.get_meta(&"terrain_biome_id", &"")) + == region.get_biome_at(coordinate) + ) + + +func _validate_decoration_transform( + region: GeneratedWorldRegion, + prop: Node3D, + definition: TerrainPropDefinition, + grass_surface_triangles: Array[PackedVector3Array], + sand_surface_triangles: Array[PackedVector3Array], +) -> void: + assert(prop != null) + assert(prop.scale.is_equal_approx(Vector3.ONE)) + var visual_root := prop.get_node_or_null("Visual") as Node3D + var visual := _find_mesh_instance(visual_root) + var collision := prop.get_node_or_null( + "TrunkCollision/CollisionShape" + ) as CollisionShape3D + assert(visual_root != null) + assert(visual_root.position.is_equal_approx(definition.visual_offset)) + var visual_scale := float( + prop.get_meta(&"terrain_prop_visual_scale", 1.0) + ) + assert(visual_scale >= definition.minimum_visual_scale - 0.001) + assert(visual_scale <= definition.maximum_visual_scale + 0.001) + assert( + visual_root.scale.is_equal_approx(Vector3.ONE * visual_scale) + ) + assert(visual != null and visual.mesh != null) + if definition.has_collision(): + assert(collision != null) + assert( + collision.shape is CylinderShape3D + or collision.shape is BoxShape3D + ) + assert(collision.global_basis.get_scale().is_equal_approx(Vector3.ONE)) + if collision.shape is CylinderShape3D: + var cylinder := collision.shape as CylinderShape3D + assert(is_equal_approx( + cylinder.radius, + definition.collision_radius * visual_scale, + )) + assert(is_equal_approx( + cylinder.height, + definition.collision_height * visual_scale, + )) + assert(collision.position.is_equal_approx( + definition.collision_offset * visual_scale + + Vector3.UP * cylinder.height * 0.5 + )) + else: + assert(collision == null) + var query := PhysicsRayQueryParameters3D.create( + # Stay below neighboring cliff overhangs while still beginning above the + # authored walkable surface. Regional collision batches intentionally + # keep every original shape on one body, so excluding an overhang body + # would also exclude the ground beneath the prop. + prop.global_position + Vector3.UP * 0.1, + prop.global_position + Vector3.DOWN * 8.0, + 1, + ) + var excluded_colliders: Array[RID] = [] + var decorations := region.get_node("Decorations") as Node3D + for decoration: Node in decorations.get_children(): + var prop_body := decoration.get_node_or_null( + "TrunkCollision", + ) as CollisionObject3D + if prop_body != null: + excluded_colliders.append(prop_body.get_rid()) + query.exclude = excluded_colliders + var hit := region.get_world_3d().direct_space_state.intersect_ray(query) + # Stacked cliff walls can overhang a neighboring cell. Match the placement + # sampler by ignoring steep faces until the ray reaches walkable terrain. + while ( + not hit.is_empty() + and absf((hit.get("normal", Vector3.ZERO) as Vector3).dot(Vector3.UP)) + < 0.35 + ): + var steep_collider := hit.get("collider") as CollisionObject3D + assert(steep_collider != null) + excluded_colliders.append(steep_collider.get_rid()) + query.exclude = excluded_colliders + hit = region.get_world_3d().direct_space_state.intersect_ray(query) + assert( + not hit.is_empty(), + "No terrain collision below %s (%s) at %s." + % [prop.name, definition.stable_id, prop.global_position], + ) + var ground_position: Vector3 = hit["position"] + assert( + absf(ground_position.y - prop.global_position.y) <= 0.01, + "Terrain height %s does not match %s (%s) at %s." + % [ + ground_position.y, + prop.name, + definition.stable_id, + "%s in chunk %s; hit %s" % [ + prop.global_position, + prop.get_meta(&"terrain_chunk_coordinate", Vector2i(-1, -1)), + (hit.get("collider") as Node).get_path(), + ], + ], + ) + var required_surface_triangles: Array[PackedVector3Array] = ( + sand_surface_triangles + if definition.procedural_group == &"sand_tree" + else grass_surface_triangles + ) + var required_surface_height := _triangle_surface_height_at( + prop.global_position, + required_surface_triangles, + ) + assert( + required_surface_height > -INF + and absf(required_surface_height - prop.global_position.y) <= 0.01, + "%s (%s) is not rooted on its required terrain material at %s." + % [prop.name, definition.stable_id, prop.global_position], + ) + + +func _triangle_surface_height_at( + position: Vector3, + triangles: Array[PackedVector3Array], +) -> float: + var highest := -INF + var segment_start := position + Vector3.UP * 100.0 + var segment_end := position + Vector3.DOWN * 100.0 + for triangle: PackedVector3Array in triangles: + if triangle.size() != 3: + continue + var hit: Variant = Geometry3D.segment_intersects_triangle( + segment_start, + segment_end, + triangle[0], + triangle[1], + triangle[2], + ) + if hit is Vector3: + highest = maxf(highest, (hit as Vector3).y) + return highest + + +func _validate_water_recovery_positions( + region: GeneratedWorldRegion, + grass_triangles: Array[PackedVector3Array], + sand_triangles: Array[PackedVector3Array], +) -> void: + var fresh_water_root := region.get_node( + "WaterBodies/FreshWaterBodies" + ) as Node3D + assert(fresh_water_root != null and fresh_water_root.get_child_count() > 0) + var fresh_water := fresh_water_root.get_child(0) as WaterBodyAuthoring + assert(fresh_water != null) + var entry_position := fresh_water.global_position + var fallback_position := region.get_player_spawn_transform().origin + var recovery_position := region.get_water_recovery_position( + entry_position, + fallback_position, + ) + assert(recovery_position.is_finite()) + assert( + _horizontal_distance_squared(entry_position, recovery_position) + < _horizontal_distance_squared(entry_position, fallback_position), + "Fresh-water recovery returned the distant generated-world spawn.", + ) + assert( + recovery_position.y + > GeneratedWorldRegion.WATER_HEIGHT + + GeneratedWorldRegion.WATER_RECOVERY_MINIMUM_GROUND_CLEARANCE + ) + var recovery_triangles: Array[PackedVector3Array] = [] + recovery_triangles.append_array(grass_triangles) + recovery_triangles.append_array(sand_triangles) + var center_height := _triangle_surface_height_at( + recovery_position, + recovery_triangles, + ) + assert(center_height > -INF) + assert(absf(center_height - recovery_position.y) <= 0.01) + for direction: Vector2 in GeneratedWorldRegion.PROP_SURFACE_SAMPLE_DIRECTIONS: + var footprint_position := recovery_position + Vector3( + direction.x * GeneratedWorldRegion.WATER_RECOVERY_FOOTPRINT_RADIUS, + 0.0, + direction.y * GeneratedWorldRegion.WATER_RECOVERY_FOOTPRINT_RADIUS, + ) + var footprint_height := _triangle_surface_height_at( + footprint_position, + recovery_triangles, + ) + assert(footprint_height > -INF) + assert( + absf(footprint_height - recovery_position.y) + <= GeneratedWorldRegion.PROP_MAXIMUM_SUPPORT_HEIGHT_DIFFERENCE + ) + assert( + region.get_water_recovery_position( + entry_position, + fallback_position, + ).is_equal_approx(recovery_position) + ) + assert( + region.get_water_recovery_position( + Vector3(INF, 0.0, 0.0), + fallback_position, + ).is_equal_approx(fallback_position) + ) + + +func _horizontal_distance_squared(a: Vector3, b: Vector3) -> float: + return Vector2(a.x - b.x, a.z - b.z).length_squared() + + +func _validate_tree_gatherable_anchors( + region: GeneratedWorldRegion, + decorations: Node3D, + anchors: GatherableAnchorSet3D, +) -> void: + var eligible_props: Dictionary[StringName, Node3D] = {} + var expected_anchor_count := 0 + for child: Node in decorations.get_children(): + var prop := child as Node3D + if prop == null: + continue + var prop_id := StringName(prop.get_meta(&"terrain_prop_id", &"")) + var definition := region.get_prop_catalog().definition_for_id(prop_id) + var socket_count := _count_authored_beetle_sockets(prop) + if ( + definition != null + and definition.has_gatherable_surface() + and socket_count > 0 + ): + eligible_props[prop.name] = prop + expected_anchor_count += socket_count + var positions := anchors.get_spawn_positions() + assert(positions.size() == expected_anchor_count) + assert(positions.size() >= 12) + for child: Node in anchors.get_children(): + var anchor := child as Marker3D + assert(anchor != null) + assert(bool(anchor.get_meta(&"authored_beetle_socket", false))) + var prop_name := StringName(anchor.get_meta(&"terrain_prop_name", &"")) + assert(eligible_props.has(prop_name)) + var prop: Node3D = eligible_props[prop_name] + var prop_id := StringName(prop.get_meta(&"terrain_prop_id", &"")) + var definition := region.get_prop_catalog().definition_for_id(prop_id) + assert(definition != null and definition.has_gatherable_surface()) + var local_anchor := prop.to_local(anchor.global_position) + assert(prop_id != &"prop_palm") + assert(local_anchor.y >= 0.25 and local_anchor.y <= 2.0) + + +func _count_authored_beetle_sockets(root_node: Node) -> int: + var result := 0 + if String(root_node.name).to_lower().contains("beetle_socket"): + result += 1 + for child: Node in root_node.get_children(): + result += _count_authored_beetle_sockets(child) + return result + + +func _find_mesh_instance(root_node: Node) -> MeshInstance3D: + if root_node is MeshInstance3D: + return root_node as MeshInstance3D + if root_node == null: + return null + for child: Node in root_node.get_children(): + var mesh_instance := _find_mesh_instance(child) + if mesh_instance != null: + return mesh_instance + return null + + +func _has_precipitation_occlusion_layer(root_node: Node) -> bool: + var mesh_instance := root_node as MeshInstance3D + if ( + mesh_instance != null + and mesh_instance.get_layer_mask_value( + PrecipitationOcclusionType.RENDER_LAYER_NUMBER + ) + ): + return true + for child: Node in root_node.get_children(): + if _has_precipitation_occlusion_layer(child): + return true + return false + + +func _has_material_variant_override( + root_node: Node, + variants: Array[Material], +) -> bool: + if root_node == null: + return false + var mesh_instance := root_node as MeshInstance3D + if mesh_instance != null and mesh_instance.mesh != null: + for surface_index: int in mesh_instance.mesh.get_surface_count(): + var override := mesh_instance.get_surface_override_material( + surface_index + ) + if override != null and override in variants: + return true + for child: Node in root_node.get_children(): + if _has_material_variant_override(child, variants): + return true + return false + + +func _validate_authored_chunk_surfaces( + region: GeneratedWorldRegion, + generator: TerrainChunkGenerator, +) -> void: + var generated := generator.get_generated_chunks_root() + var found_beach := false + var found_stream := false + var found_pond := false + var found_grass_ocean_edge := false + var found_grass_beach_transition := false + var found_grass_ocean_corner := false + var found_beach_ocean_corner := false + var found_grass_sand_diagonal := false + var beach_family := ( + _placement_count(generator.placement_keys(), "chunk_0002") > 0 + ) + for chunk_root: Node in generated.get_children(): + if chunk_root.name.begins_with("chunk_0002r"): + var beach := chunk_root.find_child( + "chunk_0002", true, false + ) as MeshInstance3D + assert(beach != null and beach.mesh != null) + var material := beach.get_active_material(0) + assert(material != null and material.resource_name == "sand") + found_beach = true + elif ( + chunk_root.name.begins_with("chunk_0003r") + or chunk_root.name.begins_with("chunk_0016r") + ): + var stream_id := ( + &"chunk_0016" + if chunk_root.name.begins_with("chunk_0016r") + else &"chunk_0003" + ) + var stream := chunk_root.find_child( + String(stream_id), true, false + ) as MeshInstance3D + assert(stream != null and stream.mesh != null) + var stream_materials := _material_names(stream) + assert("dirt" in stream_materials) + assert("grass_lite" in stream_materials) + assert("dirt_wall" in stream_materials) + if stream_id == &"chunk_0003": + found_stream = true + elif chunk_root.name.begins_with("chunk_0004r"): + var pond := chunk_root.find_child( + "chunk_0004", true, false + ) as MeshInstance3D + assert(pond != null and pond.mesh != null) + for surface_index: int in pond.mesh.get_surface_count(): + var arrays := pond.mesh.surface_get_arrays(surface_index) + var normals := arrays[Mesh.ARRAY_NORMAL] as PackedVector3Array + for normal: Vector3 in normals: + assert(normal.y >= -0.001) + _validate_pond_collision(region, pond) + found_pond = true + elif chunk_root.name.begins_with("chunk_0005r"): + var grass_ocean_edge := chunk_root.find_child( + "chunk_0005", true, false + ) as MeshInstance3D + assert(grass_ocean_edge != null and grass_ocean_edge.mesh != null) + var edge_materials := _material_names(grass_ocean_edge) + assert("grass_lite" in edge_materials) + assert("cliff_wall" in edge_materials) + found_grass_ocean_edge = true + elif chunk_root.name.begins_with("chunk_0006r"): + var grass_beach_transition := chunk_root.find_child( + "chunk_0006", true, false + ) as MeshInstance3D + assert( + grass_beach_transition != null + and grass_beach_transition.mesh != null + ) + var transition_materials := _material_names( + grass_beach_transition + ) + assert("sand" in transition_materials) + assert("grass_lite" in transition_materials) + assert("cliff_wall" in transition_materials) + found_grass_beach_transition = true + elif chunk_root.name.begins_with("chunk_0007r"): + var grass_ocean_corner := chunk_root.find_child( + "chunk_0007", true, false + ) as MeshInstance3D + assert(grass_ocean_corner != null and grass_ocean_corner.mesh != null) + var corner_materials := _material_names(grass_ocean_corner) + assert("grass_lite" in corner_materials) + assert("cliff_wall" in corner_materials) + found_grass_ocean_corner = true + elif chunk_root.name.begins_with("chunk_0008r"): + var beach_ocean_corner := chunk_root.find_child( + "chunk_0008", true, false + ) as MeshInstance3D + assert(beach_ocean_corner != null and beach_ocean_corner.mesh != null) + var beach_corner_materials := _material_names(beach_ocean_corner) + assert("sand" in beach_corner_materials) + found_beach_ocean_corner = true + elif chunk_root.name.begins_with("chunk_0013r"): + var grass_sand_diagonal := chunk_root.find_child( + "chunk_0013", true, false + ) as MeshInstance3D + assert(grass_sand_diagonal != null and grass_sand_diagonal.mesh != null) + var diagonal_materials := _material_names(grass_sand_diagonal) + assert("grass_lite" in diagonal_materials) + assert("sand" in diagonal_materials) + found_grass_sand_diagonal = true + assert(found_stream) + assert(found_pond) + assert(found_grass_sand_diagonal) + if beach_family: + assert(found_beach) + assert(found_beach_ocean_corner) + assert(not found_grass_ocean_edge) + assert(not found_grass_ocean_corner) + else: + assert(not found_beach) + assert(not found_beach_ocean_corner) + assert(found_grass_ocean_edge) + assert(found_grass_ocean_corner) + assert(not found_grass_beach_transition) + + +func _material_names(mesh_instance: MeshInstance3D) -> PackedStringArray: + var result := PackedStringArray() + for surface_index: int in mesh_instance.mesh.get_surface_count(): + var material := mesh_instance.get_active_material(surface_index) + if material != null: + result.append(material.resource_name) + return result + + +func _validate_projected_terrain_materials(root: Node) -> void: + var expected_sizes := { + "grass_lite": 1.75, + "sand": 2.6, + "dirt": 2.5, + } + var surface_counts := { + "grass_lite": 0, + "sand": 0, + "dirt": 0, + } + _validate_projected_material_node(root, expected_sizes, surface_counts) + for material_name: String in expected_sizes: + assert(surface_counts[material_name] > 0) + + +func _validate_projected_material_node( + root: Node, + expected_sizes: Dictionary, + surface_counts: Dictionary, +) -> void: + var mesh_instance := root as MeshInstance3D + if mesh_instance != null and mesh_instance.mesh != null: + for surface_index: int in mesh_instance.mesh.get_surface_count(): + var material := mesh_instance.get_active_material(surface_index) + if material == null or not expected_sizes.has(material.resource_name): + continue + var shader_material := material as ShaderMaterial + assert(shader_material != null and shader_material.shader != null) + assert( + shader_material.shader.resource_path + == "res://world/materials/terrain_surface_projection.gdshader" + ) + assert( + is_equal_approx( + float(shader_material.get_shader_parameter( + &"tile_world_size" + )), + float(expected_sizes[material.resource_name]), + ) + ) + surface_counts[material.resource_name] += 1 + for child: Node in root.get_children(): + _validate_projected_material_node( + child, + expected_sizes, + surface_counts, + ) + + +func _validate_pond_collision( + region: GeneratedWorldRegion, + pond: MeshInstance3D, +) -> void: + var best_centroid := Vector3.ZERO + var best_height := -INF + for surface_index: int in pond.mesh.get_surface_count(): + var arrays := pond.mesh.surface_get_arrays(surface_index) + var vertices := arrays[Mesh.ARRAY_VERTEX] as PackedVector3Array + var normals := arrays[Mesh.ARRAY_NORMAL] as PackedVector3Array + var indices := arrays[Mesh.ARRAY_INDEX] as PackedInt32Array + var triangle_count := ( + indices.size() / 3 if not indices.is_empty() else vertices.size() / 3 + ) + for triangle_index: int in triangle_count: + var offset := triangle_index * 3 + var index_a: int = indices[offset] if not indices.is_empty() else offset + var index_b: int = ( + indices[offset + 1] if not indices.is_empty() else offset + 1 + ) + var index_c: int = ( + indices[offset + 2] if not indices.is_empty() else offset + 2 + ) + var a: Vector3 = vertices[index_a] + var b: Vector3 = vertices[index_b] + var c: Vector3 = vertices[index_c] + var normal := ( + (normals[index_a] + normals[index_b] + normals[index_c]) / 3.0 + ).normalized() + var centroid := (a + b + c) / 3.0 + if normal.y > 0.5 and centroid.y > best_height: + best_height = centroid.y + best_centroid = centroid + assert(best_height > -INF) + var target := pond.global_transform * best_centroid + var query := PhysicsRayQueryParameters3D.create( + target + Vector3.UP * 2.0, + target + Vector3.DOWN * 2.0, + 1, + ) + var hit := region.get_world_3d().direct_space_state.intersect_ray(query) + assert(not hit.is_empty()) + var collider := hit.get("collider") as Node + assert( + collider != null + and collider.has_meta(&"terrain_collision_batch") + ) + + +func _decoration_group_count( + region: GeneratedWorldRegion, + group: StringName, +) -> int: + var count := 0 + var decorations := region.get_node("Decorations") as Node3D + for child: Node in decorations.get_children(): + var stable_id := StringName(child.get_meta(&"terrain_prop_id", &"")) + var definition := region.get_prop_catalog().definition_for_id(stable_id) + if definition != null and definition.procedural_group == group: + count += 1 + return count + + +func _decoration_biome_group_count( + region: GeneratedWorldRegion, + biome_id: StringName, + group: StringName, +) -> int: + var count := 0 + var decorations := region.get_node("Decorations") as Node3D + for child: Node in decorations.get_children(): + if StringName(child.get_meta(&"terrain_biome_id", &"")) != biome_id: + continue + var prop_id := StringName(child.get_meta(&"terrain_prop_id", &"")) + var definition := region.get_prop_catalog().definition_for_id(prop_id) + if definition != null and definition.procedural_group == group: + count += 1 + return count + + +func _biome_signature( + region: GeneratedWorldRegion, + generator: TerrainChunkGenerator, +) -> PackedStringArray: + var result := PackedStringArray() + for row: int in generator.grid_size.y: + for column: int in generator.grid_size.x: + result.append( + String(region.get_biome_at(Vector2i(column, row))) + ) + return result + + +func _placement_count(keys: PackedStringArray, stable_id: String) -> int: + var count := 0 + for key: String in keys: + if key.begins_with(stable_id + "@"): + count += 1 + return count + + +func _decoration_signature(region: GeneratedWorldRegion) -> PackedStringArray: + var result := PackedStringArray() + var decorations := region.get_node("Decorations") as Node3D + for child: Node in decorations.get_children(): + var prop := child as Node3D + result.append("%s:%s:%s" % [ + prop.name, + prop.position, + prop.rotation, + ]) + return result diff --git a/tests/generated_world_runtime_validation.gd.uid b/tests/generated_world_runtime_validation.gd.uid new file mode 100644 index 0000000..060cb22 --- /dev/null +++ b/tests/generated_world_runtime_validation.gd.uid @@ -0,0 +1 @@ +uid://opamwsr0t7px diff --git a/tests/home_spawn_multiplayer_validation.gd b/tests/home_spawn_multiplayer_validation.gd new file mode 100644 index 0000000..1f16147 --- /dev/null +++ b/tests/home_spawn_multiplayer_validation.gd @@ -0,0 +1,178 @@ +extends SceneTree + +const MainScene: PackedScene = preload("res://main/main.tscn") +const TEST_PORT: int = 18222 + + +func _initialize() -> void: + call_deferred("_run") + + +func _run() -> void: + var arguments: PackedStringArray = OS.get_cmdline_user_args() + if arguments.has("host"): + await _run_host() + return + if arguments.has("client"): + await _run_client() + return + push_error("Home spawn validation needs host or client mode.") + quit(1) + + +func _run_host() -> void: + var main: Node = await _create_initialized_main() + var session := main.get_node("%NetworkSession") as NetworkSession + var network_home := main.get_node( + "%NetworkHomeService" + ) as NetworkHomeService + var home_world := main.get_node("%HomeWorldService") as HomeWorldService + var spawn_service := main.get_node( + "%PlayerSpawnService" + ) as PlayerSpawnService + var save_manager := main.get("_save_manager") as PlayerSaveManager + assert(bool(main.call( + "_apply_world", WorldLayout.STARTER_ISLAND, 1, true + ))) + assert(bool(main.call( + "_prepare_host_world", WorldLayout.STARTER_ISLAND, 1 + ))) + assert(save_manager.initialize_new_game(1, WorldLayout.STARTER_ISLAND)) + assert(session.start_private_host(TEST_PORT)) + main.call("_enter_gameplay") + assert(session.set_host_open(true)) + + var host_fingerprint: String = session.get_local_identity_fingerprint() + assert(await _wait_for_home(network_home, host_fingerprint)) + var host_avatar: Player = spawn_service.get_avatar(1) + var host_spawn: Transform3D = home_world.get_exterior_spawn_transform( + host_fingerprint + ) + assert(_same_door_position(host_avatar.global_position, host_spawn.origin)) + assert(network_home.request_enter(host_fingerprint)) + await physics_frame + host_avatar.global_position = home_world.get_interior_exit_position( + host_fingerprint + ) + assert(network_home.request_exit()) + await physics_frame + assert(_same_door_position(host_avatar.global_position, host_spawn.origin)) + + var remote_peer_id: int = await _wait_for_remote_peer(session) + assert(remote_peer_id > 1) + var remote_record := session.get_peer_record(remote_peer_id) + var remote_fingerprint: String = remote_record.identity_fingerprint + assert(await _wait_for_home(network_home, remote_fingerprint)) + var remote_avatar: Player = spawn_service.get_avatar(remote_peer_id) + var remote_spawn: Transform3D = home_world.get_exterior_spawn_transform( + remote_fingerprint + ) + assert(_same_door_position( + remote_avatar.global_position, remote_spawn.origin + )) + + var disconnect_deadline: int = Time.get_ticks_msec() + 12000 + while ( + Time.get_ticks_msec() < disconnect_deadline + and session.is_authenticated_peer(remote_peer_id) + ): + await process_frame + assert(not session.is_authenticated_peer(remote_peer_id)) + print("Home spawn multiplayer host validation: PASS") + await _cleanup(main, session) + + +func _run_client() -> void: + var main: Node = await _create_initialized_main() + main.call( + "_on_title_join_game_requested", + "127.0.0.1:%d" % TEST_PORT, + ) + var session := main.get_node("%NetworkSession") as NetworkSession + var network_home := main.get_node( + "%NetworkHomeService" + ) as NetworkHomeService + var home_world := main.get_node("%HomeWorldService") as HomeWorldService + var deadline: int = Time.get_ticks_msec() + 20000 + while Time.get_ticks_msec() < deadline: + await process_frame + if session.state == NetworkSession.State.VERIFYING_SERVER_IDENTITY: + main.call("_confirm_server_trust") + if session.is_joined_client() and bool(main.get("_gameplay_started")): + break + assert(session.is_joined_client()) + var fingerprint: String = session.get_local_identity_fingerprint() + assert(await _wait_for_home(network_home, fingerprint)) + var player := main.get("_player") as Player + var exterior_spawn: Transform3D = ( + home_world.get_exterior_spawn_transform(fingerprint) + ) + deadline = Time.get_ticks_msec() + 5000 + while ( + Time.get_ticks_msec() < deadline + and not _same_door_position( + player.global_position, exterior_spawn.origin + ) + ): + await physics_frame + assert(_same_door_position( + player.global_position, exterior_spawn.origin + )) + print("Home spawn multiplayer client validation: PASS") + await _cleanup(main, session) + + +func _create_initialized_main() -> Node: + root.size = Vector2i(1280, 720) + var main: Node = MainScene.instantiate() + root.add_child(main) + for _frame: int in 4: + await process_frame + if not bool(main.get("_application_initialized")): + main.call("_activate_selected_data_path", "", true) + for _frame: int in 8: + await process_frame + assert(bool(main.get("_application_initialized"))) + return main + + +func _wait_for_home( + network_home: NetworkHomeService, + fingerprint: String, +) -> bool: + var deadline: int = Time.get_ticks_msec() + 10000 + while Time.get_ticks_msec() < deadline: + await process_frame + var manifests: Dictionary = network_home.get( + "_manifests_by_fingerprint" + ) + if manifests.has(fingerprint): + return true + return false + + +func _wait_for_remote_peer(session: NetworkSession) -> int: + var deadline: int = Time.get_ticks_msec() + 20000 + while Time.get_ticks_msec() < deadline: + await process_frame + for peer_id: int in session.get_authenticated_peer_ids(): + if peer_id != session.get_local_peer_id(): + return peer_id + return 0 + + +func _same_door_position(first: Vector3, second: Vector3) -> bool: + return ( + Vector2(first.x, first.z).distance_to(Vector2(second.x, second.z)) + < 0.08 + and absf(first.y - second.y) < 0.3 + ) + + +func _cleanup(main: Node, session: NetworkSession) -> void: + session.disconnect_session("") + main.queue_free() + for _frame: int in 4: + await process_frame + await create_timer(0.1).timeout + quit() diff --git a/tests/home_spawn_multiplayer_validation.gd.uid b/tests/home_spawn_multiplayer_validation.gd.uid new file mode 100644 index 0000000..06150f2 --- /dev/null +++ b/tests/home_spawn_multiplayer_validation.gd.uid @@ -0,0 +1 @@ +uid://bndtkip5p6xma diff --git a/tests/inventory_notepad_art_validation.gd b/tests/inventory_notepad_art_validation.gd index 2a526e4..d871b49 100644 --- a/tests/inventory_notepad_art_validation.gd +++ b/tests/inventory_notepad_art_validation.gd @@ -1,14 +1,22 @@ extends SceneTree const PlayerMenuScene = preload("res://ui/player_menu.tscn") +const HotbarScene = preload("res://ui/hotbar.tscn") const UIReferencePresentationType = preload( "res://ui/ui_reference_presentation.gd" ) +const FishSaleResultType = preload("res://economy/fish_sale_result.gd") +const CurrencyPresentationType = preload( + "res://ui/currency_presentation.gd" +) +const PelicanBuyer = preload("res://economy/buyers/pelicans.tres") const EXPECTED_HOST_SIZE := Vector2(278.0, 484.0) const EXPECTED_ART_SIZE := Vector2(306.28125, 580.8) const EXPECTED_ART_POSITION := Vector2(-4.140625, -28.4) -const INVENTORY_PANEL_RECT := Rect2(54.0, 166.0, 882.0, 484.0) -const NOTEPAD_HOST_RECT := Rect2(952.0, 166.0, 278.0, 484.0) +const LEGACY_COOLER_PANEL_RECT := Rect2(54.0, 166.0, 882.0, 484.0) +const LEGACY_COOLER_NOTEPAD_RECT := Rect2(952.0, 166.0, 278.0, 484.0) +const INVENTORY_PANEL_RECT := Rect2(199.0, 166.0, 882.0, 484.0) +const NOTEPAD_HOST_RECT := Rect2(501.0, 166.0, 278.0, 484.0) const NOTEPAD_ART_RECT := Rect2( NOTEPAD_HOST_RECT.position + EXPECTED_ART_POSITION, EXPECTED_ART_SIZE, @@ -57,7 +65,13 @@ func _run() -> void: + InventoryNotepad.NOTEPAD_ART_OFFSET )) _validate_shared_inventory_geometry(player_menu) + _validate_first_open_inventory(player_menu) + await _validate_inventory_grid_centering(player_menu, presentation_stage) + _validate_utility_page_geometry(player_menu) + await _validate_profile_content_bounds(player_menu) + await _validate_hotbar_centering(presentation_stage) _validate_inventory_layering(player_menu) + _validate_sale_confirmation_copy(player_menu) _validate_tackle_to_items_transition(player_menu) _validate_cooler_notepad_typography(player_menu) _validate_resolution_matrix() @@ -103,23 +117,296 @@ func _apply_stage_layout(stage: Control, display_size: Vector2) -> void: func _validate_shared_inventory_geometry(player_menu: PlayerMenu) -> void: for node_name: StringName in [ - &"CoolerOuterWall", &"BagOuterWall", &"TackleMainPanel", ]: var main_panel := player_menu.get_node("%%%s" % node_name) as Control assert(main_panel != null) assert(main_panel.position.is_equal_approx(INVENTORY_PANEL_RECT.position)) - assert(main_panel.size.is_equal_approx(INVENTORY_PANEL_RECT.size)) + assert( + main_panel.size.is_equal_approx(INVENTORY_PANEL_RECT.size), + "%s was %s, expected %s" % [ + node_name, + main_panel.size, + INVENTORY_PANEL_RECT.size, + ], + ) + var cooler_panel := player_menu.get_node("%CoolerOuterWall") as Control + var cooler_notepad := player_menu.get_node("%DetailConstellation") as Control + assert(cooler_panel.position.is_equal_approx( + LEGACY_COOLER_PANEL_RECT.position + )) + assert(cooler_panel.size.is_equal_approx(LEGACY_COOLER_PANEL_RECT.size)) + assert(cooler_notepad.position.is_equal_approx( + LEGACY_COOLER_NOTEPAD_RECT.position + )) + assert(cooler_notepad.size.is_equal_approx( + LEGACY_COOLER_NOTEPAD_RECT.size + )) for node_name: StringName in [ - &"DetailConstellation", &"BagDetailConstellation", &"TackleDetailPanel", ]: var host := player_menu.get_node("%%%s" % node_name) as Control assert(host != null) - assert(host.position.is_equal_approx(Vector2(952.0, 166.0))) + assert(host.position.is_equal_approx(NOTEPAD_HOST_RECT.position)) assert(host.size.is_equal_approx(EXPECTED_HOST_SIZE)) + assert(is_equal_approx(INVENTORY_PANEL_RECT.get_center().x, 640.0)) + + +func _validate_first_open_inventory(player_menu: PlayerMenu) -> void: + var legacy_slots: Array = player_menu.get("_bag_slot_nodes") as Array + assert(legacy_slots.is_empty()) + var old_slot_nodes: Array[Node] = player_menu.find_children( + "*", "BagStorageSlot", true, false + ) + assert(old_slot_nodes.is_empty()) + + +func _validate_inventory_grid_centering( + player_menu: PlayerMenu, + stage: Control, +) -> void: + var grid := player_menu.get("_general_inventory_grid") as Control + assert(grid != null) + grid.custom_minimum_size = Vector2(782.0, 342.0) + grid.size = grid.custom_minimum_size + player_menu.call("_layout_general_inventory_grid") + await process_frame + assert(is_equal_approx(grid.position.y, 39.0)) + assert( + is_equal_approx( + grid.get_global_rect().get_center().x, + stage.get_global_rect().get_center().x, + ), + "inventory center %s did not match stage center %s" % [ + grid.get_global_rect().get_center().x, + stage.get_global_rect().get_center().x, + ], + ) + + +func _validate_utility_page_geometry(player_menu: PlayerMenu) -> void: + for page_name: StringName in [ + &"TheNetPage", + &"MailPage", + &"ProfilePage", + &"PlayersPage", + ]: + var page := player_menu.get_node("%%%s" % page_name) as Control + assert(page != null) + var shell := page.find_child( + "UtilityMainBox", true, false + ) as Control + assert(shell != null) + assert(shell.position.is_equal_approx(UtilityPageStyle.LAPTOP_RECT.position)) + assert(shell.size.is_equal_approx(UtilityPageStyle.LAPTOP_RECT.size)) + assert(is_equal_approx(shell.get_rect().get_center().x, 640.0)) + + +func _validate_profile_content_bounds(player_menu: PlayerMenu) -> void: + var profile := player_menu.get_node("%ProfilePage") as ProfilePage + assert(profile != null) + var menu_was_visible: bool = player_menu.visible + var profile_was_visible: bool = profile.visible + player_menu.visible = true + profile.visible = true + await process_frame + await process_frame + var option_list := profile.get("_option_list") as Control + var body := option_list.get_parent() as Control + var preview := profile.get("_preview") as Control + var shell := profile.find_child("UtilityMainBox", true, false) as Control + var content_zone := profile.find_child( + "ProfileContentZone", true, false + ) as Control + var profile_layout := profile.find_child( + "ProfileLayout", true, false + ) as Control + var account_row := profile.find_child( + "ProfileAccountRow", true, false + ) as Control + var body_panel := profile.find_child( + "ProfileBodyPanel", true, false + ) as Control + assert(option_list != null and body != null and preview != null) + assert(shell != null and content_zone != null and profile_layout != null) + assert(account_row != null and body_panel != null) + var content_frame_size := Vector2( + UtilityPageStyle.LAPTOP_RECT.size.x - 40.0, + UtilityPageStyle.LAPTOP_RECT.size.y - 42.0, + ) + assert( + content_zone.size.is_equal_approx(content_frame_size), + ( + "profile content zone changed size: %s != %s; " + + "layout min=%s account min=%s body min=%s" + ) % [ + content_zone.size, + content_frame_size, + profile_layout.get_combined_minimum_size(), + account_row.get_combined_minimum_size(), + body_panel.get_combined_minimum_size(), + ], + ) + assert( + profile_layout.size.is_equal_approx( + UtilityPageStyle.LAPTOP_CONTENT_SIZE + ), + "profile layout changed size: %s != %s" % [ + profile_layout.size, + UtilityPageStyle.LAPTOP_CONTENT_SIZE, + ], + ) + assert( + profile_layout.get_combined_minimum_size().x + <= profile_layout.size.x, + "profile layout exceeded shared content width: %s > %s" % [ + profile_layout.get_combined_minimum_size().x, + profile_layout.size.x, + ], + ) + var content_rect: Rect2 = profile_layout.get_global_rect() + for section: Control in [account_row, body_panel]: + var section_rect: Rect2 = section.get_global_rect() + assert(section_rect.position.x >= content_rect.position.x - 0.5) + assert(section_rect.end.x <= content_rect.end.x + 0.5) + var category_ids: Array[String] = [] + for category_id: String in CharacterCustomizationCatalog.CATEGORY_IDS: + category_ids.append(category_id) + category_ids.append("voice") + for category_id: String in category_ids: + profile.call("_select_category", category_id) + await process_frame + await process_frame + assert( + shell.position.is_equal_approx( + UtilityPageStyle.LAPTOP_RECT.position + ), + "%s profile shell position changed: %s" % [ + category_id, + shell.position, + ], + ) + assert( + shell.size.is_equal_approx(UtilityPageStyle.LAPTOP_RECT.size), + "%s profile shell size changed: %s != %s" % [ + category_id, + shell.size, + UtilityPageStyle.LAPTOP_RECT.size, + ], + ) + assert( + content_zone.size.is_equal_approx(content_frame_size), + "%s profile content zone changed size: %s != %s" % [ + category_id, + content_zone.size, + content_frame_size, + ], + ) + assert( + profile_layout.size.is_equal_approx( + UtilityPageStyle.LAPTOP_CONTENT_SIZE + ), + "%s profile layout changed size: %s != %s" % [ + category_id, + profile_layout.size, + UtilityPageStyle.LAPTOP_CONTENT_SIZE, + ], + ) + assert( + profile_layout.get_combined_minimum_size().x + <= profile_layout.size.x, + "%s profile layout exceeded shared content width: %s > %s" % [ + category_id, + profile_layout.get_combined_minimum_size().x, + profile_layout.size.x, + ], + ) + var category_body_rect: Rect2 = body_panel.get_global_rect() + assert( + category_body_rect.end.x <= content_rect.end.x + 0.5, + "%s body overflowed shared content: %s > %s" % [ + category_id, + category_body_rect.end.x, + content_rect.end.x, + ], + ) + assert( + category_body_rect.end.y <= content_rect.end.y + 0.5, + "%s body overflowed shared content vertically: %s > %s" % [ + category_id, + category_body_rect.end.y, + content_rect.end.y, + ], + ) + assert( + body.get_combined_minimum_size().x <= body.size.x, + "%s customization content overflowed its body: %s > %s" % [ + category_id, + body.get_combined_minimum_size().x, + body.size.x, + ], + ) + assert( + preview.get_global_rect().end.x + <= content_rect.end.x + 0.5, + "%s preview overflowed the utility content area" % category_id, + ) + profile.call("_select_category", "fur_pattern") + profile.call("_select_fur_section", "colors") + await process_frame + await process_frame + var color_panel := profile.find_child( + "FurColorOptionsPanel", true, false + ) as Control + var color_scroll := profile.find_child( + "FurColorScroll", true, false + ) as ScrollContainer + assert(color_panel != null and color_scroll != null) + assert( + color_panel.get_global_rect().end.y + <= body_panel.get_global_rect().end.y + 0.5, + "fur color panel overflowed profile body: %s > %s" % [ + color_panel.get_global_rect().end.y, + body_panel.get_global_rect().end.y, + ], + ) + assert( + profile_layout.get_combined_minimum_size().y + <= profile_layout.size.y, + "fur colors expanded profile layout vertically: %s > %s" % [ + profile_layout.get_combined_minimum_size().y, + profile_layout.size.y, + ], + ) + profile.visible = profile_was_visible + player_menu.visible = menu_was_visible + + +func _validate_hotbar_centering(parent: Control) -> void: + var hotbar := HotbarScene.instantiate() as HotbarUI + parent.add_child(hotbar) + await process_frame + var presentation := hotbar.get_node( + "%HotbarPresentationScaleRoot" + ) as Control + var field := hotbar.get_node("%BubbleField") as Control + hotbar.set_player_menu_context(true) + var displayed_center_x: float = ( + presentation.position.x + + field.get_rect().get_center().x * presentation.scale.x + ) + assert(is_equal_approx(displayed_center_x, 640.0)) + var displayed_top: float = ( + presentation.position.y + field.position.y * presentation.scale.y + ) + var displayed_bottom: float = ( + displayed_top + field.size.y * presentation.scale.y + ) + assert(displayed_top < INVENTORY_PANEL_RECT.end.y) + assert(displayed_bottom > INVENTORY_PANEL_RECT.end.y) + hotbar.queue_free() func _validate_inventory_layering(player_menu: PlayerMenu) -> void: @@ -136,13 +423,31 @@ func _validate_inventory_layering(player_menu: PlayerMenu) -> void: assert(cooler_panel != null) assert(tackle_panel != null) assert(inventory_tabs != null) - assert(items_tab != null and items_tab.text == "Items") - assert(bait_list != null and bait_list.columns == 3) - assert(lure_list != null and lure_list.columns == 3) + assert(items_tab != null and not items_tab.visible) + assert(not (player_menu.get_node("%CoolerSubTab") as Button).visible) + assert((player_menu.get_node("%BagSubTab") as Button).text == "Inventory") + assert(bait_list != null and bait_list.columns == 4) + assert(lure_list != null and lure_list.columns == 4) assert(bait_list.get_theme_constant("h_separation") == 28) assert(lure_list.get_theme_constant("h_separation") == 28) assert(sale_confirmation.z_index > cooler_panel.z_index) assert(sale_confirmation.z_index > tackle_panel.z_index) + assert( + (player_menu.get_node("%BagDetailConstellation") as Control).z_index + > bag_panel.z_index + ) + assert( + (player_menu.get_node("%BagModalBlocker") as Control).z_index + > bag_panel.z_index + ) + assert( + (player_menu.get_node("%BagDetailConstellation") as Control).z_index + > (player_menu.get_node("%BagModalBlocker") as Control).z_index + ) + assert( + (player_menu.get_node("%TackleDetailPanel") as Control).z_index + > tackle_panel.z_index + ) # The contextual Hotbar uses z=90 while the Player Menu is open. assert(sale_confirmation.z_index > 90) assert(sale_confirmation.position.is_equal_approx(Vector2(380.0, 265.0))) @@ -158,26 +463,78 @@ func _validate_inventory_layering(player_menu: PlayerMenu) -> void: ) +func _validate_sale_confirmation_copy(player_menu: PlayerMenu) -> void: + var preview := FishSaleResultType.new() + preview.fish_count = 1 + preview.payout = 3 + preview.base_value = 12 + var message: String = str(player_menu.call( + "_sale_confirmation_text", + preview, + PelicanBuyer, + preview.base_value, + )) + assert(message == ( + "[center]You can sell this fish to the pelicans now for %s, " + + "but the shop is willing to pay %s![/center]" + ) % [ + CurrencyPresentationType.bbcode_amount(preview.payout, 22), + CurrencyPresentationType.bbcode_amount(preview.base_value, 22), + ]) + assert((player_menu.get_node("%ConfirmSaleButton") as Button).text == "sell now") + assert((player_menu.get_node("%CancelSaleButton") as Button).text == "nevermind") + + func _validate_tackle_to_items_transition(player_menu: PlayerMenu) -> void: - var empty_state := player_menu.get_node("%BagEmptyState") as Label - player_menu.set("_bag_view", PlayerMenu.BagView.EQUIPMENT) - player_menu.call("_refresh_bag") - assert(empty_state.text == "No equipment in your Bag.") + var inventory_notepad := player_menu.get_node( + "%BagDetailBubble" + ) as InventoryNotepad + assert(inventory_notepad != null) + assert(inventory_notepad.title_text == "inventory notes") player_menu.call( "_show_section_immediate", PlayerMenu.Section.TACKLE_BOX ) - player_menu.call("_show_bag_view", PlayerMenu.BagView.CONSUMABLES) - assert( - player_menu.get("_current_section") == PlayerMenu.Section.BAG - ) - assert( - player_menu.get("_bag_view") == PlayerMenu.BagView.CONSUMABLES - ) - assert(empty_state.text == "No items in your Bag.") + player_menu.call("_show_inventory_tab", 0) player_menu.call("_cancel_page_tween") - player_menu.call( - "_show_section_immediate", PlayerMenu.Section.COOLER + player_menu.call("_show_section_immediate", PlayerMenu.Section.BAG) + player_menu.call("_update_bag_detail") + assert(player_menu.get("_current_section") == PlayerMenu.Section.BAG) + assert(not (player_menu.get_node("%BagDetailConstellation") as Control).visible) + assert( + (player_menu.get_node("%BagSpriteDetailData") as Label).text + == "select an item for details." ) + player_menu.visible = true + player_menu.call("_set_content_interactive", true) + var no_actions: Array[BaseButton] = [] + player_menu.call( + "_open_inventory_notepad", + PlayerMenu.Section.BAG, + StringName("modal-test"), + no_actions, + ) + assert((player_menu.get_node("%BagDetailConstellation") as Control).visible) + assert((player_menu.get_node("%BagModalBlocker") as Control).visible) + assert( + (player_menu.get_node("%BagModalBlocker") as Control).mouse_filter + == Control.MOUSE_FILTER_STOP + ) + assert( + (player_menu.get_node("%InventoryTab") as Button).focus_mode + == Control.FOCUS_NONE + ) + assert( + (player_menu.get_node("%BagSpriteDetailData") as Label).get_theme_font( + "font" + ) == InventoryNotepad.NOTEPAD_FONT + ) + player_menu.call( + "_release_controller_ownership", false, false + ) + assert(not (player_menu.get_node("%BagModalBlocker") as Control).visible) + player_menu.call("_set_content_interactive", false) + player_menu.visible = false + player_menu.call("_cancel_page_tween") func _validate_cooler_notepad_typography(player_menu: PlayerMenu) -> void: @@ -190,11 +547,11 @@ func _validate_cooler_notepad_typography(player_menu: PlayerMenu) -> void: ) as Label var favorite := player_menu.get_node("%FavoriteBubble") as Button var sell := player_menu.get_node("%SellBubble") as Button - var sell_all := player_menu.get_node("%SellAllBubble") as Button assert(sort_choice != null) assert(sort_direction != null) assert(empty_selection != null) - assert(favorite != null and sell != null and sell_all != null) + assert(favorite != null and sell != null) + assert(player_menu.get_node_or_null("%SellAllBubble") == null) var displayed_value := sort_choice.get_node("%DisplayedValue") as Label assert(displayed_value != null) assert(displayed_value.get_theme_font_size("font_size") == 17) @@ -210,7 +567,6 @@ func _validate_cooler_notepad_typography(player_menu: PlayerMenu) -> void: assert(empty_selection.get_theme_font_size("font_size") == 20) assert(favorite.get_theme_font_size("font_size") == 19) assert(sell.get_theme_font_size("font_size") == 19) - assert(sell_all.get_theme_font_size("font_size") == 17) func _validate_resolution_matrix() -> void: @@ -310,28 +666,30 @@ func _to_screen_rect( func _capture_inventory_pages(player_menu: PlayerMenu) -> void: - if not OS.has_environment("NETFISHING_NOTEPAD_CAPTURE"): + if not OS.has_environment("straywild_NOTEPAD_CAPTURE"): return player_menu.visible = true var sections: Array[PlayerMenu.Section] = [ - PlayerMenu.Section.COOLER, PlayerMenu.Section.BAG, PlayerMenu.Section.TACKLE_BOX, ] - var suffixes: Array[String] = ["cooler", "equipment", "tackle"] + var suffixes: Array[String] = ["inventory", "tackle"] for index: int in sections.size(): player_menu.call("_show_section_immediate", sections[index]) await process_frame await process_frame await _save_capture(suffixes[index]) - player_menu.call("_show_section_immediate", PlayerMenu.Section.COOLER) + player_menu.call("_show_section_immediate", PlayerMenu.Section.BAG) var sale_confirmation := player_menu.get_node("%SaleConfirmation") as Control var confirmation_message := player_menu.get_node( "%ConfirmationMessage" ) as Label assert(sale_confirmation != null) assert(confirmation_message != null) - confirmation_message.text = "sell selected fish?" + confirmation_message.text = ( + "You can sell this fish to the pelicans now, " + + "but the shop will pay more!" + ) sale_confirmation.visible = true await process_frame await process_frame @@ -342,7 +700,7 @@ func _capture_inventory_pages(player_menu: PlayerMenu) -> void: func _save_capture(suffix: String) -> void: var image: Image = root.get_texture().get_image() var path: String = "%s-%s.png" % [ - OS.get_environment("NETFISHING_NOTEPAD_CAPTURE"), + OS.get_environment("straywild_NOTEPAD_CAPTURE"), suffix, ] assert(image.save_png(path) == OK) diff --git a/tests/inventory_storage_persistence_validation.gd b/tests/inventory_storage_persistence_validation.gd new file mode 100644 index 0000000..794f438 --- /dev/null +++ b/tests/inventory_storage_persistence_validation.gd @@ -0,0 +1,83 @@ +extends SceneTree + +const MainScene: PackedScene = preload("res://main/main.tscn") +const ItemCatalogResource: ItemCatalog = preload( + "res://items/catalog/item_catalog.tres" +) + + +func _initialize() -> void: + call_deferred("_run") + + +func _run() -> void: + root.size = Vector2i(1280, 720) + var main: Node = MainScene.instantiate() + root.add_child(main) + for _frame: int in 4: + await process_frame + if not bool(main.get("_application_initialized")): + main.call("_activate_selected_data_path", "", true) + for _frame: int in 8: + await process_frame + assert(bool(main.get("_application_initialized"))) + + var save_manager := main.get("_save_manager") as PlayerSaveManager + var player := main.get("_player") as Player + assert(save_manager != null and player != null) + const TEST_WORLD_SEED := 918273 + assert(save_manager.initialize_new_game( + TEST_WORLD_SEED, + WorldLayout.STARTER_ISLAND, + )) + save_manager.set_autosave_enabled(true) + assert(player.bag.add_item(&"art_kit")) + assert(player.bag.add_item(&"coffee")) + assert(player.bag.add_item(&"worms")) + assert(player.bag.add_item(&"the_standby")) + assert(player.equip_bait(ItemCatalogResource.get_item_by_id(&"worms"))) + assert(player.equip_lure(ItemCatalogResource.get_item_by_id(&"the_standby"))) + assert(player.bag.move_item_to_storage_slot(&"basic_fishing_rod", 14)) + assert(player.bag.move_item_to_storage_slot(&"coffee", 12)) + assert(save_manager.save_now()) + + var decoded: Dictionary = ProgressionSaveCodec.read_local_save( + str(save_manager.get("_save_path")) + ) + assert(bool(decoded.get("ok", false))) + var parsed: Dictionary = decoded["data"] + var records: Array = parsed["bag"]["items"] + assert(str(parsed["world"]["layout"]) == String(WorldLayout.STARTER_ISLAND)) + assert(int(parsed["world"]["seed"]) == TEST_WORLD_SEED) + assert(_saved_slot(records, &"basic_fishing_rod") == 14) + assert(_saved_slot(records, &"coffee") == 12) + + assert(player.bag.move_item_to_storage_slot(&"basic_fishing_rod", 0)) + assert(player.bag.move_item_to_storage_slot(&"coffee", 0)) + player.unequip_bait() + player.unequip_lure() + assert(save_manager.load_player_data()) + assert(save_manager.get_world_layout() == WorldLayout.STARTER_ISLAND) + assert(save_manager.get_world_seed() == TEST_WORLD_SEED) + assert(player.bag.get_storage_slot(&"basic_fishing_rod") == 14) + assert(player.bag.get_storage_slot(&"coffee") == 12) + assert(player.active_bait_id == &"worms") + assert(player.active_lure_id == &"the_standby") + + main.queue_free() + for _frame: int in 4: + await process_frame + await create_timer(0.1).timeout + print("Inventory storage persistence validation: PASS") + quit() + + +func _saved_slot(records: Array, item_id: StringName) -> int: + for value: Variant in records: + if ( + typeof(value) == TYPE_DICTIONARY + and str((value as Dictionary).get("item_id", "")) + == String(item_id) + ): + return int((value as Dictionary).get("storage_slot", -1)) + return -1 diff --git a/tests/inventory_storage_persistence_validation.gd.uid b/tests/inventory_storage_persistence_validation.gd.uid new file mode 100644 index 0000000..6edda3b --- /dev/null +++ b/tests/inventory_storage_persistence_validation.gd.uid @@ -0,0 +1 @@ +uid://bwp2jhs116hmw diff --git a/tests/inventory_storage_validation.gd b/tests/inventory_storage_validation.gd new file mode 100644 index 0000000..eccb66d --- /dev/null +++ b/tests/inventory_storage_validation.gd @@ -0,0 +1,127 @@ +extends SceneTree + +const Catalog: ItemCatalog = preload("res://items/catalog/item_catalog.tres") +const Bluegill: FishData = preload("res://fish/species/bluegill/bluegill.tres") + + +func _initialize() -> void: + call_deferred("_run") + + +func _run() -> void: + var state := Node.new() + root.add_child(state) + var bag := PlayerBag.new() + var catches := FishInventory.new() + var storage_capacity := PlayerCoolerCapacity.new() + var layout := PlayerInventoryLayout.new() + var hotbar := PlayerHotbar.new() + for node: Node in [bag, catches, storage_capacity, layout, hotbar]: + state.add_child(node) + bag.setup(Catalog) + layout.setup(bag, catches, Catalog, storage_capacity) + bag.set_inventory_layout(layout) + catches.set_inventory_layout(layout) + hotbar.setup(bag, Catalog, catches, layout) + + assert(bag.add_item(&"basic_fishing_rod", 1)) + assert(bag.add_item(&"coffee", 3)) + var fish_catch := _make_bluegill() + assert(catches.add_catch(fish_catch)) + + var inventory_grid := GeneralInventoryGrid.new() + inventory_grid.set_slot_presentation(Vector2(78.0, 78.0), 10) + root.add_child(inventory_grid) + inventory_grid.setup( + layout, + bag, + catches, + hotbar, + Catalog, + PlayerInventoryLayout.InventoryContainer.INVENTORY, + ) + var storage_grid := GeneralInventoryGrid.new() + root.add_child(storage_grid) + storage_grid.setup( + layout, + bag, + catches, + hotbar, + Catalog, + PlayerInventoryLayout.InventoryContainer.STORAGE, + ) + await process_frame + + var inventory_slots: Array = inventory_grid.get("_slots") + var storage_slots: Array = storage_grid.get("_slots") + assert(inventory_slots.size() == 36) + assert(inventory_grid.get_slots().size() == 9) + assert(inventory_grid.custom_minimum_size == Vector2(782.0, 342.0)) + assert(storage_capacity.get_capacity() == 9) + assert(storage_slots.size() == 72) + assert(storage_grid.get_slots().size() == 9) + assert((storage_slots[0] as Control).custom_minimum_size == Vector2(52.0, 52.0)) + assert((storage_slots[9] as GeneralInventorySlot).disabled) + + var coffee_slot := _find_slot(inventory_slots, &"coffee") + assert(coffee_slot != null) + (inventory_slots[7] as GeneralInventorySlot).call( + "_drop_data", + Vector2.ZERO, + {"kind": "bag_item", "item_id": "coffee"}, + ) + assert(int(layout.get_entry( + PlayerInventoryLayout.EntryKind.ITEM, &"coffee" + ).get("slot", -1)) == 7) + assert(coffee_slot.entry_identity.is_empty()) + + (storage_slots[0] as GeneralInventorySlot).call( + "_drop_data", + Vector2.ZERO, + {"kind": "cooler_fish", "catch_id": String(fish_catch.catch_id)}, + ) + assert(layout.get_container( + PlayerInventoryLayout.EntryKind.CATCH, fish_catch.catch_id + ) == PlayerInventoryLayout.InventoryContainer.STORAGE) + + assert(hotbar.assign_item(0, &"basic_fishing_rod")) + assert(not layout.is_item_in_inventory(&"basic_fishing_rod")) + (inventory_slots[8] as GeneralInventorySlot).call( + "_drop_data", + Vector2.ZERO, + {"kind": "hotbar_slot", "slot_index": 0}, + ) + assert(hotbar.get_item_id(0).is_empty()) + assert(layout.is_item_in_inventory(&"basic_fishing_rod")) + assert(int(layout.get_entry( + PlayerInventoryLayout.EntryKind.ITEM, &"basic_fishing_rod" + ).get("slot", -1)) == 8) + + print("Inventory storage validation: PASS") + state.free() + inventory_grid.free() + storage_grid.free() + quit() + + +func _make_bluegill() -> FishCatch: + var fish_catch := FishCatch.new() + fish_catch.fish = Bluegill + fish_catch.fish_id = Bluegill.id + fish_catch.catch_id = &"bluegill:inventory_storage_test" + fish_catch.weight_lb = Bluegill.get_minimum_weight() + fish_catch.display_scale = Bluegill.get_display_scale_for_weight( + fish_catch.weight_lb + ) + fish_catch.sale_value = Bluegill.get_sale_value_for_weight( + fish_catch.weight_lb + ) + return fish_catch + + +func _find_slot(slots: Array, identity: StringName) -> GeneralInventorySlot: + for candidate: Variant in slots: + var slot := candidate as GeneralInventorySlot + if slot != null and slot.entry_identity == identity: + return slot + return null diff --git a/tests/inventory_storage_validation.gd.uid b/tests/inventory_storage_validation.gd.uid new file mode 100644 index 0000000..1c8717c --- /dev/null +++ b/tests/inventory_storage_validation.gd.uid @@ -0,0 +1 @@ +uid://w6e06q8yfwp6 diff --git a/tests/job_multiplayer_validation.gd b/tests/job_multiplayer_validation.gd index c31d392..6c0fa5b 100644 --- a/tests/job_multiplayer_validation.gd +++ b/tests/job_multiplayer_validation.gd @@ -24,6 +24,10 @@ func _run_host() -> void: var main: Node = await _create_initialized_main() var session := main.get_node("%NetworkSession") as NetworkSession var jobs := main.get_node("%PlayerJobService") as PlayerJobService + assert(bool(main.call( + "_apply_world", WorldLayout.STARTER_ISLAND, 1, true + ))) + assert(session.set_host_world(WorldLayout.STARTER_ISLAND, 1)) assert(session.start_dedicated_host(TEST_PORT, 8, "127.0.0.1")) jobs.begin_progression_session() await process_frame diff --git a/tests/job_system_validation.gd b/tests/job_system_validation.gd index 32fe10e..65b7164 100644 --- a/tests/job_system_validation.gd +++ b/tests/job_system_validation.gd @@ -21,13 +21,17 @@ func _run() -> void: assert(bool(main.get("_application_initialized"))) var session := main.get_node("%NetworkSession") as NetworkSession assert(session != null) + assert(bool(main.call( + "_apply_world", WorldLayout.STARTER_ISLAND, 1, true + ))) + assert(session.set_host_world(WorldLayout.STARTER_ISLAND, 1)) var occupied_port := PacketPeerUDP.new() assert(occupied_port.bind(18137, "127.0.0.1") == OK) assert(session.start_private_host(18137, 3)) assert(session.get_host_port() == 18138) occupied_port.close() var save_manager := main.get("_save_manager") as PlayerSaveManager - assert(save_manager.initialize_new_game()) + assert(save_manager.initialize_new_game(1, WorldLayout.STARTER_ISLAND)) main.call("_enter_gameplay") await physics_frame await physics_frame @@ -49,6 +53,7 @@ func _run() -> void: _validate_weather_guarantees(board) _validate_late_board_weather_fallback() _validate_remote_tamper_rejection(jobs, board) + _validate_creature_jobs(jobs) var sell_job: Dictionary = _find_job( jobs.get_daily_jobs(), JobCatalog.Kind.SELL_TOTAL @@ -85,6 +90,10 @@ func _run() -> void: (player_menu.get_node("%NavigationCluster") as Control).get_child_count() == 7 ) + net_page.call("_select_view", TheNetPage.View.LIFETIME) + await process_frame + _validate_fishnet_bounds(net_page) + await _validate_compact_value_tooltips(net_page) await _validate_unavailable_fishnet_layout() var wallet_before: int = player.wallet.get_balance() @@ -195,16 +204,16 @@ func _run() -> void: assert(session.set_host_open(false)) assert(save_manager.save_now()) - var save_file := FileAccess.open( - str(save_manager.get("_save_path")), FileAccess.READ + var decoded: Dictionary = ProgressionSaveCodec.read_local_save( + str(save_manager.get("_save_path")) ) - assert(save_file != null) - var parsed: Variant = JSON.parse_string(save_file.get_as_text()) - save_file.close() - assert(typeof(parsed) == TYPE_DICTIONARY) - var save_data: Dictionary = parsed - assert(int(save_data.get("save_version", -1)) == 7) + assert(bool(decoded.get("ok", false))) + var save_data: Dictionary = decoded["data"] + assert(int(save_data.get("save_version", -1)) == 11) assert(PlayerJobService.validate_save_data(save_data.get("jobs", {}))) + assert(not PlayerHomeState.sanitize_save_data( + save_data.get("home", {}) + ).is_empty()) _validate_pause_session_switch(main, session) main.queue_free() @@ -263,6 +272,170 @@ func _validate_unavailable_fishnet_layout() -> void: await process_frame +func _validate_fishnet_bounds(page: TheNetPage) -> void: + var laptop := page.get_node("UtilityMainBox") as PanelContainer + var forecast_column := page.find_child( + "ForecastColumn", true, false + ) as VBoxContainer + var refresh_label := page.find_child( + "DailyRefreshLabel", true, false + ) as Label + var jobs_scroll := page.find_child("JobsScroll", true, false) as ScrollContainer + assert(laptop != null) + assert(forecast_column != null and refresh_label != null) + assert(jobs_scroll != null) + var laptop_rect: Rect2 = laptop.get_global_rect() + assert(forecast_column.get_global_rect().end.x <= laptop_rect.end.x) + assert(refresh_label.get_global_rect().end.x <= laptop_rect.end.x) + assert(refresh_label.get_global_rect().end.y <= laptop_rect.end.y) + assert(jobs_scroll.horizontal_scroll_mode == ScrollContainer.SCROLL_MODE_DISABLED) + var list := page.get("_list") as VBoxContainer + assert(list != null) + for row: Control in list.get_children(): + assert(row.size.x <= jobs_scroll.size.x + 0.5) + + +func _validate_compact_value_tooltips(page: TheNetPage) -> void: + assert(str(page.call("_compact_integer", 2400)) == "2.4k") + assert(str(page.call("_compact_integer", 2500)) == "2.5k") + var list := page.get("_list") as VBoxContainer + assert(list != null) + var jobs: Array[Dictionary] = [{ + "title": "compact tooltip check", + "description": "compact values keep their exact values on hover", + "target": 2500, + "progress": 2400, + "fish_coin": 1200, + "experience": 3400, + }] + page.call("_build_job_rows", jobs, "") + await process_frame + var row := list.get_child(list.get_child_count() - 1) as PanelContainer + assert(row != null) + var progress_bar: ProgressBar + var progress_count: Label + var reward: VBoxContainer + for child: Node in row.find_children("*", "ProgressBar", true, false): + progress_bar = child as ProgressBar + break + for child: Node in row.find_children("*", "Label", true, false): + var label := child as Label + if label != null and label.text == "2.4k / 2.5k": + progress_count = label + break + for child: Node in row.find_children("*", "VBoxContainer", true, false): + var candidate := child as VBoxContainer + if candidate != null and candidate.tooltip_text == ( + "1200 fish coins · 3400 xp" + ): + reward = candidate + break + assert(progress_bar != null) + assert(progress_bar.tooltip_text == "2400 / 2500") + assert(progress_bar.mouse_filter == Control.MOUSE_FILTER_STOP) + assert(progress_count != null) + assert(progress_count.tooltip_text == "2400 / 2500") + assert(progress_count.mouse_filter == Control.MOUSE_FILTER_STOP) + assert(reward != null) + assert(reward.mouse_filter == Control.MOUSE_FILTER_STOP) + row.queue_free() + await process_frame + + +func _validate_creature_jobs(jobs: PlayerJobService) -> void: + var fish_count: int = 0 + var insect_count: int = 0 + var shellfish_count: int = 0 + var candidates: Array[FishData] = [] + for fish: FishData in Catalog.candidates: + if fish == null or not fish.is_selectable(): + continue + candidates.append(fish) + match fish.get_creature_group(): + FishData.CreatureGroup.FISH: + fish_count += 1 + FishData.CreatureGroup.INSECT: + insect_count += 1 + FishData.CreatureGroup.SHELLFISH: + shellfish_count += 1 + assert(fish_count > 0 and insect_count > 0 and shellfish_count > 0) + + var lifetime: Array[Dictionary] = jobs.get_lifetime_jobs() + var fish_discovery: Dictionary = _find_job( + lifetime, JobCatalog.Kind.DISCOVER_SPECIES + ) + assert(int(fish_discovery.get("target", -1)) == fish_count) + for creature_group: int in [ + FishData.CreatureGroup.INSECT, + FishData.CreatureGroup.SHELLFISH, + ]: + assert(not _find_creature_job( + lifetime, + JobCatalog.Kind.CATCH_CREATURE_GROUP, + creature_group, + ).is_empty()) + assert(not _find_creature_job( + lifetime, + JobCatalog.Kind.DISCOVER_CREATURE_GROUP, + creature_group, + ).is_empty()) + assert(not _find_creature_job( + lifetime, + JobCatalog.Kind.MASTER_CREATURE_GROUP, + creature_group, + ).is_empty()) + + var daily_groups: Dictionary[int, bool] = {} + for seed_index: int in 64: + for job: Dictionary in JobCatalog.generate_daily_jobs( + "creature-job-validation-%d" % seed_index, + candidates, + true, + ): + if int(job.get("kind", -1)) == JobCatalog.Kind.CATCH_CREATURE_GROUP: + daily_groups[int(job.get("creature_group", -1))] = true + assert(daily_groups.has(FishData.CreatureGroup.INSECT)) + assert(daily_groups.has(FishData.CreatureGroup.SHELLFISH)) + + var beetle: FishData = Catalog.get_fish_by_id(&"beetle_stag_common") + assert(beetle != null) + var beetle_catch := _make_test_catch(beetle, &"job-beetle") + jobs.call("_on_authoritative_catch", beetle_catch) + var statistics: Dictionary = jobs.to_save_data().get("statistics", {}) + assert(int(statistics.get("fish_caught", -1)) == 0) + assert(int(statistics.get("insects_caught", -1)) == 1) + + +func _find_creature_job( + jobs: Array[Dictionary], + kind: JobCatalog.Kind, + creature_group: int, +) -> Dictionary: + for job: Dictionary in jobs: + if ( + int(job.get("kind", -1)) == kind + and int(job.get("creature_group", -1)) == creature_group + ): + return job + return {} + + +func _make_test_catch(fish: FishData, catch_id: StringName) -> FishCatch: + var fish_catch := FishCatch.new() + fish_catch.fish = fish + fish_catch.fish_id = fish.id + fish_catch.catch_id = catch_id + fish_catch.catch_sequence = 1 + fish_catch.weight_lb = fish.get_minimum_weight() + fish_catch.display_scale = fish.get_display_scale_for_weight( + fish_catch.weight_lb + ) + fish_catch.quality = FishQuality.Tier.BORING + fish_catch.sale_value = fish.get_sale_value_for_weight(fish_catch.weight_lb) + assert(fish_catch.is_valid()) + return fish_catch + + func _validate_weather_guarantees(board: Dictionary) -> void: var jobs: Array = board.get("jobs", []) var schedule: Array = board.get("weather_schedule", []) diff --git a/tests/keyboard_mouse_mapping_validation.gd b/tests/keyboard_mouse_mapping_validation.gd index b532f4b..1b95e01 100644 --- a/tests/keyboard_mouse_mapping_validation.gd +++ b/tests/keyboard_mouse_mapping_validation.gd @@ -7,6 +7,12 @@ const KeyboardMouseMappingPanelType = preload( "res://ui/keyboard_mouse_mapping_panel.gd" ) const SettingsPanelScene = preload("res://ui/settings_panel.tscn") +const FishingSpotScene = preload("res://fishing/fishing_spot.tscn") +const FishingSpotType = preload("res://fishing/fishing_spot.gd") +const CatchDifficultyProfileType = preload( + "res://fishing/catch_difficulty_profile.gd" +) +const PlayerType = preload("res://player/player.gd") func _initialize() -> void: @@ -22,11 +28,38 @@ func _run() -> void: defaults.size() == KeyboardMouseMappingManagerType.ROLE_ORDER.size() ) + assert( + not manager.get_binding( + KeyboardMouseMappingManagerType.ROLE_INTERACT + ).is_empty() + ) + assert( + manager.get_binding_label( + KeyboardMouseMappingManagerType.ROLE_INTERACT + ) == "e" + ) + assert( + KeyboardMouseMappingManagerType.ROLE_LABELS[ + KeyboardMouseMappingManagerType.ROLE_CAMERA_ZOOM_IN + ] == "hotbar select (+SHIFT to zoom)" + ) + assert( + KeyboardMouseMappingManagerType.ROLE_LABELS[ + KeyboardMouseMappingManagerType.ROLE_CAMERA_ZOOM_OUT + ] == "hotbar select (+SHIFT to zoom)" + ) assert( str(defaults[ str(KeyboardMouseMappingManagerType.ROLE_PRIMARY_ACTION) ].get("kind", "")) == "mouse_button" ) + assert( + str(defaults[ + str(KeyboardMouseMappingManagerType.ROLE_ALTERNATE_REEL) + ].get("kind", "")) == "key" + ) + assert(_has_physical_key(&"reel_alternate", KEY_QUOTELEFT)) + assert(_event_count(&"reel_alternate", true) == 0) assert( str(defaults[ str(KeyboardMouseMappingManagerType.ROLE_CHAT) @@ -60,6 +93,15 @@ func _run() -> void: )) assert(_has_mouse_button(&"fish_primary", MOUSE_BUTTON_XBUTTON1)) assert(not _has_mouse_button(&"fish_primary", MOUSE_BUTTON_LEFT)) + var alternate_reel_key := InputEventKey.new() + alternate_reel_key.physical_keycode = KEY_G + alternate_reel_key.pressed = true + assert(manager.set_binding( + KeyboardMouseMappingManagerType.ROLE_ALTERNATE_REEL, + manager.binding_from_event(alternate_reel_key), + )) + assert(_has_physical_key(&"reel_alternate", KEY_G)) + assert(_event_count(&"reel_alternate", true) == 0) var joypad_event := InputEventJoypadButton.new() joypad_event.button_index = JOY_BUTTON_A @@ -98,6 +140,11 @@ func _run() -> void: interact_key.pressed = true panel._input(interact_key) assert(_has_physical_key(&"interact", KEY_F)) + assert( + manager.get_binding_label( + KeyboardMouseMappingManagerType.ROLE_INTERACT + ) == "f" + ) assert(not panel.is_capturing()) var settings_panel := SettingsPanelScene.instantiate() as SettingsPanel @@ -107,8 +154,8 @@ func _run() -> void: "%ControllerMapping" ) as Button var keyboard_bubble := settings_panel.get_node("%KeyboardMapping") as Button - assert(controller_bubble.text == "controller\nbinds") - assert(keyboard_bubble.text == "keyboard\nbinds") + assert(controller_bubble.text == "controller binds") + assert(keyboard_bubble.text == "keyboard binds") assert(manager.reset_mapping()) assert(not manager.has_custom_mapping()) @@ -117,11 +164,78 @@ func _run() -> void: )) assert(_has_physical_key(&"jump", KEY_SPACE)) assert(_has_mouse_button(&"fish_primary", MOUSE_BUTTON_LEFT)) + assert(_has_physical_key(&"reel_alternate", KEY_QUOTELEFT)) + assert(_event_count(&"reel_alternate", true) == 0) assert(_has_physical_key(&"open_chat", KEY_T)) assert(_event_count(&"jump", true) == joypad_events_before) + var legacy_bindings: Dictionary = manager.get_active_bindings() + legacy_bindings.erase(str( + KeyboardMouseMappingManagerType.ROLE_ALTERNATE_REEL + )) + legacy_bindings[str(KeyboardMouseMappingManagerType.ROLE_JUMP)] = ( + manager.binding_from_event(rebind_key) + ) + var legacy_file := FileAccess.open( + KeyboardMouseMappingManagerType.MAPPING_PATH, + FileAccess.WRITE, + ) + assert(legacy_file != null) + legacy_file.store_string(JSON.stringify({ + "format_version": KeyboardMouseMappingManagerType.LEGACY_FORMAT_VERSION, + "bindings": legacy_bindings, + })) + legacy_file.close() + var migrated_manager := KeyboardMouseMappingManagerType.new() + root.add_child(migrated_manager) + await process_frame + assert(migrated_manager.has_custom_mapping()) + assert(_has_physical_key(&"jump", KEY_R)) + assert(_has_physical_key(&"reel_alternate", KEY_QUOTELEFT)) + assert(migrated_manager.reset_mapping()) + + var fishing_spot := FishingSpotScene.instantiate() as FishingSpotType + root.add_child(fishing_spot) + await process_frame + var local_player := PlayerType.new() + fishing_spot.set("_local_player", local_player) + fishing_spot.set("_gameplay_input_enabled", true) + fishing_spot.state = FishingSpotType.FishingState.FIGHTING + var catch_controller := fishing_spot.get_node("%CatchController") + var catch_profile := CatchDifficultyProfileType.new() + catch_profile.barrier_count_min = 0 + catch_profile.barrier_count_max = 0 + catch_controller.start_encounter(catch_profile, 1.0, 1) + var alternate_echo := InputEventKey.new() + alternate_echo.physical_keycode = KEY_QUOTELEFT + alternate_echo.pressed = true + alternate_echo.echo = true + assert(alternate_echo.is_action(&"reel_alternate")) + fishing_spot._unhandled_input(alternate_echo) + assert(not bool(catch_controller.get("_reel_input_held"))) + var alternate_key_press := InputEventKey.new() + alternate_key_press.physical_keycode = KEY_QUOTELEFT + alternate_key_press.pressed = true + assert(alternate_key_press.is_action(&"reel_alternate")) + fishing_spot._unhandled_input(alternate_key_press) + assert(bool(catch_controller.get("_reel_input_held"))) + catch_controller.set_reel_input(false) + var alternate_press := InputEventAction.new() + alternate_press.action = &"reel_alternate" + alternate_press.pressed = true + fishing_spot._unhandled_input(alternate_press) + assert(bool(catch_controller.get("_reel_input_held"))) + var alternate_release := InputEventAction.new() + alternate_release.action = &"reel_alternate" + alternate_release.pressed = false + fishing_spot._unhandled_input(alternate_release) + assert(not bool(catch_controller.get("_reel_input_held"))) + fishing_spot.free() + local_player.free() + settings_panel.queue_free() panel.queue_free() + migrated_manager.queue_free() manager.queue_free() print("Keyboard and mouse mapping validation: PASS") quit(0) diff --git a/tests/late_join_multiplayer_validation.gd b/tests/late_join_multiplayer_validation.gd new file mode 100644 index 0000000..6ea544f --- /dev/null +++ b/tests/late_join_multiplayer_validation.gd @@ -0,0 +1,369 @@ +extends SceneTree + +const MainScene: PackedScene = preload("res://main/main.tscn") +const TEST_PORT: int = 18194 +const LATE_MESSAGE: String = "late join visibility check" +const CLEAR_MESSAGE: String = "late join animation clear check" +const ACTIVE_ACTION: StringName = &"draw" + + +func _initialize() -> void: + call_deferred("_run") + + +func _run() -> void: + var arguments: PackedStringArray = OS.get_cmdline_user_args() + if arguments.has("host"): + await _run_host() + elif arguments.has("first"): + await _run_first_client() + elif arguments.has("late"): + await _run_late_client() + else: + push_error("Late-join validation needs host, first, or late mode.") + quit(1) + + +func _run_host() -> void: + var main: Node = await _create_initialized_main() + var session := main.get_node("%NetworkSession") as NetworkSession + var save_manager := main.get("_save_manager") as PlayerSaveManager + assert(bool(main.call( + "_apply_world", + WorldLayout.STARTER_ISLAND, + NetworkProtocol.DEFAULT_WORLD_SEED, + true, + ))) + assert(session.set_host_world( + WorldLayout.STARTER_ISLAND, + NetworkProtocol.DEFAULT_WORLD_SEED, + )) + assert(session.start_private_host(TEST_PORT)) + assert(save_manager.initialize_new_game( + NetworkProtocol.DEFAULT_WORLD_SEED, + WorldLayout.STARTER_ISLAND, + )) + main.call("_enter_gameplay") + for _frame: int in 4: + await physics_frame + assert(session.set_host_open(true)) + assert(await _wait_for_registry_size(session, 3)) + var spawn := main.get_node("%PlayerSpawnService") as PlayerSpawnService + assert(spawn.get_peer_ids().size() == 3) + var action_peer_id: int = await _wait_for_remote_action( + spawn, + ACTIVE_ACTION, + ) + assert(action_peer_id > 1) + assert(await _wait_for_avatar_bool( + spawn, + action_peer_id, + &"_active_item_is_net", + true, + )) + assert(await _wait_for_avatar_sitting(spawn, action_peer_id, true)) + assert(await _wait_for_avatar_action( + spawn, + action_peer_id, + &"", + )) + assert(await _wait_for_avatar_sitting(spawn, action_peer_id, false)) + var chat := main.get_node("%NetworkChatService") as NetworkChatService + assert(await _wait_for_history_message(chat, CLEAR_MESSAGE)) + print("Late-join multiplayer host validation: PASS") + await _cleanup(main, session) + + +func _run_first_client() -> void: + var main: Node = await _create_initialized_main() + var session := await _join(main) + var profile := main.get_node("%NetworkProfileService") as NetworkProfileService + var preview: Dictionary = profile.get_persisted_appearance().duplicate(true) + preview["scale"] = 0.9 + assert(profile.preview_appearance(preview)) + var player := main.get("_player") as Player + assert(player != null) + var floor_deadline: int = Time.get_ticks_msec() + 5000 + while Time.get_ticks_msec() < floor_deadline and not player.is_on_floor(): + await physics_frame + assert(player.is_on_floor()) + player.toggle_sitting() + assert(player.is_sitting()) + assert(player.bag.add_item(&"crab_net")) + # Slot zero begins selected with the starter rod. Replacing that slot does + # not emit a selection change, so use the next slot to exercise the same + # equipped-item path a player uses in normal gameplay. + assert(player.hotbar.assign_item(1, &"crab_net")) + assert(player.hotbar.select_slot(1)) + assert(await _wait_for_local_net(main, player)) + assert(player.begin_animation_action(ACTIVE_ACTION)) + await create_timer(0.5).timeout + assert(StringName(str(player.get("_animation_action_id"))) == ACTIVE_ACTION) + var chat := main.get_node("%NetworkChatService") as NetworkChatService + var deadline: int = Time.get_ticks_msec() + 15000 + while Time.get_ticks_msec() < deadline: + await process_frame + if ( + session.get_authenticated_peer_ids().size() == 3 + and _history_contains(chat, LATE_MESSAGE) + ): + break + assert(session.get_authenticated_peer_ids().size() == 3) + assert(_history_contains(chat, LATE_MESSAGE)) + var spawn := main.get_node("%PlayerSpawnService") as PlayerSpawnService + assert(spawn.get_peer_ids().size() == 3) + # Keep the action active until the late peer has joined and announced that + # it has received the lifecycle snapshot. This exercises client -> host -> + # existing client/late client replication, including the join-in-progress + # state carried by the spawn envelope. + await create_timer(1.0).timeout + player.end_animation_action() + player.toggle_sitting() + assert(not player.is_sitting()) + assert(await _wait_for_history_message(chat, CLEAR_MESSAGE)) + print("Late-join first-client validation: PASS") + await _cleanup(main, session) + + +func _run_late_client() -> void: + var main: Node = await _create_initialized_main() + var session := await _join(main) + var deadline: int = Time.get_ticks_msec() + 8000 + while ( + Time.get_ticks_msec() < deadline + and session.get_authenticated_peer_ids().size() < 3 + ): + await process_frame + assert(session.get_authenticated_peer_ids().size() == 3) + var spawn := main.get_node("%PlayerSpawnService") as PlayerSpawnService + assert(spawn.get_peer_ids().size() == 3) + var action_peer_id: int = await _wait_for_remote_action( + spawn, + ACTIVE_ACTION, + ) + assert(action_peer_id > 1) + assert(await _wait_for_avatar_bool( + spawn, + action_peer_id, + &"_active_item_is_net", + true, + )) + assert(await _wait_for_avatar_sitting(spawn, action_peer_id, true)) + var chat := main.get_node("%NetworkChatService") as NetworkChatService + assert(chat.send_local_message(LATE_MESSAGE)) + assert(await _wait_for_avatar_action( + spawn, + action_peer_id, + &"", + )) + assert(await _wait_for_avatar_sitting(spawn, action_peer_id, false)) + assert(chat.send_local_message(CLEAR_MESSAGE)) + await create_timer(0.5).timeout + print("Late-join late-client validation: PASS") + await _cleanup(main, session) + + +func _join(main: Node) -> NetworkSession: + main.call("_on_title_join_game_requested", "127.0.0.1:%d" % TEST_PORT) + var session := main.get_node("%NetworkSession") as NetworkSession + var deadline: int = Time.get_ticks_msec() + 20000 + while Time.get_ticks_msec() < deadline: + await process_frame + if session.state == NetworkSession.State.VERIFYING_SERVER_IDENTITY: + main.call("_confirm_server_trust") + if session.is_joined_client() and bool(main.get("_gameplay_started")): + return session + assert(false, "Client did not join in time.") + return session + + +func _wait_for_registry_size(session: NetworkSession, expected: int) -> bool: + var deadline: int = Time.get_ticks_msec() + 25000 + while Time.get_ticks_msec() < deadline: + await process_frame + if session.get_authenticated_peer_ids().size() == expected: + return true + return false + + +func _wait_for_local_net(main: Node, player: Player) -> bool: + var deadline: int = Time.get_ticks_msec() + 10000 + while Time.get_ticks_msec() < deadline: + # A joined client can finish its world transition one frame after the + # hotbar selection signal. Refresh through the production path until the + # ready fishing state accepts the equipped item. + main.call("_refresh_active_hotbar_item") + await process_frame + if bool(player.get("_active_item_is_net")): + return true + var fishing_spot: Node = main.get_node("%FishingSpot") + print( + "net equip wait timed out: ", + { + "fishing_state": int(fishing_spot.get("state")), + "selected_slot": player.hotbar.get_selected_slot(), + "selected_item": String(player.hotbar.get_selected_item_id()), + "owns_net": player.bag.owns_item(&"crab_net"), + }, + ) + return false + + +func _history_contains(service: NetworkChatService, body: String) -> bool: + return service.get_history().any( + func(message: Dictionary) -> bool: + return str(message.get("body", "")) == body + ) + + +func _wait_for_history_message( + service: NetworkChatService, + body: String, +) -> bool: + var deadline: int = Time.get_ticks_msec() + 10000 + while Time.get_ticks_msec() < deadline: + await process_frame + if _history_contains(service, body): + return true + return false + + +func _wait_for_remote_action( + spawn_service: PlayerSpawnService, + action_id: StringName, +) -> int: + var deadline: int = Time.get_ticks_msec() + 10000 + while Time.get_ticks_msec() < deadline: + await process_frame + for peer_id: int in spawn_service.get_peer_ids(): + var avatar: Player = spawn_service.get_avatar(peer_id) + if ( + avatar != null + and _observed_action_id(avatar) == action_id + ): + return peer_id + print( + "animation wait timed out: ", + _action_debug_snapshot(spawn_service), + ) + return 0 + + +func _wait_for_avatar_action( + spawn_service: PlayerSpawnService, + peer_id: int, + action_id: StringName, +) -> bool: + var deadline: int = Time.get_ticks_msec() + 10000 + while Time.get_ticks_msec() < deadline: + await process_frame + var avatar: Player = spawn_service.get_avatar(peer_id) + if ( + avatar != null + and _observed_action_id(avatar) == action_id + ): + return true + print( + "animation clear wait timed out: ", + _action_debug_snapshot(spawn_service), + ) + return false + + +func _wait_for_avatar_bool( + spawn_service: PlayerSpawnService, + peer_id: int, + property_name: StringName, + expected: bool, +) -> bool: + var deadline: int = Time.get_ticks_msec() + 10000 + while Time.get_ticks_msec() < deadline: + await process_frame + var avatar: Player = spawn_service.get_avatar(peer_id) + if avatar != null and bool(avatar.get(property_name)) == expected: + return true + return false + + +func _wait_for_avatar_sitting( + spawn_service: PlayerSpawnService, + peer_id: int, + expected: bool, +) -> bool: + var deadline: int = Time.get_ticks_msec() + 10000 + while Time.get_ticks_msec() < deadline: + await process_frame + var avatar: Player = spawn_service.get_avatar(peer_id) + if avatar != null and avatar.is_sitting() == expected: + return true + var avatar: Player = spawn_service.get_avatar(peer_id) + if avatar != null: + print( + "sitting wait timed out: ", + { + "peer_id": peer_id, + "expected": expected, + "sitting": avatar.is_sitting(), + "sit_after_landing": bool(avatar.get("_sit_after_landing")), + "on_floor": avatar.is_on_floor(), + "position": avatar.global_position, + "velocity": avatar.velocity, + "authoritative": bool(avatar.get( + "_network_authoritative_simulation" + )), + "last_input": int(avatar.get( + "_last_network_input_sequence" + )), + }, + ) + return false + + +func _observed_action_id(avatar: Player) -> StringName: + return StringName(str(avatar.get( + "_animation_action_id" + if bool(avatar.get("_network_authoritative_simulation")) + else "_network_target_animation_action_id" + ))) + + +func _action_debug_snapshot(spawn_service: PlayerSpawnService) -> Dictionary: + var result: Dictionary = {} + for peer_id: int in spawn_service.get_peer_ids(): + var avatar: Player = spawn_service.get_avatar(peer_id) + if avatar == null: + continue + result[peer_id] = { + "authoritative": bool(avatar.get( + "_network_authoritative_simulation" + )), + "source": str(avatar.get("_animation_action_id")), + "target": str(avatar.get( + "_network_target_animation_action_id" + )), + "last_input": int(avatar.get("_last_network_input_sequence")), + } + return result + + +func _create_initialized_main() -> Node: + root.size = Vector2i(1280, 720) + var main: Node = MainScene.instantiate() + root.add_child(main) + for _frame: int in 4: + await process_frame + if not bool(main.get("_application_initialized")): + main.call("_activate_selected_data_path", "", true) + for _frame: int in 8: + await process_frame + assert(bool(main.get("_application_initialized"))) + return main + + +func _cleanup(main: Node, session: NetworkSession) -> void: + session.disconnect_session("") + main.queue_free() + for _frame: int in 4: + await process_frame + await create_timer(0.1).timeout + quit() diff --git a/tests/late_join_multiplayer_validation.gd.uid b/tests/late_join_multiplayer_validation.gd.uid new file mode 100644 index 0000000..5d33548 --- /dev/null +++ b/tests/late_join_multiplayer_validation.gd.uid @@ -0,0 +1 @@ +uid://dnuwxkoeeykt3 diff --git a/tests/light_performance_profile_validation.gd b/tests/light_performance_profile_validation.gd index 30911c6..6a654f1 100644 --- a/tests/light_performance_profile_validation.gd +++ b/tests/light_performance_profile_validation.gd @@ -4,11 +4,6 @@ const MainScene: PackedScene = preload("res://main/main.tscn") const RuntimePerformanceProfileType = preload( "res://main/runtime_performance_profile.gd" ) -const FOLIAGE_WIND_SHADER: Shader = preload( - "res://world/materials/foliage_wind.gdshader" -) - - func _initialize() -> void: call_deferred("_run") @@ -29,6 +24,12 @@ func _run() -> void: for _frame: int in 8: await process_frame assert(bool(main.get("_application_initialized"))) + assert(bool(main.call( + "_apply_world", + WorldLayout.GENERATED, + PlayerSaveManager.DEFAULT_WORLD_SEED, + true, + ))) _validate_main_profile(main) _validate_minimal_weather(main) _stop_audio_players(main) @@ -47,7 +48,14 @@ func _run() -> void: for _frame: int in 8: await process_frame assert(bool(normal_main.get("_application_initialized"))) + assert(bool(normal_main.call( + "_apply_world", + WorldLayout.GENERATED, + PlayerSaveManager.DEFAULT_WORLD_SEED, + true, + ))) _validate_normal_profile(normal_main) + _validate_new_game_music_transition(normal_main) _stop_audio_players(normal_main) normal_main.queue_free() for _frame: int in 8: @@ -63,39 +71,33 @@ func _validate_profile_resolution() -> void: assert(not normal.is_light()) assert(is_equal_approx(normal.get_world_render_scale(), 1.0)) assert(light.is_light()) - assert(is_equal_approx(light.get_world_render_scale(), 0.5)) + assert(is_equal_approx(light.get_world_render_scale(), 0.375)) assert(legacy.is_light()) func _validate_main_profile(main: Node) -> void: var profile: RuntimePerformanceProfile = main.get("_performance_profile") assert(profile != null and profile.is_light()) - assert(is_equal_approx(root.scaling_3d_scale, 0.5)) + assert(is_equal_approx(root.scaling_3d_scale, 0.375)) var pixelation: Node = main.get_node("%WorldPixelationPostprocess") assert(bool(pixelation.call("is_light_performance_profile"))) pixelation.call("set_gameplay_active", true) var screen_grid := pixelation.get_node("ScreenGrid") as ColorRect assert(screen_grid != null and not screen_grid.visible) - var pond := main.get_node( - "TestWorld/Regions/StarterIslandRegion/WaterBodies/Pond/VisualWater" - ) as MeshInstance3D + var pond := _first_fresh_water_visual(main) var ocean := main.get_node( - "TestWorld/Regions/StarterIslandRegion/WaterBodies/Ocean/VisualWater" + "TestWorld/Regions/GeneratedWorldRegion/WaterBodies/OceanWater/VisualWater" ) as MeshInstance3D - assert(pond.material_override is StandardMaterial3D) + assert(not pond.visible) assert(ocean.material_override is StandardMaterial3D) - assert(not pond.material_override is ShaderMaterial) assert(not ocean.material_override is ShaderMaterial) - assert(not ocean.is_processing()) _validate_ocean_fishing_coverage(main, ocean) - var island := main.get_node( - "TestWorld/Regions/StarterIslandRegion" - ) as StarterIslandRegion - assert(island != null and not island.is_foliage_wind_enabled()) - assert(_count_foliage_wind_overrides( - island.get_node("Terrain/Visual") - ) == 0) + var region := main.get_node( + "TestWorld/Regions/GeneratedWorldRegion" + ) as GeneratedWorldRegion + assert(region != null) + assert(region.get_node("Decorations").get_child_count() > 0) var title_background := main.get_node("%TitleBackground") as ColorRect var title_material := title_background.material as ShaderMaterial @@ -118,29 +120,47 @@ func _validate_main_profile(main: Node) -> void: "scroll_velocity_pixels" ) == Vector2.ZERO ) + var game_ui := main.get_node("%GameUI") as GameUI + var title_screen := game_ui.get_title_screen() + assert(title_screen != null) + var player_menu := game_ui.get("_player_menu") as PlayerMenu + assert(player_menu != null) + assert(not player_menu.is_cooler_water_effect_enabled()) + assert((main.get_node("%TitleMusic") as AudioStreamPlayer).stream != null) + assert((main.get_node("%NewGameMusic") as AudioStreamPlayer).stream != null) + assert((main.get_node("%DuskMusic") as AudioStreamPlayer).stream != null) + assert( + (main.get_node("%WavesAudio") as AudioStreamPlayer).stream == null + ) + assert( + (main.get_node("RainAmbience") as AudioStreamPlayer).stream == null + ) func _validate_normal_profile(main: Node) -> void: var profile: RuntimePerformanceProfile = main.get("_performance_profile") assert(profile != null and not profile.is_light()) assert(is_equal_approx(root.scaling_3d_scale, 1.0)) - var pond := main.get_node( - "TestWorld/Regions/StarterIslandRegion/WaterBodies/Pond/VisualWater" - ) as MeshInstance3D + var pixelation: Node = main.get_node("%WorldPixelationPostprocess") + assert(not bool(pixelation.call("is_light_performance_profile"))) + var pond := _first_fresh_water_visual(main) var ocean := main.get_node( - "TestWorld/Regions/StarterIslandRegion/WaterBodies/Ocean/VisualWater" + "TestWorld/Regions/GeneratedWorldRegion/WaterBodies/OceanWater/VisualWater" ) as MeshInstance3D - assert(pond.material_override is ShaderMaterial) + assert(not pond.visible) assert(ocean.material_override is ShaderMaterial) - assert(not ocean.is_processing()) _validate_ocean_fishing_coverage(main, ocean) - var island := main.get_node( - "TestWorld/Regions/StarterIslandRegion" - ) as StarterIslandRegion - assert(island != null and island.is_foliage_wind_enabled()) - assert(_count_foliage_wind_overrides( - island.get_node("Terrain/Visual") - ) > 0) + var region := main.get_node( + "TestWorld/Regions/GeneratedWorldRegion" + ) as GeneratedWorldRegion + assert(region != null) + assert(region.get_node("Decorations").get_child_count() > 0) + var game_ui := main.get_node("%GameUI") as GameUI + var title_screen := game_ui.get_title_screen() + assert(title_screen != null) + var player_menu := game_ui.get("_player_menu") as PlayerMenu + assert(player_menu != null) + assert(player_menu.is_cooler_water_effect_enabled()) var title_background := main.get_node("%TitleBackground") as ColorRect var title_material := title_background.material as ShaderMaterial @@ -167,6 +187,41 @@ func _validate_normal_profile(main: Node) -> void: var rain := visuals.get_node("LocalRain") as GPUParticles3D assert(rain.amount == WorldTimeVisualController.RAIN_PARTICLE_AMOUNT) assert(rain.fixed_fps == 30) + var clouds := visuals.get_node( + "LocalStormClouds" + ) as LocalStormCloudLayer + assert(clouds.get_patch_count() == 81) + assert(clouds.get_node_or_null("CloudField") is MultiMeshInstance3D) + assert(clouds.get_node_or_null("CloudCeiling") == null) + assert((main.get_node("%TitleMusic") as AudioStreamPlayer).stream != null) + assert((main.get_node("%NewGameMusic") as AudioStreamPlayer).stream != null) + assert((main.get_node("%DuskMusic") as AudioStreamPlayer).stream != null) + assert( + (main.get_node("%WavesAudio") as AudioStreamPlayer).stream != null + ) + assert( + (main.get_node("RainAmbience") as AudioStreamPlayer).stream != null + ) + + +func _validate_new_game_music_transition(main: Node) -> void: + var title_music := main.get_node("%TitleMusic") as AudioStreamPlayer + var new_game_music := main.get_node("%NewGameMusic") as AudioStreamPlayer + assert(title_music.playing) + main.call("_start_new_game_music") + assert(not title_music.playing) + assert(new_game_music.playing) + main.call("_show_title_music", true) + assert(not new_game_music.playing) + assert(title_music.playing) + + +func _first_fresh_water_visual(main: Node) -> MeshInstance3D: + var root := main.get_node( + "TestWorld/Regions/GeneratedWorldRegion/WaterBodies/FreshWaterBodies" + ) as Node3D + assert(root != null and root.get_child_count() > 0) + return root.get_child(0).get_node("VisualWater") as MeshInstance3D func _validate_ocean_fishing_coverage( @@ -176,34 +231,19 @@ func _validate_ocean_fishing_coverage( var ocean_mesh := ocean.mesh as PlaneMesh assert(ocean_mesh != null) var shape_node := main.get_node( - "TestWorld/Regions/StarterIslandRegion/WaterBodies/Ocean/" - + "FishingRegions/OceanFishingRegion/Shape" + "TestWorld/Regions/GeneratedWorldRegion/WaterBodies/OceanWater/" + + "FishingRegion/Shape" ) as CollisionShape3D assert(shape_node != null) var fishing_shape := shape_node.shape as BoxShape3D assert(fishing_shape != null) assert(fishing_shape.size.is_equal_approx(Vector3( ocean_mesh.size.x, - 2.0, + 4.0, ocean_mesh.size.y, ))) -func _count_foliage_wind_overrides(root_node: Node) -> int: - var count: int = 0 - var mesh_instance := root_node as MeshInstance3D - if mesh_instance != null and mesh_instance.mesh != null: - for surface_index: int in mesh_instance.mesh.get_surface_count(): - var material := mesh_instance.get_surface_override_material( - surface_index - ) as ShaderMaterial - if material != null and material.shader == FOLIAGE_WIND_SHADER: - count += 1 - for child: Node in root_node.get_children(): - count += _count_foliage_wind_overrides(child) - return count - - func _stop_audio_players(root_node: Node) -> void: if root_node is AudioStreamPlayer: (root_node as AudioStreamPlayer).stop() @@ -222,8 +262,8 @@ func _validate_minimal_weather(main: Node) -> void: var rain := visuals.get_node("LocalRain") as GPUParticles3D assert(rain.amount == WorldTimeVisualController.LIGHT_RAIN_PARTICLE_AMOUNT) assert(rain.fixed_fps == WorldTimeVisualController.LIGHT_RAIN_FIXED_FPS) - assert(rain.amount == 128) - assert(rain.fixed_fps == 12) + assert(rain.amount == 48) + assert(rain.fixed_fps == 8) var clouds := visuals.get_node("LocalStormClouds") as LocalStormCloudLayer assert(clouds.get_patch_count() == 1) var ceiling := clouds.get_node("CloudCeiling") as MeshInstance3D diff --git a/tests/logbook_runtime_validation.gd b/tests/logbook_runtime_validation.gd index d1367de..47e795d 100644 --- a/tests/logbook_runtime_validation.gd +++ b/tests/logbook_runtime_validation.gd @@ -2,6 +2,7 @@ extends SceneTree const MainScene = preload("res://main/main.tscn") const FishCatchType = preload("res://fish/fish_catch.gd") +const MENU_TRANSITION_SETTLE_SECONDS := 3.0 func _initialize() -> void: @@ -36,12 +37,16 @@ func _run() -> void: var logbook := player_menu.get_node("%CatalogLogbook") as LogbookPage var backdrop := main.get_node("%PlayerMenuBackdrop") as ColorRect var hotbar := game_ui.get_node("%Hotbar") as Control + var fishing_spot := main.get("_fishing_spot") as FishingSpot + assert(logbook.get("_fishing_spot") == fishing_spot) + assert(logbook.get("_world_time") == main.get("_world_time")) + assert(logbook.get("_world_weather") == main.get("_world_weather")) var shortcut := InputEventKey.new() shortcut.pressed = true shortcut.physical_keycode = KEY_L assert(bool(player_menu.call("_handle_direct_page_shortcut", shortcut))) - await create_timer(2.2).timeout + await create_timer(MENU_TRANSITION_SETTLE_SECONDS).timeout assert(player_menu.visible) assert(logbook.visible) assert(backdrop.visible) @@ -49,32 +54,60 @@ func _run() -> void: assert(not hotbar.visible) var entry_buttons: Dictionary = logbook.get("_entry_buttons") - assert(entry_buttons.size() == 19) + assert(entry_buttons.size() == 108) await _capture_if_requested("-unknown") + logbook.call("_set_index_open", true, false) + await process_frame + assert(bool(logbook.get("_index_open"))) + assert((logbook.get("_index_body") as Control).visible) + await _capture_if_requested("-index") + logbook.set_compact_presentation(true) + await process_frame + await _capture_if_requested("-index-compact") + logbook.set_compact_presentation(false) + await process_frame + logbook.call("_set_index_open", false, false) + await process_frame logbook.call( "_select_category", WaterType.Type.FRESH_WATER ) await create_timer(0.25).timeout - assert((logbook.get("_entry_buttons") as Dictionary).size() == 19) + assert((logbook.get("_entry_buttons") as Dictionary).size() == 108) await _capture_if_requested("-fresh") logbook.call("_select_category", WaterType.Type.SALT_WATER) await create_timer(0.25).timeout - assert((logbook.get("_entry_buttons") as Dictionary).size() == 34) + assert((logbook.get("_entry_buttons") as Dictionary).size() == 202) logbook.call("_select_category", WaterType.Type.FRESH_WATER) await create_timer(0.25).timeout - assert((logbook.get("_entry_buttons") as Dictionary).size() == 19) + assert((logbook.get("_entry_buttons") as Dictionary).size() == 108) player.collection_log.mark_discovered(&"bluegill") await process_frame logbook.call("_select_entry", &"bluegill", &"bluegill") await create_timer(0.2).timeout await _capture_if_requested("-known") + var bluegill := ( + main.get("fish_catalog") as FishPool + ).get_fish_by_id(&"bluegill") + var bluegill_available_now := fishing_spot.is_species_available_now(bluegill) + var index_options := logbook.get("_index_options") as Dictionary + index_options["availability"] = ( + LogbookCatalog.AvailabilityFilter.AVAILABLE_NOW + ) + logbook.notify_availability_context_changed() + await process_frame + assert( + (logbook.get("_entry_buttons") as Dictionary).has(&"bluegill") + == bluegill_available_now + ) + logbook.call("_reset_index") + await process_frame assert(bool(player_menu.call("_handle_direct_page_shortcut", shortcut))) - await create_timer(2.2).timeout + await create_timer(MENU_TRANSITION_SETTLE_SECONDS).timeout assert(not player_menu.visible) assert(bool(player_menu.call("_handle_direct_page_shortcut", shortcut))) - await create_timer(2.2).timeout + await create_timer(MENU_TRANSITION_SETTLE_SECONDS).timeout player_menu.call( "_show_section_immediate", PlayerMenu.Section.PROFILE ) @@ -108,11 +141,38 @@ func _validate_save_round_trip( var player := main.get("_player") as Player var catalog := main.get("fish_catalog") as FishPool assert(catalog != null) - assert(catalog.candidates.size() == 314) + assert(catalog.candidates.size() == 316) var active_species := LogbookCatalog.ordered_species(catalog.candidates) - assert(active_species.size() == 54) + assert(active_species.size() == 313) + # Keep this runtime save fixture within maximum player capacity while the + # focused catalog validation exercises every active species individually. + var round_trip_species: Array[FishData] = [] + for fish: FishData in active_species: + if round_trip_species.size() >= 59: + break + round_trip_species.append(fish) + for fish_id: StringName in [ + &"catfish_blue", + &"catfish_channel", + &"catfish_flathead", + &"catfish_white", + ]: + var catfish: FishData = catalog.get_fish_by_id(fish_id) + if catfish not in round_trip_species: + round_trip_species.append(catfish) + assert(round_trip_species.size() == 63) + player.inventory_layout.restore_backpack_level( + PlayerInventoryLayout.MAX_BACKPACK_LEVEL + ) + player.cooler_capacity.restore_level(PlayerCoolerCapacity.MAX_LEVEL) + assert( + player.inventory_layout.get_backpack_level() + == PlayerInventoryLayout.MAX_BACKPACK_LEVEL + ) + assert(player.cooler_capacity.get_level() == PlayerCoolerCapacity.MAX_LEVEL) + player.inventory.set_inventory_layout(null) for index: int in 4: - _add_test_catch(player, active_species[index]) + _add_test_catch(player, round_trip_species[index]) assert(save_manager.save_now()) var no_catches: Array[FishCatch] = [] var no_discoveries: Array[StringName] = [] @@ -121,18 +181,21 @@ func _validate_save_round_trip( assert(save_manager.load_player_data()) assert(player.inventory.get_all_catches().size() == 4) for index: int in 4: - var original_fish: FishData = active_species[index] + var original_fish: FishData = round_trip_species[index] assert(player.inventory.get_count(original_fish.id) == 1) assert(player.collection_log.has_discovered(original_fish.id)) - for index: int in range(4, active_species.size()): - _add_test_catch(player, active_species[index]) + for index: int in range(4, round_trip_species.size()): + _add_test_catch(player, round_trip_species[index]) assert(save_manager.save_now()) assert(player.inventory.replace_all_catches(no_catches, 1)) assert(player.collection_log.replace_discovered_ids(no_discoveries)) assert(save_manager.load_player_data()) - assert(player.inventory.get_all_catches().size() == 54) - for fish: FishData in active_species: + assert( + player.inventory.get_all_catches().size() + == round_trip_species.size() + ) + for fish: FishData in round_trip_species: assert(player.inventory.get_count(fish.id) == 1) assert(player.collection_log.has_discovered(fish.id)) for fish_id: StringName in [ @@ -151,6 +214,7 @@ func _validate_save_round_trip( assert(catch_sprite != null) assert(catch_sprite.texture == fish_catch.fish.display_texture) player.end_catch_showcase(Callable(), true) + player.inventory.set_inventory_layout(player.inventory_layout) func _add_test_catch(player: Player, fish: FishData) -> void: @@ -170,13 +234,13 @@ func _add_test_catch(player: Player, fish: FishData) -> void: func _capture_if_requested(suffix: String) -> void: - if not OS.has_environment("NETFISHING_LOGBOOK_CAPTURE"): + if not OS.has_environment("straywild_LOGBOOK_CAPTURE"): return await process_frame await process_frame var image: Image = root.get_texture().get_image() var path: String = ( - OS.get_environment("NETFISHING_LOGBOOK_CAPTURE") + OS.get_environment("straywild_LOGBOOK_CAPTURE") + suffix + ".png" ) diff --git a/tests/logbook_validation.gd b/tests/logbook_validation.gd index 8e09e6d..431ed2e 100644 --- a/tests/logbook_validation.gd +++ b/tests/logbook_validation.gd @@ -5,6 +5,7 @@ const FishInventoryType = preload("res://inventory/fish_inventory.gd") const FishPoolType = preload("res://fish/fish_pool.gd") const CollectionLogType = preload("res://collection/collection_log.gd") const FishDataType = preload("res://fish/fish_data.gd") +const FishQualityType = preload("res://fish/fish_quality.gd") const LogbookPortraitType = preload( "res://ui/components/logbook_portrait.gd" ) @@ -16,17 +17,19 @@ const CatalogResource: FishPoolType = preload( "res://fish/pools/fish_catalog.tres" ) +var _query_available_id: StringName + func _initialize() -> void: call_deferred("_run") func _run() -> void: - if OS.has_environment("NETFISHING_TEST_CREATE_ROOT"): + if OS.has_environment("straywild_TEST_CREATE_ROOT"): var data_root := PlayerDataRoot.new() root.add_child(data_root) var result: Dictionary = data_root.create_unbound_root( - OS.get_environment("NETFISHING_TEST_CREATE_ROOT") + OS.get_environment("straywild_TEST_CREATE_ROOT") ) assert(bool(result.get("ok", false))) data_root.queue_free() @@ -34,15 +37,16 @@ func _run() -> void: quit() return _validate_catalog() + _validate_catalog_query() await _validate_page() print("Logbook validation: PASS") quit() func _validate_catalog() -> void: - assert(CatalogResource.candidates.size() == 314) + assert(CatalogResource.candidates.size() == 316) var ordered := LogbookCatalog.ordered_species(CatalogResource.candidates) - assert(ordered.size() == 54) + assert(ordered.size() == 313) var previous_number: int = 0 var catalog_numbers: Dictionary[int, bool] = {} for fish: FishDataType in CatalogResource.candidates: @@ -67,6 +71,348 @@ func _validate_catalog() -> void: ) +func _validate_catalog_query() -> void: + var collection := CollectionLogType.new() + var inventory := FishInventoryType.new() + var fresh_species: Array[FishDataType] = [] + for fish: FishDataType in LogbookCatalog.ordered_species( + CatalogResource.candidates + ): + if LogbookCatalog.category_for(fish) == LogbookCatalog.Category.FRESH_WATER: + fresh_species.append(fish) + assert(fresh_species.size() == 108) + var first := fresh_species[0] + var second := fresh_species[1] + var unknown := fresh_species[2] + for quality: int in FishQualityType.TIER_COUNT: + collection.record_catch(first.id, quality) + collection.record_catch(second.id, FishQualityType.Tier.BORING) + var held := _make_test_catch(first, true) + assert(inventory.add_catch(held)) + + var options := _default_query_options() + options["show"] = LogbookCatalog.DiscoveryFilter.CAUGHT + var filtered := LogbookCatalog.filtered_species( + CatalogResource.candidates, + LogbookCatalog.Category.FRESH_WATER, + collection, + inventory, + options, + ) + assert(filtered.size() == 2) + assert(first in filtered and second in filtered) + + options["show"] = LogbookCatalog.DiscoveryFilter.MISSING + filtered = LogbookCatalog.filtered_species( + CatalogResource.candidates, + LogbookCatalog.Category.FRESH_WATER, + collection, + inventory, + options, + ) + assert(filtered.size() == fresh_species.size() - 2) + options["sort"] = LogbookCatalog.SortMode.CATALOG_NUMBER + options["descending"] = true + filtered = LogbookCatalog.filtered_species( + CatalogResource.candidates, + LogbookCatalog.Category.FRESH_WATER, + collection, + inventory, + options, + ) + assert(filtered.front() == fresh_species.back()) + assert(filtered.back() == unknown) + + options["show"] = LogbookCatalog.DiscoveryFilter.INCOMPLETE + options["descending"] = false + filtered = LogbookCatalog.filtered_species( + CatalogResource.candidates, + LogbookCatalog.Category.FRESH_WATER, + collection, + inventory, + options, + ) + assert(filtered == [second]) + + options = _default_query_options() + options["show"] = LogbookCatalog.DiscoveryFilter.CAUGHT + options["sort"] = LogbookCatalog.SortMode.CATCH_COUNT + options["descending"] = true + filtered = LogbookCatalog.filtered_species( + CatalogResource.candidates, + LogbookCatalog.Category.FRESH_WATER, + collection, + inventory, + options, + ) + assert(filtered == [first, second]) + + options = _default_query_options() + options["search"] = unknown.display_name + filtered = LogbookCatalog.filtered_species( + CatalogResource.candidates, + LogbookCatalog.Category.FRESH_WATER, + collection, + inventory, + options, + ) + assert(filtered.is_empty()) + options["search"] = str(unknown.catalog_number) + filtered = LogbookCatalog.filtered_species( + CatalogResource.candidates, + LogbookCatalog.Category.FRESH_WATER, + collection, + inventory, + options, + ) + assert(filtered == [unknown]) + + options = _default_query_options() + options["holding"] = LogbookCatalog.HoldingFilter.FAVORITED + filtered = LogbookCatalog.filtered_species( + CatalogResource.candidates, + LogbookCatalog.Category.FRESH_WATER, + collection, + inventory, + options, + ) + assert(filtered == [first]) + options["holding"] = LogbookCatalog.HoldingFilter.IN_COOLER + filtered = LogbookCatalog.filtered_species( + CatalogResource.candidates, + LogbookCatalog.Category.FRESH_WATER, + collection, + inventory, + options, + ) + assert(filtered == [first]) + + options = _default_query_options() + options["show"] = LogbookCatalog.DiscoveryFilter.CAUGHT + options["group"] = String(first.collection_group) + filtered = LogbookCatalog.filtered_species( + CatalogResource.candidates, + LogbookCatalog.Category.FRESH_WATER, + collection, + inventory, + options, + ) + assert(first in filtered) + for fish: FishDataType in filtered: + assert(fish.collection_group == first.collection_group) + + options = _default_query_options() + options["show"] = LogbookCatalog.DiscoveryFilter.CAUGHT + options["rarity"] = ( + int(first.rarity) + LogbookCatalog.RarityFilter.COMMON + ) + filtered = LogbookCatalog.filtered_species( + CatalogResource.candidates, + LogbookCatalog.Category.FRESH_WATER, + collection, + inventory, + options, + ) + assert(first in filtered) + for fish: FishDataType in filtered: + assert(fish.rarity == first.rarity) + + options = _default_query_options() + options["show"] = LogbookCatalog.DiscoveryFilter.CAUGHT + options["method"] = ( + int(first.collection_method) + LogbookCatalog.MethodFilter.FISHING + ) + filtered = LogbookCatalog.filtered_species( + CatalogResource.candidates, + LogbookCatalog.Category.FRESH_WATER, + collection, + inventory, + options, + ) + assert(first in filtered) + for fish: FishDataType in filtered: + assert(fish.collection_method == first.collection_method) + + var first_season := -1 + for season: int in 4: + if first.is_available_in_season(season): + first_season = season + break + assert(first_season >= 0) + options = _default_query_options() + options["show"] = LogbookCatalog.DiscoveryFilter.CAUGHT + options["season"] = ( + first_season + LogbookCatalog.SeasonFilter.SPRING + ) + filtered = LogbookCatalog.filtered_species( + CatalogResource.candidates, + LogbookCatalog.Category.FRESH_WATER, + collection, + inventory, + options, + ) + assert(first in filtered) + for fish: FishDataType in filtered: + assert(fish.is_available_in_season(first_season)) + + var first_is_available_by_day := ( + first.availability == null or first.availability.allow_day + ) + options = _default_query_options() + options["show"] = LogbookCatalog.DiscoveryFilter.CAUGHT + options["time"] = ( + LogbookCatalog.TimeFilter.DAY + if first_is_available_by_day + else LogbookCatalog.TimeFilter.NIGHT + ) + filtered = LogbookCatalog.filtered_species( + CatalogResource.candidates, + LogbookCatalog.Category.FRESH_WATER, + collection, + inventory, + options, + ) + assert(first in filtered) + + options = _default_query_options() + options["show"] = LogbookCatalog.DiscoveryFilter.CAUGHT + options["sort"] = LogbookCatalog.SortMode.QUALITY_PROGRESS + options["descending"] = true + filtered = LogbookCatalog.filtered_species( + CatalogResource.candidates, + LogbookCatalog.Category.FRESH_WATER, + collection, + inventory, + options, + ) + assert(filtered == [first, second]) + for sort_mode: LogbookCatalog.SortMode in [ + LogbookCatalog.SortMode.NAME, + LogbookCatalog.SortMode.RARITY, + LogbookCatalog.SortMode.VALUE, + LogbookCatalog.SortMode.WEIGHT, + ]: + options = _default_query_options() + options["sort"] = sort_mode + filtered = LogbookCatalog.filtered_species( + CatalogResource.candidates, + LogbookCatalog.Category.FRESH_WATER, + collection, + inventory, + options, + ) + assert(filtered[0] in [first, second]) + assert(filtered[1] in [first, second]) + assert(filtered[0] != filtered[1]) + assert(filtered[2] == unknown) + + _query_available_id = second.id + options = _default_query_options() + options["availability"] = ( + LogbookCatalog.AvailabilityFilter.AVAILABLE_NOW + ) + filtered = LogbookCatalog.filtered_species( + CatalogResource.candidates, + LogbookCatalog.Category.FRESH_WATER, + collection, + inventory, + options, + Callable(self, "_query_species_available_now"), + ) + assert(filtered == [second]) + + _query_available_id = unknown.id + options["show"] = LogbookCatalog.DiscoveryFilter.MISSING + options["rarity"] = ( + int(unknown.rarity) + LogbookCatalog.RarityFilter.COMMON + ) + filtered = LogbookCatalog.filtered_species( + CatalogResource.candidates, + LogbookCatalog.Category.FRESH_WATER, + collection, + inventory, + options, + Callable(self, "_query_species_available_now"), + ) + assert(filtered == [unknown]) + + options = _default_query_options() + options["show"] = LogbookCatalog.DiscoveryFilter.MISSING + options["group"] = String(unknown.collection_group) + filtered = LogbookCatalog.filtered_species( + CatalogResource.candidates, + LogbookCatalog.Category.FRESH_WATER, + collection, + inventory, + options, + ) + assert(unknown in filtered) + assert( + String(unknown.collection_group) + in LogbookCatalog.available_groups( + CatalogResource.candidates, + LogbookCatalog.Category.FRESH_WATER, + collection, + ) + ) + + var unknown_is_available_by_day := ( + unknown.availability == null or unknown.availability.allow_day + ) + options = _default_query_options() + options["show"] = LogbookCatalog.DiscoveryFilter.MISSING + options["time"] = ( + LogbookCatalog.TimeFilter.DAY + if unknown_is_available_by_day + else LogbookCatalog.TimeFilter.NIGHT + ) + filtered = LogbookCatalog.filtered_species( + CatalogResource.candidates, + LogbookCatalog.Category.FRESH_WATER, + collection, + inventory, + options, + ) + assert(unknown in filtered) + inventory.free() + collection.free() + + +func _default_query_options() -> Dictionary: + return { + "search": "", + "show": LogbookCatalog.DiscoveryFilter.ALL, + "sort": LogbookCatalog.SortMode.CATALOG_NUMBER, + "descending": false, + "availability": LogbookCatalog.AvailabilityFilter.ANY, + "season": LogbookCatalog.SeasonFilter.ANY, + "time": LogbookCatalog.TimeFilter.ANY, + "rarity": LogbookCatalog.RarityFilter.ANY, + "method": LogbookCatalog.MethodFilter.ANY, + "holding": LogbookCatalog.HoldingFilter.ANY, + "group": "", + } + + +func _make_test_catch(fish: FishDataType, favorited: bool) -> FishCatchType: + var fish_catch := FishCatchType.new() + fish_catch.fish = fish + fish_catch.fish_id = fish.id + fish_catch.weight_lb = fish.get_minimum_weight() + fish_catch.display_scale = fish.get_display_scale_for_weight( + fish_catch.weight_lb + ) + fish_catch.quality = FishQualityType.Tier.BORING + fish_catch.sale_value = fish.get_sale_value_for_weight(fish_catch.weight_lb) + fish_catch.is_favorited = favorited + fish_catch.ensure_identity() + return fish_catch + + +func _query_species_available_now(fish: FishDataType) -> bool: + return fish != null and fish.id == _query_available_id + + func _validate_page() -> void: var collection := CollectionLogType.new() var inventory := FishInventoryType.new() @@ -74,14 +420,59 @@ func _validate_page() -> void: root.add_child(inventory) var page := LogbookPageScene.instantiate() as LogbookPage root.add_child(page) + page.set_anchors_and_offsets_preset(Control.PRESET_TOP_LEFT) + page.size = Vector2(1280.0, 720.0) await process_frame page.setup(collection, inventory, CatalogResource) page.activate() await process_frame + var outer_margin := page.get("_outer_margin") as MarginContainer + var book := page.get("_book") as Control + assert(outer_margin != null) + assert(book != null) + page.set_compact_presentation(true) + await process_frame + assert(outer_margin.get_theme_constant("margin_left") == 160) + assert(outer_margin.get_theme_constant("margin_right") == 160) + assert(outer_margin.get_theme_constant("margin_bottom") == 106) + assert(is_equal_approx(book.offset_top, 65.0)) + page.call("_set_index_open", true, false) + await process_frame + _validate_index_content_bounds(page) + page.call("_set_index_open", false, false) + page.set_compact_presentation(false) + await process_frame + assert(outer_margin.get_theme_constant("margin_left") == 52) + assert(outer_margin.get_theme_constant("margin_right") == 52) + assert(outer_margin.get_theme_constant("margin_bottom") == 18) + assert(is_equal_approx(book.offset_top, 50.0)) assert( page.get("_category") == LogbookCatalog.Category.FRESH_WATER ) assert((page.get("_catalog_grid") as GridContainer).columns == 4) + var catalog_scroll := page.get("_catalog_scroll") as ScrollContainer + assert(catalog_scroll != null and catalog_scroll.follow_focus) + catalog_scroll.scroll_vertical = 37 + await create_timer(0.2).timeout + assert(catalog_scroll.scroll_vertical == 37) + page.call( + "_set_controller_zone", + LogbookPage.ControllerZone.ENTRIES, + ) + for _frame: int in 2: + await process_frame + var initial_entries: Array = ( + page.get("_entry_buttons") as Dictionary + ).values() + assert(initial_entries.size() > 4) + var final_entry := initial_entries.back() as Button + final_entry.grab_focus() + for _frame: int in 3: + await process_frame + assert(catalog_scroll.scroll_vertical > 0) + page.reset_controller_zone() + for _frame: int in 2: + await process_frame var category_tabs: Array = page.get("_category_tabs") as Array var category_tab_categories: Array = ( page.get("_category_tab_categories") as Array @@ -93,6 +484,10 @@ func _validate_page() -> void: LogbookCatalog.Category.OTHER, ]) assert(category_tabs.size() == category_tab_categories.size()) + assert( + LogbookCatalog.category_label(LogbookCatalog.Category.OTHER) + == "Insects" + ) for tab_node: Variant in category_tabs: var category_tab := tab_node as Button assert(category_tab.size == LogbookPage.LOGBOOK_TAB_SIZE) @@ -112,6 +507,39 @@ func _validate_page() -> void: ) var initial_detail_body := page.get("_detail_body") as VBoxContainer assert(not initial_detail_body.get_parent() is ScrollContainer) + var index_tab := page.get("_index_tab") as Button + var index_body := page.get("_index_body") as VBoxContainer + assert(index_tab != null and index_body != null) + assert(index_tab.size == LogbookPage.INDEX_TAB_SIZE) + assert( + not index_tab.get_global_rect().intersects( + (category_tabs.back() as Button).get_global_rect() + ) + ) + page.call("_set_index_open", true, false) + await process_frame + assert(index_body.visible) + assert(not initial_detail_body.visible) + assert((page.get("_index_option_buttons") as Dictionary).size() == 10) + _validate_index_content_bounds(page) + page.call( + "_cycle_index_option", + &"show", + 1, + ) + await process_frame + assert((page.get("_entry_buttons") as Dictionary).is_empty()) + assert( + (page.get("_empty_state") as Label).text + == "No entries match this index." + ) + page.call("_reset_index") + await process_frame + assert((page.get("_entry_buttons") as Dictionary).size() == 108) + page.call("_set_index_open", false, false) + await process_frame + assert(not index_body.visible) + assert(initial_detail_body.visible) assert( page.call("_entry_label_text", "flathead catfish") == "flathead\ncatfish" @@ -119,6 +547,11 @@ func _validate_page() -> void: var shared_material: Material var silhouette_count: int = 0 + var target_silhouette_area: float = ( + LogbookPage.CATALOG_PORTRAIT_SIZE.x + * LogbookPage.CATALOG_PORTRAIT_SIZE.y + * LogbookPortraitType.UNIFORM_FOOTPRINT_AREA_RATIO + ) for category: LogbookCatalog.Category in [ LogbookCatalog.Category.FRESH_WATER, LogbookCatalog.Category.SALT_WATER, @@ -128,7 +561,7 @@ func _validate_page() -> void: var entries: Dictionary = page.get("_entry_buttons") assert( entries.size() - == (19 if category == LogbookCatalog.Category.FRESH_WATER else 34) + == (108 if category == LogbookCatalog.Category.FRESH_WATER else 202) ) for fish: FishDataType in LogbookCatalog.ordered_species( CatalogResource.candidates @@ -149,8 +582,15 @@ func _validate_page() -> void: assert(portrait != null) assert(portrait.source_texture == fish.display_texture) assert( - portrait.custom_minimum_size - == LogbookPage.CATALOG_PORTRAIT_SIZE + portrait.custom_minimum_size.x + <= LogbookPage.CATALOG_PORTRAIT_SIZE.x + and portrait.custom_minimum_size.y + <= LogbookPage.CATALOG_PORTRAIT_SIZE.y + ) + assert(portrait.get_parent() is CenterContainer) + assert( + (portrait.get_parent() as CenterContainer).custom_minimum_size + == LogbookPage.CATALOG_PORTRAIT_SIZE ) assert( portrait.expand_mode @@ -166,6 +606,23 @@ func _validate_page() -> void: else: assert(portrait.material == shared_material) assert(_texture_has_transparency(portrait.texture)) + var silhouette_area: float = ( + portrait.custom_minimum_size.x + * portrait.custom_minimum_size.y + ) + assert(silhouette_area > 0.0) + assert(silhouette_area <= target_silhouette_area * 1.05) + assert( + silhouette_area >= target_silhouette_area * 0.9 + or is_equal_approx( + portrait.custom_minimum_size.x, + LogbookPage.CATALOG_PORTRAIT_SIZE.x, + ) + or is_equal_approx( + portrait.custom_minimum_size.y, + LogbookPage.CATALOG_PORTRAIT_SIZE.y, + ) + ) silhouette_count += 1 for candidate: FishDataType in CatalogResource.candidates: assert(not entry.text.contains(candidate.display_name)) @@ -179,20 +636,22 @@ func _validate_page() -> void: candidate.display_name ) ) - assert(silhouette_count == 53) + assert(silhouette_count == 310) page.call("_select_category", LogbookCatalog.Category.SHELLFISH) await create_timer(0.25).timeout - assert((page.get("_entry_buttons") as Dictionary).size() == 1) + assert((page.get("_entry_buttons") as Dictionary).size() == 2) assert( (page.get("_entry_buttons") as Dictionary).has(&"unknown_3906") ) + assert( + (page.get("_entry_buttons") as Dictionary).has(&"unknown_6406") + ) page.call("_select_category", LogbookCatalog.Category.OTHER) await create_timer(0.25).timeout - assert((page.get("_entry_buttons") as Dictionary).is_empty()) + assert((page.get("_entry_buttons") as Dictionary).size() == 1) assert( - (page.get("_empty_state") as Label).text - == "No entries available." + (page.get("_entry_buttons") as Dictionary).has(&"unknown_8001") ) page.call("_select_category", LogbookCatalog.Category.FRESH_WATER) await create_timer(0.25).timeout @@ -207,6 +666,10 @@ func _validate_page() -> void: .get(bluegill_unknown) != null ) collection.mark_discovered(&"bluegill") + collection.mark_quality_discovered( + &"bluegill", + FishQualityType.Tier.BORING, + ) await process_frame var entries: Dictionary = page.get("_entry_buttons") var known := entries.get(&"bluegill") as Button @@ -220,6 +683,11 @@ func _validate_page() -> void: assert(known_portrait != null) assert(known_portrait.source_texture == bluegill.display_texture) assert(known_portrait.material == null) + assert(known_portrait.get_parent() is CenterContainer) + assert( + (known_portrait.get_parent() as CenterContainer).custom_minimum_size + == LogbookPage.CATALOG_PORTRAIT_SIZE + ) assert(known.button_pressed) _validate_handwritten_logbook_font(page) @@ -235,10 +703,11 @@ func _validate_page() -> void: ) fish_catch.ensure_identity() inventory.add_catch(fish_catch) + collection.record_catch(fish_catch.fish_id, fish_catch.quality) page.call("_select_entry", &"bluegill", &"bluegill") await process_frame - assert(_detail_text(page).contains("number owned\n1")) - assert(_detail_text(page).contains("number caught\nunknown")) + assert(not _detail_text(page).contains("number owned")) + assert(_detail_text(page).contains("number caught\n1")) assert(_detail_text(page).contains("body of water\nfresh water")) assert( _detail_text(page).contains( @@ -249,12 +718,32 @@ func _validate_page() -> void: assert(_detail_text(page).contains(LogbookCatalog.facts_for(bluegill))) _validate_detail_field_fonts(page) _validate_handwritten_numeric_scale(page) + _validate_detail_content_bounds(page) var detail_buttons: Array = page.get("_detail_buttons") as Array assert(detail_buttons.size() == 4) var portrait_detail := detail_buttons[0] as Button var facts_detail := detail_buttons[1] as Button var quality_detail := detail_buttons[2] as Button var stats_detail := detail_buttons[3] as Button + assert( + quality_detail.custom_minimum_size + == LogbookPage.DETAIL_QUALITY_SECTION_SIZE + ) + assert( + stats_detail.custom_minimum_size + == LogbookPage.DETAIL_STATS_SECTION_SIZE + ) + assert( + quality_detail.size_flags_horizontal + == Control.SIZE_SHRINK_CENTER + ) + assert( + stats_detail.size_flags_horizontal + == Control.SIZE_SHRINK_CENTER + ) + assert( + stats_detail.size_flags_vertical & Control.SIZE_EXPAND == 0 + ) assert( portrait_detail.get_node(portrait_detail.focus_neighbor_right) == facts_detail @@ -290,9 +779,15 @@ func _validate_page() -> void: ) assert(overlay_artwork.source_texture == bluegill.display_texture) assert( - overlay_artwork.custom_minimum_size.x <= 860.0 - and overlay_artwork.custom_minimum_size.y <= 480.0 + overlay_artwork.custom_minimum_size.x + <= LogbookPage.PORTRAIT_VIEW_MAX_SIZE.x + and overlay_artwork.custom_minimum_size.y + <= LogbookPage.PORTRAIT_VIEW_MAX_SIZE.y ) + var overlay_card := _find_overlay_card(portrait_overlay) + assert(overlay_card != null) + assert(overlay_card.size == LogbookPage.DETAIL_OVERLAY_CARD_SIZE) + assert(is_equal_approx(overlay_card.size.aspect(), 4.0 / 3.0)) (page.get("_portrait_overlay_backdrop") as Button).pressed.emit() await process_frame assert(not portrait_overlay.visible) @@ -312,20 +807,53 @@ func _validate_page() -> void: == HORIZONTAL_ALIGNMENT_LEFT ) assert( - portrait_overlay.size.x - - overlay_text.size.x - <= float( - (LogbookPage.DETAIL_OVERLAY_EDGE_MARGIN - + LogbookPage.DETAIL_OVERLAY_CONTENT_MARGIN) * 2 - + 8 - ) + overlay_text.get_theme_font("font") + == UtilityPageStyle.TuffyFont ) (page.get("_portrait_overlay_backdrop") as Button).pressed.emit() await process_frame + quality_detail.pressed.emit() + await process_frame + var quality_view := page.get("_portrait_overlay_quality_view") as Control + assert(quality_view.visible) + var quality_text: String = _descendant_label_text(quality_view) + for quality: int in FishQualityType.TIER_COUNT: + assert(quality_text.contains(FishQualityType.display_name(quality))) + assert(quality_text.contains("●")) + assert(quality_text.contains("○")) + _validate_overlay_fonts(quality_view) + (page.get("_portrait_overlay_backdrop") as Button).pressed.emit() + await process_frame + + stats_detail.pressed.emit() + await process_frame + var stats_view := page.get("_portrait_overlay_stats_view") as Control + assert(stats_view.visible) + var stats_text: String = _descendant_label_text(stats_view) + assert(stats_text.contains("catalog number")) + assert(stats_text.contains("number caught")) + assert(stats_text.contains("1")) + assert(stats_text.contains("seasons")) + assert(not stats_text.contains("number owned")) + _validate_overlay_fonts(stats_view) + (page.get("_portrait_overlay_backdrop") as Button).pressed.emit() + await process_frame + + var live_index_options := page.get("_index_options") as Dictionary + live_index_options["holding"] = LogbookCatalog.HoldingFilter.IN_COOLER + page.call("_refresh_catalog") + await process_frame + assert( + (page.get("_entry_buttons") as Dictionary).keys() + == [&"bluegill"] + ) inventory.remove_catch_by_id(fish_catch.catch_id) await process_frame - assert(_detail_text(page).contains("number owned\n0")) + assert((page.get("_entry_buttons") as Dictionary).is_empty()) + page.call("_reset_index") + await process_frame + assert(not _detail_text(page).contains("number owned")) page.queue_free() collection.queue_free() inventory.queue_free() @@ -339,6 +867,97 @@ func _detail_text(page: LogbookPage) -> String: return "\n".join(values) +func _validate_index_content_bounds(page: LogbookPage) -> void: + var body := page.get("_index_body") as VBoxContainer + assert(body != null and body.visible) + var right_page := body.get_parent() as Control + assert(right_page != null) + var page_rect := right_page.get_global_rect() + var body_rect := body.get_global_rect() + var protected_rect := Rect2( + page_rect.position + Vector2( + LogbookPage.INDEX_CONTENT_LEFT_INSET, + LogbookPage.INDEX_CONTENT_TOP_INSET, + ), + page_rect.size - Vector2( + LogbookPage.INDEX_CONTENT_LEFT_INSET + + LogbookPage.INDEX_CONTENT_RIGHT_INSET, + LogbookPage.INDEX_CONTENT_TOP_INSET + + LogbookPage.INDEX_CONTENT_BOTTOM_INSET, + ), + ) + assert( + body_rect.position.x + >= page_rect.position.x + LogbookPage.INDEX_CONTENT_LEFT_INSET - 1.0 + ) + assert( + body_rect.end.x + <= page_rect.end.x - LogbookPage.INDEX_CONTENT_RIGHT_INSET + 1.0 + ) + assert( + body_rect.position.y >= page_rect.position.y, + "Index starts above the authored page: body=%s page=%s" + % [body_rect, page_rect], + ) + assert( + body_rect.end.y <= page_rect.end.y, + "Index extends below the authored page: body=%s page=%s" + % [body_rect, page_rect], + ) + var controls: Array = page.get("_index_controls") as Array + for value: Variant in controls: + var control := value as Control + if control != null and control.visible: + assert( + protected_rect.grow(2.0).encloses(control.get_global_rect()), + "Index control crossed the authored right-page boundary: %s" + % control.name, + ) + + +func _descendant_label_text(parent: Node) -> String: + var values: PackedStringArray = [] + for node: Node in parent.find_children("*", "Label", true, false): + values.append((node as Label).text) + return "\n".join(values) + + +func _validate_overlay_fonts(parent: Node) -> void: + for node: Node in parent.find_children("*", "Label", true, false): + assert( + (node as Label).get_theme_font("font") + == UtilityPageStyle.TuffyFont + ) + + +func _validate_detail_content_bounds(page: LogbookPage) -> void: + var detail_body := page.get("_detail_body") as VBoxContainer + var page_rect: Rect2 = (detail_body.get_parent() as Control).get_global_rect() + for node: Node in detail_body.find_children("*", "Label", true, false): + var label := node as Label + var label_rect: Rect2 = label.get_global_rect() + assert( + label_rect.position.y >= page_rect.position.y - 0.5, + "Label starts above logbook page: %s %s vs %s" + % [label.text, label_rect, page_rect], + ) + assert( + label_rect.end.y <= page_rect.end.y + 0.5, + "Label ends below logbook page: %s %s vs %s" + % [label.text, label_rect, page_rect], + ) + + +func _find_overlay_card(parent: Node) -> PanelContainer: + for node: Node in parent.find_children( + "*", "PanelContainer", true, false + ): + var panel := node as PanelContainer + if panel.custom_minimum_size == LogbookPage.DETAIL_OVERLAY_CARD_SIZE: + return panel + return null + + func _find_portrait(entry: Button) -> LogbookPortraitType: var pending: Array[Node] = [entry] while not pending.is_empty(): @@ -375,10 +994,10 @@ func _validate_handwritten_logbook_font(page: LogbookPage) -> void: "rarity", "body of water", "time of day", + "seasons", "weight range", "value range", "number caught", - "number owned", ]: continue assert( @@ -395,10 +1014,10 @@ func _validate_detail_field_fonts(page: LogbookPage) -> void: "rarity", "body of water", "time of day", + "seasons", "weight range", "value range", "number caught", - "number owned", ] for node: Node in detail_body.find_children("*", "Label", true, false): var label := node as Label diff --git a/tests/manual/terrain_chunk_generator/terrain_chunk_compatibility_report.gd b/tests/manual/terrain_chunk_generator/terrain_chunk_compatibility_report.gd new file mode 100644 index 0000000..0d35543 --- /dev/null +++ b/tests/manual/terrain_chunk_generator/terrain_chunk_compatibility_report.gd @@ -0,0 +1,122 @@ +extends SceneTree + +const CATALOG: TerrainChunkCatalog = preload( + "res://world/generation/chunks/terrain_chunk_catalog.tres" +) +const BIOME_CATALOG: TerrainBiomeCatalog = preload( + "res://world/generation/biomes/terrain_biome_catalog.tres" +) + + +func _initialize() -> void: + call_deferred(&"_run") + + +func _run() -> void: + var generator := _make_generator() + root.add_child(generator) + if not generator._prepare_catalog(): + generator.free() + quit(1) + return + var variants: Array[TerrainChunkVariant] = [] + variants.assign(generator._solver_variants) + + print( + "Terrain chunk rotations: %d authored, %d distinct constraints" + % [generator._variants.size(), variants.size()] + ) + for variant: TerrainChunkVariant in variants: + print("\n", variant.stable_key()) + var ocean_edges := variant.rotated_edge_mask( + variant.definition.ocean_facing_edges + ) + for edge_value: int in TerrainChunkTopology.Edge.values(): + var edge := edge_value as TerrainChunkTopology.Edge + var matches := PackedStringArray() + for other: TerrainChunkVariant in variants: + var opposite := TerrainChunkTopology.opposite_edge(edge) + if generator._edges_are_compatible( + variant, + edge, + other, + opposite, + ): + matches.append( + "%s.%s" + % [ + other.stable_key(), + TerrainChunkTopology.edge_name(opposite), + ] + ) + print( + " %s%s [%d points]: %s" + % [ + TerrainChunkTopology.edge_name(edge), + ( + " [ocean]" + if (ocean_edges & (1 << edge_value)) != 0 + else "" + ), + variant.profile(edge).points.size(), + ", ".join(matches) if not matches.is_empty() else "NONE", + ] + ) + + if generator.generate(): + var summary := generator._build_summary() + print( + ( + "\nSeeded diagnostic layout %s " + + "(%d backtracks, %d repeated edges):" + ) + % [ + str(summary["layout_fingerprint"]).substr(0, 12), + int(summary["backtracks"]), + int(summary["adjacent_repeat_edges"]), + ] + ) + var keys := generator.placement_keys() + for row: int in generator.grid_size.y: + var cells := PackedStringArray() + for column: int in generator.grid_size.x: + cells.append(keys[row * generator.grid_size.x + column]) + print(" ", " ".join(cells)) + var biomes := TerrainBiomeAssigner.assign( + BIOME_CATALOG, + generator.placement_records(), + generator.generation_seed, + ) + print("\nBiome layout:") + for row: int in generator.grid_size.y: + var cells := PackedStringArray() + for column: int in generator.grid_size.x: + var biome_id: StringName = biomes.get( + Vector2i(column, row), + &"", + ) + cells.append(String(biome_id).trim_prefix("biome_")) + print(" ", " ".join(cells)) + generator.free() + quit(0) + + +func _make_generator() -> TerrainChunkGenerator: + var generator := TerrainChunkGenerator.new() + generator.catalog = CATALOG + generator.grid_size = Vector2i(9, 9) + generator.generation_seed = 13001 + generator.generate_on_ready = false + generator.build_collision = false + generator.force_center_chunk_id = &"chunk_spawn" + generator.required_chunk_ids = PackedStringArray( + [ + "chunk_spawn", + "chunk_0001", + "chunk_0002", + "chunk_0003", + "chunk_0004", + ] + ) + generator.grass_sand_smoothing_enabled = true + return generator diff --git a/tests/manual/terrain_chunk_generator/terrain_chunk_compatibility_report.gd.uid b/tests/manual/terrain_chunk_generator/terrain_chunk_compatibility_report.gd.uid new file mode 100644 index 0000000..1da131f --- /dev/null +++ b/tests/manual/terrain_chunk_generator/terrain_chunk_compatibility_report.gd.uid @@ -0,0 +1 @@ +uid://di4yaor4f3s4e diff --git a/tests/manual/terrain_chunk_generator/terrain_chunk_generator_test.gd b/tests/manual/terrain_chunk_generator/terrain_chunk_generator_test.gd new file mode 100644 index 0000000..657347f --- /dev/null +++ b/tests/manual/terrain_chunk_generator/terrain_chunk_generator_test.gd @@ -0,0 +1,37 @@ +extends Node3D + +@onready var _generator: TerrainChunkGenerator = $TerrainChunkGenerator +@onready var _status: Label = $Instructions/Status + + +func _unhandled_input(event: InputEvent) -> void: + if event.is_action_pressed(&"ui_cancel"): + get_viewport().set_input_as_handled() + get_tree().quit() + return + var key_event := event as InputEventKey + if ( + key_event != null + and key_event.pressed + and not key_event.echo + and key_event.physical_keycode == KEY_R + ): + get_viewport().set_input_as_handled() + _generator.generation_seed += 1 + _generator.generate() + + +func _on_generation_completed(summary: Dictionary) -> void: + _status.text = ( + "Terrain generator diagnostic • seed %d • %d chunks • " + + "%d rotations / %d constraints • %d backtracks • " + + "%d repeated edges\nlayout %s • R: regenerate • Esc/B: close" + ) % [ + int(summary["seed"]), + int(summary["chunk_count"]), + int(summary["variant_count"]), + int(summary["solver_variant_count"]), + int(summary["backtracks"]), + int(summary["adjacent_repeat_edges"]), + str(summary["layout_fingerprint"]).substr(0, 12), + ] diff --git a/tests/manual/terrain_chunk_generator/terrain_chunk_generator_test.gd.uid b/tests/manual/terrain_chunk_generator/terrain_chunk_generator_test.gd.uid new file mode 100644 index 0000000..4713f51 --- /dev/null +++ b/tests/manual/terrain_chunk_generator/terrain_chunk_generator_test.gd.uid @@ -0,0 +1 @@ +uid://0dmjswsm038h diff --git a/tests/manual/terrain_chunk_generator/terrain_chunk_generator_test.tscn b/tests/manual/terrain_chunk_generator/terrain_chunk_generator_test.tscn new file mode 100644 index 0000000..5c1e046 --- /dev/null +++ b/tests/manual/terrain_chunk_generator/terrain_chunk_generator_test.tscn @@ -0,0 +1,48 @@ +[gd_scene load_steps=7 format=3] + +[ext_resource type="Script" path="res://tests/manual/terrain_chunk_generator/terrain_chunk_generator_test.gd" id="1_test"] +[ext_resource type="Script" path="res://world/generation/terrain_chunk_generator.gd" id="2_generator"] +[ext_resource type="Resource" path="res://world/generation/chunks/terrain_chunk_catalog.tres" id="3_catalog"] +[ext_resource type="PackedScene" path="res://player/player.tscn" id="4_player"] +[ext_resource type="Environment" path="res://world/environment/straywild_environment.tres" id="5_environment"] + +[node name="TerrainChunkGeneratorTest" type="Node3D"] +script = ExtResource("1_test") + +[node name="WorldEnvironment" type="WorldEnvironment" parent="."] +environment = ExtResource("5_environment") + +[node name="Sun" type="DirectionalLight3D" parent="."] +rotation_degrees = Vector3(-54, -32, 0) +light_color = Color(0.88, 0.94, 0.96, 1) +light_energy = 1.0 +shadow_enabled = true + +[node name="TerrainChunkGenerator" type="Node3D" parent="."] +script = ExtResource("2_generator") +catalog = ExtResource("3_catalog") +grid_size = Vector2i(15, 13) +generation_seed = 13001 +build_collision = true +show_chunk_labels = false +force_center_chunk_id = &"chunk_spawn" +required_chunk_ids = PackedStringArray("chunk_spawn", "chunk_0001", "chunk_0002", "chunk_0003", "chunk_0004") +grass_sand_smoothing_enabled = true +elevated_cliff_feature_enabled = true + +[node name="Player" parent="." instance=ExtResource("4_player")] +position = Vector3(0, 0.3, 0) + +[node name="Instructions" type="CanvasLayer" parent="."] +layer = 20 + +[node name="Status" type="Label" parent="Instructions"] +offset_left = 18.0 +offset_top = 18.0 +offset_right = 930.0 +offset_bottom = 74.0 +text = "Terrain generator diagnostic\nR: regenerate • Esc/B: close" +theme_override_colors/font_color = Color(0.76, 0.88, 0.9, 1) +theme_override_font_sizes/font_size = 18 + +[connection signal="generation_completed" from="TerrainChunkGenerator" to="." method="_on_generation_completed"] diff --git a/tests/movement_multiplayer_validation.gd b/tests/movement_multiplayer_validation.gd index 274544a..05a668d 100644 --- a/tests/movement_multiplayer_validation.gd +++ b/tests/movement_multiplayer_validation.gd @@ -2,7 +2,7 @@ extends SceneTree const MainScene: PackedScene = preload("res://main/main.tscn") const PlayerScene: PackedScene = preload("res://player/player.tscn") -const TEST_PORT: int = 18141 +const TEST_PORT: int = 18171 func _initialize() -> void: @@ -32,15 +32,40 @@ func _validate_latency_smoothing() -> void: await process_frame avatar.set_process(false) avatar.set_physics_process(false) + _validate_compact_input_encoding() _validate_compact_snapshot_encoding() + _validate_compact_animation_encoding() + _validate_animation_action_ordering(avatar) _validate_transit_estimation() - _validate_remote_snapshot_smoothing(avatar) + await _validate_remote_snapshot_smoothing(avatar) + _validate_remote_locomotion_playback_recovery(avatar) _validate_reliable_jump_intent(avatar) + _validate_airborne_sitting(avatar) _validate_stale_input_expiry(avatar) avatar.queue_free() await process_frame +func _validate_compact_input_encoding() -> void: + var input: Dictionary = _movement_input( + 12, + true, + true, + true, + &"strike", + 4, + true, + ) + var encoded: Array = NetworkSession._encode_movement_input(input) + assert(encoded.size() == NetworkSession.MOVEMENT_INPUT_FIELD_COUNT) + assert(var_to_bytes(encoded).size() < var_to_bytes(input).size()) + assert(NetworkSession._decode_movement_input(encoded) == input) + assert(NetworkSession._decode_movement_input(encoded.slice(0, 3)).is_empty()) + var unknown_flags: Array = encoded.duplicate() + unknown_flags[3] = 1 << 12 + assert(NetworkSession._decode_movement_input(unknown_flags).is_empty()) + + func _validate_compact_snapshot_encoding() -> void: var moving_snapshot: Dictionary = _network_snapshot( Vector3.ZERO, @@ -48,16 +73,168 @@ func _validate_compact_snapshot_encoding() -> void: 1, ) assert(NetworkSession.MOVEMENT_SNAPSHOT_BATCH_SIZE == 8) + assert(NetworkSession.OWNER_SNAPSHOT_DIVISOR == 3) var encoded_snapshots: Array = [] for _peer: int in NetworkSession.MOVEMENT_SNAPSHOT_BATCH_SIZE: encoded_snapshots.append( NetworkSession._encode_movement_snapshot(moving_snapshot) ) assert(var_to_bytes(encoded_snapshots).size() < 1200) + var expected_snapshot: Dictionary = moving_snapshot.duplicate(true) + expected_snapshot.erase("animation_state") + assert( + NetworkSession._decode_movement_snapshot(encoded_snapshots[0]) + == expected_snapshot + ) assert( NetworkSession._decode_movement_snapshot( - encoded_snapshots[0] - ) == moving_snapshot + encoded_snapshots[0].slice(0, 4) + ).is_empty() + ) + var invalid_snapshot_flags: Array = encoded_snapshots[0].duplicate() + invalid_snapshot_flags[5] = 1 << 12 + assert( + NetworkSession._decode_movement_snapshot( + invalid_snapshot_flags + ).is_empty() + ) + + +func _validate_compact_animation_encoding() -> void: + var paused_state := NetworkPlayerAnimationProtocol.make_state( + NetworkPlayerAnimationProtocol.LOCOMOTION_IDLE, + true, + &"strike", + 7, + 0.5, + true, + ) + var encoded: Array = NetworkSession._encode_movement_animation( + 2, + paused_state, + ) + assert(encoded.size() == NetworkSession.MOVEMENT_ANIMATION_FIELD_COUNT) + var decoded: Dictionary = NetworkSession._decode_movement_animation(encoded) + assert(int(decoded.get("peer_id", 0)) == 2) + assert(Dictionary(decoded.get("state", {})) == paused_state) + var advanced_state: Dictionary = paused_state.duplicate(true) + advanced_state["action"]["elapsed"] = 0.75 + assert( + NetworkSession._movement_animation_signature(advanced_state) + == NetworkSession._movement_animation_signature(paused_state) + ) + var action: Dictionary = paused_state["action"] + var encoded_action: Array = ( + NetworkSession._encode_movement_animation_action(action, true) + ) + assert( + encoded_action.size() + == NetworkSession.MOVEMENT_ANIMATION_ACTION_FIELD_COUNT + ) + var decoded_action: Dictionary = ( + NetworkSession._decode_movement_animation_action(encoded_action) + ) + assert(Dictionary(decoded_action.get("action", {})) == action) + assert(bool(decoded_action.get("sitting", false))) + assert( + NetworkSession._decode_movement_animation_action( + encoded_action.slice(0, 2) + ).is_empty() + ) + + +func _validate_airborne_sitting(avatar: Player) -> void: + avatar.reset_network_movement_state() + avatar.set_local_control(true) + avatar.set("_sit_after_landing", true) + assert(avatar.get_network_sitting_intent()) + assert(not avatar.get_network_sitting_state()) + assert(not bool(avatar.make_network_snapshot(2)["sitting"])) + assert(bool(avatar.capture_network_input(1)["sitting"])) + avatar.call("_queue_local_network_jump_intent") + var jumping_input: Dictionary = avatar.capture_network_input(2) + assert(bool(jumping_input["jump"])) + assert(not bool(jumping_input["sitting"])) + avatar.call("_cancel_sitting_for_jump") + assert(not bool(avatar.get("_sit_after_landing"))) + assert(bool(avatar.get("_sitting_intent_pending"))) + avatar.reset_network_movement_state() + + # Even a malformed or stale reconciliation that marks an airborne avatar as + # seated must not bypass gravity and freeze it in place. + avatar.set("_sit_after_landing", false) + avatar.call("_set_sitting", true) + avatar.velocity = Vector3(0.0, 4.0, 0.0) + avatar.call("_simulate_movement_physics", 0.1) + assert(not avatar.is_sitting()) + assert(bool(avatar.get("_sit_after_landing"))) + assert(avatar.velocity.y < 4.0) + avatar.reset_network_movement_state() + + +func _validate_animation_action_ordering(avatar: Player) -> void: + var draw := NetworkPlayerAnimationProtocol.make_action_state( + &"draw", 5, 0.2 + ) + avatar.apply_authoritative_network_animation_action(draw) + assert(StringName(str(avatar.get("_animation_action_id"))) == &"draw") + var cleared := NetworkPlayerAnimationProtocol.make_action_state( + &"", 6, 0.0 + ) + avatar.apply_authoritative_network_animation_action(cleared) + assert(StringName(str(avatar.get("_animation_action_id"))).is_empty()) + avatar.apply_authoritative_network_animation_action(draw) + assert(StringName(str(avatar.get("_animation_action_id"))).is_empty()) + avatar.apply_authoritative_network_animation_action( + NetworkPlayerAnimationProtocol.make_action_state(&"strike", 6, 0.0) + ) + assert(StringName(str(avatar.get("_animation_action_id"))).is_empty()) + var strike := NetworkPlayerAnimationProtocol.make_action_state( + &"strike", 7, 0.2 + ) + avatar.apply_authoritative_network_animation_action(strike) + avatar.apply_authoritative_network_animation_action( + NetworkPlayerAnimationProtocol.make_action_state( + &"strike", 8, 0.4, true + ) + ) + avatar.apply_authoritative_network_animation_action(strike) + assert(bool(avatar.get("_animation_action_paused"))) + avatar.apply_authoritative_network_animation_action( + NetworkPlayerAnimationProtocol.make_action_state(&"", 9, 0.0) + ) + + avatar.configure_network_remote(false) + avatar.apply_network_animation_state( + NetworkPlayerAnimationProtocol.make_state( + NetworkPlayerAnimationProtocol.LOCOMOTION_IDLE, + true, + &"strike", + 9, + 0.4, + true, + ) + ) + avatar.apply_network_animation_state( + NetworkPlayerAnimationProtocol.make_state( + NetworkPlayerAnimationProtocol.LOCOMOTION_WALKING, + true, + &"draw", + 8, + 0.1, + ) + ) + assert( + StringName(str(avatar.get("_network_target_animation_action_id"))) + == &"strike" + ) + avatar.apply_network_animation_state( + NetworkPlayerAnimationProtocol.make_state( + NetworkPlayerAnimationProtocol.LOCOMOTION_IDLE, + true, + &"", + 10, + ) ) @@ -136,16 +313,191 @@ func _validate_remote_snapshot_smoothing(avatar: Player) -> void: ) assert(avatar.global_position.x <= maximum_extrapolated_x + 0.1) + # Reconciliation only applies after both simulations report a grounded body. + # Give the unit avatar a real floor so this exercises the production path. + var floor := StaticBody3D.new() + floor.collision_layer = 1 + floor.collision_mask = 0 + floor.position = Vector3(0.0, -0.1, 0.0) + var floor_shape := CollisionShape3D.new() + var floor_box := BoxShape3D.new() + floor_box.size = Vector3(100.0, 0.2, 100.0) + floor_shape.shape = floor_box + floor.add_child(floor_shape) + root.add_child(floor) + await physics_frame avatar.set_local_control(true) avatar.global_position = Vector3(0.8, 0.0, 0.0) + avatar.velocity = Vector3.DOWN + avatar.move_and_slide() + assert(avatar.is_on_floor()) avatar.apply_local_prediction_correction( moving_snapshot, - 10, + 2, 1.0 / 30.0, 0.1, + 0.1, ) - assert(avatar.global_position.x < 0.8) - assert(avatar.global_position.x > 0.7) + # Ordinary host/client disagreement is expected while a packet is in flight. + # It must never tug the locally controlled body or camera around. + assert(is_equal_approx(avatar.global_position.x, 0.8)) + assert( + int(avatar.get("_local_prediction_soft_corrections")) == 0 + ) + assert( + int(avatar.get("_local_prediction_hard_corrections")) == 0 + ) + + # A larger but still plausible mismatch must persist across multiple audits + # before a small correction is allowed. Preserve both visible character and + # camera positions while the collision body catches up. + avatar.global_position = Vector3(3.0, 0.0, 0.0) + var visual_position: Vector3 = avatar.get_node("Visuals").global_position + var camera_position: Vector3 = avatar.get_node("CameraYaw").global_position + var drift_snapshot: Dictionary = _network_snapshot( + Vector3.ZERO, + Vector3.ZERO, + 20, + ) + for _audit: int in 3: + avatar.apply_local_prediction_correction( + drift_snapshot, + 20, + 1.0 / 30.0, + 0.0, + 0.1, + ) + assert(is_equal_approx(avatar.global_position.x, 3.0)) + avatar.apply_local_prediction_correction( + drift_snapshot, + 20, + 1.0 / 30.0, + 0.0, + 0.1, + ) + assert(avatar.global_position.x < 3.0) + assert(avatar.global_position.x >= 2.85 - 0.001) + assert(avatar.get_node("Visuals").global_position == visual_position) + assert(avatar.get_node("CameraYaw").global_position == camera_position) + assert( + int(avatar.get("_local_prediction_soft_corrections")) == 1 + ) + + # Host and client jump timing naturally differs. An airborne authoritative + # snapshot must not drag the local capsule sideways or down before landing. + avatar.global_position = Vector3(3.0, 0.0, 0.0) + avatar.velocity = Vector3(0.0, 1.0, 0.0) + var airborne_snapshot: Dictionary = drift_snapshot.duplicate(true) + airborne_snapshot["grounded"] = false + for _audit: int in 6: + avatar.apply_local_prediction_correction( + airborne_snapshot, + 20, + 1.0 / 30.0, + 0.0, + 0.1, + ) + assert(avatar.global_position.is_equal_approx(Vector3(3.0, 0.0, 0.0))) + assert(int(avatar.get("_local_prediction_soft_corrections")) == 1) + avatar.velocity = Vector3.ZERO + + # The local body may reach its apex after the host has already landed. The + # local airborne state still owns presentation and must not be pulled toward + # the host until it has landed too. + avatar.global_position = Vector3(3.0, 2.0, 0.0) + avatar.velocity = Vector3.ZERO + avatar.move_and_slide() + assert(not avatar.is_on_floor()) + for _audit: int in 6: + avatar.apply_local_prediction_correction( + drift_snapshot, + 20, + 1.0 / 30.0, + 0.0, + 0.1, + ) + assert(avatar.global_position.is_equal_approx(Vector3(3.0, 2.0, 0.0))) + assert(int(avatar.get("_local_prediction_soft_corrections")) == 1) + + # Genuine divergence still recovers immediately, as do the separate reliable + # teleport and water-recovery paths used by gameplay transitions. + avatar.global_position = Vector3(10.0, 0.0, 0.0) + avatar.apply_local_prediction_correction( + drift_snapshot, + 20, + 1.0 / 30.0, + 0.0, + 0.1, + ) + assert(avatar.global_position == Vector3.ZERO) + assert( + int(avatar.get("_local_prediction_hard_corrections")) == 1 + ) + + # Soft reconciliation must respect the same terrain collision as ordinary + # player movement instead of phasing the capsule through a solid obstacle. + var blocker := StaticBody3D.new() + blocker.collision_layer = 1 + blocker.collision_mask = 0 + blocker.position = Vector3(1.0, 1.0, 0.0) + var blocker_shape := CollisionShape3D.new() + var blocker_box := BoxShape3D.new() + blocker_box.size = Vector3(0.2, 4.0, 4.0) + blocker_shape.shape = blocker_box + blocker.add_child(blocker_shape) + root.add_child(blocker) + await physics_frame + avatar.global_position = Vector3.ZERO + avatar.velocity = Vector3.ZERO + avatar.call("_clear_local_reconciliation_offsets") + var blocked_visual_position: Vector3 = ( + avatar.get_node("Visuals") as Node3D + ).global_position + var blocked_camera_position: Vector3 = ( + avatar.get_node("CameraYaw") as Node3D + ).global_position + assert(bool(avatar.call( + "_apply_camera_safe_local_correction", + Vector3(2.0, 0.0, 0.0), + ))) + assert(avatar.global_position.x > 0.0 and avatar.global_position.x < 0.6) + assert( + (avatar.get_node("Visuals") as Node3D).global_position + == blocked_visual_position + ) + assert( + (avatar.get_node("CameraYaw") as Node3D).global_position + == blocked_camera_position + ) + blocker.queue_free() + floor.queue_free() + await physics_frame + + +func _validate_remote_locomotion_playback_recovery(avatar: Player) -> void: + avatar.configure_network_remote(false) + avatar.push_network_snapshot( + _network_snapshot(Vector3.ZERO, Vector3(4.5, 0.0, 0.0), 21) + ) + avatar.call("_update_character_animation") + var animation_player := avatar.get_node( + "Visuals/CharacterRig/AnimationPlayer" + ) as AnimationPlayer + assert(animation_player.assigned_animation == &"running") + assert(animation_player.is_playing()) + + # Reproduce issue #111: locomotion replication still says RUNNING (and the + # dust therefore still emits), but the rig playback has fallen idle. The + # local presentation pass must repair that state without another packet. + animation_player.stop() + assert(not animation_player.is_playing()) + assert( + int(avatar.get("_network_target_locomotion_state")) + == Player.LocomotionState.RUNNING + ) + avatar.call("_update_character_animation") + assert(animation_player.assigned_animation == &"running") + assert(animation_player.is_playing()) func _validate_reliable_jump_intent(avatar: Player) -> void: @@ -158,9 +510,10 @@ func _validate_reliable_jump_intent(avatar: Player) -> void: assert(int(avatar.get("_local_network_jump_intent_sequence")) == 20) avatar.apply_local_prediction_correction( _network_snapshot(avatar.global_position, Vector3.ZERO, 20), - 21, + 20, 1.0 / 30.0, 0.0, + 0.1, ) assert(not bool(avatar.capture_network_input(22)["jump"])) @@ -189,12 +542,24 @@ func _validate_reliable_jump_intent(avatar: Player) -> void: func _validate_stale_input_expiry(avatar: Player) -> void: avatar.configure_network_remote(true) - avatar.apply_authoritative_network_input(_movement_input(40, true)) + var high_latency_timeout := ( + Player.resolve_network_input_stale_timeout_seconds(400) + ) + assert(high_latency_timeout > Player.NETWORK_INPUT_STALE_TIMEOUT_SECONDS) + avatar.apply_authoritative_network_input( + _movement_input(40, true), + high_latency_timeout, + ) assert((avatar.get("_network_axis") as Vector2).length_squared() > 0.0) avatar.call( "_update_network_input_freshness", Player.NETWORK_INPUT_STALE_TIMEOUT_SECONDS + 0.01, ) + assert(not bool(avatar.get("_network_input_stale"))) + avatar.call( + "_update_network_input_freshness", + high_latency_timeout, + ) assert((avatar.get("_network_axis") as Vector2) == Vector2.ZERO) assert(not bool(avatar.get("_network_sprint"))) assert(bool(avatar.get("_network_input_stale"))) @@ -214,6 +579,7 @@ func _network_snapshot( "position": [position.x, position.y, position.z], "velocity": [velocity.x, velocity.y, velocity.z], "visual_yaw": 0.0, + "grounded": true, "animation_state": NetworkPlayerAnimationProtocol.make_state( NetworkPlayerAnimationProtocol.LOCOMOTION_RUNNING, true, @@ -227,22 +593,67 @@ func _run_host() -> void: var main: Node = await _create_initialized_main() var session := main.get_node("%NetworkSession") as NetworkSession var save_manager := main.get("_save_manager") as PlayerSaveManager + assert(bool(main.call( + "_apply_world", + WorldLayout.STARTER_ISLAND, + NetworkProtocol.DEFAULT_WORLD_SEED, + true, + ))) + assert(bool(main.call( + "_prepare_host_world", + WorldLayout.STARTER_ISLAND, + NetworkProtocol.DEFAULT_WORLD_SEED, + ))) + assert(save_manager.initialize_new_game( + NetworkProtocol.DEFAULT_WORLD_SEED, + WorldLayout.STARTER_ISLAND, + )) assert(session.start_private_host(TEST_PORT)) - assert(save_manager.initialize_new_game()) main.call("_enter_gameplay") for _frame: int in 4: await physics_frame assert(session.set_host_open(true)) var remote_peer_id: int = await _wait_for_remote_peer(session) assert(remote_peer_id > 1) + # Authentication completes before the client has necessarily created and + # begun observing the host avatar. Give its gameplay scene a bounded moment + # to settle before emitting the one-shot locomotion/action sequence. + await create_timer(3.0).timeout var player := main.get("_player") as Player + var world := main.get_node("TestWorld") as TestWorld player.configure_network_remote(true) - player.apply_authoritative_network_input(_movement_input(1, true)) - await create_timer(2.5).timeout - player.apply_authoritative_network_input(_movement_input(2, false)) - await create_timer(2.5).timeout - player.apply_authoritative_network_input(_movement_input(3, false, false)) - var disconnect_deadline: int = Time.get_ticks_msec() + 8000 + await _reset_locomotion_test_position(player, session, world) + var input_sequence: int = 1 + input_sequence = await _sustain_locomotion_input( + player, input_sequence, 1.5, true + ) + await _reset_locomotion_test_position(player, session, world) + input_sequence = await _sustain_locomotion_input( + player, input_sequence, 1.5, false + ) + await _reset_locomotion_test_position(player, session, world) + input_sequence = await _sustain_locomotion_input( + player, input_sequence, 1.5, false, true, true + ) + input_sequence = await _sustain_locomotion_input( + player, input_sequence, 1.5, false, false, true + ) + player.apply_authoritative_network_input( + _movement_input(input_sequence, false, false, true, &"draw", 1) + ) + input_sequence += 1 + await create_timer(1.0).timeout + player.apply_authoritative_network_input( + _movement_input( + input_sequence, false, false, true, &"strike", 2, true + ) + ) + input_sequence += 1 + await create_timer(2.0).timeout + player.apply_authoritative_network_input( + _movement_input(input_sequence, false, false, false, &"", 3) + ) + var disconnect_deadline: int = Time.get_ticks_msec() + 15000 while ( Time.get_ticks_msec() < disconnect_deadline and session.is_authenticated_peer(remote_peer_id) @@ -276,7 +687,7 @@ func _run_client() -> void: var spawn_service := main.get_node( "%PlayerSpawnService" ) as PlayerSpawnService - var host_avatar: Player = spawn_service.get_avatar(1) + var host_avatar: Player = await _wait_for_avatar(spawn_service, 1) assert(host_avatar != null) var animation_player := host_avatar.get_node( "Visuals/CharacterRig/AnimationPlayer" @@ -284,16 +695,50 @@ func _run_client() -> void: var sprint_dust := host_avatar.get_node("%SprintDust") as SprintDustTrail var saw_running: bool = false var saw_walking: bool = false + var saw_sneaking: bool = false + var saw_idle_sneak: bool = false + var saw_net_draw: bool = false + var saw_net_strike: bool = false + var saw_net_strike_paused: bool = false var saw_animation_advance: bool = false var saw_dust: bool = false + var observed_animations: Dictionary = {} + var observed_locomotion_states: Dictionary = {} + var maximum_sneak_speed: float = 0.0 var previous_animation: StringName = &"" var previous_animation_position: float = -1.0 - var observation_deadline: int = Time.get_ticks_msec() + 7000 + var observation_deadline: int = Time.get_ticks_msec() + 22000 while Time.get_ticks_msec() < observation_deadline: await process_frame var current_animation: StringName = animation_player.current_animation + observed_animations[current_animation] = true + var target_locomotion_state: int = int(host_avatar.get( + "_network_target_locomotion_state" + )) + observed_locomotion_states[target_locomotion_state] = true + if target_locomotion_state == Player.LocomotionState.SNEAKING: + maximum_sneak_speed = maxf( + maximum_sneak_speed, + Vector2( + host_avatar.velocity.x, host_avatar.velocity.z + ).length(), + ) saw_running = saw_running or current_animation.begins_with("running") saw_walking = saw_walking or current_animation.begins_with("walking") + saw_sneaking = saw_sneaking or current_animation == &"sneaking" + saw_idle_sneak = saw_idle_sneak or current_animation == &"idle_sneak" + saw_net_draw = saw_net_draw or current_animation == &"draw" + saw_net_strike = ( + saw_net_strike + or current_animation == &"strike" + or animation_player.assigned_animation == &"strike" + ) + saw_net_strike_paused = ( + saw_net_strike_paused + or bool(host_avatar.get( + "_network_target_animation_action_paused" + )) + ) var current_position: float = ( animation_player.current_animation_position ) @@ -306,12 +751,56 @@ func _run_client() -> void: previous_animation = current_animation previous_animation_position = current_position saw_dust = saw_dust or sprint_dust.get_active_puff_count() > 0 - if saw_running and saw_walking and saw_animation_advance and saw_dust: - break - assert(saw_running) - assert(saw_walking) - assert(saw_animation_advance) - assert(saw_dust) + if ( + saw_running + and saw_walking + and saw_sneaking + and saw_idle_sneak + and saw_net_draw + and saw_net_strike + and saw_net_strike_paused + and saw_animation_advance + and saw_dust + ): + break + var missing_observations: Array[String] = [] + if not saw_running: + missing_observations.append("running") + if not saw_walking: + missing_observations.append("walking") + if not saw_sneaking: + missing_observations.append("sneaking") + if not saw_idle_sneak: + missing_observations.append("idle_sneak") + if not saw_net_draw: + missing_observations.append("net_draw") + if not saw_net_strike: + missing_observations.append("net_strike") + if not saw_net_strike_paused: + missing_observations.append("net_strike_paused") + if not saw_animation_advance: + missing_observations.append("animation_advance") + if not saw_dust: + missing_observations.append("sprint_dust") + if not missing_observations.is_empty(): + push_error( + ( + "Missing movement observations %s; observed animations: %s; " + + "locomotion states: %s; maximum sneak speed: %.3f" + ) % [ + missing_observations, + observed_animations.keys(), + observed_locomotion_states.keys(), + maximum_sneak_speed, + ] + ) + session.disconnect_session("") + main.queue_free() + for _frame: int in 4: + await process_frame + await create_timer(0.1).timeout + quit(1) + return print("Movement multiplayer client validation: PASS") session.disconnect_session("") main.queue_free() @@ -325,6 +814,10 @@ func _movement_input( sequence: int, sprinting: bool, moving: bool = true, + sneaking: bool = false, + action_id: StringName = &"", + action_sequence: int = 0, + action_paused: bool = false, ) -> Dictionary: return { "sequence": sequence, @@ -332,16 +825,52 @@ func _movement_input( "camera_yaw": 0.0, "jump": false, "sprint": sprinting, - "sneak": false, + "sneak": sneaking, "slow_walk": false, "sitting": false, "casting": false, - "animation_action": ( - NetworkPlayerAnimationProtocol.make_action_state() + "animation_action": NetworkPlayerAnimationProtocol.make_action_state( + action_id, + action_sequence, + 0.0, + action_paused, ), } +func _sustain_locomotion_input( + player: Player, + starting_sequence: int, + duration_seconds: float, + sprinting: bool, + moving: bool = true, + sneaking: bool = false, +) -> int: + var sequence: int = starting_sequence + var deadline: int = ( + Time.get_ticks_msec() + roundi(duration_seconds * 1000.0) + ) + while Time.get_ticks_msec() < deadline: + player.apply_authoritative_network_input( + _movement_input(sequence, sprinting, moving, sneaking) + ) + sequence += 1 + await create_timer(0.1).timeout + return sequence + + +func _reset_locomotion_test_position( + player: Player, + session: NetworkSession, + world: TestWorld, +) -> void: + player.velocity = Vector3.ZERO + player.global_transform = world.get_player_spawn_transform() + session.publish_authoritative_teleport(1) + for _frame: int in 4: + await physics_frame + + func _create_initialized_main() -> Node: root.size = Vector2i(1280, 720) var main: Node = MainScene.instantiate() @@ -364,3 +893,16 @@ func _wait_for_remote_peer(session: NetworkSession) -> int: if peer_id != session.get_local_peer_id(): return peer_id return 0 + + +func _wait_for_avatar( + spawn_service: PlayerSpawnService, + peer_id: int, +) -> Player: + var deadline: int = Time.get_ticks_msec() + 8000 + while Time.get_ticks_msec() < deadline: + await process_frame + var avatar := spawn_service.get_avatar(peer_id) as Player + if avatar != null: + return avatar + return null diff --git a/tests/net_attachment_validation.gd b/tests/net_attachment_validation.gd new file mode 100644 index 0000000..6b53c08 --- /dev/null +++ b/tests/net_attachment_validation.gd @@ -0,0 +1,163 @@ +extends SceneTree + +const NetAttachmentScene: PackedScene = preload( + "res://player/net_attachment.tscn" +) +const FishingRodAttachmentScene: PackedScene = preload( + "res://player/fishing_rod_attachment.tscn" +) + +var failures: Array[String] = [] + + +func _initialize() -> void: + call_deferred("_run") + + +func _run() -> void: + var host_skeleton := Skeleton3D.new() + host_skeleton.name = "HostSkeleton" + host_skeleton.add_bone("rod_socket") + host_skeleton.add_bone("rod_socket.001") + host_skeleton.set_bone_parent(1, 0) + host_skeleton.set_bone_rest( + 1, + Transform3D( + Basis(Quaternion(Vector3.UP, Vector3.RIGHT)), + Vector3(0.0, 0.25, 0.0), + ), + ) + root.add_child(host_skeleton) + + var attachment := NetAttachmentScene.instantiate() as BoneAttachment3D + host_skeleton.add_child(attachment) + await process_frame + await process_frame + + _check( + attachment.bone_name == "rod_socket", + "Attachment moved off rod_socket.", + ) + var catching_net := attachment.get_node_or_null("CatchingNet") as Node3D + _check(catching_net != null, "CatchingNet presentation root is missing.") + if catching_net == null: + _finish(host_skeleton) + return + _check(not catching_net.visible, "Net must start hidden.") + _check( + catching_net.position.is_zero_approx(), + "Net direction alignment moved its hand anchor.", + ) + _check( + catching_net.basis.y.is_equal_approx(Vector3.UP), + "Net working axis no longer follows rod_socket.", + ) + _check( + catching_net.basis.z.is_equal_approx(Vector3.RIGHT), + "Net rear face did not follow the socket direction guide.", + ) + + var model := catching_net.get_node_or_null("ModelMount/NetModel") as Node3D + _check(model != null, "Imported net model is missing.") + if model == null: + _finish(host_skeleton) + return + var skeleton := model.find_child("Skeleton3D", true, false) as Skeleton3D + _check(skeleton != null, "Imported net Skeleton3D is missing.") + if skeleton == null: + _finish(host_skeleton) + return + _check( + skeleton.find_bone("net_root") >= 0, + "Imported net_root bone is missing.", + ) + _check( + skeleton.find_bone("net_rim") >= 0, + "Imported net_rim bone is missing.", + ) + _check( + skeleton.find_bone("net_mid") >= 0, + "Imported net_mid bone is missing.", + ) + _check( + skeleton.find_bone("net_tip") >= 0, + "Imported net_tip bone is missing.", + ) + + var spring := skeleton.get_node_or_null("NetSpring") as SpringBoneSimulator3D + _check(spring != null, "Net spring simulator was not created.") + if spring != null: + _check(spring.get_setting_count() == 1, "Net spring settings changed.") + _check( + spring.get_root_bone_name(0) == &"net_mid", + "Net spring root must remain net_mid.", + ) + _check( + spring.get_end_bone_name(0) == &"net_tip", + "Net spring end must remain net_tip.", + ) + _check(not spring.active, "Hidden net spring must be suspended.") + catching_net.visible = true + await process_frame + await process_frame + _check(spring.active, "Visible net spring must be active.") + _check(spring.get_joint_count(0) == 2, "Net spring chain is incomplete.") + _check( + not attachment.get_impact_world_position().is_equal_approx( + catching_net.global_position + ), + "Net impact position did not follow the authored rim bone.", + ) + catching_net.visible = false + await process_frame + _check(not spring.active, "Hidden net spring did not suspend.") + + for child: Node in model.find_children("*", "MeshInstance3D", true, false): + var mesh_instance := child as MeshInstance3D + if mesh_instance.mesh == null: + continue + for surface_index: int in mesh_instance.mesh.get_surface_count(): + var material := mesh_instance.mesh.surface_get_material(surface_index) + if material is BaseMaterial3D: + _check( + (material as BaseMaterial3D).texture_filter + == BaseMaterial3D.TEXTURE_FILTER_NEAREST, + "Net material does not use nearest texture sampling.", + ) + + var rod_attachment := ( + FishingRodAttachmentScene.instantiate() as BoneAttachment3D + ) + host_skeleton.add_child(rod_attachment) + await process_frame + var fishing_rod := rod_attachment.get_node("FishingRod") as Node3D + _check( + fishing_rod.position.is_zero_approx(), + "Rod direction alignment moved its hand anchor.", + ) + _check( + fishing_rod.basis.y.is_equal_approx(Vector3.UP), + "Rod working axis no longer follows rod_socket.", + ) + _check( + fishing_rod.basis.z.is_equal_approx(Vector3.RIGHT), + "Rod rear face did not follow the socket direction guide.", + ) + + _finish(host_skeleton) + + +func _finish(host_skeleton: Skeleton3D) -> void: + host_skeleton.queue_free() + if failures.is_empty(): + print("Net attachment validation: PASS") + quit(0) + return + for failure: String in failures: + printerr("Net attachment validation: ", failure) + quit(1) + + +func _check(condition: bool, message: String) -> void: + if not condition: + failures.append(message) diff --git a/tests/net_attachment_validation.gd.uid b/tests/net_attachment_validation.gd.uid new file mode 100644 index 0000000..5f968d1 --- /dev/null +++ b/tests/net_attachment_validation.gd.uid @@ -0,0 +1 @@ +uid://clnr8ofu1fqw5 diff --git a/tests/network_chat_protocol_validation.gd b/tests/network_chat_protocol_validation.gd new file mode 100644 index 0000000..9368189 --- /dev/null +++ b/tests/network_chat_protocol_validation.gd @@ -0,0 +1,55 @@ +extends SceneTree + +const EDGE_PADDING: String = " \t\n ​⠀" + + +func _initialize() -> void: + call_deferred("_validate_protocol") + + +func _validate_protocol() -> void: + _validate_type_and_empty_handling() + _validate_message_cleanup() + _validate_protocol_limits() + print("Network chat protocol validation: PASS") + quit() + + +func _validate_type_and_empty_handling() -> void: + assert(NetworkChatProtocol.sanitize_body(null) == "") + assert(NetworkChatProtocol.sanitize_body(42) == "") + assert(NetworkChatProtocol.sanitize_body(EDGE_PADDING) == "") + assert(NetworkChatProtocol.sanitize_body("\u0001") == "") + + +func _validate_message_cleanup() -> void: + assert(NetworkChatProtocol.sanitize_body(" hello ") == "hello") + assert(NetworkChatProtocol.sanitize_body("a\tb\nc") == "a b c") + assert(NetworkChatProtocol.sanitize_body("word word") == "word word") + assert(NetworkChatProtocol.sanitize_body(" !!! ") == "!!!") + assert( + NetworkChatProtocol.sanitize_body( + EDGE_PADDING + "visible" + EDGE_PADDING + ) == "visible" + ) + + +func _validate_protocol_limits() -> void: + var maximum_body: String = "a".repeat( + NetworkChatProtocol.MAX_VISIBLE_CHARACTERS + ) + assert(NetworkChatProtocol.sanitize_body(maximum_body) == maximum_body) + assert( + NetworkChatProtocol.sanitize_body(maximum_body + "a") == "" + ) + var maximum_utf8_body: String = "🐟".repeat( + NetworkChatProtocol.MAX_VISIBLE_CHARACTERS + ) + assert( + maximum_utf8_body.to_utf8_buffer().size() + == NetworkChatProtocol.MAX_UTF8_BYTES + ) + assert( + NetworkChatProtocol.sanitize_body(maximum_utf8_body) + == maximum_utf8_body + ) diff --git a/tests/network_chat_protocol_validation.gd.uid b/tests/network_chat_protocol_validation.gd.uid new file mode 100644 index 0000000..5e98b42 --- /dev/null +++ b/tests/network_chat_protocol_validation.gd.uid @@ -0,0 +1 @@ +uid://bj7nq2k6q5c7f diff --git a/tests/network_player_animation_protocol_validation.gd b/tests/network_player_animation_protocol_validation.gd index 8c3474c..66a3ec3 100644 --- a/tests/network_player_animation_protocol_validation.gd +++ b/tests/network_player_animation_protocol_validation.gd @@ -15,11 +15,24 @@ func _initialize() -> void: 1.25, ) assert(NetworkPlayerAnimationProtocol.validate_state(emote)) + var paused_action := NetworkPlayerAnimationProtocol.make_action_state( + &"strike", + 18, + 0.72, + true, + ) + assert(NetworkPlayerAnimationProtocol.validate_action_state(paused_action)) + assert(bool(paused_action["paused"])) var future_locomotion := NetworkPlayerAnimationProtocol.make_state( &"swimming_fast", false, ) assert(NetworkPlayerAnimationProtocol.validate_state(future_locomotion)) + var sneaking := NetworkPlayerAnimationProtocol.make_state( + NetworkPlayerAnimationProtocol.LOCOMOTION_SNEAKING, + true, + ) + assert(NetworkPlayerAnimationProtocol.validate_state(sneaking)) var extra_future_field: Dictionary = emote.duplicate(true) extra_future_field["future_layer"] = {"id": "umbrella"} assert(NetworkPlayerAnimationProtocol.validate_state(extra_future_field)) @@ -45,5 +58,8 @@ func _initialize() -> void: "elapsed": INF, } assert(not NetworkPlayerAnimationProtocol.validate_state(invalid_elapsed)) + var invalid_paused: Dictionary = emote.duplicate(true) + invalid_paused["action"]["paused"] = "yes" + assert(not NetworkPlayerAnimationProtocol.validate_state(invalid_paused)) print("Network player animation protocol validation: PASS") quit() diff --git a/tests/on_screen_keyboard_validation.gd b/tests/on_screen_keyboard_validation.gd index 7a6e49a..a685c65 100644 --- a/tests/on_screen_keyboard_validation.gd +++ b/tests/on_screen_keyboard_validation.gd @@ -1,11 +1,44 @@ extends SceneTree const KeyboardType = preload("res://ui/on_screen_keyboard.gd") +const ControllerMappingManagerType = preload( + "res://settings/controller_mapping_manager.gd" +) const SettingsManagerType = preload( "res://settings/player_settings_manager.gd" ) +class ControllerInputProbe: + extends Node + + var pressed_buttons: Array[int] = [] + + + func _input(event: InputEvent) -> void: + var button := event as InputEventJoypadButton + if button != null and button.pressed: + pressed_buttons.append(button.button_index) + + +class NativeKeyboardProbe: + extends OnScreenKeyboard + var shown_controls: Array[Control] = [] + var hide_count: int = 0 + + + func _uses_native_virtual_keyboard() -> bool: + return true + + + func _show_native_keyboard_for(control: Control) -> void: + shown_controls.append(control) + + + func _hide_native_keyboard() -> void: + hide_count += 1 + + func _initialize() -> void: call_deferred("_run") @@ -13,6 +46,8 @@ func _initialize() -> void: func _run() -> void: _validate_default_and_persistence() await _validate_keyboard_entry() + await _validate_automapped_face_buttons() + await _validate_native_keyboard() print("On-screen keyboard validation: PASS") quit() @@ -20,19 +55,46 @@ func _run() -> void: func _validate_default_and_persistence() -> void: var defaults := PlayerSettings.new() assert(not defaults.on_screen_keyboard_enabled) - assert(KeyboardType.should_enable_for_controller(false, false)) - assert(not KeyboardType.should_enable_for_controller(false, true)) - assert(KeyboardType.should_enable_for_controller(true, true)) + assert(not defaults.swap_hotbar_camera_scroll) + assert( + KeyboardType.should_enable_for_controller(false, false, "Linux") + ) + assert( + KeyboardType.should_enable_for_controller(false, true, "Linux") + ) + assert( + not KeyboardType.should_enable_for_controller(false, true, "Android") + ) + assert( + KeyboardType.should_enable_for_controller(true, true, "Android") + ) + assert( + KeyboardType.should_use_native_virtual_keyboard( + false, true, "Android" + ) + ) + assert( + not KeyboardType.should_use_native_virtual_keyboard( + true, true, "Android" + ) + ) + assert( + not KeyboardType.should_use_native_virtual_keyboard( + false, true, "Linux" + ) + ) var manager := SettingsManagerType.new() root.add_child(manager) assert(manager.load_settings()) var edited: PlayerSettings = manager.current_settings.copy() edited.on_screen_keyboard_enabled = true + edited.swap_hotbar_camera_scroll = true assert(manager.apply_settings(edited)) var reloaded := SettingsManagerType.new() root.add_child(reloaded) assert(reloaded.load_settings()) assert(reloaded.current_settings.on_screen_keyboard_enabled) + assert(reloaded.current_settings.swap_hotbar_camera_scroll) manager.queue_free() reloaded.queue_free() @@ -41,18 +103,15 @@ func _validate_keyboard_entry() -> void: var host := Control.new() root.add_child(host) var edit := LineEdit.new() + edit.text = "seed" + edit.caret_column = 0 edit.focus_mode = Control.FOCUS_ALL host.add_child(edit) var keyboard := KeyboardType.new() host.add_child(keyboard) await process_frame keyboard.set_enabled(false) - assert( - keyboard.is_enabled() - == not DisplayServer.has_feature( - DisplayServer.FEATURE_VIRTUAL_KEYBOARD - ) - ) + assert(keyboard.is_enabled()) var activate_event := InputEventJoypadButton.new() activate_event.button_index = JOY_BUTTON_A activate_event.pressed = true @@ -66,25 +125,88 @@ func _validate_keyboard_entry() -> void: edit.grab_focus() keyboard.call("_input", activate_event) assert(keyboard.is_open()) + assert(edit.caret_column == edit.text.length()) + assert(keyboard.get("_buffer_caret") == edit.text.length()) + assert( + str( + (keyboard.get("_preview") as RichTextLabel).get_parsed_text() + ).begins_with("seed") + ) + var left_page_event := InputEventJoypadButton.new() + left_page_event.button_index = JOY_BUTTON_LEFT_SHOULDER + left_page_event.pressed = true + keyboard.call("_input", left_page_event) + assert(keyboard.is_open()) + assert(keyboard.get("_page") == KeyboardType.Page.SYMBOLS) + var right_page_event := InputEventJoypadButton.new() + right_page_event.button_index = JOY_BUTTON_RIGHT_SHOULDER + right_page_event.pressed = true + keyboard.call("_input", right_page_event) + assert(keyboard.is_open()) + assert(keyboard.get("_page") == KeyboardType.Page.LOWER) + for _frame: int in 2: + await process_frame + var focused_key := root.gui_get_focus_owner() as Button + assert(focused_key != null and focused_key.text == "q") + var second_key := keyboard.get("_key_buttons")[1] as Button + second_key.grab_focus() + var outside_button := Button.new() + host.add_child(outside_button) + outside_button.grab_focus() + assert(root.gui_get_focus_owner() == outside_button) + keyboard.call("_process", 0.0) + assert(root.gui_get_focus_owner() == second_key) + var conflicting_cancel_binding := InputEventJoypadButton.new() + conflicting_cancel_binding.button_index = JOY_BUTTON_A + InputMap.action_add_event(&"ui_cancel", conflicting_cancel_binding) + keyboard.call("_input", activate_event) + InputMap.action_erase_event(&"ui_cancel", conflicting_cancel_binding) + assert(keyboard.is_open()) + assert(edit.text == "seedw") + var left_trigger := InputEventJoypadMotion.new() + left_trigger.axis = JOY_AXIS_TRIGGER_LEFT + left_trigger.axis_value = 1.0 + keyboard.call("_input", left_trigger) + assert(keyboard.get("_buffer_caret") == edit.text.length() - 1) + var right_trigger := InputEventJoypadMotion.new() + right_trigger.axis = JOY_AXIS_TRIGGER_RIGHT + right_trigger.axis_value = 1.0 + keyboard.call("_input", right_trigger) + assert(keyboard.get("_buffer_caret") == edit.text.length()) + var preview := keyboard.get("_preview") as RichTextLabel + var preview_height_before_blink: float = preview.get_content_height() + var preview_text_before_blink: String = preview.get_parsed_text() + keyboard.call("_process", KeyboardType.CARET_BLINK_INTERVAL) + assert( + not bool(keyboard.get("_caret_visible")) + ) + assert(preview.get_parsed_text() == preview_text_before_blink) + assert(is_equal_approx(preview.get_content_height(), preview_height_before_blink)) keyboard.call("_type_character", "a") keyboard.call("_type_space") keyboard.call("_set_page", KeyboardType.Page.UPPER) keyboard.call("_type_character", "B") - assert(edit.text == "a B") + assert(edit.text == "seedwa B") keyboard.call("_move_caret", -1) keyboard.call("_type_character", "C") - assert(edit.text == "a CB") + assert(edit.text == "seedwa CB") + var input_probe := ControllerInputProbe.new() + root.add_child(input_probe) + root.move_child(input_probe, 0) var backspace_event := InputEventJoypadButton.new() backspace_event.button_index = JOY_BUTTON_X backspace_event.pressed = true - keyboard.call("_input", backspace_event) - assert(edit.text == "a B") - var defocus_event := InputEventJoypadButton.new() - defocus_event.button_index = JOY_BUTTON_LEFT_SHOULDER - defocus_event.pressed = true - keyboard.call("_input", defocus_event) + Input.parse_input_event(backspace_event) + await process_frame + assert(edit.text == "seedwa B") + assert(input_probe.pressed_buttons.is_empty()) + var close_event := InputEventJoypadButton.new() + close_event.button_index = JOY_BUTTON_B + close_event.pressed = true + keyboard.call("_input", close_event) assert(not keyboard.is_open()) - assert(root.gui_get_focus_owner() == null) + assert(root.gui_get_focus_owner() == edit) + input_probe.queue_free() edit.grab_focus() keyboard.call("_input", activate_event) assert(keyboard.is_open()) @@ -94,5 +216,145 @@ func _validate_keyboard_entry() -> void: ) keyboard.call("_submit") assert(not keyboard.is_open()) - assert(submitted == ["a B"]) + assert(submitted == ["seedwa B"]) + var letter_body := TextEdit.new() + letter_body.text = "letter" + letter_body.focus_mode = Control.FOCUS_ALL + host.add_child(letter_body) + letter_body.text_changed.connect(func() -> void: + outside_button.call_deferred("grab_focus") + ) + letter_body.grab_focus() + keyboard.call("_input", activate_event) + assert(keyboard.is_open()) + for _frame: int in 2: + await process_frame + var letter_key := keyboard.get("_key_buttons")[2] as Button + letter_key.grab_focus() + keyboard.call("_input", activate_event) + for _frame: int in 2: + await process_frame + assert(letter_body.text == "lettere") + assert(root.gui_get_focus_owner() == letter_key) + keyboard.call("_input", close_event) + assert(not keyboard.is_open()) + host.queue_free() + + +func _validate_automapped_face_buttons() -> void: + var manager := ControllerMappingManagerType.new() + root.add_child(manager) + await process_frame + var swapped_bindings: Dictionary = ( + ControllerMappingManagerType.default_bindings() + ) + swapped_bindings[str(ControllerMappingManagerType.ROLE_A)] = { + "kind": "button", + "button": int(JOY_BUTTON_B), + } + swapped_bindings[str(ControllerMappingManagerType.ROLE_B)] = { + "kind": "button", + "button": int(JOY_BUTTON_A), + } + manager._active_profile_key = "keyboard-mapping-test" + manager._profiles[manager._active_profile_key] = { + "controller_name": "keyboard mapping test", + "bindings": swapped_bindings, + } + var host := Control.new() + root.add_child(host) + var edit := LineEdit.new() + edit.focus_mode = Control.FOCUS_ALL + host.add_child(edit) + var keyboard := KeyboardType.new() + host.add_child(keyboard) + keyboard.setup_controller_mapping(manager) + keyboard.set_enabled(true) + await process_frame + var mapped_accept := InputEventJoypadButton.new() + mapped_accept.device = manager.get_active_device_id() + mapped_accept.button_index = JOY_BUTTON_B + mapped_accept.pressed = true + edit.grab_focus() + keyboard.call("_input", mapped_accept) + assert(keyboard.is_open()) + for _frame: int in 2: + await process_frame + keyboard.call("_input", mapped_accept) + assert(keyboard.is_open()) + assert(edit.text == "q") + var mapped_cancel := InputEventJoypadButton.new() + mapped_cancel.device = manager.get_active_device_id() + mapped_cancel.button_index = JOY_BUTTON_A + mapped_cancel.pressed = true + keyboard.call("_input", mapped_cancel) + assert(not keyboard.is_open()) + host.queue_free() + manager.queue_free() + + +func _validate_native_keyboard() -> void: + var host := Control.new() + root.add_child(host) + var edit := LineEdit.new() + edit.focus_mode = Control.FOCUS_ALL + edit.virtual_keyboard_enabled = true + host.add_child(edit) + var outside_button := Button.new() + host.add_child(outside_button) + var keyboard := NativeKeyboardProbe.new() + host.add_child(keyboard) + await process_frame + edit.grab_focus() + assert(keyboard.is_open()) + var focus_exit_count: int = 0 + edit.focus_exited.connect(func() -> void: + focus_exit_count += 1 + ) + assert(keyboard.request_for_control(edit)) + assert(edit.has_focus()) + assert(focus_exit_count == 0) + assert(not edit.virtual_keyboard_enabled) + assert(not edit.virtual_keyboard_show_on_focus) + assert(keyboard.shown_controls == [edit]) + var character_event := InputEventKey.new() + character_event.keycode = KEY_A + character_event.unicode = 97 + character_event.pressed = true + Input.parse_input_event(character_event) + await process_frame + assert(edit.has_focus()) + assert(edit.text == "a") + outside_button.grab_focus() + await process_frame + assert(outside_button.has_focus()) + assert(keyboard.is_open()) + var backspace_event := InputEventKey.new() + backspace_event.keycode = KEY_BACKSPACE + backspace_event.pressed = true + Input.parse_input_event(backspace_event) + await process_frame + assert(edit.has_focus()) + assert(edit.text.is_empty()) + var close_event := InputEventJoypadButton.new() + close_event.button_index = JOY_BUTTON_B + close_event.pressed = true + keyboard.call("_input", close_event) + assert(not edit.has_focus()) + assert(not keyboard.is_open()) + assert(edit.virtual_keyboard_enabled) + assert(edit.virtual_keyboard_show_on_focus) + assert(keyboard.hide_count == 1) + assert(keyboard.request_for_control(edit)) + await process_frame + assert(edit.has_focus()) + assert(keyboard.is_open()) + assert(keyboard.shown_controls == [edit, edit]) + var escape_event := InputEventKey.new() + escape_event.keycode = KEY_ESCAPE + escape_event.pressed = true + keyboard.call("_input", escape_event) + assert(not edit.has_focus()) + assert(not keyboard.is_open()) + assert(keyboard.hide_count == 2) host.queue_free() diff --git a/tests/operator_multiplayer_validation.gd b/tests/operator_multiplayer_validation.gd index 3712fd4..05f8ee9 100644 --- a/tests/operator_multiplayer_validation.gd +++ b/tests/operator_multiplayer_validation.gd @@ -36,6 +36,10 @@ func _run_host() -> void: as NetworkPlayerListService ) var bans := main.get_node("%HostBanStore") as HostBanStore + assert(bool(main.call( + "_apply_world", WorldLayout.STARTER_ISLAND, 1, true + ))) + assert(session.set_host_world(WorldLayout.STARTER_ISLAND, 1)) assert(session.start_private_host(TEST_PORT)) assert(session.set_host_open(true)) @@ -65,6 +69,7 @@ func _run_host() -> void: assert(players_page != null) players_page.call("_refresh") assert(_has_button_text(players_page, "deop")) + assert(_has_button_tooltip(players_page, "scrub art")) var unban_deadline: int = Time.get_ticks_msec() + 12000 while ( @@ -148,9 +153,9 @@ func _run_client() -> void: assert(players_page != null) players_page.call("_refresh") var tabs := players_page.get("_tabs") as HBoxContainer - assert((tabs.get_child(2) as Button).visible) - players_page.call("_select_tab", 2) - assert(int(players_page.get("_current_tab")) == 2) + assert((tabs.get_child(3) as Button).visible) + players_page.call("_select_tab", 3) + assert(int(players_page.get("_current_tab")) == 3) var local_entry: PlayerListEntry = _entry_for_peer( service, session.get_local_peer_id() ) @@ -175,7 +180,7 @@ func _run_client() -> void: await process_frame assert(not session.is_local_operator()) assert(not service.is_local_moderator()) - assert(not (tabs.get_child(2) as Button).visible) + assert(not (tabs.get_child(3) as Button).visible) assert(int(players_page.get("_current_tab")) == 0) service.request_unban.rpc_id(1, SECOND_BANNED_FINGERPRINT) var disconnect_deadline: int = Time.get_ticks_msec() + 10000 @@ -251,3 +256,11 @@ func _has_button_text(root_node: Node, text: String) -> bool: if button != null and button.text == text: return true return false + + +func _has_button_tooltip(root_node: Node, tooltip: String) -> bool: + for node: Node in root_node.find_children("*", "Button", true, false): + var button := node as Button + if button != null and button.tooltip_text == tooltip: + return true + return false diff --git a/tests/player_experience_validation.gd b/tests/player_experience_validation.gd index c9b36cd..a76a3dd 100644 --- a/tests/player_experience_validation.gd +++ b/tests/player_experience_validation.gd @@ -143,14 +143,21 @@ func _validate_save_migration() -> void: version_five, 5, ) - assert(int(migrated.get("save_version", -1)) == 7) + assert(int(migrated.get("save_version", -1)) == 11) var experience_data: Dictionary = migrated.get("experience", {}) assert(int(experience_data.get("total_experience", -1)) == 0) var world_data: Dictionary = migrated.get("world", {}) assert(is_equal_approx(float(world_data.get("time_hours", -1.0)), 8.0)) + assert( + int(world_data.get("seed", 0)) + == PlayerSaveManager.DEFAULT_WORLD_SEED + ) assert( PlayerJobService.validate_save_data(migrated.get("jobs", {})) ) + assert(not PlayerHomeState.sanitize_save_data( + migrated.get("home", {}) + ).is_empty()) manager.queue_free() diff --git a/tests/player_gathering_animation_validation.gd b/tests/player_gathering_animation_validation.gd new file mode 100644 index 0000000..42f97ca --- /dev/null +++ b/tests/player_gathering_animation_validation.gd @@ -0,0 +1,140 @@ +extends SceneTree + + +const PlayerScene: PackedScene = preload("res://player/player.tscn") +const CrabBrown: FishData = preload( + "res://fish/species/crab_brown/crab_brown.tres" +) +const ClamManila: FishData = preload( + "res://fish/species/clam_manila/clam_manila.tres" +) +const BeetleStagCommon: FishData = preload( + "res://fish/species/beetle_stag_common/beetle_stag_common.tres" +) + + +func _initialize() -> void: + call_deferred("_run") + + +func _run() -> void: + var player := PlayerScene.instantiate() as Player + root.add_child(player) + await process_frame + assert(is_equal_approx( + Player.get_catch_texture_resolution_scale(CrabBrown.display_texture), + 20.0, + )) + assert(is_equal_approx( + Player.get_catch_texture_resolution_scale(ClamManila.display_texture), + 20.0, + )) + assert(is_equal_approx( + Player.get_catch_texture_resolution_scale(BeetleStagCommon.display_texture), + 20.0, + )) + player.set_process(false) + player.set_physics_process(false) + var animation_player := player.get_node( + "Visuals/CharacterRig/AnimationPlayer" + ) as AnimationPlayer + assert(animation_player != null) + for required_animation: StringName in [ + &"draw", + &"idle_sneak", + &"sneaking", + &"strike", + ]: + assert(animation_player.has_animation(required_animation)) + + Input.action_press(&"sneak") + player.velocity = Vector3.ZERO + player.call("_update_character_animation") + assert(animation_player.current_animation == &"idle_sneak") + + player.velocity = Vector3(player.sneak_speed, 0.0, 0.0) + player.call("_update_character_animation") + assert(animation_player.current_animation == &"sneaking") + + player.velocity = Vector3.ZERO + assert(player.begin_net_draw_visual()) + assert(animation_player.current_animation == &"draw") + player.call("_on_character_animation_finished", &"draw") + assert(StringName(player.get("_animation_action_id")) == &"draw") + assert(animation_player.current_animation == &"draw") + + assert(player.play_net_strike_visual()) + assert(animation_player.current_animation == &"strike") + player.call("_on_character_animation_finished", &"strike") + assert(StringName(player.get("_animation_action_id")) == &"strike") + assert(bool(player.get("_animation_action_paused"))) + assert(player.is_net_strike_held()) + assert(player.release_net_strike_hold()) + assert(StringName(player.get("_animation_action_id")).is_empty()) + assert(animation_player.current_animation == &"idle_sneak") + + Input.action_release(&"sneak") + assert(player.begin_net_draw_visual()) + assert(animation_player.current_animation == &"casting") + player.cancel_net_action_visual() + assert(StringName(player.get("_animation_action_id")).is_empty()) + assert(animation_player.current_animation == &"idle") + Input.action_press(&"sneak") + var visuals := player.get_node("Visuals") as Node3D + + assert(player.play_net_strike_visual()) + player.resolve_net_strike_visual(true) + player.net_success_contact_pause_duration = 0.05 + player.showcase_turn_duration = 0.05 + player.showcase_camera_transition_duration = 0.05 + player.net_showcase_camera_yaw_offset = 0.0 + var crab_catch := FishCatch.new() + crab_catch.fish = CrabBrown + crab_catch.fish_id = CrabBrown.id + crab_catch.weight_lb = CrabBrown.get_minimum_weight() + crab_catch.display_scale = CrabBrown.get_display_scale_for_weight( + crab_catch.weight_lb + ) + crab_catch.sale_value = CrabBrown.get_sale_value_for_weight( + crab_catch.weight_lb + ) + crab_catch.ensure_identity() + player.begin_catch_showcase(crab_catch) + assert(not bool(player.get("_showcase_animation_active"))) + assert(player.get("_pending_net_showcase_catch") == crab_catch) + player.call("_on_character_animation_finished", &"strike") + assert(StringName(player.get("_animation_action_id")) == &"strike") + assert(bool(player.get("_animation_action_paused"))) + assert(not bool(player.get("_showcase_animation_active"))) + var contact_pause := player.get("_net_strike_showcase_pause_tween") as Tween + assert(contact_pause != null and contact_pause.is_valid()) + await contact_pause.finished + assert(StringName(player.get("_animation_action_id")).is_empty()) + assert(bool(player.get("_showcase_animation_active"))) + var stored_showcase_rotation: Vector3 = player.get( + "_showcase_visual_rotation" + ) + await create_timer(0.1).timeout + assert( + absf(wrapf( + visuals.rotation.y - stored_showcase_rotation.y, + -PI, + PI, + )) > 3.0 + ) + var catch_display := player.get("_catch_display") as Node3D + assert(catch_display != null and catch_display.visible) + player.end_catch_showcase(Callable(), true, true) + assert( + absf(wrapf( + visuals.rotation.y - stored_showcase_rotation.y, + -PI, + PI, + )) < 0.01 + ) + + Input.action_release(&"sneak") + player.queue_free() + await process_frame + print("Player gathering animation validation: PASS") + quit() diff --git a/tests/player_gathering_animation_validation.gd.uid b/tests/player_gathering_animation_validation.gd.uid new file mode 100644 index 0000000..276cd27 --- /dev/null +++ b/tests/player_gathering_animation_validation.gd.uid @@ -0,0 +1 @@ +uid://cba1j1dfxk5t4 diff --git a/tests/profile_multiplayer_validation.gd b/tests/profile_multiplayer_validation.gd index bc969e2..4d2bd70 100644 --- a/tests/profile_multiplayer_validation.gd +++ b/tests/profile_multiplayer_validation.gd @@ -1,7 +1,10 @@ extends SceneTree const MainScene: PackedScene = preload("res://main/main.tscn") +const AnimaleseVoiceType = preload("res://ui/animalese_voice.gd") const TEST_PORT: int = 18144 +const HOST_HISTORY_MESSAGE: String = "silent history replay" +const HOST_VOICE_MESSAGE: String = "remote voice playback" func _initialize() -> void: @@ -9,6 +12,7 @@ func _initialize() -> void: func _run() -> void: + _validate_voice_distance_attenuation() var arguments: PackedStringArray = OS.get_cmdline_user_args() if arguments.has("host"): await _run_host() @@ -20,16 +24,67 @@ func _run() -> void: quit(1) +func _validate_voice_distance_attenuation() -> void: + assert(is_zero_approx( + ChatUI.animalese_volume_offset_db_for_distance(0.0) + )) + assert(is_zero_approx( + ChatUI.animalese_volume_offset_db_for_distance(4.0) + )) + var middle_distance_volume := ( + ChatUI.animalese_volume_offset_db_for_distance(14.0) + ) + assert(middle_distance_volume < 0.0) + assert(middle_distance_volume > -80.0) + assert(is_equal_approx( + ChatUI.animalese_volume_offset_db_for_distance(24.0), + -80.0, + )) + + func _run_host() -> void: var main: Node = await _create_initialized_main() var session := main.get_node("%NetworkSession") as NetworkSession + var profile := main.get_node( + "%NetworkProfilePreferences" + ) as NetworkProfilePreferences + assert(profile.set_profile_identity( + profile.display_name, + "deep", + profile.speech_speed_id, + profile.call_id, + "kim", + )) var save_manager := main.get("_save_manager") as PlayerSaveManager + assert(bool(main.call( + "_apply_world", WorldLayout.STARTER_ISLAND, 1, true + ))) + assert(session.set_host_world(WorldLayout.STARTER_ISLAND, 1)) assert(session.start_private_host(TEST_PORT)) + var local_avatar := main.get_node("%PlayerSpawnService").get_avatar( + 1 + ) as Player + assert(local_avatar != null) + assert(local_avatar.get_animalese_voice_id() == "deep") + assert(local_avatar.get_animalese_sample_set_id() == "kim") assert(save_manager.initialize_new_game()) main.call("_enter_gameplay") for _frame: int in 4: await physics_frame assert(session.set_host_open(true)) + var chat_service := main.get_node( + "%NetworkChatService" + ) as NetworkChatService + assert(chat_service.send_local_message( + HOST_HISTORY_MESSAGE, + profile.voice_id, + profile.sample_set_id, + )) + var voice_messages: Array[Dictionary] = [] + chat_service.message_received.connect(func(message: Dictionary) -> void: + if str(message.get("body", "")) == "voice profile sync": + voice_messages.append(message) + ) var remote_peer_id: int = await _wait_for_remote_peer(session) assert(remote_peer_id > 1) var record := session.get_peer_record(remote_peer_id) @@ -50,6 +105,20 @@ func _run_host() -> void: assert(avatar != null) assert(avatar.appearance_snapshot == changed) assert(record.display_name != "NetworkProfileService") + assert(chat_service.send_local_message( + HOST_VOICE_MESSAGE, + profile.voice_id, + profile.sample_set_id, + )) + var voice_message_deadline: int = Time.get_ticks_msec() + 8000 + while ( + Time.get_ticks_msec() < voice_message_deadline + and voice_messages.is_empty() + ): + await process_frame + assert(not voice_messages.is_empty()) + assert(str(voice_messages[0].get("voice_id", "")) == "deep") + assert(str(voice_messages[0].get("sample_set_id", "")) == "kim") var disconnect_deadline: int = Time.get_ticks_msec() + 8000 while ( Time.get_ticks_msec() < disconnect_deadline @@ -63,6 +132,14 @@ func _run_host() -> void: func _run_client() -> void: var main: Node = await _create_initialized_main() + var chat_ui := main.get_node("%GameUI").get_node("%ChatUI") as ChatUI + var animalese := chat_ui.get("_animalese_voice") as AnimaleseVoiceType + assert(animalese != null) + var remote_voice_samples: Array[String] = [] + animalese.character_sample_played.connect( + func(sample_set_id: String, _character: String) -> void: + remote_voice_samples.append(sample_set_id) + ) main.call("_on_title_join_game_requested", "127.0.0.1:%d" % TEST_PORT) var session := main.get_node("%NetworkSession") as NetworkSession var join_deadline: int = Time.get_ticks_msec() + 20000 @@ -76,6 +153,17 @@ func _run_client() -> void: assert(session.supports_server_capability( NetworkProtocol.APPEARANCE_PREVIEW_CAPABILITY )) + var chat_service := main.get_node( + "%NetworkChatService" + ) as NetworkChatService + # Player-hosted rooms deliberately send no prior scrollback to joining or + # reconnecting clients. Live messages sent after authentication still work. + await create_timer(0.5).timeout + assert(not chat_service.get_history().any( + func(message: Dictionary) -> bool: + return str(message.get("body", "")) == HOST_HISTORY_MESSAGE + )) + assert(remote_voice_samples.is_empty()) var service := main.get_node( "%NetworkProfileService" ) as NetworkProfileService @@ -95,9 +183,10 @@ func _run_client() -> void: service.get_persisted_name(), changed, true, - service.get_persisted_voice_id(), + "deep", service.get_persisted_speech_speed_id(), service.get_persisted_call_id(), + "kim", )) var apply_deadline: int = Time.get_ticks_msec() + 8000 while Time.get_ticks_msec() < apply_deadline and apply_results.is_empty(): @@ -105,8 +194,55 @@ func _run_client() -> void: assert(not apply_results.is_empty()) assert(bool(apply_results[0][0])) assert(service.get_persisted_appearance() == changed) + assert(service.get_persisted_voice_id() == "deep") + assert(service.get_persisted_sample_set_id() == "kim") assert(Dictionary(session.get("_local_appearance_snapshot")) == changed) - await create_timer(0.75).timeout + var player := main.get_node("%PlayerSpawnService").get_local_player() as Player + assert(player.get_animalese_voice_id() == "deep") + assert(player.get_animalese_sample_set_id() == "kim") + var host_voice_messages: Array[Dictionary] = [] + for message: Dictionary in chat_service.get_history(): + if str(message.get("body", "")) == HOST_VOICE_MESSAGE: + host_voice_messages.append(message) + var host_voice_deadline: int = Time.get_ticks_msec() + 8000 + while ( + Time.get_ticks_msec() < host_voice_deadline + and ( + host_voice_messages.is_empty() + or remote_voice_samples.is_empty() + ) + ): + await process_frame + for message: Dictionary in chat_service.get_history(): + if ( + str(message.get("body", "")) == HOST_VOICE_MESSAGE + and message not in host_voice_messages + ): + host_voice_messages.append(message) + assert(not host_voice_messages.is_empty()) + assert(str(host_voice_messages[0].get("voice_id", "")) == "deep") + assert(str(host_voice_messages[0].get("sample_set_id", "")) == "kim") + assert(remote_voice_samples.has("kim")) + var local_confirmations: Array[Dictionary] = [] + chat_service.local_message_confirmed.connect( + func(message: Dictionary) -> void: + if str(message.get("body", "")) == "voice profile sync": + local_confirmations.append(message) + ) + assert(chat_service.send_local_message( + "voice profile sync", + service.get_persisted_voice_id(), + service.get_persisted_sample_set_id(), + )) + var confirmation_deadline: int = Time.get_ticks_msec() + 8000 + while ( + Time.get_ticks_msec() < confirmation_deadline + and local_confirmations.is_empty() + ): + await process_frame + assert(not local_confirmations.is_empty()) + assert(str(local_confirmations[0].get("voice_id", "")) == "deep") + assert(str(local_confirmations[0].get("sample_set_id", "")) == "kim") print("Profile multiplayer client validation: PASS") await _session_cleanup(main, session) diff --git a/tests/progression_archive_validation.gd b/tests/progression_archive_validation.gd new file mode 100644 index 0000000..30f0df6 --- /dev/null +++ b/tests/progression_archive_validation.gd @@ -0,0 +1,377 @@ +extends SceneTree + +const MainScene: PackedScene = preload("res://main/main.tscn") + + +func _initialize() -> void: + call_deferred("_run") + + +func _run() -> void: + root.size = Vector2i(1280, 720) + var main: Node = MainScene.instantiate() + root.add_child(main) + for _frame: int in 4: + await process_frame + if not bool(main.get("_application_initialized")): + main.call("_activate_selected_data_path", "", true) + for _frame: int in 8: + await process_frame + assert(bool(main.get("_application_initialized"))) + + var save_manager := main.get("_save_manager") as PlayerSaveManager + var player := main.get("_player") as Player + var data_root := main.get("_data_root") as PlayerDataRoot + var home_state := main.get("_home_state") as PlayerHomeState + assert( + save_manager != null + and player != null + and data_root != null + and home_state != null + ) + assert(save_manager.initialize_new_game(864209)) + save_manager.set_autosave_enabled(true) + assert(player.wallet.restore_balance(4321)) + assert(player.bag.add_item(&"coffee")) + assert(home_state.add_owned_decor(&"basic_cube")) + assert(not home_state.place_decor( + &"basic_cube", + Vector3.ZERO, + 0.0, + PlayerHomeState.PlacementMode.GRID, + ).is_empty()) + assert(save_manager.save_now()) + + var save_path: String = str(save_manager.get("_save_path")) + assert(save_path.ends_with("player/player_save.nfsave")) + assert(FileAccess.file_exists(save_path)) + assert(not FileAccess.file_exists(save_path.get_base_dir().path_join( + "player_save.json" + ))) + _assert_opaque(save_path) + var decoded: Dictionary = ProgressionSaveCodec.read_local_save(save_path) + assert(bool(decoded.get("ok", false))) + assert(int((decoded["data"] as Dictionary)["save_version"]) == 11) + assert(not PlayerHomeState.sanitize_save_data( + (decoded["data"] as Dictionary).get("home", {}) + ).is_empty()) + assert( + ((decoded["data"] as Dictionary)["home"] as Dictionary) + .get("placements", []).size() == 1 + ) + var legacy_container_path: String = data_root.progression_backup_directory().path_join( + "netfishing-container.nfsave" + ) + _assert_legacy_progression_container( + legacy_container_path, + decoded["data"] as Dictionary, + ) + _assert_legacy_data_manifest(data_root.root_path.get_base_dir()) + _assert_legacy_identity_backup(main, data_root) + + var archive_path: String = data_root.progression_backup_directory().path_join( + "progression-test.nfsave" + ) + var exported: Dictionary = save_manager.export_progression_archive( + archive_path + ) + assert(bool(exported.get("ok", false))) + assert(FileAccess.file_exists(archive_path)) + _assert_opaque(archive_path) + var inspected: Dictionary = save_manager.inspect_progression_archive( + archive_path + ) + assert(bool(inspected.get("ok", false))) + assert(int(inspected.get("wallet_balance", -1)) == 4321) + assert(int(inspected.get("world_seed", -1)) == 864209) + + assert(player.wallet.restore_balance(7)) + assert(save_manager.save_now()) + var imported: Dictionary = save_manager.import_progression_archive( + archive_path + ) + assert(bool(imported.get("ok", false))) + assert(save_manager.load_player_data()) + assert(player.wallet.get_balance() == 4321) + assert(save_manager.get_world_seed() == 864209) + assert(home_state.get_owned_count(&"basic_cube") == 1) + assert(home_state.get_placed_count(&"basic_cube") == 1) + + var legacy_data: Dictionary = ( + ProgressionSaveCodec.read_local_save(save_path)["data"] + ) + assert(save_manager.delete_progression_save()) + var legacy_path: String = save_path.get_base_dir().path_join( + "player_save.json" + ) + var legacy_file := FileAccess.open(legacy_path, FileAccess.WRITE) + assert(legacy_file != null) + legacy_file.store_string(JSON.stringify(legacy_data, "\t")) + legacy_file.close() + assert(save_manager.load_player_data()) + assert(FileAccess.file_exists(save_path)) + assert(not FileAccess.file_exists(legacy_path)) + _assert_opaque(save_path) + + save_manager.set_autosave_enabled(false) + var save_slots := main.get("_save_slots") as PlayerSaveSlotCatalog + assert(save_slots != null) + assert(save_slots.configure(data_root, save_manager)) + var adopted_slots: Array[Dictionary] = save_slots.list_slots() + assert(adopted_slots.size() == 1) + var adopted_slot_id: String = str(adopted_slots.front().get("slot_id", "")) + assert(bool(adopted_slots.front().get("legacy", false))) + assert(bool(adopted_slots.front().get("has_save", false))) + + var duplicated: Dictionary = save_slots.duplicate_slot( + adopted_slot_id, + "another island", + WorldLayout.GENERATED, + 97531, + ) + assert(bool(duplicated.get("ok", false))) + var duplicated_slot_id: String = str(duplicated.get("slot_id", "")) + var duplicate_summary: Dictionary = save_slots.get_slot(duplicated_slot_id) + assert(int(duplicate_summary.get("wallet_balance", -1)) == 4321) + assert(int(duplicate_summary.get("world_seed", -1)) == 97531) + assert(save_slots.activate_slot(duplicated_slot_id)) + assert(save_manager.load_player_data()) + assert(player.wallet.get_balance() == 4321) + assert(save_manager.get_world_seed() == 97531) + assert(save_slots.rename_slot(duplicated_slot_id, "renamed island")) + + var slot_archive: String = data_root.progression_backup_directory().path_join( + "save-slot-export.nfsave" + ) + assert(bool(save_slots.export_slot( + duplicated_slot_id, + slot_archive, + ).get("ok", false))) + var imported_slot: Dictionary = save_slots.import_slot( + slot_archive, + "imported island", + ) + assert(bool(imported_slot.get("ok", false))) + var imported_slot_id: String = str(imported_slot.get("slot_id", "")) + assert(not save_slots.get_slot(imported_slot_id).is_empty()) + assert(save_slots.delete_slot(duplicated_slot_id)) + assert(save_slots.get_slot(duplicated_slot_id).is_empty()) + assert(save_slots.list_slots().size() == 2) + + var settings_panels: Array[Node] = main.find_children( + "*", "SettingsPanel", true, false + ) + assert(settings_panels.size() == 2) + for settings_panel: SettingsPanel in settings_panels: + assert(settings_panel.get_node_or_null("%ExportProgression") == null) + assert(settings_panel.get_node_or_null("%ImportProgression") == null) + var settings_panel: SettingsPanel = settings_panels.front() as SettingsPanel + settings_panel.set( + "_presentation_mode", SettingsPanel.PresentationMode.TITLE_EMBEDDED + ) + var unchanged_root: String = data_root.root_path + settings_panel.call("_choose_data_folder") + var data_folder_dialog := ( + settings_panel.get("_data_folder_dialog") as FileDialog + ) + assert(data_folder_dialog != null) + assert(data_folder_dialog.current_dir == unchanged_root) + data_folder_dialog.hide() + settings_panel.call("_change_data_folder", unchanged_root + "/") + await process_frame + assert(data_root.root_path == unchanged_root) + assert( + (settings_panel.get_node("%SettingsFeedback") as Label).text + == "this data folder is already active." + ) + var save_slots_page := main.find_child( + "SaveSlotsPage", true, false + ) as SaveSlotsPage + assert(save_slots_page != null) + assert(save_slots_page.get_node("%ExportSlotButton") is Button) + assert(save_slots_page.get_node("%ImportSlotButton") is Button) + + var unchanged_migration: Dictionary = ( + PortableDataMigration.migrate_active_to( + data_root, unchanged_root + "/" + ) + ) + assert(bool(unchanged_migration.get("ok", false))) + assert(not bool(unchanged_migration.get("changed", true))) + assert(data_root.root_path == unchanged_root) + + var migrated_root: String = data_root.root_path.get_base_dir().path_join( + "progression-migrated-data" + ) + settings_panel.call("_change_data_folder", migrated_root) + for _frame: int in 4: + await process_frame + assert(data_root.root_path == migrated_root) + assert( + (settings_panel.get_node("%SettingsFeedback") as Label).text + == "data folder changed." + ) + var migrated_save: String = migrated_root.path_join( + "player/player_save.nfsave" + ) + assert(FileAccess.file_exists(migrated_save)) + assert(bool( + ProgressionSaveCodec.read_local_save(migrated_save).get("ok", false) + )) + assert(FileAccess.file_exists(migrated_root.path_join( + "player/save_slots.json" + ))) + var migrated_imported_slot: String = migrated_root.path_join( + "player/saves/%s.nfsave" % imported_slot_id + ) + assert(FileAccess.file_exists(migrated_imported_slot)) + assert(bool( + ProgressionSaveCodec.read_local_save(migrated_imported_slot).get( + "ok", false + ) + )) + var live_slots: Array[Dictionary] = save_slots.list_slots() + assert(live_slots.size() == 2) + var live_created: Dictionary = save_slots.create_empty_slot( + "live root switch" + ) + assert(bool(live_created.get("ok", false))) + var live_slot_id: String = str(live_created.get("slot_id", "")) + assert(save_slots.rename_slot(live_slot_id, "live root ready")) + assert( + str(save_slots.get_slot(live_slot_id).get("display_name", "")) + == "live root ready" + ) + + main.queue_free() + for _frame: int in 4: + await process_frame + await create_timer(0.1).timeout + print("Progression archive validation: PASS") + quit() + + +func _assert_legacy_progression_container( + path: String, + payload: Dictionary, +) -> void: + var payload_json: String = JSON.stringify(payload) + var envelope: Dictionary = { + "magic": ProgressionSaveCodec.LEGACY_MAGIC, + "format_version": ProgressionSaveCodec.FORMAT_VERSION, + "kind": ProgressionSaveCodec.LOCAL_KIND, + "game_version": "0.18.1-alpha", + "created_at_unix": 1, + "payload_sha256": PortableFileGuard.hash_bytes( + payload_json.to_utf8_buffer() + ), + "payload_json": payload_json, + } + var file: FileAccess = FileAccess.open_encrypted_with_pass( + path, + FileAccess.WRITE, + ProgressionSaveCodec.CONTAINER_PASSPHRASE, + ) + assert(file != null) + file.store_string(JSON.stringify(envelope)) + file.close() + var decoded: Dictionary = ProgressionSaveCodec.read_local_save(path) + assert(bool(decoded.get("ok", false))) + assert(bool(decoded.get("legacy_container", false))) + + +func _assert_legacy_data_manifest(parent: String) -> void: + var legacy_root: String = parent.path_join("netfishing-manifest-root") + assert(DirAccess.make_dir_recursive_absolute(legacy_root) == OK) + var legacy_id: String = "0123456789abcdef0123456789abcdef" + var legacy_manifest: Dictionary = { + "format_version": PlayerDataRoot.MANIFEST_VERSION, + "layout_version": PlayerDataRoot.LAYOUT_VERSION, + "application": PlayerDataRoot.LEGACY_APPLICATION_ID, + "root_id": legacy_id, + "created_at_unix": 1, + "last_opened_at_unix": 1, + } + var legacy_path: String = legacy_root.path_join( + PlayerDataRoot.LEGACY_MANIFEST_FILENAME + ) + var file := FileAccess.open(legacy_path, FileAccess.WRITE) + assert(file != null) + file.store_string(JSON.stringify(legacy_manifest, "\t")) + file.close() + var legacy_data_root := PlayerDataRoot.new() + root.add_child(legacy_data_root) + assert(legacy_data_root.use_existing_root(legacy_root)) + assert(legacy_data_root.root_id == legacy_id) + assert(FileAccess.file_exists(legacy_path)) + var canonical_path: String = legacy_root.path_join( + PlayerDataRoot.MANIFEST_FILENAME + ) + assert(FileAccess.file_exists(canonical_path)) + var parser := JSON.new() + assert(parser.parse(FileAccess.get_file_as_string(canonical_path)) == OK) + assert((parser.data as Dictionary).get("application") == PlayerDataRoot.APPLICATION_ID) + legacy_data_root.queue_free() + + +func _assert_legacy_identity_backup(main: Node, data_root: PlayerDataRoot) -> void: + var player_identity := main.get("_player_identity") as PlayerIdentityStore + var identity_backups := main.get("_identity_backups") as IdentityBackupService + assert(player_identity != null and player_identity.is_ready()) + assert(identity_backups != null) + var material: Dictionary = player_identity.export_identity_material() + var fingerprint: String = str(material.get("fingerprint", "")) + var private_key := CryptoKey.new() + assert(private_key.load_from_string(str(material.get("private_pem", ""))) == OK) + var canonical: PackedByteArray = NetworkIdentityCrypto.canonical_bytes_for_prefix( + NetworkIdentityCrypto.LEGACY_DOMAIN_PREFIX, + "identity_backup_self_test", + ["player", fingerprint], + ) + var context := HashingContext.new() + assert(context.start(HashingContext.HASH_SHA256) == OK) + context.update(canonical) + var signature: PackedByteArray = Crypto.new().sign( + HashingContext.HASH_SHA256, + context.finish(), + private_key, + ) + var envelope: Dictionary = { + "magic": IdentityBackupService.LEGACY_MAGIC, + "format_version": IdentityBackupService.FORMAT_VERSION, + "identity_type": "player", + "algorithm": NetworkIdentityCrypto.ALGORITHM, + "private_pem": material.get("private_pem", ""), + "public_pem": material.get("public_pem", ""), + "fingerprint": fingerprint, + "created_at_unix": 1, + "source_device_id": data_root.device_id, + "self_signature": Marshalls.raw_to_base64(signature), + } + var backup_path: String = data_root.identity_backup_directory().path_join( + "netfishing-player.nfidentity" + ) + var passphrase := "legacy-test-passphrase" + var file: FileAccess = FileAccess.open_encrypted_with_pass( + backup_path, + FileAccess.WRITE, + passphrase, + ) + assert(file != null) + file.store_string(JSON.stringify(envelope)) + file.close() + var inspected: Dictionary = identity_backups.inspect_backup( + backup_path, + passphrase, + "player", + ) + assert(bool(inspected.get("ok", false))) + assert(str(inspected.get("fingerprint", "")) == fingerprint) + + +func _assert_opaque(path: String) -> void: + var bytes: PackedByteArray = PortableFileGuard.read_bytes(path) + assert(not bytes.is_empty()) + var encoded_hex: String = bytes.hex_encode() + assert("save_version".to_utf8_buffer().hex_encode() not in encoded_hex) + assert("wallet".to_utf8_buffer().hex_encode() not in encoded_hex) diff --git a/tests/progression_archive_validation.gd.uid b/tests/progression_archive_validation.gd.uid new file mode 100644 index 0000000..59699fd --- /dev/null +++ b/tests/progression_archive_validation.gd.uid @@ -0,0 +1 @@ +uid://ccl47ftc1cu5l diff --git a/tests/session_switch_multiplayer_validation.gd b/tests/session_switch_multiplayer_validation.gd index 68cfcc7..86c9a84 100644 --- a/tests/session_switch_multiplayer_validation.gd +++ b/tests/session_switch_multiplayer_validation.gd @@ -31,6 +31,10 @@ func _run() -> void: func _run_host(port: int, label: String) -> void: var main: Node = await _create_initialized_main() var session := main.get_node("%NetworkSession") as NetworkSession + assert(bool(main.call( + "_apply_world", WorldLayout.STARTER_ISLAND, 1, true + ))) + assert(session.set_host_world(WorldLayout.STARTER_ISLAND, 1)) assert(session.start_dedicated_host(port, 8, "127.0.0.1")) assert(session.set_host_open(true)) var remote_peer_id: int = await _wait_for_remote_peer(session) diff --git a/tests/shoreline_ambience_validation.gd b/tests/shoreline_ambience_validation.gd index 4297d72..78829f1 100644 --- a/tests/shoreline_ambience_validation.gd +++ b/tests/shoreline_ambience_validation.gd @@ -35,6 +35,8 @@ func _run() -> void: root.add_child(controller) await process_frame assert(runtime_audio.bus == &"Environment") + assert(runtime_audio.stream == null) + controller.set_audio_enabled(true) assert(controller.near_distance < controller.far_distance) assert(controller.near_volume_db > controller.far_volume_db) var runtime_waves := runtime_audio.stream as AudioStreamWAV diff --git a/tests/surface_drawing_multiplayer_validation.gd b/tests/surface_drawing_multiplayer_validation.gd index 74c86d2..f79700e 100644 --- a/tests/surface_drawing_multiplayer_validation.gd +++ b/tests/surface_drawing_multiplayer_validation.gd @@ -2,7 +2,7 @@ extends SceneTree const MainScene: PackedScene = preload("res://main/main.tscn") const TEST_PORT: int = 18133 -const WAIT_MSEC: int = 20000 +const WAIT_MSEC: int = 60000 func _initialize() -> void: @@ -24,9 +24,15 @@ func _run() -> void: func _run_host() -> void: var main: Node = await _create_initialized_main() var session := main.get_node("%NetworkSession") as NetworkSession - assert(session.start_private_host(TEST_PORT)) + assert(bool(main.call( + "_apply_world", WorldLayout.STARTER_ISLAND, 1, true + ))) + assert(bool(main.call( + "_prepare_host_world", WorldLayout.STARTER_ISLAND, 1 + ))) var save_manager := main.get("_save_manager") as PlayerSaveManager - assert(save_manager.initialize_new_game()) + assert(save_manager.initialize_new_game(1, WorldLayout.STARTER_ISLAND)) + assert(session.start_private_host(TEST_PORT)) main.call("_enter_gameplay") await physics_frame await physics_frame @@ -58,6 +64,40 @@ func _run_host() -> void: remote_peer_id ) assert(remote_record != null) + var network_home := main.get_node( + "%NetworkHomeService" + ) as NetworkHomeService + var home_world := main.get_node("%HomeWorldService") as HomeWorldService + var spawn_service := main.get_node( + "%PlayerSpawnService" + ) as PlayerSpawnService + assert(await _wait_for_home( + network_home, remote_record.identity_fingerprint + )) + var remote_avatar: Player = spawn_service.get_avatar(remote_peer_id) + assert(remote_avatar != null) + var exterior_spawn: Transform3D = home_world.get_exterior_spawn_transform( + remote_record.identity_fingerprint + ) + var exterior_deadline: int = Time.get_ticks_msec() + 5000 + while ( + Time.get_ticks_msec() < exterior_deadline + and remote_avatar.global_position.distance_to(exterior_spawn.origin) > 0.25 + ): + await physics_frame + assert(remote_avatar.global_position.distance_to(exterior_spawn.origin) <= 0.25) + var canvas_state: Dictionary = service.get_canvas_state(canvas_id) + var canvas_origin: Vector3 = SurfaceDrawingProtocol.array_to_vector( + canvas_state["origin"] + ) + remote_avatar.global_position = Vector3( + canvas_origin.x + 1.0, + player.global_position.y, + canvas_origin.z, + ) + session.publish_authoritative_teleport(remote_peer_id) + for _frame: int in 4: + await physics_frame assert(session.peer_supports_capability( remote_peer_id, SurfaceDrawingProtocol.CAPABILITY )) @@ -83,6 +123,10 @@ func _run_host() -> void: str(overwritten_cell["author_fingerprint"]) == remote_record.identity_fingerprint ) + assert( + remote_record.identity_fingerprint + in overwritten_state.get("participant_fingerprints", []) + ) assert(service.request_cell_edits(canvas_id, [{ "x": 8, @@ -112,7 +156,64 @@ func _run_host() -> void: assert(service.request_guide_visibility(canvas_id, false, true)) await create_timer(1.0).timeout assert(service.clear_session_artwork()) + var stamp_deadline: int = Time.get_ticks_msec() + WAIT_MSEC + while ( + Time.get_ticks_msec() < stamp_deadline + and service.get_canvas_ids().is_empty() + ): + await process_frame + assert(service.get_canvas_ids().size() == 1) + var stamp_id: String = service.get_canvas_ids()[0] + var stamp_state: Dictionary = service.get_canvas_state(stamp_id) + assert(bool(stamp_state.get("stamp", false))) + assert(bool(stamp_state["finalized"])) + assert((stamp_state["cells"] as Array).size() == 1) + assert(str(stamp_state["cells"][0]["color_id"]) == "coral") + assert( + stamp_state.get("participant_fingerprints", []) + == [remote_record.identity_fingerprint] + ) + # Give the client a full observation window before the authoritative clear. await create_timer(1.0).timeout + assert( + service.clear_artwork_by_fingerprint( + remote_record.identity_fingerprint + ) == 1 + ) + assert(service.get_canvas_ids().is_empty()) + var second_stamp_deadline: int = Time.get_ticks_msec() + WAIT_MSEC + while ( + Time.get_ticks_msec() < second_stamp_deadline + and service.get_canvas_ids().is_empty() + ): + await process_frame + assert(service.get_canvas_ids().size() == 1) + # Keep the second stamp observable on the client before the ban removes all + # artwork carrying that participant fingerprint. + await create_timer(1.0).timeout + var player_list := main.get_node( + "%NetworkPlayerListService" + ) as NetworkPlayerListService + var remote_entry: PlayerListEntry = null + for entry: PlayerListEntry in player_list.get_entries(): + if entry.peer_id == remote_peer_id: + remote_entry = entry + break + assert(remote_entry != null and remote_entry.can_ban) + assert(player_list.ban( + remote_peer_id, + remote_record.identity_fingerprint, + remote_record.display_name, + remote_entry.revision, + )) + assert(service.get_canvas_ids().is_empty()) + var removed_deadline: int = Time.get_ticks_msec() + WAIT_MSEC + while ( + Time.get_ticks_msec() < removed_deadline + and session.is_authenticated_peer(remote_peer_id) + ): + await process_frame + assert(not session.is_authenticated_peer(remote_peer_id)) print("Surface drawing multiplayer host validation: PASS") session.disconnect_session("") main.queue_free() @@ -159,6 +260,20 @@ func _run_client() -> void: var canvas_id: String = service.get_canvas_ids()[0] var snapshot: Dictionary = service.get_canvas_state(canvas_id) assert(str(_find_cell(snapshot, 7, 7).get("color_id", "")) == "coral") + var canvas_origin: Vector3 = SurfaceDrawingProtocol.array_to_vector( + snapshot["origin"] + ) + var placement_deadline: int = Time.get_ticks_msec() + 10000 + while ( + Time.get_ticks_msec() < placement_deadline + and player.global_position.distance_to(canvas_origin) + > NetworkSurfaceDrawingService.MAX_DRAW_DISTANCE + 2.0 + ): + await physics_frame + assert( + player.global_position.distance_to(canvas_origin) + <= NetworkSurfaceDrawingService.MAX_DRAW_DISTANCE + 2.0 + ) assert(service.request_cell_edits(canvas_id, [{ "x": 7, "y": 7, @@ -210,8 +325,63 @@ func _run_client() -> void: if service.get_canvas_ids().is_empty(): break assert(service.get_canvas_ids().is_empty()) + var data_root := main.get("_data_root") as PlayerDataRoot + var stamp_directory: String = data_root.root_path.path_join("artwork") + assert(DirAccess.make_dir_recursive_absolute(stamp_directory) == OK) + var stamp_path: String = stamp_directory.path_join("multiplayer-stamp.png") + var stamp_image := Image.create(16, 16, false, Image.FORMAT_RGBA8) + stamp_image.fill(Color.TRANSPARENT) + stamp_image.set_pixel(3, 11, SurfaceDrawingPalette.get_color(&"coral")) + assert(stamp_image.save_png(stamp_path) == OK) + assert(service.select_saved_stamp(stamp_path)) + var stamp_surface: Dictionary = _surface_below_local_player(main) + assert(not stamp_surface.is_empty()) + assert(service.request_stamp_at_surface( + stamp_surface["position"], stamp_surface["normal"], Vector3.RIGHT + )) + var shared_stamp_deadline: int = Time.get_ticks_msec() + WAIT_MSEC + while ( + Time.get_ticks_msec() < shared_stamp_deadline + and service.get_canvas_ids().is_empty() + ): + await process_frame + assert(service.get_canvas_ids().size() == 1) + var stamp_state: Dictionary = service.get_canvas_state( + service.get_canvas_ids()[0] + ) + assert(bool(stamp_state.get("stamp", false))) + assert(bool(stamp_state["finalized"])) + assert(str(stamp_state["cells"][0]["color_id"]) == "coral") + assert( + session.get_local_identity_fingerprint() + in stamp_state.get("participant_fingerprints", []) + ) + var clear_deadline: int = Time.get_ticks_msec() + WAIT_MSEC + while ( + Time.get_ticks_msec() < clear_deadline + and not service.get_canvas_ids().is_empty() + ): + await process_frame + assert(service.get_canvas_ids().is_empty()) + assert(service.request_stamp_at_surface( + stamp_surface["position"], stamp_surface["normal"], Vector3.RIGHT + )) + var second_stamp_deadline: int = Time.get_ticks_msec() + WAIT_MSEC + while ( + Time.get_ticks_msec() < second_stamp_deadline + and service.get_canvas_ids().is_empty() + ): + await process_frame + assert(service.get_canvas_ids().size() == 1) + var ban_deadline: int = Time.get_ticks_msec() + WAIT_MSEC + while ( + Time.get_ticks_msec() < ban_deadline + and session.state != NetworkSession.State.SERVER_LOST + ): + await process_frame + assert(session.state == NetworkSession.State.SERVER_LOST) + assert(service.get_canvas_ids().is_empty()) print("Surface drawing multiplayer client validation: PASS") - session.disconnect_session("") main.queue_free() for _frame: int in 4: await process_frame @@ -264,3 +434,18 @@ func _create_initialized_main() -> Node: await process_frame assert(bool(main.get("_application_initialized"))) return main + + +func _wait_for_home( + network_home: NetworkHomeService, + fingerprint: String, +) -> bool: + var deadline: int = Time.get_ticks_msec() + 10000 + while Time.get_ticks_msec() < deadline: + await process_frame + var manifests: Dictionary = network_home.get( + "_manifests_by_fingerprint" + ) + if manifests.has(fingerprint): + return true + return false diff --git a/tests/surface_drawing_runtime_validation.gd b/tests/surface_drawing_runtime_validation.gd index 8835127..85110cd 100644 --- a/tests/surface_drawing_runtime_validation.gd +++ b/tests/surface_drawing_runtime_validation.gd @@ -20,9 +20,13 @@ func _run() -> void: await process_frame assert(bool(main.get("_application_initialized"))) var session := main.get_node("%NetworkSession") as NetworkSession + assert(bool(main.call( + "_apply_world", WorldLayout.STARTER_ISLAND, 1, true + ))) + assert(session.set_host_world(WorldLayout.STARTER_ISLAND, 1)) assert(session.start_private_host(TEST_PORT)) var save_manager := main.get("_save_manager") as PlayerSaveManager - assert(save_manager.initialize_new_game()) + assert(save_manager.initialize_new_game(1, WorldLayout.STARTER_ISLAND)) main.call("_enter_gameplay") await physics_frame await physics_frame @@ -67,6 +71,28 @@ func _run() -> void: state["cells"][0]["author_fingerprint"] == session.get_local_identity_fingerprint() ) + service.set("_last_hovered_canvas_id", canvas_id) + service.set("_hovered_canvas_id", "") + var game_ui := main.get_node("%GameUI") as GameUI + var toolbar := game_ui.get_node( + "%SurfaceDrawingToolbar" + ) as SurfaceDrawingToolbar + var export_button := toolbar.get_node("%ExportButton") as Button + export_button.pressed.emit() + var exported_entries: Array[Dictionary] = service.get_saved_stamp_entries() + assert(exported_entries.size() == 1) + var export_path: String = str(exported_entries[0]["path"]) + assert(not export_path.is_empty()) + var data_root := main.get("_data_root") as PlayerDataRoot + assert(export_path.begins_with(data_root.root_path.path_join("artwork"))) + assert(FileAccess.file_exists(export_path)) + var status_label := game_ui.get_node("%StatusLabel") as Label + assert(status_label.text == "artwork exported to the data folder • artwork") + var exported_image: Image = Image.load_from_file(export_path) + assert(exported_image.get_size() == Vector2i(16, 16)) + assert(exported_image.get_pixel(8, 7).is_equal_approx( + SurfaceDrawingPalette.get_color(&"ocean_teal") + )) assert(service.request_guide_visibility(canvas_id, false)) state = service.get_canvas_state(canvas_id) assert(not bool(state["guide_visible"])) @@ -78,6 +104,7 @@ func _run() -> void: assert(service.request_guide_visibility(canvas_id, false, true)) assert(bool(service.get_canvas_state(canvas_id)["finalized"])) assert(canvas.is_finalized()) + assert(not canvas.has_guide_geometry()) assert(service.request_canvas_at_surface( hit["position"], hit["normal"], Vector3.RIGHT )) @@ -109,6 +136,38 @@ func _run() -> void: assert(player_list.get_session_artwork_counts() == Vector2i(2, 1)) assert(player_list.reset_session_artwork()) assert(service.get_canvas_ids().is_empty()) + var stamp_entries: Array[Dictionary] = service.get_saved_stamp_entries() + assert(stamp_entries.size() == 1) + assert(str(stamp_entries[0]["path"]) == export_path) + assert(int(stamp_entries[0]["grid_size"]) == 16) + assert(bool(stamp_entries[0]["available"])) + service.activate(Vector2(640.0, 360.0)) + assert(service.select_saved_stamp(export_path)) + assert(service.is_stamp_mode()) + assert(service.request_stamp_at_surface( + hit["position"], hit["normal"], Vector3.RIGHT + )) + assert(service.get_canvas_ids().size() == 1) + var stamp_id: String = service.get_canvas_ids()[0] + var stamp_state: Dictionary = service.get_canvas_state(stamp_id) + assert(bool(stamp_state["stamp"])) + assert(bool(stamp_state["finalized"])) + assert(not bool(stamp_state["guide_visible"])) + assert((stamp_state["cells"] as Array).size() == 1) + assert(int(stamp_state["cells"][0]["x"]) == 8) + assert(int(stamp_state["cells"][0]["y"]) == 8) + assert(str(stamp_state["cells"][0]["color_id"]) == "ocean_teal") + assert( + stamp_state.get("participant_fingerprints", []) + == [session.get_local_identity_fingerprint()] + ) + var stamp_canvas_nodes: Dictionary = service.get("_canvas_nodes") + var stamp_canvas := stamp_canvas_nodes[stamp_id] as SurfaceDrawingCanvas + assert(stamp_canvas.is_finalized()) + assert(not stamp_canvas.has_guide_geometry()) + service.set_placement_mode(false) + assert(not service.is_stamp_mode()) + assert(service.clear_session_artwork()) print("Surface drawing runtime validation: PASS") session.disconnect_session("") diff --git a/tests/surface_drawing_texture_renderer_validation.gd b/tests/surface_drawing_texture_renderer_validation.gd new file mode 100644 index 0000000..ed99383 --- /dev/null +++ b/tests/surface_drawing_texture_renderer_validation.gd @@ -0,0 +1,101 @@ +extends SceneTree + +const CANVAS_COUNT: int = 5 +const GRID_SIZE: int = 32 +const FINGERPRINT: String = ( + "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" +) + + +func _initialize() -> void: + call_deferred("_run") + + +func _run() -> void: + var world := Node3D.new() + root.add_child(world) + var color_ids: Array[StringName] = SurfaceDrawingPalette.get_color_ids() + var cells: Array[Dictionary] = [] + for y: int in range(GRID_SIZE): + for x: int in range(GRID_SIZE): + cells.append({ + "x": x, + "y": y, + "color_id": str(color_ids[(x + y) % color_ids.size()]), + "author_fingerprint": FINGERPRINT, + }) + var canvases: Array[SurfaceDrawingCanvas] = [] + var persistent_meshes: Array[Mesh] = [] + var persistent_textures: Array[Texture2D] = [] + for canvas_index: int in range(CANVAS_COUNT): + var canvas := SurfaceDrawingCanvas.new() + world.add_child(canvas) + assert(canvas.setup({ + "session_id": "texture-renderer-session", + "canvas_id": "canvas-%d" % canvas_index, + "origin": [float(canvas_index) * 3.0, 0.0, 0.0], + "normal": [0.0, 1.0, 0.0], + "tangent": [1.0, 0.0, 0.0], + "width": GRID_SIZE, + "height": GRID_SIZE, + "cell_size": SurfaceDrawingProtocol.CELL_SIZE, + "revision": 0, + "guide_visible": true, + "finalized": false, + "layer": canvas_index, + "creator_fingerprint": FINGERPRINT, + "cells": cells, + }, null)) + assert(canvas.get_rendered_pixel_count() == GRID_SIZE * GRID_SIZE) + var pixel_instance := canvas.get("_pixel_instance") as MeshInstance3D + assert(pixel_instance != null) + assert(pixel_instance.mesh.get_surface_count() == 1) + var material := pixel_instance.mesh.surface_get_material( + 0 + ) as StandardMaterial3D + assert(material != null) + assert(material.albedo_texture is ImageTexture) + canvases.append(canvas) + persistent_meshes.append(pixel_instance.mesh) + persistent_textures.append(material.albedo_texture) + for canvas_index: int in range(CANVAS_COUNT): + var canvas: SurfaceDrawingCanvas = canvases[canvas_index] + assert(canvas.apply_update({ + "session_id": "texture-renderer-session", + "canvas_id": "canvas-%d" % canvas_index, + "revision": 1, + "edits": [{ + "x": canvas_index, + "y": canvas_index, + "color_id": "coral", + "author_fingerprint": FINGERPRINT, + }], + })) + var pixel_instance := canvas.get("_pixel_instance") as MeshInstance3D + var material := pixel_instance.mesh.surface_get_material( + 0 + ) as StandardMaterial3D + assert(pixel_instance.mesh == persistent_meshes[canvas_index]) + assert(material.albedo_texture == persistent_textures[canvas_index]) + assert(canvas.apply_guide_update({ + "session_id": "texture-renderer-session", + "canvas_id": "canvas-%d" % canvas_index, + "revision": 2, + "guide_visible": false, + "finalized": true, + })) + assert(not canvas.has_guide_geometry()) + await process_frame + for canvas: SurfaceDrawingCanvas in canvases: + var artwork_mesh_count: int = 0 + for child: Node in canvas.get_children(): + if child is MultiMeshInstance3D: + assert(false, "Art Kit pixels regressed to per-color MultiMeshes.") + if child is MeshInstance3D: + artwork_mesh_count += 1 + assert(artwork_mesh_count == 1) + assert(canvas.get_export_image().get_size() == Vector2i(32, 32)) + world.queue_free() + await process_frame + print("Surface drawing texture renderer validation: PASS") + quit() diff --git a/tests/surface_drawing_texture_renderer_validation.gd.uid b/tests/surface_drawing_texture_renderer_validation.gd.uid new file mode 100644 index 0000000..c64b594 --- /dev/null +++ b/tests/surface_drawing_texture_renderer_validation.gd.uid @@ -0,0 +1 @@ +uid://qj7jd2p3b4p8 diff --git a/tests/surface_drawing_validation.gd b/tests/surface_drawing_validation.gd index 596cec0..ac48a67 100644 --- a/tests/surface_drawing_validation.gd +++ b/tests/surface_drawing_validation.gd @@ -90,6 +90,21 @@ func _validate_protocol_bounds() -> void: unsupported_size["width"] = 48 unsupported_size["height"] = 48 assert(not SurfaceDrawingProtocol.validate_canvas_request(unsupported_size)) + var stamp_pixels := PackedByteArray() + stamp_pixels.resize(16 * 16) + stamp_pixels[0] = 1 + var stamp_request: Dictionary = canvas_request.duplicate(true) + stamp_request["request_id"] = "stamp-1" + stamp_request["pixels"] = stamp_pixels + assert(SurfaceDrawingProtocol.validate_stamp_request(stamp_request)) + var invalid_stamp: Dictionary = stamp_request.duplicate(true) + var invalid_pixels: PackedByteArray = invalid_stamp["pixels"] + invalid_pixels[0] = SurfaceDrawingPalette.COLORS.size() + 1 + invalid_stamp["pixels"] = invalid_pixels + assert(not SurfaceDrawingProtocol.validate_stamp_request(invalid_stamp)) + var empty_stamp: Dictionary = stamp_request.duplicate(true) + empty_stamp["pixels"] = PackedByteArray() + assert(not SurfaceDrawingProtocol.validate_stamp_request(empty_stamp)) var guide_request: Dictionary = { "request_id": "guide-1", "session_id": "session", @@ -116,9 +131,11 @@ func _validate_art_unlocks() -> void: assert(unlocks.unlock_product(&"marker_ocean_teal")) assert(unlocks.unlock_product(&"brush_4x")) assert(unlocks.unlock_product(&"grid_128x")) + assert(unlocks.unlock_product(PlayerArtUnlocks.STAMP_PRODUCT_ID)) assert(unlocks.is_color_unlocked(&"ocean_teal")) assert(unlocks.is_brush_size_unlocked(4)) assert(unlocks.is_grid_size_unlocked(128)) + assert(unlocks.is_stamp_unlocked()) assert(not unlocks.restore_mask(PlayerArtUnlocks.ALL_UNLOCK_MASK + 1)) unlocks.free() @@ -177,6 +194,16 @@ func _validate_canvas_geometry_and_collaboration() -> void: "cells": [], } assert(canvas.setup(state, null)) + var pixel_instance := canvas.get("_pixel_instance") as MeshInstance3D + assert(pixel_instance != null) + assert(pixel_instance.name == "ArtworkTexture") + var persistent_mesh: Mesh = pixel_instance.mesh + var pixel_material := persistent_mesh.surface_get_material( + 0 + ) as StandardMaterial3D + assert(pixel_material != null) + var persistent_texture: Texture2D = pixel_material.albedo_texture + assert(persistent_texture is ImageTexture) var first_center: Vector3 = canvas.get_cell_world_position(0, 0) assert(canvas.cell_at_world_point(first_center) == Vector2i(0, 0)) assert(canvas.contains_world_point(first_center)) @@ -192,6 +219,15 @@ func _validate_canvas_geometry_and_collaboration() -> void: }], } assert(canvas.apply_update(first_update)) + assert(pixel_instance.mesh == persistent_mesh) + assert(pixel_material.albedo_texture == persistent_texture) + assert(canvas.get_rendered_pixel_count() == 1) + var export_image: Image = canvas.get_export_image() + assert(export_image.get_size() == Vector2i(16, 16)) + assert(export_image.get_pixel(3, 11).is_equal_approx( + SurfaceDrawingPalette.get_color(&"coral") + )) + assert(export_image.get_pixel(0, 0).is_equal_approx(Color.TRANSPARENT)) var finish_update: Dictionary = { "session_id": "session", "canvas_id": "canvas-1", @@ -202,6 +238,9 @@ func _validate_canvas_geometry_and_collaboration() -> void: assert(canvas.apply_guide_update(finish_update)) assert(not canvas.is_guide_visible()) assert(canvas.is_finalized()) + assert(not canvas.has_guide_geometry()) + assert(pixel_instance.mesh == persistent_mesh) + assert(pixel_material.albedo_texture == persistent_texture) await process_frame var finished_pixel_scale: float = canvas.get_rendered_pixel_size() assert( @@ -223,6 +262,8 @@ func _validate_canvas_geometry_and_collaboration() -> void: }], } assert(canvas.apply_update(second_update)) + assert(pixel_instance.mesh == persistent_mesh) + assert(pixel_material.albedo_texture == persistent_texture) var cells: Array[Dictionary] = canvas.get_authoritative_cells() assert(cells.size() == 1) assert(cells[0]["color_id"] == "blue") @@ -240,6 +281,10 @@ func _validate_canvas_geometry_and_collaboration() -> void: } assert(canvas.apply_update(erase_update)) assert(canvas.get_authoritative_cells().is_empty()) + assert(canvas.get_rendered_pixel_count() == 0) + assert(canvas.get_export_image().get_pixel(3, 11).is_equal_approx( + Color.TRANSPARENT + )) world.queue_free() await process_frame @@ -282,6 +327,7 @@ func _validate_blocked_author_visibility() -> void: "cell_size": SurfaceDrawingProtocol.CELL_SIZE, "revision": 1, "creator_fingerprint": FINGERPRINT_A, + "participant_fingerprints": [FINGERPRINT_A, FINGERPRINT_B], "cells": [ { "x": 1, @@ -298,20 +344,30 @@ func _validate_blocked_author_visibility() -> void: ], } assert(canvas.setup(state, relationships)) - assert(_rendered_pixel_count(canvas) == 1) + assert(canvas.is_hidden_by_relationship()) + assert(canvas.get_rendered_pixel_count() == 0) relationships.set("_records", {}) canvas.refresh_relationship_visibility() await process_frame - assert(_rendered_pixel_count(canvas) == 2) + assert(not canvas.is_hidden_by_relationship()) + assert(canvas.get_rendered_pixel_count() == 2) + relationships.set("_records", { + FINGERPRINT_B: {"blocked": true, "muted": true}, + }) + assert(canvas.apply_update({ + "session_id": "session", + "canvas_id": "blocked-author-canvas", + "revision": 2, + "participant_fingerprints": [FINGERPRINT_A, FINGERPRINT_B], + "edits": [{ + "x": 2, + "y": 1, + "color_id": "", + "author_fingerprint": "", + }], + })) + canvas.refresh_relationship_visibility() + assert(canvas.is_hidden_by_relationship()) + assert(canvas.get_rendered_pixel_count() == 0) world.queue_free() await process_frame - - -func _rendered_pixel_count(canvas: SurfaceDrawingCanvas) -> int: - var count: int = 0 - for child: Node in canvas.get_children(): - if child is MultiMeshInstance3D: - var instance := child as MultiMeshInstance3D - if instance.multimesh != null: - count += instance.multimesh.instance_count - return count diff --git a/tests/tackle_order_validation.gd b/tests/tackle_order_validation.gd new file mode 100644 index 0000000..5a38e06 --- /dev/null +++ b/tests/tackle_order_validation.gd @@ -0,0 +1,61 @@ +extends SceneTree + +const Catalog: ItemCatalog = preload("res://items/catalog/item_catalog.tres") +const PlayerMenuType = preload("res://ui/player_menu.gd") + +const EXPECTED_BAIT_ORDER: Array[StringName] = [ + &"worms", + &"snails", + &"shrimp", + &"squid_chunks", + &"whole_sardine", + &"whole_anchovy", + &"luminous_roe", +] + + +func _initialize() -> void: + call_deferred("_run") + + +func _run() -> void: + var player_menu := PlayerMenuType.new() as PlayerMenu + player_menu.set("_item_catalog", Catalog) + var tackle_items: Array[OwnedItem] = [] + for item_id: StringName in [ + &"luminous_roe", + &"whole_anchovy", + &"shrimp", + &"snails", + &"whole_sardine", + &"squid_chunks", + &"worms", + ]: + var owned := OwnedItem.new() + owned.item_id = item_id + owned.quantity = 1 + tackle_items.append(owned) + tackle_items.sort_custom( + func(first: OwnedItem, second: OwnedItem) -> bool: + return bool(player_menu.call( + "_sort_tackle_items", first, second + )) + ) + var sorted_ids: Array[StringName] = [] + for owned: OwnedItem in tackle_items: + sorted_ids.append(owned.item_id) + assert(sorted_ids == EXPECTED_BAIT_ORDER) + var bag := PlayerBag.new() + bag.setup(Catalog) + assert(bag.add_item(&"worms", 1)) + assert(bag.add_item(&"shrimp", 1)) + var worms_slot: int = bag.get_storage_slot(&"worms") + var shrimp_slot: int = bag.get_storage_slot(&"shrimp") + assert(worms_slot >= 0 and shrimp_slot >= 0 and worms_slot != shrimp_slot) + assert(bag.move_item_to_storage_slot(&"worms", shrimp_slot)) + assert(bag.get_storage_slot(&"worms") == shrimp_slot) + assert(bag.get_storage_slot(&"shrimp") == worms_slot) + bag.free() + player_menu.free() + print("Tackle order validation: PASS") + quit() diff --git a/tests/tackle_order_validation.gd.uid b/tests/tackle_order_validation.gd.uid new file mode 100644 index 0000000..353ba7e --- /dev/null +++ b/tests/tackle_order_validation.gd.uid @@ -0,0 +1 @@ +uid://27tkdvxgkv3y diff --git a/tests/terrain_biome_validation.gd b/tests/terrain_biome_validation.gd new file mode 100644 index 0000000..968ff5e --- /dev/null +++ b/tests/terrain_biome_validation.gd @@ -0,0 +1,135 @@ +extends SceneTree + +const BIOME_CATALOG: TerrainBiomeCatalog = preload( + "res://world/generation/biomes/terrain_biome_catalog.tres" +) +const PROP_CATALOG: TerrainPropCatalog = preload( + "res://world/generation/props/terrain_prop_catalog.tres" +) +const EXPECTED_BIOMES: Array[StringName] = [ + &"biome_plains", + &"biome_forest", + &"biome_pine_forest", + &"biome_coast", +] +const TEST_SEED := 13001 + +var _failures: Array[String] = [] + + +func _initialize() -> void: + call_deferred(&"_run") + + +func _run() -> void: + _validate_catalog() + _validate_assignment() + _finish() + + +func _validate_catalog() -> void: + for error: String in BIOME_CATALOG.validation_errors(): + _check(false, error) + _check( + BIOME_CATALOG.definitions.size() == EXPECTED_BIOMES.size(), + "The biome catalog must contain all initial authored profiles.", + ) + for biome_id: StringName in EXPECTED_BIOMES: + var biome := BIOME_CATALOG.definition_for_id(biome_id) + _check(biome != null, "The biome catalog is missing %s." % biome_id) + if biome == null: + continue + for rule: TerrainBiomePropRule in biome.prop_rules: + for prop_id_value: String in rule.allowed_prop_ids: + var prop := PROP_CATALOG.definition_for_id( + StringName(prop_id_value) + ) + _check( + prop != null and rule.allows_prop(prop), + "%s has an invalid %s prop rule." + % [biome_id, prop_id_value], + ) + + +func _validate_assignment() -> void: + var records := _synthetic_records() + var first := TerrainBiomeAssigner.assign( + BIOME_CATALOG, + records, + TEST_SEED, + ) + var second := TerrainBiomeAssigner.assign( + BIOME_CATALOG, + records, + TEST_SEED, + ) + _check(first == second, "Biome assignment must be deterministic by seed.") + _check( + TerrainBiomeAssigner.fingerprint(first).length() == 64, + "Biome assignments must expose a SHA-256 fingerprint.", + ) + var counts := TerrainBiomeAssigner.counts(first) + for biome_id: StringName in EXPECTED_BIOMES: + _check( + counts.get(biome_id, 0) > 0, + "The synthetic map must contain %s." % biome_id, + ) + _check( + first.get(Vector2i(3, 3), &"") == &"biome_plains", + "The spawn-tagged center must remain plains.", + ) + for record: Dictionary in records: + var coordinate: Vector2i = record["coordinate"] + var tags: PackedStringArray = record["tags"] + var biome_id: StringName = first.get(coordinate, &"") + if "fresh_water" in tags: + _check( + biome_id == &"", + "Freshwater-only chunks must not inherit a land-prop biome.", + ) + continue + var biome := BIOME_CATALOG.definition_for_id(biome_id) + _check( + biome != null and biome.supports_chunk_tags(tags), + "Biome %s does not support chunk %s." + % [biome_id, coordinate], + ) + + +func _synthetic_records() -> Array[Dictionary]: + var result: Array[Dictionary] = [] + for row: int in 7: + for column: int in 7: + var coordinate := Vector2i(column, row) + var tags := PackedStringArray(["land", "walkable", "grass"]) + if row == 0: + tags = PackedStringArray(["land", "walkable", "sand"]) + elif coordinate == Vector2i(0, 6): + tags = PackedStringArray([ + "land", + "walkable", + "fresh_water", + "pond", + ]) + elif coordinate == Vector2i(3, 3): + tags.append("spawn") + result.append({ + "coordinate": coordinate, + "tags": tags, + }) + return result + + +func _check(condition: bool, message: String) -> void: + if not condition: + _failures.append(message) + + +func _finish() -> void: + if _failures.is_empty(): + print("Terrain biome validation: PASS") + quit(0) + return + for failure: String in _failures: + printerr("Terrain biome validation: ", failure) + quit(1) diff --git a/tests/terrain_biome_validation.gd.uid b/tests/terrain_biome_validation.gd.uid new file mode 100644 index 0000000..40de9e4 --- /dev/null +++ b/tests/terrain_biome_validation.gd.uid @@ -0,0 +1 @@ +uid://cxioi62f6oap0 diff --git a/tests/terrain_chunk_generator_validation.gd b/tests/terrain_chunk_generator_validation.gd new file mode 100644 index 0000000..ec736d9 --- /dev/null +++ b/tests/terrain_chunk_generator_validation.gd @@ -0,0 +1,2082 @@ +extends SceneTree + +const CATALOG: TerrainChunkCatalog = preload( + "res://world/generation/chunks/terrain_chunk_catalog.tres" +) +const EXPECTED_IDS: Array[String] = [ + "chunk_0000", + "chunk_0001", + "chunk_0002", + "chunk_0003", + "chunk_0004", + "chunk_0005", + "chunk_0006", + "chunk_0007", + "chunk_0008", + "chunk_0009", + "chunk_0010", + "chunk_0011", + "chunk_0012", + "chunk_0013", + "chunk_0014", + "chunk_0015", + "chunk_0016", + "chunk_0017", + "chunk_0018", + "chunk_0019", + "chunk_0020", + "chunk_0021", + "chunk_0022", + "chunk_0023", + "chunk_0024", + "chunk_0025", + "chunk_0026", + "chunk_0027", + "chunk_0028", + "chunk_0029", + "chunk_0030", + "chunk_0031", + "chunk_0032", + "chunk_0033", + "chunk_0034", + "chunk_0035", + "chunk_0036", + "chunk_0037", + "chunk_0038", + "chunk_9999", + "chunk_9998", + "chunk_9997", + "chunk_9996", + "chunk_9995", + "chunk_spawn", +] +const REQUIRED_IDS: Array[String] = [ + "chunk_spawn", + "chunk_0001", + "chunk_0002", + "chunk_0003", + "chunk_0004", +] +const TEST_SEED := 13001 +const CONNECTOR_STRESS_SEED := 287 +const EXPECTED_SOLVER_VARIANT_COUNT := 35 +const EXPECTED_VARIANT_COUNTS: Dictionary[StringName, int] = { + &"chunk_0000": 4, + &"chunk_0001": 4, + &"chunk_0002": 4, + &"chunk_0003": 4, + &"chunk_0004": 4, + &"chunk_0005": 4, + &"chunk_0006": 4, + &"chunk_0007": 4, + &"chunk_0008": 4, + &"chunk_0009": 4, + &"chunk_0010": 4, + &"chunk_0011": 4, + &"chunk_0012": 4, + &"chunk_0013": 4, + &"chunk_0014": 4, + &"chunk_0015": 4, + &"chunk_0016": 4, + &"chunk_0017": 4, + &"chunk_0018": 4, + &"chunk_0019": 1, + &"chunk_0020": 4, + &"chunk_0021": 4, + &"chunk_0022": 4, + &"chunk_0023": 4, + &"chunk_0024": 4, + &"chunk_0025": 4, + &"chunk_0026": 4, + &"chunk_0027": 4, + &"chunk_0028": 4, + &"chunk_0029": 4, + &"chunk_0030": 4, + &"chunk_0031": 4, + &"chunk_0032": 4, + &"chunk_0033": 4, + &"chunk_0034": 4, + &"chunk_0035": 4, + &"chunk_0036": 4, + &"chunk_0037": 4, + &"chunk_0038": 4, + &"chunk_9999": 4, + &"chunk_9998": 4, + &"chunk_9997": 4, + &"chunk_9996": 4, + &"chunk_9995": 4, + &"chunk_spawn": 1, +} + +var _failures: Array[String] = [] + + +func _initialize() -> void: + call_deferred(&"_run") + + +func _run() -> void: + _validate_catalog() + _validate_profiles() + _validate_second_tier_coastal_layout() + _validate_generation() + _finish() + + +func _validate_catalog() -> void: + for error: String in CATALOG.validation_errors(): + _check(false, error) + _check( + CATALOG.definitions.size() == EXPECTED_IDS.size(), + "Catalog must contain the authored chunks and spawn definition.", + ) + for stable_id: String in EXPECTED_IDS: + var definition := CATALOG.definition_for_id(StringName(stable_id)) + _check(definition != null, "Catalog is missing %s." % stable_id) + if definition == null: + continue + _check( + definition.packed_scene != null, + "%s must reference an imported GLB." % stable_id, + ) + var grass := CATALOG.definition_for_id(&"chunk_0000") + var sand := CATALOG.definition_for_id(&"chunk_0001") + var beach := CATALOG.definition_for_id(&"chunk_0002") + var grass_ocean_edge := CATALOG.definition_for_id(&"chunk_0005") + var grass_beach_transition := CATALOG.definition_for_id(&"chunk_0006") + var grass_ocean_corner := CATALOG.definition_for_id(&"chunk_0007") + var beach_ocean_corner := CATALOG.definition_for_id(&"chunk_0008") + var grass_sand_diagonal := CATALOG.definition_for_id(&"chunk_0013") + var pond := CATALOG.definition_for_id(&"chunk_0004") + var cliff_sea_edge := CATALOG.definition_for_id(&"chunk_0014") + var cliff_sea_corner := CATALOG.definition_for_id(&"chunk_0015") + var cliff_sea_transition_right := CATALOG.definition_for_id(&"chunk_9999") + var cliff_sea_transition_left := CATALOG.definition_for_id(&"chunk_9998") + var cliff_beach_transition_right := CATALOG.definition_for_id(&"chunk_9997") + var cliff_beach_transition_left := CATALOG.definition_for_id(&"chunk_9996") + var stream_variant := CATALOG.definition_for_id(&"chunk_0016") + var lake_edge := CATALOG.definition_for_id(&"chunk_0017") + var lake_edge_variant := CATALOG.definition_for_id(&"chunk_0037") + var lake_corner := CATALOG.definition_for_id(&"chunk_0018") + var lake_fill := CATALOG.definition_for_id(&"chunk_0019") + var lake_diagonal := CATALOG.definition_for_id(&"chunk_0020") + var lake_narrow := CATALOG.definition_for_id(&"chunk_0021") + var lake_regular_to_narrow := CATALOG.definition_for_id(&"chunk_0022") + var lake_narrow_to_regular := CATALOG.definition_for_id(&"chunk_0023") + var river_edge := CATALOG.definition_for_id(&"chunk_0024") + var river_edge_variant := CATALOG.definition_for_id(&"chunk_0025") + var river_stone_bridge := CATALOG.definition_for_id(&"chunk_0038") + var river_source_right := CATALOG.definition_for_id(&"chunk_0029") + var river_source_left := CATALOG.definition_for_id(&"chunk_0030") + var river_outlet_right := CATALOG.definition_for_id(&"chunk_0031") + var river_outlet_left := CATALOG.definition_for_id(&"chunk_0032") + var river_bend_c := CATALOG.definition_for_id(&"chunk_0033") + var river_bend_b := CATALOG.definition_for_id(&"chunk_0034") + var river_bend_a := CATALOG.definition_for_id(&"chunk_0035") + var river_bend_d := CATALOG.definition_for_id(&"chunk_0036") + var river_cap := CATALOG.definition_for_id(&"chunk_9995") + var cliff_top := CATALOG.definition_for_id(&"chunk_0009") + var cliff_corner := CATALOG.definition_for_id(&"chunk_0010") + var cliff_edge := CATALOG.definition_for_id(&"chunk_0011") + var cliff_ramp := CATALOG.definition_for_id(&"chunk_0012") + var cliff_third_tier_edge := CATALOG.definition_for_id(&"chunk_0026") + var cliff_third_tier_corner := CATALOG.definition_for_id(&"chunk_0027") + var cliff_third_tier_top := CATALOG.definition_for_id(&"chunk_0028") + var spawn := CATALOG.definition_for_id(&"chunk_spawn") + _check( + ( + grass != null + and sand != null + and beach != null + and grass_ocean_edge != null + and grass_beach_transition != null + and grass_ocean_corner != null + and beach_ocean_corner != null + and grass_sand_diagonal != null + and pond != null + and cliff_sea_edge != null + and cliff_sea_corner != null + and cliff_sea_transition_right != null + and cliff_sea_transition_left != null + and cliff_beach_transition_right != null + and cliff_beach_transition_left != null + and stream_variant != null + and lake_edge != null + and lake_edge_variant != null + and lake_corner != null + and lake_fill != null + and lake_diagonal != null + and lake_narrow != null + and lake_regular_to_narrow != null + and lake_narrow_to_regular != null + and river_edge != null + and river_edge_variant != null + and river_stone_bridge != null + and river_source_right != null + and river_source_left != null + and river_outlet_right != null + and river_outlet_left != null + and river_bend_a != null + and river_bend_b != null + and river_bend_c != null + and river_bend_d != null + and river_cap != null + and cliff_top != null + and cliff_corner != null + and cliff_edge != null + and cliff_ramp != null + and cliff_third_tier_edge != null + and cliff_third_tier_corner != null + and cliff_third_tier_top != null + and spawn != null + ), + "The authored biome-rule definitions must be available.", + ) + if ( + grass != null + and sand != null + and beach != null + and grass_ocean_edge != null + and grass_beach_transition != null + and grass_ocean_corner != null + and beach_ocean_corner != null + and grass_sand_diagonal != null + and pond != null + and cliff_sea_edge != null + and cliff_sea_corner != null + and cliff_sea_transition_right != null + and cliff_sea_transition_left != null + and cliff_beach_transition_right != null + and cliff_beach_transition_left != null + and stream_variant != null + and lake_edge != null + and lake_edge_variant != null + and lake_corner != null + and lake_fill != null + and lake_diagonal != null + and lake_narrow != null + and lake_regular_to_narrow != null + and lake_narrow_to_regular != null + and river_edge != null + and river_edge_variant != null + and river_stone_bridge != null + and river_source_right != null + and river_source_left != null + and river_outlet_right != null + and river_outlet_left != null + and river_bend_a != null + and river_bend_b != null + and river_bend_c != null + and river_bend_d != null + and river_cap != null + and cliff_top != null + and cliff_corner != null + and cliff_edge != null + and cliff_ramp != null + and cliff_third_tier_edge != null + and cliff_third_tier_corner != null + and cliff_third_tier_top != null + and spawn != null + ): + _check( + sand.allows_non_water_neighbor(beach), + "Flat sand must permit an adjacent authored beach.", + ) + _check( + sand.allows_non_water_neighbor(grass), + "Flat sand must permit the inland transition to grass.", + ) + _check( + grass.allows_non_water_neighbor(sand), + "Grass must permit the inland side of a flat-sand transition.", + ) + _check( + ( + "sand" in sand.required_neighbor_tags + and "coast" in sand.required_neighbor_tags + and sand.maximum_boundary_distance == 1 + ), + ( + "Every flat-sand chunk must remain attached to sand or authored " + + "coast within the first inland terrain ring." + ), + ) + _check( + spawn.minimum_required_neighbors == 3, + "Spawn must retain its three-sided safe-grass requirement.", + ) + _check( + beach.ocean_facing_edges + == (1 << int(TerrainChunkTopology.Edge.EAST)), + "The authored beach must descend eastward into ocean before rotation.", + ) + _check( + grass_ocean_edge.ocean_facing_edges + == (1 << int(TerrainChunkTopology.Edge.EAST)), + "The authored grass cliff must face eastward ocean before rotation.", + ) + _check( + grass_beach_transition.ocean_facing_edges + == (1 << int(TerrainChunkTopology.Edge.EAST)), + "The authored grass/beach join must face eastward ocean before rotation.", + ) + _check( + grass_beach_transition.minimum_required_neighbors == 2 + and "coast" in grass_beach_transition.required_neighbor_tags, + "The grass/beach join must remain between two coastline chunks.", + ) + _check( + grass_beach_transition.allows_non_water_neighbor_on_edge( + grass, + TerrainChunkTopology.Edge.WEST, + ) + and not grass_beach_transition.allows_non_water_neighbor_on_edge( + sand, + TerrainChunkTopology.Edge.WEST, + ), + "The grass-backed transition edge must accept grass and reject sand.", + ) + _check( + grass_beach_transition.allows_non_water_neighbor_on_edge( + beach, + TerrainChunkTopology.Edge.NORTH, + ) + and grass_beach_transition.allows_non_water_neighbor_on_edge( + grass_ocean_edge, + TerrainChunkTopology.Edge.SOUTH, + ), + "The transition's coastline seams must retain their authored roles.", + ) + _check( + not grass_ocean_edge.allows_non_water_neighbor_on_edge( + sand, + TerrainChunkTopology.Edge.WEST, + ), + "The straight grass coast's inland edge must reject sand.", + ) + _check( + grass_ocean_corner.ocean_facing_edges + == ( + (1 << int(TerrainChunkTopology.Edge.EAST)) + | (1 << int(TerrainChunkTopology.Edge.SOUTH)) + ), + "The authored grass corner must expose east and south to ocean.", + ) + _check( + grass_ocean_corner.minimum_required_neighbors == 2 + and ( + "grass_ocean_edge" + in grass_ocean_corner.required_neighbor_tags + ), + "The grass corner must join two straight grass ocean edges.", + ) + _check( + grass_ocean_corner.allows_non_water_neighbor_on_edge( + grass_ocean_edge, + TerrainChunkTopology.Edge.NORTH, + ) + and grass_ocean_corner.allows_non_water_neighbor_on_edge( + grass_ocean_edge, + TerrainChunkTopology.Edge.WEST, + ), + "Both corner land seams must accept straight grass ocean edges.", + ) + _check( + beach_ocean_corner.ocean_facing_edges + == ( + (1 << int(TerrainChunkTopology.Edge.EAST)) + | (1 << int(TerrainChunkTopology.Edge.SOUTH)) + ), + "The authored beach corner must expose east and south to ocean.", + ) + _check( + beach_ocean_corner.minimum_required_neighbors == 2 + and ( + "beach_ocean_edge" + in beach_ocean_corner.required_neighbor_tags + ), + "The beach corner must join two straight beach ocean edges.", + ) + _check( + grass_sand_diagonal.must_be_interior + and not grass_sand_diagonal.participates_in_base_solver + and grass_sand_diagonal.maximum_boundary_distance == 2 + and "mixed_surface" in grass_sand_diagonal.tags, + ( + "The grass-sand diagonal must remain an inland post-process " + + "mixed-surface chunk." + ), + ) + _check( + grass_sand_diagonal.surface_tags_for_edge( + TerrainChunkTopology.Edge.NORTH + ) == PackedStringArray(["sand"]) + and grass_sand_diagonal.surface_tags_for_edge( + TerrainChunkTopology.Edge.WEST + ) == PackedStringArray(["sand"]) + and grass_sand_diagonal.surface_tags_for_edge( + TerrainChunkTopology.Edge.EAST + ) == PackedStringArray(["grass"]) + and grass_sand_diagonal.surface_tags_for_edge( + TerrainChunkTopology.Edge.SOUTH + ) == PackedStringArray(["grass"]), + "The diagonal's authored edges must retain two sand and two grass sides.", + ) + var stream := CATALOG.definition_for_id(&"chunk_0003") + _check( + pond.water_inlet_edges == pond.water_outlet_edges + and pond.water_inlet_edges + == (1 << int(TerrainChunkTopology.Edge.NORTH)), + "A pond must terminate either end of an inland freshwater chain.", + ) + _check( + pond.maximum_placements == 2, + "Generated worlds must contain only one pond/stream chain.", + ) + _check( + stream != null + and is_equal_approx(stream.selection_weight, 0.3) + and is_equal_approx(stream_variant.selection_weight, 0.3) + and stream.maximum_placements == 2 + and stream_variant.maximum_placements == 1 + and "pond" in stream.tags + and "river" not in stream.tags + and stream_variant.tags == stream.tags + and stream_variant.allowed_neighbor_tags + == stream.allowed_neighbor_tags + and stream_variant.water_inlet_edges == stream.water_inlet_edges + and stream_variant.water_outlet_edges == stream.water_outlet_edges + and stream_variant.water_surface_size == stream.water_surface_size + and stream.water_surface_offset.x < 0.0 + and stream_variant.water_surface_offset.x > 0.0 + and is_equal_approx( + stream_variant.water_surface_offset.y, + stream.water_surface_offset.y, + ), + ( + "Both pond-stream visuals must share one combined selection weight " + + "and mirrored water footprints." + ), + ) + _check( + ( + not lake_edge.participates_in_base_solver + and not lake_edge_variant.participates_in_base_solver + and not lake_corner.participates_in_base_solver + and not lake_fill.participates_in_base_solver + and not lake_diagonal.participates_in_base_solver + and not lake_narrow.participates_in_base_solver + and not lake_regular_to_narrow.participates_in_base_solver + and not lake_narrow_to_regular.participates_in_base_solver + and lake_edge.water_inlet_edges == lake_edge.water_outlet_edges + and lake_edge.water_inlet_edges == 7 + and lake_edge_variant.water_inlet_edges + == lake_edge.water_inlet_edges + and lake_edge_variant.water_outlet_edges + == lake_edge.water_outlet_edges + and lake_edge_variant.water_surface_size + == lake_edge.water_surface_size + and lake_edge_variant.water_surface_offset + == lake_edge.water_surface_offset + and lake_corner.water_inlet_edges + == lake_corner.water_outlet_edges + and lake_corner.water_inlet_edges == 6 + and lake_fill.water_inlet_edges + == lake_fill.water_outlet_edges + and lake_fill.water_inlet_edges == 15 + and lake_fill.water_surface_size == Vector2(10.0, 10.0) + and lake_diagonal.water_inlet_edges + == lake_diagonal.water_outlet_edges + and lake_diagonal.water_inlet_edges == 6 + and lake_diagonal.maximum_placements == 4 + and lake_diagonal.water_surface_polygon.size() == 6 + and lake_narrow.water_inlet_edges == 14 + and lake_narrow.water_outlet_edges == 14 + and lake_narrow.water_surface_polygon.size() == 4 + and lake_regular_to_narrow.water_inlet_edges == 14 + and lake_regular_to_narrow.water_outlet_edges == 14 + and lake_regular_to_narrow.water_surface_polygon.size() == 5 + and lake_narrow_to_regular.water_inlet_edges == 14 + and lake_narrow_to_regular.water_outlet_edges == 14 + and lake_narrow_to_regular.water_surface_polygon.size() == 5 + and "lake" in lake_edge.tags + and "lake" in lake_edge_variant.tags + and "lake" in lake_corner.tags + and "lake" in lake_fill.tags + and "lake" in lake_diagonal.tags + and "lake" in lake_narrow.tags + and "lake" in lake_regular_to_narrow.tags + and "lake" in lake_narrow_to_regular.tags + ), + "The deterministic lake ring and bottom must remain connected freshwater chunks.", + ) + _check( + ( + not river_edge.participates_in_base_solver + and not river_edge_variant.participates_in_base_solver + and not river_stone_bridge.participates_in_base_solver + and river_stone_bridge.maximum_placements == 2 + and not river_source_right.participates_in_base_solver + and not river_source_left.participates_in_base_solver + and not river_outlet_right.participates_in_base_solver + and not river_outlet_left.participates_in_base_solver + and not river_bend_a.participates_in_base_solver + and not river_bend_b.participates_in_base_solver + and not river_bend_c.participates_in_base_solver + and not river_bend_d.participates_in_base_solver + and not river_cap.participates_in_base_solver + and river_edge.water_inlet_edges == 14 + and river_edge.water_outlet_edges == 14 + and river_edge_variant.water_inlet_edges == 14 + and river_edge_variant.water_outlet_edges == 14 + and river_stone_bridge.water_inlet_edges == 14 + and river_stone_bridge.water_outlet_edges == 14 + and river_source_right.water_inlet_edges == 6 + and river_source_right.water_outlet_edges == 6 + and river_source_left.water_inlet_edges == 3 + and river_source_left.water_outlet_edges == 3 + and river_outlet_right.water_inlet_edges == 14 + and river_outlet_right.water_outlet_edges == 14 + and river_outlet_left.water_inlet_edges == 11 + and river_outlet_left.water_outlet_edges == 11 + and river_bend_a.water_inlet_edges == 14 + and river_bend_a.water_outlet_edges == 14 + and river_bend_b.water_inlet_edges == 12 + and river_bend_b.water_outlet_edges == 12 + and river_bend_c.water_inlet_edges == 15 + and river_bend_c.water_outlet_edges == 15 + and river_bend_c.continuous_water_seam_edges == 15 + and river_bend_d.water_inlet_edges == 13 + and river_bend_d.water_outlet_edges == 13 + and river_bend_d.continuous_water_seam_edges == 1 + and river_cap.water_inlet_edges == 6 + and river_cap.water_outlet_edges == 6 + and river_edge.water_surface_polygon.size() == 13 + and river_edge_variant.water_surface_polygon.size() == 13 + and river_stone_bridge.water_surface_polygon.size() == 13 + and river_source_right.water_surface_polygon.size() == 13 + and river_source_left.water_surface_polygon.size() == 13 + and river_outlet_right.water_surface_polygon.size() == 19 + and river_outlet_left.water_surface_polygon.size() == 19 + and river_outlet_right.ocean_facing_edges == 2 + and river_outlet_left.ocean_facing_edges == 2 + and river_cap.water_surface_polygon.size() == 6 + and river_cap.primary_mesh_name == &"chunk_0020" + and "river" in river_edge.tags + and "river" in river_edge_variant.tags + and "river_bridge" in river_stone_bridge.tags + and "stepping_stones" in river_stone_bridge.tags + and "river_source_right" in river_source_right.tags + and "river_source_left" in river_source_left.tags + and "river_outlet_right" in river_outlet_right.tags + and "river_outlet_left" in river_outlet_left.tags + and "river_bend_a" in river_bend_a.tags + and "river_bend_b" in river_bend_b.tags + and "river_bend_c" in river_bend_c.tags + and "river_bend_d" in river_bend_d.tags + and "river" in river_cap.tags + ), + ( + "The river banks, bend, cliff source, ocean outlet, and legacy " + + "caps must remain connected freshwater chunks." + ), + ) + for cliff_definition: TerrainChunkDefinition in [ + cliff_top, + cliff_corner, + cliff_edge, + cliff_ramp, + ]: + _check( + cliff_definition.overlay_only + and cliff_definition.must_be_interior + and cliff_definition.base_layer_scene != null + and cliff_definition.base_layer_mesh_name == &"chunk_0000", + "Every second-tier piece must overlay level-one grass inland.", + ) + for cliff_definition: TerrainChunkDefinition in [ + cliff_third_tier_top, + cliff_third_tier_corner, + cliff_third_tier_edge, + ]: + _check( + cliff_definition.overlay_only + and cliff_definition.must_be_interior + and cliff_definition.base_layer_scene != null + and cliff_definition.base_layer_mesh_name == &"chunk_0000" + and "elevation_3" in cliff_definition.tags, + "Every third-tier piece must overlay level-one grass inland.", + ) + for coastal_cliff: TerrainChunkDefinition in [ + cliff_sea_edge, + cliff_sea_corner, + ]: + _check( + coastal_cliff.overlay_only + and coastal_cliff.base_layer_scene == null + and not coastal_cliff.must_be_interior + and coastal_cliff.prefers_map_boundary + and "coast" in coastal_cliff.tags + and "elevation_2_sea_edge" in coastal_cliff.tags, + ( + "Each second-tier sea piece must be a complete coastal " + + "overlay without an inland grass base." + ), + ) + for transition: TerrainChunkDefinition in [ + cliff_sea_transition_right, + cliff_sea_transition_left, + ]: + _check( + transition.overlay_only + and transition.primary_mesh_name == &"chunk_0010" + and transition.base_layer_scene != null + and transition.base_layer_mesh_name == &"chunk_0007" + and not transition.must_be_interior + and transition.prefers_map_boundary + and "transition" in transition.tags, + ( + "Each raised-coast endpoint must layer the inland corner " + + "over an authored level-one coastline." + ), + ) + _check( + cliff_sea_transition_right.base_layer_quarter_turns == 3 + and cliff_sea_transition_right.ocean_facing_edges + == (1 << int(TerrainChunkTopology.Edge.SOUTH)), + "The right coastal transition must align its south-facing base coast.", + ) + _check( + cliff_sea_transition_left.base_layer_quarter_turns == 1 + and cliff_sea_transition_left.ocean_facing_edges + == (1 << int(TerrainChunkTopology.Edge.EAST)), + "The left coastal transition must align its east-facing base coast.", + ) + for transition: TerrainChunkDefinition in [ + cliff_beach_transition_right, + cliff_beach_transition_left, + ]: + _check( + transition.overlay_only + and transition.primary_mesh_name == &"chunk_0010" + and transition.base_layer_scene != null + and transition.base_layer_mesh_name == &"chunk_0008" + and not transition.must_be_interior + and transition.prefers_map_boundary + and "sand" in transition.tags + and "transition" in transition.tags, + ( + "Each raised beach endpoint must close over an authored " + + "level-one beach corner." + ), + ) + _check( + cliff_beach_transition_right.base_layer_quarter_turns == 3 + and cliff_beach_transition_right.ocean_facing_edges + == (1 << int(TerrainChunkTopology.Edge.SOUTH)) + and cliff_beach_transition_left.base_layer_quarter_turns == 1 + and cliff_beach_transition_left.ocean_facing_edges + == (1 << int(TerrainChunkTopology.Edge.EAST)), + "The raised beach endpoint corners must face their open coastline.", + ) + _check( + cliff_sea_edge.ocean_facing_edges + == (1 << int(TerrainChunkTopology.Edge.EAST)), + "The second-tier sea edge must face east before rotation.", + ) + _check( + cliff_sea_corner.ocean_facing_edges + == ( + (1 << int(TerrainChunkTopology.Edge.EAST)) + | (1 << int(TerrainChunkTopology.Edge.SOUTH)) + ), + "The second-tier sea corner must face east and south before rotation.", + ) + _check( + cliff_sea_corner.minimum_required_neighbors == 2 + and ( + "elevation_2_sea_edge" + in cliff_sea_corner.required_neighbor_tags + ), + "The second-tier sea corner must join two straight sea edges.", + ) + _check( + cliff_top.minimum_required_neighbors == 4 + and "elevation_2" in cliff_top.required_neighbor_tags, + "The second-tier top must be enclosed on all four sides.", + ) + _check( + "ramp" in cliff_ramp.tags + and cliff_ramp.maximum_placements > 0, + "The second-tier ramp must remain available without being required.", + ) + _check( + cliff_third_tier_top.minimum_required_neighbors == 4 + and "elevation_3" in cliff_third_tier_top.required_neighbor_tags + and "ramp" not in cliff_third_tier_edge.tags + and "ramp" not in cliff_third_tier_corner.tags, + "The third-tier set must form a closed, intentionally unramped plateau.", + ) + + +func _validate_profiles() -> void: + for definition: TerrainChunkDefinition in CATALOG.definitions: + var variants := TerrainChunkAnalyzer.create_variants( + definition, + CATALOG.chunk_size, + ) + _check( + not variants.is_empty(), + "%s must produce at least one rotation variant." + % definition.stable_id, + ) + for variant: TerrainChunkVariant in variants: + _check( + variant.edge_profiles.size() == 4, + "%s must expose four edge profiles." % variant.stable_key(), + ) + var ocean_edges := variant.rotated_edge_mask( + definition.ocean_facing_edges + ) + for edge_index: int in variant.edge_profiles.size(): + var profile := variant.edge_profiles[edge_index] + _check( + ( + not profile.points.is_empty() + or (ocean_edges & (1 << edge_index)) != 0 + ), + ( + "%s has an empty non-ocean edge profile." + % variant.stable_key() + ), + ) + + +func _validate_second_tier_coastal_layout() -> void: + var generator := TerrainChunkGenerator.new() + generator.catalog = CATALOG + generator.grid_size = Vector2i(4, 4) + generator.generate_on_ready = false + generator.build_collision = false + generator.force_center_chunk_id = &"" + root.add_child(generator) + var keys := PackedStringArray() + for row: int in generator.grid_size.y: + for column: int in generator.grid_size.x: + var at_north := row == 0 + var at_east := column == generator.grid_size.x - 1 + var at_south := row == generator.grid_size.y - 1 + var at_west := column == 0 + if at_north and at_west: + keys.append("chunk_0015@2") + elif at_north and at_east: + keys.append("chunk_0015@1") + elif at_south and at_east: + keys.append("chunk_0015@0") + elif at_south and at_west: + keys.append("chunk_0015@3") + elif at_north: + keys.append("chunk_0014@1") + elif at_east: + keys.append("chunk_0014@0") + elif at_south: + keys.append("chunk_0014@3") + elif at_west: + keys.append("chunk_0014@2") + else: + keys.append("chunk_0009@0") + _check( + generator.generate_from_placement_keys(keys), + ( + "The second-tier sea edge and corner must form a complete " + + "raised coastal perimeter." + ), + ) + if generator.placement_keys().size() == keys.size(): + _check( + _all_neighbor_edges_match(generator), + "Every raised coastal-perimeter seam must match.", + ) + _check( + _count_placements(generator.placement_keys(), "chunk_0014") == 8 + and _count_placements( + generator.placement_keys(), "chunk_0015" + ) == 4, + "The raised coastal perimeter must use its straight and corner pieces.", + ) + for record: Dictionary in generator.placement_records(): + var stable_id: StringName = record.get("stable_id", &"") + if stable_id not in [&"chunk_0014", &"chunk_0015"]: + continue + var coordinate: Vector2i = record.get( + "coordinate", Vector2i.ZERO + ) + var variant := _find_variant( + generator, + stable_id, + int(record.get("rotation_quarters", 0)), + ) + _check( + variant != null + and generator._variant_respects_ocean_boundary( + variant, coordinate + ), + "Every second-tier sea opening must face outside the terrain grid.", + ) + var generated := generator.get_generated_chunks_root() + if generated != null: + for child: Node in generated.get_children(): + var stable_id := StringName( + child.get_meta(&"terrain_chunk_id", &"") + ) + if stable_id in [&"chunk_0014", &"chunk_0015"]: + _check( + child.get_node_or_null("TerrainBaseLayer") == null, + "Second-tier sea pieces must not render inland grass over ocean.", + ) + generator.free() + + +func _validate_generation() -> void: + var first := _make_generator() + root.add_child(first) + var first_solved := first.generate() + _check(first_solved, "Generator must solve the prototype 9x9 grid.") + if not first_solved: + first.free() + return + var first_keys := first.placement_keys() + _check(first_keys.size() == 81, "Generator must place exactly 81 chunks.") + for stable_id: String in REQUIRED_IDS: + _check( + _placements_contain(first_keys, stable_id), + "Generated diagnostic must contain %s." % stable_id, + ) + _check( + _all_neighbor_edges_match(first), + "Every generated neighboring edge must match.", + ) + _check( + _count_placements(first_keys, "chunk_spawn") == 1, + "Generated layouts must contain exactly one spawn chunk.", + ) + _check( + first_keys[40].begins_with("chunk_spawn@"), + "The spawn chunk must occupy the center cell.", + ) + _validate_layout_rules(first) + _validate_authored_rotations(first) + _validate_generation_summary(first) + var first_generated_root := first.get_generated_chunks_root() + _check( + first.generate(), + "Repeated generation on one generator must solve.", + ) + _check( + first.placement_keys() == first_keys, + "Repeated generation on one generator must remain deterministic.", + ) + _check( + first.get_generated_chunks_root() != first_generated_root, + "Successful regeneration must replace the generated scene atomically.", + ) + + var second := _make_generator() + root.add_child(second) + var second_solved := second.generate() + _check(second_solved, "Repeated deterministic generation must solve.") + if not second_solved: + first.free() + second.free() + return + _check( + second.placement_keys() == first_keys, + "The same seed and catalog must produce the same layout.", + ) + var restored := _make_generator() + restored.generation_seed = TEST_SEED + 999 + root.add_child(restored) + _check( + restored.generate_from_placement_keys(first_keys), + "A resolved placement manifest must rebuild successfully.", + ) + _check( + restored.placement_keys() == first_keys, + "A resolved placement manifest must preserve exact rotations.", + ) + first.free() + second.free() + restored.free() + + for seed_offset: int in range(1, 6): + var generator := _make_generator() + generator.generation_seed = TEST_SEED + seed_offset + root.add_child(generator) + var solved := generator.generate() + _check( + solved, + "Generator must solve seed %d." % generator.generation_seed, + ) + if solved: + var keys := generator.placement_keys() + for stable_id: String in REQUIRED_IDS: + _check( + _placements_contain(keys, stable_id), + "Seed %d must contain %s." + % [generator.generation_seed, stable_id], + ) + _check( + _all_neighbor_edges_match(generator), + "Seed %d has a mismatched neighboring edge." + % generator.generation_seed, + ) + _validate_layout_rules(generator) + generator.free() + + var connector_stress := _make_generator() + connector_stress.generation_seed = CONNECTOR_STRESS_SEED + connector_stress.maximum_backtracks = 100 + root.add_child(connector_stress) + _check( + connector_stress.generate(), + "Connector propagation must solve the known stress seed.", + ) + _check( + connector_stress._backtrack_count < 100, + "Connector propagation must reject unsupported branches early.", + ) + connector_stress.free() + + +func _validate_authored_rotations(generator: TerrainChunkGenerator) -> void: + var counts: Dictionary[StringName, int] = {} + for variant: TerrainChunkVariant in generator._variants: + var stable_id := variant.definition.stable_id + counts[stable_id] = counts.get(stable_id, 0) + 1 + for stable_id: StringName in EXPECTED_VARIANT_COUNTS: + _check( + counts.get(stable_id, 0) == EXPECTED_VARIANT_COUNTS[stable_id], + "%s must preserve every explicitly allowed rotation." % stable_id, + ) + + var stream := CATALOG.definition_for_id(&"chunk_0003") + var alternate_stream := CATALOG.definition_for_id(&"chunk_0016") + _check( + stream != null and alternate_stream != null, + "Both stream visual definitions must be available.", + ) + if stream == null or alternate_stream == null: + return + for quarter_turns: int in 4: + var stream_variant := _find_variant( + generator, + &"chunk_0003", + quarter_turns, + ) + _check( + stream_variant != null, + "The stream must support rotation %d." % quarter_turns, + ) + var alternate_variant := _find_variant( + generator, + &"chunk_0016", + quarter_turns, + ) + _check( + alternate_variant != null, + "The alternate stream must support rotation %d." % quarter_turns, + ) + if stream_variant == null or alternate_variant == null: + continue + var expected_inlet := 1 << int(TerrainChunkTopology.rotated_edge( + TerrainChunkTopology.Edge.NORTH, + quarter_turns, + )) + var expected_outlet := 1 << int(TerrainChunkTopology.rotated_edge( + TerrainChunkTopology.Edge.SOUTH, + quarter_turns, + )) + _check( + stream_variant.rotated_edge_mask(stream.water_inlet_edges) + == expected_inlet, + "The rotated stream inlet must follow its authored orientation.", + ) + _check( + stream_variant.rotated_edge_mask(stream.water_outlet_edges) + == expected_outlet, + "The rotated stream outlet must follow its authored orientation.", + ) + _check( + alternate_variant.rotated_edge_mask( + alternate_stream.water_inlet_edges + ) == expected_inlet + and alternate_variant.rotated_edge_mask( + alternate_stream.water_outlet_edges + ) == expected_outlet, + "The alternate stream connectors must rotate exactly like the original.", + ) + for edge_value: int in TerrainChunkTopology.Edge.values(): + var edge := edge_value as TerrainChunkTopology.Edge + _check( + stream_variant.profile(edge).signature( + TerrainChunkGenerator.CONSTRAINT_PROFILE_QUANTIZATION + ) == alternate_variant.profile(edge).signature( + TerrainChunkGenerator.CONSTRAINT_PROFILE_QUANTIZATION + ), + "Both stream visuals must expose identical terrain edge profiles.", + ) + + var beach := CATALOG.definition_for_id(&"chunk_0002") + _check(beach != null, "The beach definition must be available.") + if beach == null: + return + for quarter_turns: int in 4: + var beach_variant := _find_variant( + generator, + &"chunk_0002", + quarter_turns, + ) + _check( + beach_variant != null, + "The beach must support rotation %d." % quarter_turns, + ) + if beach_variant == null: + continue + var expected_ocean_edge := 1 << int( + TerrainChunkTopology.rotated_edge( + TerrainChunkTopology.Edge.EAST, + quarter_turns, + ) + ) + _check( + beach_variant.rotated_edge_mask(beach.ocean_facing_edges) + == expected_ocean_edge, + "The rotated beach must keep its low edge facing the ocean.", + ) + _check( + not generator._variant_respects_ocean_boundary( + beach_variant, + Vector2i(3, 3), + ), + "A beach slope must never direct its low edge into the map.", + ) + var boundary_coordinate := Vector2i(3, 3) + match TerrainChunkTopology.rotated_edge( + TerrainChunkTopology.Edge.EAST, + quarter_turns, + ): + TerrainChunkTopology.Edge.NORTH: + boundary_coordinate.y = 0 + TerrainChunkTopology.Edge.EAST: + boundary_coordinate.x = generator.grid_size.x - 1 + TerrainChunkTopology.Edge.SOUTH: + boundary_coordinate.y = generator.grid_size.y - 1 + TerrainChunkTopology.Edge.WEST: + boundary_coordinate.x = 0 + _check( + generator._variant_respects_ocean_boundary( + beach_variant, + boundary_coordinate, + ), + "A beach slope must be legal when its low edge faces open ocean.", + ) + + var grass_ocean_edge := CATALOG.definition_for_id(&"chunk_0005") + var grass_beach_transition := CATALOG.definition_for_id(&"chunk_0006") + var grass_ocean_corner := CATALOG.definition_for_id(&"chunk_0007") + var beach_ocean_corner := CATALOG.definition_for_id(&"chunk_0008") + _check( + ( + grass_ocean_edge != null + and grass_beach_transition != null + and grass_ocean_corner != null + and beach_ocean_corner != null + ), + "The authored coastline additions must be available.", + ) + if ( + grass_ocean_edge == null + or grass_beach_transition == null + or grass_ocean_corner == null + or beach_ocean_corner == null + ): + return + var beach_zero := _find_variant(generator, &"chunk_0002", 0) + var grass_edge_zero := _find_variant(generator, &"chunk_0005", 0) + var grass_edge_south := _find_variant(generator, &"chunk_0005", 3) + var transition_zero := _find_variant(generator, &"chunk_0006", 0) + var corner_zero := _find_variant(generator, &"chunk_0007", 0) + var beach_corner_zero := _find_variant(generator, &"chunk_0008", 0) + _check( + beach_zero != null + and grass_edge_zero != null + and grass_edge_south != null + and transition_zero != null + and corner_zero != null + and beach_corner_zero != null, + "The unrotated coastline variants must be available.", + ) + if ( + beach_zero != null + and grass_edge_zero != null + and grass_edge_south != null + and transition_zero != null + and corner_zero != null + and beach_corner_zero != null + ): + _check( + grass_edge_zero.profile( + TerrainChunkTopology.Edge.EAST + ).points.is_empty(), + "The grass cliff's authored east edge must remain open to ocean.", + ) + _check( + transition_zero.profile( + TerrainChunkTopology.Edge.NORTH + ).matches( + beach_zero.profile(TerrainChunkTopology.Edge.SOUTH), + generator.edge_match_tolerance, + ), + "The transition's north side must match the authored beach.", + ) + _check( + transition_zero.profile( + TerrainChunkTopology.Edge.SOUTH + ).matches( + grass_edge_zero.profile(TerrainChunkTopology.Edge.NORTH), + generator.edge_match_tolerance, + ), + "The transition's south side must match the grass cliff.", + ) + _check( + corner_zero.profile(TerrainChunkTopology.Edge.EAST).points.is_empty() + and corner_zero.profile( + TerrainChunkTopology.Edge.SOUTH + ).points.is_empty(), + "The corner's authored east and south edges must remain open to ocean.", + ) + _check( + corner_zero.profile(TerrainChunkTopology.Edge.NORTH).matches( + grass_edge_zero.profile(TerrainChunkTopology.Edge.SOUTH), + generator.edge_match_tolerance, + ), + "The corner's north side must join a straight grass ocean edge.", + ) + _check( + corner_zero.profile(TerrainChunkTopology.Edge.WEST).matches( + grass_edge_south.profile(TerrainChunkTopology.Edge.EAST), + generator.edge_match_tolerance, + ), + "The corner's west side must join a straight grass ocean edge.", + ) + _check( + beach_corner_zero.profile(TerrainChunkTopology.Edge.NORTH).matches( + beach_zero.profile(TerrainChunkTopology.Edge.SOUTH), + generator.edge_match_tolerance, + ), + "The beach corner's north side must join a straight beach.", + ) + var beach_south := _find_variant(generator, &"chunk_0002", 3) + _check( + beach_south != null + and beach_corner_zero.profile( + TerrainChunkTopology.Edge.WEST + ).matches( + beach_south.profile(TerrainChunkTopology.Edge.EAST), + generator.edge_match_tolerance, + ), + "The beach corner's west side must join a rotated straight beach.", + ) + var cliff_top_zero := _find_variant(generator, &"chunk_0009", 0) + var cliff_edge_zero := _find_variant(generator, &"chunk_0011", 0) + var cliff_edge_south := _find_variant(generator, &"chunk_0011", 3) + var cliff_sea_edge_zero := _find_variant(generator, &"chunk_0014", 0) + var cliff_sea_edge_south := _find_variant(generator, &"chunk_0014", 3) + var cliff_sea_corner_zero := _find_variant(generator, &"chunk_0015", 0) + _check( + cliff_top_zero != null + and cliff_edge_zero != null + and cliff_edge_south != null + and cliff_sea_edge_zero != null + and cliff_sea_edge_south != null + and cliff_sea_corner_zero != null, + "The inland and coastal second-tier cliff variants must be available.", + ) + if ( + cliff_top_zero != null + and cliff_edge_zero != null + and cliff_edge_south != null + and cliff_sea_edge_zero != null + and cliff_sea_edge_south != null + and cliff_sea_corner_zero != null + ): + _check( + cliff_sea_edge_zero.profile( + TerrainChunkTopology.Edge.EAST + ).points.is_empty(), + "The second-tier sea edge must remain open on its ocean side.", + ) + _check( + cliff_sea_corner_zero.profile( + TerrainChunkTopology.Edge.EAST + ).points.is_empty() + and cliff_sea_corner_zero.profile( + TerrainChunkTopology.Edge.SOUTH + ).points.is_empty(), + "The second-tier sea corner must retain both ocean openings.", + ) + _check( + generator._edges_are_compatible( + cliff_sea_edge_zero, + TerrainChunkTopology.Edge.WEST, + cliff_top_zero, + TerrainChunkTopology.Edge.EAST, + ), + "The second-tier sea edge must join the raised grass top inland.", + ) + _check( + generator._edges_are_compatible( + cliff_sea_corner_zero, + TerrainChunkTopology.Edge.NORTH, + cliff_sea_edge_zero, + TerrainChunkTopology.Edge.SOUTH, + ) + and generator._edges_are_compatible( + cliff_sea_corner_zero, + TerrainChunkTopology.Edge.WEST, + cliff_sea_edge_south, + TerrainChunkTopology.Edge.EAST, + ), + "The second-tier sea corner must join two straight sea edges.", + ) + _check( + generator._edges_are_compatible( + cliff_sea_edge_zero, + TerrainChunkTopology.Edge.NORTH, + cliff_edge_zero, + TerrainChunkTopology.Edge.SOUTH, + ) + and generator._edges_are_compatible( + cliff_sea_edge_zero, + TerrainChunkTopology.Edge.SOUTH, + cliff_edge_zero, + TerrainChunkTopology.Edge.NORTH, + ), + ( + "A coastal cliff edge must transition directly into its " + + "inland edge counterpart." + ), + ) + _check( + generator._edges_are_compatible( + cliff_sea_corner_zero, + TerrainChunkTopology.Edge.NORTH, + cliff_edge_zero, + TerrainChunkTopology.Edge.SOUTH, + ) + and generator._edges_are_compatible( + cliff_sea_corner_zero, + TerrainChunkTopology.Edge.WEST, + cliff_edge_south, + TerrainChunkTopology.Edge.EAST, + ), + ( + "A coastal cliff corner must transition directly into " + + "ordinary inland cliff edges." + ), + ) + var flat_grass := _find_variant(generator, &"chunk_0000", 0) + var flat_sand := _find_variant(generator, &"chunk_0001", 0) + _check( + flat_grass != null and flat_sand != null, + "Flat grass and sand variants must be available for seam validation.", + ) + if flat_grass != null and flat_sand != null: + for quarter_turns: int in 4: + var transition := _find_variant( + generator, + &"chunk_0006", + quarter_turns, + ) + if transition == null: + continue + var inland_edge := TerrainChunkTopology.rotated_edge( + TerrainChunkTopology.Edge.WEST, + quarter_turns, + ) + var neighbor_edge := TerrainChunkTopology.opposite_edge(inland_edge) + _check( + generator._edges_are_compatible( + transition, + inland_edge, + flat_grass, + neighbor_edge, + ), + "Every transition rotation must accept grass behind it.", + ) + _check( + not generator._edges_are_compatible( + transition, + inland_edge, + flat_sand, + neighbor_edge, + ), + "No transition rotation may accept sand behind it.", + ) + for quarter_turns: int in 4: + var diagonal := _find_variant( + generator, + &"chunk_0013", + quarter_turns, + ) + _check( + diagonal != null, + "The grass-sand diagonal must support rotation %d." + % quarter_turns, + ) + if diagonal == null: + continue + for source_edge_value: int in TerrainChunkTopology.Edge.values(): + var source_edge := source_edge_value as TerrainChunkTopology.Edge + var edge := TerrainChunkTopology.rotated_edge( + source_edge, + quarter_turns, + ) + var neighbor_edge := TerrainChunkTopology.opposite_edge(edge) + var expects_sand := source_edge in [ + TerrainChunkTopology.Edge.NORTH, + TerrainChunkTopology.Edge.WEST, + ] + var expected := flat_sand if expects_sand else flat_grass + var rejected := flat_grass if expects_sand else flat_sand + _check( + generator._edges_are_compatible( + diagonal, + edge, + expected, + neighbor_edge, + ), + "Each rotated diagonal edge must accept its authored surface.", + ) + _check( + not generator._edges_are_compatible( + diagonal, + edge, + rejected, + neighbor_edge, + ), + "No rotated diagonal edge may accept the opposite surface.", + ) + var lake_diagonal_northwest := _find_variant(generator, &"chunk_0020", 0) + var lake_diagonal_northeast := _find_variant(generator, &"chunk_0020", 3) + var lake_narrow_top := _find_variant(generator, &"chunk_0021", 0) + var lake_narrow_left := _find_variant(generator, &"chunk_0021", 1) + var lake_regular_to_narrow := _find_variant(generator, &"chunk_0022", 0) + var lake_narrow_to_regular := _find_variant(generator, &"chunk_0023", 0) + var lake_regular_top := _find_variant(generator, &"chunk_0017", 3) + var lake_regular_variant_top := _find_variant(generator, &"chunk_0037", 3) + _check( + ( + lake_diagonal_northwest != null + and lake_diagonal_northeast != null + and lake_narrow_top != null + and lake_narrow_left != null + and lake_regular_to_narrow != null + and lake_narrow_to_regular != null + and lake_regular_top != null + and lake_regular_variant_top != null + ), + "Every authored diagonal lake perimeter variant must be available.", + ) + if ( + lake_diagonal_northwest != null + and lake_diagonal_northeast != null + and lake_narrow_top != null + and lake_narrow_left != null + and lake_regular_to_narrow != null + and lake_narrow_to_regular != null + and lake_regular_top != null + and lake_regular_variant_top != null + ): + _check( + lake_regular_variant_top.topology_signature(0.001) + == lake_regular_top.topology_signature(0.001), + "Both regular lake edge visuals must expose identical seams.", + ) + _check( + generator._edges_are_compatible( + lake_diagonal_northwest, + TerrainChunkTopology.Edge.EAST, + lake_narrow_top, + TerrainChunkTopology.Edge.WEST, + ) + and generator._edges_are_compatible( + lake_diagonal_northwest, + TerrainChunkTopology.Edge.SOUTH, + lake_narrow_left, + TerrainChunkTopology.Edge.NORTH, + ), + "Both diagonal banks must join the exact narrow lake profile.", + ) + _check( + generator._edges_are_compatible( + lake_narrow_top, + TerrainChunkTopology.Edge.EAST, + lake_narrow_to_regular, + TerrainChunkTopology.Edge.WEST, + ) + and generator._edges_are_compatible( + lake_narrow_to_regular, + TerrainChunkTopology.Edge.EAST, + lake_regular_top, + TerrainChunkTopology.Edge.WEST, + ) + and generator._edges_are_compatible( + lake_regular_top, + TerrainChunkTopology.Edge.EAST, + lake_regular_to_narrow, + TerrainChunkTopology.Edge.WEST, + ) + and generator._edges_are_compatible( + lake_regular_to_narrow, + TerrainChunkTopology.Edge.EAST, + lake_narrow_top, + TerrainChunkTopology.Edge.WEST, + ), + "The narrow lake run must transition exactly into the regular edge.", + ) + _check( + generator._edges_are_compatible( + lake_diagonal_northwest, + TerrainChunkTopology.Edge.EAST, + lake_narrow_to_regular, + TerrainChunkTopology.Edge.WEST, + ) + and generator._edges_are_compatible( + lake_narrow_to_regular, + TerrainChunkTopology.Edge.EAST, + lake_regular_to_narrow, + TerrainChunkTopology.Edge.WEST, + ) + and generator._edges_are_compatible( + lake_regular_to_narrow, + TerrainChunkTopology.Edge.EAST, + lake_diagonal_northeast, + TerrainChunkTopology.Edge.WEST, + ), + "The five-chunk lake side must remain valid without a narrow run.", + ) + var river_cap_northwest := _find_variant(generator, &"chunk_9995", 0) + var river_cap_northeast := _find_variant(generator, &"chunk_9995", 3) + var river_cap_southwest := _find_variant(generator, &"chunk_9995", 1) + var river_cap_southeast := _find_variant(generator, &"chunk_9995", 2) + var river_edge_top := _find_variant(generator, &"chunk_0024", 0) + var river_edge_variant_top := _find_variant(generator, &"chunk_0025", 0) + var river_edge_variant_bottom := _find_variant(generator, &"chunk_0025", 2) + var river_edge_vertical_left := _find_variant(generator, &"chunk_0024", 1) + var river_edge_vertical_right := _find_variant(generator, &"chunk_0025", 3) + var river_stones_top := _find_variant(generator, &"chunk_0038", 0) + var river_stones_bottom := _find_variant(generator, &"chunk_0038", 2) + var river_stones_left := _find_variant(generator, &"chunk_0038", 1) + var river_stones_right := _find_variant(generator, &"chunk_0038", 3) + var river_source_right := _find_variant(generator, &"chunk_0029", 0) + var river_source_left := _find_variant(generator, &"chunk_0030", 0) + var river_outlet_right := _find_variant(generator, &"chunk_0031", 0) + var river_outlet_left := _find_variant(generator, &"chunk_0032", 0) + var river_bend_a := _find_variant(generator, &"chunk_0035", 0) + var river_bend_b := _find_variant(generator, &"chunk_0034", 0) + var river_bend_c := _find_variant(generator, &"chunk_0033", 2) + var river_bend_d := _find_variant(generator, &"chunk_0036", 0) + var beach_east := _find_variant(generator, &"chunk_0002", 0) + var canonical_bend_specs := generator._river_bend_placement_specs( + Vector2i(5, 5), + 0, + ) + var rotated_bend_specs := generator._river_bend_placement_specs( + Vector2i(5, 5), + 1, + ) + _check( + ( + canonical_bend_specs.size() == 4 + and canonical_bend_specs[2]["id"] == &"chunk_0033" + and int(canonical_bend_specs[2]["turns"]) == 2 + and rotated_bend_specs.size() == 4 + and rotated_bend_specs[2]["id"] == &"chunk_0033" + and int(rotated_bend_specs[2]["turns"]) == 3 + ), + "River bend C must retain its authored half-turn at every bend rotation.", + ) + _check( + ( + river_cap_northwest != null + and river_cap_northeast != null + and river_cap_southwest != null + and river_cap_southeast != null + and river_edge_top != null + and river_edge_variant_top != null + and river_edge_variant_bottom != null + and river_edge_vertical_left != null + and river_edge_vertical_right != null + and river_stones_top != null + and river_stones_bottom != null + and river_stones_left != null + and river_stones_right != null + and river_source_right != null + and river_source_left != null + and river_outlet_right != null + and river_outlet_left != null + and river_bend_a != null + and river_bend_b != null + and river_bend_c != null + and river_bend_d != null + and beach_east != null + ), + ( + "Every authored river-bank, bend, source, outlet, and legacy-cap " + + "variant must be available." + ), + ) + if ( + river_cap_northwest != null + and river_cap_northeast != null + and river_cap_southwest != null + and river_cap_southeast != null + and river_edge_top != null + and river_edge_variant_top != null + and river_edge_variant_bottom != null + and river_edge_vertical_left != null + and river_edge_vertical_right != null + and river_stones_top != null + and river_stones_bottom != null + and river_stones_left != null + and river_stones_right != null + and river_source_right != null + and river_source_left != null + and river_outlet_right != null + and river_outlet_left != null + and river_bend_a != null + and river_bend_b != null + and river_bend_c != null + and river_bend_d != null + and beach_east != null + ): + _check( + generator._edges_are_compatible( + river_edge_top, + TerrainChunkTopology.Edge.EAST, + river_stones_top, + TerrainChunkTopology.Edge.WEST, + ) + and generator._edges_are_compatible( + river_stones_top, + TerrainChunkTopology.Edge.SOUTH, + river_stones_bottom, + TerrainChunkTopology.Edge.NORTH, + ) + and generator._edges_are_compatible( + river_stones_left, + TerrainChunkTopology.Edge.EAST, + river_stones_right, + TerrainChunkTopology.Edge.WEST, + ), + ( + "The stepping-stone banks must replace one paired straight river " + + "station in either orientation." + ), + ) + _check( + generator._edges_are_compatible( + river_source_right, + TerrainChunkTopology.Edge.SOUTH, + river_source_left, + TerrainChunkTopology.Edge.NORTH, + ) + and generator._edges_are_compatible( + river_source_right, + TerrainChunkTopology.Edge.EAST, + river_edge_top, + TerrainChunkTopology.Edge.WEST, + ) + and generator._edges_are_compatible( + river_source_left, + TerrainChunkTopology.Edge.EAST, + river_edge_variant_bottom, + TerrainChunkTopology.Edge.WEST, + ), + "The paired cliff source must open directly into both river banks.", + ) + _check( + generator._edges_are_compatible( + river_bend_a, + TerrainChunkTopology.Edge.EAST, + river_bend_b, + TerrainChunkTopology.Edge.WEST, + ) + and generator._edges_are_compatible( + river_bend_a, + TerrainChunkTopology.Edge.SOUTH, + river_bend_c, + TerrainChunkTopology.Edge.NORTH, + ) + and generator._edges_are_compatible( + river_bend_b, + TerrainChunkTopology.Edge.SOUTH, + river_bend_d, + TerrainChunkTopology.Edge.NORTH, + ) + and generator._edges_are_compatible( + river_bend_c, + TerrainChunkTopology.Edge.EAST, + river_bend_d, + TerrainChunkTopology.Edge.WEST, + ), + "The four authored river-bend quadrants must form one continuous turn.", + ) + _check( + generator._edges_are_compatible( + river_edge_top, + TerrainChunkTopology.Edge.EAST, + river_bend_a, + TerrainChunkTopology.Edge.WEST, + ) + and generator._edges_are_compatible( + river_edge_variant_bottom, + TerrainChunkTopology.Edge.EAST, + river_bend_c, + TerrainChunkTopology.Edge.WEST, + ) + and generator._edges_are_compatible( + river_bend_c, + TerrainChunkTopology.Edge.SOUTH, + river_edge_vertical_left, + TerrainChunkTopology.Edge.NORTH, + ) + and generator._edges_are_compatible( + river_bend_d, + TerrainChunkTopology.Edge.SOUTH, + river_edge_vertical_right, + TerrainChunkTopology.Edge.NORTH, + ), + "The bend must connect both incoming and outgoing authored river banks.", + ) + _check( + generator._edges_are_compatible( + river_edge_top, + TerrainChunkTopology.Edge.EAST, + river_outlet_right, + TerrainChunkTopology.Edge.WEST, + ) + and generator._edges_are_compatible( + river_edge_variant_bottom, + TerrainChunkTopology.Edge.EAST, + river_outlet_left, + TerrainChunkTopology.Edge.WEST, + ) + and generator._edges_are_compatible( + river_outlet_right, + TerrainChunkTopology.Edge.SOUTH, + river_outlet_left, + TerrainChunkTopology.Edge.NORTH, + ), + "Both river banks must terminate in the paired beach outlet.", + ) + _check( + generator._edges_are_compatible( + beach_east, + TerrainChunkTopology.Edge.SOUTH, + river_outlet_right, + TerrainChunkTopology.Edge.NORTH, + ) + and generator._edges_are_compatible( + river_outlet_left, + TerrainChunkTopology.Edge.SOUTH, + beach_east, + TerrainChunkTopology.Edge.NORTH, + ), + "The ocean outlet must remain straddled by ordinary beach tiles.", + ) + _check( + generator._edges_are_compatible( + river_cap_northwest, + TerrainChunkTopology.Edge.EAST, + river_edge_top, + TerrainChunkTopology.Edge.WEST, + ) + and generator._edges_are_compatible( + river_edge_top, + TerrainChunkTopology.Edge.EAST, + river_edge_variant_top, + TerrainChunkTopology.Edge.WEST, + ) + and generator._edges_are_compatible( + river_edge_variant_top, + TerrainChunkTopology.Edge.EAST, + river_cap_northeast, + TerrainChunkTopology.Edge.WEST, + ), + "Both river-bank visuals must chain exactly between composite caps.", + ) + _check( + generator._edges_are_compatible( + river_cap_northwest, + TerrainChunkTopology.Edge.SOUTH, + river_cap_southwest, + TerrainChunkTopology.Edge.NORTH, + ) + and generator._edges_are_compatible( + river_edge_top, + TerrainChunkTopology.Edge.SOUTH, + river_edge_variant_bottom, + TerrainChunkTopology.Edge.NORTH, + ) + and generator._edges_are_compatible( + river_cap_northeast, + TerrainChunkTopology.Edge.SOUTH, + river_cap_southeast, + TerrainChunkTopology.Edge.NORTH, + ), + "Opposing river banks and end caps must close the water channel.", + ) + for stable_id: StringName in [ + &"chunk_0005", + &"chunk_0006", + &"chunk_0007", + &"chunk_0008", + &"chunk_0014", + &"chunk_0015", + &"chunk_9999", + &"chunk_9998", + &"chunk_9997", + &"chunk_9996", + ]: + for quarter_turns: int in 4: + var coast_variant := _find_variant( + generator, + stable_id, + quarter_turns, + ) + _check( + coast_variant != null, + "%s must support rotation %d." % [stable_id, quarter_turns], + ) + if coast_variant == null: + continue + _check( + not generator._variant_respects_ocean_boundary( + coast_variant, + Vector2i(3, 3), + ), + "%s must never place its ocean edge inside the map." % stable_id, + ) + var coast_definition := CATALOG.definition_for_id(stable_id) + if coast_definition == null: + continue + var boundary_coordinate := Vector2i(3, 3) + var ocean_edges := coast_variant.rotated_edge_mask( + coast_definition.ocean_facing_edges + ) + for edge_value: int in TerrainChunkTopology.Edge.values(): + if (ocean_edges & (1 << edge_value)) == 0: + continue + match edge_value as TerrainChunkTopology.Edge: + TerrainChunkTopology.Edge.NORTH: + boundary_coordinate.y = 0 + TerrainChunkTopology.Edge.EAST: + boundary_coordinate.x = generator.grid_size.x - 1 + TerrainChunkTopology.Edge.SOUTH: + boundary_coordinate.y = generator.grid_size.y - 1 + TerrainChunkTopology.Edge.WEST: + boundary_coordinate.x = 0 + _check( + generator._variant_respects_ocean_boundary( + coast_variant, + boundary_coordinate, + ), + "Each coast rotation must fit its matching open map boundary.", + ) + + +func _validate_generation_summary(generator: TerrainChunkGenerator) -> void: + var summary := generator._build_summary() + _check( + int(summary.get("variant_count", 0)) == 174, + "The current catalog must expose all 174 authored rotations.", + ) + _check( + int(summary.get("solver_variant_count", 0)) + == EXPECTED_SOLVER_VARIANT_COUNT, + "Equivalent visual rotations must share one solver constraint.", + ) + _check( + int(summary.get("adjacent_repeat_edges", -1)) + == generator._count_adjacent_repeat_edges(), + "The summary must report adjacent repeated chunk definitions.", + ) + _check( + str(summary.get("layout_fingerprint", "")) + == generator.placement_fingerprint(), + "The summary must identify the exact resolved layout.", + ) + _check( + generator.placement_fingerprint().length() == 64, + "The resolved layout fingerprint must be SHA-256.", + ) + var variant_counts: Dictionary = summary.get("variant_counts", {}) + for stable_id: StringName in EXPECTED_VARIANT_COUNTS: + _check( + int(variant_counts.get(stable_id, 0)) + == EXPECTED_VARIANT_COUNTS[stable_id], + "The summary must report %s rotation candidates." % stable_id, + ) + + +func _find_variant( + generator: TerrainChunkGenerator, + stable_id: StringName, + quarter_turns: int, +) -> TerrainChunkVariant: + for variant: TerrainChunkVariant in generator._variants: + if ( + variant.definition.stable_id == stable_id + and variant.quarter_turns == quarter_turns + ): + return variant + return null + + +func _make_generator() -> TerrainChunkGenerator: + var generator := TerrainChunkGenerator.new() + generator.catalog = CATALOG + generator.grid_size = Vector2i(9, 9) + generator.generation_seed = TEST_SEED + generator.generate_on_ready = false + generator.build_collision = false + generator.force_center_chunk_id = &"chunk_spawn" + generator.required_chunk_ids = PackedStringArray(REQUIRED_IDS) + generator.grass_sand_smoothing_enabled = true + generator.maximum_backtracks = 100000 + return generator + + +func _placements_contain(keys: PackedStringArray, stable_id: String) -> bool: + for key: String in keys: + if key.begins_with(stable_id + "@"): + return true + return false + + +func _count_placements(keys: PackedStringArray, stable_id: String) -> int: + var count := 0 + for key: String in keys: + if key.begins_with(stable_id + "@"): + count += 1 + return count + + +func _all_neighbor_edges_match(generator: TerrainChunkGenerator) -> bool: + for index: int in generator._placements.size(): + var coordinate := Vector2i( + index % generator.grid_size.x, + index / generator.grid_size.x, + ) + var current: TerrainChunkVariant = generator._placements[index] + if coordinate.x > 0: + var west: TerrainChunkVariant = generator._placements[index - 1] + if not generator._edges_are_compatible( + current, + TerrainChunkTopology.Edge.WEST, + west, + TerrainChunkTopology.Edge.EAST, + ): + return false + if coordinate.y > 0: + var north: TerrainChunkVariant = ( + generator._placements[index - generator.grid_size.x] + ) + if not generator._edges_are_compatible( + current, + TerrainChunkTopology.Edge.NORTH, + north, + TerrainChunkTopology.Edge.SOUTH, + ): + return false + return true + + +func _validate_layout_rules(generator: TerrainChunkGenerator) -> void: + _check( + generator._neighbor_requirement_validation_error( + generator._placements + ).is_empty(), + "Every generated chunk must satisfy its authored neighbor count.", + ) + _check( + generator._walkable_connectivity_validation_error( + generator._placements + ).is_empty(), + "All walkable generated terrain must remain connected to spawn.", + ) + var center := Vector2i( + generator.grid_size.x / 2, + generator.grid_size.y / 2, + ) + var safe_spawn_neighbors := 0 + for edge_value: int in TerrainChunkTopology.Edge.values(): + var neighbor_coordinate := ( + center + + TerrainChunkTopology.grid_offset( + edge_value as TerrainChunkTopology.Edge + ) + ) + var neighbor := generator._placements[ + neighbor_coordinate.y * generator.grid_size.x + + neighbor_coordinate.x + ] + if "spawn_safe" in neighbor.definition.tags: + safe_spawn_neighbors += 1 + _check( + safe_spawn_neighbors >= 3, + "At least three cardinal spawn neighbors must be safe flat grass.", + ) + for index: int in generator._placements.size(): + var placement := generator._placements[index] + var coordinate := Vector2i( + index % generator.grid_size.x, + index / generator.grid_size.x, + ) + if "coast" in placement.definition.tags: + _check( + generator._variant_respects_ocean_boundary( + placement, + coordinate, + ), + "Every coastline chunk must direct its ocean edge outside the grid.", + ) + var ocean_edges := placement.rotated_edge_mask( + placement.definition.ocean_facing_edges + ) + for edge_value: int in TerrainChunkTopology.Edge.values(): + var neighbor_coordinate := ( + coordinate + + TerrainChunkTopology.grid_offset( + edge_value as TerrainChunkTopology.Edge + ) + ) + var outside := not generator._coordinate_is_inside_grid( + neighbor_coordinate + ) + _check( + ((ocean_edges & (1 << edge_value)) != 0) == outside, + "Every map-boundary edge must use authored coastline geometry.", + ) + if placement.definition.stable_id == &"chunk_0006": + var touches_beach := false + var touches_grass_edge := false + for edge_value: int in TerrainChunkTopology.Edge.values(): + var neighbor_coordinate := ( + coordinate + + TerrainChunkTopology.grid_offset( + edge_value as TerrainChunkTopology.Edge + ) + ) + if not generator._coordinate_is_inside_grid(neighbor_coordinate): + continue + var neighbor := generator._placements[ + neighbor_coordinate.y * generator.grid_size.x + + neighbor_coordinate.x + ] + touches_beach = ( + touches_beach + or neighbor.definition.stable_id == &"chunk_0002" + ) + touches_grass_edge = ( + touches_grass_edge + or neighbor.definition.stable_id == &"chunk_0005" + ) + _check( + touches_beach and touches_grass_edge, + "Every grass/beach transition must join both authored edge types.", + ) + if placement.definition.stable_id == &"chunk_0007": + var straight_edge_neighbors := 0 + for edge_value: int in TerrainChunkTopology.Edge.values(): + var neighbor_coordinate := ( + coordinate + + TerrainChunkTopology.grid_offset( + edge_value as TerrainChunkTopology.Edge + ) + ) + if not generator._coordinate_is_inside_grid(neighbor_coordinate): + continue + var neighbor := generator._placements[ + neighbor_coordinate.y * generator.grid_size.x + + neighbor_coordinate.x + ] + if neighbor.definition.stable_id == &"chunk_0005": + straight_edge_neighbors += 1 + _check( + straight_edge_neighbors == 2, + "Every grass corner must join two straight grass ocean edges.", + ) + if placement.definition.stable_id == &"chunk_0008": + var straight_beach_neighbors := 0 + for edge_value: int in TerrainChunkTopology.Edge.values(): + var neighbor_coordinate := ( + coordinate + + TerrainChunkTopology.grid_offset( + edge_value as TerrainChunkTopology.Edge + ) + ) + if not generator._coordinate_is_inside_grid(neighbor_coordinate): + continue + var neighbor := generator._placements[ + neighbor_coordinate.y * generator.grid_size.x + + neighbor_coordinate.x + ] + if neighbor.definition.stable_id == &"chunk_0002": + straight_beach_neighbors += 1 + _check( + straight_beach_neighbors == 2, + "Every beach corner must join two straight beach ocean edges.", + ) + if placement.definition.stable_id != &"chunk_0001": + continue + var touches_sand_or_coast := false + for edge_value: int in TerrainChunkTopology.Edge.values(): + var neighbor_coordinate := ( + coordinate + + TerrainChunkTopology.grid_offset( + edge_value as TerrainChunkTopology.Edge + ) + ) + if not generator._coordinate_is_inside_grid(neighbor_coordinate): + continue + var neighbor := generator._placements[ + neighbor_coordinate.y * generator.grid_size.x + + neighbor_coordinate.x + ] + if ( + "sand" in neighbor.definition.tags + or "coast" in neighbor.definition.tags + ): + touches_sand_or_coast = true + _check( + touches_sand_or_coast, + "Every flat-sand chunk must remain attached to sand or coast.", + ) + + +func _check(condition: bool, message: String) -> void: + if not condition: + _failures.append(message) + + +func _finish() -> void: + if _failures.is_empty(): + print("Terrain chunk generator validation: PASS") + quit(0) + return + for failure: String in _failures: + printerr("Terrain chunk generator validation: ", failure) + quit(1) diff --git a/tests/terrain_chunk_generator_validation.gd.uid b/tests/terrain_chunk_generator_validation.gd.uid new file mode 100644 index 0000000..d13a22b --- /dev/null +++ b/tests/terrain_chunk_generator_validation.gd.uid @@ -0,0 +1 @@ +uid://bt6pjgkomx76s diff --git a/tests/texture_sampling_validation.gd b/tests/texture_sampling_validation.gd index deeabce..dcccc38 100644 --- a/tests/texture_sampling_validation.gd +++ b/tests/texture_sampling_validation.gd @@ -1,6 +1,11 @@ extends SceneTree const POLICY := preload("res://main/texture_sampling_policy.gd") +const PROJECTED_TERRAIN_TEXTURE_IMPORTS: Array[String] = [ + "res://world/generation/chunks/assets/chunk_0000_grass_lite.png.import", + "res://world/generation/chunks/assets/chunk_0001_sand.png.import", + "res://world/generation/chunks/assets/chunk_0031_dirt.png.import", +] var failures: Array[String] = [] @@ -83,9 +88,14 @@ func _validate_repository_files(path: String) -> void: func _validate_import_file(path: String) -> void: var source := FileAccess.get_file_as_string(path) + var expects_mipmaps := path in PROJECTED_TERRAIN_TEXTURE_IMPORTS _check( - "mipmaps/generate=true" not in source, - "Texture import generates mipmaps: %s" % path, + ("mipmaps/generate=true" in source) == expects_mipmaps, + ( + "Projected terrain mipmap policy mismatch: %s" + if expects_mipmaps + else "Texture import generates unapproved mipmaps: %s" + ) % path, ) diff --git a/tests/title_credits_validation.gd b/tests/title_credits_validation.gd index 7e50f89..e5ac4cc 100644 --- a/tests/title_credits_validation.gd +++ b/tests/title_credits_validation.gd @@ -21,6 +21,10 @@ func _run() -> void: var credits_button := title_screen.get_node( "%CreditsButton" ) as BubbleButton + var play_button := title_screen.get_node("%PlayButton") as BubbleButton + var continue_stats_drawer := title_screen.get_node( + "%ContinueStatsDrawer" + ) as RichTextLabel var credits_page := title_screen.get_node( "%CreditsPage" ) as TitleCreditsPageType @@ -34,35 +38,72 @@ func _run() -> void: await process_frame _expect(credits_button != null, "title menu exposes a credits button") + _expect(play_button != null, "title menu exposes the play button") + _expect( + continue_stats_drawer != null, + "play button owns a dedicated save-preview drawer", + ) + if play_button != null and continue_stats_drawer != null: + _expect( + continue_stats_drawer.get_parent() == play_button, + "save preview extends directly from the play button", + ) + _expect( + continue_stats_drawer.position.y < play_button.size.y + and ( + continue_stats_drawer.position.y + + continue_stats_drawer.size.y + ) > play_button.size.y, + "save preview overlaps the play edge and extends below it", + ) + _expect( + continue_stats_drawer.mouse_filter + == Control.MOUSE_FILTER_IGNORE, + "save preview drawer cannot intercept menu input", + ) + _expect( + credits_button.icon != null and credits_button.text.is_empty(), + "credits action uses its icon in the square-button presentation", + ) _expect(credits_page != null, "title screen contains the credits page") _expect(not credits_page.visible, "credits page starts closed") _expect( Rect2(Vector2.ZERO, bubble_field.size).encloses( Rect2(credits_button.position, credits_button.size) ), - "credits bubble stays inside the authored title field", + "credits button stays inside the authored title field", ) _expect( credits_button.mouse_filter == Control.MOUSE_FILTER_STOP, - "credits bubble accepts pointer input", + "credits button accepts pointer input", ) - if OS.has_environment("NETFISHING_TITLE_MENU_CAPTURE"): + if OS.has_environment("straywild_TITLE_MENU_CAPTURE"): (title_screen.get_node("%StartPromptCenter") as Control).hide() title_screen.set_process(true) await create_timer(0.5).timeout _expect( _save_capture( - OS.get_environment("NETFISHING_TITLE_MENU_CAPTURE") + OS.get_environment("straywild_TITLE_MENU_CAPTURE") ) == OK, "title menu validation capture saves successfully", ) title_screen.set_process(false) title_screen.set("_navigation_focus_active", false) + credits_button.call("_set_hovered", true) + credits_button.advance_emphasis(1.0) + _expect( + (credits_button.get_node("HoverDrawer") as Control).visible, + "pointer hover reveals the credits drawer before activation", + ) credits_button.pressed.emit() await process_frame _expect(credits_page.visible, "pointer activation opens credits") _expect(not presentation.visible, "credits replace the primary title menu") + _expect( + not (credits_button.get_node("HoverDrawer") as Control).visible, + "opening a title page collapses its hover drawer", + ) _expect( root.gui_get_focus_owner() != back_button, "pointer activation does not pseudo-select back", @@ -76,11 +117,11 @@ func _run() -> void: back_button.mouse_filter == Control.MOUSE_FILTER_STOP, "credits back button accepts pointer clicks", ) - if OS.has_environment("NETFISHING_CREDITS_CAPTURE"): + if OS.has_environment("straywild_CREDITS_CAPTURE"): await process_frame _expect( _save_capture( - OS.get_environment("NETFISHING_CREDITS_CAPTURE") + OS.get_environment("straywild_CREDITS_CAPTURE") ) == OK, "credits validation capture saves successfully", ) @@ -93,6 +134,30 @@ func _run() -> void: "pointer return leaves the title menu unfocused", ) + var online_button := title_screen.get_node( + "%JoinGameButton" + ) as BubbleButton + var join_game_page := title_screen.get_node("%JoinGamePage") as Control + online_button.call("_set_hovered", true) + online_button.advance_emphasis(1.0) + _expect( + (online_button.get_node("HoverDrawer") as Control).visible, + "pointer hover reveals the online drawer before activation", + ) + online_button.pressed.emit() + await process_frame + _expect(join_game_page.visible, "online activation opens the join page") + _expect( + not (online_button.get_node("HoverDrawer") as Control).visible, + "opening the join page collapses the online drawer", + ) + title_screen.call("_close_join_game") + await process_frame + _expect( + not (online_button.get_node("HoverDrawer") as Control).visible, + "returning from the join page does not restore stale pointer hover", + ) + title_screen.set("_navigation_focus_active", true) credits_button.grab_focus() credits_button.pressed.emit() @@ -130,7 +195,7 @@ func _run() -> void: _expect(not credits_page.visible, "ui cancel closes credits") _expect( root.gui_get_focus_owner() == credits_button, - "navigation return restores focus to the credits bubble", + "navigation return restores focus to the credits button", ) var chillnfill_name := credits_page.get_node( @@ -145,15 +210,10 @@ func _run() -> void: var chillnfill_credit := credits_page.get_node( "Paper/Margin/Layout/Columns/CreativeCredits/ChillnfillCredit" ) as Label - var tekgator_name := credits_page.get_node( - "Paper/Margin/Layout/Columns/CreativeCredits/TekgatorName" + var credits_paper := credits_page.get_node("Paper") as PanelContainer + var audio_credits := credits_page.get_node( + "Paper/Margin/Layout/Columns/AdditionalCredits/AudioCredits" ) as Label - var tekgator_credit := credits_page.get_node( - "Paper/Margin/Layout/Columns/CreativeCredits/TekgatorCredit" - ) as Label - var creative_credits := credits_page.get_node( - "Paper/Margin/Layout/Columns/CreativeCredits" - ) as VBoxContainer _expect(voyager_name.text == "Voyager", "in-game credits use Voyager") _expect( endeavour_name.text == "Endeavour", @@ -168,18 +228,18 @@ func _run() -> void: "in-game credits describe the supplied model families", ) _expect( - tekgator_name.text == "Tekgator", - "in-game credits name Tekgator", + "kat • animalese source recording" in audio_credits.text, + "in-game credits name kat's animalese source contribution", ) _expect( - "shop icon" in tekgator_credit.text.to_lower(), - "in-game credits describe Tekgator's shop icon artwork", + "kim • animalese source recording" in audio_credits.text, + "in-game credits name kim's animalese source contribution", ) _expect( - Rect2(Vector2.ZERO, creative_credits.size).encloses( - Rect2(tekgator_credit.position, tekgator_credit.size) + credits_paper.get_global_rect().encloses( + audio_credits.get_global_rect() ), - "Tekgator's credit stays inside the authored credits column", + "audio credits stay inside the authored credits panel", ) title_screen.queue_free() diff --git a/tests/tree_gathering_prototype_validation.gd b/tests/tree_gathering_prototype_validation.gd new file mode 100644 index 0000000..2814e19 --- /dev/null +++ b/tests/tree_gathering_prototype_validation.gd @@ -0,0 +1,166 @@ +extends SceneTree + +const StarterIslandScene = preload( + "res://world/regions/starter_island_region.tscn" +) +const Gatherables: GatherableCatalog = preload( + "res://gathering/catalog/gatherable_catalog.tres" +) +const FishCatalog: FishPool = preload("res://fish/pools/fish_catalog.tres") +const MeshSurfaceAnchorSamplerType = preload( + "res://world/generation/mesh_surface_anchor_sampler.gd" +) + + +func _initialize() -> void: + call_deferred("_run") + + +func _run() -> void: + _validate_beetle_data() + await _validate_mesh_surface_sampler() + await _validate_tree_anchors() + _validate_anchored_presentation() + _validate_three_dimensional_targeting() + print("Tree gathering prototype validation: PASS") + quit() + + +func _validate_beetle_data() -> void: + var beetle: GatherableData = Gatherables.get_entry(&"beetle_stag_common") + assert(beetle != null and beetle.is_available()) + assert(beetle.catch_data == FishCatalog.get_fish_by_id(&"beetle_stag_common")) + assert(beetle.catch_data.display_texture != null) + assert(beetle.catch_data.collection_method == FishData.CollectionMethod.NET) + assert(beetle.catch_data.collection_group == &"Beetles") + assert(beetle.required_tool_id == &"crab_net") + assert(beetle.spawn_anchor_set_id == &"starter_reachable_tree_trunks") + assert(beetle.population == 3) + assert(is_equal_approx(beetle.spawn_anchor_occupancy_ratio, 0.35)) + assert(beetle.maximum_anchor_population == 64) + assert(beetle.target_population_for_anchor_count(8) == 3) + assert(beetle.target_population_for_anchor_count(40) == 14) + assert(beetle.target_population_for_anchor_count(400) == 64) + assert(is_equal_approx(beetle.sprite_pixel_size, 0.0075)) + assert(beetle.is_stationary_spawn()) + assert(not beetle.can_be_scared()) + + +func _validate_mesh_surface_sampler() -> void: + var prop := Node3D.new() + # The accessibility band is local to the planted prop, so the same tree on + # a raised cliff remains reachable from that cliff's walkable surface. + prop.position = Vector3(3.0, 12.0, -4.0) + root.add_child(prop) + var visual := MeshInstance3D.new() + var box := BoxMesh.new() + box.size = Vector3(2.0, 4.0, 2.0) + var wood := StandardMaterial3D.new() + wood.resource_name = "wood" + box.material = wood + visual.mesh = box + visual.position.y = 2.0 + prop.add_child(visual) + await process_frame + var random := RandomNumberGenerator.new() + random.seed = 115 + var sample: Dictionary = MeshSurfaceAnchorSamplerType.sample_vertical_surface( + prop, + prop, + PackedStringArray(["wood"]), + 0.7, + 1.5, + 0.35, + 0.025, + random, + ) + assert(not sample.is_empty()) + var surface_position: Vector3 = sample["surface_position"] + var anchor_position: Vector3 = sample["position"] + assert(surface_position.y >= 0.7 and surface_position.y <= 1.5) + var world_anchor_position := prop.to_global(anchor_position) + assert( + world_anchor_position.y >= 12.7 + and world_anchor_position.y <= 13.5 + ) + assert(is_equal_approx( + maxf(absf(surface_position.x), absf(surface_position.z)), + 1.0, + )) + assert(is_equal_approx( + anchor_position.distance_to(surface_position), + 0.025, + )) + assert(MeshSurfaceAnchorSamplerType.sample_vertical_surface( + prop, + prop, + PackedStringArray(["leaf"]), + 0.7, + 1.5, + 0.35, + 0.025, + random, + ).is_empty()) + prop.queue_free() + + +func _validate_tree_anchors() -> void: + var region := StarterIslandScene.instantiate() as WorldRegion + root.add_child(region) + await process_frame + var anchor_set: GatherableAnchorSet3D = region.get_gatherable_anchor_set( + &"starter_reachable_tree_trunks" + ) + assert(anchor_set != null) + var positions: PackedVector3Array = anchor_set.get_spawn_positions() + assert(positions.size() == 8) + for position: Vector3 in positions: + assert(position.is_finite()) + assert(position.y >= 4.3 and position.y <= 4.5) + region.queue_free() + + +func _validate_anchored_presentation() -> void: + var beetle: GatherableData = Gatherables.get_entry(&"beetle_stag_common") + var presentation := WorldGatherable.new() + root.add_child(presentation) + presentation.configure("beetle-visual", beetle, Vector3.ZERO, 0.0) + var sprite := presentation.get_node("GatherableSprite") as Sprite3D + assert(sprite != null) + assert(is_zero_approx(sprite.position.y)) + assert(is_equal_approx(sprite.pixel_size, 0.0075)) + assert(not sprite.shaded) + assert(sprite.billboard == BaseMaterial3D.BILLBOARD_ENABLED) + assert(sprite.texture_filter == BaseMaterial3D.TEXTURE_FILTER_NEAREST) + presentation.queue_free() + + +func _validate_three_dimensional_targeting() -> void: + var service := NetworkWorldSpawnService.new() + var beetle: GatherableData = Gatherables.get_entry(&"beetle_stag_common") + service.set( + "_entities", + { + "beetle-test": { + "entity_id": "beetle-test", + "type_id": &"beetle_stag_common", + "data": beetle, + "position": Vector3(2.0, 4.4, 3.0), + "locked": false, + }, + }, + ) + assert( + service.find_capture_target( + Vector3(2.0, 4.4, 3.0), + &"crab_net", + ) + == "beetle-test" + ) + assert( + service.find_capture_target( + Vector3(2.0, 3.0, 3.0), + &"crab_net", + ).is_empty() + ) + service.free() diff --git a/tests/tree_gathering_prototype_validation.gd.uid b/tests/tree_gathering_prototype_validation.gd.uid new file mode 100644 index 0000000..defb119 --- /dev/null +++ b/tests/tree_gathering_prototype_validation.gd.uid @@ -0,0 +1 @@ +uid://d0g1xubbi48n diff --git a/tests/ui_scaling_runtime_validation.gd b/tests/ui_scaling_runtime_validation.gd index f9ddcae..6e6182a 100644 --- a/tests/ui_scaling_runtime_validation.gd +++ b/tests/ui_scaling_runtime_validation.gd @@ -6,6 +6,9 @@ const UIPixelationPresenterType = preload( const UIReferencePresentationType = preload( "res://ui/ui_reference_presentation.gd" ) +const FullscreenMenuPresentationType = preload( + "res://ui/fullscreen_menu_presentation.gd" +) const GameUIScene := preload("res://ui/game_ui.tscn") const TARGET_SIZES: Array[Vector2i] = [ Vector2i(1280, 720), @@ -40,6 +43,9 @@ func _run() -> void: var player_menu := game_ui.get_node( "UIRoot/CanonicalStage/PlayerMenu" ) as PlayerMenu + var player_menu_profile_stage := player_menu.get_node( + "ResponsivePlayerMenuStage" + ) as Control var hotbar := game_ui.get_node( "UIRoot/CanonicalStage/Hotbar" ) as HotbarUI @@ -51,17 +57,35 @@ func _run() -> void: var title_content_stage := title_screen.get_node( "ResponsiveTitleStage" ) as Control - var decorative_fish_layer := title_screen.get_node( - "DecorativeFishLayer" + var title_profile_root := title_screen.get_node( + "ResponsiveTitleStage/TitlePresentationScaleRoot" ) as Control - var decorative_bubble_layer := title_screen.get_node( - "DecorativeBubbleLayer" + var pause_menu := game_ui.get_node( + "UIRoot/CanonicalStage/PauseMenu" + ) as PauseMenu + var pause_profile_stage := pause_menu.get_node( + "ResponsivePauseStage" ) as Control ui_viewport.add_child(game_ui) presenter.add_child(ui_viewport) root.add_child(presenter) await process_frame chat_ui.set_available(true) + var speech_layer := chat_ui.get("_speech_layer") as Control + assert(speech_layer != null and speech_layer.visible) + game_ui.call("_on_player_menu_visibility_changed", true) + assert(not chat_ui.is_world_speech_visible()) + assert(not speech_layer.visible) + game_ui.call("_on_player_menu_visibility_changed", false) + assert(chat_ui.is_world_speech_visible()) + assert(speech_layer.visible) + chat_ui.set_available(true) + chat_ui.call( + "_set_presentation_state", + ChatUI.PresentationState.EXPANDED, + false, + false, + ) print( "UI viewport embedding: root=%s subviewport=%s" % [root.gui_embed_subwindows, ui_viewport.gui_embed_subwindows] @@ -79,6 +103,12 @@ func _run() -> void: var expected_stage_offset: Vector2 = UIReferencePresentationType.get_offset( display_size ) + var expected_profile_scale: float = ( + FullscreenMenuPresentationType.get_profile_scale(display_size) + ) + var expected_profile_position: Vector2 = ( + FullscreenMenuPresentationType.get_profile_position(display_size) + ) assert(presenter.position.is_equal_approx(Vector2.ZERO)) assert(ui_root.position.is_equal_approx(Vector2.ZERO)) var expected_visible_size: Vector2 = ( @@ -97,6 +127,12 @@ func _run() -> void: assert(player_menu.size.is_equal_approx( UIReferencePresentationType.REFERENCE_SIZE )) + assert(player_menu_profile_stage.scale.is_equal_approx( + Vector2.ONE * expected_profile_scale + )) + assert(player_menu_profile_stage.position.is_equal_approx( + expected_profile_position + )) assert(hotbar.position.is_equal_approx(Vector2( 0.0, canonical_stage.position.y, @@ -111,26 +147,18 @@ func _run() -> void: assert(title_content_stage.position.is_equal_approx( canonical_stage.position )) - assert(decorative_fish_layer.size.is_equal_approx( - expected_visible_size + assert(title_profile_root.scale.is_equal_approx( + Vector2.ONE * expected_profile_scale )) - assert(decorative_bubble_layer.size.is_equal_approx( - expected_visible_size + assert(title_profile_root.position.is_equal_approx( + expected_profile_position + )) + assert(pause_profile_stage.scale.is_equal_approx( + Vector2.ONE * expected_profile_scale + )) + assert(pause_profile_stage.position.is_equal_approx( + expected_profile_position )) - var left_to_right_bounds: Vector2 = ( - TitleScreen.get_decorative_fish_crossing_bounds( - expected_visible_size.x, 160.0, 1.0 - ) - ) - var right_to_left_bounds: Vector2 = ( - TitleScreen.get_decorative_fish_crossing_bounds( - expected_visible_size.x, 160.0, -1.0 - ) - ) - assert(left_to_right_bounds.x < -160.0) - assert(left_to_right_bounds.y > expected_visible_size.x) - assert(right_to_left_bounds.x > expected_visible_size.x) - assert(right_to_left_bounds.y < -160.0) assert(is_equal_approx(presenter.scale.x, presenter.scale.y)) assert(is_equal_approx(ui_root.scale.x, ui_root.scale.y)) var effective_scale: float = presenter.scale.x * ui_root.scale.x @@ -138,6 +166,34 @@ func _run() -> void: assert(( canonical_stage.position * effective_scale ).distance_to(expected_stage_offset) <= 0.01) + var profile_source_rect: Rect2 = ( + FullscreenMenuPresentationType.get_source_rect(display_size) + ) + var profile_screen_start: Vector2 = expected_stage_offset + ( + expected_profile_position + + profile_source_rect.position * expected_profile_scale + ) * expected_scale + var profile_screen_size: Vector2 = ( + profile_source_rect.size + * expected_profile_scale + * expected_scale + ) + var compact_target_scale: float = minf( + display_size.x / profile_source_rect.size.x, + display_size.y / profile_source_rect.size.y, + ) + var expected_profile_screen_size: Vector2 = ( + profile_source_rect.size * compact_target_scale + ) + var expected_profile_screen_start: Vector2 = ( + display_size - expected_profile_screen_size + ) * 0.5 + assert(profile_screen_start.distance_to( + expected_profile_screen_start + ) <= 0.01) + assert(profile_screen_size.distance_to( + expected_profile_screen_size + ) <= 0.01) var expected_render_height: int = mini( roundi(UIReferencePresentationType.REFERENCE_SIZE.y * expected_scale), PlayerSettings.get_ui_render_height( @@ -157,12 +213,16 @@ func _run() -> void: assert(presenter.size.is_equal_approx(Vector2(expected_viewport_size))) var chat_panel := chat_ui.get_node("ChatPanel") as Control var clock_panel := chat_ui.get_node("WorldClockPanel") as Control + var calendar_panel := chat_ui.get_node( + "WorldCalendarPanel" + ) as Control var status_effect_column := chat_ui.get_node( "StatusEffectColumn" ) as Control var weather_icon := chat_ui.get_node("WorldWeatherIcon") as Control assert(chat_panel != null) assert(clock_panel != null) + assert(calendar_panel != null) assert(status_effect_column != null) assert(weather_icon != null) assert(chat_panel.visible) @@ -175,15 +235,32 @@ func _run() -> void: ChatUI.CLOCK_EDGE_MARGIN, ChatUI.CLOCK_EDGE_MARGIN, ))) + assert(calendar_panel.position.is_equal_approx(Vector2( + ChatUI.CLOCK_EDGE_MARGIN, + ChatUI.CLOCK_EDGE_MARGIN + + ChatUI.CLOCK_SIZE.y + + ChatUI.CALENDAR_TOP_GAP, + ))) + assert(calendar_panel.size.is_equal_approx(ChatUI.CALENDAR_SIZE)) + assert( + chat_panel.position.y + >= calendar_panel.position.y + + calendar_panel.size.y + + ChatUI.EXPANDED_CHAT_TOP_GAP + - 0.01 + ) assert(is_equal_approx( status_effect_column.position.x, - clock_panel.position.x - + (ChatUI.CLOCK_SIZE.x - ChatUI.STATUS_EFFECT_ICON_SIZE.x) * 0.5, + calendar_panel.position.x + + ( + ChatUI.CALENDAR_SIZE.x + - ChatUI.STATUS_EFFECT_ICON_SIZE.x + ) * 0.5, )) assert(is_equal_approx( status_effect_column.position.y, - clock_panel.position.y - + ChatUI.CLOCK_SIZE.y + calendar_panel.position.y + + ChatUI.CALENDAR_SIZE.y + ChatUI.STATUS_EFFECT_TOP_GAP, )) assert(is_equal_approx( @@ -207,13 +284,13 @@ func _run() -> void: chat_panel.position.x * effective_scale, ] ) - if OS.has_environment("NETFISHING_UI_SCALE_CAPTURE"): + if OS.has_environment("straywild_UI_SCALE_CAPTURE"): await process_frame var capture: Image = root.get_texture().get_image() var capture_path: String = ( "%s-requested-%dx%d-actual-%dx%d.png" ) % [ - OS.get_environment("NETFISHING_UI_SCALE_CAPTURE"), + OS.get_environment("straywild_UI_SCALE_CAPTURE"), target_size.x, target_size.y, actual_size.x, diff --git a/tests/unified_inventory_validation.gd b/tests/unified_inventory_validation.gd new file mode 100644 index 0000000..6928969 --- /dev/null +++ b/tests/unified_inventory_validation.gd @@ -0,0 +1,288 @@ +extends SceneTree + +const ItemCatalogResource: ItemCatalog = preload( + "res://items/catalog/item_catalog.tres" +) +const Bluegill: FishData = preload( + "res://fish/species/bluegill/bluegill.tres" +) +const MainShopBuyer: FishBuyerProfile = preload( + "res://economy/buyers/main_fishing_shop.tres" +) +const FishCatalogResource: FishPool = preload( + "res://fish/pools/fish_catalog.tres" +) + + +func _initialize() -> void: + call_deferred("_run") + + +func _run() -> void: + var root := Node.new() + get_root().add_child(root) + var bag := PlayerBag.new() + var catches := FishInventory.new() + var capacity := PlayerCoolerCapacity.new() + var layout := PlayerInventoryLayout.new() + var hotbar := PlayerHotbar.new() + for node: Node in [bag, catches, capacity, layout, hotbar]: + root.add_child(node) + bag.setup(ItemCatalogResource) + layout.setup(bag, catches, ItemCatalogResource, capacity) + bag.set_inventory_layout(layout) + catches.set_inventory_layout(layout) + hotbar.setup(bag, ItemCatalogResource, catches, layout) + assert(PlayerInventoryLayout.INVENTORY_CAPACITIES == [9, 18, 27, 36]) + assert(PlayerCoolerCapacity.CAPACITIES == [9, 18, 27, 36, 45, 54, 63, 72]) + var basic_cube: ItemData = ItemCatalogResource.get_item_by_id(&"basic_cube") + assert(basic_cube != null) + assert(basic_cube.icon != null) + assert(basic_cube.hotbar_allowed) + assert(bag.add_item(&"basic_cube")) + assert(layout.is_item_in_inventory(&"basic_cube")) + assert(hotbar.assign_item(0, &"basic_cube")) + assert(hotbar.get_item_id(0) == &"basic_cube") + assert( + layout.get_container( + PlayerInventoryLayout.EntryKind.ITEM, + &"basic_cube", + ) == PlayerInventoryLayout.InventoryContainer.HOTBAR + ) + assert(hotbar.clear_slot(0)) + assert(layout.is_item_in_inventory(&"basic_cube")) + assert(bag.remove_item(&"basic_cube")) + var packed_decor_slot: int = hotbar.find_first_empty_slot() + assert(packed_decor_slot == 0) + assert(layout.prepare_new_item_placement( + &"basic_cube", + PlayerInventoryLayout.InventoryContainer.HOTBAR, + packed_decor_slot, + )) + assert(bag.add_item(&"basic_cube")) + assert( + layout.get_container( + PlayerInventoryLayout.EntryKind.ITEM, + &"basic_cube", + ) == PlayerInventoryLayout.InventoryContainer.HOTBAR + ) + assert(hotbar.assign_item(packed_decor_slot, &"basic_cube")) + assert(hotbar.select_slot(packed_decor_slot)) + assert(hotbar.get_selected_item_id() == &"basic_cube") + assert(bag.remove_item(&"basic_cube")) + + assert(bag.add_item(&"coffee", 3)) + assert(layout.get_inventory_count() == 1) + assert(layout.get_inventory_capacity() == 9) + assert(layout.get_hotbar_count() == 0) + assert(hotbar.assign_item(2, &"coffee")) + assert(layout.get_inventory_count() == 0) + assert(layout.get_hotbar_count() == 1) + assert( + layout.get_container(PlayerInventoryLayout.EntryKind.ITEM, &"coffee") + == PlayerInventoryLayout.InventoryContainer.HOTBAR + ) + assert(hotbar.clear_slot(2)) + assert(layout.get_inventory_count() == 1) + assert(layout.get_hotbar_count() == 0) + + var fish_catch := FishCatch.new() + fish_catch.fish = Bluegill + fish_catch.fish_id = Bluegill.id + fish_catch.catch_id = &"bluegill:unified_inventory_test" + fish_catch.weight_lb = Bluegill.get_minimum_weight() + fish_catch.display_scale = Bluegill.get_display_scale_for_weight( + fish_catch.weight_lb + ) + fish_catch.sale_value = Bluegill.get_sale_value_for_weight( + fish_catch.weight_lb + ) + fish_catch.quality = FishQuality.Tier.IMPRESSIVE + assert(catches.add_catch(fish_catch)) + assert(layout.get_inventory_count() == 2) + assert(layout.move_entry_to_first_free( + PlayerInventoryLayout.EntryKind.CATCH, + fish_catch.catch_id, + PlayerInventoryLayout.InventoryContainer.STORAGE, + )) + assert(layout.get_inventory_count() == 1) + assert(layout.get_storage_count() == 1) + assert(layout.get_storage_capacity() == 9) + var inventory_grid := GeneralInventoryGrid.new() + root.add_child(inventory_grid) + inventory_grid.set_slot_presentation(Vector2(78.0, 78.0), 10) + inventory_grid.setup( + layout, + bag, + catches, + hotbar, + ItemCatalogResource, + PlayerInventoryLayout.InventoryContainer.INVENTORY, + ) + var all_inventory_slots: Array = inventory_grid.get("_slots") + assert(all_inventory_slots.size() == 36) + assert(inventory_grid.get_slots().size() == 9) + for slot_index: int in all_inventory_slots.size(): + var slot := all_inventory_slots[slot_index] as GeneralInventorySlot + assert(slot.custom_minimum_size == Vector2(78.0, 78.0)) + assert(slot.disabled == (slot_index >= 9)) + assert(slot.tooltip_text.is_empty()) + var normal := slot.get_theme_stylebox("normal") as StyleBoxFlat + assert(normal != null and normal.corner_radius_top_left == 39) + var locked_slot := all_inventory_slots[9] as GeneralInventorySlot + var locked_icon := locked_slot.get("_icon") as TextureRect + assert(locked_icon != null) + assert(is_equal_approx(locked_icon.size.x, 24.0)) + assert(is_equal_approx(locked_icon.size.y, 24.0)) + assert(is_equal_approx(locked_icon.modulate.a, 0.18)) + var staged_slot := all_inventory_slots[0] as GeneralInventorySlot + staged_slot.set_staged(true) + assert( + (staged_slot.get_theme_stylebox("normal") as StyleBoxFlat).bg_color + == Color(UtilityPageStyle.OCEAN_SELECTED, 0.92) + ) + staged_slot.set_staged(false) + var quality_slot := GeneralInventorySlot.new() + root.add_child(quality_slot) + quality_slot.set_presentation_size(Vector2(78.0, 78.0)) + quality_slot.configure( + 0, + PlayerInventoryLayout.InventoryContainer.STORAGE, + false, + layout, + bag, + catches, + hotbar, + ItemCatalogResource, + ) + assert(quality_slot.entry_identity == fish_catch.catch_id) + assert( + (quality_slot.get_theme_stylebox("normal") as StyleBoxFlat).bg_color + == GeneralInventorySlot.quality_background_color( + FishQuality.Tier.IMPRESSIVE, + GeneralInventorySlot.QualityEmphasis.NORMAL, + ) + ) + quality_slot.set_staged(true) + assert( + (quality_slot.get_theme_stylebox("normal") as StyleBoxFlat).bg_color + == GeneralInventorySlot.quality_background_color( + FishQuality.Tier.IMPRESSIVE, + GeneralInventorySlot.QualityEmphasis.SELECTED, + ) + ) + var distinct_quality_colors: Dictionary[Color, bool] = {} + for quality: int in FishQuality.TIER_COUNT: + var quality_color := GeneralInventorySlot.quality_background_color( + quality, + GeneralInventorySlot.QualityEmphasis.NORMAL, + ) + assert(not distinct_quality_colors.has(quality_color)) + distinct_quality_colors[quality_color] = true + assert(distinct_quality_colors.size() == FishQuality.TIER_COUNT) + var sale_tray_slot := ShopSaleTraySlot.new() + root.add_child(sale_tray_slot) + sale_tray_slot.configure( + "catch:%s" % fish_catch.catch_id, + fish_catch.fish.display_texture, + fish_catch.fish.display_name, + 1, + fish_catch.quality, + ) + assert( + sale_tray_slot.custom_minimum_size + == GeneralInventoryGrid.DEFAULT_SLOT_SIZE + ) + var sale_tray_style := sale_tray_slot.get_theme_stylebox( + "normal" + ) as StyleBoxFlat + assert(sale_tray_style != null) + assert(sale_tray_style.corner_radius_top_left == 26) + var expected_tray_quality_color := ( + GeneralInventorySlot.quality_background_color( + FishQuality.Tier.IMPRESSIVE, + GeneralInventorySlot.QualityEmphasis.NORMAL, + ) + ) + expected_tray_quality_color.a = 0.96 + assert(sale_tray_style.bg_color == expected_tray_quality_color) + var wallet := PlayerWallet.new() + root.add_child(wallet) + assert(wallet.restore_balance(15000)) + assert(layout.get_next_backpack_cost() == 1500) + assert(layout.purchase_backpack(wallet)) + assert(layout.get_inventory_capacity() == 18) + assert(inventory_grid.get_slots().size() == 18) + assert(layout.get_next_backpack_cost() == 4500) + assert(layout.purchase_backpack(wallet)) + assert(layout.get_inventory_capacity() == 27) + assert(inventory_grid.get_slots().size() == 27) + assert(layout.get_next_backpack_cost() == 9000) + assert(layout.purchase_backpack(wallet)) + assert(layout.get_inventory_capacity() == 36) + assert(inventory_grid.get_slots().size() == 36) + assert(layout.get_next_backpack_cost() == -1) + var storage_grid := GeneralInventoryGrid.new() + root.add_child(storage_grid) + storage_grid.setup( + layout, + bag, + catches, + hotbar, + ItemCatalogResource, + PlayerInventoryLayout.InventoryContainer.STORAGE, + ) + var all_storage_slots: Array = storage_grid.get("_slots") + assert(all_storage_slots.size() == 72) + assert(storage_grid.get_slots().size() == 9) + assert( + (all_storage_slots[9] as GeneralInventorySlot).accessibility_name + == "locked storage slot 10" + ) + var storage_wallet := PlayerWallet.new() + root.add_child(storage_wallet) + assert(storage_wallet.restore_balance(9500)) + for expected_capacity: int in [18, 27, 36, 45, 54, 63, 72]: + assert(capacity.purchase(storage_wallet)) + assert(layout.get_storage_capacity() == expected_capacity) + assert(storage_grid.get_slots().size() == expected_capacity) + assert(capacity.get_next_capacity() == -1) + assert(capacity.get_next_cost() == -1) + + var saved := layout.to_save_data() + assert(layout.move_entry_to_first_free( + PlayerInventoryLayout.EntryKind.ITEM, + &"coffee", + PlayerInventoryLayout.InventoryContainer.STORAGE, + )) + assert(layout.restore_from_save_data(saved)) + assert(layout.is_item_in_inventory(&"coffee")) + assert( + layout.get_container( + PlayerInventoryLayout.EntryKind.CATCH, + fish_catch.catch_id, + ) == PlayerInventoryLayout.InventoryContainer.STORAGE + ) + + var network_sale := NetworkSaleService.new() + var session := NetworkSession.new() + root.add_child(session) + root.add_child(network_sale) + network_sale.set("_session", session) + network_sale.set("_item_catalog", ItemCatalogResource) + network_sale.set("_fish_catalog", FishCatalogResource) + var result: Dictionary = network_sale.call( + "_build_authoritative_result", + 1, + "mixed_sale_test", + [], + [{"item_id": "coffee", "quantity": 2}], + MainShopBuyer, + ) + assert(bool(result.get("accepted", false))) + assert(int(result.get("payout", -1)) == 20) + assert((result.get("items", []) as Array).size() == 1) + + print("Unified inventory validation: PASS") + root.free() + quit() diff --git a/tests/unified_inventory_validation.gd.uid b/tests/unified_inventory_validation.gd.uid new file mode 100644 index 0000000..baaf9c3 --- /dev/null +++ b/tests/unified_inventory_validation.gd.uid @@ -0,0 +1 @@ +uid://osuf2xa2bxht diff --git a/tests/world_layout_multiplayer_validation.gd b/tests/world_layout_multiplayer_validation.gd new file mode 100644 index 0000000..51e7be6 --- /dev/null +++ b/tests/world_layout_multiplayer_validation.gd @@ -0,0 +1,126 @@ +extends SceneTree + +const MainScene: PackedScene = preload("res://main/main.tscn") +const TEST_PORT: int = 18155 +const TEST_SEED: int = 86421357 + + +func _initialize() -> void: + call_deferred("_run") + + +func _run() -> void: + var arguments: PackedStringArray = OS.get_cmdline_user_args() + if arguments.has("host"): + await _run_host() + return + if arguments.has("client"): + await _run_client() + return + push_error("World layout multiplayer validation needs host or client mode.") + quit(1) + + +func _run_host() -> void: + var main: Node = await _create_initialized_main() + var session := main.get_node("%NetworkSession") as NetworkSession + var save_manager := main.get("_save_manager") as PlayerSaveManager + assert(bool(main.call( + "_apply_world", + WorldLayout.STARTER_ISLAND, + TEST_SEED, + true, + ))) + assert(bool(main.call( + "_prepare_host_world", + WorldLayout.STARTER_ISLAND, + TEST_SEED, + ))) + assert(save_manager.initialize_new_game( + TEST_SEED, + WorldLayout.STARTER_ISLAND, + )) + assert(session.start_private_host(TEST_PORT)) + main.call("_enter_gameplay") + assert(session.set_host_open(true)) + var remote_peer_id: int = await _wait_for_remote_peer(session) + assert(remote_peer_id > 1) + assert(session.peer_supports_capability( + remote_peer_id, + NetworkProtocol.WORLD_LAYOUT_CAPABILITY, + )) + var disconnect_deadline: int = Time.get_ticks_msec() + 12000 + while ( + Time.get_ticks_msec() < disconnect_deadline + and session.is_authenticated_peer(remote_peer_id) + ): + await process_frame + assert(not session.is_authenticated_peer(remote_peer_id)) + print("World layout multiplayer host validation: PASS") + await _cleanup(main, session) + + +func _run_client() -> void: + var main: Node = await _create_initialized_main() + main.call( + "_on_title_join_game_requested", + "127.0.0.1:%d" % TEST_PORT, + ) + var session := main.get_node("%NetworkSession") as NetworkSession + var deadline: int = Time.get_ticks_msec() + 20000 + while Time.get_ticks_msec() < deadline: + await process_frame + if session.state == NetworkSession.State.VERIFYING_SERVER_IDENTITY: + main.call("_confirm_server_trust") + if session.is_joined_client() and bool(main.get("_gameplay_started")): + break + assert(session.is_joined_client()) + assert(session.supports_server_capability( + NetworkProtocol.WORLD_LAYOUT_CAPABILITY + )) + var metadata: Dictionary = session.get_last_server_metadata() + assert(str(metadata.get("world_layout", "")) == String( + WorldLayout.STARTER_ISLAND + )) + assert(int(metadata.get("world_seed", 0)) == TEST_SEED) + var world := main.get("_test_world") as TestWorld + assert(world.get_world_layout() == WorldLayout.STARTER_ISLAND) + assert(world.get_generation_seed() == TEST_SEED) + assert(world.get_node_or_null("Regions/StarterIslandRegion") != null) + assert(world.get_fishing_shop() != null) + assert(world.get_player_storage() != null) + print("World layout multiplayer client validation: PASS") + await _cleanup(main, session) + + +func _create_initialized_main() -> Node: + root.size = Vector2i(1280, 720) + var main: Node = MainScene.instantiate() + root.add_child(main) + for _frame: int in 4: + await process_frame + if not bool(main.get("_application_initialized")): + main.call("_activate_selected_data_path", "", true) + for _frame: int in 8: + await process_frame + assert(bool(main.get("_application_initialized"))) + return main + + +func _wait_for_remote_peer(session: NetworkSession) -> int: + var deadline: int = Time.get_ticks_msec() + 20000 + while Time.get_ticks_msec() < deadline: + await process_frame + for peer_id: int in session.get_authenticated_peer_ids(): + if peer_id != session.get_local_peer_id(): + return peer_id + return 0 + + +func _cleanup(main: Node, session: NetworkSession) -> void: + session.disconnect_session("") + main.queue_free() + for _frame: int in 4: + await process_frame + await create_timer(0.1).timeout + quit() diff --git a/tests/world_layout_multiplayer_validation.gd.uid b/tests/world_layout_multiplayer_validation.gd.uid new file mode 100644 index 0000000..e666cb2 --- /dev/null +++ b/tests/world_layout_multiplayer_validation.gd.uid @@ -0,0 +1 @@ +uid://bg52pbgv5ykjc diff --git a/tests/world_layout_validation.gd b/tests/world_layout_validation.gd new file mode 100644 index 0000000..e6eec39 --- /dev/null +++ b/tests/world_layout_validation.gd @@ -0,0 +1,159 @@ +extends SceneTree + +const TestWorldScene: PackedScene = preload("res://world/test_world.tscn") +const SetupPageScene: PackedScene = preload( + "res://ui/new_game_setup_page.tscn" +) + + +func _initialize() -> void: + call_deferred("_run") + + +func _run() -> void: + root.size = Vector2i(1280, 720) + _validate_layout_values() + await _validate_setup_page() + await _validate_world_switching() + _validate_network_metadata() + print("World layout validation: PASS") + quit() + + +func _validate_layout_values() -> void: + assert(WorldLayout.is_valid(WorldLayout.GENERATED)) + assert(WorldLayout.is_valid(String(WorldLayout.STARTER_ISLAND))) + assert(not WorldLayout.is_valid(&"unknown")) + assert(WorldLayout.normalized("unknown") == WorldLayout.GENERATED) + assert(WorldLayout.display_name(WorldLayout.STARTER_ISLAND) == "starter island") + + +func _validate_setup_page() -> void: + assert(NewGameSetupPage.parse_seed_text(" 24680 ") == 24680) + assert(NewGameSetupPage.parse_seed_text("0") == 0) + assert(NewGameSetupPage.parse_seed_text("2147483647") == 0) + assert(NewGameSetupPage.parse_seed_text("") == 0) + var text_seed: int = NewGameSetupPage.parse_seed_text("voyager island") + assert(text_seed > 0 and text_seed <= PlayerSaveManager.MAX_WORLD_SEED) + assert(NewGameSetupPage.parse_seed_text(" voyager island ") == text_seed) + assert(NewGameSetupPage.parse_seed_text("voyager island") == text_seed) + assert(NewGameSetupPage.parse_seed_text("Voyager Island") != text_seed) + var page := SetupPageScene.instantiate() as NewGameSetupPage + root.add_child(page) + await process_frame + page.open_page(true) + await process_frame + assert(page.visible) + var paper := page.get_node("%Paper") as PanelContainer + assert(paper.get_combined_minimum_size().x <= paper.size.x) + assert(paper.get_combined_minimum_size().y <= paper.size.y) + assert(page.get_selected_world_layout() == WorldLayout.GENERATED) + assert(page.get_selected_world_seed() > 0) + assert((page.get_node("%OverwriteWarning") as Label).visible) + var generated_button := page.get_node("%GeneratedButton") as Button + var starter_button := page.get_node("%StarterButton") as Button + var random_button := page.get_node("%RandomSeedButton") as Button + var custom_button := page.get_node("%CustomSeedButton") as Button + var seed_edit := page.get_node("%SeedEdit") as LineEdit + var start_button := page.get_node("%StartButton") as Button + var back_button := page.get_node("%BackButton") as Button + assert(generated_button.get_node(generated_button.focus_neighbor_right) == starter_button) + assert(generated_button.get_node(generated_button.focus_neighbor_bottom) == random_button) + assert(random_button.get_node(random_button.focus_neighbor_right) == custom_button) + assert(start_button.get_node(start_button.focus_neighbor_right) == back_button) + page.call("_choose_custom_seed") + assert(seed_edit.editable) + assert(custom_button.get_node(custom_button.focus_neighbor_bottom) == seed_edit) + assert(seed_edit.get_node(seed_edit.focus_neighbor_bottom) == start_button) + page.call("_set_world_layout", WorldLayout.STARTER_ISLAND) + assert(not (page.get_node("%SeedSection") as Control).visible) + var request: Dictionary = {} + page.start_requested.connect(func(layout: StringName, seed: int) -> void: + request["layout"] = layout + request["seed"] = seed + ) + page.call("_request_start") + assert(request.get("layout") == WorldLayout.STARTER_ISLAND) + assert(int(request.get("seed", 0)) > 0) + page.queue_free() + await process_frame + + +func _validate_world_switching() -> void: + var world := TestWorldScene.instantiate() as TestWorld + root.add_child(world) + await process_frame + assert(world.get_world_layout() == WorldLayout.GENERATED) + var initial_generator := world.get_node( + "Regions/GeneratedWorldRegion/Terrain/TerrainChunkGenerator" + ) as TerrainChunkGenerator + assert(initial_generator != null) + assert(initial_generator.get_generated_chunks_root() == null) + assert(world.get_fishing_shop() != null) + assert(world.get_player_storage() != null) + _validate_world_boundary_clearance(world) + assert(world.activate_world(WorldLayout.STARTER_ISLAND, 13579)) + assert(world.get_world_layout() == WorldLayout.STARTER_ISLAND) + assert(world.get_generation_seed() == 13579) + assert(world.get_node_or_null("Regions/StarterIslandRegion") != null) + assert(world.get_node_or_null("Regions/GeneratedWorldRegion") == null) + assert(world.get_fishing_shop() != null) + assert(world.get_player_storage() != null) + assert(not world.get_fishable_water_regions().is_empty()) + var starter_safe_points := world.get_safe_respawn_points() + assert(not starter_safe_points.is_empty()) + var authored_safe_point: SafeRespawnPoint = starter_safe_points.back() + assert( + world.get_water_recovery_position( + authored_safe_point.global_position + ).is_equal_approx(authored_safe_point.global_position) + ) + assert(world.activate_world(WorldLayout.GENERATED, 24680)) + assert(world.get_world_layout() == WorldLayout.GENERATED) + assert(world.get_generation_seed() == 24680) + assert(world.get_node_or_null("Regions/GeneratedWorldRegion") != null) + assert(world.get_node_or_null("Regions/StarterIslandRegion") == null) + world.queue_free() + await process_frame + + +func _validate_world_boundary_clearance(world: TestWorld) -> void: + var active_region := world.get("_active_region") as WorldRegion + assert(active_region != null) + var half := active_region.get_playable_half_extents() + var north := world.get_node("WorldBounds/North") as StaticBody3D + var south := world.get_node("WorldBounds/South") as StaticBody3D + var west := world.get_node("WorldBounds/West") as StaticBody3D + var east := world.get_node("WorldBounds/East") as StaticBody3D + var fishing_defaults := FishingSpot.new() + assert( + TestWorld.WORLD_BOUNDARY_SHORELINE_CLEARANCE + > fishing_defaults.maximum_cast_distance + 1.0 + ) + fishing_defaults.free() + assert(north.position.z - half.y >= 18.0) + assert(-south.position.z - half.y >= 18.0) + assert(-west.position.x - half.x >= 18.0) + assert(east.position.x - half.x >= 18.0) + + +func _validate_network_metadata() -> void: + var hello: Dictionary = NetworkProtocol.make_server_hello( + true, + NetworkProtocol.RejectionCode.NONE, + "session", + 2, + 1, + 16, + "room", + 97531, + WorldLayout.STARTER_ISLAND, + ) + assert(str(hello.get("world_layout", "")) == String( + WorldLayout.STARTER_ISLAND + )) + assert(int(hello.get("world_seed", 0)) == 97531) + assert( + NetworkProtocol.WORLD_LAYOUT_CAPABILITY + in PackedStringArray(hello.get("capability_flags", [])) + ) diff --git a/tests/world_layout_validation.gd.uid b/tests/world_layout_validation.gd.uid new file mode 100644 index 0000000..9002c58 --- /dev/null +++ b/tests/world_layout_validation.gd.uid @@ -0,0 +1 @@ +uid://bgxgyqq73sdpi diff --git a/tests/world_spawn_multiplayer_validation.gd b/tests/world_spawn_multiplayer_validation.gd index 5378188..45be081 100644 --- a/tests/world_spawn_multiplayer_validation.gd +++ b/tests/world_spawn_multiplayer_validation.gd @@ -1,8 +1,20 @@ extends SceneTree const MainScene: PackedScene = preload("res://main/main.tscn") -const TEST_PORT: int = 18141 -const EXPECTED_POPULATION: int = 2 +const TEST_PORT: int = 18170 +const EXPECTED_POPULATION: int = 8 +const EXPECTED_BY_TYPE: Dictionary = { + &"crab_brown": 2, + &"clam_manila": 3, + &"beetle_stag_common": 3, +} +const WINTER_POPULATION: int = 5 +const WINTER_BY_TYPE: Dictionary = { + &"crab_brown": 2, + &"clam_manila": 3, +} +const SUMMER_DATE_ID: String = "2026-08-18" +const WINTER_DATE_ID: String = "2026-12-18" func _initialize() -> void: @@ -25,9 +37,17 @@ func _run_host() -> void: var main: Node = await _create_initialized_main() var session := main.get_node("%NetworkSession") as NetworkSession var service: Node = main.get_node("%NetworkWorldSpawnService") + var world_time := main.get_node("%WorldTimeService") as WorldTimeService + assert(bool(main.call( + "_apply_world", WorldLayout.STARTER_ISLAND, 1, true + ))) + assert(session.set_host_world(WorldLayout.STARTER_ISLAND, 1)) assert(session.start_dedicated_host(TEST_PORT, 8, "127.0.0.1")) + assert(world_time.synchronize_calendar_time(12.0, SUMMER_DATE_ID)) + assert(world_time.set_authoritative_time(12.0)) assert(session.set_host_open(true)) - await _wait_for_population(service) + await _wait_for_population(service, EXPECTED_POPULATION) + _freeze_timed_entries(service) _validate_population(service, true) var remote_peer_id: int = 0 @@ -43,6 +63,14 @@ func _run_host() -> void: remote_peer_id, NetworkProtocol.WORLD_SPAWN_CAPABILITY, )) + await create_timer(0.75).timeout + assert(world_time.synchronize_calendar_time(12.0, WINTER_DATE_ID)) + await _wait_for_population(service, WINTER_POPULATION) + _validate_population(service, true, WINTER_BY_TYPE) + await create_timer(0.75).timeout + assert(world_time.synchronize_calendar_time(12.0, SUMMER_DATE_ID)) + await _wait_for_population(service, EXPECTED_POPULATION) + _validate_population(service, true) var disconnect_deadline: int = Time.get_ticks_msec() + 12000 while ( @@ -70,6 +98,7 @@ func _run_client() -> void: ) var session := main.get_node("%NetworkSession") as NetworkSession var service: Node = main.get_node("%NetworkWorldSpawnService") + var world_time := main.get_node("%WorldTimeService") as WorldTimeService var join_deadline: int = Time.get_ticks_msec() + 20000 while Time.get_ticks_msec() < join_deadline: await process_frame @@ -81,8 +110,14 @@ func _run_client() -> void: assert(session.supports_server_capability( NetworkProtocol.WORLD_SPAWN_CAPABILITY )) - await _wait_for_population(service) + await _wait_for_population(service, EXPECTED_POPULATION) _validate_population(service, false) + await _wait_for_population(service, WINTER_POPULATION) + _validate_population(service, false, WINTER_BY_TYPE) + assert(world_time.get_calendar_date_id() == WINTER_DATE_ID) + await _wait_for_population(service, EXPECTED_POPULATION) + _validate_population(service, false) + assert(world_time.get_calendar_date_id() == SUMMER_DATE_ID) print("World spawn multiplayer client validation: PASS") session.disconnect_session("") main.queue_free() @@ -92,52 +127,80 @@ func _run_client() -> void: quit() -func _wait_for_population(service: Node) -> void: +func _wait_for_population(service: Node, expected_population: int) -> void: var deadline: int = Time.get_ticks_msec() + 12000 while Time.get_ticks_msec() < deadline: await process_frame - if (service.get("_entities") as Dictionary).size() == EXPECTED_POPULATION: + if (service.get("_entities") as Dictionary).size() == expected_population: return assert(false, "Timed out waiting for the world spawn population.") -func _validate_population(service: Node, expect_authoritative_state: bool) -> void: +func _validate_population( + service: Node, + expect_authoritative_state: bool, + expected_by_type: Dictionary = EXPECTED_BY_TYPE, +) -> void: var entities: Dictionary = service.get("_entities") var presentations: Dictionary = service.get("_presentations") - assert(entities.size() == EXPECTED_POPULATION) - assert(presentations.size() == EXPECTED_POPULATION) + var expected_population: int = 0 + for amount: int in expected_by_type.values(): + expected_population += amount + assert(entities.size() == expected_population) + assert(presentations.size() == expected_population) + var counts: Dictionary = {} for state: Dictionary in entities.values(): - assert(state.get("type_id") == &"crab_brown") + var type_id := state.get("type_id") as StringName + counts[type_id] = int(counts.get(type_id, 0)) + 1 var position: Variant = state.get("position") assert(typeof(position) == TYPE_VECTOR3) assert((position as Vector3).is_finite()) - assert((position as Vector3).y > 0.08) + var entry := state.get("data") as GatherableData + assert(entry != null) + assert( + (position as Vector3).y + >= entry.minimum_surface_y - 0.001 + ) if expect_authoritative_state: var quality: int = int(state.get("quality", -1)) assert(FishQuality.is_valid(quality)) - var entry := state.get("data") as GatherableData - assert(entry != null) - assert(entry.get_movement_speed_for_quality(quality) > 0.0) - assert(entry.get_scare_radius_for_quality(quality) > 0.0) + if entry.is_stationary_spawn(): + assert(entry.get_movement_speed_for_quality(quality) <= 0.0) + assert(not entry.can_be_scared()) + else: + assert(entry.get_movement_speed_for_quality(quality) > 0.0) + assert(entry.get_scare_radius_for_quality(quality) > 0.0) + assert(counts == expected_by_type) + + +func _freeze_timed_entries(service: Node) -> void: + for state: Dictionary in (service.get("_entities") as Dictionary).values(): + var entry := state.get("data") as GatherableData + if entry != null and entry.active_lifetime_seconds > 0.0: + state["expires_at"] = INF func _validate_respawn_budget(service: Node) -> void: var entities: Dictionary = service.get("_entities") - var entity_ids: Array = entities.keys() - assert(entity_ids.size() == EXPECTED_POPULATION) - for entity_id: Variant in entity_ids: + var crab_ids: Array[String] = [] + for entity_id: String in entities: + var state: Dictionary = entities[entity_id] + if state.get("type_id") == &"crab_brown": + crab_ids.append(entity_id) + assert(crab_ids.size() == 2) + for entity_id: String in crab_ids: service.call( "_despawn_entity", - str(entity_id), + entity_id, &"captured", false, true, ) - assert((service.get("_entities") as Dictionary).is_empty()) + assert((service.get("_entities") as Dictionary).size() == 6) var now: float = Time.get_ticks_msec() / 1000.0 var respawns: Array = service.get("_respawns") - assert(respawns.size() == EXPECTED_POPULATION) + assert(respawns.size() == crab_ids.size()) for index: int in respawns.size(): var respawn: Dictionary = respawns[index] var delay: float = float(respawn.get("due", 0.0)) - now @@ -146,19 +209,20 @@ func _validate_respawn_budget(service: Node) -> void: respawns[index] = respawn service.call("_update_respawns") - assert((service.get("_entities") as Dictionary).size() == 1) + assert((service.get("_entities") as Dictionary).size() == 7) assert((service.get("_respawns") as Array).size() == 1) var next_by_type: Dictionary = service.get("_next_respawn_by_type") var next_allowed: float = float(next_by_type.get(&"crab_brown", 0.0)) assert(next_allowed - now >= 179.0) service.call("_update_respawns") - assert((service.get("_entities") as Dictionary).size() == 1) + assert((service.get("_entities") as Dictionary).size() == 7) assert((service.get("_respawns") as Array).size() == 1) next_by_type[&"crab_brown"] = now - 1.0 service.call("_update_respawns") - assert((service.get("_entities") as Dictionary).size() == 2) + assert((service.get("_entities") as Dictionary).size() == 8) assert((service.get("_respawns") as Array).is_empty()) + _validate_population(service, true) func _create_initialized_main() -> Node: diff --git a/tests/world_spawn_protocol_validation.gd b/tests/world_spawn_protocol_validation.gd index c9de51c..0840f2d 100644 --- a/tests/world_spawn_protocol_validation.gd +++ b/tests/world_spawn_protocol_validation.gd @@ -4,16 +4,30 @@ const Gatherables: GatherableCatalog = preload( "res://gathering/catalog/gatherable_catalog.tres" ) const FishCatalog: FishPool = preload("res://fish/pools/fish_catalog.tres") +const GatheringControllerType = preload( + "res://gathering/gathering_controller.gd" +) +const WorldGatherableType = preload("res://gathering/world_gatherable.gd") + +const CRAB_PIXEL_SIZE: float = 0.0005 +const REDUCED_CATCH_RING_RADIUS: float = 0.175 +const NET_STRIKE_MARKER_DISTANCE: float = 0.85 +const CalendarSeasonType = preload("res://world/calendar_season.gd") func _initialize() -> void: - assert(NetworkProtocol.PROTOCOL_VERSION == 6) + call_deferred(&"_run") + + +func _run() -> void: + assert(NetworkProtocol.PROTOCOL_VERSION == 12) assert( NetworkWorldSpawnProtocol.CAPABILITY == NetworkProtocol.WORLD_SPAWN_CAPABILITY ) assert(NetworkWorldSpawnProtocol.SNAPSHOT_ENTITIES_PER_ENVELOPE <= 4) _validate_catalog_statuses() + await _validate_billboard_presentation() _validate_envelopes() print("World spawn protocol validation: PASS") quit() @@ -27,6 +41,12 @@ func _validate_catalog_statuses() -> void: assert(brown.catch_data.logbook_section == FishData.LogbookSection.SHELLFISH) assert(brown.population == 2) assert(is_equal_approx(brown.charge_duration, 2.0)) + assert( + is_equal_approx( + brown.sprite_pixel_size, + CRAB_PIXEL_SIZE, + ) + ) _validate_quality_behavior(brown) assert(is_equal_approx(brown.capture_respawn_min_seconds, 480.0)) assert(is_equal_approx(brown.capture_respawn_max_seconds, 720.0)) @@ -34,8 +54,37 @@ func _validate_catalog_statuses() -> void: assert(is_equal_approx(brown.scare_respawn_max_seconds, 90.0)) assert(is_equal_approx(brown.minimum_respawn_spacing_seconds, 180.0)) assert(brown.required_tool_id == &"crab_net") + assert(is_equal_approx(brown.minimum_surface_y, -0.44)) assert(FishCatalog.get_fish_by_id(&"crab_brown") == brown.catch_data) assert(not brown.catch_data.is_fishable()) + var clam: GatherableData = Gatherables.get_entry(&"clam_manila") + assert(clam != null and clam.is_available()) + assert(clam.catch_data.collection_method == FishData.CollectionMethod.DIGGING) + assert(clam.catch_data.logbook_section == FishData.LogbookSection.SHELLFISH) + assert(clam.required_tool_id == &"standard_shovel") + assert(clam.diggable_area_id == &"starter_beach") + assert(clam.presentation_mode == GatherableData.PresentationMode.WATER_SPURT) + assert(clam.is_stationary_hotspot()) + assert(not clam.requires_sneaking) + assert(not clam.can_be_scared()) + assert(is_equal_approx(clam.active_lifetime_seconds, 10.0)) + assert(FishCatalog.get_fish_by_id(&"clam_manila") == clam.catch_data) + assert(not clam.catch_data.is_fishable()) + var beetle: GatherableData = Gatherables.get_entry(&"beetle_stag_common") + assert(beetle != null and beetle.is_available()) + assert(beetle.is_available(CalendarSeasonType.Season.SUMMER)) + assert(not beetle.is_available(CalendarSeasonType.Season.WINTER)) + assert(beetle.catch_data.collection_method == FishData.CollectionMethod.NET) + assert(beetle.required_tool_id == &"crab_net") + assert(beetle.spawn_anchor_set_id == &"starter_reachable_tree_trunks") + assert(is_equal_approx(beetle.spawn_anchor_occupancy_ratio, 0.35)) + assert(beetle.maximum_anchor_population == 64) + assert(beetle.is_stationary_spawn()) + assert(not beetle.is_stationary_hotspot()) + assert(not beetle.requires_sneaking) + assert(not beetle.can_be_scared()) + assert(FishCatalog.get_fish_by_id(&"beetle_stag_common") == beetle.catch_data) + assert(not beetle.catch_data.is_fishable()) for type_id: StringName in [ &"crab_ghost", @@ -47,6 +96,12 @@ func _validate_catalog_statuses() -> void: assert(entry.is_valid()) assert(not entry.catch_data.active) assert(not entry.is_available()) + assert( + is_equal_approx( + entry.sprite_pixel_size, + CRAB_PIXEL_SIZE, + ) + ) assert(entry.catch_data.collection_method == FishData.CollectionMethod.NET) assert( entry.catch_data.logbook_section @@ -54,8 +109,16 @@ func _validate_catalog_statuses() -> void: ) var available: Array[GatherableData] = Gatherables.get_available_entries() - assert(available.size() == 1) - assert(available.front() == brown) + assert(available.size() == 3) + assert(available.has(brown)) + assert(available.has(clam)) + assert(available.has(beetle)) + var winter_available: Array[GatherableData] = ( + Gatherables.get_available_entries(CalendarSeasonType.Season.WINTER) + ) + assert(winter_available.has(brown)) + assert(winter_available.has(clam)) + assert(not winter_available.has(beetle)) var rng := RandomNumberGenerator.new() rng.seed = 24680 var captured_delay: float = brown.get_respawn_delay(&"captured", rng) @@ -63,6 +126,75 @@ func _validate_catalog_statuses() -> void: assert(captured_delay >= 480.0 and captured_delay <= 720.0) assert(scared_delay >= 45.0 and scared_delay <= 90.0) + var gathering_controller := GatheringControllerType.new() + assert( + is_equal_approx( + gathering_controller.marker_radius, + REDUCED_CATCH_RING_RADIUS, + ) + ) + assert( + is_equal_approx( + gathering_controller.marker_distance, + NET_STRIKE_MARKER_DISTANCE, + ) + ) + gathering_controller.free() + + +func _validate_billboard_presentation() -> void: + var gatherable := WorldGatherableType.new() + gatherable.call("_ensure_visual") + var sprite := gatherable.get_node("GatherableSprite") as Sprite3D + assert(sprite != null) + assert(sprite.billboard == BaseMaterial3D.BILLBOARD_ENABLED) + assert(sprite.texture_filter == BaseMaterial3D.TEXTURE_FILTER_NEAREST) + assert(not sprite.shaded) + gatherable.free() + + var unconfigured_hotspot := WorldGatherableType.new() + unconfigured_hotspot.call("_ensure_water_spurt_visual") + assert( + unconfigured_hotspot.get_node_or_null( + "WaterSpurt/WaterDroplets" + ) == null + ) + unconfigured_hotspot.free() + + var clam: GatherableData = Gatherables.get_entry(&"clam_manila") + assert(clam != null) + var hotspot := WorldGatherableType.new() + root.add_child(hotspot) + var configured_position := Vector3(24.0, 0.3, -11.0) + hotspot.configure( + "world:clam-presentation-regression", + clam, + configured_position, + 0.0, + ) + assert(hotspot.global_position.is_equal_approx(configured_position)) + var hole := hotspot.get_node("WaterSpurt/BurrowMark") as MeshInstance3D + assert(hole != null) + assert(hole.cast_shadow == GeometryInstance3D.SHADOW_CASTING_SETTING_OFF) + var hole_material := hole.mesh.surface_get_material(0) as StandardMaterial3D + assert(hole_material != null) + assert(hole_material.shading_mode == BaseMaterial3D.SHADING_MODE_UNSHADED) + assert(hole_material.transparency == BaseMaterial3D.TRANSPARENCY_DISABLED) + assert(is_equal_approx(hole_material.albedo_color.a, 1.0)) + var particles := hotspot.get_node( + "WaterSpurt/WaterDroplets" + ) as CPUParticles3D + assert(particles != null and particles.emitting) + assert(particles.local_coords) + assert(particles.global_position.is_equal_approx( + configured_position + Vector3.UP * 0.035 + )) + hotspot.set_process(false) + await create_timer(0.6).timeout + await process_frame + assert(hotspot.get_node_or_null("WaterSpurt/WaterDroplets") == null) + hotspot.queue_free() + func _validate_quality_behavior(entry: GatherableData) -> void: var prior_speed: float = -1.0 diff --git a/tests/world_time_multiplayer_validation.gd b/tests/world_time_multiplayer_validation.gd index cebb0eb..635ad4f 100644 --- a/tests/world_time_multiplayer_validation.gd +++ b/tests/world_time_multiplayer_validation.gd @@ -30,20 +30,15 @@ func _run_host() -> void: var world_weather := ( main.get_node("%WorldWeatherService") as WorldWeatherService ) + assert(bool(main.call( + "_apply_world", WorldLayout.STARTER_ISLAND, 1, true + ))) + assert(session.set_host_world(WorldLayout.STARTER_ISLAND, 1)) assert(session.start_private_host(TEST_PORT)) - var game_ui := main.get_node("%GameUI") as CanvasLayer - var chat_ui := game_ui.get_node("%ChatUI") as ChatUI - assert(chat_ui.call("_handle_chat_command", "/weather clear")) - assert(world_weather.get_weather() == WorldWeatherService.Weather.SUNNY) - world_time.synchronize_time(INITIAL_HOST_TIME) - assert(is_equal_approx( - world_time.get_persistent_time_hours(), INITIAL_HOST_TIME + assert(world_time.set_authoritative_time(INITIAL_HOST_TIME)) + assert(world_weather.set_authoritative_weather( + WorldWeatherService.Weather.RAINY )) - assert(chat_ui.call("_handle_chat_command", "/weather rainy")) - assert( - world_weather.get_persistent_weather() - == WorldWeatherService.Weather.RAINY - ) assert(session.set_host_open(true)) var remote_peer_id: int = 0 @@ -61,35 +56,15 @@ func _run_host() -> void: assert(session.peer_supports_capability( remote_peer_id, NetworkProtocol.WORLD_WEATHER_CAPABILITY )) - var remote_record: PeerRegistry.PeerRecord = session.get_peer_record( - remote_peer_id - ) - assert(remote_record != null and remote_record.identity_authenticated) - assert(session.set_peer_operator( - remote_peer_id, - remote_record.identity_fingerprint, - true, - )) assert(world_time.get_phase() == WorldTimeService.Phase.DUSK) - - var command_deadline: int = Time.get_ticks_msec() + 10000 - while ( - Time.get_ticks_msec() < command_deadline - and _wrapped_time_difference( - world_time.get_time_hours(), UPDATED_HOST_TIME - ) > TIME_TOLERANCE_HOURS - ): - await process_frame - assert(is_equal_approx( - world_time.get_persistent_time_hours(), UPDATED_HOST_TIME + assert(WorldTimeService.is_valid_calendar_date_id( + world_time.get_calendar_date_id() + )) + await create_timer(1.0).timeout + assert(world_time.set_authoritative_time(UPDATED_HOST_TIME)) + assert(world_weather.set_authoritative_weather( + WorldWeatherService.Weather.FOGGY )) - var fog_deadline: int = Time.get_ticks_msec() + 10000 - while Time.get_ticks_msec() < fog_deadline and not world_weather.is_foggy(): - await process_frame - assert( - world_weather.get_persistent_weather() - == WorldWeatherService.Weather.FOGGY - ) var disconnect_deadline: int = Time.get_ticks_msec() + 12000 while ( Time.get_ticks_msec() < disconnect_deadline @@ -131,12 +106,6 @@ func _run_client() -> void: assert(session.supports_server_capability( NetworkProtocol.WORLD_WEATHER_CAPABILITY )) - assert(world_time.restore_persistent_time_hours(15.25)) - assert(world_weather.restore_persistent_state( - WorldWeatherService.Weather.CLOUDY, - 222.0, - )) - var initial_deadline: int = Time.get_ticks_msec() + 8000 while ( Time.get_ticks_msec() < initial_deadline @@ -149,6 +118,10 @@ func _run_client() -> void: world_time.get_time_hours(), INITIAL_HOST_TIME ) <= TIME_TOLERANCE_HOURS) assert(world_time.get_phase() == WorldTimeService.Phase.DUSK) + var expected_date_id: String = WorldTimeService.date_id_from_datetime( + Time.get_datetime_dict_from_system(false) + ) + assert(world_time.get_calendar_date_id() == expected_date_id) var weather_deadline: int = Time.get_ticks_msec() + 8000 while ( Time.get_ticks_msec() < weather_deadline @@ -160,21 +133,48 @@ func _run_client() -> void: var chat_ui := game_ui.get_node("%ChatUI") as Control var clock_panel := chat_ui.get_node("WorldClockPanel") as PanelContainer var clock_label := clock_panel.get_node("WorldClockLabel") as Label + var calendar_panel := ( + chat_ui.get_node("WorldCalendarPanel") as PanelContainer + ) + var calendar_row := ( + calendar_panel.get_node("WorldCalendarRow") as HBoxContainer + ) + var calendar_label := ( + calendar_row.get_node("WorldCalendarLabel") as Label + ) + var calendar_balance := ( + calendar_row.get_node("WorldCalendarBalance") as CurrencyAmount + ) var weather_icon := chat_ui.get_node("WorldWeatherIcon") as WeatherIcon var chat_panel := chat_ui.get_node("ChatPanel") as PanelContainer assert(clock_panel.visible) assert(clock_label.text == world_time.get_clock_text()) assert(clock_label.text.ends_with(" pm")) + assert(calendar_panel.visible) + assert(calendar_label.text == world_time.get_calendar_text()) + assert(not calendar_label.text.is_empty()) + assert( + calendar_label.horizontal_alignment + == HORIZONTAL_ALIGNMENT_LEFT + ) + assert(calendar_label.size_flags_horizontal == Control.SIZE_EXPAND_FILL) + var player := chat_ui.get("_player") as Player + assert(calendar_balance.amount == player.wallet.get_balance()) + assert(player.wallet.credit(1)) + assert(calendar_balance.amount == player.wallet.get_balance()) assert(weather_icon.visible) assert(weather_icon.get_weather() == WorldWeatherService.Weather.RAINY) assert(is_equal_approx(clock_panel.position.y, 10.0)) assert(is_equal_approx(weather_icon.position.y, 10.0)) + assert(is_equal_approx( + calendar_panel.position.y, + clock_panel.position.y + + clock_panel.size.y + + ChatUI.CALENDAR_TOP_GAP, + )) + assert(calendar_panel.size.is_equal_approx(ChatUI.CALENDAR_SIZE)) assert(clock_panel.position.y + clock_panel.size.y < chat_panel.position.y) - var operator_deadline: int = Time.get_ticks_msec() + 10000 - while Time.get_ticks_msec() < operator_deadline and not session.is_local_operator(): - await process_frame - assert(session.is_local_operator()) - assert(chat_ui.call("_handle_chat_command", "/time night")) + assert(not chat_ui.has_method("_handle_chat_command")) var update_deadline: int = Time.get_ticks_msec() + 10000 while ( @@ -188,10 +188,7 @@ func _run_client() -> void: world_time.get_time_hours(), UPDATED_HOST_TIME ) <= TIME_TOLERANCE_HOURS) assert(world_time.get_phase() == WorldTimeService.Phase.NIGHT) - assert(is_equal_approx(world_time.get_persistent_time_hours(), 15.25)) assert(clock_label.text == world_time.get_clock_text()) - await create_timer(0.6).timeout - assert(chat_ui.call("_handle_chat_command", "/weather foggy")) var fog_deadline: int = Time.get_ticks_msec() + 8000 while ( Time.get_ticks_msec() < fog_deadline @@ -200,23 +197,21 @@ func _run_client() -> void: await process_frame assert(world_weather.is_foggy()) assert(weather_icon.get_weather() == WorldWeatherService.Weather.FOGGY) - assert( - world_weather.get_persistent_weather() - == WorldWeatherService.Weather.CLOUDY - ) - assert(is_equal_approx( - world_weather.get_persistent_seconds_remaining(), - 222.0, - )) chat_ui.call("set_dock_right", true) await process_frame assert(clock_panel.position.x > 1000.0) assert(weather_icon.position.x < clock_panel.position.x) + assert(is_equal_approx( + calendar_panel.position.x, weather_icon.position.x + )) assert(is_equal_approx(clock_panel.position.y, 10.0)) chat_ui.call("set_dock_right", false) await process_frame assert(clock_panel.position.x < 20.0) assert(weather_icon.position.x > clock_panel.position.x) + assert(is_equal_approx( + calendar_panel.position.x, clock_panel.position.x + )) assert(is_equal_approx(clock_panel.position.y, 10.0)) print("World time multiplayer client validation: PASS") session.disconnect_session("") diff --git a/tests/world_time_validation.gd b/tests/world_time_validation.gd index b043718..3caea2b 100644 --- a/tests/world_time_validation.gd +++ b/tests/world_time_validation.gd @@ -15,6 +15,7 @@ const FishableWaterRegionType = preload( "res://world/fishable_water_region.gd" ) const WeatherIconType = preload("res://ui/weather_icon.gd") +const CalendarSeasonType = preload("res://world/calendar_season.gd") const Catalog: FishPoolType = preload("res://fish/pools/fish_catalog.tres") const SaltWaterMaterial: ShaderMaterial = preload( @@ -29,6 +30,7 @@ func _initialize() -> void: func _run() -> void: _validate_clock_boundaries_and_duration() + _validate_system_clock_authority() _validate_persistent_host_clock() _validate_fishing_availability() _validate_fishing_spot_context() @@ -40,7 +42,63 @@ func _run() -> void: func _validate_clock_boundaries_and_duration() -> void: - assert(WorldTimeServiceType.REAL_SECONDS_PER_CYCLE == 3600.0) + assert(WorldTimeServiceType.REAL_SECONDS_PER_CYCLE == 86400.0) + assert(is_equal_approx( + WorldTimeServiceType.HOURS_PER_REAL_SECOND, + 1.0 / 3600.0, + )) + assert(is_equal_approx( + WorldTimeServiceType.time_hours_from_datetime({ + "hour": 17, "minute": 30, "second": 18, + }), + 17.505, + )) + assert( + WorldTimeServiceType.date_id_from_datetime({ + "year": 2026, "month": 8, "day": 18, + }) == "2026-08-18" + ) + assert(WorldTimeServiceType.is_valid_calendar_date_id("2026-08-18")) + assert(WorldTimeServiceType.is_valid_calendar_date_id("2028-02-29")) + assert(not WorldTimeServiceType.is_valid_calendar_date_id("2026-02-29")) + assert(not WorldTimeServiceType.is_valid_calendar_date_id("2026-13-01")) + assert(not WorldTimeServiceType.is_valid_calendar_date_id("2026-8-18")) + assert( + WorldTimeServiceType.format_calendar_date("2026-08-18") + == "tuesday, august 18" + ) + assert( + CalendarSeasonType.from_date_id("2026-03-01") + == CalendarSeasonType.Season.SPRING + ) + assert( + CalendarSeasonType.from_date_id("2026-06-01") + == CalendarSeasonType.Season.SUMMER + ) + assert( + CalendarSeasonType.from_date_id("2026-09-01") + == CalendarSeasonType.Season.FALL + ) + assert( + CalendarSeasonType.from_date_id("2026-12-01") + == CalendarSeasonType.Season.WINTER + ) + assert( + CalendarSeasonType.from_date_id("invalid") + == CalendarSeasonType.UNKNOWN + ) + assert( + WorldTimeServiceType.calendar_cycle_id_from_datetime({ + "year": 2026, "month": 8, "day": 18, + "hour": 7, "minute": 59, "second": 0, + }, WorldTimeServiceType.DAY_START_HOUR) == "2026-08-17" + ) + assert( + WorldTimeServiceType.calendar_cycle_id_from_datetime({ + "year": 2026, "month": 8, "day": 18, + "hour": 8, "minute": 0, "second": 0, + }, WorldTimeServiceType.DAY_START_HOUR) == "2026-08-18" + ) assert( WorldTimeServiceType.phase_for_hour(7.49) == WorldTimeServiceType.Phase.NIGHT @@ -71,12 +129,16 @@ func _validate_clock_boundaries_and_duration() -> void: var clock := WorldTimeServiceType.new() root.add_child(clock) - clock.begin_session(8.0) - clock.advance_time(1800.0) + clock.begin_test_session(8.0, "2026-08-18") + assert(clock.get_calendar_date_id() == "2026-08-18") + assert(clock.get_calendar_text() == "tuesday, august 18") + assert(clock.get_season() == CalendarSeasonType.Season.SUMMER) + assert(clock.get_season_text() == "summer") + clock.advance_time(12.0 * 60.0 * 60.0) assert(is_equal_approx(clock.get_time_hours(), 20.0)) assert(clock.is_night_period()) assert(clock.is_transition()) - clock.advance_time(1800.0) + clock.advance_time(12.0 * 60.0 * 60.0) assert(is_equal_approx(clock.get_time_hours(), 8.0)) assert(not clock.is_night_period()) assert(clock.is_transition()) @@ -88,10 +150,10 @@ func _validate_clock_boundaries_and_duration() -> void: func(time_hours: float, _phase: WorldTimeService.Phase) -> void: emitted_times.append(time_hours) ) - clock.begin_session(12.0 + 31.0 / 60.0) + clock.begin_test_session(12.0 + 31.0 / 60.0) emitted_times.clear() - for _frame: int in 1201: - clock.advance_time(1.0 / 240.0) + for _frame: int in 7201: + clock.advance_time(1.0 / 60.0) assert(clock.get_clock_text() == "12:33 pm") assert(emitted_times.size() >= 2) clock.queue_free() @@ -101,29 +163,52 @@ func _validate_persistent_host_clock() -> void: var clock := WorldTimeServiceType.new() root.add_child(clock) assert(clock.restore_persistent_time_hours(18.75)) - clock.set_persistence_tracking_enabled(true) - clock.begin_session(clock.get_persistent_time_hours()) + clock.begin_test_session(18.75) assert(is_equal_approx(clock.get_time_hours(), 18.75)) clock.synchronize_time(19.25) assert(is_equal_approx(clock.get_persistent_time_hours(), 19.25)) - clock.set_persistence_tracking_enabled(false) clock.synchronize_time(6.5) assert(is_equal_approx(clock.get_time_hours(), 6.5)) - assert(is_equal_approx(clock.get_persistent_time_hours(), 19.25)) + assert(is_equal_approx(clock.get_persistent_time_hours(), 6.5)) assert(not clock.restore_persistent_time_hours(-1.0)) assert(not clock.restore_persistent_time_hours(24.0)) clock.queue_free() +func _validate_system_clock_authority() -> void: + var clock := WorldTimeServiceType.new() + root.add_child(clock) + clock.begin_authoritative_session() + var system_datetime: Dictionary = Time.get_datetime_dict_from_system(false) + var system_hour: float = WorldTimeServiceType.time_hours_from_datetime( + system_datetime + ) + assert(clock.is_using_system_clock()) + assert(_wrapped_time_difference( + clock.get_time_hours(), system_hour + ) < 2.0 / 3600.0) + assert( + clock.get_calendar_date_id() + == WorldTimeServiceType.date_id_from_datetime(system_datetime) + ) + assert(clock.set_authoritative_time(12.0)) + assert(not clock.is_using_system_clock()) + clock.clear_editor_time_override() + assert(clock.is_using_system_clock()) + clock.queue_free() + + func _validate_fishing_availability() -> void: var day_context := FishingContextType.new() - day_context.location_tags = [&"starter_pond"] + # Cover both freshwater habitat families so this test isolates time-of-day + # gating from the separate pond-versus-river availability rules. + day_context.location_tags = [&"starter_pond", &"river"] day_context.is_night = false var night_context := FishingContextType.new() - night_context.location_tags = [&"starter_pond"] + night_context.location_tags = [&"starter_pond", &"river"] night_context.is_night = true var transition_context := FishingContextType.new() - transition_context.location_tags = [&"starter_pond"] + transition_context.location_tags = [&"starter_pond", &"river"] transition_context.is_night = true transition_context.is_day_night_transition = true @@ -165,7 +250,7 @@ func _validate_fishing_availability() -> void: func _validate_fishing_spot_context() -> void: var clock := WorldTimeServiceType.new() - clock.begin_session(20.25) + clock.begin_test_session(20.25, "2026-12-18") var fishing_spot := FishingSpotType.new() fishing_spot.set("_world_time", clock) var region := FishableWaterRegionType.new() @@ -174,6 +259,7 @@ func _validate_fishing_spot_context() -> void: var dusk_context: FishingContext = fishing_spot.build_network_context(region) assert(dusk_context.is_night) assert(dusk_context.is_day_night_transition) + assert(dusk_context.season == CalendarSeasonType.Season.WINTER) clock.synchronize_time(14.0) var day_context: FishingContext = fishing_spot.build_network_context(region) assert(not day_context.is_night) @@ -187,16 +273,25 @@ func _validate_network_snapshot_bounds() -> void: assert(NetworkWorldTimeServiceType.validate_snapshot({ "session_id": "session", "time_hours": 8.25, + "calendar_date_id": "2026-08-18", "sequence": 1, })) assert(not NetworkWorldTimeServiceType.validate_snapshot({ "session_id": "session", "time_hours": 24.0, + "calendar_date_id": "2026-08-18", "sequence": 1, })) assert(not NetworkWorldTimeServiceType.validate_snapshot({ "session_id": "", "time_hours": 8.0, + "calendar_date_id": "2026-08-18", + "sequence": 1, + })) + assert(not NetworkWorldTimeServiceType.validate_snapshot({ + "session_id": "session", + "time_hours": 8.0, + "calendar_date_id": "2026-02-29", "sequence": 1, })) @@ -209,7 +304,7 @@ func _validate_environment_presentation() -> void: var sky := Sky.new() var sky_material := ShaderMaterial.new() sky_material.shader = preload( - "res://world/environment/netfishing_sky.gdshader" + "res://world/environment/straywild_sky.gdshader" ) sky.sky_material = sky_material environment.sky = sky @@ -246,6 +341,10 @@ func _validate_environment_presentation() -> void: float(runtime_sky_material.get_shader_parameter("moon_visibility")) < 0.01 ) + assert( + float(runtime_sky_material.get_shader_parameter("star_visibility")) + < 0.01 + ) var day_ambient_energy: float = runtime_environment.ambient_light_energy assert(not runtime_environment.fog_enabled) assert(is_equal_approx(runtime_environment.fog_sky_affect, 0.35)) @@ -253,10 +352,13 @@ func _validate_environment_presentation() -> void: "res://world/materials/stylized_water.gdshader" ) var sky_shader: Shader = preload( - "res://world/environment/netfishing_sky.gdshader" + "res://world/environment/straywild_sky.gdshader" ) assert("uniform float fog_horizon_occlusion" in sky_shader.code) assert("fog_horizon_color.rgb" in sky_shader.code) + assert("uniform float star_visibility" in sky_shader.code) + assert("float procedural_star_field" in sky_shader.code) + assert("upper_sky_fade" in sky_shader.code) assert("fog_disabled" in water_shader.code) assert("surface_view_position = view_vertex.xyz" in water_shader.code) assert("surface_view_distance = length(surface_view_position)" in water_shader.code) @@ -268,6 +370,10 @@ func _validate_environment_presentation() -> void: assert("weather_fog_near_amount" in water_shader.code) assert("float weather_fog_alpha = mix(" in water_shader.code) assert("ALPHA = clamp(water_alpha, 0.1, weather_fog_alpha)" in water_shader.code) + assert( + "water_alpha *= mix(0.82, 1.0, contact_stability);" + in water_shader.code + ) assert(is_zero_approx(float( SaltWaterMaterial.get_shader_parameter("weather_fog_amount") ))) @@ -301,6 +407,17 @@ func _validate_environment_presentation() -> void: runtime_sky_material.get_shader_parameter("sun_direction") as Vector3 ) assert(night_moon_visibility > 0.99) + assert( + float(runtime_sky_material.get_shader_parameter("star_visibility")) + > 0.99 + ) + assert(( + runtime_sky_material.get_shader_parameter("star_color") as Color + ).is_equal_approx(WorldTimeVisualController.STAR_COLOR)) + assert(is_equal_approx( + float(runtime_sky_material.get_shader_parameter("star_strength")), + WorldTimeVisualController.STAR_STRENGTH, + )) assert(night_moon_direction.y > 0.85) assert(night_moon_direction.is_equal_approx(-night_sun_direction)) assert(runtime_environment.ambient_light_energy < day_ambient_energy) @@ -339,6 +456,9 @@ func _validate_environment_presentation() -> void: assert(is_equal_approx(float( runtime_sky_material.get_shader_parameter("fog_horizon_occlusion") ), 1.0)) + assert(is_zero_approx(float( + runtime_sky_material.get_shader_parameter("star_visibility") + ))) assert(( runtime_sky_material.get_shader_parameter("fog_horizon_color") as Color ).is_equal_approx(WorldTimeVisualController.NIGHT_FOG)) @@ -425,6 +545,10 @@ func _validate_environment_presentation() -> void: assert(is_zero_approx(float( runtime_sky_material.get_shader_parameter("fog_horizon_occlusion") ))) + var dusk_star_visibility := float( + runtime_sky_material.get_shader_parameter("star_visibility") + ) + assert(dusk_star_visibility > 0.45 and dusk_star_visibility < 0.55) var dusk_horizon: Color = runtime_sky_material.get_shader_parameter( "sky_horizon_color" ) as Color @@ -442,3 +566,8 @@ func _validate_weather_clock_icon() -> void: weather_icon.set_weather(WorldWeatherService.Weather.CLOUDY) assert(weather_icon.tooltip_text == "cloudy") weather_icon.queue_free() + + +static func _wrapped_time_difference(left: float, right: float) -> float: + var difference: float = absf(left - right) + return minf(difference, WorldTimeServiceType.HOURS_PER_DAY - difference) diff --git a/tests/world_weather_validation.gd b/tests/world_weather_validation.gd index a725117..7bc5114 100644 --- a/tests/world_weather_validation.gd +++ b/tests/world_weather_validation.gd @@ -10,6 +10,9 @@ const WorldTimeServiceType = preload("res://world/world_time_service.gd") const WorldTimeVisualControllerType = preload( "res://world/world_time_visual_controller.gd" ) +const PrecipitationOcclusionType = preload( + "res://world/environment/precipitation_occlusion.gd" +) const FishingContextType = preload("res://fishing/fishing_context.gd") const FishingSpotType = preload("res://fishing/fishing_spot.gd") const FishAvailabilityType = preload("res://fish/fish_availability.gd") @@ -26,6 +29,7 @@ func _run() -> void: _validate_weather_scheduler() _validate_authoritative_weather_override() _validate_weather_persistence() + _validate_legacy_forecast_save_migration() _validate_snapshot_bounds() _validate_fishing_weather_seams() _validate_fishing_spot_context() @@ -65,14 +69,9 @@ func _validate_weather_scheduler() -> void: func _duration_is_valid(weather: WorldWeatherServiceType) -> bool: var seconds: float = weather.get_seconds_remaining() - match weather.get_weather(): - WorldWeatherServiceType.Weather.SUNNY: - return seconds >= 480.0 and seconds <= 900.0 - WorldWeatherServiceType.Weather.CLOUDY: - return seconds >= 300.0 and seconds <= 720.0 - WorldWeatherServiceType.Weather.RAINY, WorldWeatherServiceType.Weather.FOGGY: - return seconds >= 300.0 and seconds <= 600.0 - return false + return is_equal_approx( + seconds, WorldWeatherServiceType.WEATHER_PERIOD_SECONDS + ) func _validate_authoritative_weather_override() -> void: @@ -94,7 +93,7 @@ func _validate_authoritative_weather_override() -> void: var clock := WorldTimeServiceType.new() root.add_child(clock) - clock.begin_session(WorldTimeServiceType.DAY_START_HOUR) + clock.begin_test_session(WorldTimeServiceType.DAY_START_HOUR) var schedule: Array[Dictionary] = [] for index: int in WorldWeatherServiceType.DAILY_PLAN_SEGMENT_COUNT: schedule.append({ @@ -159,8 +158,11 @@ func _validate_weather_persistence() -> void: )) weather.set_persistence_tracking_enabled(true) weather.begin_authoritative_session(20260803) - assert(weather.is_raining()) - assert(is_equal_approx(weather.get_seconds_remaining(), 187.5)) + assert(weather.get_weather() == WorldWeatherServiceType.DEFAULT_WEATHER) + assert(is_equal_approx( + weather.get_seconds_remaining(), + WorldWeatherServiceType.WEATHER_PERIOD_SECONDS, + )) assert(not weather.restore_persistent_state( WorldWeatherServiceType.Weather.RAINY, WorldWeatherServiceType.MAX_PERSISTED_SECONDS + 1.0, @@ -184,11 +186,49 @@ func _validate_snapshot_bounds() -> void: assert(not NetworkWorldWeatherServiceType.validate_snapshot({ "session_id": "session", "weather": int(WorldWeatherServiceType.Weather.RAINY), - "seconds_remaining": 1801.0, + "seconds_remaining": 3601.0, "sequence": 2, })) +func _validate_legacy_forecast_save_migration() -> void: + var legacy_schedule: Array[Dictionary] = [] + for index: int in JobCatalog.LEGACY_WEATHER_SEGMENT_COUNT: + legacy_schedule.append({ + "start_hour": fposmod( + WorldTimeService.DAY_START_HOUR + + float(index) * JobCatalog.LEGACY_WEATHER_SEGMENT_HOURS, + WorldTimeService.HOURS_PER_DAY, + ), + "weather": int(WorldWeatherService.Weather.SUNNY), + }) + var legacy_job: Dictionary = { + "id": "legacy-catch", + "title": "legacy catch", + "description": "catch one fish", + "kind": int(JobCatalog.Kind.CATCH_TOTAL), + "target": 1, + "fish_coin": 1, + "experience": 1, + } + var save_data: Dictionary = PlayerJobService.default_save_data() + save_data["host_board"] = { + "plan_id": "legacy-plan", + "cycle": 4, + "schedule_anchor_index": 0, + "jobs": [legacy_job], + "weather_schedule": legacy_schedule, + } + save_data["active_plan_id"] = "legacy-plan" + assert(PlayerJobService.validate_save_data(save_data)) + var jobs := PlayerJobService.new() + assert(jobs.restore_from_save_data(save_data)) + var migrated: Dictionary = jobs.to_save_data() + assert((migrated.get("host_board", {}) as Dictionary).is_empty()) + assert(str(migrated.get("active_plan_id", "")).is_empty()) + jobs.free() + + func _validate_fishing_weather_seams() -> void: var clear_context := FishingContextType.new() var rain_context := FishingContextType.new() @@ -243,7 +283,7 @@ func _validate_weather_presentation() -> void: var sky := Sky.new() var sky_material := ShaderMaterial.new() sky_material.shader = preload( - "res://world/environment/netfishing_sky.gdshader" + "res://world/environment/straywild_sky.gdshader" ) sky.sky_material = sky_material environment.sky = sky @@ -255,7 +295,7 @@ func _validate_weather_presentation() -> void: world_root.add_child(sun) var clock := WorldTimeServiceType.new() world_root.add_child(clock) - clock.begin_session(14.0) + clock.begin_test_session(14.0) var weather := WorldWeatherServiceType.new() world_root.add_child(weather) weather.begin_remote_session() @@ -279,6 +319,34 @@ func _validate_weather_presentation() -> void: var runtime_sky_material := ( runtime_environment.sky.sky_material as ShaderMaterial ) + clock.set_authoritative_time(0.0) + visuals.apply_time_immediately(0.0) + assert(float( + runtime_sky_material.get_shader_parameter("star_visibility") + ) > 0.99) + visuals.apply_weather_immediately( + WorldWeatherServiceType.Weather.CLOUDY + ) + assert(is_equal_approx(float( + runtime_sky_material.get_shader_parameter("star_visibility") + ), 0.18)) + visuals.apply_weather_immediately( + WorldWeatherServiceType.Weather.RAINY + ) + assert(is_equal_approx(float( + runtime_sky_material.get_shader_parameter("star_visibility") + ), 0.03)) + visuals.apply_weather_immediately( + WorldWeatherServiceType.Weather.FOGGY + ) + assert(is_zero_approx(float( + runtime_sky_material.get_shader_parameter("star_visibility") + ))) + visuals.apply_weather_immediately( + WorldWeatherServiceType.Weather.SUNNY + ) + clock.set_authoritative_time(14.0) + visuals.apply_time_immediately(14.0) var clear_background_energy: float = ( runtime_environment.background_energy_multiplier ) @@ -456,11 +524,28 @@ func _validate_weather_presentation() -> void: assert(rain.emitting) assert(rain.amount_ratio > 0.99) assert(rain.amount == WorldTimeVisualControllerType.RAIN_PARTICLE_AMOUNT) + assert( + WorldTimeVisualControllerType.RAIN_EMITTER_OFFSET.y + >= WorldTimeVisualControllerType.RAIN_SUPPORTED_CANOPY_HEIGHT + + WorldTimeVisualControllerType.RAIN_CANOPY_CLEARANCE + ) + assert(is_equal_approx( + rain.lifetime, + WorldTimeVisualControllerType.RAIN_LIFETIME_SECONDS, + )) assert(rain.visibility_aabb == ( WorldTimeVisualControllerType.RAIN_VISIBILITY_AABB )) var rain_material := rain.process_material as ParticleProcessMaterial assert(rain_material != null) + assert( + rain_material.collision_mode + == ParticleProcessMaterial.COLLISION_HIDE_ON_CONTACT + ) + assert(is_equal_approx( + rain.collision_base_size, + WorldTimeVisualControllerType.RAIN_COLLISION_BASE_SIZE, + )) assert(rain_material.emission_box_extents.is_equal_approx( WorldTimeVisualControllerType.RAIN_EMISSION_EXTENTS )) @@ -472,11 +557,39 @@ func _validate_weather_presentation() -> void: rain_material.initial_velocity_max, WorldTimeVisualControllerType.RAIN_VELOCITY_MAX, )) + assert(rain_material.gravity.is_equal_approx( + WorldTimeVisualControllerType.RAIN_GRAVITY + )) var rain_mesh := rain.draw_pass_1 as BoxMesh assert(rain_mesh != null) assert(rain_mesh.size.is_equal_approx( WorldTimeVisualControllerType.RAIN_DROP_SIZE )) + var rain_collision := visuals.get_node( + "LocalRainCanopyCollision" + ) as GPUParticlesCollisionHeightField3D + assert(rain_collision != null) + assert(rain_collision.follow_camera_enabled) + assert( + rain_collision.resolution + == GPUParticlesCollisionHeightField3D.RESOLUTION_256 + ) + assert( + rain_collision.update_mode + == GPUParticlesCollisionHeightField3D.UPDATE_MODE_WHEN_MOVED + ) + assert(rain_collision.size.is_equal_approx( + WorldTimeVisualControllerType.RAIN_COLLISION_SIZE + )) + assert( + rain_collision.size.y * 0.5 + > WorldTimeVisualControllerType.RAIN_EMITTER_OFFSET.y + + WorldTimeVisualControllerType.RAIN_EMISSION_EXTENTS.y + ) + assert( + rain_collision.heightfield_mask + == PrecipitationOcclusionType.RENDER_LAYER_MASK + ) visuals.call( "_on_weather_changed", WorldWeatherServiceType.Weather.SUNNY, diff --git a/tools/art/export_creature_art.py b/tools/art/export_creature_art.py new file mode 100644 index 0000000..758be87 --- /dev/null +++ b/tools/art/export_creature_art.py @@ -0,0 +1,256 @@ +#!/usr/bin/env python3 +"""Export cataloged creature artwork with consistent transparent margins.""" + +from __future__ import annotations + +import argparse +import hashlib +import re +import sys +import zipfile +import xml.etree.ElementTree as ET +from pathlib import Path + +from PIL import Image + + +TABLE_NAMESPACE = "urn:oasis:names:tc:opendocument:xmlns:table:1.0" +TABLE_ATTRIBUTE = "{%s}" % TABLE_NAMESPACE +NAMESPACES = {"table": TABLE_NAMESPACE} +VALID_EXPORT_SIZES = {64, 128, 256, 512} +SAFE_AREA_RATIO = 0.875 +KNOWN_SOURCE_ALIASES = { + # The delivered filename predates the catalog's authoritative species ID. + "bowfish": "bowfin", +} + + +def parse_arguments() -> argparse.Namespace: + parser = argparse.ArgumentParser( + description=( + "Export PNG creature art according to the catalog's recommended " + "canvas size, using alpha-bound trimming and nearest-neighbor scaling." + ) + ) + parser.add_argument("--tracker", required=True, type=Path) + parser.add_argument("--source", required=True, type=Path) + parser.add_argument("--output", required=True, type=Path) + parser.add_argument( + "--skip", + action="append", + default=[], + help="Catalog creature ID or source filename stem to skip; repeat as needed.", + ) + parser.add_argument( + "--dry-run", + action="store_true", + help="Validate and report the batch without writing output files.", + ) + return parser.parse_args() + + +def normalize_name(value: str) -> str: + normalized = value.strip().lower().replace("&", " and ") + normalized = re.sub(r"[^a-z0-9]+", "_", normalized) + return normalized.strip("_") + + +def expanded_row_values(row: ET.Element) -> list[str]: + values: list[str] = [] + for cell in row.findall("table:table-cell", NAMESPACES): + repeat = int( + cell.attrib.get( + TABLE_ATTRIBUTE + "number-columns-repeated", + "1", + ) + ) + values.extend(["".join(cell.itertext()).strip()] * repeat) + return values + + +def load_catalog(tracker_path: Path) -> list[dict[str, str]]: + with zipfile.ZipFile(tracker_path) as archive: + root = ET.fromstring(archive.read("content.xml")) + table = root.find(".//table:table", NAMESPACES) + if table is None: + raise ValueError("tracker does not contain a table") + rows = table.findall("table:table-row", NAMESPACES) + if not rows: + raise ValueError("tracker table is empty") + headers = expanded_row_values(rows[0]) + required_headers = { + "catalog_number", + "display_name", + "id", + "recommended_export_canvas_px", + } + missing_headers = required_headers.difference(headers) + if missing_headers: + raise ValueError( + "tracker is missing required columns: " + + ", ".join(sorted(missing_headers)) + ) + records: list[dict[str, str]] = [] + for row in rows[1:]: + values = expanded_row_values(row) + if not any(values): + continue + record = dict(zip(headers, values)) + if record.get("id", "").strip(): + records.append(record) + return records + + +def catalog_lookup(records: list[dict[str, str]]) -> dict[str, dict[str, str]]: + lookup: dict[str, dict[str, str]] = {} + for record in records: + keys = { + normalize_name(record["catalog_number"]), + normalize_name(record["id"]), + normalize_name(record["display_name"]), + } + for key in keys: + previous = lookup.get(key) + if previous is not None and previous["id"] != record["id"]: + raise ValueError( + f"ambiguous normalized catalog name {key!r}: " + f"{previous['id']} and {record['id']}" + ) + lookup[key] = record + return lookup + + +def resolve_record( + source_path: Path, + lookup: dict[str, dict[str, str]], +) -> dict[str, str]: + source_key = normalize_name(source_path.stem) + catalog_key = KNOWN_SOURCE_ALIASES.get(source_key, source_key) + record = lookup.get(catalog_key) + if record is None: + raise ValueError( + f"cannot map source {source_path.name!r} to one catalog creature" + ) + return record + + +def normalize_artwork(source_path: Path, canvas_size: int) -> tuple[Image.Image, tuple[int, int, int, int], tuple[int, int]]: + with Image.open(source_path) as source_image: + artwork = source_image.convert("RGBA") + alpha_bounds = artwork.getchannel("A").getbbox() + if alpha_bounds is None: + raise ValueError(f"source {source_path.name!r} is fully transparent") + visible = artwork.crop(alpha_bounds) + safe_long_side = round(canvas_size * SAFE_AREA_RATIO) + scale = safe_long_side / max(visible.width, visible.height) + scaled_size = ( + max(1, round(visible.width * scale)), + max(1, round(visible.height * scale)), + ) + visible = visible.resize(scaled_size, Image.Resampling.NEAREST) + canvas = Image.new("RGBA", (canvas_size, canvas_size), (0, 0, 0, 0)) + offset = ( + (canvas_size - scaled_size[0]) // 2, + (canvas_size - scaled_size[1]) // 2, + ) + canvas.alpha_composite(visible, offset) + return canvas, alpha_bounds, scaled_size + + +def sha256(path: Path) -> str: + digest = hashlib.sha256() + with path.open("rb") as source: + for block in iter(lambda: source.read(1024 * 1024), b""): + digest.update(block) + return digest.hexdigest() + + +def main() -> int: + arguments = parse_arguments() + records = load_catalog(arguments.tracker) + lookup = catalog_lookup(records) + skip_keys = {normalize_name(value) for value in arguments.skip} + source_paths = sorted(arguments.source.glob("*.png")) + if not source_paths: + raise ValueError(f"no PNG files found under {arguments.source}") + + resolved_by_output: dict[str, tuple[Path, dict[str, str]]] = {} + for source_path in source_paths: + record = resolve_record(source_path, lookup) + source_key = normalize_name(source_path.stem) + creature_key = normalize_name(record["id"]) + if source_key in skip_keys or creature_key in skip_keys: + print(f"SKIP {source_path.name} -> {record['id']}") + continue + output_name = f"{record['catalog_number']}.png" + previous = resolved_by_output.get(output_name) + if previous is not None: + previous_path, _previous_record = previous + catalog_key = normalize_name(record["catalog_number"]) + previous_is_numbered = ( + normalize_name(previous_path.stem) == catalog_key + ) + current_is_numbered = source_key == catalog_key + if current_is_numbered and not previous_is_numbered: + print( + "SUPERSEDE " + f"{previous_path.name} with numbered source " + f"{source_path.name} -> {record['id']}" + ) + resolved_by_output[output_name] = (source_path, record) + continue + if previous_is_numbered and not current_is_numbered: + print( + "SKIP " + f"{source_path.name}; numbered source " + f"{previous_path.name} takes precedence -> {record['id']}" + ) + continue + raise ValueError( + f"duplicate sources for output filename {output_name}: " + f"{previous_path.name} and {source_path.name}" + ) + resolved_by_output[output_name] = (source_path, record) + + resolved = list(resolved_by_output.values()) + + if not arguments.dry_run: + arguments.output.mkdir(parents=True, exist_ok=True) + + for source_path, record in resolved: + canvas_size = int(record["recommended_export_canvas_px"]) + if canvas_size not in VALID_EXPORT_SIZES: + raise ValueError( + f"{record['id']} has invalid export size {canvas_size}" + ) + image, alpha_bounds, scaled_size = normalize_artwork( + source_path, + canvas_size, + ) + output_path = arguments.output / f"{record['catalog_number']}.png" + if not arguments.dry_run: + image.save(output_path, format="PNG", optimize=False, compress_level=6) + output_hash = sha256(output_path) + else: + output_hash = "dry-run" + print( + "EXPORT " + f"{source_path.name} -> {output_path.name} " + f"id={record['id']} canvas={canvas_size}x{canvas_size} " + f"alpha_bounds={alpha_bounds} visible={scaled_size[0]}x{scaled_size[1]} " + f"source_sha256={sha256(source_path)} output_sha256={output_hash}" + ) + + print( + f"Complete: {len(resolved)} export(s), " + f"{len(source_paths) - len(resolved)} skipped." + ) + return 0 + + +if __name__ == "__main__": + try: + raise SystemExit(main()) + except (OSError, ValueError, zipfile.BadZipFile) as error: + print(f"ERROR: {error}", file=sys.stderr) + raise SystemExit(1) diff --git a/tools/blender/export_terrain_chunks.py b/tools/blender/export_terrain_chunks.py new file mode 100644 index 0000000..d4a278e --- /dev/null +++ b/tools/blender/export_terrain_chunks.py @@ -0,0 +1,873 @@ +#!/usr/bin/env python3 +"""Export convention-named terrain chunk collections to individual GLBs. + +Run through Blender rather than a standalone Python interpreter: + + blender --background terrain_chunks.blend \ + --python tools/blender/export_terrain_chunks.py -- \ + --output /path/to/terrain_chunks + +Collections use ``chunk_####_description`` and contain one primary terrain +mesh named ``chunk_####``. Additional production objects may live in the same +collection. Reusable procedural props use individual ``prop_description`` +mesh objects. Their child empties are exported with them so authored sockets +remain attached to the prop. Props may be arranged anywhere in the source file +because each root object's authored origin becomes the exported runtime anchor. +A same-named ``prop_description`` collection remains supported for multi-object +props. Unrelated objects and collections are ignored. +""" + +from __future__ import annotations + +import argparse +import hashlib +import json +import math +import re +import struct +import sys +from dataclasses import dataclass +from pathlib import Path +from typing import Iterable + +import bpy +from mathutils import Vector + + +CHUNK_SIZE_METERS = 10.0 +# Match the runtime boundary analyzer's five-millimeter authoring tolerance. +DEFAULT_TOLERANCE = 0.005 +COLLECTION_PATTERN = re.compile( + r"^chunk_(?P\d{4})(?:_(?P